Sign In

@opencode-ai/client

Package Overview
Dependencies
Maintainers
2
Versions
850
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opencode-ai/client - npm Package Compare versions

Comparing version
0.0.0-next-17307
to
0.0.0-next-17311
+2
dist/service-version.d.ts
import type { DiscoverOptions } from "./service.js";
export declare function matchesVersion(version: string | undefined, options: DiscoverOptions): boolean;
export function matchesVersion(version, options) {
if (options.version === undefined)
return true;
if (version === undefined)
return false;
if (typeof options.version === "function")
return options.version(version);
return version === options.version;
}
+4
-3

@@ -7,2 +7,3 @@ import { ServiceStatus } from "@opencode-ai/protocol/groups/health";

import { defaultEnsureTiming, ensureTiming } from "../service-timing.js";
import { matchesVersion } from "../service-version.js";
export * from "../service.js";

@@ -28,3 +29,3 @@ // Find, start, and stop the local opencode background service.

return undefined;
if (options.version !== undefined && found.version !== options.version)
if (!matchesVersion(found.version, options))
return undefined;

@@ -37,3 +38,3 @@ return { endpoint: found.endpoint, state: found.state };

return undefined;
if (options.version !== undefined && found.version !== options.version)
if (!matchesVersion(found.version, options))
return undefined;

@@ -90,3 +91,3 @@ return found;

spawnDelay = timing.spawnDelay;
const compatible = !service.legacy && (options.version === undefined || service.version === options.version);
const compatible = !service.legacy && matchesVersion(service.version, options);
if (compatible && service.state === "ready")

@@ -93,0 +94,0 @@ return Option.some(service);

@@ -6,2 +6,3 @@ import { readFile } from "node:fs/promises";

import { defaultEnsureTiming, ensureTiming } from "../service-timing.js";
import { matchesVersion } from "../service-version.js";
export * from "../service.js";

@@ -21,3 +22,3 @@ // Find, start, and stop the local opencode background service.

return undefined;
if (options.version !== undefined && found.version !== options.version)
if (!matchesVersion(found.version, options))
return undefined;

@@ -74,3 +75,3 @@ return found;

const service = registration.service;
const compatible = !service.legacy && (options.version === undefined || service.version === options.version);
const compatible = !service.legacy && matchesVersion(service.version, options);
if (compatible && service.state === "ready")

@@ -77,0 +78,0 @@ return service.endpoint;

@@ -19,4 +19,4 @@ /** Connection details for a local OpenCode service. */

readonly file?: string;
/** Required service version. */
readonly version?: string;
/** Required exact service version or compatibility predicate. */
readonly version?: string | ((version: string) => boolean);
};

@@ -23,0 +23,0 @@ /** Reason ensuring the service requires a new process. */

{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/client",
"version": "0.0.0-next-17307",
"version": "0.0.0-next-17311",
"type": "module",

@@ -56,4 +56,4 @@ "license": "MIT",

"dependencies": {
"@opencode-ai/schema": "0.0.0-next-17307",
"@opencode-ai/protocol": "0.0.0-next-17307"
"@opencode-ai/schema": "0.0.0-next-17311",
"@opencode-ai/protocol": "0.0.0-next-17311"
},

@@ -70,3 +70,3 @@ "peerDependencies": {

"@effect/platform-node": "4.0.0-beta.101",
"@opencode-ai/httpapi-codegen": "0.0.0-next-17307",
"@opencode-ai/httpapi-codegen": "0.0.0-next-17311",
"@tsconfig/bun": "1.0.9",

@@ -73,0 +73,0 @@ "@types/bun": "1.3.13",