@opencode-ai/client
Advanced tools
@@ -20,3 +20,8 @@ import { ServiceStatus } from "@opencode-ai/protocol/groups/health"; | ||
| export const discover = Effect.fn("service.discover")(function* (options = {}) { | ||
| return (yield* discoverLocal(options))?.endpoint; | ||
| const found = (yield* registered(options.file)).service; | ||
| if (found?.state !== "ready") | ||
| return undefined; | ||
| if (!matchesVersion(found.version, options)) | ||
| return undefined; | ||
| return found.endpoint; | ||
| }); | ||
@@ -33,10 +38,2 @@ /** Recognize an authenticated compatible service bound to an expected URL, including while it starts or fails. */ | ||
| }); | ||
| const discoverLocal = Effect.fnUntraced(function* (options) { | ||
| const found = (yield* registered(options.file)).service; | ||
| if (found?.state !== "ready") | ||
| return undefined; | ||
| if (!matchesVersion(found.version, options)) | ||
| return undefined; | ||
| return found; | ||
| }); | ||
| // Idempotent ensure-running: reuses a healthy compatible server, replaces a | ||
@@ -43,0 +40,0 @@ // version-mismatched one, and otherwise spawns small contenders until a server |
@@ -15,5 +15,2 @@ import { readFile, rm } from "node:fs/promises"; | ||
| export async function discover(options = {}) { | ||
| return (await discoverLocal(options))?.endpoint; | ||
| } | ||
| async function discoverLocal(options) { | ||
| const found = (await registered(options.file)).service; | ||
@@ -24,3 +21,3 @@ if (found?.state !== "ready") | ||
| return undefined; | ||
| return found; | ||
| return found.endpoint; | ||
| } | ||
@@ -139,5 +136,2 @@ /** Ensure a healthy, compatible local service is running. */ | ||
| } | ||
| async function probe(info, allowLegacy = false) { | ||
| return (await probeResult(info, allowLegacy)).service; | ||
| } | ||
| async function probeResult(info, allowLegacy = false, timeout = defaultEnsureTiming.requestTimeout) { | ||
@@ -144,0 +138,0 @@ const endpoint = { |
+4
-4
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "name": "@opencode-ai/client", | ||
| "version": "0.0.0-dev-17852", | ||
| "version": "0.0.0-dev-17853", | ||
| "type": "module", | ||
@@ -60,4 +60,4 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "@opencode-ai/schema": "0.0.0-dev-17852", | ||
| "@opencode-ai/protocol": "0.0.0-dev-17852" | ||
| "@opencode-ai/schema": "0.0.0-dev-17853", | ||
| "@opencode-ai/protocol": "0.0.0-dev-17853" | ||
| }, | ||
@@ -78,3 +78,3 @@ "peerDependencies": { | ||
| "@effect/platform-node": "4.0.0-rc.110", | ||
| "@opencode-ai/httpapi-codegen": "0.0.0-dev-17852", | ||
| "@opencode-ai/httpapi-codegen": "0.0.0-dev-17853", | ||
| "@tsconfig/bun": "1.0.9", | ||
@@ -81,0 +81,0 @@ "@types/bun": "1.3.13", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
707619
-0.04%17167
-0.05%+ Added
+ Added
- Removed
- Removed