@opencode-ai/client 0.0.0-dev-18706 → 0.0.0-dev-18709
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 +17 -0
- package/dist/effect/api.d.ts +1 -0
- package/dist/effect/client.d.ts +2526 -0
- package/dist/effect/client.js +29 -0
- package/dist/effect/generated/client.d.ts +18 -1
- package/dist/effect/generated/client.js +7 -0
- package/dist/effect/index.d.ts +4 -2
- package/dist/effect/index.js +1 -0
- package/dist/effect/rpc.d.ts +20 -0
- package/dist/effect/rpc.js +49 -0
- package/dist/promise/api.d.ts +3 -2
- package/dist/promise/client.d.ts +255 -0
- package/dist/promise/client.js +13 -0
- package/dist/promise/generated/client.d.ts +4 -1
- package/dist/promise/generated/client.js +11 -0
- package/dist/promise/generated/types.d.ts +63 -9
- package/dist/promise/generated/types.js +2 -0
- package/dist/promise/index.d.ts +4 -2
- package/dist/promise/index.js +1 -0
- package/dist/promise/rpc.d.ts +32 -0
- package/dist/promise/rpc.js +86 -0
- package/dist/rpc-runtime.d.ts +21 -0
- package/dist/rpc-runtime.js +32 -0
- package/dist/shared-events.d.ts +8 -0
- package/dist/shared-events.js +133 -0
- package/dist/solid/connection.js +1 -1
- package/dist/solid/data.d.ts +7 -6
- package/package.json +6 -5
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export * as OpenCode from "./client.js";
|
|
2
|
+
import { Cause, Context, Effect, Stream } from "effect";
|
|
3
|
+
import { HttpClient, HttpClientRequest } from "effect/unstable/http";
|
|
4
|
+
import { SharedEvents } from "../shared-events.js";
|
|
5
|
+
import { ClientError, OpenCode } from "./generated/index.js";
|
|
6
|
+
import { RpcClientRuntime } from "./rpc.js";
|
|
7
|
+
const CurrentHeaders = Context.Reference("@opencode-ai/client/effect/rpc/headers", {
|
|
8
|
+
defaultValue: () => undefined,
|
|
9
|
+
});
|
|
10
|
+
export const make = Effect.fn("OpenCode.make")(function* (options) {
|
|
11
|
+
const httpClient = yield* HttpClient.HttpClient;
|
|
12
|
+
const raw = yield* OpenCode.make(options).pipe(Effect.provideService(HttpClient.HttpClient, HttpClient.mapRequestEffect(httpClient, (request) => Effect.map(CurrentHeaders, (headers) => headers ? HttpClientRequest.setHeaders(request, new Headers(headers)) : request))));
|
|
13
|
+
const context = yield* Effect.context();
|
|
14
|
+
const native = raw.event.subscribe();
|
|
15
|
+
// Async iterators throw a squashed cause; retain the native typed failures and defects intact.
|
|
16
|
+
class EventFailure {
|
|
17
|
+
cause;
|
|
18
|
+
constructor(cause) {
|
|
19
|
+
this.cause = cause;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const shared = SharedEvents.make((signal) => Stream.toAsyncIterableWith(native.pipe(Stream.interruptWhen(RpcClientRuntime.aborted(signal)), Stream.catchCause((cause) => Stream.fail(new EventFailure(cause)))), context));
|
|
23
|
+
const subscribe = () => Stream.fromAsyncIterable(shared.subscribe(), (error) => error).pipe(Stream.catch((error) => Stream.failCause(error instanceof EventFailure ? error.cause : Cause.fail(new ClientError({ cause: error })))));
|
|
24
|
+
return {
|
|
25
|
+
...raw,
|
|
26
|
+
event: { ...raw.event, subscribe },
|
|
27
|
+
rpc: Object.assign(RpcClientRuntime.make((input, options) => raw.rpc.call(input).pipe(Effect.provideService(CurrentHeaders, options?.headers)), subscribe), raw.rpc),
|
|
28
|
+
};
|
|
29
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { HealthGetOutput, ServerGetOutput, LocationGetInput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, SessionListInput, SessionListOutput, SessionStatsInput, SessionStatsOutput, SessionCreateInput, SessionImportInput, SessionExportInput, SessionExportOutput, SessionActiveOutput, SessionGetInput, SessionRemoveInput, SessionForkInput, SessionSwitchAgentInput, SessionSwitchModelInput, SessionRenameInput, SessionMoveInput, SessionPromptInput, SessionCommandInput, SessionSkillInput, SessionSyntheticInput, SessionShellInput, SessionCompactInput, SessionWaitInput, SessionRevertStageInput, SessionRevertClearInput, SessionRevertCommitInput, SessionContextInput, SessionContextOutput, SessionInboxListInput, SessionInboxListOutput, SessionInboxCancelInput, SessionInboxSteerInput, SessionInboxQueueInput, SessionInstructionsEntryListInput, SessionInstructionsEntryListOutput, SessionInstructionsEntryPutInput, SessionInstructionsEntryRemoveInput, SessionGenerateInput, SessionGenerateOutput, SessionLogInput, SessionLogOutput, SessionInterruptInput, SessionInterruptOutput, SessionBackgroundInput, SessionMessageInput, SessionMessageUpdateInput, 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, ProjectCurrentInput, FormRequestListInput, FormRequestListOutput, FormListInput, FormListOutput, FormCreateInput, FormGetInput, FormStateInput, FormReplyInput, FormCancelInput, PermissionRequestListInput, PermissionRequestListOutput, PermissionSavedListInput, PermissionSavedListOutput, PermissionSavedRemoveInput, PermissionCreateInput, PermissionCreateOutput, PermissionListInput, PermissionListOutput, PermissionGetInput, PermissionReplyInput, FileListInput, FileListOutput, FileFindInput, FileFindOutput, CommandListInput, CommandListOutput, SkillListInput, SkillListOutput, 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, ShellTimeoutInput, ShellTimeoutOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeCreateInput, WorktreeRemoveInput, WorktreeRefreshInput, WorkspaceCreateInput, WorkspaceDestroyInput, VcsGetInput, VcsGetOutput, VcsBaseInput, VcsBaseOutput, VcsStatusInput, VcsStatusOutput, VcsBranchesInput, VcsBranchesOutput, VcsDiffInput, VcsDiffOutput, DebugLocationListOutput, DebugLocationEvictInput, MigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ConfigGetInput, ConfigGetOutput } from "../api/api.js";
|
|
4
|
+
import type { HealthGetOutput, ServerGetOutput, LocationGetInput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, SessionListInput, SessionListOutput, SessionStatsInput, SessionStatsOutput, SessionCreateInput, SessionImportInput, SessionExportInput, SessionExportOutput, SessionActiveOutput, SessionGetInput, SessionRemoveInput, SessionForkInput, SessionSwitchAgentInput, SessionSwitchModelInput, SessionRenameInput, SessionMoveInput, SessionPromptInput, SessionCommandInput, SessionSkillInput, SessionSyntheticInput, SessionShellInput, SessionCompactInput, SessionWaitInput, SessionRevertStageInput, SessionRevertClearInput, SessionRevertCommitInput, SessionContextInput, SessionContextOutput, SessionInboxListInput, SessionInboxListOutput, SessionInboxCancelInput, SessionInboxSteerInput, SessionInboxQueueInput, SessionInstructionsEntryListInput, SessionInstructionsEntryListOutput, SessionInstructionsEntryPutInput, SessionInstructionsEntryRemoveInput, SessionGenerateInput, SessionGenerateOutput, SessionLogInput, SessionLogOutput, SessionInterruptInput, SessionInterruptOutput, SessionBackgroundInput, SessionMessageInput, SessionMessageUpdateInput, 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, ProjectCurrentInput, FormRequestListInput, FormRequestListOutput, FormListInput, FormListOutput, FormCreateInput, FormGetInput, FormStateInput, FormReplyInput, FormCancelInput, 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, ShellTimeoutInput, ShellTimeoutOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeCreateInput, WorktreeRemoveInput, WorktreeRefreshInput, WorkspaceCreateInput, WorkspaceDestroyInput, VcsGetInput, VcsGetOutput, VcsBaseInput, VcsBaseOutput, VcsStatusInput, VcsStatusOutput, VcsBranchesInput, VcsBranchesOutput, VcsDiffInput, VcsDiffOutput, DebugLocationListOutput, DebugLocationEvictInput, MigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ConfigGetInput, ConfigGetOutput } 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;
|
|
@@ -169,6 +169,9 @@ export declare const make: (options?: {
|
|
|
169
169
|
skill: {
|
|
170
170
|
list: (input?: SkillListInput) => Effect.Effect<SkillListOutput, import("@opencode-ai/protocol/errors").InvalidRequestError | import("@opencode-ai/protocol/errors").UnauthorizedError | Schema.SchemaError | ClientError | HttpClientError.HttpClientError, never>;
|
|
171
171
|
};
|
|
172
|
+
rpc: {
|
|
173
|
+
call: (input: RpcCallInput) => Effect.Effect<RpcCallOutput, import("@opencode-ai/protocol/errors").InvalidRequestError | import("@opencode-ai/protocol/errors").RpcError | import("@opencode-ai/protocol/errors").RpcInternalError | import("@opencode-ai/protocol/errors").UnauthorizedError | Schema.SchemaError | ClientError | HttpClientError.HttpClientError, never>;
|
|
174
|
+
};
|
|
172
175
|
event: {
|
|
173
176
|
subscribe: () => Stream.Stream<{
|
|
174
177
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
@@ -2419,6 +2422,20 @@ export declare const make: (options?: {
|
|
|
2419
2422
|
readonly metadata?: {
|
|
2420
2423
|
readonly [x: string]: unknown;
|
|
2421
2424
|
} | undefined;
|
|
2425
|
+
} | {
|
|
2426
|
+
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
2427
|
+
readonly location: {
|
|
2428
|
+
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
2429
|
+
readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
|
|
2430
|
+
};
|
|
2431
|
+
readonly data: {
|
|
2432
|
+
readonly [x: string]: unknown;
|
|
2433
|
+
};
|
|
2434
|
+
readonly type: `rpc.${string}`;
|
|
2435
|
+
readonly created: number;
|
|
2436
|
+
readonly metadata?: {
|
|
2437
|
+
readonly [x: string]: unknown;
|
|
2438
|
+
} | undefined;
|
|
2422
2439
|
} | {
|
|
2423
2440
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
2424
2441
|
readonly data: {};
|
|
@@ -390,6 +390,12 @@ const EndpointCommandList = (raw) => (input) => preserveEffect()(raw["command.li
|
|
|
390
390
|
const adaptGroupCommand = (raw) => ({ list: EndpointCommandList(raw) });
|
|
391
391
|
const EndpointSkillList = (raw) => (input) => preserveEffect()(raw["skill.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
392
392
|
const adaptGroupSkill = (raw) => ({ list: EndpointSkillList(raw) });
|
|
393
|
+
const EndpointRpcCall = (raw) => (input) => preserveEffect()(raw["rpc.call"]({
|
|
394
|
+
params: { rpcID: input["rpcID"], method: input["method"] },
|
|
395
|
+
query: { location: input["location"] },
|
|
396
|
+
payload: { input: input["input"] },
|
|
397
|
+
}).pipe(Effect.mapError(mapClientError)));
|
|
398
|
+
const adaptGroupRpc = (raw) => ({ call: EndpointRpcCall(raw) });
|
|
393
399
|
const EndpointEventSubscribe = (raw) => () => preserveStream()(Stream.unwrap(raw["event.subscribe"]({}).pipe(Effect.mapError(mapClientError), Effect.map((stream) => stream.pipe(Stream.mapError(mapClientError))))));
|
|
394
400
|
const adaptGroupEvent = (raw) => ({ subscribe: EndpointEventSubscribe(raw) });
|
|
395
401
|
const EndpointPtyList = (raw) => (input) => preserveEffect()(raw["pty.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
|
|
@@ -571,6 +577,7 @@ const adaptClient = (raw) => ({
|
|
|
571
577
|
file: adaptGroupFile(raw["server.fs"]),
|
|
572
578
|
command: adaptGroupCommand(raw["server.command"]),
|
|
573
579
|
skill: adaptGroupSkill(raw["server.skill"]),
|
|
580
|
+
rpc: adaptGroupRpc(raw["server.rpc"]),
|
|
574
581
|
event: adaptGroupEvent(raw["server.event"]),
|
|
575
582
|
pty: adaptGroupPty(raw["server.pty"]),
|
|
576
583
|
experimental: adaptGroupExperimental(raw["server.experimental"]),
|
package/dist/effect/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Effect } from "effect";
|
|
2
|
+
import type { OpenCode } from "./client.js";
|
|
2
3
|
export * from "./generated/index";
|
|
3
|
-
export
|
|
4
|
+
export { OpenCode } from "./client.js";
|
|
5
|
+
export type { AgentApi, AppApi, CatalogApi, CommandApi, ConfigApi, EventApi, IntegrationApi, ModelApi, PluginApi, ProviderApi, ReferenceApi, RpcApi, RpcClient, WebSearchApi, SessionApi, SkillApi, } from "./api.js";
|
|
4
6
|
export { Agent } from "@opencode-ai/schema/agent";
|
|
5
7
|
export { Command } from "@opencode-ai/schema/command";
|
|
6
8
|
export { Config } from "@opencode-ai/schema/config";
|
|
@@ -30,4 +32,4 @@ export { Skill } from "@opencode-ai/schema/skill";
|
|
|
30
32
|
export { Prompt } from "@opencode-ai/schema/prompt";
|
|
31
33
|
export { PromptInput } from "@opencode-ai/schema/prompt-input";
|
|
32
34
|
export type { OpenCodeEvent } from "@opencode-ai/protocol/groups/event";
|
|
33
|
-
export type OpenCodeClient = Effect.Success<ReturnType<typeof
|
|
35
|
+
export type OpenCodeClient = Effect.Success<ReturnType<typeof OpenCode.make>>;
|
package/dist/effect/index.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * as RpcClientRuntime from "./rpc.js";
|
|
2
|
+
import type { Rpc } from "@opencode-ai/schema/rpc";
|
|
3
|
+
import type { RpcError, RpcInternalError } from "@opencode-ai/protocol/errors";
|
|
4
|
+
import type { OpenCodeEvent } from "@opencode-ai/protocol/groups/event";
|
|
5
|
+
import { Effect, Schema, Stream } from "effect";
|
|
6
|
+
import type { RpcArguments, RpcCallOptions } from "../promise/rpc.js";
|
|
7
|
+
import type { RpcCallInput, RpcCallOutput } from "./api/api.js";
|
|
8
|
+
type DecodeError<S> = S extends Schema.Top ? Schema.SchemaError : never;
|
|
9
|
+
export type RpcClient<D extends Rpc.Definition, E = never, Options = RpcCallOptions, EventError = E> = {
|
|
10
|
+
readonly [Name in keyof D["methods"]]: (...args: RpcArguments<Rpc.Input<D["methods"][Name]["input"]>, Options>) => Effect.Effect<Rpc.Output<D["methods"][Name]["output"]>, Rpc.MethodError<D["methods"][Name]> | DecodeError<D["methods"][Name]["output"]> | E>;
|
|
11
|
+
} & {
|
|
12
|
+
readonly events: {
|
|
13
|
+
readonly subscribe: <Name extends keyof D["events"] & string>(name: Name) => Stream.Stream<Rpc.EventPayload<D, Name>, DecodeError<D["events"][Name]["schema"]> | EventError>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export interface RpcApi<E = never, Options = RpcCallOptions, EventError = E> {
|
|
17
|
+
<D extends Rpc.Definition>(definition: D): RpcClient<D, E, Options, EventError>;
|
|
18
|
+
}
|
|
19
|
+
export declare function make<CallError, EventError>(call: (input: RpcCallInput, options?: RpcCallOptions) => Effect.Effect<RpcCallOutput, CallError>, subscribe: () => Stream.Stream<OpenCodeEvent, EventError>): RpcApi<Exclude<CallError, RpcError | RpcInternalError> | Rpc.SystemError, RpcCallOptions, EventError>;
|
|
20
|
+
export declare function aborted(signal: AbortSignal): Effect.Effect<void, never, never>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export * as RpcClientRuntime from "./rpc.js";
|
|
2
|
+
import { Effect, Schema, Stream } from "effect";
|
|
3
|
+
import { RpcRuntime } from "../rpc-runtime.js";
|
|
4
|
+
export function make(call, subscribe) {
|
|
5
|
+
return (definition) => {
|
|
6
|
+
const methods = Object.fromEntries(Object.entries(definition.methods).map(([name, method]) => [
|
|
7
|
+
name,
|
|
8
|
+
(input, options) => {
|
|
9
|
+
const result = Effect.gen(function* () {
|
|
10
|
+
const response = yield* call({
|
|
11
|
+
rpcID: definition.id,
|
|
12
|
+
method: name,
|
|
13
|
+
input,
|
|
14
|
+
location: options?.location,
|
|
15
|
+
}, options);
|
|
16
|
+
return yield* RpcRuntime.read(method.output, response.output);
|
|
17
|
+
}).pipe(Effect.catch((error) => RpcRuntime.readError(method, error)));
|
|
18
|
+
const signal = options?.signal;
|
|
19
|
+
if (!signal)
|
|
20
|
+
return result;
|
|
21
|
+
return Effect.suspend(() => signal.aborted
|
|
22
|
+
? Effect.interrupt
|
|
23
|
+
: Effect.raceFirst(result, Effect.andThen(aborted(signal), Effect.interrupt)));
|
|
24
|
+
},
|
|
25
|
+
]));
|
|
26
|
+
// SAFETY: Every runtime key comes from this definition, and each value is decoded through its corresponding schema.
|
|
27
|
+
// oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion
|
|
28
|
+
return Object.assign(methods, {
|
|
29
|
+
events: {
|
|
30
|
+
subscribe: (name) => {
|
|
31
|
+
const type = RpcRuntime.eventType(definition, name);
|
|
32
|
+
if (!Object.hasOwn(definition.events, name))
|
|
33
|
+
return Stream.fail(new Error(`Unknown RPC event: ${type}`));
|
|
34
|
+
const schema = definition.events[name];
|
|
35
|
+
return subscribe().pipe(Stream.filter((event) => event.type === type), Stream.mapEffect((event) => RpcRuntime.event(definition, name, schema, event)));
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export function aborted(signal) {
|
|
42
|
+
return Effect.callback((resume) => {
|
|
43
|
+
if (signal.aborted)
|
|
44
|
+
return resume(Effect.void);
|
|
45
|
+
const abort = () => resume(Effect.void);
|
|
46
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
47
|
+
return Effect.sync(() => signal.removeEventListener("abort", abort));
|
|
48
|
+
});
|
|
49
|
+
}
|
package/dist/promise/api.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
type
|
|
1
|
+
import type { OpenCode } from "./client.js";
|
|
2
|
+
type Client = ReturnType<typeof OpenCode.make>;
|
|
3
|
+
export type { RpcApi, RpcCallOptions, RpcClient, RpcEventPayload } from "./rpc.js";
|
|
2
4
|
export type AgentApi = Client["agent"];
|
|
3
5
|
export type CommandApi = Client["command"];
|
|
4
6
|
export type ConfigApi = Client["config"];
|
|
@@ -19,4 +21,3 @@ export interface CatalogApi {
|
|
|
19
21
|
readonly provider: ProviderApi;
|
|
20
22
|
readonly model: ModelApi;
|
|
21
23
|
}
|
|
22
|
-
export {};
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
export * as OpenCode from "./client.js";
|
|
2
|
+
import { OpenCode } from "./generated/index.js";
|
|
3
|
+
import type { ClientOptions } from "./generated/client.js";
|
|
4
|
+
export type { ClientOptions, RequestOptions } from "./generated/client.js";
|
|
5
|
+
export declare function make(options: ClientOptions): {
|
|
6
|
+
rpc: import("./rpc.js").RpcApi<import("./rpc.js").RpcCallOptions> & {
|
|
7
|
+
call: (input: import("./index.js").RpcCallInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").RpcOutput>;
|
|
8
|
+
};
|
|
9
|
+
event: {
|
|
10
|
+
subscribe(options?: {
|
|
11
|
+
readonly signal?: AbortSignal;
|
|
12
|
+
} | undefined): AsyncIterable<import("./index.js").V2Event>;
|
|
13
|
+
};
|
|
14
|
+
health: {
|
|
15
|
+
get: (requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ServiceHealth>;
|
|
16
|
+
};
|
|
17
|
+
server: {
|
|
18
|
+
get: (requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ServerGetOutput>;
|
|
19
|
+
};
|
|
20
|
+
location: {
|
|
21
|
+
get: (input?: import("./index.js").LocationGetInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").LocationGetOutput>;
|
|
22
|
+
};
|
|
23
|
+
agent: {
|
|
24
|
+
list: (input?: import("./index.js").AgentListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").AgentListOutput>;
|
|
25
|
+
get: (input: import("./index.js").AgentGetInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").AgentGetOutput>;
|
|
26
|
+
};
|
|
27
|
+
plugin: {
|
|
28
|
+
list: (input?: import("./index.js").PluginListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PluginListOutput>;
|
|
29
|
+
};
|
|
30
|
+
session: {
|
|
31
|
+
list: (input?: import("./index.js").SessionListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionsResponse>;
|
|
32
|
+
stats: (input?: import("./index.js").SessionStatsInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionStatsInfo>;
|
|
33
|
+
create: (input?: import("./index.js").SessionCreateInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionInfo>;
|
|
34
|
+
import: (input: import("./index.js").SessionImportInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionInfo>;
|
|
35
|
+
export: (input: import("./index.js").SessionExportInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionTransferData>;
|
|
36
|
+
active: (requestOptions?: OpenCode.RequestOptions) => Promise<{
|
|
37
|
+
[x: string]: import("./index.js").SessionActive;
|
|
38
|
+
}>;
|
|
39
|
+
get: (input: import("./index.js").SessionGetInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionInfo>;
|
|
40
|
+
remove: (input: import("./index.js").SessionRemoveInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
41
|
+
fork: (input: import("./index.js").SessionForkInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionInfo>;
|
|
42
|
+
switchAgent: (input: import("./index.js").SessionSwitchAgentInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
43
|
+
switchModel: (input: import("./index.js").SessionSwitchModelInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
44
|
+
rename: (input: import("./index.js").SessionRenameInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
45
|
+
move: (input: import("./index.js").SessionMoveInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
46
|
+
prompt: (input: import("./index.js").SessionPromptInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionInboxUser>;
|
|
47
|
+
command: (input: import("./index.js").SessionCommandInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
48
|
+
skill: (input: import("./index.js").SessionSkillInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
49
|
+
synthetic: (input: import("./index.js").SessionSyntheticInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionInboxSynthetic>;
|
|
50
|
+
shell: (input: import("./index.js").SessionShellInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
51
|
+
compact: (input: import("./index.js").SessionCompactInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionInboxCompaction>;
|
|
52
|
+
wait: (input: import("./index.js").SessionWaitInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
53
|
+
revert: {
|
|
54
|
+
stage: (input: import("./index.js").SessionRevertStageInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionRevert>;
|
|
55
|
+
clear: (input: import("./index.js").SessionRevertClearInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
56
|
+
commit: (input: import("./index.js").SessionRevertCommitInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
57
|
+
};
|
|
58
|
+
context: (input: import("./index.js").SessionContextInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionMessageInfo[]>;
|
|
59
|
+
inbox: {
|
|
60
|
+
list: (input: import("./index.js").SessionInboxListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionInboxInfo[]>;
|
|
61
|
+
cancel: (input: import("./index.js").SessionInboxCancelInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
62
|
+
steer: (input: import("./index.js").SessionInboxSteerInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
63
|
+
queue: (input: import("./index.js").SessionInboxQueueInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
64
|
+
};
|
|
65
|
+
instructions: {
|
|
66
|
+
entry: {
|
|
67
|
+
list: (input: import("./index.js").SessionInstructionsEntryListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").InstructionEntryInfo[]>;
|
|
68
|
+
put: (input: import("./index.js").SessionInstructionsEntryPutInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
69
|
+
remove: (input: import("./index.js").SessionInstructionsEntryRemoveInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
generate: (input: import("./index.js").SessionGenerateInput, requestOptions?: OpenCode.RequestOptions) => Promise<{
|
|
73
|
+
text: string;
|
|
74
|
+
}>;
|
|
75
|
+
log: (input: import("./index.js").SessionLogInput, requestOptions?: OpenCode.RequestOptions) => AsyncIterable<import("./index.js").SessionLogOutput>;
|
|
76
|
+
interrupt: (input: import("./index.js").SessionInterruptInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionInterruptResponse>;
|
|
77
|
+
background: (input: import("./index.js").SessionBackgroundInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
78
|
+
message: (input: import("./index.js").SessionMessageInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionMessageAgentSelected | import("./index.js").SessionMessageSynthetic | import("./index.js").SessionMessageSystem | import("./index.js").SessionMessageSkill | import("./index.js").SessionMessageShell | import("./index.js").SessionMessageCompactionRunning | import("./index.js").SessionMessageCompactionCompleted | import("./index.js").SessionMessageLocationSwitched | import("./index.js").SessionMessageModelSelected | import("./index.js").SessionMessageCompactionFailed | import("./index.js").SessionMessageUser | import("./index.js").SessionMessageAssistant>;
|
|
79
|
+
messageUpdate: (input: import("./index.js").SessionMessageUpdateInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionMessageAssistant>;
|
|
80
|
+
environment: (input: import("./index.js").SessionEnvironmentInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
81
|
+
view: (input: import("./index.js").SessionViewInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
82
|
+
};
|
|
83
|
+
message: {
|
|
84
|
+
list: (input: import("./index.js").MessageListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SessionMessagesResponse>;
|
|
85
|
+
};
|
|
86
|
+
model: {
|
|
87
|
+
list: (input?: import("./index.js").ModelListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ModelListOutput>;
|
|
88
|
+
default: (input?: import("./index.js").ModelDefaultInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ModelDefaultOutput>;
|
|
89
|
+
};
|
|
90
|
+
generate: {
|
|
91
|
+
text: (input: import("./index.js").GenerateTextInput, requestOptions?: OpenCode.RequestOptions) => Promise<{
|
|
92
|
+
text: string;
|
|
93
|
+
}>;
|
|
94
|
+
};
|
|
95
|
+
provider: {
|
|
96
|
+
list: (input?: import("./index.js").ProviderListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ProviderListOutput>;
|
|
97
|
+
get: (input: import("./index.js").ProviderGetInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ProviderGetOutput>;
|
|
98
|
+
};
|
|
99
|
+
integration: {
|
|
100
|
+
list: (input?: import("./index.js").IntegrationListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").IntegrationListOutput>;
|
|
101
|
+
get: (input: import("./index.js").IntegrationGetInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").IntegrationGetOutput>;
|
|
102
|
+
wellknown: {
|
|
103
|
+
add: (input: import("./index.js").IntegrationWellknownAddInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
104
|
+
};
|
|
105
|
+
connect: {
|
|
106
|
+
key: (input: import("./index.js").IntegrationConnectKeyInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
107
|
+
};
|
|
108
|
+
oauth: {
|
|
109
|
+
connect: (input: import("./index.js").IntegrationOauthConnectInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").IntegrationOauthConnectOutput>;
|
|
110
|
+
status: (input: import("./index.js").IntegrationOauthStatusInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").IntegrationOauthStatusOutput>;
|
|
111
|
+
complete: (input: import("./index.js").IntegrationOauthCompleteInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
112
|
+
cancel: (input: import("./index.js").IntegrationOauthCancelInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
113
|
+
};
|
|
114
|
+
command: {
|
|
115
|
+
connect: (input: import("./index.js").IntegrationCommandConnectInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").IntegrationCommandConnectOutput>;
|
|
116
|
+
status: (input: import("./index.js").IntegrationCommandStatusInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").IntegrationCommandStatusOutput>;
|
|
117
|
+
cancel: (input: import("./index.js").IntegrationCommandCancelInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
mcp: {
|
|
121
|
+
list: (input?: import("./index.js").McpListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").McpListOutput>;
|
|
122
|
+
add: (input: import("./index.js").McpAddInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
123
|
+
remove: (input: import("./index.js").McpRemoveInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
124
|
+
connect: (input: import("./index.js").McpConnectInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
125
|
+
disconnect: (input: import("./index.js").McpDisconnectInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
126
|
+
resource: {
|
|
127
|
+
catalog: (input?: import("./index.js").McpResourceCatalogInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").McpResourceCatalogOutput>;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
credential: {
|
|
131
|
+
update: (input: import("./index.js").CredentialUpdateInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
132
|
+
activate: (input: import("./index.js").CredentialActivateInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
133
|
+
remove: (input: import("./index.js").CredentialRemoveInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
134
|
+
};
|
|
135
|
+
project: {
|
|
136
|
+
list: (requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ProjectListOutput>;
|
|
137
|
+
update: (input: import("./index.js").ProjectUpdateInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").Project>;
|
|
138
|
+
current: (input?: import("./index.js").ProjectCurrentInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ProjectCurrent>;
|
|
139
|
+
};
|
|
140
|
+
form: {
|
|
141
|
+
request: {
|
|
142
|
+
list: (input?: import("./index.js").FormRequestListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").FormRequestListOutput>;
|
|
143
|
+
};
|
|
144
|
+
list: (input: import("./index.js").FormListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").FormInfo[]>;
|
|
145
|
+
create: (input: import("./index.js").FormCreateInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").FormInfo>;
|
|
146
|
+
get: (input: import("./index.js").FormGetInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").FormInfo>;
|
|
147
|
+
state: (input: import("./index.js").FormStateInput, requestOptions?: OpenCode.RequestOptions) => Promise<{
|
|
148
|
+
status: "pending";
|
|
149
|
+
} | {
|
|
150
|
+
status: "answered";
|
|
151
|
+
answer: import("./index.js").FormAnswer;
|
|
152
|
+
} | {
|
|
153
|
+
status: "cancelled";
|
|
154
|
+
}>;
|
|
155
|
+
reply: (input: import("./index.js").FormReplyInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
156
|
+
cancel: (input: import("./index.js").FormCancelInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
157
|
+
};
|
|
158
|
+
permission: {
|
|
159
|
+
request: {
|
|
160
|
+
list: (input?: import("./index.js").PermissionRequestListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PermissionRequestListOutput>;
|
|
161
|
+
};
|
|
162
|
+
saved: {
|
|
163
|
+
list: (input?: import("./index.js").PermissionSavedListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PermissionSavedInfo[]>;
|
|
164
|
+
remove: (input: import("./index.js").PermissionSavedRemoveInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
165
|
+
};
|
|
166
|
+
create: (input: import("./index.js").PermissionCreateInput, requestOptions?: OpenCode.RequestOptions) => Promise<{
|
|
167
|
+
id: string;
|
|
168
|
+
effect: import("./index.js").PermissionEffect;
|
|
169
|
+
}>;
|
|
170
|
+
list: (input: import("./index.js").PermissionListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PermissionRequest[]>;
|
|
171
|
+
get: (input: import("./index.js").PermissionGetInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PermissionRequest>;
|
|
172
|
+
reply: (input: import("./index.js").PermissionReplyInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
173
|
+
};
|
|
174
|
+
file: {
|
|
175
|
+
read: (input: import("./index.js").FileReadInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").FileReadOutput>;
|
|
176
|
+
list: (input?: import("./index.js").FileListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").FileListOutput>;
|
|
177
|
+
find: (input: import("./index.js").FileFindInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").FileFindOutput>;
|
|
178
|
+
};
|
|
179
|
+
command: {
|
|
180
|
+
list: (input?: import("./index.js").CommandListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").CommandListOutput>;
|
|
181
|
+
};
|
|
182
|
+
skill: {
|
|
183
|
+
list: (input?: import("./index.js").SkillListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").SkillListOutput>;
|
|
184
|
+
};
|
|
185
|
+
pty: {
|
|
186
|
+
list: (input?: import("./index.js").PtyListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PtyListOutput>;
|
|
187
|
+
create: (input?: import("./index.js").PtyCreateInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PtyCreateOutput>;
|
|
188
|
+
get: (input: import("./index.js").PtyGetInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PtyGetOutput>;
|
|
189
|
+
update: (input: import("./index.js").PtyUpdateInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PtyUpdateOutput>;
|
|
190
|
+
remove: (input: import("./index.js").PtyRemoveInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
191
|
+
connect: {
|
|
192
|
+
token: (input: import("./index.js").PtyConnectTokenInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PtyConnectTokenOutput>;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
experimental: {
|
|
196
|
+
persistentPty: {
|
|
197
|
+
read: (input: import("./index.js").ExperimentalPersistentPtyReadInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PersistentPtyReadResult | null>;
|
|
198
|
+
list: (input: import("./index.js").ExperimentalPersistentPtyListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PersistentPtyInfo[]>;
|
|
199
|
+
create: (input: import("./index.js").ExperimentalPersistentPtyCreateInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PersistentPtyInfo>;
|
|
200
|
+
shutdown: (requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
201
|
+
handoff: (requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ExperimentalPersistentPtyHandoffOutput>;
|
|
202
|
+
get: (input: import("./index.js").ExperimentalPersistentPtyGetInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PersistentPtyInfo>;
|
|
203
|
+
update: (input: import("./index.js").ExperimentalPersistentPtyUpdateInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PersistentPtyInfo>;
|
|
204
|
+
snapshot: (input: import("./index.js").ExperimentalPersistentPtySnapshotInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PersistentPtySnapshot>;
|
|
205
|
+
remove: (input: import("./index.js").ExperimentalPersistentPtyRemoveInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
206
|
+
connectToken: (input: import("./index.js").ExperimentalPersistentPtyConnectTokenInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").PtyTicketConnectToken>;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
shell: {
|
|
210
|
+
list: (input?: import("./index.js").ShellListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ShellListOutput>;
|
|
211
|
+
create: (input: import("./index.js").ShellCreateInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ShellCreateOutput>;
|
|
212
|
+
get: (input: import("./index.js").ShellGetInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ShellGetOutput>;
|
|
213
|
+
timeout: (input: import("./index.js").ShellTimeoutInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ShellTimeoutOutput>;
|
|
214
|
+
output: (input: import("./index.js").ShellOutputInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ShellOutputOutput>;
|
|
215
|
+
remove: (input: import("./index.js").ShellRemoveInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
216
|
+
};
|
|
217
|
+
reference: {
|
|
218
|
+
list: (input?: import("./index.js").ReferenceListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ReferenceListOutput>;
|
|
219
|
+
};
|
|
220
|
+
worktree: {
|
|
221
|
+
list: (input: import("./index.js").WorktreeListInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").WorktreeList>;
|
|
222
|
+
create: (input: import("./index.js").WorktreeCreateInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").WorktreeInfo>;
|
|
223
|
+
remove: (input: import("./index.js").WorktreeRemoveInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
224
|
+
refresh: (input: import("./index.js").WorktreeRefreshInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
225
|
+
};
|
|
226
|
+
workspace: {
|
|
227
|
+
create: (input: import("./index.js").WorkspaceCreateInput, requestOptions?: OpenCode.RequestOptions) => Promise<string>;
|
|
228
|
+
destroy: (input: import("./index.js").WorkspaceDestroyInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").WorkspaceDestroyResult>;
|
|
229
|
+
};
|
|
230
|
+
vcs: {
|
|
231
|
+
get: (input?: import("./index.js").VcsGetInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").VcsGetOutput>;
|
|
232
|
+
base: (input?: import("./index.js").VcsBaseInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").VcsBaseOutput>;
|
|
233
|
+
status: (input?: import("./index.js").VcsStatusInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").VcsStatusOutput>;
|
|
234
|
+
branches: (input?: import("./index.js").VcsBranchesInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").VcsBranchesOutput>;
|
|
235
|
+
diff: (input: import("./index.js").VcsDiffInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").VcsDiffOutput>;
|
|
236
|
+
};
|
|
237
|
+
debug: {
|
|
238
|
+
location: {
|
|
239
|
+
list: (requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").DebugLocationListOutput>;
|
|
240
|
+
evict: (input?: import("./index.js").DebugLocationEvictInput, requestOptions?: OpenCode.RequestOptions) => Promise<void>;
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
migration: {
|
|
244
|
+
v1: {
|
|
245
|
+
status: (requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").MigrationV1StatusOutput>;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
websearch: {
|
|
249
|
+
providers: (input?: import("./index.js").WebsearchProvidersInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").WebsearchProvidersOutput>;
|
|
250
|
+
query: (input: import("./index.js").WebsearchQueryInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").WebsearchQueryOutput>;
|
|
251
|
+
};
|
|
252
|
+
config: {
|
|
253
|
+
get: (input?: import("./index.js").ConfigGetInput, requestOptions?: OpenCode.RequestOptions) => Promise<import("./index.js").ConfigGetOutput>;
|
|
254
|
+
};
|
|
255
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * as OpenCode from "./client.js";
|
|
2
|
+
import { SharedEvents } from "../shared-events.js";
|
|
3
|
+
import { OpenCode } from "./generated/index.js";
|
|
4
|
+
import { makeRpc } from "./rpc.js";
|
|
5
|
+
export function make(options) {
|
|
6
|
+
const raw = OpenCode.make(options);
|
|
7
|
+
const events = SharedEvents.make((signal) => raw.event.subscribe({ signal }));
|
|
8
|
+
return {
|
|
9
|
+
...raw,
|
|
10
|
+
rpc: Object.assign(makeRpc(raw, events), raw.rpc),
|
|
11
|
+
event: events,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ServerGetOutput, LocationGetInput, LocationGetOutput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, SessionListInput, SessionStatsInput, 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, SessionMessageUpdateInput, 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, 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, PtyConnectTokenInput, PtyConnectTokenOutput, ExperimentalPersistentPtyReadInput, ExperimentalPersistentPtyListInput, ExperimentalPersistentPtyCreateInput, ExperimentalPersistentPtyHandoffOutput, ExperimentalPersistentPtyGetInput, ExperimentalPersistentPtyUpdateInput, ExperimentalPersistentPtySnapshotInput, ExperimentalPersistentPtyRemoveInput, ExperimentalPersistentPtyConnectTokenInput, ShellListInput, ShellListOutput, ShellCreateInput, ShellCreateOutput, ShellGetInput, ShellGetOutput, ShellTimeoutInput, ShellTimeoutOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeCreateInput, WorktreeRemoveInput, WorktreeRefreshInput, WorkspaceCreateInput, WorkspaceDestroyInput, VcsGetInput, VcsGetOutput, VcsBaseInput, VcsBaseOutput, VcsStatusInput, VcsStatusOutput, VcsBranchesInput, VcsBranchesOutput, VcsDiffInput, VcsDiffOutput, DebugLocationListOutput, DebugLocationEvictInput, MigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ConfigGetInput, ConfigGetOutput } from "./types.js";
|
|
1
|
+
import type { ServerGetOutput, LocationGetInput, LocationGetOutput, AgentListInput, AgentListOutput, AgentGetInput, AgentGetOutput, PluginListInput, PluginListOutput, SessionListInput, SessionStatsInput, 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, SessionMessageUpdateInput, 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, 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, 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, ShellTimeoutInput, ShellTimeoutOutput, ShellOutputInput, ShellOutputOutput, ShellRemoveInput, ReferenceListInput, ReferenceListOutput, WorktreeListInput, WorktreeCreateInput, WorktreeRemoveInput, WorktreeRefreshInput, WorkspaceCreateInput, WorkspaceDestroyInput, VcsGetInput, VcsGetOutput, VcsBaseInput, VcsBaseOutput, VcsStatusInput, VcsStatusOutput, VcsBranchesInput, VcsBranchesOutput, VcsDiffInput, VcsDiffOutput, DebugLocationListOutput, DebugLocationEvictInput, MigrationV1StatusOutput, WebsearchProvidersInput, WebsearchProvidersOutput, WebsearchQueryInput, WebsearchQueryOutput, ConfigGetInput, ConfigGetOutput } from "./types.js";
|
|
2
2
|
export interface ClientOptions {
|
|
3
3
|
readonly baseUrl: string;
|
|
4
4
|
readonly fetch?: typeof globalThis.fetch;
|
|
@@ -180,6 +180,9 @@ export declare function make(options: ClientOptions): {
|
|
|
180
180
|
skill: {
|
|
181
181
|
list: (input?: SkillListInput, requestOptions?: RequestOptions) => Promise<SkillListOutput>;
|
|
182
182
|
};
|
|
183
|
+
rpc: {
|
|
184
|
+
call: (input: RpcCallInput, requestOptions?: RequestOptions) => Promise<import("./types.js").RpcOutput>;
|
|
185
|
+
};
|
|
183
186
|
event: {
|
|
184
187
|
subscribe: (requestOptions?: RequestOptions) => AsyncIterable<EventSubscribeOutput>;
|
|
185
188
|
};
|
|
@@ -952,6 +952,17 @@ export function make(options) {
|
|
|
952
952
|
empty: false,
|
|
953
953
|
}, requestOptions),
|
|
954
954
|
},
|
|
955
|
+
rpc: {
|
|
956
|
+
call: (input, requestOptions) => request({
|
|
957
|
+
method: "POST",
|
|
958
|
+
path: `/api/rpc/${encodeURIComponent(input.rpcID)}/${encodeURIComponent(input.method)}`,
|
|
959
|
+
query: { location: input["location"] },
|
|
960
|
+
body: { input: input["input"] },
|
|
961
|
+
successStatus: 200,
|
|
962
|
+
declaredStatuses: [400, 500, 401],
|
|
963
|
+
empty: false,
|
|
964
|
+
}, requestOptions),
|
|
965
|
+
},
|
|
955
966
|
event: {
|
|
956
967
|
subscribe: (requestOptions) => sse({ method: "GET", path: `/api/event`, successStatus: 200, declaredStatuses: [401, 400], empty: false }, requestOptions),
|
|
957
968
|
},
|