@opencode/client 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/effect/api/api.d.ts +9 -3
- package/dist/effect/client.d.ts +14 -1
- package/dist/effect/generated/client.d.ts +15 -2
- package/dist/effect/generated/client.js +7 -3
- package/dist/effect/service.js +8 -8
- package/dist/promise/client.d.ts +3 -1
- package/dist/promise/generated/client.d.ts +4 -2
- package/dist/promise/generated/client.js +24 -3
- package/dist/promise/generated/types.d.ts +45 -9
- package/dist/promise/generated/types.js +1 -1
- package/dist/promise/service.js +8 -8
- package/package.json +4 -4
package/dist/effect/api/api.d.ts
CHANGED
|
@@ -37,14 +37,17 @@ import type { Worktree } from "@opencode/schema/worktree";
|
|
|
37
37
|
import type { Vcs } from "@opencode/schema/vcs";
|
|
38
38
|
import type { WebSearch } from "@opencode/schema/websearch";
|
|
39
39
|
import type { Config } from "@opencode/schema/config";
|
|
40
|
-
export type
|
|
40
|
+
export type ServerInfoOutput = {
|
|
41
41
|
readonly version: string;
|
|
42
42
|
readonly pid: number;
|
|
43
43
|
readonly urls: ReadonlyArray<string>;
|
|
44
|
+
readonly paths: {
|
|
45
|
+
readonly tmp: string;
|
|
46
|
+
};
|
|
44
47
|
};
|
|
45
|
-
export type
|
|
48
|
+
export type ServerInfoOperation<E = never> = () => Effect.Effect<ServerInfoOutput, E>;
|
|
46
49
|
export interface ServerApi<E = never> {
|
|
47
|
-
readonly
|
|
50
|
+
readonly info: ServerInfoOperation<E>;
|
|
48
51
|
}
|
|
49
52
|
export type LocationGetInput = {
|
|
50
53
|
readonly location?: {
|
|
@@ -53,8 +56,11 @@ export type LocationGetInput = {
|
|
|
53
56
|
};
|
|
54
57
|
export type LocationGetOutput = Location.PublicInfo;
|
|
55
58
|
export type LocationGetOperation<E = never> = (input?: LocationGetInput) => Effect.Effect<LocationGetOutput, E>;
|
|
59
|
+
export type LocationReloadOutput = void;
|
|
60
|
+
export type LocationReloadOperation<E = never> = () => Effect.Effect<LocationReloadOutput, E>;
|
|
56
61
|
export interface LocationApi<E = never> {
|
|
57
62
|
readonly get: LocationGetOperation<E>;
|
|
63
|
+
readonly reload: LocationReloadOperation<E>;
|
|
58
64
|
}
|
|
59
65
|
export type AgentListInput = {
|
|
60
66
|
readonly location?: {
|
package/dist/effect/client.d.ts
CHANGED
|
@@ -1896,6 +1896,18 @@ export declare const make: (options?: {
|
|
|
1896
1896
|
readonly metadata?: {
|
|
1897
1897
|
readonly [x: string]: unknown;
|
|
1898
1898
|
} | undefined;
|
|
1899
|
+
} | {
|
|
1900
|
+
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
1901
|
+
readonly data: {};
|
|
1902
|
+
readonly type: "location.shutdown";
|
|
1903
|
+
readonly created: number;
|
|
1904
|
+
readonly location?: {
|
|
1905
|
+
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
1906
|
+
readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
|
|
1907
|
+
} | undefined;
|
|
1908
|
+
readonly metadata?: {
|
|
1909
|
+
readonly [x: string]: unknown;
|
|
1910
|
+
} | undefined;
|
|
1899
1911
|
} | {
|
|
1900
1912
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
1901
1913
|
readonly data: {
|
|
@@ -2232,10 +2244,11 @@ export declare const make: (options?: {
|
|
|
2232
2244
|
call: (input: import("./api.js").RpcCallInput) => Effect.Effect<import("./api.js").RpcCallOutput, import("@opencode/protocol/errors").InvalidRequestError | import("@opencode/protocol/errors").RpcError | import("@opencode/protocol/errors").RpcInternalError | import("@opencode/protocol/errors").UnauthorizedError | import("effect/Schema").SchemaError | ClientError | import("effect/unstable/http/HttpClientError").HttpClientError, never>;
|
|
2233
2245
|
};
|
|
2234
2246
|
server: {
|
|
2235
|
-
|
|
2247
|
+
info: () => Effect.Effect<import("./api.js").ServerInfoOutput, import("@opencode/protocol/errors").InvalidRequestError | import("@opencode/protocol/errors").UnauthorizedError | import("effect/Schema").SchemaError | ClientError | import("effect/unstable/http/HttpClientError").HttpClientError, never>;
|
|
2236
2248
|
};
|
|
2237
2249
|
location: {
|
|
2238
2250
|
get: (input?: import("./api.js").LocationGetInput) => Effect.Effect<import("@opencode/schema/location").PublicInfo, import("@opencode/protocol/errors").InvalidRequestError | import("@opencode/protocol/errors").UnauthorizedError | import("effect/Schema").SchemaError | ClientError | import("effect/unstable/http/HttpClientError").HttpClientError, never>;
|
|
2251
|
+
reload: () => Effect.Effect<void, import("@opencode/protocol/errors").InvalidRequestError | import("@opencode/protocol/errors").UnauthorizedError | import("@opencode/protocol/errors").ServiceUnavailableError | import("effect/Schema").SchemaError | ClientError | import("effect/unstable/http/HttpClientError").HttpClientError, never>;
|
|
2239
2252
|
};
|
|
2240
2253
|
agent: {
|
|
2241
2254
|
list: (input?: import("./api.js").AgentListInput) => Effect.Effect<import("./api.js").AgentListOutput, import("@opencode/protocol/errors").InvalidRequestError | import("@opencode/protocol/errors").UnauthorizedError | import("effect/Schema").SchemaError | ClientError | import("effect/unstable/http/HttpClientError").HttpClientError, never>;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { Effect, Stream, Schema } from "effect";
|
|
2
2
|
import { Sse } from "effect/unstable/encoding";
|
|
3
3
|
import { HttpClientError } from "effect/unstable/http";
|
|
4
|
-
import type {
|
|
4
|
+
import type { ServerInfoOutput, LocationGetInput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, PluginCheckInput, PluginCheckOutput, PluginUpdateInput, SessionListInput, SessionListOutput, SessionStatsInput, SessionStatsOutput, SessionCreateInput, SessionImportInput, SessionExportInput, SessionExportOutput, SessionActiveOutput, SessionGetInput, SessionRemoveInput, SessionForkInput, SessionSwitchAgentInput, SessionSwitchModelInput, SessionUpdateInput, SessionMoveInput, SessionPromptInput, SessionCommandInput, SessionSkillInput, SessionSyntheticInput, SessionShellInput, SessionCompactInput, SessionWaitInput, SessionRevertStageInput, SessionRevertClearInput, SessionRevertCommitInput, SessionContextInput, SessionContextOutput, SessionDiffInput, SessionDiffOutput, SessionInboxListInput, SessionInboxListOutput, SessionInboxCancelInput, SessionInboxUpdateInput, SessionInstructionsEntryListInput, SessionInstructionsEntryListOutput, SessionInstructionsEntryPutInput, SessionInstructionsEntryRemoveInput, SessionGenerateInput, SessionGenerateOutput, SessionLogInput, SessionLogOutput, SessionInterruptInput, SessionInterruptOutput, SessionBackgroundInput, SessionMessageGetInput, SessionFormListInput, SessionFormListOutput, SessionFormCreateInput, SessionFormGetInput, SessionFormReplyInput, SessionFormCancelInput, SessionEnvironmentInput, SessionViewInput, MessageListInput, MessageListOutput, ModelListInput, ModelListOutput, ModelDefaultInput, ModelDefaultOutput, GenerateTextInput, GenerateTextOutput, ProviderListInput, ProviderListOutput, ProviderGetInput, ProviderGetOutput, IntegrationListInput, IntegrationListOutput, IntegrationGetInput, IntegrationGetOutput, IntegrationWellknownAddInput, IntegrationConnectKeyInput, IntegrationOauthConnectInput, IntegrationOauthConnectOutput, IntegrationOauthStatusInput, IntegrationOauthStatusOutput, IntegrationOauthCompleteInput, IntegrationOauthCancelInput, IntegrationCommandConnectInput, IntegrationCommandConnectOutput, IntegrationCommandStatusInput, IntegrationCommandStatusOutput, IntegrationCommandCancelInput, McpListInput, McpListOutput, McpAddInput, McpRemoveInput, McpConnectInput, McpDisconnectInput, McpResourceCatalogInput, McpResourceCatalogOutput, CredentialUpdateInput, CredentialActivateInput, CredentialRemoveInput, ProjectListOutput, ProjectUpdateInput, FormListInput, FormListOutput, PermissionRequestListInput, PermissionRequestListOutput, PermissionSavedListInput, PermissionSavedListOutput, PermissionSavedRemoveInput, PermissionCreateInput, PermissionCreateOutput, PermissionListInput, PermissionListOutput, PermissionGetInput, PermissionReplyInput, FileListInput, FileListOutput, FileFindInput, FileFindOutput, CommandListInput, CommandListOutput, SkillListInput, SkillListOutput, RpcCallInput, RpcCallOutput, PtyListInput, PtyListOutput, PtyCreateInput, PtyCreateOutput, PtyGetInput, PtyGetOutput, PtyUpdateInput, PtyUpdateOutput, PtyRemoveInput, PtyConnectTokenInput, PtyConnectTokenOutput, ExperimentalPersistentPtyReadInput, ExperimentalPersistentPtyReadOutput, ExperimentalPersistentPtyListInput, ExperimentalPersistentPtyListOutput, ExperimentalPersistentPtyCreateInput, ExperimentalPersistentPtyCreateOutput, ExperimentalPersistentPtyHandoffOutput, ExperimentalPersistentPtyGetInput, ExperimentalPersistentPtyGetOutput, ExperimentalPersistentPtyUpdateInput, ExperimentalPersistentPtyUpdateOutput, ExperimentalPersistentPtySnapshotInput, ExperimentalPersistentPtySnapshotOutput, ExperimentalPersistentPtyRemoveInput, ExperimentalPersistentPtyConnectTokenInput, ShellListInput, ShellListOutput, ShellCreateInput, ShellCreateOutput, ShellGetInput, ShellGetOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeCreateInput, WorktreeRemoveInput, WorktreeRefreshInput, VcsGetInput, VcsGetOutput, VcsBaseInput, VcsBaseOutput, VcsStatusInput, VcsStatusOutput, VcsBranchListInput, VcsBranchListOutput, VcsDiffInput, VcsDiffOutput, DebugLocationListOutput, DebugLocationEvictInput, MigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ConfigGetInput, ConfigGetOutput, ConfigShellsOutput, ConfigUpdateInput } from "../api/api.js";
|
|
5
5
|
import { ClientError } from "./client-error.js";
|
|
6
6
|
export declare const make: (options?: {
|
|
7
7
|
readonly baseUrl?: URL | string;
|
|
8
8
|
}) => Effect.Effect<{
|
|
9
9
|
server: {
|
|
10
|
-
|
|
10
|
+
info: () => Effect.Effect<ServerInfoOutput, import("@opencode/protocol/errors").InvalidRequestError | import("@opencode/protocol/errors").UnauthorizedError | Schema.SchemaError | ClientError | HttpClientError.HttpClientError, never>;
|
|
11
11
|
};
|
|
12
12
|
location: {
|
|
13
13
|
get: (input?: LocationGetInput) => Effect.Effect<import("@opencode/schema/location").PublicInfo, import("@opencode/protocol/errors").InvalidRequestError | import("@opencode/protocol/errors").UnauthorizedError | Schema.SchemaError | ClientError | HttpClientError.HttpClientError, never>;
|
|
14
|
+
reload: () => Effect.Effect<void, import("@opencode/protocol/errors").InvalidRequestError | import("@opencode/protocol/errors").UnauthorizedError | import("@opencode/protocol/errors").ServiceUnavailableError | Schema.SchemaError | ClientError | HttpClientError.HttpClientError, never>;
|
|
14
15
|
};
|
|
15
16
|
agent: {
|
|
16
17
|
list: (input?: AgentListInput) => Effect.Effect<AgentListOutput, import("@opencode/protocol/errors").InvalidRequestError | import("@opencode/protocol/errors").UnauthorizedError | Schema.SchemaError | ClientError | HttpClientError.HttpClientError, never>;
|
|
@@ -2050,6 +2051,18 @@ export declare const make: (options?: {
|
|
|
2050
2051
|
readonly metadata?: {
|
|
2051
2052
|
readonly [x: string]: unknown;
|
|
2052
2053
|
} | undefined;
|
|
2054
|
+
} | {
|
|
2055
|
+
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
2056
|
+
readonly data: {};
|
|
2057
|
+
readonly type: "location.shutdown";
|
|
2058
|
+
readonly created: number;
|
|
2059
|
+
readonly location?: {
|
|
2060
|
+
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
2061
|
+
readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
|
|
2062
|
+
} | undefined;
|
|
2063
|
+
readonly metadata?: {
|
|
2064
|
+
readonly [x: string]: unknown;
|
|
2065
|
+
} | undefined;
|
|
2053
2066
|
} | {
|
|
2054
2067
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
2055
2068
|
readonly data: {
|
|
@@ -10,10 +10,14 @@ const mapClientError = (error) => HttpClientError.isHttpClientError(error) || Sc
|
|
|
10
10
|
: error;
|
|
11
11
|
const preserveEffect = () => (effect) => effect;
|
|
12
12
|
const preserveStream = () => (stream) => stream;
|
|
13
|
-
const
|
|
14
|
-
const adaptGroupServer = (raw) => ({
|
|
13
|
+
const EndpointServerInfo = (raw) => () => preserveEffect()(raw["server.info"]({}).pipe(Effect.mapError(mapClientError)));
|
|
14
|
+
const adaptGroupServer = (raw) => ({ info: EndpointServerInfo(raw) });
|
|
15
15
|
const EndpointLocationGet = (raw) => (input) => preserveEffect()(raw["location.get"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
16
|
-
const
|
|
16
|
+
const EndpointLocationReload = (raw) => () => preserveEffect()(raw["location.reload"]({}).pipe(Effect.mapError(mapClientError)));
|
|
17
|
+
const adaptGroupLocation = (raw) => ({
|
|
18
|
+
get: EndpointLocationGet(raw),
|
|
19
|
+
reload: EndpointLocationReload(raw),
|
|
20
|
+
});
|
|
17
21
|
const EndpointAgentList = (raw) => (input) => preserveEffect()(raw["agent.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
18
22
|
const EndpointAgentGet = (raw) => (input) => preserveEffect()(raw["agent.get"]({ params: { agentID: input["agentID"] }, query: { location: input["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
19
23
|
const adaptGroupAgent = (raw) => ({
|
package/dist/effect/service.js
CHANGED
|
@@ -162,7 +162,7 @@ export const Info = Schema.Struct({
|
|
|
162
162
|
password: Schema.optional(Schema.String),
|
|
163
163
|
});
|
|
164
164
|
const decode = Schema.decodeUnknownEffect(Schema.fromJsonString(Info));
|
|
165
|
-
const
|
|
165
|
+
const decodeInfo = Schema.decodeUnknownOption(Schema.Struct({
|
|
166
166
|
version: Schema.String,
|
|
167
167
|
pid: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
168
168
|
}));
|
|
@@ -186,7 +186,7 @@ const probeResult = Effect.fnUntraced(function* (info, timeout = defaultEnsureTi
|
|
|
186
186
|
: { type: "basic", username: "opencode", password: info.password },
|
|
187
187
|
};
|
|
188
188
|
const signal = AbortSignal.timeout(timeout);
|
|
189
|
-
const result = yield* Effect.promise(() => fetch(new URL("/api/
|
|
189
|
+
const result = yield* Effect.promise(() => fetch(new URL("/api/info", info.url), { headers: headers(endpoint), signal })
|
|
190
190
|
.then(async (response) => ({
|
|
191
191
|
response,
|
|
192
192
|
body: response.status === 404 ? undefined : (await response.json()),
|
|
@@ -195,7 +195,7 @@ const probeResult = Effect.fnUntraced(function* (info, timeout = defaultEnsureTi
|
|
|
195
195
|
if ("cause" in result)
|
|
196
196
|
return { service: undefined, timedOut: signal.aborted };
|
|
197
197
|
const response = result.value.response;
|
|
198
|
-
// The previous V2 service exposes /api/
|
|
198
|
+
// The previous V2 service exposes /api/status instead. Its authenticated 404 is enough
|
|
199
199
|
// to recognize the registered daemon as incompatible and route it through replacement.
|
|
200
200
|
if (response.status === 404)
|
|
201
201
|
return {
|
|
@@ -209,17 +209,17 @@ const probeResult = Effect.fnUntraced(function* (info, timeout = defaultEnsureTi
|
|
|
209
209
|
timedOut: false,
|
|
210
210
|
};
|
|
211
211
|
const body = result.value.body;
|
|
212
|
-
const
|
|
213
|
-
if (Option.isSome(
|
|
214
|
-
if (
|
|
212
|
+
const serverInfo = decodeInfo(body);
|
|
213
|
+
if (Option.isSome(serverInfo)) {
|
|
214
|
+
if (serverInfo.value.pid !== info.pid)
|
|
215
215
|
return { service: undefined, timedOut: false };
|
|
216
|
-
if (info.version !== undefined &&
|
|
216
|
+
if (info.version !== undefined && serverInfo.value.version !== info.version)
|
|
217
217
|
return { service: undefined, timedOut: false };
|
|
218
218
|
return {
|
|
219
219
|
service: {
|
|
220
220
|
info,
|
|
221
221
|
endpoint,
|
|
222
|
-
version:
|
|
222
|
+
version: serverInfo.value.version,
|
|
223
223
|
state: response.ok ? "ready" : response.status === 500 ? "failed" : "waiting",
|
|
224
224
|
compatible: true,
|
|
225
225
|
},
|
package/dist/promise/client.d.ts
CHANGED
|
@@ -11,10 +11,11 @@ export declare function make(options: ClientOptions): {
|
|
|
11
11
|
subscribe(options?: SharedEvents.SubscribeOptions): AsyncIterable<import("./index.js").V2Event>;
|
|
12
12
|
};
|
|
13
13
|
server: {
|
|
14
|
-
|
|
14
|
+
info: (requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ServerInfo>;
|
|
15
15
|
};
|
|
16
16
|
location: {
|
|
17
17
|
get: (input?: import("./index.js").LocationGetInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").LocationPublicInfo>;
|
|
18
|
+
reload: (requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
18
19
|
};
|
|
19
20
|
agent: {
|
|
20
21
|
list: (input?: import("./index.js").AgentListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").AgentListOutput>;
|
|
@@ -165,6 +166,7 @@ export declare function make(options: ClientOptions): {
|
|
|
165
166
|
read: (input: import("./index.js").FileReadInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").FileReadOutput>;
|
|
166
167
|
list: (input?: import("./index.js").FileListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").FileListOutput>;
|
|
167
168
|
find: (input: import("./index.js").FileFindInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").FileFindOutput>;
|
|
169
|
+
write: (input: import("./index.js").FileWriteInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").FileWriteOutput>;
|
|
168
170
|
};
|
|
169
171
|
command: {
|
|
170
172
|
list: (input?: import("./index.js").CommandListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").CommandListOutput>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LocationGetInput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, PluginCheckInput, PluginCheckOutput, PluginUpdateInput, SessionListInput, SessionStatsInput, SessionCreateInput, SessionImportInput, SessionExportInput, SessionGetInput, SessionRemoveInput, SessionForkInput, SessionSwitchAgentInput, SessionSwitchModelInput, SessionUpdateInput, SessionMoveInput, SessionPromptInput, SessionCommandInput, SessionSkillInput, SessionSyntheticInput, SessionShellInput, SessionCompactInput, SessionWaitInput, SessionRevertStageInput, SessionRevertClearInput, SessionRevertCommitInput, SessionContextInput, SessionDiffInput, SessionInboxListInput, SessionInboxCancelInput, SessionInboxUpdateInput, SessionInstructionsEntryListInput, SessionInstructionsEntryPutInput, SessionInstructionsEntryRemoveInput, SessionGenerateInput, SessionLogInput, SessionLogOutput, SessionInterruptInput, SessionBackgroundInput, SessionMessageGetInput, SessionFormListInput, SessionFormCreateInput, SessionFormGetInput, SessionFormReplyInput, SessionFormCancelInput, SessionEnvironmentInput, SessionViewInput, MessageListInput, ModelListInput, ModelListOutput, ModelDefaultInput, ModelDefaultOutput, GenerateTextInput, ProviderListInput, ProviderListOutput, ProviderGetInput, ProviderGetOutput, IntegrationListInput, IntegrationListOutput, IntegrationGetInput, IntegrationGetOutput, IntegrationWellknownAddInput, IntegrationConnectKeyInput, IntegrationOauthConnectInput, IntegrationOauthConnectOutput, IntegrationOauthStatusInput, IntegrationOauthStatusOutput, IntegrationOauthCompleteInput, IntegrationOauthCancelInput, IntegrationCommandConnectInput, IntegrationCommandConnectOutput, IntegrationCommandStatusInput, IntegrationCommandStatusOutput, IntegrationCommandCancelInput, McpListInput, McpListOutput, McpAddInput, McpRemoveInput, McpConnectInput, McpDisconnectInput, McpResourceCatalogInput, McpResourceCatalogOutput, CredentialUpdateInput, CredentialActivateInput, CredentialRemoveInput, ProjectListOutput, ProjectUpdateInput, FormListInput, FormListOutput, PermissionRequestListInput, PermissionRequestListOutput, PermissionSavedListInput, PermissionSavedRemoveInput, PermissionCreateInput, PermissionListInput, PermissionGetInput, PermissionReplyInput, FileReadInput, FileReadOutput, FileListInput, FileListOutput, FileFindInput, FileFindOutput, CommandListInput, CommandListOutput, SkillListInput, SkillListOutput, RpcCallInput, EventSubscribeOutput, PtyListInput, PtyListOutput, PtyCreateInput, PtyCreateOutput, PtyGetInput, PtyGetOutput, PtyUpdateInput, PtyUpdateOutput, PtyRemoveInput, PtyConnectTokenInput, PtyConnectTokenOutput, ExperimentalPersistentPtyReadInput, ExperimentalPersistentPtyListInput, ExperimentalPersistentPtyCreateInput, ExperimentalPersistentPtyHandoffOutput, ExperimentalPersistentPtyGetInput, ExperimentalPersistentPtyUpdateInput, ExperimentalPersistentPtySnapshotInput, ExperimentalPersistentPtyRemoveInput, ExperimentalPersistentPtyConnectTokenInput, ShellListInput, ShellListOutput, ShellCreateInput, ShellCreateOutput, ShellGetInput, ShellGetOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeCreateInput, WorktreeRemoveInput, WorktreeRefreshInput, VcsGetInput, VcsGetOutput, VcsBaseInput, VcsBaseOutput, VcsStatusInput, VcsStatusOutput, VcsBranchListInput, VcsBranchListOutput, VcsDiffInput, VcsDiffOutput, DebugLocationListOutput, DebugLocationEvictInput, MigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ConfigGetInput, ConfigGetOutput, ConfigShellsOutput, ConfigUpdateInput } from "./types.js";
|
|
1
|
+
import type { LocationGetInput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, PluginCheckInput, PluginCheckOutput, PluginUpdateInput, SessionListInput, SessionStatsInput, SessionCreateInput, SessionImportInput, SessionExportInput, SessionGetInput, SessionRemoveInput, SessionForkInput, SessionSwitchAgentInput, SessionSwitchModelInput, SessionUpdateInput, SessionMoveInput, SessionPromptInput, SessionCommandInput, SessionSkillInput, SessionSyntheticInput, SessionShellInput, SessionCompactInput, SessionWaitInput, SessionRevertStageInput, SessionRevertClearInput, SessionRevertCommitInput, SessionContextInput, SessionDiffInput, SessionInboxListInput, SessionInboxCancelInput, SessionInboxUpdateInput, SessionInstructionsEntryListInput, SessionInstructionsEntryPutInput, SessionInstructionsEntryRemoveInput, SessionGenerateInput, SessionLogInput, SessionLogOutput, SessionInterruptInput, SessionBackgroundInput, SessionMessageGetInput, SessionFormListInput, SessionFormCreateInput, SessionFormGetInput, SessionFormReplyInput, SessionFormCancelInput, SessionEnvironmentInput, SessionViewInput, MessageListInput, ModelListInput, ModelListOutput, ModelDefaultInput, ModelDefaultOutput, GenerateTextInput, ProviderListInput, ProviderListOutput, ProviderGetInput, ProviderGetOutput, IntegrationListInput, IntegrationListOutput, IntegrationGetInput, IntegrationGetOutput, IntegrationWellknownAddInput, IntegrationConnectKeyInput, IntegrationOauthConnectInput, IntegrationOauthConnectOutput, IntegrationOauthStatusInput, IntegrationOauthStatusOutput, IntegrationOauthCompleteInput, IntegrationOauthCancelInput, IntegrationCommandConnectInput, IntegrationCommandConnectOutput, IntegrationCommandStatusInput, IntegrationCommandStatusOutput, IntegrationCommandCancelInput, McpListInput, McpListOutput, McpAddInput, McpRemoveInput, McpConnectInput, McpDisconnectInput, McpResourceCatalogInput, McpResourceCatalogOutput, CredentialUpdateInput, CredentialActivateInput, CredentialRemoveInput, ProjectListOutput, ProjectUpdateInput, FormListInput, FormListOutput, PermissionRequestListInput, PermissionRequestListOutput, PermissionSavedListInput, PermissionSavedRemoveInput, PermissionCreateInput, PermissionListInput, PermissionGetInput, PermissionReplyInput, FileReadInput, FileReadOutput, FileListInput, FileListOutput, FileFindInput, FileFindOutput, FileWriteInput, FileWriteOutput, CommandListInput, CommandListOutput, SkillListInput, SkillListOutput, RpcCallInput, EventSubscribeOutput, PtyListInput, PtyListOutput, PtyCreateInput, PtyCreateOutput, PtyGetInput, PtyGetOutput, PtyUpdateInput, PtyUpdateOutput, PtyRemoveInput, PtyConnectTokenInput, PtyConnectTokenOutput, ExperimentalPersistentPtyReadInput, ExperimentalPersistentPtyListInput, ExperimentalPersistentPtyCreateInput, ExperimentalPersistentPtyHandoffOutput, ExperimentalPersistentPtyGetInput, ExperimentalPersistentPtyUpdateInput, ExperimentalPersistentPtySnapshotInput, ExperimentalPersistentPtyRemoveInput, ExperimentalPersistentPtyConnectTokenInput, ShellListInput, ShellListOutput, ShellCreateInput, ShellCreateOutput, ShellGetInput, ShellGetOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeCreateInput, WorktreeRemoveInput, WorktreeRefreshInput, VcsGetInput, VcsGetOutput, VcsBaseInput, VcsBaseOutput, VcsStatusInput, VcsStatusOutput, VcsBranchListInput, VcsBranchListOutput, VcsDiffInput, VcsDiffOutput, DebugLocationListOutput, DebugLocationEvictInput, MigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ConfigGetInput, ConfigGetOutput, ConfigShellsOutput, ConfigUpdateInput } from "./types.js";
|
|
2
2
|
export interface ClientOptions {
|
|
3
3
|
readonly baseUrl: string;
|
|
4
4
|
readonly fetch?: typeof globalThis.fetch;
|
|
@@ -12,10 +12,11 @@ export interface RequestOptions {
|
|
|
12
12
|
}
|
|
13
13
|
export declare function make(options: ClientOptions): {
|
|
14
14
|
server: {
|
|
15
|
-
|
|
15
|
+
info: (requestOptions?: RequestOptions) => Promise<import("./types.js").ServerInfo>;
|
|
16
16
|
};
|
|
17
17
|
location: {
|
|
18
18
|
get: (input?: LocationGetInput, requestOptions?: RequestOptions) => Promise<import("./types.js").LocationPublicInfo>;
|
|
19
|
+
reload: (requestOptions?: RequestOptions) => Promise<void>;
|
|
19
20
|
};
|
|
20
21
|
agent: {
|
|
21
22
|
list: (input?: AgentListInput, requestOptions?: RequestOptions) => Promise<AgentListOutput>;
|
|
@@ -166,6 +167,7 @@ export declare function make(options: ClientOptions): {
|
|
|
166
167
|
read: (input: FileReadInput, requestOptions?: RequestOptions) => Promise<FileReadOutput>;
|
|
167
168
|
list: (input?: FileListInput, requestOptions?: RequestOptions) => Promise<FileListOutput>;
|
|
168
169
|
find: (input: FileFindInput, requestOptions?: RequestOptions) => Promise<FileFindOutput>;
|
|
170
|
+
write: (input: FileWriteInput, requestOptions?: RequestOptions) => Promise<FileWriteOutput>;
|
|
169
171
|
};
|
|
170
172
|
command: {
|
|
171
173
|
list: (input?: CommandListInput, requestOptions?: RequestOptions) => Promise<CommandListOutput>;
|
|
@@ -14,14 +14,18 @@ export function make(options) {
|
|
|
14
14
|
for (const [key, value] of new Headers(requestOptions?.headers))
|
|
15
15
|
headers.set(key, value);
|
|
16
16
|
if (descriptor.body !== undefined && !headers.has("content-type"))
|
|
17
|
-
headers.set("content-type", "application/json");
|
|
17
|
+
headers.set("content-type", descriptor.binaryBody ? "application/octet-stream" : "application/json");
|
|
18
18
|
return {
|
|
19
19
|
url,
|
|
20
20
|
init: {
|
|
21
21
|
method: descriptor.method,
|
|
22
22
|
signal: requestOptions?.signal,
|
|
23
23
|
headers,
|
|
24
|
-
body: descriptor.body === undefined
|
|
24
|
+
body: descriptor.body === undefined
|
|
25
|
+
? undefined
|
|
26
|
+
: descriptor.binaryBody
|
|
27
|
+
? descriptor.body
|
|
28
|
+
: JSON.stringify(descriptor.body),
|
|
25
29
|
},
|
|
26
30
|
};
|
|
27
31
|
};
|
|
@@ -130,7 +134,7 @@ export function make(options) {
|
|
|
130
134
|
});
|
|
131
135
|
return {
|
|
132
136
|
server: {
|
|
133
|
-
|
|
137
|
+
info: (requestOptions) => request({ method: "GET", path: `/api/info`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions),
|
|
134
138
|
},
|
|
135
139
|
location: {
|
|
136
140
|
get: (input, requestOptions) => request({
|
|
@@ -141,6 +145,13 @@ export function make(options) {
|
|
|
141
145
|
declaredStatuses: [400, 401],
|
|
142
146
|
empty: false,
|
|
143
147
|
}, requestOptions),
|
|
148
|
+
reload: (requestOptions) => request({
|
|
149
|
+
method: "POST",
|
|
150
|
+
path: `/api/location/reload`,
|
|
151
|
+
successStatus: 204,
|
|
152
|
+
declaredStatuses: [400, 401, 503],
|
|
153
|
+
empty: true,
|
|
154
|
+
}, requestOptions),
|
|
144
155
|
},
|
|
145
156
|
agent: {
|
|
146
157
|
list: (input, requestOptions) => request({
|
|
@@ -931,6 +942,16 @@ export function make(options) {
|
|
|
931
942
|
declaredStatuses: [400, 401],
|
|
932
943
|
empty: false,
|
|
933
944
|
}, requestOptions),
|
|
945
|
+
write: (input, requestOptions) => request({
|
|
946
|
+
method: "POST",
|
|
947
|
+
path: `/api/experimental/fs/write`,
|
|
948
|
+
query: { location: input["location"], path: input["path"] },
|
|
949
|
+
body: input["payload"],
|
|
950
|
+
successStatus: 200,
|
|
951
|
+
declaredStatuses: [400, 401],
|
|
952
|
+
empty: false,
|
|
953
|
+
binaryBody: true,
|
|
954
|
+
}, requestOptions),
|
|
934
955
|
},
|
|
935
956
|
command: {
|
|
936
957
|
list: (input, requestOptions) => request({
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
export type JsonValue = null | boolean | number | string | Array<JsonValue> | {
|
|
2
2
|
[key: string]: JsonValue;
|
|
3
3
|
};
|
|
4
|
-
export type
|
|
4
|
+
export type ServerInfo = {
|
|
5
5
|
version: string;
|
|
6
6
|
pid: number;
|
|
7
7
|
urls: Array<string>;
|
|
8
|
+
paths: {
|
|
9
|
+
tmp: string;
|
|
10
|
+
};
|
|
8
11
|
};
|
|
9
12
|
export type LocationPublicInfo = {
|
|
10
13
|
directory: string;
|
|
@@ -521,6 +524,9 @@ export type FileSystemEntry = {
|
|
|
521
524
|
path: string;
|
|
522
525
|
type: "file" | "directory";
|
|
523
526
|
};
|
|
527
|
+
export type FileSystemWrite = {
|
|
528
|
+
path: string;
|
|
529
|
+
};
|
|
524
530
|
export type CommandInfo = {
|
|
525
531
|
name: string;
|
|
526
532
|
description?: string;
|
|
@@ -1369,6 +1375,16 @@ export type SessionUsageRecorded = {
|
|
|
1369
1375
|
tokens: TokenUsageInfo;
|
|
1370
1376
|
};
|
|
1371
1377
|
};
|
|
1378
|
+
export type LocationShutdown = {
|
|
1379
|
+
id: string;
|
|
1380
|
+
created: number;
|
|
1381
|
+
metadata?: {
|
|
1382
|
+
[x: string]: any;
|
|
1383
|
+
};
|
|
1384
|
+
type: "location.shutdown";
|
|
1385
|
+
location?: LocationRef;
|
|
1386
|
+
data: {};
|
|
1387
|
+
};
|
|
1372
1388
|
export type ModelsDevRefreshed = {
|
|
1373
1389
|
id: string;
|
|
1374
1390
|
created: number;
|
|
@@ -3249,7 +3265,7 @@ export type IntegrationInfo = {
|
|
|
3249
3265
|
methods: Array<IntegrationMethod>;
|
|
3250
3266
|
connections: Array<ConnectionInfo>;
|
|
3251
3267
|
};
|
|
3252
|
-
export type V2Event = ModelsDevRefreshed | CredentialUpdated | CredentialSwitched | IntegrationUpdated | ProviderUpdated | ModelUpdated | AgentUpdated | SessionCreated | SessionAgentSelected | SessionModelSelected | SessionMoved | SessionRenamed | SessionPermissions | SessionViewed | SessionUsageUpdated | SessionDeleted | SessionForked | SessionInboxDelivered | SessionInboxEnqueued | SessionInboxCancelled | SessionInboxDeliveryChanged | SessionExecutionStarted | SessionExecutionSucceeded | SessionExecutionFailed | SessionExecutionInterrupted | SessionInstructionsUpdated | SessionSynthetic | SessionSkillActivated | SessionShellStarted | SessionShellEnded | SessionStepStarted | SessionStepStreamed | SessionStepEnded | SessionStepFailed | SessionTextStarted | SessionTextDelta | SessionTextEnded | SessionReasoningStarted | SessionReasoningDelta | SessionReasoningEnded | SessionToolInputStarted | SessionToolInputDelta | SessionToolInputEnded | SessionToolCalled | SessionToolProgress | SessionToolSuccess | SessionToolFailed | SessionRetryScheduled | SessionCompactionStarted | SessionCompactionDelta | SessionCompactionEnded | SessionCompactionFailed | SessionRevertStaged | SessionRevertCleared | SessionRevertCommitted | FilesystemChanged | ReferenceUpdated | PermissionAsked | PermissionReplied | PluginUpdated | ProjectUpdated | WorktreeUpdated | WorktreeResolved | CommandUpdated | ConfigUpdated | SkillUpdated | PtyCreated | PtyUpdated | PtyExited | PtyDeleted | PersistentPtyAdded | PersistentPtyRemoved | ShellCreated | ShellExited | ShellDeleted | FormCreated | FormReplied | FormCancelled | WebsearchUpdated | SessionStatusUpdated | SessionIdle | TuiPromptAppend | TuiCommandExecute | TuiToastShow | TuiSessionSelect | InstallationUpdated | InstallationUpdateAvailable | VcsBranchUpdated | McpStatusChanged | McpResourcesChanged | V2EventRpc | V2EventServerConnected;
|
|
3268
|
+
export type V2Event = LocationShutdown | ModelsDevRefreshed | CredentialUpdated | CredentialSwitched | IntegrationUpdated | ProviderUpdated | ModelUpdated | AgentUpdated | SessionCreated | SessionAgentSelected | SessionModelSelected | SessionMoved | SessionRenamed | SessionPermissions | SessionViewed | SessionUsageUpdated | SessionDeleted | SessionForked | SessionInboxDelivered | SessionInboxEnqueued | SessionInboxCancelled | SessionInboxDeliveryChanged | SessionExecutionStarted | SessionExecutionSucceeded | SessionExecutionFailed | SessionExecutionInterrupted | SessionInstructionsUpdated | SessionSynthetic | SessionSkillActivated | SessionShellStarted | SessionShellEnded | SessionStepStarted | SessionStepStreamed | SessionStepEnded | SessionStepFailed | SessionTextStarted | SessionTextDelta | SessionTextEnded | SessionReasoningStarted | SessionReasoningDelta | SessionReasoningEnded | SessionToolInputStarted | SessionToolInputDelta | SessionToolInputEnded | SessionToolCalled | SessionToolProgress | SessionToolSuccess | SessionToolFailed | SessionRetryScheduled | SessionCompactionStarted | SessionCompactionDelta | SessionCompactionEnded | SessionCompactionFailed | SessionRevertStaged | SessionRevertCleared | SessionRevertCommitted | FilesystemChanged | ReferenceUpdated | PermissionAsked | PermissionReplied | PluginUpdated | ProjectUpdated | WorktreeUpdated | WorktreeResolved | CommandUpdated | ConfigUpdated | SkillUpdated | PtyCreated | PtyUpdated | PtyExited | PtyDeleted | PersistentPtyAdded | PersistentPtyRemoved | ShellCreated | ShellExited | ShellDeleted | FormCreated | FormReplied | FormCancelled | WebsearchUpdated | SessionStatusUpdated | SessionIdle | TuiPromptAppend | TuiCommandExecute | TuiToastShow | TuiSessionSelect | InstallationUpdated | InstallationUpdateAvailable | VcsBranchUpdated | McpStatusChanged | McpResourcesChanged | V2EventRpc | V2EventServerConnected;
|
|
3253
3269
|
export type SessionLogItem = SessionEventDurable | EventLogSynced;
|
|
3254
3270
|
export type InvalidRequestError = {
|
|
3255
3271
|
readonly _tag: "InvalidRequestError";
|
|
@@ -3263,18 +3279,18 @@ export type UnauthorizedError = {
|
|
|
3263
3279
|
readonly message: string;
|
|
3264
3280
|
};
|
|
3265
3281
|
export declare const isUnauthorizedError: (value: unknown) => value is UnauthorizedError;
|
|
3266
|
-
export type AgentNotFoundError = {
|
|
3267
|
-
readonly _tag: "AgentNotFoundError";
|
|
3268
|
-
readonly agentID: string;
|
|
3269
|
-
readonly message: string;
|
|
3270
|
-
};
|
|
3271
|
-
export declare const isAgentNotFoundError: (value: unknown) => value is AgentNotFoundError;
|
|
3272
3282
|
export type ServiceUnavailableError = {
|
|
3273
3283
|
readonly _tag: "ServiceUnavailableError";
|
|
3274
3284
|
readonly message: string;
|
|
3275
3285
|
readonly service?: string | undefined;
|
|
3276
3286
|
};
|
|
3277
3287
|
export declare const isServiceUnavailableError: (value: unknown) => value is ServiceUnavailableError;
|
|
3288
|
+
export type AgentNotFoundError = {
|
|
3289
|
+
readonly _tag: "AgentNotFoundError";
|
|
3290
|
+
readonly agentID: string;
|
|
3291
|
+
readonly message: string;
|
|
3292
|
+
};
|
|
3293
|
+
export declare const isAgentNotFoundError: (value: unknown) => value is AgentNotFoundError;
|
|
3278
3294
|
export type InvalidCursorError = {
|
|
3279
3295
|
readonly _tag: "InvalidCursorError";
|
|
3280
3296
|
readonly message: string;
|
|
@@ -3443,7 +3459,7 @@ export type WorktreeError = {
|
|
|
3443
3459
|
};
|
|
3444
3460
|
};
|
|
3445
3461
|
export declare const isWorktreeError: (value: unknown) => value is WorktreeError;
|
|
3446
|
-
export type
|
|
3462
|
+
export type ServerInfoOutput = ServerInfo;
|
|
3447
3463
|
export type LocationGetInput = {
|
|
3448
3464
|
readonly location?: {
|
|
3449
3465
|
readonly location?: {
|
|
@@ -3452,6 +3468,7 @@ export type LocationGetInput = {
|
|
|
3452
3468
|
}["location"];
|
|
3453
3469
|
};
|
|
3454
3470
|
export type LocationGetOutput = LocationPublicInfo;
|
|
3471
|
+
export type LocationReloadOutput = void;
|
|
3455
3472
|
export type AgentListInput = {
|
|
3456
3473
|
readonly location?: {
|
|
3457
3474
|
readonly location?: {
|
|
@@ -7654,6 +7671,25 @@ export type FileFindOutput = {
|
|
|
7654
7671
|
location: LocationPublicRef;
|
|
7655
7672
|
data: Array<FileSystemEntry>;
|
|
7656
7673
|
};
|
|
7674
|
+
export type FileWriteInput = {
|
|
7675
|
+
readonly location?: {
|
|
7676
|
+
readonly location?: {
|
|
7677
|
+
readonly directory?: string | undefined;
|
|
7678
|
+
} | undefined;
|
|
7679
|
+
readonly path: string;
|
|
7680
|
+
}["location"];
|
|
7681
|
+
readonly path: {
|
|
7682
|
+
readonly location?: {
|
|
7683
|
+
readonly directory?: string | undefined;
|
|
7684
|
+
} | undefined;
|
|
7685
|
+
readonly path: string;
|
|
7686
|
+
}["path"];
|
|
7687
|
+
readonly payload: globalThis.Uint8Array;
|
|
7688
|
+
};
|
|
7689
|
+
export type FileWriteOutput = {
|
|
7690
|
+
location: LocationPublicRef;
|
|
7691
|
+
data: FileSystemWrite;
|
|
7692
|
+
};
|
|
7657
7693
|
export type CommandListInput = {
|
|
7658
7694
|
readonly location?: {
|
|
7659
7695
|
readonly location?: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const isInvalidRequestError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "InvalidRequestError";
|
|
2
2
|
export const isUnauthorizedError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "UnauthorizedError";
|
|
3
|
-
export const isAgentNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "AgentNotFoundError";
|
|
4
3
|
export const isServiceUnavailableError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "ServiceUnavailableError";
|
|
4
|
+
export const isAgentNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "AgentNotFoundError";
|
|
5
5
|
export const isInvalidCursorError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "InvalidCursorError";
|
|
6
6
|
export const isSessionNotFoundError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "SessionNotFoundError";
|
|
7
7
|
export const isConflictError = (value) => typeof value === "object" && value !== null && "_tag" in value && value["_tag"] === "ConflictError";
|
package/dist/promise/service.js
CHANGED
|
@@ -155,7 +155,7 @@ async function probeResult(info, timeout = defaultEnsureTiming.requestTimeout) {
|
|
|
155
155
|
: { type: "basic", username: "opencode", password: info.password },
|
|
156
156
|
};
|
|
157
157
|
const signal = AbortSignal.timeout(timeout);
|
|
158
|
-
const result = await fetch(new URL("/api/
|
|
158
|
+
const result = await fetch(new URL("/api/info", info.url), { headers: headers(endpoint), signal })
|
|
159
159
|
.then(async (response) => ({
|
|
160
160
|
response,
|
|
161
161
|
body: response.status === 404 ? undefined : (await response.json()),
|
|
@@ -164,7 +164,7 @@ async function probeResult(info, timeout = defaultEnsureTiming.requestTimeout) {
|
|
|
164
164
|
if ("cause" in result)
|
|
165
165
|
return { service: undefined, timedOut: signal.aborted };
|
|
166
166
|
const response = result.value.response;
|
|
167
|
-
// The previous V2 service exposes /api/
|
|
167
|
+
// The previous V2 service exposes /api/status instead. Its authenticated 404 is enough
|
|
168
168
|
// to recognize the registered daemon as incompatible and route it through replacement.
|
|
169
169
|
if (response.status === 404)
|
|
170
170
|
return {
|
|
@@ -177,17 +177,17 @@ async function probeResult(info, timeout = defaultEnsureTiming.requestTimeout) {
|
|
|
177
177
|
},
|
|
178
178
|
timedOut: false,
|
|
179
179
|
};
|
|
180
|
-
const
|
|
181
|
-
if (
|
|
182
|
-
if (
|
|
180
|
+
const serverInfo = decodeInfo(result.value.body);
|
|
181
|
+
if (serverInfo !== undefined) {
|
|
182
|
+
if (serverInfo.pid !== info.pid)
|
|
183
183
|
return { service: undefined, timedOut: false };
|
|
184
|
-
if (info.version !== undefined &&
|
|
184
|
+
if (info.version !== undefined && serverInfo.version !== info.version)
|
|
185
185
|
return { service: undefined, timedOut: false };
|
|
186
186
|
return {
|
|
187
187
|
service: {
|
|
188
188
|
info,
|
|
189
189
|
endpoint,
|
|
190
|
-
version:
|
|
190
|
+
version: serverInfo.version,
|
|
191
191
|
state: response.ok ? "ready" : response.status === 500 ? "failed" : "waiting",
|
|
192
192
|
compatible: true,
|
|
193
193
|
},
|
|
@@ -196,7 +196,7 @@ async function probeResult(info, timeout = defaultEnsureTiming.requestTimeout) {
|
|
|
196
196
|
}
|
|
197
197
|
return { service: undefined, timedOut: false };
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function decodeInfo(input) {
|
|
200
200
|
if (typeof input !== "object" || input === null)
|
|
201
201
|
return;
|
|
202
202
|
if (!("version" in input) || typeof input.version !== "string")
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@opencode/client",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"typecheck": "tsgo --noEmit"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@opencode/schema": "2.0.
|
|
61
|
-
"@opencode/protocol": "2.0.
|
|
60
|
+
"@opencode/schema": "2.0.6",
|
|
61
|
+
"@opencode/protocol": "2.0.6"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"effect": "4.0.0-rc.112",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@effect/platform-node": "4.0.0-rc.112",
|
|
77
|
-
"@opencode/httpapi-codegen": "2.0.
|
|
77
|
+
"@opencode/httpapi-codegen": "2.0.6",
|
|
78
78
|
"@tsconfig/bun": "1.0.9",
|
|
79
79
|
"@types/bun": "1.4.0",
|
|
80
80
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|