@matrix-ai/sdk 1.6.0 → 1.6.1
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/client.js +26 -0
- package/dist/process.d.ts +3 -0
- package/dist/process.js +33 -0
- package/dist/server.js +25 -14
- package/dist/v2/client.js +40 -3
- package/dist/v2/gen/sdk.gen.d.ts +59 -38
- package/dist/v2/gen/sdk.gen.js +103 -64
- package/dist/v2/gen/types.gen.d.ts +551 -417
- package/dist/v2/server.js +25 -14
- package/package.json +7 -4
package/dist/client.js
CHANGED
|
@@ -2,6 +2,31 @@ export * from "./gen/types.gen.js";
|
|
|
2
2
|
import { createClient } from "./gen/client/client.gen.js";
|
|
3
3
|
import { OpencodeClient } from "./gen/sdk.gen.js";
|
|
4
4
|
export { OpencodeClient };
|
|
5
|
+
function pick(value, fallback) {
|
|
6
|
+
if (!value)
|
|
7
|
+
return;
|
|
8
|
+
if (!fallback)
|
|
9
|
+
return value;
|
|
10
|
+
if (value === fallback)
|
|
11
|
+
return fallback;
|
|
12
|
+
if (value === encodeURIComponent(fallback))
|
|
13
|
+
return fallback;
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
function rewrite(request, directory) {
|
|
17
|
+
if (request.method !== "GET" && request.method !== "HEAD")
|
|
18
|
+
return request;
|
|
19
|
+
const value = pick(request.headers.get("x-opencode-directory"), directory);
|
|
20
|
+
if (!value)
|
|
21
|
+
return request;
|
|
22
|
+
const url = new URL(request.url);
|
|
23
|
+
if (!url.searchParams.has("directory")) {
|
|
24
|
+
url.searchParams.set("directory", value);
|
|
25
|
+
}
|
|
26
|
+
const next = new Request(url, request);
|
|
27
|
+
next.headers.delete("x-opencode-directory");
|
|
28
|
+
return next;
|
|
29
|
+
}
|
|
5
30
|
export function createOpencodeClient(config) {
|
|
6
31
|
if (!config?.fetch) {
|
|
7
32
|
const customFetch = (req) => {
|
|
@@ -21,5 +46,6 @@ export function createOpencodeClient(config) {
|
|
|
21
46
|
};
|
|
22
47
|
}
|
|
23
48
|
const client = createClient(config);
|
|
49
|
+
client.interceptors.request.use((request) => rewrite(request, config?.directory));
|
|
24
50
|
return new OpencodeClient({ client });
|
|
25
51
|
}
|
package/dist/process.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
// Duplicated from `packages/opencode/src/util/process.ts` because the SDK cannot
|
|
3
|
+
// import `opencode` without creating a cycle (`opencode` depends on `@opencode-ai/sdk`).
|
|
4
|
+
export function stop(proc) {
|
|
5
|
+
if (proc.exitCode !== null || proc.signalCode !== null)
|
|
6
|
+
return;
|
|
7
|
+
if (process.platform === "win32" && proc.pid) {
|
|
8
|
+
const out = spawnSync("taskkill", ["/pid", String(proc.pid), "/T", "/F"], { windowsHide: true });
|
|
9
|
+
if (!out.error && out.status === 0)
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
proc.kill();
|
|
13
|
+
}
|
|
14
|
+
export function bindAbort(proc, signal, onAbort) {
|
|
15
|
+
if (!signal)
|
|
16
|
+
return () => { };
|
|
17
|
+
const abort = () => {
|
|
18
|
+
clear();
|
|
19
|
+
stop(proc);
|
|
20
|
+
onAbort?.();
|
|
21
|
+
};
|
|
22
|
+
const clear = () => {
|
|
23
|
+
signal.removeEventListener("abort", abort);
|
|
24
|
+
proc.off("exit", clear);
|
|
25
|
+
proc.off("error", clear);
|
|
26
|
+
};
|
|
27
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
28
|
+
proc.on("exit", clear);
|
|
29
|
+
proc.on("error", clear);
|
|
30
|
+
if (signal.aborted)
|
|
31
|
+
abort();
|
|
32
|
+
return clear;
|
|
33
|
+
}
|
package/dist/server.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import launch from "cross-spawn";
|
|
2
|
+
import { stop, bindAbort } from "./process.js";
|
|
2
3
|
export async function createOpencodeServer(options) {
|
|
3
4
|
options = Object.assign({
|
|
4
5
|
hostname: "127.0.0.1",
|
|
@@ -8,28 +9,38 @@ export async function createOpencodeServer(options) {
|
|
|
8
9
|
const args = [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`];
|
|
9
10
|
if (options.config?.logLevel)
|
|
10
11
|
args.push(`--log-level=${options.config.logLevel}`);
|
|
11
|
-
const proc =
|
|
12
|
-
signal: options.signal,
|
|
12
|
+
const proc = launch(`opencode`, args, {
|
|
13
13
|
env: {
|
|
14
14
|
...process.env,
|
|
15
15
|
OPENCODE_CONFIG_CONTENT: JSON.stringify(options.config ?? {}),
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
|
+
let clear = () => { };
|
|
18
19
|
const url = await new Promise((resolve, reject) => {
|
|
19
20
|
const id = setTimeout(() => {
|
|
21
|
+
clear();
|
|
22
|
+
stop(proc);
|
|
20
23
|
reject(new Error(`Timeout waiting for server to start after ${options.timeout}ms`));
|
|
21
24
|
}, options.timeout);
|
|
22
25
|
let output = "";
|
|
26
|
+
let resolved = false;
|
|
23
27
|
proc.stdout?.on("data", (chunk) => {
|
|
28
|
+
if (resolved)
|
|
29
|
+
return;
|
|
24
30
|
output += chunk.toString();
|
|
25
31
|
const lines = output.split("\n");
|
|
26
32
|
for (const line of lines) {
|
|
27
33
|
if (line.startsWith("opencode server listening")) {
|
|
28
34
|
const match = line.match(/on\s+(https?:\/\/[^\s]+)/);
|
|
29
35
|
if (!match) {
|
|
30
|
-
|
|
36
|
+
clear();
|
|
37
|
+
stop(proc);
|
|
38
|
+
clearTimeout(id);
|
|
39
|
+
reject(new Error(`Failed to parse server url from output: ${line}`));
|
|
40
|
+
return;
|
|
31
41
|
}
|
|
32
42
|
clearTimeout(id);
|
|
43
|
+
resolved = true;
|
|
33
44
|
resolve(match[1]);
|
|
34
45
|
return;
|
|
35
46
|
}
|
|
@@ -50,17 +61,16 @@ export async function createOpencodeServer(options) {
|
|
|
50
61
|
clearTimeout(id);
|
|
51
62
|
reject(error);
|
|
52
63
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
});
|
|
58
|
-
}
|
|
64
|
+
clear = bindAbort(proc, options.signal, () => {
|
|
65
|
+
clearTimeout(id);
|
|
66
|
+
reject(options.signal?.reason);
|
|
67
|
+
});
|
|
59
68
|
});
|
|
60
69
|
return {
|
|
61
70
|
url,
|
|
62
71
|
close() {
|
|
63
|
-
|
|
72
|
+
clear();
|
|
73
|
+
stop(proc);
|
|
64
74
|
},
|
|
65
75
|
};
|
|
66
76
|
}
|
|
@@ -78,17 +88,18 @@ export function createOpencodeTui(options) {
|
|
|
78
88
|
if (options?.agent) {
|
|
79
89
|
args.push(`--agent=${options.agent}`);
|
|
80
90
|
}
|
|
81
|
-
const proc =
|
|
82
|
-
signal: options?.signal,
|
|
91
|
+
const proc = launch(`opencode`, args, {
|
|
83
92
|
stdio: "inherit",
|
|
84
93
|
env: {
|
|
85
94
|
...process.env,
|
|
86
95
|
OPENCODE_CONFIG_CONTENT: JSON.stringify(options?.config ?? {}),
|
|
87
96
|
},
|
|
88
97
|
});
|
|
98
|
+
const clear = bindAbort(proc, options?.signal);
|
|
89
99
|
return {
|
|
90
100
|
close() {
|
|
91
|
-
|
|
101
|
+
clear();
|
|
102
|
+
stop(proc);
|
|
92
103
|
},
|
|
93
104
|
};
|
|
94
105
|
}
|
package/dist/v2/client.js
CHANGED
|
@@ -2,6 +2,41 @@ export * from "./gen/types.gen.js";
|
|
|
2
2
|
import { createClient } from "./gen/client/client.gen.js";
|
|
3
3
|
import { OpencodeClient } from "./gen/sdk.gen.js";
|
|
4
4
|
export { OpencodeClient };
|
|
5
|
+
function pick(value, fallback, encode) {
|
|
6
|
+
if (!value)
|
|
7
|
+
return;
|
|
8
|
+
if (!fallback)
|
|
9
|
+
return value;
|
|
10
|
+
if (value === fallback)
|
|
11
|
+
return fallback;
|
|
12
|
+
if (encode && value === encode(fallback))
|
|
13
|
+
return fallback;
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
function rewrite(request, values) {
|
|
17
|
+
if (request.method !== "GET" && request.method !== "HEAD")
|
|
18
|
+
return request;
|
|
19
|
+
const url = new URL(request.url);
|
|
20
|
+
let changed = false;
|
|
21
|
+
for (const [name, key] of [
|
|
22
|
+
["x-opencode-directory", "directory"],
|
|
23
|
+
["x-opencode-workspace", "workspace"],
|
|
24
|
+
]) {
|
|
25
|
+
const value = pick(request.headers.get(name), key === "directory" ? values.directory : values.workspace, key === "directory" ? encodeURIComponent : undefined);
|
|
26
|
+
if (!value)
|
|
27
|
+
continue;
|
|
28
|
+
if (!url.searchParams.has(key)) {
|
|
29
|
+
url.searchParams.set(key, value);
|
|
30
|
+
}
|
|
31
|
+
changed = true;
|
|
32
|
+
}
|
|
33
|
+
if (!changed)
|
|
34
|
+
return request;
|
|
35
|
+
const next = new Request(url, request);
|
|
36
|
+
next.headers.delete("x-opencode-directory");
|
|
37
|
+
next.headers.delete("x-opencode-workspace");
|
|
38
|
+
return next;
|
|
39
|
+
}
|
|
5
40
|
export function createOpencodeClient(config) {
|
|
6
41
|
if (!config?.fetch) {
|
|
7
42
|
const customFetch = (req) => {
|
|
@@ -15,11 +50,9 @@ export function createOpencodeClient(config) {
|
|
|
15
50
|
};
|
|
16
51
|
}
|
|
17
52
|
if (config?.directory) {
|
|
18
|
-
const isNonASCII = /[^\x00-\x7F]/.test(config.directory);
|
|
19
|
-
const encodedDirectory = isNonASCII ? encodeURIComponent(config.directory) : config.directory;
|
|
20
53
|
config.headers = {
|
|
21
54
|
...config.headers,
|
|
22
|
-
"x-opencode-directory":
|
|
55
|
+
"x-opencode-directory": encodeURIComponent(config.directory),
|
|
23
56
|
};
|
|
24
57
|
}
|
|
25
58
|
if (config?.experimental_workspaceID) {
|
|
@@ -29,5 +62,9 @@ export function createOpencodeClient(config) {
|
|
|
29
62
|
};
|
|
30
63
|
}
|
|
31
64
|
const client = createClient(config);
|
|
65
|
+
client.interceptors.request.use((request) => rewrite(request, {
|
|
66
|
+
directory: config?.directory,
|
|
67
|
+
workspace: config?.experimental_workspaceID,
|
|
68
|
+
}));
|
|
32
69
|
return new OpencodeClient({ client });
|
|
33
70
|
}
|
package/dist/v2/gen/sdk.gen.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Client, type Options as Options2, type TDataShape } from "./client/index.js";
|
|
2
|
-
import type { AgentPartInput, AppAgentsResponses, AppLogErrors, AppLogResponses, AppSkillsResponses, Auth as Auth3, AuthRemoveErrors, AuthRemoveResponses, AuthSetErrors, AuthSetResponses, CommandListResponses, Config as Config3, ConfigGetResponses, ConfigProvidersResponses, ConfigUpdateErrors, ConfigUpdateResponses, EventSubscribeResponses, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiSessionSelect, EventTuiToastShow, ExperimentalResourceListResponses, ExperimentalSessionListResponses, ExperimentalWorkspaceCreateErrors, ExperimentalWorkspaceCreateResponses, ExperimentalWorkspaceListResponses, ExperimentalWorkspaceRemoveErrors, ExperimentalWorkspaceRemoveResponses, FileListResponses, FilePartInput, FilePartSource, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, FormatterStatusResponses, GlobalConfigGetResponses, GlobalConfigUpdateErrors, GlobalConfigUpdateResponses, GlobalDisposeResponses, GlobalEventResponses, GlobalHealthResponses, GlobalUpgradeErrors, GlobalUpgradeResponses, InstanceDisposeResponses, LspStatusResponses, McpAddErrors, McpAddResponses, McpAuthAuthenticateErrors, McpAuthAuthenticateResponses, McpAuthCallbackErrors, McpAuthCallbackResponses, McpAuthRemoveErrors, McpAuthRemoveResponses, McpAuthStartErrors, McpAuthStartResponses, McpConnectResponses, McpDisconnectResponses, McpLocalConfig, McpRemoteConfig, McpStatusResponses, OutputFormat, Part as Part2, PartDeleteErrors, PartDeleteResponses, PartUpdateErrors, PartUpdateResponses, PathGetResponses, PermissionListResponses, PermissionReplyErrors, PermissionReplyResponses, PermissionRespondErrors, PermissionRespondResponses, PermissionRuleset, ProjectCurrentResponses, ProjectInitGitResponses, ProjectListResponses, ProjectUpdateErrors, ProjectUpdateResponses, ProviderAuthResponses, ProviderListResponses, ProviderOauthAuthorizeErrors, ProviderOauthAuthorizeResponses, ProviderOauthCallbackErrors, ProviderOauthCallbackResponses, PtyConnectErrors, PtyConnectResponses, PtyCreateErrors, PtyCreateResponses, PtyGetErrors, PtyGetResponses, PtyListResponses, PtyRemoveErrors, PtyRemoveResponses, PtyUpdateErrors, PtyUpdateResponses, QuestionAnswer, QuestionListResponses, QuestionRejectErrors, QuestionRejectResponses, QuestionReplyErrors, QuestionReplyResponses, SessionAbortErrors, SessionAbortResponses, SessionChildrenErrors, SessionChildrenResponses, SessionCommandErrors, SessionCommandResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteErrors, SessionDeleteMessageErrors, SessionDeleteMessageResponses, SessionDeleteResponses, SessionDiffResponses, SessionForkResponses, SessionGetErrors, SessionGetResponses, SessionInitErrors, SessionInitResponses, SessionListResponses, SessionMessageErrors, SessionMessageResponses, SessionMessagesErrors, SessionMessagesResponses, SessionPromptAsyncErrors, SessionPromptAsyncResponses, SessionPromptErrors, SessionPromptResponses, SessionRevertErrors, SessionRevertResponses, SessionShareErrors, SessionShareResponses, SessionShellErrors, SessionShellResponses, SessionStatusErrors, SessionStatusResponses, SessionSummarizeErrors, SessionSummarizeResponses, SessionTodoErrors, SessionTodoResponses, SessionUnrevertErrors, SessionUnrevertResponses, SessionUnshareErrors, SessionUnshareResponses, SessionUpdateErrors, SessionUpdateResponses, SubtaskPartInput, TextPartInput, ToolIdsErrors, ToolIdsResponses, ToolListErrors, ToolListResponses, TuiAppendPromptErrors, TuiAppendPromptResponses, TuiClearPromptResponses, TuiControlNextResponses, TuiControlResponseResponses, TuiExecuteCommandErrors, TuiExecuteCommandResponses, TuiOpenHelpResponses, TuiOpenModelsResponses, TuiOpenSessionsResponses, TuiOpenThemesResponses, TuiPublishErrors, TuiPublishResponses, TuiSelectSessionErrors, TuiSelectSessionResponses, TuiShowToastResponses, TuiSubmitPromptResponses, VcsGetResponses, WorktreeCreateErrors, WorktreeCreateInput, WorktreeCreateResponses, WorktreeListResponses, WorktreeRemoveErrors, WorktreeRemoveInput, WorktreeRemoveResponses, WorktreeResetErrors, WorktreeResetInput, WorktreeResetResponses } from "./types.gen.js";
|
|
2
|
+
import type { AgentPartInput, AppAgentsResponses, AppLogErrors, AppLogResponses, AppSkillsResponses, Auth as Auth3, AuthRemoveErrors, AuthRemoveResponses, AuthSetErrors, AuthSetResponses, CommandListResponses, Config as Config3, ConfigGetResponses, ConfigProvidersResponses, ConfigUpdateErrors, ConfigUpdateResponses, EventSubscribeResponses, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiSessionSelect, EventTuiToastShow, ExperimentalResourceListResponses, ExperimentalSessionListResponses, ExperimentalWorkspaceCreateErrors, ExperimentalWorkspaceCreateResponses, ExperimentalWorkspaceListResponses, ExperimentalWorkspaceRemoveErrors, ExperimentalWorkspaceRemoveResponses, FileListResponses, FilePartInput, FilePartSource, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, FormatterStatusResponses, GlobalConfigGetResponses, GlobalConfigUpdateErrors, GlobalConfigUpdateResponses, GlobalDisposeResponses, GlobalEventResponses, GlobalHealthResponses, GlobalSyncEventSubscribeResponses, GlobalUpgradeErrors, GlobalUpgradeResponses, InstanceDisposeResponses, LspStatusResponses, McpAddErrors, McpAddResponses, McpAuthAuthenticateErrors, McpAuthAuthenticateResponses, McpAuthCallbackErrors, McpAuthCallbackResponses, McpAuthRemoveErrors, McpAuthRemoveResponses, McpAuthStartErrors, McpAuthStartResponses, McpConnectResponses, McpDisconnectResponses, McpLocalConfig, McpRemoteConfig, McpStatusResponses, OutputFormat, Part as Part2, PartDeleteErrors, PartDeleteResponses, PartUpdateErrors, PartUpdateResponses, PathGetResponses, PermissionListResponses, PermissionReplyErrors, PermissionReplyResponses, PermissionRespondErrors, PermissionRespondResponses, PermissionRuleset, ProjectCurrentResponses, ProjectInitGitResponses, ProjectListResponses, ProjectUpdateErrors, ProjectUpdateResponses, ProviderAuthResponses, ProviderListResponses, ProviderOauthAuthorizeErrors, ProviderOauthAuthorizeResponses, ProviderOauthCallbackErrors, ProviderOauthCallbackResponses, PtyConnectErrors, PtyConnectResponses, PtyCreateErrors, PtyCreateResponses, PtyGetErrors, PtyGetResponses, PtyListResponses, PtyRemoveErrors, PtyRemoveResponses, PtyUpdateErrors, PtyUpdateResponses, QuestionAnswer, QuestionListResponses, QuestionRejectErrors, QuestionRejectResponses, QuestionReplyErrors, QuestionReplyResponses, SessionAbortErrors, SessionAbortResponses, SessionChildrenErrors, SessionChildrenResponses, SessionCommandErrors, SessionCommandResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteErrors, SessionDeleteMessageErrors, SessionDeleteMessageResponses, SessionDeleteResponses, SessionDiffResponses, SessionForkResponses, SessionGetErrors, SessionGetResponses, SessionInitErrors, SessionInitResponses, SessionListResponses, SessionMessageErrors, SessionMessageResponses, SessionMessagesErrors, SessionMessagesResponses, SessionPromptAsyncErrors, SessionPromptAsyncResponses, SessionPromptErrors, SessionPromptResponses, SessionRevertErrors, SessionRevertResponses, SessionShareErrors, SessionShareResponses, SessionShellErrors, SessionShellResponses, SessionStatusErrors, SessionStatusResponses, SessionSummarizeErrors, SessionSummarizeResponses, SessionTodoErrors, SessionTodoResponses, SessionUnrevertErrors, SessionUnrevertResponses, SessionUnshareErrors, SessionUnshareResponses, SessionUpdateErrors, SessionUpdateResponses, SubtaskPartInput, TextPartInput, ToolIdsErrors, ToolIdsResponses, ToolListErrors, ToolListResponses, TuiAppendPromptErrors, TuiAppendPromptResponses, TuiClearPromptResponses, TuiControlNextResponses, TuiControlResponseResponses, TuiExecuteCommandErrors, TuiExecuteCommandResponses, TuiOpenHelpResponses, TuiOpenModelsResponses, TuiOpenSessionsResponses, TuiOpenThemesResponses, TuiPublishErrors, TuiPublishResponses, TuiSelectSessionErrors, TuiSelectSessionResponses, TuiShowToastResponses, TuiSubmitPromptResponses, VcsDiffResponses, VcsGetResponses, WorktreeCreateErrors, WorktreeCreateInput, WorktreeCreateResponses, WorktreeListResponses, WorktreeRemoveErrors, WorktreeRemoveInput, WorktreeRemoveResponses, WorktreeResetErrors, WorktreeResetInput, WorktreeResetResponses } from "./types.gen.js";
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -25,6 +25,14 @@ declare class HeyApiRegistry<T> {
|
|
|
25
25
|
get(key?: string): T;
|
|
26
26
|
set(value: T, key?: string): void;
|
|
27
27
|
}
|
|
28
|
+
export declare class SyncEvent extends HeyApiClient {
|
|
29
|
+
/**
|
|
30
|
+
* Subscribe to global sync events
|
|
31
|
+
*
|
|
32
|
+
* Get global sync events
|
|
33
|
+
*/
|
|
34
|
+
subscribe<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): Promise<import("./core/serverSentEvents.gen.js").ServerSentEventsResult<GlobalSyncEventSubscribeResponses, unknown>>;
|
|
35
|
+
}
|
|
28
36
|
export declare class Config extends HeyApiClient {
|
|
29
37
|
/**
|
|
30
38
|
* Get global configuration
|
|
@@ -68,6 +76,8 @@ export declare class Global extends HeyApiClient {
|
|
|
68
76
|
upgrade<ThrowOnError extends boolean = false>(parameters?: {
|
|
69
77
|
target?: string;
|
|
70
78
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<GlobalUpgradeResponses, GlobalUpgradeErrors, ThrowOnError, "fields">;
|
|
79
|
+
private _syncEvent?;
|
|
80
|
+
get syncEvent(): SyncEvent;
|
|
71
81
|
private _config?;
|
|
72
82
|
get config(): Config;
|
|
73
83
|
}
|
|
@@ -90,6 +100,41 @@ export declare class Auth extends HeyApiClient {
|
|
|
90
100
|
auth?: Auth3;
|
|
91
101
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<AuthSetResponses, AuthSetErrors, ThrowOnError, "fields">;
|
|
92
102
|
}
|
|
103
|
+
export declare class App extends HeyApiClient {
|
|
104
|
+
/**
|
|
105
|
+
* Write log
|
|
106
|
+
*
|
|
107
|
+
* Write a log entry to the server logs with specified level and metadata.
|
|
108
|
+
*/
|
|
109
|
+
log<ThrowOnError extends boolean = false>(parameters?: {
|
|
110
|
+
directory?: string;
|
|
111
|
+
workspace?: string;
|
|
112
|
+
service?: string;
|
|
113
|
+
level?: "debug" | "info" | "error" | "warn";
|
|
114
|
+
message?: string;
|
|
115
|
+
extra?: {
|
|
116
|
+
[key: string]: unknown;
|
|
117
|
+
};
|
|
118
|
+
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<AppLogResponses, AppLogErrors, ThrowOnError, "fields">;
|
|
119
|
+
/**
|
|
120
|
+
* List agents
|
|
121
|
+
*
|
|
122
|
+
* Get a list of all available AI agents in the OpenCode system.
|
|
123
|
+
*/
|
|
124
|
+
agents<ThrowOnError extends boolean = false>(parameters?: {
|
|
125
|
+
directory?: string;
|
|
126
|
+
workspace?: string;
|
|
127
|
+
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<AppAgentsResponses, unknown, ThrowOnError, "fields">;
|
|
128
|
+
/**
|
|
129
|
+
* List skills
|
|
130
|
+
*
|
|
131
|
+
* Get a list of all available skills in the OpenCode system.
|
|
132
|
+
*/
|
|
133
|
+
skills<ThrowOnError extends boolean = false>(parameters?: {
|
|
134
|
+
directory?: string;
|
|
135
|
+
workspace?: string;
|
|
136
|
+
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<AppSkillsResponses, unknown, ThrowOnError, "fields">;
|
|
137
|
+
}
|
|
93
138
|
export declare class Project extends HeyApiClient {
|
|
94
139
|
/**
|
|
95
140
|
* List all projects
|
|
@@ -659,6 +704,7 @@ export declare class Session2 extends HeyApiClient {
|
|
|
659
704
|
sessionID: string;
|
|
660
705
|
directory?: string;
|
|
661
706
|
workspace?: string;
|
|
707
|
+
messageID?: string;
|
|
662
708
|
agent?: string;
|
|
663
709
|
model?: {
|
|
664
710
|
providerID: string;
|
|
@@ -1155,52 +1201,27 @@ export declare class Vcs extends HeyApiClient {
|
|
|
1155
1201
|
directory?: string;
|
|
1156
1202
|
workspace?: string;
|
|
1157
1203
|
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<VcsGetResponses, unknown, ThrowOnError, "fields">;
|
|
1158
|
-
}
|
|
1159
|
-
export declare class Command extends HeyApiClient {
|
|
1160
1204
|
/**
|
|
1161
|
-
*
|
|
1205
|
+
* Get VCS diff
|
|
1162
1206
|
*
|
|
1163
|
-
*
|
|
1207
|
+
* Retrieve the current git diff for the working tree or against the default branch.
|
|
1164
1208
|
*/
|
|
1165
|
-
|
|
1209
|
+
diff<ThrowOnError extends boolean = false>(parameters: {
|
|
1166
1210
|
directory?: string;
|
|
1167
1211
|
workspace?: string;
|
|
1168
|
-
|
|
1212
|
+
mode: "git" | "branch";
|
|
1213
|
+
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<VcsDiffResponses, unknown, ThrowOnError, "fields">;
|
|
1169
1214
|
}
|
|
1170
|
-
export declare class
|
|
1171
|
-
/**
|
|
1172
|
-
* Write log
|
|
1173
|
-
*
|
|
1174
|
-
* Write a log entry to the server logs with specified level and metadata.
|
|
1175
|
-
*/
|
|
1176
|
-
log<ThrowOnError extends boolean = false>(parameters?: {
|
|
1177
|
-
directory?: string;
|
|
1178
|
-
workspace?: string;
|
|
1179
|
-
service?: string;
|
|
1180
|
-
level?: "debug" | "info" | "error" | "warn";
|
|
1181
|
-
message?: string;
|
|
1182
|
-
extra?: {
|
|
1183
|
-
[key: string]: unknown;
|
|
1184
|
-
};
|
|
1185
|
-
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<AppLogResponses, AppLogErrors, ThrowOnError, "fields">;
|
|
1186
|
-
/**
|
|
1187
|
-
* List agents
|
|
1188
|
-
*
|
|
1189
|
-
* Get a list of all available AI agents in the OpenCode system.
|
|
1190
|
-
*/
|
|
1191
|
-
agents<ThrowOnError extends boolean = false>(parameters?: {
|
|
1192
|
-
directory?: string;
|
|
1193
|
-
workspace?: string;
|
|
1194
|
-
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<AppAgentsResponses, unknown, ThrowOnError, "fields">;
|
|
1215
|
+
export declare class Command extends HeyApiClient {
|
|
1195
1216
|
/**
|
|
1196
|
-
* List
|
|
1217
|
+
* List commands
|
|
1197
1218
|
*
|
|
1198
|
-
* Get a list of all available
|
|
1219
|
+
* Get a list of all available commands in the OpenCode system.
|
|
1199
1220
|
*/
|
|
1200
|
-
|
|
1221
|
+
list<ThrowOnError extends boolean = false>(parameters?: {
|
|
1201
1222
|
directory?: string;
|
|
1202
1223
|
workspace?: string;
|
|
1203
|
-
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<
|
|
1224
|
+
}, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<CommandListResponses, unknown, ThrowOnError, "fields">;
|
|
1204
1225
|
}
|
|
1205
1226
|
export declare class Lsp extends HeyApiClient {
|
|
1206
1227
|
/**
|
|
@@ -1234,6 +1255,8 @@ export declare class OpencodeClient extends HeyApiClient {
|
|
|
1234
1255
|
get global(): Global;
|
|
1235
1256
|
private _auth?;
|
|
1236
1257
|
get auth(): Auth;
|
|
1258
|
+
private _app?;
|
|
1259
|
+
get app(): App;
|
|
1237
1260
|
private _project?;
|
|
1238
1261
|
get project(): Project;
|
|
1239
1262
|
private _pty?;
|
|
@@ -1274,8 +1297,6 @@ export declare class OpencodeClient extends HeyApiClient {
|
|
|
1274
1297
|
get vcs(): Vcs;
|
|
1275
1298
|
private _command?;
|
|
1276
1299
|
get command(): Command;
|
|
1277
|
-
private _app?;
|
|
1278
|
-
get app(): App;
|
|
1279
1300
|
private _lsp?;
|
|
1280
1301
|
get lsp(): Lsp;
|
|
1281
1302
|
private _formatter?;
|
package/dist/v2/gen/sdk.gen.js
CHANGED
|
@@ -21,6 +21,19 @@ class HeyApiRegistry {
|
|
|
21
21
|
this.instances.set(key ?? this.defaultKey, value);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
export class SyncEvent extends HeyApiClient {
|
|
25
|
+
/**
|
|
26
|
+
* Subscribe to global sync events
|
|
27
|
+
*
|
|
28
|
+
* Get global sync events
|
|
29
|
+
*/
|
|
30
|
+
subscribe(options) {
|
|
31
|
+
return (options?.client ?? this.client).sse.get({
|
|
32
|
+
url: "/global/sync-event",
|
|
33
|
+
...options,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
24
37
|
export class Config extends HeyApiClient {
|
|
25
38
|
/**
|
|
26
39
|
* Get global configuration
|
|
@@ -104,6 +117,10 @@ export class Global extends HeyApiClient {
|
|
|
104
117
|
},
|
|
105
118
|
});
|
|
106
119
|
}
|
|
120
|
+
_syncEvent;
|
|
121
|
+
get syncEvent() {
|
|
122
|
+
return (this._syncEvent ??= new SyncEvent({ client: this.client }));
|
|
123
|
+
}
|
|
107
124
|
_config;
|
|
108
125
|
get config() {
|
|
109
126
|
return (this._config ??= new Config({ client: this.client }));
|
|
@@ -149,6 +166,77 @@ export class Auth extends HeyApiClient {
|
|
|
149
166
|
});
|
|
150
167
|
}
|
|
151
168
|
}
|
|
169
|
+
export class App extends HeyApiClient {
|
|
170
|
+
/**
|
|
171
|
+
* Write log
|
|
172
|
+
*
|
|
173
|
+
* Write a log entry to the server logs with specified level and metadata.
|
|
174
|
+
*/
|
|
175
|
+
log(parameters, options) {
|
|
176
|
+
const params = buildClientParams([parameters], [
|
|
177
|
+
{
|
|
178
|
+
args: [
|
|
179
|
+
{ in: "query", key: "directory" },
|
|
180
|
+
{ in: "query", key: "workspace" },
|
|
181
|
+
{ in: "body", key: "service" },
|
|
182
|
+
{ in: "body", key: "level" },
|
|
183
|
+
{ in: "body", key: "message" },
|
|
184
|
+
{ in: "body", key: "extra" },
|
|
185
|
+
],
|
|
186
|
+
},
|
|
187
|
+
]);
|
|
188
|
+
return (options?.client ?? this.client).post({
|
|
189
|
+
url: "/log",
|
|
190
|
+
...options,
|
|
191
|
+
...params,
|
|
192
|
+
headers: {
|
|
193
|
+
"Content-Type": "application/json",
|
|
194
|
+
...options?.headers,
|
|
195
|
+
...params.headers,
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* List agents
|
|
201
|
+
*
|
|
202
|
+
* Get a list of all available AI agents in the OpenCode system.
|
|
203
|
+
*/
|
|
204
|
+
agents(parameters, options) {
|
|
205
|
+
const params = buildClientParams([parameters], [
|
|
206
|
+
{
|
|
207
|
+
args: [
|
|
208
|
+
{ in: "query", key: "directory" },
|
|
209
|
+
{ in: "query", key: "workspace" },
|
|
210
|
+
],
|
|
211
|
+
},
|
|
212
|
+
]);
|
|
213
|
+
return (options?.client ?? this.client).get({
|
|
214
|
+
url: "/agent",
|
|
215
|
+
...options,
|
|
216
|
+
...params,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* List skills
|
|
221
|
+
*
|
|
222
|
+
* Get a list of all available skills in the OpenCode system.
|
|
223
|
+
*/
|
|
224
|
+
skills(parameters, options) {
|
|
225
|
+
const params = buildClientParams([parameters], [
|
|
226
|
+
{
|
|
227
|
+
args: [
|
|
228
|
+
{ in: "query", key: "directory" },
|
|
229
|
+
{ in: "query", key: "workspace" },
|
|
230
|
+
],
|
|
231
|
+
},
|
|
232
|
+
]);
|
|
233
|
+
return (options?.client ?? this.client).get({
|
|
234
|
+
url: "/skill",
|
|
235
|
+
...options,
|
|
236
|
+
...params,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
152
240
|
export class Project extends HeyApiClient {
|
|
153
241
|
/**
|
|
154
242
|
* List all projects
|
|
@@ -1269,6 +1357,7 @@ export class Session2 extends HeyApiClient {
|
|
|
1269
1357
|
{ in: "path", key: "sessionID" },
|
|
1270
1358
|
{ in: "query", key: "directory" },
|
|
1271
1359
|
{ in: "query", key: "workspace" },
|
|
1360
|
+
{ in: "body", key: "messageID" },
|
|
1272
1361
|
{ in: "body", key: "agent" },
|
|
1273
1362
|
{ in: "body", key: "model" },
|
|
1274
1363
|
{ in: "body", key: "command" },
|
|
@@ -2349,85 +2438,35 @@ export class Vcs extends HeyApiClient {
|
|
|
2349
2438
|
...params,
|
|
2350
2439
|
});
|
|
2351
2440
|
}
|
|
2352
|
-
}
|
|
2353
|
-
export class Command extends HeyApiClient {
|
|
2354
2441
|
/**
|
|
2355
|
-
*
|
|
2442
|
+
* Get VCS diff
|
|
2356
2443
|
*
|
|
2357
|
-
*
|
|
2444
|
+
* Retrieve the current git diff for the working tree or against the default branch.
|
|
2358
2445
|
*/
|
|
2359
|
-
|
|
2446
|
+
diff(parameters, options) {
|
|
2360
2447
|
const params = buildClientParams([parameters], [
|
|
2361
2448
|
{
|
|
2362
2449
|
args: [
|
|
2363
2450
|
{ in: "query", key: "directory" },
|
|
2364
2451
|
{ in: "query", key: "workspace" },
|
|
2452
|
+
{ in: "query", key: "mode" },
|
|
2365
2453
|
],
|
|
2366
2454
|
},
|
|
2367
2455
|
]);
|
|
2368
2456
|
return (options?.client ?? this.client).get({
|
|
2369
|
-
url: "/
|
|
2457
|
+
url: "/vcs/diff",
|
|
2370
2458
|
...options,
|
|
2371
2459
|
...params,
|
|
2372
2460
|
});
|
|
2373
2461
|
}
|
|
2374
2462
|
}
|
|
2375
|
-
export class
|
|
2376
|
-
/**
|
|
2377
|
-
* Write log
|
|
2378
|
-
*
|
|
2379
|
-
* Write a log entry to the server logs with specified level and metadata.
|
|
2380
|
-
*/
|
|
2381
|
-
log(parameters, options) {
|
|
2382
|
-
const params = buildClientParams([parameters], [
|
|
2383
|
-
{
|
|
2384
|
-
args: [
|
|
2385
|
-
{ in: "query", key: "directory" },
|
|
2386
|
-
{ in: "query", key: "workspace" },
|
|
2387
|
-
{ in: "body", key: "service" },
|
|
2388
|
-
{ in: "body", key: "level" },
|
|
2389
|
-
{ in: "body", key: "message" },
|
|
2390
|
-
{ in: "body", key: "extra" },
|
|
2391
|
-
],
|
|
2392
|
-
},
|
|
2393
|
-
]);
|
|
2394
|
-
return (options?.client ?? this.client).post({
|
|
2395
|
-
url: "/log",
|
|
2396
|
-
...options,
|
|
2397
|
-
...params,
|
|
2398
|
-
headers: {
|
|
2399
|
-
"Content-Type": "application/json",
|
|
2400
|
-
...options?.headers,
|
|
2401
|
-
...params.headers,
|
|
2402
|
-
},
|
|
2403
|
-
});
|
|
2404
|
-
}
|
|
2405
|
-
/**
|
|
2406
|
-
* List agents
|
|
2407
|
-
*
|
|
2408
|
-
* Get a list of all available AI agents in the OpenCode system.
|
|
2409
|
-
*/
|
|
2410
|
-
agents(parameters, options) {
|
|
2411
|
-
const params = buildClientParams([parameters], [
|
|
2412
|
-
{
|
|
2413
|
-
args: [
|
|
2414
|
-
{ in: "query", key: "directory" },
|
|
2415
|
-
{ in: "query", key: "workspace" },
|
|
2416
|
-
],
|
|
2417
|
-
},
|
|
2418
|
-
]);
|
|
2419
|
-
return (options?.client ?? this.client).get({
|
|
2420
|
-
url: "/agent",
|
|
2421
|
-
...options,
|
|
2422
|
-
...params,
|
|
2423
|
-
});
|
|
2424
|
-
}
|
|
2463
|
+
export class Command extends HeyApiClient {
|
|
2425
2464
|
/**
|
|
2426
|
-
* List
|
|
2465
|
+
* List commands
|
|
2427
2466
|
*
|
|
2428
|
-
* Get a list of all available
|
|
2467
|
+
* Get a list of all available commands in the OpenCode system.
|
|
2429
2468
|
*/
|
|
2430
|
-
|
|
2469
|
+
list(parameters, options) {
|
|
2431
2470
|
const params = buildClientParams([parameters], [
|
|
2432
2471
|
{
|
|
2433
2472
|
args: [
|
|
@@ -2437,7 +2476,7 @@ export class App extends HeyApiClient {
|
|
|
2437
2476
|
},
|
|
2438
2477
|
]);
|
|
2439
2478
|
return (options?.client ?? this.client).get({
|
|
2440
|
-
url: "/
|
|
2479
|
+
url: "/command",
|
|
2441
2480
|
...options,
|
|
2442
2481
|
...params,
|
|
2443
2482
|
});
|
|
@@ -2501,6 +2540,10 @@ export class OpencodeClient extends HeyApiClient {
|
|
|
2501
2540
|
get auth() {
|
|
2502
2541
|
return (this._auth ??= new Auth({ client: this.client }));
|
|
2503
2542
|
}
|
|
2543
|
+
_app;
|
|
2544
|
+
get app() {
|
|
2545
|
+
return (this._app ??= new App({ client: this.client }));
|
|
2546
|
+
}
|
|
2504
2547
|
_project;
|
|
2505
2548
|
get project() {
|
|
2506
2549
|
return (this._project ??= new Project({ client: this.client }));
|
|
@@ -2581,10 +2624,6 @@ export class OpencodeClient extends HeyApiClient {
|
|
|
2581
2624
|
get command() {
|
|
2582
2625
|
return (this._command ??= new Command({ client: this.client }));
|
|
2583
2626
|
}
|
|
2584
|
-
_app;
|
|
2585
|
-
get app() {
|
|
2586
|
-
return (this._app ??= new App({ client: this.client }));
|
|
2587
|
-
}
|
|
2588
2627
|
_lsp;
|
|
2589
2628
|
get lsp() {
|
|
2590
2629
|
return (this._lsp ??= new Lsp({ client: this.client }));
|