@opencode/client 0.0.0-dev-19714 → 0.0.0-dev-19716
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 +6 -3
- package/dist/effect/client.d.ts +1 -1
- package/dist/effect/generated/client.d.ts +2 -2
- package/dist/effect/generated/client.js +2 -2
- package/dist/effect/service.js +8 -8
- package/dist/promise/client.d.ts +1 -1
- package/dist/promise/generated/client.d.ts +1 -1
- package/dist/promise/generated/client.js +1 -1
- package/dist/promise/generated/types.d.ts +5 -2
- 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?: {
|
package/dist/effect/client.d.ts
CHANGED
|
@@ -2244,7 +2244,7 @@ export declare const make: (options?: {
|
|
|
2244
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>;
|
|
2245
2245
|
};
|
|
2246
2246
|
server: {
|
|
2247
|
-
|
|
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>;
|
|
2248
2248
|
};
|
|
2249
2249
|
location: {
|
|
2250
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>;
|
|
@@ -1,13 +1,13 @@
|
|
|
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>;
|
|
@@ -10,8 +10,8 @@ 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
16
|
const EndpointLocationReload = (raw) => () => preserveEffect()(raw["location.reload"]({}).pipe(Effect.mapError(mapClientError)));
|
|
17
17
|
const adaptGroupLocation = (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,7 +11,7 @@ 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>;
|
|
@@ -12,7 +12,7 @@ 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>;
|
|
@@ -130,7 +130,7 @@ export function make(options) {
|
|
|
130
130
|
});
|
|
131
131
|
return {
|
|
132
132
|
server: {
|
|
133
|
-
|
|
133
|
+
info: (requestOptions) => request({ method: "GET", path: `/api/info`, successStatus: 200, declaredStatuses: [400, 401], empty: false }, requestOptions),
|
|
134
134
|
},
|
|
135
135
|
location: {
|
|
136
136
|
get: (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;
|
|
@@ -3453,7 +3456,7 @@ export type WorktreeError = {
|
|
|
3453
3456
|
};
|
|
3454
3457
|
};
|
|
3455
3458
|
export declare const isWorktreeError: (value: unknown) => value is WorktreeError;
|
|
3456
|
-
export type
|
|
3459
|
+
export type ServerInfoOutput = ServerInfo;
|
|
3457
3460
|
export type LocationGetInput = {
|
|
3458
3461
|
readonly location?: {
|
|
3459
3462
|
readonly location?: {
|
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": "0.0.0-dev-
|
|
4
|
+
"version": "0.0.0-dev-19716",
|
|
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": "0.0.0-dev-
|
|
61
|
-
"@opencode/protocol": "0.0.0-dev-
|
|
60
|
+
"@opencode/schema": "0.0.0-dev-19716",
|
|
61
|
+
"@opencode/protocol": "0.0.0-dev-19716"
|
|
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": "0.0.0-dev-
|
|
77
|
+
"@opencode/httpapi-codegen": "0.0.0-dev-19716",
|
|
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",
|