@opencode-ai/client
Advanced tools
@@ -99,10 +99,8 @@ import { ServiceStatus } from "@opencode-ai/protocol/groups/health"; | ||
| yield* announce("version-mismatch", service.version); | ||
| if (!service.legacy && service.state === "ready") | ||
| yield* Effect.tryPromise(() => PtyHandoff.prepare(options.file ?? fallback(), service.info, timing.requestTimeout)); | ||
| else { | ||
| if (!service.legacy) | ||
| yield* Effect.logWarning("Background service is not ready; replacement cannot preserve persistent terminals"); | ||
| yield* Effect.tryPromise(() => PtyHandoff.clear(options.file ?? fallback())); | ||
| } | ||
| yield* terminate(service.info, options, timing).pipe(Effect.ignore); | ||
| if (!service.legacy && service.state !== "ready") | ||
| yield* Effect.logWarning("Background service is not ready; replacement cannot preserve persistent terminals"); | ||
| yield* stop({ | ||
| file: options.file, | ||
| pty: !service.legacy && service.state === "ready" ? "handoff" : "clear", | ||
| }).pipe(Effect.ignore); | ||
| lastSpawn = 0; | ||
@@ -138,4 +136,7 @@ return Option.none(); | ||
| export const stop = Effect.fn("service.stop")(function* (options = {}) { | ||
| yield* Effect.tryPromise(() => PtyHandoff.clear(options.file ?? fallback())); | ||
| const info = yield* read(options.file); | ||
| if (options.pty === "handoff" && info !== undefined) | ||
| yield* Effect.tryPromise(() => PtyHandoff.prepare(options.file ?? fallback(), info, defaultEnsureTiming.requestTimeout)); | ||
| else | ||
| yield* Effect.tryPromise(() => PtyHandoff.clear(options.file ?? fallback())); | ||
| if (info !== undefined) | ||
@@ -142,0 +143,0 @@ yield* terminate(info, options, defaultEnsureTiming); |
@@ -82,10 +82,8 @@ import { readFile, rm } from "node:fs/promises"; | ||
| announce("version-mismatch", service.version); | ||
| if (!service.legacy && service.state === "ready") | ||
| await PtyHandoff.prepare(options.file ?? fallback(), service.info, timing.requestTimeout); | ||
| else { | ||
| if (!service.legacy) | ||
| console.warn("Background service is not ready; replacement cannot preserve persistent terminals"); | ||
| await PtyHandoff.clear(options.file ?? fallback()); | ||
| } | ||
| await terminate(service.info, options, timing).catch(() => undefined); | ||
| if (!service.legacy && service.state !== "ready") | ||
| console.warn("Background service is not ready; replacement cannot preserve persistent terminals"); | ||
| await stop({ | ||
| file: options.file, | ||
| pty: !service.legacy && service.state === "ready" ? "handoff" : "clear", | ||
| }).catch(() => undefined); | ||
| lastSpawn = 0; | ||
@@ -121,4 +119,7 @@ } | ||
| export async function stop(options = {}) { | ||
| await PtyHandoff.clear(options.file ?? fallback()); | ||
| const info = await read(options.file); | ||
| if (options.pty === "handoff" && info !== undefined) | ||
| await PtyHandoff.prepare(options.file ?? fallback(), info, defaultEnsureTiming.requestTimeout); | ||
| else | ||
| await PtyHandoff.clear(options.file ?? fallback()); | ||
| if (info !== undefined) | ||
@@ -125,0 +126,0 @@ await terminate(info, options, defaultEnsureTiming); |
@@ -37,2 +37,4 @@ /** Connection details for a local OpenCode service. */ | ||
| readonly file?: string; | ||
| /** How to handle persistent terminals before stopping the service. */ | ||
| readonly pty?: "clear" | "handoff"; | ||
| }; | ||
@@ -39,0 +41,0 @@ /** Contents of the local service registration file. */ |
+4
-4
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "name": "@opencode-ai/client", | ||
| "version": "0.0.0-dev-18822", | ||
| "version": "0.0.0-dev-18825", | ||
| "type": "module", | ||
@@ -60,4 +60,4 @@ "license": "MIT", | ||
| "dependencies": { | ||
| "@opencode-ai/schema": "0.0.0-dev-18822", | ||
| "@opencode-ai/protocol": "0.0.0-dev-18822" | ||
| "@opencode-ai/schema": "0.0.0-dev-18825", | ||
| "@opencode-ai/protocol": "0.0.0-dev-18825" | ||
| }, | ||
@@ -78,3 +78,3 @@ "peerDependencies": { | ||
| "@effect/platform-node": "4.0.0-rc.112", | ||
| "@opencode-ai/httpapi-codegen": "0.0.0-dev-18822", | ||
| "@opencode-ai/httpapi-codegen": "0.0.0-dev-18825", | ||
| "@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.
1034844
0.01%22946
0.02%+ Added
+ Added
- Removed
- Removed