@opencode/client 0.0.0-dev-21881 → 0.0.0-dev-21903

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 (66) hide show
  1. package/dist/chunks/{pty-handoff-bpcm6er9.js → rpc-runtime-10stgdsh.js} +79 -50
  2. package/dist/chunks/{pty-handoff-s062yqxj.js → rpc-runtime-1m3dzmf1.js} +2 -2
  3. package/dist/chunks/{pty-handoff-y2etg5bs.js → rpc-runtime-7f0py9js.js} +2 -2
  4. package/dist/chunks/{pty-handoff-jq91dnkq.js → rpc-runtime-7saa3msa.js} +17 -17
  5. package/dist/chunks/{pty-handoff-8bbb028w.js → rpc-runtime-8bbb028w.js} +1 -1
  6. package/dist/chunks/{pty-handoff-2ny4vxct.js → rpc-runtime-8ye1ye6f.js} +2 -2
  7. package/dist/chunks/{pty-handoff-d4bnv4f0.js → rpc-runtime-ff0ps5x1.js} +18 -11
  8. package/dist/chunks/rpc-runtime-hjkdb2as.js +30 -0
  9. package/dist/chunks/{pty-handoff-nwcpakzx.js → rpc-runtime-js54wxgp.js} +2 -2
  10. package/dist/chunks/{pty-handoff-15p82y03.js → rpc-runtime-myz4ngx9.js} +5 -5
  11. package/dist/chunks/{pty-handoff-ryy6kscr.js → rpc-runtime-ryy6kscr.js} +1 -1
  12. package/dist/chunks/{pty-handoff-skhp7hxc.js → rpc-runtime-skhp7hxc.js} +1 -1
  13. package/dist/chunks/{pty-handoff-zp1ww9gq.js → rpc-runtime-vea8g3zs.js} +38 -20
  14. package/dist/contract.js +1 -1
  15. package/dist/effect/api/api.d.ts +19 -0
  16. package/dist/effect/client.d.ts +3 -1
  17. package/dist/effect/client.js +12 -12
  18. package/dist/effect/generated/client-error.js +3 -3
  19. package/dist/effect/generated/client.d.ts +4 -2
  20. package/dist/effect/generated/client.js +5 -5
  21. package/dist/effect/generated/index.js +8 -8
  22. package/dist/effect/index.js +12 -12
  23. package/dist/effect/rpc.js +4 -4
  24. package/dist/effect/service.js +6 -6
  25. package/dist/promise/client.d.ts +2 -0
  26. package/dist/promise/client.js +11 -11
  27. package/dist/promise/generated/client-error.js +3 -3
  28. package/dist/promise/generated/client.d.ts +3 -1
  29. package/dist/promise/generated/client.js +4 -4
  30. package/dist/promise/generated/index.js +9 -9
  31. package/dist/promise/generated/types.d.ts +23 -0
  32. package/dist/promise/generated/types.js +1 -1
  33. package/dist/promise/index.js +12 -12
  34. package/dist/promise/rpc.js +2 -2
  35. package/dist/promise/service.js +6 -6
  36. package/dist/pty-handoff.js +4 -4
  37. package/dist/rpc-runtime.js +1 -1
  38. package/dist/service-contender.js +1 -1
  39. package/dist/service-probe.js +3 -3
  40. package/dist/service-timing.js +1 -1
  41. package/dist/service-version.js +1 -1
  42. package/dist/service.js +1 -1
  43. package/dist/shared-events.js +1 -1
  44. package/dist/solid/connection.js +1 -1
  45. package/dist/solid/data.d.ts +5 -0
  46. package/dist/solid/data.js +9 -9
  47. package/dist/solid/index.js +13 -13
  48. package/dist/solid/pty.js +1 -1
  49. package/dist/solid/retention.js +1 -1
  50. package/dist/solid/usage.js +1 -1
  51. package/package.json +4 -4
  52. package/dist/chunks/pty-handoff-gb6s2y2x.js +0 -30
  53. /package/dist/chunks/{pty-handoff-6mptkzbc.js → rpc-runtime-6mptkzbc.js} +0 -0
  54. /package/dist/chunks/{pty-handoff-6mq2wh8y.js → rpc-runtime-6mq2wh8y.js} +0 -0
  55. /package/dist/chunks/{pty-handoff-8s2anffy.js → rpc-runtime-8s2anffy.js} +0 -0
  56. /package/dist/chunks/{pty-handoff-9rqn6x4v.js → rpc-runtime-9rqn6x4v.js} +0 -0
  57. /package/dist/chunks/{pty-handoff-c46qzyff.js → rpc-runtime-c46qzyff.js} +0 -0
  58. /package/dist/chunks/{pty-handoff-gne7h7mq.js → rpc-runtime-gne7h7mq.js} +0 -0
  59. /package/dist/chunks/{pty-handoff-m2eywc8w.js → rpc-runtime-m2eywc8w.js} +0 -0
  60. /package/dist/chunks/{pty-handoff-qav6mfdz.js → rpc-runtime-qav6mfdz.js} +0 -0
  61. /package/dist/chunks/{pty-handoff-sxt88q69.js → rpc-runtime-sxt88q69.js} +0 -0
  62. /package/dist/chunks/{pty-handoff-ve4aws36.js → rpc-runtime-ve4aws36.js} +0 -0
  63. /package/dist/chunks/{pty-handoff-vmytr4q8.js → rpc-runtime-vmytr4q8.js} +0 -0
  64. /package/dist/chunks/{pty-handoff-vyas3vgt.js → rpc-runtime-vyas3vgt.js} +0 -0
  65. /package/dist/chunks/{pty-handoff-xgnj2w4v.js → rpc-runtime-xgnj2w4v.js} +0 -0
  66. /package/dist/chunks/{pty-handoff-ydhz1zrh.js → rpc-runtime-ydhz1zrh.js} +0 -0
@@ -2,7 +2,7 @@ import {
2
2
  isFormNotFoundError2,
3
3
  isFormAlreadySettledError2,
4
4
  isPermissionNotFoundError2
5
- } from "./pty-handoff-c46qzyff.js";
5
+ } from "./rpc-runtime-c46qzyff.js";
6
6
 
7
7
  // src/solid/data.ts
8
8
  import { Worktree } from "@opencode/schema/worktree";
@@ -44,6 +44,18 @@ function optimisticFiles(files) {
44
44
  });
45
45
  return items?.length ? items : undefined;
46
46
  }
47
+ function omitFileData(content) {
48
+ const omit = (item) => item.type === "file" && item.uri.startsWith("data:") ? { ...item, uri: `data:${item.mime};base64,` } : item;
49
+ return [omit(content[0]), ...content.slice(1).map(omit)];
50
+ }
51
+ function omitMessageFileData(message) {
52
+ if (message.type !== "assistant")
53
+ return message;
54
+ return {
55
+ ...message,
56
+ content: message.content.map((part) => part.type === "tool" && ("content" in part.state) && part.state.content ? { ...part, state: { ...part.state, content: omitFileData(part.state.content) } } : part)
57
+ };
58
+ }
47
59
  function formRequestOptions(sessionID, ref) {
48
60
  if (sessionID !== "global" || !ref)
49
61
  return;
@@ -160,6 +172,7 @@ function createData2(config) {
160
172
  const [defaultLocation, setDefaultLocation] = createSignal({ directory: config.directory });
161
173
  const sessions = createMemo(() => Object.values(store.session.info).toSorted((a, b) => b.time.updated - a.time.updated));
162
174
  const messageIndex = new Map;
175
+ const stored = (message) => config.omitToolFileData ? omitMessageFileData(message) : message;
163
176
  const sync = createSync();
164
177
  let activeUpdates;
165
178
  const pendingUpdates = new Map;
@@ -456,6 +469,10 @@ function createData2(config) {
456
469
  });
457
470
  activeUpdates = undefined;
458
471
  setStore("session", "active", reconcile(Object.fromEntries(snapshot)));
472
+ snapshot.forEach((status, id) => {
473
+ if (status === "running" && !store.session.info[id])
474
+ refresh(() => result.session.sync(id));
475
+ });
459
476
  }).catch(() => {
460
477
  if (activeUpdates === updates)
461
478
  activeUpdates = undefined;
@@ -811,7 +828,7 @@ function createData2(config) {
811
828
  status: "completed",
812
829
  input: tool.state.input,
813
830
  metadata: event.data.metadata,
814
- content: [...event.data.content]
831
+ content: config.omitToolFileData ? omitFileData(event.data.content) : [...event.data.content]
815
832
  };
816
833
  tool.executed = event.data.executed || tool.executed === true;
817
834
  if (event.data.native)
@@ -828,7 +845,7 @@ function createData2(config) {
828
845
  error: event.data.error,
829
846
  input: typeof tool.state.input === "string" ? {} : tool.state.input,
830
847
  metadata: event.data.metadata,
831
- content: event.data.content
848
+ content: config.omitToolFileData && event.data.content ? omitFileData(event.data.content) : event.data.content
832
849
  };
833
850
  tool.executed = event.data.executed || tool.executed === true;
834
851
  if (event.data.native)
@@ -1022,26 +1039,28 @@ function createData2(config) {
1022
1039
  const location = { directory: ref[0], workspaceID: ref[1] ?? undefined };
1023
1040
  refreshUsageLimits(location);
1024
1041
  if (event.type === "credential.updated") {
1025
- result.location.integration.invalidate(location);
1026
- refresh(() => result.location.integration.sync(location));
1042
+ refreshLocation("integration", result.location.integration, location);
1027
1043
  return;
1028
1044
  }
1029
- setStore("location", key, (data) => ({
1030
- integration: data?.integration?.map((integration) => {
1031
- if (integration.id !== event.data.integrationID)
1032
- return integration;
1033
- const active = integration.connections.find((connection) => connection.type === "credential" && connection.id === event.data.credentialID);
1034
- if (!active)
1035
- return integration;
1036
- return {
1037
- ...integration,
1038
- connections: [active, ...integration.connections.filter((connection) => connection !== active)]
1039
- };
1040
- })
1041
- }));
1045
+ if (store.location[key]?.integration)
1046
+ setStore("location", key, (data) => ({
1047
+ integration: data?.integration?.map((integration) => {
1048
+ if (integration.id !== event.data.integrationID)
1049
+ return integration;
1050
+ const active = integration.connections.find((connection) => connection.type === "credential" && connection.id === event.data.credentialID);
1051
+ if (!active)
1052
+ return integration;
1053
+ return {
1054
+ ...integration,
1055
+ connections: [active, ...integration.connections.filter((connection) => connection !== active)]
1056
+ };
1057
+ })
1058
+ }));
1059
+ const active = hasLocation("integration", location) || hasLocation("model", location) || hasLocation("provider", location);
1042
1060
  result.location.model.invalidate(location);
1043
1061
  result.location.provider.invalidate(location);
1044
- refresh(() => Promise.all([result.location.model.sync(location), result.location.provider.sync(location)]));
1062
+ if (active)
1063
+ refresh(() => Promise.all([result.location.model.sync(location), result.location.provider.sync(location)]));
1045
1064
  });
1046
1065
  return;
1047
1066
  }
@@ -1050,28 +1069,22 @@ function createData2(config) {
1050
1069
  const location = event.location;
1051
1070
  switch (event.type) {
1052
1071
  case "provider.updated":
1053
- result.location.provider.invalidate(location);
1054
- refresh(() => result.location.provider.sync(location));
1072
+ refreshLocation("provider", result.location.provider, location);
1055
1073
  break;
1056
1074
  case "model.updated":
1057
- result.location.model.invalidate(location);
1058
- refresh(() => result.location.model.sync(location));
1075
+ refreshLocation("model", result.location.model, location);
1059
1076
  break;
1060
1077
  case "agent.updated":
1061
- result.location.agent.invalidate(location);
1062
- refresh(() => result.location.agent.sync(location));
1078
+ refreshLocation("agent", result.location.agent, location);
1063
1079
  break;
1064
1080
  case "command.updated":
1065
- result.location.command.invalidate(location);
1066
- refresh(() => result.location.command.sync(location));
1081
+ refreshLocation("command", result.location.command, location);
1067
1082
  break;
1068
1083
  case "skill.updated":
1069
- result.location.skill.invalidate(location);
1070
- refresh(() => result.location.skill.sync(location));
1084
+ refreshLocation("skill", result.location.skill, location);
1071
1085
  break;
1072
1086
  case "vcs.branch.updated":
1073
- result.location.vcs.invalidate(location);
1074
- refresh(() => result.location.vcs.sync(location));
1087
+ refreshLocation("vcs", result.location.vcs, location);
1075
1088
  break;
1076
1089
  case "form.created":
1077
1090
  if (store.session.form[event.data.form.sessionID]?.some((form) => form.id === event.data.form.id))
@@ -1091,44 +1104,60 @@ function createData2(config) {
1091
1104
  break;
1092
1105
  case "shell.exited":
1093
1106
  case "shell.deleted":
1107
+ if (!store.location[locationKey2(location)]?.shell?.[event.data.id])
1108
+ break;
1094
1109
  setStore("location", locationKey2(location), (data) => ({
1095
1110
  shell: Object.fromEntries(Object.entries(data?.shell ?? {}).filter(([id]) => id !== event.data.id))
1096
1111
  }));
1097
1112
  break;
1098
1113
  case "reference.updated":
1099
- result.location.reference.invalidate(location);
1100
- refresh(() => result.location.reference.sync(location));
1114
+ refreshLocation("reference", result.location.reference, location);
1101
1115
  break;
1102
- case "integration.updated":
1116
+ case "integration.updated": {
1103
1117
  refreshUsageLimits(location);
1118
+ const active = hasLocation("integration", location) || hasLocation("model", location) || hasLocation("provider", location);
1104
1119
  result.location.integration.invalidate(location);
1105
1120
  result.location.model.invalidate(location);
1106
1121
  result.location.provider.invalidate(location);
1107
- refresh(() => Promise.all([
1108
- result.location.integration.sync(location),
1109
- result.location.model.sync(location),
1110
- result.location.provider.sync(location)
1111
- ]));
1122
+ if (active)
1123
+ refresh(() => Promise.all([
1124
+ result.location.integration.sync(location),
1125
+ result.location.model.sync(location),
1126
+ result.location.provider.sync(location)
1127
+ ]));
1112
1128
  break;
1129
+ }
1113
1130
  case "config.updated":
1114
- result.location.config.invalidate(location);
1115
- if (result.location.config.list(location) !== undefined || sync.has(`location.config:${locationKey2(location)}`))
1116
- refresh(() => result.location.config.sync(location));
1117
- refresh(() => result.location.websearch.refresh(location));
1131
+ refreshLocation("config", result.location.config, location);
1132
+ if (hasLocation("websearch", location))
1133
+ refresh(() => result.location.websearch.refresh(location));
1118
1134
  break;
1119
1135
  case "websearch.updated":
1120
- refresh(() => result.location.websearch.refresh(location));
1136
+ if (hasLocation("websearch", location))
1137
+ refresh(() => result.location.websearch.refresh(location));
1121
1138
  break;
1122
- case "mcp.status.changed":
1139
+ case "mcp.status.changed": {
1140
+ const active = hasLocation("mcpServer", location);
1123
1141
  result.location.mcp.server.invalidate(location);
1124
- settle(`mcp.status:${locationKey2(location)}`, () => result.location.mcp.server.sync(location));
1142
+ if (active)
1143
+ settle(`mcp.status:${locationKey2(location)}`, () => result.location.mcp.server.sync(location));
1125
1144
  break;
1145
+ }
1126
1146
  case "mcp.resources.changed":
1127
- result.location.mcp.resource.invalidate(location);
1128
- refresh(() => result.location.mcp.resource.sync(location));
1147
+ refreshLocation("mcpResource", result.location.mcp.resource, location);
1129
1148
  break;
1130
1149
  }
1131
1150
  }
1151
+ function hasLocation(field, ref) {
1152
+ const id = locationKey2(ref ?? defaultLocation());
1153
+ return store.location[id]?.[field] !== undefined || sync.has(`location.${field}:${id}`);
1154
+ }
1155
+ function refreshLocation(field, resource, location) {
1156
+ const active = hasLocation(field, location);
1157
+ resource.invalidate(location);
1158
+ if (active)
1159
+ refresh(() => resource.sync(location));
1160
+ }
1132
1161
  function refreshUsageLimits(location) {
1133
1162
  const loaded = store.location[locationKey2(location)]?.usageLimits !== undefined || sync.has(`location.usageLimits:${locationKey2(location)}`);
1134
1163
  usageLimits.invalidate(location);
@@ -1422,7 +1451,7 @@ function createData2(config) {
1422
1451
  limit: config.initialMessageLimit?.() ?? messagePageLimit,
1423
1452
  order: "desc"
1424
1453
  });
1425
- const fetched = response.data.toReversed();
1454
+ const fetched = response.data.toReversed().map(stored);
1426
1455
  const ids = new Set(fetched.map((item) => item.id));
1427
1456
  const admitted = new Set((store.session.pending[sessionID] ?? []).flatMap((item) => item.type === "user" || item.type === "synthetic" ? [item.id] : []));
1428
1457
  const local = (store.session.message[sessionID] ?? []).filter((item) => !ids.has(item.id) && (outbox.has(item.id) || admitted.has(item.id)));
@@ -1475,7 +1504,7 @@ function createData2(config) {
1475
1504
  }, { signal });
1476
1505
  if (signal?.aborted)
1477
1506
  return;
1478
- fetched.push(...response.data);
1507
+ fetched.push(...response.data.map(stored));
1479
1508
  next = response.cursor.next ?? undefined;
1480
1509
  if (!options?.all)
1481
1510
  break;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  headers2
3
- } from "./pty-handoff-2ny4vxct.js";
3
+ } from "./rpc-runtime-8ye1ye6f.js";
4
4
  import {
5
5
  __export
6
- } from "./pty-handoff-9rqn6x4v.js";
6
+ } from "./rpc-runtime-9rqn6x4v.js";
7
7
 
8
8
  // src/pty-handoff.ts
9
9
  var exports_pty_handoff = {};
@@ -1,9 +1,9 @@
1
1
  // src/effect/generated/client-error.ts
2
2
  import { Schema } from "effect";
3
3
 
4
- class ClientError2 extends Schema.TaggedError()("ClientError", {
4
+ class ClientError3 extends Schema.TaggedError()("ClientError", {
5
5
  cause: Schema.Defect()
6
6
  }) {
7
7
  }
8
8
 
9
- export { ClientError2 };
9
+ export { ClientError3 };
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  make7
3
- } from "./pty-handoff-8bbb028w.js";
3
+ } from "./rpc-runtime-8bbb028w.js";
4
4
  import {
5
- ClientError2
6
- } from "./pty-handoff-y2etg5bs.js";
5
+ ClientError3
6
+ } from "./rpc-runtime-7f0py9js.js";
7
7
  import {
8
- make4
9
- } from "./pty-handoff-d4bnv4f0.js";
8
+ make5
9
+ } from "./rpc-runtime-ff0ps5x1.js";
10
10
  import {
11
- make3,
11
+ make6,
12
12
  aborted2
13
- } from "./pty-handoff-15p82y03.js";
13
+ } from "./rpc-runtime-myz4ngx9.js";
14
14
  import {
15
15
  __export
16
- } from "./pty-handoff-9rqn6x4v.js";
16
+ } from "./rpc-runtime-9rqn6x4v.js";
17
17
 
18
18
  // src/effect/client.ts
19
- var exports_client = {};
20
- __export(exports_client, {
21
- OpenCode: () => exports_client,
22
- make: () => make2
19
+ var exports_client3 = {};
20
+ __export(exports_client3, {
21
+ OpenCode: () => exports_client3,
22
+ make: () => make4
23
23
  });
24
24
  import { Cause, Context, Effect, Stream } from "effect";
25
25
  import { HttpClient, HttpClientRequest } from "effect/http";
@@ -28,9 +28,9 @@ var CurrentHeaders = Context.Reference("@opencode/client/effect/rpc/headers", {
28
28
  return;
29
29
  }
30
30
  });
31
- var make2 = Effect.fn("OpenCode.make")(function* (options) {
31
+ var make4 = 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* make5(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
 
@@ -41,12 +41,12 @@ var make2 = Effect.fn("OpenCode.make")(function* (options) {
41
41
  }
42
42
  }
43
43
  const shared = make7((signal) => Stream.toAsyncIterableWith(native.pipe(Stream.interruptWhen(aborted2(signal)), Stream.catchCause((cause) => Stream.fail(new EventFailure(cause)))), context));
44
- const subscribe = () => Stream.fromAsyncIterable(shared.subscribe(), (error) => error).pipe(Stream.catch((error) => Stream.failCause(error instanceof EventFailure ? error.cause : Cause.fail(new ClientError2({ cause: error })))));
44
+ const subscribe = () => Stream.fromAsyncIterable(shared.subscribe(), (error) => error).pipe(Stream.catch((error) => Stream.failCause(error instanceof EventFailure ? error.cause : Cause.fail(new ClientError3({ cause: error })))));
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(make6((input, options) => raw.rpc.call(input).pipe(Effect.provideService(CurrentHeaders, options?.headers)), subscribe), raw.rpc)
49
49
  };
50
50
  });
51
51
 
52
- export { make2, exports_client };
52
+ export { make4, exports_client3 };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./pty-handoff-9rqn6x4v.js";
3
+ } from "./rpc-runtime-9rqn6x4v.js";
4
4
 
5
5
  // src/shared-events.ts
6
6
  var exports_shared_events = {};
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  defaultEnsureTiming2
3
- } from "./pty-handoff-xgnj2w4v.js";
3
+ } from "./rpc-runtime-xgnj2w4v.js";
4
4
  import {
5
5
  matchesVersion2
6
- } from "./pty-handoff-sxt88q69.js";
6
+ } from "./rpc-runtime-sxt88q69.js";
7
7
 
8
8
  // src/service-probe.ts
9
9
  import { homedir } from "node:os";
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  ClientApi2
3
- } from "./pty-handoff-vmytr4q8.js";
3
+ } from "./rpc-runtime-vmytr4q8.js";
4
4
  import {
5
- ClientError2
6
- } from "./pty-handoff-y2etg5bs.js";
5
+ ClientError3
6
+ } from "./rpc-runtime-7f0py9js.js";
7
7
  import {
8
8
  __export
9
- } from "./pty-handoff-9rqn6x4v.js";
9
+ } from "./rpc-runtime-9rqn6x4v.js";
10
10
 
11
11
  // src/effect/generated/client.ts
12
- var exports_client2 = {};
13
- __export(exports_client2, {
14
- make: () => make4
12
+ var exports_client4 = {};
13
+ __export(exports_client4, {
14
+ make: () => make5
15
15
  });
16
16
  import { Effect, Stream, Schema } from "effect";
17
17
  import { Sse } from "effect/encoding";
18
18
  import { HttpClientError } from "effect/http";
19
19
  import { HttpApiClient } from "effect/http-api";
20
- var mapClientError = (error) => HttpClientError.isHttpClientError(error) || Schema.isSchemaError(error) || Sse.Retry.is(error) ? new ClientError2({ cause: error }) : error;
20
+ var mapClientError = (error) => HttpClientError.isHttpClientError(error) || Schema.isSchemaError(error) || Sse.Retry.is(error) ? new ClientError3({ cause: error }) : error;
21
21
  var preserveEffect = () => (effect) => effect;
22
22
  var preserveStream = () => (stream) => stream;
23
23
  var EndpointServerInfo = (raw) => () => preserveEffect()(raw["server.info"]({}).pipe(Effect.mapError(mapClientError)));
@@ -447,7 +447,14 @@ var EndpointFileList = (raw) => (input) => preserveEffect()(raw["fs.list"]({ que
447
447
  var EndpointFileFind = (raw) => (input) => preserveEffect()(raw["fs.find"]({
448
448
  query: { location: input["location"], query: input["query"], type: input["type"], limit: input["limit"] }
449
449
  }).pipe(Effect.mapError(mapClientError)));
450
- var adaptGroupFile = (raw) => ({ list: EndpointFileList(raw), find: EndpointFileFind(raw) });
450
+ var EndpointFileWatch = (raw) => (input) => preserveEffect()(raw["fs.watch"]({ query: { location: input["location"] }, payload: { path: input["path"] } }).pipe(Effect.mapError(mapClientError)));
451
+ var EndpointFileUnwatch = (raw) => (input) => preserveEffect()(raw["fs.unwatch"]({ query: { location: input["location"] }, payload: { path: input["path"] } }).pipe(Effect.mapError(mapClientError)));
452
+ var adaptGroupFile = (raw) => ({
453
+ list: EndpointFileList(raw),
454
+ find: EndpointFileFind(raw),
455
+ watch: EndpointFileWatch(raw),
456
+ unwatch: EndpointFileUnwatch(raw)
457
+ });
451
458
  var EndpointCommandList = (raw) => (input) => preserveEffect()(raw["command.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
452
459
  var adaptGroupCommand = (raw) => ({ list: EndpointCommandList(raw) });
453
460
  var EndpointSkillList = (raw) => (input) => preserveEffect()(raw["skill.list"]({ query: { location: input?.["location"] } }).pipe(Effect.mapError(mapClientError)));
@@ -651,6 +658,6 @@ var adaptClient = (raw) => ({
651
658
  usage: adaptGroupUsage(raw["server.usage"]),
652
659
  config: adaptGroupConfig(raw["server.config"])
653
660
  });
654
- var make4 = (options) => HttpApiClient.make(ClientApi2, options).pipe(Effect.map(adaptClient));
661
+ var make5 = (options) => HttpApiClient.make(ClientApi2, options).pipe(Effect.map(adaptClient));
655
662
 
656
- export { make4, exports_client2 };
663
+ export { make5, exports_client4 };
@@ -0,0 +1,30 @@
1
+ import {
2
+ make7
3
+ } from "./rpc-runtime-8bbb028w.js";
4
+ import {
5
+ make3
6
+ } from "./rpc-runtime-vea8g3zs.js";
7
+ import {
8
+ makeRpc2
9
+ } from "./rpc-runtime-skhp7hxc.js";
10
+ import {
11
+ __export
12
+ } from "./rpc-runtime-9rqn6x4v.js";
13
+
14
+ // src/promise/client.ts
15
+ var exports_client = {};
16
+ __export(exports_client, {
17
+ OpenCode: () => exports_client,
18
+ make: () => make2
19
+ });
20
+ function make2(options) {
21
+ const raw = make3(options);
22
+ const events = make7((signal, onActivity) => raw.event.subscribe({ signal, onActivity }));
23
+ return {
24
+ ...raw,
25
+ rpc: Object.assign(makeRpc2(raw, events), raw.rpc),
26
+ event: events
27
+ };
28
+ }
29
+
30
+ export { make2, exports_client };
@@ -1,5 +1,5 @@
1
1
  // src/promise/generated/client-error.ts
2
- class ClientError3 extends Error {
2
+ class ClientError2 extends Error {
3
3
  reason;
4
4
  name = "ClientError";
5
5
  constructor(reason, options) {
@@ -9,4 +9,4 @@ class ClientError3 extends Error {
9
9
  }
10
10
  }
11
11
 
12
- export { ClientError3 };
12
+ export { ClientError2 };
@@ -3,20 +3,20 @@ import {
3
3
  readError2,
4
4
  event2,
5
5
  eventType2
6
- } from "./pty-handoff-ryy6kscr.js";
6
+ } from "./rpc-runtime-ryy6kscr.js";
7
7
  import {
8
8
  __export
9
- } from "./pty-handoff-9rqn6x4v.js";
9
+ } from "./rpc-runtime-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: () => make6
17
17
  });
18
18
  import { Effect, Stream } from "effect";
19
- function make3(call, subscribe) {
19
+ function make6(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 { make6, aborted2, exports_rpc };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./pty-handoff-9rqn6x4v.js";
3
+ } from "./rpc-runtime-9rqn6x4v.js";
4
4
 
5
5
  // src/rpc-runtime.ts
6
6
  var exports_rpc_runtime = {};
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isRpcError2,
3
3
  isRpcInternalError2
4
- } from "./pty-handoff-c46qzyff.js";
4
+ } from "./rpc-runtime-c46qzyff.js";
5
5
 
6
6
  // src/promise/rpc.ts
7
7
  function makeRpc2(raw, events) {
@@ -1,17 +1,17 @@
1
1
  import {
2
- ClientError3
3
- } from "./pty-handoff-nwcpakzx.js";
2
+ ClientError2
3
+ } from "./rpc-runtime-js54wxgp.js";
4
4
  import {
5
5
  __export
6
- } from "./pty-handoff-9rqn6x4v.js";
6
+ } from "./rpc-runtime-9rqn6x4v.js";
7
7
 
8
8
  // src/promise/generated/client.ts
9
- var exports_client4 = {};
10
- __export(exports_client4, {
11
- make: () => make6
9
+ var exports_client2 = {};
10
+ __export(exports_client2, {
11
+ make: () => make3
12
12
  });
13
13
  var maxSseEventBytes = 16 * 1024 * 1024;
14
- function make6(options) {
14
+ function make3(options) {
15
15
  const fetch = options.fetch ?? globalThis.fetch;
16
16
  const prepare = (descriptor, requestOptions) => {
17
17
  const baseUrl = new URL(options.baseUrl);
@@ -44,7 +44,7 @@ function make6(options) {
44
44
  const prepared = prepare(descriptor, requestOptions);
45
45
  return await fetch(prepared.url, prepared.init);
46
46
  } catch (cause) {
47
- throw new ClientError3("Transport", { cause });
47
+ throw new ClientError2("Transport", { cause });
48
48
  }
49
49
  };
50
50
  const responseError = async (response, descriptor) => {
@@ -53,7 +53,7 @@ function make6(options) {
53
53
  try {
54
54
  await response.body?.cancel();
55
55
  } catch {}
56
- throw new ClientError3("UnexpectedStatus", { cause: { status: response.status }, detail: String(response.status) });
56
+ throw new ClientError2("UnexpectedStatus", { cause: { status: response.status }, detail: String(response.status) });
57
57
  };
58
58
  const request = async (descriptor, requestOptions) => {
59
59
  const response = await execute(descriptor, requestOptions);
@@ -78,10 +78,10 @@ function make6(options) {
78
78
  try {
79
79
  await response.body?.cancel();
80
80
  } catch {}
81
- throw new ClientError3("UnsupportedContentType", { detail: response.headers.get("content-type") });
81
+ throw new ClientError2("UnsupportedContentType", { detail: response.headers.get("content-type") });
82
82
  }
83
83
  if (response.body === null)
84
- throw new ClientError3("MalformedResponse");
84
+ throw new ClientError2("MalformedResponse");
85
85
  const reader = response.body.getReader();
86
86
  const decoder = new TextDecoder;
87
87
  let buffer = "";
@@ -91,13 +91,13 @@ function make6(options) {
91
91
  try {
92
92
  next = await reader.read();
93
93
  } catch (cause) {
94
- throw new ClientError3("Transport", { cause });
94
+ throw new ClientError2("Transport", { cause });
95
95
  }
96
96
  if (!next.done)
97
97
  requestOptions?.onActivity?.();
98
98
  buffer += decoder.decode(next.value, { stream: !next.done });
99
99
  if (buffer.length > maxSseEventBytes)
100
- throw new ClientError3("SseEventTooLarge");
100
+ throw new ClientError2("SseEventTooLarge");
101
101
  const trailingCarriageReturn = !next.done && buffer.endsWith("\r");
102
102
  if (trailingCarriageReturn)
103
103
  buffer = buffer.slice(0, -1);
@@ -124,7 +124,7 @@ function make6(options) {
124
124
  try {
125
125
  yield JSON.parse(data);
126
126
  } catch (cause) {
127
- throw new ClientError3("MalformedResponse", { cause });
127
+ throw new ClientError2("MalformedResponse", { cause });
128
128
  }
129
129
  }
130
130
  boundary = buffer.indexOf(`
@@ -177,7 +177,7 @@ function make6(options) {
177
177
  path: `/api/agent`,
178
178
  query: { location: input?.["location"] },
179
179
  successStatus: 200,
180
- declaredStatuses: [400, 401, 404],
180
+ declaredStatuses: [400, 401, 404, 503],
181
181
  empty: false
182
182
  }, requestOptions),
183
183
  get: (input, requestOptions) => request({
@@ -1044,6 +1044,24 @@ function make6(options) {
1044
1044
  declaredStatuses: [400, 401, 404],
1045
1045
  empty: false,
1046
1046
  binaryBody: true
1047
+ }, requestOptions),
1048
+ watch: (input, requestOptions) => request({
1049
+ method: "POST",
1050
+ path: `/api/experimental/fs/watch`,
1051
+ query: { location: input["location"] },
1052
+ body: { path: input["path"] },
1053
+ successStatus: 204,
1054
+ declaredStatuses: [400, 401, 404, 503],
1055
+ empty: true
1056
+ }, requestOptions),
1057
+ unwatch: (input, requestOptions) => request({
1058
+ method: "DELETE",
1059
+ path: `/api/experimental/fs/watch`,
1060
+ query: { location: input["location"] },
1061
+ body: { path: input["path"] },
1062
+ successStatus: 204,
1063
+ declaredStatuses: [400, 401, 404],
1064
+ empty: true
1047
1065
  }, requestOptions)
1048
1066
  },
1049
1067
  command: {
@@ -1497,20 +1515,20 @@ async function json(response) {
1497
1515
  try {
1498
1516
  await response.body?.cancel();
1499
1517
  } catch {}
1500
- throw new ClientError3("UnsupportedContentType", { detail: response.headers.get("content-type") });
1518
+ throw new ClientError2("UnsupportedContentType", { detail: response.headers.get("content-type") });
1501
1519
  }
1502
1520
  let text;
1503
1521
  try {
1504
1522
  text = await response.text();
1505
1523
  } catch (cause) {
1506
- throw new ClientError3("Transport", { cause });
1524
+ throw new ClientError2("Transport", { cause });
1507
1525
  }
1508
1526
  if (text === "")
1509
- throw new ClientError3("MalformedResponse");
1527
+ throw new ClientError2("MalformedResponse");
1510
1528
  try {
1511
1529
  return JSON.parse(text);
1512
1530
  } catch (cause) {
1513
- throw new ClientError3("MalformedResponse", { cause });
1531
+ throw new ClientError2("MalformedResponse", { cause });
1514
1532
  }
1515
1533
  }
1516
1534
  function declared(body) {
@@ -1523,4 +1541,4 @@ function isContentType(response, expected) {
1523
1541
  return response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() === expected;
1524
1542
  }
1525
1543
 
1526
- export { make6, exports_client4 };
1544
+ export { make3, exports_client2 };
package/dist/contract.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  effectOmitEndpoints2,
4
4
  groupNames2,
5
5
  promiseOmitEndpoints2
6
- } from "./chunks/pty-handoff-vmytr4q8.js";
6
+ } from "./chunks/rpc-runtime-vmytr4q8.js";
7
7
  export {
8
8
  ClientApi2 as ClientApi,
9
9
  effectOmitEndpoints2 as effectOmitEndpoints,