@opencode-ai/sdk 1.3.16 → 1.4.0

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 CHANGED
@@ -66,5 +66,6 @@ export function createOpencodeClient(config) {
66
66
  directory: config?.directory,
67
67
  workspace: config?.experimental_workspaceID,
68
68
  }));
69
- return new OpencodeClient({ client });
69
+ const result = new OpencodeClient({ client });
70
+ return result;
70
71
  }
@@ -0,0 +1,9 @@
1
+ import type { Part, UserMessage } from "./client.js";
2
+ export declare const message: {
3
+ user(input: Omit<UserMessage, "role" | "time" | "id"> & {
4
+ parts: Omit<Part, "id" | "sessionID" | "messageID">[];
5
+ }): {
6
+ info: UserMessage;
7
+ parts: Part[];
8
+ };
9
+ };
@@ -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 FileDiff = {
292
+ export type SnapshotFileDiff = {
293
293
  file: string;
294
- before: string;
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<FileDiff>;
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<FileDiff>;
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<FileDiff>;
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<FileDiff>;
882
+ diffs?: Array<SnapshotFileDiff>;
884
883
  } | null;
885
884
  share?: {
886
885
  url: string | null;
@@ -1387,6 +1386,9 @@ export type OAuth = {
1387
1386
  export type ApiAuth = {
1388
1387
  type: "api";
1389
1388
  key: string;
1389
+ metadata?: {
1390
+ [key: string]: string;
1391
+ };
1390
1392
  };
1391
1393
  export type WellKnownAuth = {
1392
1394
  type: "wellknown";
@@ -1531,7 +1533,7 @@ export type GlobalSession = {
1531
1533
  additions: number;
1532
1534
  deletions: number;
1533
1535
  files: number;
1534
- diffs?: Array<FileDiff>;
1536
+ diffs?: Array<SnapshotFileDiff>;
1535
1537
  };
1536
1538
  share?: {
1537
1539
  url: string;
@@ -1709,6 +1711,13 @@ export type VcsInfo = {
1709
1711
  branch?: string;
1710
1712
  default_branch?: string;
1711
1713
  };
1714
+ export type VcsFileDiff = {
1715
+ file: string;
1716
+ patch: string;
1717
+ additions: number;
1718
+ deletions: number;
1719
+ status?: "added" | "deleted" | "modified";
1720
+ };
1712
1721
  export type Command = {
1713
1722
  name: string;
1714
1723
  description?: string;
@@ -2977,7 +2986,7 @@ export type SessionDiffResponses = {
2977
2986
  /**
2978
2987
  * Successfully retrieved diff
2979
2988
  */
2980
- 200: Array<FileDiff>;
2989
+ 200: Array<SnapshotFileDiff>;
2981
2990
  };
2982
2991
  export type SessionDiffResponse = SessionDiffResponses[keyof SessionDiffResponses];
2983
2992
  export type SessionSummarizeData = {
@@ -4415,7 +4424,7 @@ export type VcsDiffResponses = {
4415
4424
  /**
4416
4425
  * VCS diff
4417
4426
  */
4418
- 200: Array<FileDiff>;
4427
+ 200: Array<VcsFileDiff>;
4419
4428
  };
4420
4429
  export type VcsDiffResponse = VcsDiffResponses[keyof VcsDiffResponses];
4421
4430
  export type CommandListData = {
@@ -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,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/sdk",
4
- "version": "1.3.16",
4
+ "version": "1.4.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {