@opencode-ai/client
Advanced tools
| import { Effect, FileSystem, Schema } from "effect"; | ||
| import type { DiscoverOptions, Endpoint, StartOptions, StopOptions } from "../service.js"; | ||
| import type { DiscoverOptions, Endpoint, EnsureOptions, StopOptions } from "../service.js"; | ||
| export * from "../service.js"; | ||
@@ -16,3 +16,3 @@ /** Contents of the local service registration file. */ | ||
| /** Ensure a healthy, compatible local service is running. */ | ||
| export declare const start: (options?: StartOptions | undefined) => Effect.Effect<Endpoint, Error, FileSystem.FileSystem>; | ||
| export declare const ensure: (options?: EnsureOptions | undefined) => Effect.Effect<Endpoint, Error, FileSystem.FileSystem>; | ||
| /** Stop the registered local service. */ | ||
@@ -42,3 +42,3 @@ export declare const stop: (options?: StopOptions | undefined) => Effect.Effect<void, Error, FileSystem.FileSystem>; | ||
| } | undefined, never, FileSystem.FileSystem>; | ||
| start: (options?: StartOptions | undefined) => Effect.Effect<Endpoint, Error, FileSystem.FileSystem>; | ||
| ensure: (options?: EnsureOptions | undefined) => Effect.Effect<Endpoint, Error, FileSystem.FileSystem>; | ||
| stop: (options?: StopOptions | undefined) => Effect.Effect<void, Error, FileSystem.FileSystem>; | ||
@@ -45,0 +45,0 @@ headers: typeof headers; |
@@ -8,3 +8,3 @@ import { ServiceStatus } from "@opencode-ai/protocol/groups/health"; | ||
| // Read-only lookup: registration file plus health check and version gate. | ||
| // Never spawns; escalation to start() is the caller's policy. | ||
| // Never spawns; escalation to ensure() is the caller's policy. | ||
| /** Discover a healthy, compatible local service without starting one. */ | ||
@@ -26,3 +26,3 @@ export const discover = Effect.fn("service.discover")(function* (options = {}) { | ||
| /** Ensure a healthy, compatible local service is running. */ | ||
| export const start = Effect.fn("service.start")(function* (options = {}) { | ||
| export const ensure = Effect.fn("service.ensure")(function* (options = {}) { | ||
| const contenders = new Set(); | ||
@@ -190,3 +190,3 @@ let announced = false; | ||
| }); | ||
| // 50ms cadence bounded at ~5s, shared by stop escalation and each start | ||
| // 50ms cadence bounded at ~5s, shared by stop escalation and each ensure | ||
| // discovery window. | ||
@@ -244,2 +244,2 @@ const poll = Schedule.spaced("50 millis").pipe(Schedule.both(Schedule.recurs(100))); | ||
| /** Effect-based local service lifecycle operations. */ | ||
| export const Service = { discover, start, stop, headers, Info }; | ||
| export const Service = { discover, ensure, stop, headers, Info }; |
@@ -1,2 +0,2 @@ | ||
| import type { DiscoverOptions, Endpoint, StartOptions, StopOptions } from "../service.js"; | ||
| import type { DiscoverOptions, Endpoint, EnsureOptions, StopOptions } from "../service.js"; | ||
| export * from "../service.js"; | ||
@@ -6,3 +6,3 @@ /** Discover a healthy, compatible local service without starting one. */ | ||
| /** Ensure a healthy, compatible local service is running. */ | ||
| export declare function start(options?: StartOptions): Promise<Endpoint>; | ||
| export declare function ensure(options?: EnsureOptions): Promise<Endpoint>; | ||
| /** Stop the registered local service. */ | ||
@@ -17,5 +17,5 @@ export declare function stop(options?: StopOptions): Promise<void>; | ||
| discover: typeof discover; | ||
| start: typeof start; | ||
| ensure: typeof ensure; | ||
| stop: typeof stop; | ||
| headers: typeof headers; | ||
| }; |
@@ -19,3 +19,3 @@ import { readFile } from "node:fs/promises"; | ||
| /** Ensure a healthy, compatible local service is running. */ | ||
| export async function start(options = {}) { | ||
| export async function ensure(options = {}) { | ||
| const contenders = new Set(); | ||
@@ -231,2 +231,2 @@ let announced = false; | ||
| /** Promise-based local service lifecycle operations. */ | ||
| export const Service = { discover, start, stop, headers }; | ||
| export const Service = { discover, ensure, stop, headers }; |
@@ -22,10 +22,10 @@ /** Connection details for a local OpenCode service. */ | ||
| }; | ||
| /** Reason a new service process must be started. */ | ||
| export type StartReason = "missing" | "version-mismatch"; | ||
| /** Reason ensuring the service requires a new process. */ | ||
| export type EnsureReason = "missing" | "version-mismatch"; | ||
| /** Options used to ensure the local OpenCode service is running. */ | ||
| export type StartOptions = DiscoverOptions & { | ||
| export type EnsureOptions = DiscoverOptions & { | ||
| /** Service command and arguments. Defaults to `opencode serve --service`. */ | ||
| readonly command?: ReadonlyArray<string>; | ||
| /** Called once before spawning a new service process. */ | ||
| readonly onStart?: (reason: StartReason, previousVersion?: string) => void; | ||
| readonly onStart?: (reason: EnsureReason, previousVersion?: string) => void; | ||
| }; | ||
@@ -32,0 +32,0 @@ /** Options used to stop the local OpenCode service. */ |
+4
-4
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "name": "@opencode-ai/client", | ||
| "version": "0.0.0-next-15613", | ||
| "version": "0.0.0-next-15614", | ||
| "type": "module", | ||
@@ -56,4 +56,4 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "@opencode-ai/schema": "0.0.0-next-15613", | ||
| "@opencode-ai/protocol": "0.0.0-next-15613" | ||
| "@opencode-ai/schema": "0.0.0-next-15614", | ||
| "@opencode-ai/protocol": "0.0.0-next-15614" | ||
| }, | ||
@@ -70,3 +70,3 @@ "peerDependencies": { | ||
| "@effect/platform-node": "4.0.0-beta.83", | ||
| "@opencode-ai/httpapi-codegen": "0.0.0-next-15613", | ||
| "@opencode-ai/httpapi-codegen": "0.0.0-next-15614", | ||
| "@tsconfig/bun": "1.0.9", | ||
@@ -73,0 +73,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.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
736955
04
-20%+ Added
+ Added
- Removed
- Removed