@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
@@ -0,0 +1,67 @@
1
+ // src/solid/pty.ts
2
+ import { PersistentPty } from "@opencode/schema/persistent-pty";
3
+ import { Schema } from "effect";
4
+ var PersistentPtyMessage2 = Schema.Union([
5
+ Schema.Struct({
6
+ type: Schema.Literal("attached"),
7
+ inputProtocol: Schema.optional(Schema.Number),
8
+ info: Schema.Struct({ size: PersistentPty.Info.fields.size }),
9
+ role: Schema.optional(Schema.Literals(["controller", "observer"]))
10
+ }),
11
+ Schema.Struct({ type: Schema.Literal("replay_complete") }),
12
+ Schema.Struct({
13
+ type: Schema.Literal("resized"),
14
+ cols: Schema.Number,
15
+ rows: Schema.Number,
16
+ checkpoint: Schema.String
17
+ }),
18
+ Schema.Struct({
19
+ type: Schema.Literal("controller_changed"),
20
+ attachmentID: Schema.optional(Schema.NullOr(Schema.String))
21
+ }),
22
+ Schema.Struct({
23
+ type: Schema.Literal("exited"),
24
+ exitCode: Schema.optional(Schema.NullOr(Schema.Number))
25
+ }),
26
+ Schema.Struct({ type: Schema.Literal("title_changed"), title: Schema.String }),
27
+ Schema.Struct({ type: Schema.Literal("foreground_process_changed"), process: Schema.NullOr(Schema.String) })
28
+ ]);
29
+ var decodeMessage = Schema.decodeUnknownOption(Schema.fromJsonString(PersistentPtyMessage2));
30
+ function decodePersistentPtyMessage2(text) {
31
+ return decodeMessage(text);
32
+ }
33
+ function persistentPtyFrame2(size, data) {
34
+ const frame = new Uint8Array(5 + (data?.byteLength ?? 0));
35
+ const view = new DataView(frame.buffer);
36
+ frame[0] = data ? 1 : 0;
37
+ view.setUint16(1, size.cols);
38
+ view.setUint16(3, size.rows);
39
+ if (data)
40
+ frame.set(data, 5);
41
+ return frame;
42
+ }
43
+ function createPersistentPtyClient2(api, options) {
44
+ return {
45
+ async connect(input) {
46
+ const token = await api.experimental.persistentPty.connectToken({
47
+ ptyID: input.ptyID,
48
+ "x-opencode-ticket": "1"
49
+ });
50
+ const baseUrl = new URL(options.url);
51
+ if (!baseUrl.pathname.endsWith("/"))
52
+ baseUrl.pathname += "/";
53
+ const url = new URL(`api/experimental/persistent-pty/${encodeURIComponent(input.ptyID)}/connect`, baseUrl);
54
+ url.searchParams.set("ticket", token.ticket);
55
+ url.searchParams.set("cursor", String(input.cursor));
56
+ url.searchParams.set("attachment_id", input.attachmentID);
57
+ url.searchParams.set("takeover", String(input.takeover ?? false));
58
+ url.searchParams.set("input_protocol", "1");
59
+ url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
60
+ const socket = options.openSocket?.(url) ?? new WebSocket(url);
61
+ socket.binaryType = "arraybuffer";
62
+ return socket;
63
+ }
64
+ };
65
+ }
66
+
67
+ export { PersistentPtyMessage2, decodePersistentPtyMessage2, persistentPtyFrame2, createPersistentPtyClient2 };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  defaultEnsureTiming2
3
- } from "./pty-handoff-xgnj2w4v.js";
3
+ } from "./service-xgnj2w4v.js";
4
4
  import {
5
5
  matchesVersion2
6
- } from "./pty-handoff-sxt88q69.js";
6
+ } from "./service-sxt88q69.js";
7
7
 
8
8
  // src/service-probe.ts
9
9
  import { homedir } from "node:os";
@@ -3,20 +3,20 @@ import {
3
3
  readError2,
4
4
  event2,
5
5
  eventType2
6
- } from "./pty-handoff-ryy6kscr.js";
6
+ } from "./service-ryy6kscr.js";
7
7
  import {
8
8
  __export
9
- } from "./pty-handoff-9rqn6x4v.js";
9
+ } from "./service-9rqn6x4v.js";
10
10
 
11
11
  // src/effect/rpc.ts
12
12
  var exports_rpc = {};
13
13
  __export(exports_rpc, {
14
14
  RpcClientRuntime: () => exports_rpc,
15
15
  aborted: () => aborted2,
16
- make: () => make3
16
+ make: () => make4
17
17
  });
18
18
  import { Effect, Stream } from "effect";
19
- function make3(call, subscribe) {
19
+ function make4(call, subscribe) {
20
20
  return (definition) => {
21
21
  const methods = Object.fromEntries(Object.entries(definition.methods).map(([name, method]) => [
22
22
  name,
@@ -59,4 +59,4 @@ function aborted2(signal) {
59
59
  });
60
60
  }
61
61
 
62
- export { make3, aborted2, exports_rpc };
62
+ export { make4, aborted2, exports_rpc };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  ClientError3
3
- } from "./pty-handoff-nwcpakzx.js";
3
+ } from "./service-nwcpakzx.js";
4
4
  import {
5
5
  __export
6
- } from "./pty-handoff-9rqn6x4v.js";
6
+ } from "./service-9rqn6x4v.js";
7
7
 
8
8
  // src/promise/generated/client.ts
9
9
  var exports_client4 = {};
@@ -818,9 +818,9 @@ function make6(options) {
818
818
  update: (input, requestOptions) => request({
819
819
  method: "PUT",
820
820
  path: `/api/experimental/persistent-pty/${encodeURIComponent(input.ptyID)}`,
821
- body: { attachmentID: input["attachmentID"], size: input["size"] },
821
+ body: { attachmentID: input["attachmentID"], size: input["size"], title: input["title"] },
822
822
  successStatus: 200,
823
- declaredStatuses: [400, 401, 404, 503],
823
+ declaredStatuses: [400, 401, 404, 501, 503],
824
824
  empty: false
825
825
  }, requestOptions).then((value) => value.data),
826
826
  snapshot: (input, requestOptions) => request({
@@ -910,6 +910,78 @@ function make6(options) {
910
910
  empty: true
911
911
  }, requestOptions)
912
912
  },
913
+ artifacts: {
914
+ providers: (input, requestOptions) => request({
915
+ method: "GET",
916
+ path: `/api/experimental/artifacts/providers`,
917
+ query: { location: input?.["location"] },
918
+ successStatus: 200,
919
+ declaredStatuses: [400, 401, 403, 404, 503],
920
+ empty: false
921
+ }, requestOptions),
922
+ list: (input, requestOptions) => request({
923
+ method: "GET",
924
+ path: `/api/experimental/artifacts`,
925
+ query: { location: input?.["location"], sessionID: input?.["sessionID"], provider: input?.["provider"] },
926
+ successStatus: 200,
927
+ declaredStatuses: [400, 401, 403, 404, 503],
928
+ empty: false
929
+ }, requestOptions),
930
+ create: (input, requestOptions) => request({
931
+ method: "POST",
932
+ path: `/api/experimental/artifacts`,
933
+ query: { location: input["location"] },
934
+ body: {
935
+ title: input["title"],
936
+ files: input["files"],
937
+ entry: input["entry"],
938
+ provider: input["provider"],
939
+ sessionID: input["sessionID"]
940
+ },
941
+ successStatus: 200,
942
+ declaredStatuses: [400, 401, 403, 404, 503],
943
+ empty: false
944
+ }, requestOptions),
945
+ get: (input, requestOptions) => request({
946
+ method: "GET",
947
+ path: `/api/experimental/artifacts/${encodeURIComponent(input.artifactID)}`,
948
+ query: { location: input["location"] },
949
+ successStatus: 200,
950
+ declaredStatuses: [400, 401, 403, 404, 503],
951
+ empty: false
952
+ }, requestOptions),
953
+ update: (input, requestOptions) => request({
954
+ method: "PATCH",
955
+ path: `/api/experimental/artifacts/${encodeURIComponent(input.artifactID)}`,
956
+ query: { location: input["location"] },
957
+ body: {
958
+ title: input["title"],
959
+ files: input["files"],
960
+ entry: input["entry"],
961
+ sessionID: input["sessionID"]
962
+ },
963
+ successStatus: 200,
964
+ declaredStatuses: [400, 401, 403, 404, 503],
965
+ empty: false
966
+ }, requestOptions),
967
+ delete: (input, requestOptions) => request({
968
+ method: "DELETE",
969
+ path: `/api/experimental/artifacts/${encodeURIComponent(input.artifactID)}`,
970
+ query: { location: input["location"] },
971
+ successStatus: 204,
972
+ declaredStatuses: [400, 401, 403, 404, 503],
973
+ empty: true
974
+ }, requestOptions),
975
+ view: (input, requestOptions) => request({
976
+ method: "GET",
977
+ path: `/api/experimental/artifacts/${encodeURIComponent(input.artifactID)}/view/${encodePath(input.path)}`,
978
+ query: { location: input["location"] },
979
+ successStatus: 200,
980
+ declaredStatuses: [400, 401, 403, 404, 503],
981
+ empty: false,
982
+ binary: true
983
+ }, requestOptions)
984
+ },
913
985
  migration: {
914
986
  v1: {
915
987
  status: (requestOptions) => request({
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  make7
3
- } from "./pty-handoff-gecjxyvt.js";
3
+ } from "./service-gecjxyvt.js";
4
4
  import {
5
5
  ClientError2
6
- } from "./pty-handoff-y2etg5bs.js";
6
+ } from "./service-y2etg5bs.js";
7
7
  import {
8
- make4
9
- } from "./pty-handoff-bb4rz2ry.js";
8
+ make3
9
+ } from "./service-ykkgdxgz.js";
10
10
  import {
11
- make3,
11
+ make4,
12
12
  aborted2
13
- } from "./pty-handoff-15p82y03.js";
13
+ } from "./service-9j12j8xw.js";
14
14
  import {
15
15
  __export
16
- } from "./pty-handoff-9rqn6x4v.js";
16
+ } from "./service-9rqn6x4v.js";
17
17
 
18
18
  // src/effect/client.ts
19
19
  var exports_client = {};
@@ -30,7 +30,7 @@ var CurrentHeaders = Context.Reference("@opencode/client/effect/rpc/headers", {
30
30
  });
31
31
  var make2 = Effect.fn("OpenCode.make")(function* (options) {
32
32
  const httpClient = yield* HttpClient.HttpClient;
33
- const raw = yield* make4(options).pipe(Effect.provideService(HttpClient.HttpClient, HttpClient.mapRequestEffect(httpClient, (request) => Effect.map(CurrentHeaders, (headers) => headers ? HttpClientRequest.setHeaders(request, new Headers(headers)) : request))));
33
+ const raw = yield* make3(options).pipe(Effect.provideService(HttpClient.HttpClient, HttpClient.mapRequestEffect(httpClient, (request) => Effect.map(CurrentHeaders, (headers) => headers ? HttpClientRequest.setHeaders(request, new Headers(headers)) : request))));
34
34
  const context = yield* Effect.context();
35
35
  const native = raw.event.subscribe();
36
36
 
@@ -45,7 +45,7 @@ var make2 = Effect.fn("OpenCode.make")(function* (options) {
45
45
  return {
46
46
  ...raw,
47
47
  event: { ...raw.event, subscribe },
48
- rpc: Object.assign(make3((input, options) => raw.rpc.call(input).pipe(Effect.provideService(CurrentHeaders, options?.headers)), subscribe), raw.rpc)
48
+ rpc: Object.assign(make4((input, options) => raw.rpc.call(input).pipe(Effect.provideService(CurrentHeaders, options?.headers)), subscribe), raw.rpc)
49
49
  };
50
50
  });
51
51
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./pty-handoff-9rqn6x4v.js";
3
+ } from "./service-9rqn6x4v.js";
4
4
 
5
5
  // src/shared-events.ts
6
6
  var exports_shared_events = {};
@@ -0,0 +1,38 @@
1
+ // src/promise/media.ts
2
+ var MEDIA_URI_CAPABILITY = "experimental-media-uri";
3
+ var CAPABILITIES_HEADER = "X-OpenCode-Capabilities";
4
+ var MEDIA_REF = /^media:([0-9a-f]{64})$/;
5
+ function mediaHashFromUri2(uri) {
6
+ if (!uri)
7
+ return;
8
+ return MEDIA_REF.exec(uri)?.[1];
9
+ }
10
+ function withMediaRefs2(api) {
11
+ return {
12
+ ...api,
13
+ message: {
14
+ ...api.message,
15
+ list: (input, options) => api.message.list(input, mediaRefOptions(options))
16
+ },
17
+ session: {
18
+ ...api.session,
19
+ message: {
20
+ ...api.session.message,
21
+ get: (input, options) => api.session.message.get(input, mediaRefOptions(options))
22
+ },
23
+ inbox: {
24
+ ...api.session.inbox,
25
+ list: (input, options) => api.session.inbox.list(input, mediaRefOptions(options))
26
+ }
27
+ }
28
+ };
29
+ }
30
+ function mediaRefOptions(options) {
31
+ if (options?.mediaRefs === false)
32
+ return options;
33
+ const headers = new Headers(options?.headers);
34
+ headers.set(CAPABILITIES_HEADER, MEDIA_URI_CAPABILITY);
35
+ return { ...options, headers };
36
+ }
37
+
38
+ export { mediaHashFromUri2, withMediaRefs2 };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  headers2
3
- } from "./pty-handoff-8ye1ye6f.js";
3
+ } from "./service-8ye1ye6f.js";
4
4
  import {
5
5
  __export
6
- } from "./pty-handoff-9rqn6x4v.js";
6
+ } from "./service-9rqn6x4v.js";
7
7
 
8
8
  // src/pty-handoff.ts
9
9
  var exports_pty_handoff = {};
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./pty-handoff-9rqn6x4v.js";
3
+ } from "./service-9rqn6x4v.js";
4
4
 
5
5
  // src/rpc-runtime.ts
6
6
  var exports_rpc_runtime = {};
@@ -1,8 +1,10 @@
1
1
  import {
2
+ isSessionNotFoundError2,
3
+ isMessageNotFoundError2,
2
4
  isFormNotFoundError2,
3
5
  isFormAlreadySettledError2,
4
6
  isPermissionNotFoundError2
5
- } from "./pty-handoff-cvg5j6d1.js";
7
+ } from "./service-sdjh9vmn.js";
6
8
 
7
9
  // src/solid/data.ts
8
10
  import { Worktree } from "@opencode/schema/worktree";
@@ -127,6 +129,7 @@ function createSync() {
127
129
  };
128
130
  }
129
131
  var CHILD_PAGE = 200;
132
+ var DELETED_SESSION_LIMIT = 512;
130
133
  function createData2(config) {
131
134
  const api = config.api;
132
135
  let disposed = false;
@@ -137,6 +140,12 @@ function createData2(config) {
137
140
  load().catch((error) => {
138
141
  if (disposed || config.connection && config.connection.status() !== "connected")
139
142
  return;
143
+ if (isSessionNotFoundError2(error)) {
144
+ markDeleted(error.sessionID);
145
+ return;
146
+ }
147
+ if (isMessageNotFoundError2(error))
148
+ return;
140
149
  if (config.onError)
141
150
  return config.onError(error);
142
151
  console.error("Failed to refresh client data", error);
@@ -154,6 +163,7 @@ function createData2(config) {
154
163
  const [store, setStore] = createStore({
155
164
  session: {
156
165
  info: {},
166
+ missing: {},
157
167
  family: {},
158
168
  active: {},
159
169
  message: {},
@@ -425,6 +435,35 @@ function createData2(config) {
425
435
  draft.pending[sessionID] = pending;
426
436
  }));
427
437
  }
438
+ let deletionEpoch = 0;
439
+ const deletedAt = new Map;
440
+ function clearDeleted(sessionID) {
441
+ deletedAt.delete(sessionID);
442
+ if (store.session.missing[sessionID])
443
+ setStore("session", "missing", sessionID, undefined);
444
+ }
445
+ function markDeleted(sessionID) {
446
+ if (sessionOutbox.has(sessionID))
447
+ return;
448
+ batch(() => {
449
+ deletedAt.delete(sessionID);
450
+ deletedAt.set(sessionID, ++deletionEpoch);
451
+ if (deletedAt.size > DELETED_SESSION_LIMIT) {
452
+ const oldest = deletedAt.keys().next().value;
453
+ if (oldest !== undefined) {
454
+ deletedAt.delete(oldest);
455
+ setStore("session", "missing", oldest, undefined);
456
+ }
457
+ }
458
+ setStore("session", "missing", sessionID, true);
459
+ removeSession(sessionID);
460
+ });
461
+ }
462
+ function evictMissing(error) {
463
+ if (isSessionNotFoundError2(error))
464
+ markDeleted(error.sessionID);
465
+ throw error;
466
+ }
428
467
  function removeSession(sessionID) {
429
468
  activeUpdates?.set(sessionID, undefined);
430
469
  store.session.pending[sessionID]?.forEach((item) => outbox.delete(item.id));
@@ -489,6 +528,7 @@ function createData2(config) {
489
528
  setStore("project", "info", event.data.id, reconcile(event.data));
490
529
  return;
491
530
  case "session.created":
531
+ clearDeleted(event.data.sessionID);
492
532
  sessionOutbox.delete(event.data.sessionID);
493
533
  result.session.invalidate(event.data.sessionID);
494
534
  refresh(() => result.session.sync(event.data.sessionID));
@@ -496,7 +536,7 @@ function createData2(config) {
496
536
  sync.complete(`session.message:${event.data.sessionID}`);
497
537
  return;
498
538
  case "session.deleted":
499
- removeSession(event.data.sessionID);
539
+ markDeleted(event.data.sessionID);
500
540
  return;
501
541
  case "session.usage.updated":
502
542
  if (store.session.info[event.data.sessionID])
@@ -1210,11 +1250,18 @@ function createData2(config) {
1210
1250
  get(sessionID) {
1211
1251
  return store.session.info[sessionID];
1212
1252
  },
1253
+ missing(sessionID) {
1254
+ return Boolean(store.session.missing[sessionID]);
1255
+ },
1256
+ forget(sessionID) {
1257
+ markDeleted(sessionID);
1258
+ },
1213
1259
  creating(sessionID) {
1214
1260
  return creating.has(sessionID);
1215
1261
  },
1216
1262
  remember(info) {
1217
1263
  batch(() => {
1264
+ clearDeleted(info.id);
1218
1265
  setStore("session", "info", info.id, reconcile(info));
1219
1266
  sync.complete(`session:${info.id}`);
1220
1267
  registerSession(info.id);
@@ -1277,10 +1324,13 @@ function createData2(config) {
1277
1324
  },
1278
1325
  sync(sessionID) {
1279
1326
  return sync.run(`session.pending:${sessionID}`, async () => {
1327
+ const started = deletionEpoch;
1280
1328
  const updates = new Map;
1281
1329
  pendingUpdates.set(sessionID, updates);
1282
1330
  try {
1283
- const snapshot = await api().session.inbox.list({ sessionID });
1331
+ const snapshot = await api().session.inbox.list({ sessionID }).catch(evictMissing);
1332
+ if ((deletedAt.get(sessionID) ?? 0) > started)
1333
+ return;
1284
1334
  const current = new Map(snapshot.map((item) => [item.id, item]));
1285
1335
  updates.forEach((item, id) => {
1286
1336
  if (item === undefined)
@@ -1317,6 +1367,7 @@ function createData2(config) {
1317
1367
  const id = payload.id ?? SessionID.create();
1318
1368
  const location = payload.location ?? defaultLocation();
1319
1369
  const fresh = !store.session.info[id];
1370
+ clearDeleted(id);
1320
1371
  if (fresh) {
1321
1372
  const now = Date.now();
1322
1373
  sessionOutbox.add(id);
@@ -1423,17 +1474,19 @@ function createData2(config) {
1423
1474
  },
1424
1475
  sync(sessionID, options) {
1425
1476
  return sync.run(options?.children ? `session.family:${sessionID}` : `session:${sessionID}`, async () => {
1477
+ const started = deletionEpoch;
1426
1478
  const [info, children] = await Promise.all([
1427
- api().session.get({ sessionID }),
1479
+ api().session.get({ sessionID }).catch(evictMissing),
1428
1480
  options?.children ? listChildren({ parentID: sessionID, order: "desc", limit: CHILD_PAGE }) : []
1429
1481
  ]);
1430
- const sessions = [info, ...children];
1482
+ const sessions = [info, ...children].filter((session) => (deletedAt.get(session.id) ?? 0) <= started);
1431
1483
  batch(() => {
1432
1484
  setStore("session", "info", produce((draft) => {
1433
1485
  for (const session of sessions)
1434
1486
  draft[session.id] = session;
1435
1487
  }));
1436
1488
  for (const session of sessions) {
1489
+ clearDeleted(session.id);
1437
1490
  sync.complete(`session:${session.id}`);
1438
1491
  registerSession(session.id);
1439
1492
  }
@@ -1454,11 +1507,14 @@ function createData2(config) {
1454
1507
  },
1455
1508
  sync(sessionID) {
1456
1509
  return sync.run(`session.message:${sessionID}`, async () => {
1510
+ const started = deletionEpoch;
1457
1511
  const response = await api().message.list({
1458
1512
  sessionID,
1459
1513
  limit: config.initialMessageLimit?.() ?? messagePageLimit,
1460
1514
  order: "desc"
1461
- });
1515
+ }).catch(evictMissing);
1516
+ if ((deletedAt.get(sessionID) ?? 0) > started)
1517
+ return;
1462
1518
  const fetched = response.data.toReversed().map(stored);
1463
1519
  const ids = new Set(fetched.map((item) => item.id));
1464
1520
  const admitted = new Set((store.session.pending[sessionID] ?? []).flatMap((item) => item.type === "user" || item.type === "synthetic" ? [item.id] : []));
@@ -1547,7 +1603,11 @@ function createData2(config) {
1547
1603
  },
1548
1604
  sync(sessionID) {
1549
1605
  return sync.run(`session.permission:${sessionID}`, async () => {
1550
- setStore("session", "permission", sessionID, await api().permission.list({ sessionID }));
1606
+ const started = deletionEpoch;
1607
+ const list = await api().permission.list({ sessionID }).catch(evictMissing);
1608
+ if ((deletedAt.get(sessionID) ?? 0) > started)
1609
+ return;
1610
+ setStore("session", "permission", sessionID, list);
1551
1611
  });
1552
1612
  },
1553
1613
  invalidate(sessionID) {
@@ -1591,7 +1651,11 @@ function createData2(config) {
1591
1651
  ]);
1592
1652
  return;
1593
1653
  }
1594
- setStore("session", "form", sessionID, await api().session.form.list({ sessionID }));
1654
+ const started = deletionEpoch;
1655
+ const list = await api().session.form.list({ sessionID }).catch(evictMissing);
1656
+ if ((deletedAt.get(sessionID) ?? 0) > started)
1657
+ return;
1658
+ setStore("session", "form", sessionID, list);
1595
1659
  });
1596
1660
  },
1597
1661
  invalidate(sessionID, ref) {
@@ -34,9 +34,11 @@ var isFileNotFoundError2 = (value) => typeof value === "object" && value !== nul
34
34
  var isRpcError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcError";
35
35
  var isRpcInternalError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcInternalError";
36
36
  var isPtyNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "PtyNotFoundError";
37
+ var isPtyFeatureUnsupportedError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "PtyFeatureUnsupportedError";
37
38
  var isScheduleNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ScheduleNotFoundError";
39
+ var isArtifactNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ArtifactNotFoundError";
38
40
  var isShellNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ShellNotFoundError";
39
41
  var isWorktreeError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "WorktreeError";
40
42
  var isVcsInitNotSupportedError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "VcsInitNotSupportedError";
41
43
 
42
- export { isInvalidRequestError2, isUnauthorizedError2, isLocationNotFoundError2, isServiceUnavailableError2, isAgentNotFoundError2, isPluginNotFoundError2, isInvalidCursorError2, isSessionNotFoundError2, isMessageNotFoundError2, isConflictError2, isCommandNotFoundError2, isCommandExecutionError2, isSessionBusyError2, isUnknownError2, isFormNotFoundError2, isFormInvalidAnswerError2, isFormAlreadySettledError2, isSkillNotFoundError2, isInstructionEntryValueTooLargeError2, isProviderNotFoundError2, isModelNotFoundError2, isUnsupportedModelError2, isProviderRequestError2, isIntegrationNotFoundError2, isIntegrationAttemptNotFoundError2, isIntegrationMethodNotFoundError2, isMcpServerNotFoundError2, isForbiddenError2, isProjectNotFoundError2, isPermissionSavedNotFoundError2, isPermissionNotFoundError2, isFileNotFoundError2, isRpcError2, isRpcInternalError2, isPtyNotFoundError2, isScheduleNotFoundError2, isShellNotFoundError2, isWorktreeError2, isVcsInitNotSupportedError2 };
44
+ export { isInvalidRequestError2, isUnauthorizedError2, isLocationNotFoundError2, isServiceUnavailableError2, isAgentNotFoundError2, isPluginNotFoundError2, isInvalidCursorError2, isSessionNotFoundError2, isMessageNotFoundError2, isConflictError2, isCommandNotFoundError2, isCommandExecutionError2, isSessionBusyError2, isUnknownError2, isFormNotFoundError2, isFormInvalidAnswerError2, isFormAlreadySettledError2, isSkillNotFoundError2, isInstructionEntryValueTooLargeError2, isProviderNotFoundError2, isModelNotFoundError2, isUnsupportedModelError2, isProviderRequestError2, isIntegrationNotFoundError2, isIntegrationAttemptNotFoundError2, isIntegrationMethodNotFoundError2, isMcpServerNotFoundError2, isForbiddenError2, isProjectNotFoundError2, isPermissionSavedNotFoundError2, isPermissionNotFoundError2, isFileNotFoundError2, isRpcError2, isRpcInternalError2, isPtyNotFoundError2, isPtyFeatureUnsupportedError2, isScheduleNotFoundError2, isArtifactNotFoundError2, isShellNotFoundError2, isWorktreeError2, isVcsInitNotSupportedError2 };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  make7
3
- } from "./pty-handoff-gecjxyvt.js";
3
+ } from "./service-gecjxyvt.js";
4
4
  import {
5
5
  make6
6
- } from "./pty-handoff-0e3ghr9a.js";
6
+ } from "./service-b6gvhk3y.js";
7
7
  import {
8
8
  makeRpc2
9
- } from "./pty-handoff-kdshn947.js";
9
+ } from "./service-xqwq6bgr.js";
10
10
  import {
11
11
  __export
12
- } from "./pty-handoff-9rqn6x4v.js";
12
+ } from "./service-9rqn6x4v.js";
13
13
 
14
14
  // src/promise/client.ts
15
15
  var exports_client3 = {};
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isRpcError2,
3
3
  isRpcInternalError2
4
- } from "./pty-handoff-cvg5j6d1.js";
4
+ } from "./service-sdjh9vmn.js";
5
5
 
6
6
  // src/promise/rpc.ts
7
7
  function makeRpc2(raw, events) {
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  ClientApi2
3
- } from "./pty-handoff-60xe5cbf.js";
3
+ } from "./service-60xe5cbf.js";
4
4
  import {
5
5
  ClientError2
6
- } from "./pty-handoff-y2etg5bs.js";
6
+ } from "./service-y2etg5bs.js";
7
7
  import {
8
8
  __export
9
- } from "./pty-handoff-9rqn6x4v.js";
9
+ } from "./service-9rqn6x4v.js";
10
10
 
11
11
  // src/effect/generated/client.ts
12
12
  var exports_client2 = {};
13
13
  __export(exports_client2, {
14
- make: () => make4
14
+ make: () => make3
15
15
  });
16
16
  import { Effect, Stream, Schema } from "effect";
17
17
  import { Sse } from "effect/encoding";
@@ -540,7 +540,7 @@ var EndpointExperimentalPersistentPtyHandoff = (raw) => () => preserveEffect()(r
540
540
  var EndpointExperimentalPersistentPtyGet = (raw) => (input) => preserveEffect()(raw["persistentPty.get"]({ params: { ptyID: input["ptyID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
541
541
  var EndpointExperimentalPersistentPtyUpdate = (raw) => (input) => preserveEffect()(raw["persistentPty.update"]({
542
542
  params: { ptyID: input["ptyID"] },
543
- payload: { attachmentID: input["attachmentID"], size: input["size"] }
543
+ payload: { attachmentID: input["attachmentID"], size: input["size"], title: input["title"] }
544
544
  }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
545
545
  var EndpointExperimentalPersistentPtySnapshot = (raw) => (input) => preserveEffect()(raw["persistentPty.snapshot"]({ params: { ptyID: input["ptyID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
546
546
  var EndpointExperimentalPersistentPtyRemove = (raw) => (input) => preserveEffect()(raw["persistentPty.remove"]({ params: { ptyID: input["ptyID"] } }).pipe(Effect.mapError(mapClientError)));
@@ -564,6 +564,33 @@ var EndpointExperimentalScheduleGet = (raw) => (input) => preserveEffect()(raw["
564
564
  var EndpointExperimentalSchedulePause = (raw) => (input) => preserveEffect()(raw["schedule.pause"]({ params: { scheduleID: input["scheduleID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
565
565
  var EndpointExperimentalScheduleResume = (raw) => (input) => preserveEffect()(raw["schedule.resume"]({ params: { scheduleID: input["scheduleID"] } }).pipe(Effect.mapError(mapClientError), Effect.map((value) => value.data)));
566
566
  var EndpointExperimentalScheduleDelete = (raw) => (input) => preserveEffect()(raw["schedule.delete"]({ params: { scheduleID: input["scheduleID"] } }).pipe(Effect.mapError(mapClientError)));
567
+ var EndpointExperimentalArtifactsProviders = (raw) => (input) => preserveEffect()(raw["artifacts.providers"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
568
+ var EndpointExperimentalArtifactsList = (raw) => (input) => preserveEffect()(raw["artifacts.list"]({
569
+ query: { location: input?.["location"], sessionID: input?.["sessionID"], provider: input?.["provider"] }
570
+ }).pipe(Effect.mapError(mapClientError)));
571
+ var EndpointExperimentalArtifactsCreate = (raw) => (input) => preserveEffect()(raw["artifacts.create"]({
572
+ query: { location: input["location"] },
573
+ payload: {
574
+ title: input["title"],
575
+ files: input["files"],
576
+ entry: input["entry"],
577
+ provider: input["provider"],
578
+ sessionID: input["sessionID"]
579
+ }
580
+ }).pipe(Effect.mapError(mapClientError)));
581
+ var EndpointExperimentalArtifactsGet = (raw) => (input) => preserveEffect()(raw["artifacts.get"]({
582
+ params: { artifactID: input["artifactID"] },
583
+ query: { location: input["location"] }
584
+ }).pipe(Effect.mapError(mapClientError)));
585
+ var EndpointExperimentalArtifactsUpdate = (raw) => (input) => preserveEffect()(raw["artifacts.update"]({
586
+ params: { artifactID: input["artifactID"] },
587
+ query: { location: input["location"] },
588
+ payload: { title: input["title"], files: input["files"], entry: input["entry"], sessionID: input["sessionID"] }
589
+ }).pipe(Effect.mapError(mapClientError)));
590
+ var EndpointExperimentalArtifactsDelete = (raw) => (input) => preserveEffect()(raw["artifacts.delete"]({
591
+ params: { artifactID: input["artifactID"] },
592
+ query: { location: input["location"] }
593
+ }).pipe(Effect.mapError(mapClientError)));
567
594
  var adaptGroupExperimental = (raw) => ({
568
595
  persistentPty: {
569
596
  read: EndpointExperimentalPersistentPtyRead(raw),
@@ -584,6 +611,14 @@ var adaptGroupExperimental = (raw) => ({
584
611
  pause: EndpointExperimentalSchedulePause(raw),
585
612
  resume: EndpointExperimentalScheduleResume(raw),
586
613
  delete: EndpointExperimentalScheduleDelete(raw)
614
+ },
615
+ artifacts: {
616
+ providers: EndpointExperimentalArtifactsProviders(raw),
617
+ list: EndpointExperimentalArtifactsList(raw),
618
+ create: EndpointExperimentalArtifactsCreate(raw),
619
+ get: EndpointExperimentalArtifactsGet(raw),
620
+ update: EndpointExperimentalArtifactsUpdate(raw),
621
+ delete: EndpointExperimentalArtifactsDelete(raw)
587
622
  }
588
623
  });
589
624
  var EndpointShellList = (raw) => (input) => preserveEffect()(raw["shell.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
@@ -788,6 +823,6 @@ var adaptClient = (raw) => {
788
823
  }
789
824
  };
790
825
  };
791
- var make4 = (options) => HttpApiClient.make(ClientApi2, options).pipe(Effect.map(adaptClient));
826
+ var make3 = (options) => HttpApiClient.make(ClientApi2, options).pipe(Effect.map(adaptClient));
792
827
 
793
- export { make4, exports_client2 };
828
+ export { make3, exports_client2 };