@opencode-ai/client 0.0.0-dev-17471

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.
Files changed (40) hide show
  1. package/README.md +27 -0
  2. package/dist/contract.d.ts +1 -0
  3. package/dist/contract.js +1 -0
  4. package/dist/effect/api/api.d.ts +2155 -0
  5. package/dist/effect/api/api.js +0 -0
  6. package/dist/effect/api.d.ts +7 -0
  7. package/dist/effect/api.js +0 -0
  8. package/dist/effect/generated/client-error.d.ts +7 -0
  9. package/dist/effect/generated/client-error.js +5 -0
  10. package/dist/effect/generated/client.d.ts +2208 -0
  11. package/dist/effect/generated/client.js +460 -0
  12. package/dist/effect/generated/index.d.ts +2 -0
  13. package/dist/effect/generated/index.js +2 -0
  14. package/dist/effect/index.d.ts +32 -0
  15. package/dist/effect/index.js +28 -0
  16. package/dist/effect/service.d.ts +78 -0
  17. package/dist/effect/service.js +286 -0
  18. package/dist/promise/api.d.ts +18 -0
  19. package/dist/promise/api.js +0 -0
  20. package/dist/promise/generated/client-error.d.ts +6 -0
  21. package/dist/promise/generated/client-error.js +8 -0
  22. package/dist/promise/generated/client.d.ts +228 -0
  23. package/dist/promise/generated/client.js +1205 -0
  24. package/dist/promise/generated/index.d.ts +3 -0
  25. package/dist/promise/generated/index.js +3 -0
  26. package/dist/promise/generated/types.d.ts +7807 -0
  27. package/dist/promise/generated/types.js +26 -0
  28. package/dist/promise/index.d.ts +4 -0
  29. package/dist/promise/index.js +1 -0
  30. package/dist/promise/service.d.ts +26 -0
  31. package/dist/promise/service.js +273 -0
  32. package/dist/service-contender.d.ts +11 -0
  33. package/dist/service-contender.js +52 -0
  34. package/dist/service-timing.d.ts +13 -0
  35. package/dist/service-timing.js +19 -0
  36. package/dist/service-version.d.ts +2 -0
  37. package/dist/service-version.js +9 -0
  38. package/dist/service.d.ts +48 -0
  39. package/dist/service.js +0 -0
  40. package/package.json +75 -0
@@ -0,0 +1,286 @@
1
+ import { ServiceStatus } from "@opencode-ai/protocol/groups/health";
2
+ import { Effect, FileSystem, Option, Schedule, Schema } from "effect";
3
+ import { homedir } from "node:os";
4
+ import { join } from "node:path";
5
+ import { contenderFailure, contenderFinished, spawnServiceContender, } from "../service-contender.js";
6
+ import { defaultEnsureTiming, ensureTiming } from "../service-timing.js";
7
+ import { matchesVersion } from "../service-version.js";
8
+ export * from "../service.js";
9
+ // Find, start, and stop the local opencode background service.
10
+ //
11
+ // The service daemon advertises itself through a registration file in the
12
+ // user's state directory: url, pid, version, and the private password, with
13
+ // 0600 permissions. That file is the complete discovery contract — reading it
14
+ // is all a client needs to connect. The daemon's own configuration (port,
15
+ // persisted password) is CLI-owned and never read here.
16
+ // Read-only lookup: registration file plus health check and version gate.
17
+ // Never spawns; escalation to ensure() is the caller's policy.
18
+ /** Discover a healthy, compatible local service without starting one. */
19
+ export const discover = Effect.fn("service.discover")(function* (options = {}) {
20
+ return (yield* discoverLocal(options))?.endpoint;
21
+ });
22
+ /** Recognize an authenticated compatible service bound to an expected URL, including while it starts or fails. */
23
+ export const incumbent = Effect.fn("service.incumbent")(function* (options) {
24
+ const info = yield* read(options.file);
25
+ const found = info === undefined ? undefined : yield* probe({ ...info, url: options.url });
26
+ if (found === undefined || found.legacy)
27
+ return undefined;
28
+ if (!matchesVersion(found.version, options))
29
+ return undefined;
30
+ return { endpoint: found.endpoint, state: found.state };
31
+ });
32
+ const discoverLocal = Effect.fnUntraced(function* (options) {
33
+ const found = (yield* registered(options.file)).service;
34
+ if (found?.state !== "ready")
35
+ return undefined;
36
+ if (!matchesVersion(found.version, options))
37
+ return undefined;
38
+ return found;
39
+ });
40
+ // Idempotent ensure-running: reuses a healthy compatible server, replaces a
41
+ // version-mismatched one, and otherwise spawns small contenders until a server
42
+ // becomes discoverable. A contender is never killed merely for slow startup.
43
+ /** Ensure a healthy, compatible local service is running. */
44
+ export const ensure = Effect.fn("service.ensure")(function* (options = {}) {
45
+ const timing = ensureTiming(options);
46
+ const contenders = new Set();
47
+ let timeouts;
48
+ let announced = false;
49
+ let lastSpawn = 0;
50
+ let spawnDelay = timing.spawnDelay;
51
+ const announce = (reason, previousVersion) => Effect.sync(() => {
52
+ if (announced)
53
+ return;
54
+ announced = true;
55
+ options.onStart?.(reason, previousVersion);
56
+ });
57
+ const spawnContender = Effect.gen(function* () {
58
+ const [command, ...args] = options.command ?? ["opencode", "serve", "--service"];
59
+ if (command === undefined)
60
+ return yield* Effect.fail(new Error("Missing service command"));
61
+ return yield* Effect.try({
62
+ try: () => {
63
+ return spawnServiceContender(command, args);
64
+ },
65
+ catch: (cause) => new Error("Failed to start server", { cause }),
66
+ });
67
+ });
68
+ const found = yield* Effect.gen(function* () {
69
+ const registration = yield* registered(options.file, true, timing.requestTimeout);
70
+ const info = registration.info;
71
+ const service = registration.service;
72
+ if (registration.timedOut && info !== undefined) {
73
+ timeouts = {
74
+ info,
75
+ count: timeouts !== undefined && same(timeouts.info, info) ? timeouts.count + 1 : 1,
76
+ };
77
+ if (timeouts.count >= 3) {
78
+ yield* announce("missing");
79
+ yield* evict(info, options, timing);
80
+ timeouts = undefined;
81
+ lastSpawn = Date.now() - spawnDelay;
82
+ }
83
+ }
84
+ else
85
+ timeouts = undefined;
86
+ if (service !== undefined) {
87
+ spawnDelay = timing.spawnDelay;
88
+ const compatible = !service.legacy && matchesVersion(service.version, options);
89
+ if (compatible && service.state === "ready")
90
+ return Option.some(service);
91
+ if (compatible && service.state === "failed")
92
+ return yield* Effect.fail(new Error("Background service failed to start"));
93
+ if (compatible)
94
+ return Option.none();
95
+ yield* announce("version-mismatch", service.version);
96
+ yield* kill(service, options, timing).pipe(Effect.ignore);
97
+ lastSpawn = 0;
98
+ return Option.none();
99
+ }
100
+ else if (lastSpawn === 0 && info !== undefined)
101
+ lastSpawn = Date.now();
102
+ const finished = [...contenders].filter(contenderFinished);
103
+ const failure = finished.map(contenderFailure).find((error) => error !== undefined);
104
+ if (finished.some((item) => item.child.exitCode === 0)) {
105
+ spawnDelay = Math.min(spawnDelay * 2, timing.maxSpawnDelay);
106
+ }
107
+ finished.forEach((item) => contenders.delete(item));
108
+ if (failure !== undefined && contenders.size === 0)
109
+ return yield* Effect.fail(failure);
110
+ // Keep one candidate plus one lock probe so a pre-lock stall cannot block recovery.
111
+ if (contenders.size < 2 && Date.now() - lastSpawn >= spawnDelay) {
112
+ yield* announce("missing");
113
+ contenders.add(yield* spawnContender);
114
+ lastSpawn = Date.now();
115
+ }
116
+ return Option.none();
117
+ }).pipe(Effect.repeat({
118
+ until: Option.isSome,
119
+ schedule: Schedule.max([Schedule.spaced(timing.pollInterval), Schedule.recurs(timing.attempts)]),
120
+ }), Effect.ensuring(Effect.sync(() => contenders.forEach((contender) => contender.release()))));
121
+ if (Option.isNone(found))
122
+ return yield* Effect.fail(new Error("Timed out waiting for the background service to start"));
123
+ return found.value.endpoint;
124
+ });
125
+ /** Stop the registered local service. */
126
+ export const stop = Effect.fn("service.stop")(function* (options = {}) {
127
+ const existing = yield* find(options);
128
+ if (existing !== undefined)
129
+ yield* kill(existing, options, defaultEnsureTiming);
130
+ });
131
+ function fallback() {
132
+ const state = process.env["XDG_STATE_HOME"] ?? join(homedir(), ".local", "state");
133
+ return join(state, "opencode", "service.json");
134
+ }
135
+ /** Create HTTP authentication headers for a service endpoint. */
136
+ export function headers(endpoint) {
137
+ if (endpoint.auth === undefined)
138
+ return undefined;
139
+ return { authorization: "Basic " + btoa(endpoint.auth.username + ":" + endpoint.auth.password) };
140
+ }
141
+ /** Schema for the local service registration file. */
142
+ export const Info = Schema.Struct({
143
+ id: Schema.optional(Schema.String),
144
+ version: Schema.optional(Schema.String),
145
+ url: Schema.String,
146
+ pid: Schema.Int.check(Schema.isGreaterThan(0)),
147
+ password: Schema.optional(Schema.String),
148
+ });
149
+ const decode = Schema.decodeUnknownEffect(Schema.fromJsonString(Info));
150
+ const decodeHealth = Schema.decodeUnknownOption(ServiceStatus.Health);
151
+ const decodeLegacyHealth = Schema.decodeUnknownOption(Schema.Struct({ healthy: Schema.Literal(true) }));
152
+ // A missing or corrupt file means no valid info; callers treat both
153
+ // the same (the registering server self-evicts, clients rediscover).
154
+ const read = Effect.fnUntraced(function* (file) {
155
+ const fs = yield* FileSystem.FileSystem;
156
+ const text = yield* fs.readFileString(file ?? fallback()).pipe(Effect.option);
157
+ if (Option.isNone(text))
158
+ return undefined;
159
+ return yield* decode(text.value).pipe(Effect.option, Effect.map(Option.getOrUndefined));
160
+ });
161
+ const probe = Effect.fnUntraced(function* (info, allowLegacy = false) {
162
+ return (yield* probeResult(info, allowLegacy)).service;
163
+ });
164
+ const probeResult = Effect.fnUntraced(function* (info, allowLegacy = false, timeout = defaultEnsureTiming.requestTimeout) {
165
+ const endpoint = {
166
+ url: info.url,
167
+ auth: info.password === undefined
168
+ ? undefined
169
+ : { type: "basic", username: "opencode", password: info.password },
170
+ };
171
+ const signal = AbortSignal.timeout(timeout);
172
+ const result = yield* Effect.promise(() => fetch(new URL("/api/health", info.url), {
173
+ headers: headers(endpoint),
174
+ signal,
175
+ })
176
+ .then(async (response) => ({ response, body: (await response.json()) }))
177
+ .then((value) => ({ value }), (cause) => ({ cause })));
178
+ if ("cause" in result)
179
+ return { service: undefined, timedOut: signal.aborted };
180
+ const response = result.value.response;
181
+ const body = result.value.body;
182
+ const health = decodeHealth(body);
183
+ if (Option.isSome(health)) {
184
+ if (health.value.pid !== info.pid)
185
+ return { service: undefined, timedOut: false };
186
+ if (info.version !== undefined && health.value.version !== info.version)
187
+ return { service: undefined, timedOut: false };
188
+ return {
189
+ service: {
190
+ info,
191
+ endpoint,
192
+ version: health.value.version,
193
+ state: response.ok ? "ready" : response.status === 500 ? "failed" : "waiting",
194
+ legacy: false,
195
+ },
196
+ timedOut: false,
197
+ };
198
+ }
199
+ if (!allowLegacy ||
200
+ Option.isNone(decodeLegacyHealth(body)) ||
201
+ (typeof body === "object" && body !== null && ("version" in body || "pid" in body)))
202
+ return { service: undefined, timedOut: false };
203
+ return {
204
+ service: { info, endpoint, state: "ready", legacy: true },
205
+ timedOut: false,
206
+ };
207
+ });
208
+ const registered = Effect.fnUntraced(function* (file, allowLegacy = false, timeout) {
209
+ const info = yield* read(file);
210
+ if (info === undefined)
211
+ return { info: undefined, service: undefined, timedOut: false };
212
+ return { info, ...(yield* probeResult(info, allowLegacy, timeout)) };
213
+ });
214
+ // Health-checked lookup without the version gate: lifecycle operations must be
215
+ // able to see (and replace or stop) a server from a different version.
216
+ const find = Effect.fnUntraced(function* (options) {
217
+ return (yield* registered(options.file, true)).service;
218
+ });
219
+ // 50ms cadence bounded at ~5s, shared by stop escalation and each ensure
220
+ // discovery window.
221
+ const poll = (timing) => Schedule.max([Schedule.spaced(timing.stopPollInterval), Schedule.recurs(timing.stopPollAttempts)]);
222
+ const signal = (pid, name) => Effect.try({ try: () => process.kill(pid, name), catch: (cause) => cause }).pipe(Effect.ignore);
223
+ const stopped = Effect.fnUntraced(function* (pid) {
224
+ const running = yield* Effect.try({ try: () => process.kill(pid, 0), catch: () => false }).pipe(Effect.orElseSucceed(() => false));
225
+ if (!running)
226
+ return true;
227
+ return yield* Effect.fail(new Error(`Server process ${pid} is still running`));
228
+ });
229
+ function same(left, right) {
230
+ return left.id === right.id && left.version === right.version && left.url === right.url && left.pid === right.pid;
231
+ }
232
+ const evict = Effect.fnUntraced(function* (info, options, timing) {
233
+ const current = yield* read(options.file);
234
+ if (current === undefined || !same(current, info))
235
+ return;
236
+ yield* signal(info.pid, "SIGTERM");
237
+ const done = yield* stopped(info.pid).pipe(Effect.retry(poll(timing)), Effect.option);
238
+ if (Option.isSome(done))
239
+ return;
240
+ const latest = yield* read(options.file);
241
+ if (latest === undefined || !same(latest, info))
242
+ return;
243
+ yield* signal(info.pid, "SIGKILL");
244
+ yield* stopped(info.pid).pipe(Effect.retry(poll(timing)));
245
+ });
246
+ const kill = Effect.fnUntraced(function* (service, options, timing) {
247
+ const requested = yield* requestStop(service, timing.requestTimeout);
248
+ if (requested === "rejected")
249
+ return;
250
+ if (requested === "unsupported") {
251
+ // A stale registration may point at a reused PID. Authenticate again
252
+ // immediately before the legacy signal fallback.
253
+ const current = yield* find(options);
254
+ if (current === undefined || !same(current.info, service.info))
255
+ return;
256
+ yield* signal(service.info.pid, "SIGTERM");
257
+ }
258
+ const done = yield* stopped(service.info.pid).pipe(Effect.retry(poll(timing)), Effect.option);
259
+ if (Option.isSome(done))
260
+ return;
261
+ const latest = yield* find(options);
262
+ if (latest === undefined || !same(latest.info, service.info))
263
+ return;
264
+ yield* signal(service.info.pid, "SIGKILL");
265
+ yield* stopped(service.info.pid).pipe(Effect.retry(poll(timing)));
266
+ });
267
+ const decodeStopResponse = Schema.decodeUnknownOption(ServiceStatus.StopResponse);
268
+ const requestStop = Effect.fnUntraced(function* (service, timeout = defaultEnsureTiming.requestTimeout) {
269
+ if (service.info.id === undefined || service.legacy)
270
+ return "unsupported";
271
+ const response = yield* Effect.tryPromise(() => fetch(new URL("/api/service/stop", service.info.url), {
272
+ method: "POST",
273
+ headers: { ...headers(service.endpoint), "content-type": "application/json" },
274
+ body: JSON.stringify({ instanceID: service.info.id }),
275
+ signal: AbortSignal.timeout(timeout),
276
+ })).pipe(Effect.option, Effect.map(Option.getOrUndefined));
277
+ if (response === undefined || response.status === 404 || response.status === 405)
278
+ return "unsupported";
279
+ const body = yield* Effect.tryPromise(() => response.json()).pipe(Effect.option, Effect.map(Option.getOrUndefined));
280
+ const decoded = decodeStopResponse(body);
281
+ if (!response.ok || Option.isNone(decoded) || !decoded.value.accepted)
282
+ return "rejected";
283
+ return "accepted";
284
+ });
285
+ /** Effect-based local service lifecycle operations. */
286
+ export const Service = { discover, incumbent, ensure, stop, headers, Info };
@@ -0,0 +1,18 @@
1
+ type Client = ReturnType<typeof import("./generated/client.js").make>;
2
+ export type AgentApi = Client["agent"];
3
+ export type CommandApi = Client["command"];
4
+ export type ConfigApi = Client["config"];
5
+ export type EventApi = Client["event"];
6
+ export type IntegrationApi = Client["integration"];
7
+ export type ModelApi = Client["model"];
8
+ export type PluginApi = Client["plugin"];
9
+ export type ProviderApi = Client["provider"];
10
+ export type ReferenceApi = Client["reference"];
11
+ export type WebSearchApi = Client["websearch"];
12
+ export type SessionApi = Client["session"];
13
+ export type SkillApi = Client["skill"];
14
+ export interface CatalogApi {
15
+ readonly provider: ProviderApi;
16
+ readonly model: ModelApi;
17
+ }
18
+ export {};
File without changes
@@ -0,0 +1,6 @@
1
+ export type ClientErrorReason = "Transport" | "UnexpectedStatus" | "UnsupportedContentType" | "MalformedResponse" | "SseEventTooLarge";
2
+ export declare class ClientError extends Error {
3
+ readonly reason: ClientErrorReason;
4
+ readonly name = "ClientError";
5
+ constructor(reason: ClientErrorReason, options?: ErrorOptions);
6
+ }
@@ -0,0 +1,8 @@
1
+ export class ClientError extends Error {
2
+ reason;
3
+ name = "ClientError";
4
+ constructor(reason, options) {
5
+ super(reason, options);
6
+ this.reason = reason;
7
+ }
8
+ }
@@ -0,0 +1,228 @@
1
+ import type { HealthStopInput, ServerGetOutput, LocationGetInput, LocationGetOutput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, SessionListInput, SessionCreateInput, SessionImportInput, SessionExportInput, SessionGetInput, SessionRemoveInput, SessionForkInput, SessionSwitchAgentInput, SessionSwitchModelInput, SessionRenameInput, SessionMoveInput, SessionPromptInput, SessionCommandInput, SessionSkillInput, SessionSyntheticInput, SessionShellInput, SessionCompactInput, SessionWaitInput, SessionRevertStageInput, SessionRevertClearInput, SessionRevertCommitInput, SessionContextInput, SessionInboxListInput, SessionInboxCancelInput, SessionInboxSteerInput, SessionInboxQueueInput, SessionInstructionsEntryListInput, SessionInstructionsEntryPutInput, SessionInstructionsEntryRemoveInput, SessionGenerateInput, SessionLogInput, SessionLogOutput, SessionInterruptInput, SessionBackgroundInput, SessionMessageInput, 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, CredentialRemoveInput, ProjectListOutput, ProjectCurrentInput, FormRequestListInput, FormRequestListOutput, FormListInput, FormCreateInput, FormGetInput, FormStateInput, FormReplyInput, FormCancelInput, PermissionRequestListInput, PermissionRequestListOutput, PermissionSavedListInput, PermissionSavedRemoveInput, PermissionCreateInput, PermissionListInput, PermissionGetInput, PermissionReplyInput, FileReadInput, FileReadOutput, FileListInput, FileListOutput, FileFindInput, FileFindOutput, CommandListInput, CommandListOutput, SkillListInput, SkillListOutput, EventSubscribeOutput, PtyListInput, PtyListOutput, PtyCreateInput, PtyCreateOutput, PtyGetInput, PtyGetOutput, PtyUpdateInput, PtyUpdateOutput, PtyRemoveInput, ShellListInput, ShellListOutput, ShellCreateInput, ShellCreateOutput, ShellGetInput, ShellGetOutput, ShellTimeoutInput, ShellTimeoutOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeCreateInput, WorktreeRemoveInput, WorktreeRefreshInput, VcsGetInput, VcsGetOutput, VcsStatusInput, VcsStatusOutput, VcsDiffInput, VcsDiffOutput, DebugLocationListOutput, DebugLocationEvictInput, MigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ConfigGetInput, ConfigGetOutput } from "./types.js";
2
+ export interface ClientOptions {
3
+ readonly baseUrl: string;
4
+ readonly fetch?: typeof globalThis.fetch;
5
+ readonly headers?: RequestInit["headers"];
6
+ }
7
+ export interface RequestOptions {
8
+ readonly signal?: AbortSignal;
9
+ readonly headers?: RequestInit["headers"];
10
+ }
11
+ export declare function make(options: ClientOptions): {
12
+ health: {
13
+ get: (requestOptions?: RequestOptions) => Promise<import("./types.js").ServiceHealth>;
14
+ stop: (input: HealthStopInput, requestOptions?: RequestOptions) => Promise<import("./types.js").ServiceStopResponse>;
15
+ };
16
+ server: {
17
+ get: (requestOptions?: RequestOptions) => Promise<ServerGetOutput>;
18
+ };
19
+ location: {
20
+ get: (input?: LocationGetInput, requestOptions?: RequestOptions) => Promise<LocationGetOutput>;
21
+ };
22
+ agent: {
23
+ list: (input?: AgentListInput, requestOptions?: RequestOptions) => Promise<AgentListOutput>;
24
+ get: (input: AgentGetInput, requestOptions?: RequestOptions) => Promise<AgentGetOutput>;
25
+ };
26
+ plugin: {
27
+ list: (input?: PluginListInput, requestOptions?: RequestOptions) => Promise<PluginListOutput>;
28
+ };
29
+ session: {
30
+ list: (input?: SessionListInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionsResponse>;
31
+ create: (input?: SessionCreateInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionInfo>;
32
+ import: (input: SessionImportInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionInfo>;
33
+ export: (input: SessionExportInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionTransferData>;
34
+ active: (requestOptions?: RequestOptions) => Promise<{
35
+ [x: string]: import("./types.js").SessionActive;
36
+ }>;
37
+ get: (input: SessionGetInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionInfo>;
38
+ remove: (input: SessionRemoveInput, requestOptions?: RequestOptions) => Promise<void>;
39
+ fork: (input: SessionForkInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionInfo>;
40
+ switchAgent: (input: SessionSwitchAgentInput, requestOptions?: RequestOptions) => Promise<void>;
41
+ switchModel: (input: SessionSwitchModelInput, requestOptions?: RequestOptions) => Promise<void>;
42
+ rename: (input: SessionRenameInput, requestOptions?: RequestOptions) => Promise<void>;
43
+ move: (input: SessionMoveInput, requestOptions?: RequestOptions) => Promise<void>;
44
+ prompt: (input: SessionPromptInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionInboxUser>;
45
+ command: (input: SessionCommandInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionInboxUser>;
46
+ skill: (input: SessionSkillInput, requestOptions?: RequestOptions) => Promise<void>;
47
+ synthetic: (input: SessionSyntheticInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionInboxSynthetic>;
48
+ shell: (input: SessionShellInput, requestOptions?: RequestOptions) => Promise<void>;
49
+ compact: (input: SessionCompactInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionInboxCompaction>;
50
+ wait: (input: SessionWaitInput, requestOptions?: RequestOptions) => Promise<void>;
51
+ revert: {
52
+ stage: (input: SessionRevertStageInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionRevert>;
53
+ clear: (input: SessionRevertClearInput, requestOptions?: RequestOptions) => Promise<void>;
54
+ commit: (input: SessionRevertCommitInput, requestOptions?: RequestOptions) => Promise<void>;
55
+ };
56
+ context: (input: SessionContextInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionMessageInfo[]>;
57
+ inbox: {
58
+ list: (input: SessionInboxListInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionInboxInfo[]>;
59
+ cancel: (input: SessionInboxCancelInput, requestOptions?: RequestOptions) => Promise<void>;
60
+ steer: (input: SessionInboxSteerInput, requestOptions?: RequestOptions) => Promise<void>;
61
+ queue: (input: SessionInboxQueueInput, requestOptions?: RequestOptions) => Promise<void>;
62
+ };
63
+ instructions: {
64
+ entry: {
65
+ list: (input: SessionInstructionsEntryListInput, requestOptions?: RequestOptions) => Promise<import("./types.js").InstructionEntryInfo[]>;
66
+ put: (input: SessionInstructionsEntryPutInput, requestOptions?: RequestOptions) => Promise<void>;
67
+ remove: (input: SessionInstructionsEntryRemoveInput, requestOptions?: RequestOptions) => Promise<void>;
68
+ };
69
+ };
70
+ generate: (input: SessionGenerateInput, requestOptions?: RequestOptions) => Promise<{
71
+ text: string;
72
+ }>;
73
+ log: (input: SessionLogInput, requestOptions?: RequestOptions) => AsyncIterable<SessionLogOutput>;
74
+ interrupt: (input: SessionInterruptInput, requestOptions?: RequestOptions) => Promise<void>;
75
+ background: (input: SessionBackgroundInput, requestOptions?: RequestOptions) => Promise<void>;
76
+ message: (input: SessionMessageInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionMessageAgentSelected | import("./types.js").SessionMessageSynthetic | import("./types.js").SessionMessageSystem | import("./types.js").SessionMessageSkill | import("./types.js").SessionMessageShell | import("./types.js").SessionMessageCompactionRunning | import("./types.js").SessionMessageCompactionCompleted | import("./types.js").SessionMessageModelSelected | import("./types.js").SessionMessageLocationSwitched | import("./types.js").SessionMessageCompactionFailed | import("./types.js").SessionMessageUser | import("./types.js").SessionMessageAssistant>;
77
+ };
78
+ message: {
79
+ list: (input: MessageListInput, requestOptions?: RequestOptions) => Promise<import("./types.js").SessionMessagesResponse>;
80
+ };
81
+ model: {
82
+ list: (input?: ModelListInput, requestOptions?: RequestOptions) => Promise<ModelListOutput>;
83
+ default: (input?: ModelDefaultInput, requestOptions?: RequestOptions) => Promise<ModelDefaultOutput>;
84
+ };
85
+ generate: {
86
+ text: (input: GenerateTextInput, requestOptions?: RequestOptions) => Promise<{
87
+ text: string;
88
+ }>;
89
+ };
90
+ provider: {
91
+ list: (input?: ProviderListInput, requestOptions?: RequestOptions) => Promise<ProviderListOutput>;
92
+ get: (input: ProviderGetInput, requestOptions?: RequestOptions) => Promise<ProviderGetOutput>;
93
+ };
94
+ integration: {
95
+ list: (input?: IntegrationListInput, requestOptions?: RequestOptions) => Promise<IntegrationListOutput>;
96
+ get: (input: IntegrationGetInput, requestOptions?: RequestOptions) => Promise<IntegrationGetOutput>;
97
+ wellknown: {
98
+ add: (input: IntegrationWellknownAddInput, requestOptions?: RequestOptions) => Promise<void>;
99
+ };
100
+ connect: {
101
+ key: (input: IntegrationConnectKeyInput, requestOptions?: RequestOptions) => Promise<void>;
102
+ };
103
+ oauth: {
104
+ connect: (input: IntegrationOauthConnectInput, requestOptions?: RequestOptions) => Promise<IntegrationOauthConnectOutput>;
105
+ status: (input: IntegrationOauthStatusInput, requestOptions?: RequestOptions) => Promise<IntegrationOauthStatusOutput>;
106
+ complete: (input: IntegrationOauthCompleteInput, requestOptions?: RequestOptions) => Promise<void>;
107
+ cancel: (input: IntegrationOauthCancelInput, requestOptions?: RequestOptions) => Promise<void>;
108
+ };
109
+ command: {
110
+ connect: (input: IntegrationCommandConnectInput, requestOptions?: RequestOptions) => Promise<IntegrationCommandConnectOutput>;
111
+ status: (input: IntegrationCommandStatusInput, requestOptions?: RequestOptions) => Promise<IntegrationCommandStatusOutput>;
112
+ cancel: (input: IntegrationCommandCancelInput, requestOptions?: RequestOptions) => Promise<void>;
113
+ };
114
+ };
115
+ mcp: {
116
+ list: (input?: McpListInput, requestOptions?: RequestOptions) => Promise<McpListOutput>;
117
+ add: (input: McpAddInput, requestOptions?: RequestOptions) => Promise<void>;
118
+ remove: (input: McpRemoveInput, requestOptions?: RequestOptions) => Promise<void>;
119
+ connect: (input: McpConnectInput, requestOptions?: RequestOptions) => Promise<void>;
120
+ disconnect: (input: McpDisconnectInput, requestOptions?: RequestOptions) => Promise<void>;
121
+ resource: {
122
+ catalog: (input?: McpResourceCatalogInput, requestOptions?: RequestOptions) => Promise<McpResourceCatalogOutput>;
123
+ };
124
+ };
125
+ credential: {
126
+ update: (input: CredentialUpdateInput, requestOptions?: RequestOptions) => Promise<void>;
127
+ remove: (input: CredentialRemoveInput, requestOptions?: RequestOptions) => Promise<void>;
128
+ };
129
+ project: {
130
+ list: (requestOptions?: RequestOptions) => Promise<ProjectListOutput>;
131
+ current: (input?: ProjectCurrentInput, requestOptions?: RequestOptions) => Promise<import("./types.js").ProjectCurrent>;
132
+ };
133
+ form: {
134
+ request: {
135
+ list: (input?: FormRequestListInput, requestOptions?: RequestOptions) => Promise<FormRequestListOutput>;
136
+ };
137
+ list: (input: FormListInput, requestOptions?: RequestOptions) => Promise<import("./types.js").FormInfo[]>;
138
+ create: (input: FormCreateInput, requestOptions?: RequestOptions) => Promise<import("./types.js").FormInfo>;
139
+ get: (input: FormGetInput, requestOptions?: RequestOptions) => Promise<import("./types.js").FormInfo>;
140
+ state: (input: FormStateInput, requestOptions?: RequestOptions) => Promise<{
141
+ status: "pending";
142
+ } | {
143
+ status: "answered";
144
+ answer: import("./types.js").FormAnswer;
145
+ } | {
146
+ status: "cancelled";
147
+ }>;
148
+ reply: (input: FormReplyInput, requestOptions?: RequestOptions) => Promise<void>;
149
+ cancel: (input: FormCancelInput, requestOptions?: RequestOptions) => Promise<void>;
150
+ };
151
+ permission: {
152
+ request: {
153
+ list: (input?: PermissionRequestListInput, requestOptions?: RequestOptions) => Promise<PermissionRequestListOutput>;
154
+ };
155
+ saved: {
156
+ list: (input?: PermissionSavedListInput, requestOptions?: RequestOptions) => Promise<import("./types.js").PermissionSavedInfo[]>;
157
+ remove: (input: PermissionSavedRemoveInput, requestOptions?: RequestOptions) => Promise<void>;
158
+ };
159
+ create: (input: PermissionCreateInput, requestOptions?: RequestOptions) => Promise<{
160
+ id: string;
161
+ effect: import("./types.js").PermissionEffect;
162
+ }>;
163
+ list: (input: PermissionListInput, requestOptions?: RequestOptions) => Promise<import("./types.js").PermissionRequest[]>;
164
+ get: (input: PermissionGetInput, requestOptions?: RequestOptions) => Promise<import("./types.js").PermissionRequest>;
165
+ reply: (input: PermissionReplyInput, requestOptions?: RequestOptions) => Promise<void>;
166
+ };
167
+ file: {
168
+ read: (input: FileReadInput, requestOptions?: RequestOptions) => Promise<FileReadOutput>;
169
+ list: (input?: FileListInput, requestOptions?: RequestOptions) => Promise<FileListOutput>;
170
+ find: (input: FileFindInput, requestOptions?: RequestOptions) => Promise<FileFindOutput>;
171
+ };
172
+ command: {
173
+ list: (input?: CommandListInput, requestOptions?: RequestOptions) => Promise<CommandListOutput>;
174
+ };
175
+ skill: {
176
+ list: (input?: SkillListInput, requestOptions?: RequestOptions) => Promise<SkillListOutput>;
177
+ };
178
+ event: {
179
+ subscribe: (requestOptions?: RequestOptions) => AsyncIterable<EventSubscribeOutput>;
180
+ };
181
+ pty: {
182
+ list: (input?: PtyListInput, requestOptions?: RequestOptions) => Promise<PtyListOutput>;
183
+ create: (input?: PtyCreateInput, requestOptions?: RequestOptions) => Promise<PtyCreateOutput>;
184
+ get: (input: PtyGetInput, requestOptions?: RequestOptions) => Promise<PtyGetOutput>;
185
+ update: (input: PtyUpdateInput, requestOptions?: RequestOptions) => Promise<PtyUpdateOutput>;
186
+ remove: (input: PtyRemoveInput, requestOptions?: RequestOptions) => Promise<void>;
187
+ };
188
+ shell: {
189
+ list: (input?: ShellListInput, requestOptions?: RequestOptions) => Promise<ShellListOutput>;
190
+ create: (input: ShellCreateInput, requestOptions?: RequestOptions) => Promise<ShellCreateOutput>;
191
+ get: (input: ShellGetInput, requestOptions?: RequestOptions) => Promise<ShellGetOutput>;
192
+ timeout: (input: ShellTimeoutInput, requestOptions?: RequestOptions) => Promise<ShellTimeoutOutput>;
193
+ output: (input: ShellOutputInput, requestOptions?: RequestOptions) => Promise<ShellOutputOutput>;
194
+ remove: (input: ShellRemoveInput, requestOptions?: RequestOptions) => Promise<void>;
195
+ };
196
+ reference: {
197
+ list: (input?: ReferenceListInput, requestOptions?: RequestOptions) => Promise<ReferenceListOutput>;
198
+ };
199
+ worktree: {
200
+ list: (input: WorktreeListInput, requestOptions?: RequestOptions) => Promise<import("./types.js").WorktreeList>;
201
+ create: (input: WorktreeCreateInput, requestOptions?: RequestOptions) => Promise<import("./types.js").WorktreeInfo>;
202
+ remove: (input: WorktreeRemoveInput, requestOptions?: RequestOptions) => Promise<void>;
203
+ refresh: (input: WorktreeRefreshInput, requestOptions?: RequestOptions) => Promise<void>;
204
+ };
205
+ vcs: {
206
+ get: (input?: VcsGetInput, requestOptions?: RequestOptions) => Promise<VcsGetOutput>;
207
+ status: (input?: VcsStatusInput, requestOptions?: RequestOptions) => Promise<VcsStatusOutput>;
208
+ diff: (input: VcsDiffInput, requestOptions?: RequestOptions) => Promise<VcsDiffOutput>;
209
+ };
210
+ debug: {
211
+ location: {
212
+ list: (requestOptions?: RequestOptions) => Promise<DebugLocationListOutput>;
213
+ evict: (input?: DebugLocationEvictInput, requestOptions?: RequestOptions) => Promise<void>;
214
+ };
215
+ };
216
+ migration: {
217
+ v1: {
218
+ status: (requestOptions?: RequestOptions) => Promise<MigrationV1StatusOutput>;
219
+ };
220
+ };
221
+ websearch: {
222
+ providers: (input?: WebsearchProvidersInput, requestOptions?: RequestOptions) => Promise<WebsearchProvidersOutput>;
223
+ query: (input: WebsearchQueryInput, requestOptions?: RequestOptions) => Promise<WebsearchQueryOutput>;
224
+ };
225
+ config: {
226
+ get: (input?: ConfigGetInput, requestOptions?: RequestOptions) => Promise<ConfigGetOutput>;
227
+ };
228
+ };