@opencode-ai/sdk 1.3.17 → 1.4.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/v2/client.js +2 -1
- package/dist/v2/data.d.ts +9 -0
- package/dist/v2/data.js +22 -0
- package/dist/v2/gen/types.gen.d.ts +49 -99
- package/dist/v2/index.d.ts +1 -0
- package/dist/v2/index.js +1 -0
- package/package.json +1 -1
package/dist/v2/client.js
CHANGED
package/dist/v2/data.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const message = {
|
|
2
|
+
user(input) {
|
|
3
|
+
const { parts, ...rest } = input;
|
|
4
|
+
const info = {
|
|
5
|
+
...rest,
|
|
6
|
+
id: "asdasd",
|
|
7
|
+
time: {
|
|
8
|
+
created: Date.now(),
|
|
9
|
+
},
|
|
10
|
+
role: "user",
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
info,
|
|
14
|
+
parts: input.parts.map((part) => ({
|
|
15
|
+
...part,
|
|
16
|
+
id: "asdasd",
|
|
17
|
+
messageID: info.id,
|
|
18
|
+
sessionID: info.sessionID,
|
|
19
|
+
})),
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -289,10 +289,9 @@ export type EventCommandExecuted = {
|
|
|
289
289
|
messageID: string;
|
|
290
290
|
};
|
|
291
291
|
};
|
|
292
|
-
export type
|
|
292
|
+
export type SnapshotFileDiff = {
|
|
293
293
|
file: string;
|
|
294
|
-
|
|
295
|
-
after: string;
|
|
294
|
+
patch: string;
|
|
296
295
|
additions: number;
|
|
297
296
|
deletions: number;
|
|
298
297
|
status?: "added" | "deleted" | "modified";
|
|
@@ -301,7 +300,7 @@ export type EventSessionDiff = {
|
|
|
301
300
|
type: "session.diff";
|
|
302
301
|
properties: {
|
|
303
302
|
sessionID: string;
|
|
304
|
-
diff: Array<
|
|
303
|
+
diff: Array<SnapshotFileDiff>;
|
|
305
304
|
};
|
|
306
305
|
};
|
|
307
306
|
export type ProviderAuthError = {
|
|
@@ -453,18 +452,18 @@ export type UserMessage = {
|
|
|
453
452
|
summary?: {
|
|
454
453
|
title?: string;
|
|
455
454
|
body?: string;
|
|
456
|
-
diffs: Array<
|
|
455
|
+
diffs: Array<SnapshotFileDiff>;
|
|
457
456
|
};
|
|
458
457
|
agent: string;
|
|
459
458
|
model: {
|
|
460
459
|
providerID: string;
|
|
461
460
|
modelID: string;
|
|
461
|
+
variant?: string;
|
|
462
462
|
};
|
|
463
463
|
system?: string;
|
|
464
464
|
tools?: {
|
|
465
465
|
[key: string]: boolean;
|
|
466
466
|
};
|
|
467
|
-
variant?: string;
|
|
468
467
|
};
|
|
469
468
|
export type AssistantMessage = {
|
|
470
469
|
id: string;
|
|
@@ -775,7 +774,7 @@ export type Session = {
|
|
|
775
774
|
additions: number;
|
|
776
775
|
deletions: number;
|
|
777
776
|
files: number;
|
|
778
|
-
diffs?: Array<
|
|
777
|
+
diffs?: Array<SnapshotFileDiff>;
|
|
779
778
|
};
|
|
780
779
|
share?: {
|
|
781
780
|
url: string;
|
|
@@ -880,7 +879,7 @@ export type SyncEventSessionUpdated = {
|
|
|
880
879
|
additions: number;
|
|
881
880
|
deletions: number;
|
|
882
881
|
files: number;
|
|
883
|
-
diffs?: Array<
|
|
882
|
+
diffs?: Array<SnapshotFileDiff>;
|
|
884
883
|
} | null;
|
|
885
884
|
share?: {
|
|
886
885
|
url: string | null;
|
|
@@ -1021,6 +1020,29 @@ export type ProviderConfig = {
|
|
|
1021
1020
|
env?: Array<string>;
|
|
1022
1021
|
id?: string;
|
|
1023
1022
|
npm?: string;
|
|
1023
|
+
whitelist?: Array<string>;
|
|
1024
|
+
blacklist?: Array<string>;
|
|
1025
|
+
options?: {
|
|
1026
|
+
apiKey?: string;
|
|
1027
|
+
baseURL?: string;
|
|
1028
|
+
/**
|
|
1029
|
+
* GitHub Enterprise URL for copilot authentication
|
|
1030
|
+
*/
|
|
1031
|
+
enterpriseUrl?: string;
|
|
1032
|
+
/**
|
|
1033
|
+
* Enable promptCacheKey for this provider (default false)
|
|
1034
|
+
*/
|
|
1035
|
+
setCacheKey?: boolean;
|
|
1036
|
+
/**
|
|
1037
|
+
* Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.
|
|
1038
|
+
*/
|
|
1039
|
+
timeout?: number | false;
|
|
1040
|
+
/**
|
|
1041
|
+
* Timeout in milliseconds between streamed SSE chunks for this provider. If no chunk arrives within this window, the request is aborted.
|
|
1042
|
+
*/
|
|
1043
|
+
chunkTimeout?: number;
|
|
1044
|
+
[key: string]: unknown | string | boolean | number | false | number | undefined;
|
|
1045
|
+
};
|
|
1024
1046
|
models?: {
|
|
1025
1047
|
[key: string]: {
|
|
1026
1048
|
id?: string;
|
|
@@ -1057,16 +1079,16 @@ export type ProviderConfig = {
|
|
|
1057
1079
|
};
|
|
1058
1080
|
experimental?: boolean;
|
|
1059
1081
|
status?: "alpha" | "beta" | "deprecated";
|
|
1082
|
+
provider?: {
|
|
1083
|
+
npm?: string;
|
|
1084
|
+
api?: string;
|
|
1085
|
+
};
|
|
1060
1086
|
options?: {
|
|
1061
1087
|
[key: string]: unknown;
|
|
1062
1088
|
};
|
|
1063
1089
|
headers?: {
|
|
1064
1090
|
[key: string]: string;
|
|
1065
1091
|
};
|
|
1066
|
-
provider?: {
|
|
1067
|
-
npm?: string;
|
|
1068
|
-
api?: string;
|
|
1069
|
-
};
|
|
1070
1092
|
/**
|
|
1071
1093
|
* Variant-specific configuration
|
|
1072
1094
|
*/
|
|
@@ -1081,29 +1103,6 @@ export type ProviderConfig = {
|
|
|
1081
1103
|
};
|
|
1082
1104
|
};
|
|
1083
1105
|
};
|
|
1084
|
-
whitelist?: Array<string>;
|
|
1085
|
-
blacklist?: Array<string>;
|
|
1086
|
-
options?: {
|
|
1087
|
-
apiKey?: string;
|
|
1088
|
-
baseURL?: string;
|
|
1089
|
-
/**
|
|
1090
|
-
* GitHub Enterprise URL for copilot authentication
|
|
1091
|
-
*/
|
|
1092
|
-
enterpriseUrl?: string;
|
|
1093
|
-
/**
|
|
1094
|
-
* Enable promptCacheKey for this provider (default false)
|
|
1095
|
-
*/
|
|
1096
|
-
setCacheKey?: boolean;
|
|
1097
|
-
/**
|
|
1098
|
-
* Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.
|
|
1099
|
-
*/
|
|
1100
|
-
timeout?: number | false;
|
|
1101
|
-
/**
|
|
1102
|
-
* Timeout in milliseconds between streamed SSE chunks for this provider. If no chunk arrives within this window, the request is aborted.
|
|
1103
|
-
*/
|
|
1104
|
-
chunkTimeout?: number;
|
|
1105
|
-
[key: string]: unknown | string | boolean | number | false | number | undefined;
|
|
1106
|
-
};
|
|
1107
1106
|
};
|
|
1108
1107
|
export type McpLocalConfig = {
|
|
1109
1108
|
/**
|
|
@@ -1534,7 +1533,7 @@ export type GlobalSession = {
|
|
|
1534
1533
|
additions: number;
|
|
1535
1534
|
deletions: number;
|
|
1536
1535
|
files: number;
|
|
1537
|
-
diffs?: Array<
|
|
1536
|
+
diffs?: Array<SnapshotFileDiff>;
|
|
1538
1537
|
};
|
|
1539
1538
|
share?: {
|
|
1540
1539
|
url: string;
|
|
@@ -1712,6 +1711,13 @@ export type VcsInfo = {
|
|
|
1712
1711
|
branch?: string;
|
|
1713
1712
|
default_branch?: string;
|
|
1714
1713
|
};
|
|
1714
|
+
export type VcsFileDiff = {
|
|
1715
|
+
file: string;
|
|
1716
|
+
patch: string;
|
|
1717
|
+
additions: number;
|
|
1718
|
+
deletions: number;
|
|
1719
|
+
status?: "added" | "deleted" | "modified";
|
|
1720
|
+
};
|
|
1715
1721
|
export type Command = {
|
|
1716
1722
|
name: string;
|
|
1717
1723
|
description?: string;
|
|
@@ -2980,7 +2986,7 @@ export type SessionDiffResponses = {
|
|
|
2980
2986
|
/**
|
|
2981
2987
|
* Successfully retrieved diff
|
|
2982
2988
|
*/
|
|
2983
|
-
200: Array<
|
|
2989
|
+
200: Array<SnapshotFileDiff>;
|
|
2984
2990
|
};
|
|
2985
2991
|
export type SessionDiffResponse = SessionDiffResponses[keyof SessionDiffResponses];
|
|
2986
2992
|
export type SessionSummarizeData = {
|
|
@@ -3356,7 +3362,10 @@ export type SessionShellResponses = {
|
|
|
3356
3362
|
/**
|
|
3357
3363
|
* Created message
|
|
3358
3364
|
*/
|
|
3359
|
-
200:
|
|
3365
|
+
200: {
|
|
3366
|
+
info: Message;
|
|
3367
|
+
parts: Array<Part>;
|
|
3368
|
+
};
|
|
3360
3369
|
};
|
|
3361
3370
|
export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses];
|
|
3362
3371
|
export type SessionRevertData = {
|
|
@@ -3593,66 +3602,7 @@ export type ProviderListResponses = {
|
|
|
3593
3602
|
* List of providers
|
|
3594
3603
|
*/
|
|
3595
3604
|
200: {
|
|
3596
|
-
all: Array<
|
|
3597
|
-
api?: string;
|
|
3598
|
-
name: string;
|
|
3599
|
-
env: Array<string>;
|
|
3600
|
-
id: string;
|
|
3601
|
-
npm?: string;
|
|
3602
|
-
models: {
|
|
3603
|
-
[key: string]: {
|
|
3604
|
-
id: string;
|
|
3605
|
-
name: string;
|
|
3606
|
-
family?: string;
|
|
3607
|
-
release_date: string;
|
|
3608
|
-
attachment: boolean;
|
|
3609
|
-
reasoning: boolean;
|
|
3610
|
-
temperature: boolean;
|
|
3611
|
-
tool_call: boolean;
|
|
3612
|
-
interleaved?: true | {
|
|
3613
|
-
field: "reasoning_content" | "reasoning_details";
|
|
3614
|
-
};
|
|
3615
|
-
cost?: {
|
|
3616
|
-
input: number;
|
|
3617
|
-
output: number;
|
|
3618
|
-
cache_read?: number;
|
|
3619
|
-
cache_write?: number;
|
|
3620
|
-
context_over_200k?: {
|
|
3621
|
-
input: number;
|
|
3622
|
-
output: number;
|
|
3623
|
-
cache_read?: number;
|
|
3624
|
-
cache_write?: number;
|
|
3625
|
-
};
|
|
3626
|
-
};
|
|
3627
|
-
limit: {
|
|
3628
|
-
context: number;
|
|
3629
|
-
input?: number;
|
|
3630
|
-
output: number;
|
|
3631
|
-
};
|
|
3632
|
-
modalities?: {
|
|
3633
|
-
input: Array<"text" | "audio" | "image" | "video" | "pdf">;
|
|
3634
|
-
output: Array<"text" | "audio" | "image" | "video" | "pdf">;
|
|
3635
|
-
};
|
|
3636
|
-
experimental?: boolean;
|
|
3637
|
-
status?: "alpha" | "beta" | "deprecated";
|
|
3638
|
-
options: {
|
|
3639
|
-
[key: string]: unknown;
|
|
3640
|
-
};
|
|
3641
|
-
headers?: {
|
|
3642
|
-
[key: string]: string;
|
|
3643
|
-
};
|
|
3644
|
-
provider?: {
|
|
3645
|
-
npm?: string;
|
|
3646
|
-
api?: string;
|
|
3647
|
-
};
|
|
3648
|
-
variants?: {
|
|
3649
|
-
[key: string]: {
|
|
3650
|
-
[key: string]: unknown;
|
|
3651
|
-
};
|
|
3652
|
-
};
|
|
3653
|
-
};
|
|
3654
|
-
};
|
|
3655
|
-
}>;
|
|
3605
|
+
all: Array<Provider>;
|
|
3656
3606
|
default: {
|
|
3657
3607
|
[key: string]: string;
|
|
3658
3608
|
};
|
|
@@ -4418,7 +4368,7 @@ export type VcsDiffResponses = {
|
|
|
4418
4368
|
/**
|
|
4419
4369
|
* VCS diff
|
|
4420
4370
|
*/
|
|
4421
|
-
200: Array<
|
|
4371
|
+
200: Array<VcsFileDiff>;
|
|
4422
4372
|
};
|
|
4423
4373
|
export type VcsDiffResponse = VcsDiffResponses[keyof VcsDiffResponses];
|
|
4424
4374
|
export type CommandListData = {
|
package/dist/v2/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./client.js";
|
|
2
2
|
export * from "./server.js";
|
|
3
3
|
import type { ServerOptions } from "./server.js";
|
|
4
|
+
export * as data from "./data.js";
|
|
4
5
|
export declare function createOpencode(options?: ServerOptions): Promise<{
|
|
5
6
|
client: import("./client.js").OpencodeClient;
|
|
6
7
|
server: {
|
package/dist/v2/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./client.js";
|
|
|
2
2
|
export * from "./server.js";
|
|
3
3
|
import { createOpencodeClient } from "./client.js";
|
|
4
4
|
import { createOpencodeServer } from "./server.js";
|
|
5
|
+
export * as data from "./data.js";
|
|
5
6
|
export async function createOpencode(options) {
|
|
6
7
|
const server = await createOpencodeServer({
|
|
7
8
|
...options,
|