@opencode/client 2.2.2 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/chunks/service-3eaz3m83.js +67 -0
  2. package/dist/chunks/{pty-handoff-8ye1ye6f.js → service-8ye1ye6f.js} +2 -2
  3. package/dist/chunks/{pty-handoff-15p82y03.js → service-9j12j8xw.js} +5 -5
  4. package/dist/chunks/{pty-handoff-0e3ghr9a.js → service-b6gvhk3y.js} +76 -4
  5. package/dist/chunks/{pty-handoff-5d2vkjb7.js → service-c5ps3bxz.js} +9 -9
  6. package/dist/chunks/{pty-handoff-gecjxyvt.js → service-gecjxyvt.js} +1 -1
  7. package/dist/chunks/service-mwrzahmf.js +38 -0
  8. package/dist/chunks/{pty-handoff-pgwvv4px.js → service-qbhap0da.js} +2 -2
  9. package/dist/chunks/{pty-handoff-ryy6kscr.js → service-ryy6kscr.js} +1 -1
  10. package/dist/chunks/{pty-handoff-f6hq5twr.js → service-sbaynanj.js} +72 -8
  11. package/dist/chunks/{pty-handoff-cvg5j6d1.js → service-sdjh9vmn.js} +3 -1
  12. package/dist/chunks/{pty-handoff-wcnmkks2.js → service-vzds1rj7.js} +4 -4
  13. package/dist/chunks/{pty-handoff-kdshn947.js → service-xqwq6bgr.js} +1 -1
  14. package/dist/chunks/{pty-handoff-bb4rz2ry.js → service-ykkgdxgz.js} +42 -7
  15. package/dist/contract.js +1 -1
  16. package/dist/effect/api/api.d.ts +93 -3
  17. package/dist/effect/client.d.ts +82 -2
  18. package/dist/effect/client.js +8 -8
  19. package/dist/effect/generated/client-error.js +1 -1
  20. package/dist/effect/generated/client.d.ts +82 -2
  21. package/dist/effect/generated/client.js +5 -5
  22. package/dist/effect/generated/index.js +4 -4
  23. package/dist/effect/index.js +8 -8
  24. package/dist/effect/rpc.js +4 -4
  25. package/dist/effect/service.js +6 -6
  26. package/dist/promise/client.d.ts +10 -1
  27. package/dist/promise/client.js +7 -7
  28. package/dist/promise/generated/client-error.js +1 -1
  29. package/dist/promise/generated/client.d.ts +10 -1
  30. package/dist/promise/generated/client.js +2 -2
  31. package/dist/promise/generated/index.js +8 -4
  32. package/dist/promise/generated/types.d.ts +171 -11
  33. package/dist/promise/generated/types.js +5 -1
  34. package/dist/promise/index.d.ts +1 -0
  35. package/dist/promise/index.js +19 -9
  36. package/dist/promise/media.d.ts +365 -0
  37. package/dist/promise/media.js +8 -0
  38. package/dist/promise/rpc.js +2 -2
  39. package/dist/promise/service.js +6 -6
  40. package/dist/pty-handoff.js +4 -4
  41. package/dist/rpc-runtime.js +1 -1
  42. package/dist/service-contender.js +1 -1
  43. package/dist/service-probe.js +3 -3
  44. package/dist/service-timing.js +1 -1
  45. package/dist/service-version.js +1 -1
  46. package/dist/service.js +1 -1
  47. package/dist/shared-events.js +1 -1
  48. package/dist/solid/connection.js +1 -1
  49. package/dist/solid/data.d.ts +2 -0
  50. package/dist/solid/data.js +10 -9
  51. package/dist/solid/index.js +20 -15
  52. package/dist/solid/pty.d.ts +67 -9
  53. package/dist/solid/pty.js +7 -3
  54. package/dist/solid/retention.js +1 -1
  55. package/dist/solid/usage.js +1 -1
  56. package/package.json +4 -4
  57. package/dist/chunks/pty-handoff-gne7h7mq.js +0 -50
  58. /package/dist/chunks/{pty-handoff-60xe5cbf.js → service-60xe5cbf.js} +0 -0
  59. /package/dist/chunks/{pty-handoff-6mptkzbc.js → service-6mptkzbc.js} +0 -0
  60. /package/dist/chunks/{pty-handoff-6mq2wh8y.js → service-6mq2wh8y.js} +0 -0
  61. /package/dist/chunks/{pty-handoff-m2eywc8w.js → service-6r38tsk5.js} +0 -0
  62. /package/dist/chunks/{pty-handoff-8s2anffy.js → service-8s2anffy.js} +0 -0
  63. /package/dist/chunks/{pty-handoff-9rqn6x4v.js → service-9rqn6x4v.js} +0 -0
  64. /package/dist/chunks/{pty-handoff-nwcpakzx.js → service-nwcpakzx.js} +0 -0
  65. /package/dist/chunks/{pty-handoff-qav6mfdz.js → service-qav6mfdz.js} +0 -0
  66. /package/dist/chunks/{pty-handoff-sxt88q69.js → service-sxt88q69.js} +0 -0
  67. /package/dist/chunks/{pty-handoff-ve4aws36.js → service-ve4aws36.js} +0 -0
  68. /package/dist/chunks/{pty-handoff-vyas3vgt.js → service-vyas3vgt.js} +0 -0
  69. /package/dist/chunks/{pty-handoff-xgnj2w4v.js → service-xgnj2w4v.js} +0 -0
  70. /package/dist/chunks/{pty-handoff-y2etg5bs.js → service-y2etg5bs.js} +0 -0
  71. /package/dist/chunks/{pty-handoff-ydhz1zrh.js → service-ydhz1zrh.js} +0 -0
@@ -1,40 +1,45 @@
1
- import"../chunks/pty-handoff-nwcpakzx.js";
2
- import"../chunks/pty-handoff-0e3ghr9a.js";
3
- import"../chunks/pty-handoff-cvg5j6d1.js";
4
- import"../chunks/pty-handoff-vyas3vgt.js";
5
- import"../chunks/pty-handoff-gecjxyvt.js";
6
- import"../chunks/pty-handoff-kdshn947.js";
7
- import"../chunks/pty-handoff-wcnmkks2.js";
8
- import"../chunks/pty-handoff-m2eywc8w.js";
1
+ import"../chunks/service-nwcpakzx.js";
2
+ import"../chunks/service-b6gvhk3y.js";
3
+ import"../chunks/service-sdjh9vmn.js";
4
+ import"../chunks/service-vyas3vgt.js";
5
+ import"../chunks/service-gecjxyvt.js";
6
+ import"../chunks/service-xqwq6bgr.js";
7
+ import"../chunks/service-vzds1rj7.js";
8
+ import"../chunks/service-mwrzahmf.js";
9
+ import"../chunks/service-6r38tsk5.js";
9
10
  import {
10
11
  settleMs2,
11
12
  locationKey2,
12
13
  createData2
13
- } from "../chunks/pty-handoff-f6hq5twr.js";
14
+ } from "../chunks/service-sbaynanj.js";
14
15
  import {
15
16
  defaultIdleTimeout2,
16
17
  foregroundIdleThreshold2,
17
18
  createClientConnection2
18
- } from "../chunks/pty-handoff-ydhz1zrh.js";
19
+ } from "../chunks/service-ydhz1zrh.js";
19
20
  import {
20
- createPtyClient2,
21
+ PersistentPtyMessage2,
22
+ decodePersistentPtyMessage2,
23
+ persistentPtyFrame2,
21
24
  createPersistentPtyClient2
22
- } from "../chunks/pty-handoff-gne7h7mq.js";
25
+ } from "../chunks/service-3eaz3m83.js";
23
26
  import {
24
27
  createSessionRetention2
25
- } from "../chunks/pty-handoff-6mq2wh8y.js";
28
+ } from "../chunks/service-6mq2wh8y.js";
26
29
  import {
27
30
  lastAssistantWithUsage2
28
- } from "../chunks/pty-handoff-8s2anffy.js";
31
+ } from "../chunks/service-8s2anffy.js";
29
32
  export {
33
+ PersistentPtyMessage2 as PersistentPtyMessage,
30
34
  createClientConnection2 as createClientConnection,
31
35
  createData2 as createData,
32
36
  createPersistentPtyClient2 as createPersistentPtyClient,
33
- createPtyClient2 as createPtyClient,
34
37
  createSessionRetention2 as createSessionRetention,
38
+ decodePersistentPtyMessage2 as decodePersistentPtyMessage,
35
39
  defaultIdleTimeout2 as defaultIdleTimeout,
36
40
  foregroundIdleThreshold2 as foregroundIdleThreshold,
37
41
  lastAssistantWithUsage2 as lastAssistantWithUsage,
38
42
  locationKey2 as locationKey,
43
+ persistentPtyFrame2 as persistentPtyFrame,
39
44
  settleMs2 as settleMs
40
45
  };
@@ -1,22 +1,80 @@
1
- import type { ExperimentalPersistentPtyConnectTokenInput, OpenCodeClient, PtyConnectTokenInput } from "../promise";
1
+ import { Schema } from "effect";
2
+ import type { ExperimentalPersistentPtyConnectTokenInput, OpenCodeClient } from "../promise";
3
+ export declare const PersistentPtyMessage: Schema.Union<readonly [Schema.Struct<{
4
+ readonly type: Schema.Literal<"attached">;
5
+ readonly inputProtocol: Schema.optional<Schema.Number>;
6
+ readonly info: Schema.Struct<{
7
+ readonly size: Schema.Struct<{
8
+ readonly cols: Schema.Int;
9
+ readonly rows: Schema.Int;
10
+ }>;
11
+ }>;
12
+ readonly role: Schema.optional<Schema.Literals<readonly ["controller", "observer"]>>;
13
+ }>, Schema.Struct<{
14
+ readonly type: Schema.Literal<"replay_complete">;
15
+ }>, Schema.Struct<{
16
+ readonly type: Schema.Literal<"resized">;
17
+ readonly cols: Schema.Number;
18
+ readonly rows: Schema.Number;
19
+ readonly checkpoint: Schema.String;
20
+ }>, Schema.Struct<{
21
+ readonly type: Schema.Literal<"controller_changed">;
22
+ readonly attachmentID: Schema.optional<Schema.NullOr<Schema.String>>;
23
+ }>, Schema.Struct<{
24
+ readonly type: Schema.Literal<"exited">;
25
+ readonly exitCode: Schema.optional<Schema.NullOr<Schema.Number>>;
26
+ }>, Schema.Struct<{
27
+ readonly type: Schema.Literal<"title_changed">;
28
+ readonly title: Schema.String;
29
+ }>, Schema.Struct<{
30
+ readonly type: Schema.Literal<"foreground_process_changed">;
31
+ readonly process: Schema.NullOr<Schema.String>;
32
+ }>]>;
33
+ export type PersistentPtyMessage = typeof PersistentPtyMessage.Type;
34
+ export declare function decodePersistentPtyMessage(text: string): import("effect/Option").Option<{
35
+ readonly type: "replay_complete";
36
+ } | {
37
+ readonly type: "resized";
38
+ readonly cols: number;
39
+ readonly rows: number;
40
+ readonly checkpoint: string;
41
+ } | {
42
+ readonly type: "title_changed";
43
+ readonly title: string;
44
+ } | {
45
+ readonly type: "foreground_process_changed";
46
+ readonly process: string | null;
47
+ } | {
48
+ readonly type: "attached";
49
+ readonly inputProtocol?: number | undefined;
50
+ readonly info: {
51
+ readonly size: {
52
+ readonly cols: number;
53
+ readonly rows: number;
54
+ };
55
+ };
56
+ readonly role?: "controller" | "observer" | undefined;
57
+ } | {
58
+ readonly type: "controller_changed";
59
+ readonly attachmentID?: string | null | undefined;
60
+ } | {
61
+ readonly type: "exited";
62
+ readonly exitCode?: number | null | undefined;
63
+ }>;
64
+ export declare function persistentPtyFrame(size: {
65
+ cols: number;
66
+ rows: number;
67
+ }, data?: Uint8Array): Uint8Array<ArrayBuffer>;
2
68
  export type PtyClientOptions = {
3
69
  readonly url: string;
4
70
  readonly openSocket?: (url: URL) => WebSocket;
5
71
  };
6
- export type PtyConnectInput = {
7
- readonly ptyID: PtyConnectTokenInput["ptyID"];
8
- readonly location?: PtyConnectTokenInput["location"];
9
- readonly cursor?: number;
10
- };
11
72
  export type PersistentPtyConnectInput = {
12
73
  readonly ptyID: ExperimentalPersistentPtyConnectTokenInput["ptyID"];
13
74
  readonly cursor: number;
14
75
  readonly attachmentID: string;
15
76
  readonly takeover?: boolean;
16
77
  };
17
- export declare function createPtyClient(api: OpenCodeClient, options: PtyClientOptions): {
18
- connect(input: PtyConnectInput): Promise<WebSocket>;
19
- };
20
78
  export declare function createPersistentPtyClient(api: OpenCodeClient, options: PtyClientOptions): {
21
79
  connect(input: PersistentPtyConnectInput): Promise<WebSocket>;
22
80
  };
package/dist/solid/pty.js CHANGED
@@ -1,8 +1,12 @@
1
1
  import {
2
- createPtyClient2,
2
+ PersistentPtyMessage2,
3
+ decodePersistentPtyMessage2,
4
+ persistentPtyFrame2,
3
5
  createPersistentPtyClient2
4
- } from "../chunks/pty-handoff-gne7h7mq.js";
6
+ } from "../chunks/service-3eaz3m83.js";
5
7
  export {
8
+ PersistentPtyMessage2 as PersistentPtyMessage,
6
9
  createPersistentPtyClient2 as createPersistentPtyClient,
7
- createPtyClient2 as createPtyClient
10
+ decodePersistentPtyMessage2 as decodePersistentPtyMessage,
11
+ persistentPtyFrame2 as persistentPtyFrame
8
12
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createSessionRetention2
3
- } from "../chunks/pty-handoff-6mq2wh8y.js";
3
+ } from "../chunks/service-6mq2wh8y.js";
4
4
  export {
5
5
  createSessionRetention2 as createSessionRetention
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  lastAssistantWithUsage2
3
- } from "../chunks/pty-handoff-8s2anffy.js";
3
+ } from "../chunks/service-8s2anffy.js";
4
4
  export {
5
5
  lastAssistantWithUsage2 as lastAssistantWithUsage
6
6
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/client",
4
- "version": "2.2.2",
4
+ "version": "2.2.4",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -63,8 +63,8 @@
63
63
  "typecheck:tsc": "tsc --noEmit"
64
64
  },
65
65
  "dependencies": {
66
- "@opencode/schema": "2.2.2",
67
- "@opencode/protocol": "2.2.2"
66
+ "@opencode/schema": "2.2.4",
67
+ "@opencode/protocol": "2.2.4"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "effect": "4.0.6",
@@ -81,7 +81,7 @@
81
81
  "devDependencies": {
82
82
  "@effect/platform-node": "4.0.6",
83
83
  "@modelcontextprotocol/client": "2.3.1",
84
- "@opencode/httpapi-codegen": "2.2.2",
84
+ "@opencode/httpapi-codegen": "2.2.4",
85
85
  "@tsconfig/bun": "1.0.9",
86
86
  "@types/bun": "1.4.3",
87
87
  "@typescript/native": "npm:typescript@7.1.0-beta",
@@ -1,50 +0,0 @@
1
- // src/solid/pty.ts
2
- function createPtyClient2(api, options) {
3
- return {
4
- async connect(input) {
5
- const result = await api.pty.connect.token({
6
- ptyID: input.ptyID,
7
- location: input.location,
8
- "x-opencode-ticket": "1"
9
- });
10
- const baseUrl = new URL(options.url);
11
- if (!baseUrl.pathname.endsWith("/"))
12
- baseUrl.pathname += "/";
13
- const url = new URL(`api/pty/${encodeURIComponent(input.ptyID)}/connect`, baseUrl);
14
- if (input.location?.directory)
15
- url.searchParams.set("location[directory]", input.location.directory);
16
- if (input.cursor !== undefined)
17
- url.searchParams.set("cursor", String(input.cursor));
18
- url.searchParams.set("ticket", result.data.ticket);
19
- url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
20
- const socket = options.openSocket?.(url) ?? new WebSocket(url);
21
- socket.binaryType = "arraybuffer";
22
- return socket;
23
- }
24
- };
25
- }
26
- function createPersistentPtyClient2(api, options) {
27
- return {
28
- async connect(input) {
29
- const token = await api.experimental.persistentPty.connectToken({
30
- ptyID: input.ptyID,
31
- "x-opencode-ticket": "1"
32
- });
33
- const baseUrl = new URL(options.url);
34
- if (!baseUrl.pathname.endsWith("/"))
35
- baseUrl.pathname += "/";
36
- const url = new URL(`api/experimental/persistent-pty/${encodeURIComponent(input.ptyID)}/connect`, baseUrl);
37
- url.searchParams.set("ticket", token.ticket);
38
- url.searchParams.set("cursor", String(input.cursor));
39
- url.searchParams.set("attachment_id", input.attachmentID);
40
- url.searchParams.set("takeover", String(input.takeover ?? false));
41
- url.searchParams.set("input_protocol", "1");
42
- url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
43
- const socket = options.openSocket?.(url) ?? new WebSocket(url);
44
- socket.binaryType = "arraybuffer";
45
- return socket;
46
- }
47
- };
48
- }
49
-
50
- export { createPtyClient2, createPersistentPtyClient2 };