@opencode/client 0.0.0-dev-21894 → 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 (60) hide show
  1. package/dist/chunks/{service-probe-07pp8bwq.js → rpc-runtime-10stgdsh.js} +75 -50
  2. package/dist/chunks/{service-probe-1z3ffed9.js → rpc-runtime-1m3dzmf1.js} +2 -2
  3. package/dist/chunks/{service-probe-y2etg5bs.js → rpc-runtime-7f0py9js.js} +2 -2
  4. package/dist/chunks/{service-probe-k6rgyy5p.js → rpc-runtime-7saa3msa.js} +17 -17
  5. package/dist/chunks/{service-probe-8bbb028w.js → rpc-runtime-8bbb028w.js} +1 -1
  6. package/dist/chunks/{service-probe-2ny4vxct.js → rpc-runtime-8ye1ye6f.js} +2 -2
  7. package/dist/chunks/{service-probe-ncbmhvtm.js → rpc-runtime-ff0ps5x1.js} +10 -10
  8. package/dist/chunks/rpc-runtime-hjkdb2as.js +30 -0
  9. package/dist/chunks/{service-probe-nwcpakzx.js → rpc-runtime-js54wxgp.js} +2 -2
  10. package/dist/chunks/{service-probe-9j12j8xw.js → rpc-runtime-myz4ngx9.js} +5 -5
  11. package/dist/chunks/{service-probe-ryy6kscr.js → rpc-runtime-ryy6kscr.js} +1 -1
  12. package/dist/chunks/{service-probe-skhp7hxc.js → rpc-runtime-skhp7hxc.js} +1 -1
  13. package/dist/chunks/{service-probe-sfay14gz.js → rpc-runtime-vea8g3zs.js} +19 -19
  14. package/dist/contract.js +1 -1
  15. package/dist/effect/client.js +12 -12
  16. package/dist/effect/generated/client-error.js +3 -3
  17. package/dist/effect/generated/client.js +5 -5
  18. package/dist/effect/generated/index.js +8 -8
  19. package/dist/effect/index.js +12 -12
  20. package/dist/effect/rpc.js +4 -4
  21. package/dist/effect/service.js +6 -6
  22. package/dist/promise/client.js +11 -11
  23. package/dist/promise/generated/client-error.js +3 -3
  24. package/dist/promise/generated/client.js +4 -4
  25. package/dist/promise/generated/index.js +9 -9
  26. package/dist/promise/generated/types.js +1 -1
  27. package/dist/promise/index.js +12 -12
  28. package/dist/promise/rpc.js +2 -2
  29. package/dist/promise/service.js +6 -6
  30. package/dist/pty-handoff.js +4 -4
  31. package/dist/rpc-runtime.js +1 -1
  32. package/dist/service-contender.js +1 -1
  33. package/dist/service-probe.js +3 -3
  34. package/dist/service-timing.js +1 -1
  35. package/dist/service-version.js +1 -1
  36. package/dist/service.js +1 -1
  37. package/dist/shared-events.js +1 -1
  38. package/dist/solid/connection.js +1 -1
  39. package/dist/solid/data.d.ts +5 -0
  40. package/dist/solid/data.js +9 -9
  41. package/dist/solid/index.js +13 -13
  42. package/dist/solid/pty.js +1 -1
  43. package/dist/solid/retention.js +1 -1
  44. package/dist/solid/usage.js +1 -1
  45. package/package.json +4 -4
  46. package/dist/chunks/service-probe-2t8h8q18.js +0 -30
  47. /package/dist/chunks/{service-probe-6mptkzbc.js → rpc-runtime-6mptkzbc.js} +0 -0
  48. /package/dist/chunks/{service-probe-6mq2wh8y.js → rpc-runtime-6mq2wh8y.js} +0 -0
  49. /package/dist/chunks/{service-probe-8s2anffy.js → rpc-runtime-8s2anffy.js} +0 -0
  50. /package/dist/chunks/{service-probe-9rqn6x4v.js → rpc-runtime-9rqn6x4v.js} +0 -0
  51. /package/dist/chunks/{service-probe-c46qzyff.js → rpc-runtime-c46qzyff.js} +0 -0
  52. /package/dist/chunks/{service-probe-gne7h7mq.js → rpc-runtime-gne7h7mq.js} +0 -0
  53. /package/dist/chunks/{service-probe-m2eywc8w.js → rpc-runtime-m2eywc8w.js} +0 -0
  54. /package/dist/chunks/{service-probe-qav6mfdz.js → rpc-runtime-qav6mfdz.js} +0 -0
  55. /package/dist/chunks/{service-probe-sxt88q69.js → rpc-runtime-sxt88q69.js} +0 -0
  56. /package/dist/chunks/{service-probe-ve4aws36.js → rpc-runtime-ve4aws36.js} +0 -0
  57. /package/dist/chunks/{service-probe-vmytr4q8.js → rpc-runtime-vmytr4q8.js} +0 -0
  58. /package/dist/chunks/{service-probe-vyas3vgt.js → rpc-runtime-vyas3vgt.js} +0 -0
  59. /package/dist/chunks/{service-probe-xgnj2w4v.js → rpc-runtime-xgnj2w4v.js} +0 -0
  60. /package/dist/chunks/{service-probe-ydhz1zrh.js → rpc-runtime-ydhz1zrh.js} +0 -0
@@ -2,7 +2,7 @@ import {
2
2
  isFormNotFoundError2,
3
3
  isFormAlreadySettledError2,
4
4
  isPermissionNotFoundError2
5
- } from "./service-probe-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;
@@ -815,7 +828,7 @@ function createData2(config) {
815
828
  status: "completed",
816
829
  input: tool.state.input,
817
830
  metadata: event.data.metadata,
818
- content: [...event.data.content]
831
+ content: config.omitToolFileData ? omitFileData(event.data.content) : [...event.data.content]
819
832
  };
820
833
  tool.executed = event.data.executed || tool.executed === true;
821
834
  if (event.data.native)
@@ -832,7 +845,7 @@ function createData2(config) {
832
845
  error: event.data.error,
833
846
  input: typeof tool.state.input === "string" ? {} : tool.state.input,
834
847
  metadata: event.data.metadata,
835
- content: event.data.content
848
+ content: config.omitToolFileData && event.data.content ? omitFileData(event.data.content) : event.data.content
836
849
  };
837
850
  tool.executed = event.data.executed || tool.executed === true;
838
851
  if (event.data.native)
@@ -1026,26 +1039,28 @@ function createData2(config) {
1026
1039
  const location = { directory: ref[0], workspaceID: ref[1] ?? undefined };
1027
1040
  refreshUsageLimits(location);
1028
1041
  if (event.type === "credential.updated") {
1029
- result.location.integration.invalidate(location);
1030
- refresh(() => result.location.integration.sync(location));
1042
+ refreshLocation("integration", result.location.integration, location);
1031
1043
  return;
1032
1044
  }
1033
- setStore("location", key, (data) => ({
1034
- integration: data?.integration?.map((integration) => {
1035
- if (integration.id !== event.data.integrationID)
1036
- return integration;
1037
- const active = integration.connections.find((connection) => connection.type === "credential" && connection.id === event.data.credentialID);
1038
- if (!active)
1039
- return integration;
1040
- return {
1041
- ...integration,
1042
- connections: [active, ...integration.connections.filter((connection) => connection !== active)]
1043
- };
1044
- })
1045
- }));
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);
1046
1060
  result.location.model.invalidate(location);
1047
1061
  result.location.provider.invalidate(location);
1048
- 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)]));
1049
1064
  });
1050
1065
  return;
1051
1066
  }
@@ -1054,28 +1069,22 @@ function createData2(config) {
1054
1069
  const location = event.location;
1055
1070
  switch (event.type) {
1056
1071
  case "provider.updated":
1057
- result.location.provider.invalidate(location);
1058
- refresh(() => result.location.provider.sync(location));
1072
+ refreshLocation("provider", result.location.provider, location);
1059
1073
  break;
1060
1074
  case "model.updated":
1061
- result.location.model.invalidate(location);
1062
- refresh(() => result.location.model.sync(location));
1075
+ refreshLocation("model", result.location.model, location);
1063
1076
  break;
1064
1077
  case "agent.updated":
1065
- result.location.agent.invalidate(location);
1066
- refresh(() => result.location.agent.sync(location));
1078
+ refreshLocation("agent", result.location.agent, location);
1067
1079
  break;
1068
1080
  case "command.updated":
1069
- result.location.command.invalidate(location);
1070
- refresh(() => result.location.command.sync(location));
1081
+ refreshLocation("command", result.location.command, location);
1071
1082
  break;
1072
1083
  case "skill.updated":
1073
- result.location.skill.invalidate(location);
1074
- refresh(() => result.location.skill.sync(location));
1084
+ refreshLocation("skill", result.location.skill, location);
1075
1085
  break;
1076
1086
  case "vcs.branch.updated":
1077
- result.location.vcs.invalidate(location);
1078
- refresh(() => result.location.vcs.sync(location));
1087
+ refreshLocation("vcs", result.location.vcs, location);
1079
1088
  break;
1080
1089
  case "form.created":
1081
1090
  if (store.session.form[event.data.form.sessionID]?.some((form) => form.id === event.data.form.id))
@@ -1095,44 +1104,60 @@ function createData2(config) {
1095
1104
  break;
1096
1105
  case "shell.exited":
1097
1106
  case "shell.deleted":
1107
+ if (!store.location[locationKey2(location)]?.shell?.[event.data.id])
1108
+ break;
1098
1109
  setStore("location", locationKey2(location), (data) => ({
1099
1110
  shell: Object.fromEntries(Object.entries(data?.shell ?? {}).filter(([id]) => id !== event.data.id))
1100
1111
  }));
1101
1112
  break;
1102
1113
  case "reference.updated":
1103
- result.location.reference.invalidate(location);
1104
- refresh(() => result.location.reference.sync(location));
1114
+ refreshLocation("reference", result.location.reference, location);
1105
1115
  break;
1106
- case "integration.updated":
1116
+ case "integration.updated": {
1107
1117
  refreshUsageLimits(location);
1118
+ const active = hasLocation("integration", location) || hasLocation("model", location) || hasLocation("provider", location);
1108
1119
  result.location.integration.invalidate(location);
1109
1120
  result.location.model.invalidate(location);
1110
1121
  result.location.provider.invalidate(location);
1111
- refresh(() => Promise.all([
1112
- result.location.integration.sync(location),
1113
- result.location.model.sync(location),
1114
- result.location.provider.sync(location)
1115
- ]));
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
+ ]));
1116
1128
  break;
1129
+ }
1117
1130
  case "config.updated":
1118
- result.location.config.invalidate(location);
1119
- if (result.location.config.list(location) !== undefined || sync.has(`location.config:${locationKey2(location)}`))
1120
- refresh(() => result.location.config.sync(location));
1121
- 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));
1122
1134
  break;
1123
1135
  case "websearch.updated":
1124
- refresh(() => result.location.websearch.refresh(location));
1136
+ if (hasLocation("websearch", location))
1137
+ refresh(() => result.location.websearch.refresh(location));
1125
1138
  break;
1126
- case "mcp.status.changed":
1139
+ case "mcp.status.changed": {
1140
+ const active = hasLocation("mcpServer", location);
1127
1141
  result.location.mcp.server.invalidate(location);
1128
- 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));
1129
1144
  break;
1145
+ }
1130
1146
  case "mcp.resources.changed":
1131
- result.location.mcp.resource.invalidate(location);
1132
- refresh(() => result.location.mcp.resource.sync(location));
1147
+ refreshLocation("mcpResource", result.location.mcp.resource, location);
1133
1148
  break;
1134
1149
  }
1135
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
+ }
1136
1161
  function refreshUsageLimits(location) {
1137
1162
  const loaded = store.location[locationKey2(location)]?.usageLimits !== undefined || sync.has(`location.usageLimits:${locationKey2(location)}`);
1138
1163
  usageLimits.invalidate(location);
@@ -1426,7 +1451,7 @@ function createData2(config) {
1426
1451
  limit: config.initialMessageLimit?.() ?? messagePageLimit,
1427
1452
  order: "desc"
1428
1453
  });
1429
- const fetched = response.data.toReversed();
1454
+ const fetched = response.data.toReversed().map(stored);
1430
1455
  const ids = new Set(fetched.map((item) => item.id));
1431
1456
  const admitted = new Set((store.session.pending[sessionID] ?? []).flatMap((item) => item.type === "user" || item.type === "synthetic" ? [item.id] : []));
1432
1457
  const local = (store.session.message[sessionID] ?? []).filter((item) => !ids.has(item.id) && (outbox.has(item.id) || admitted.has(item.id)));
@@ -1479,7 +1504,7 @@ function createData2(config) {
1479
1504
  }, { signal });
1480
1505
  if (signal?.aborted)
1481
1506
  return;
1482
- fetched.push(...response.data);
1507
+ fetched.push(...response.data.map(stored));
1483
1508
  next = response.cursor.next ?? undefined;
1484
1509
  if (!options?.all)
1485
1510
  break;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  headers2
3
- } from "./service-probe-2ny4vxct.js";
3
+ } from "./rpc-runtime-8ye1ye6f.js";
4
4
  import {
5
5
  __export
6
- } from "./service-probe-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 "./service-probe-8bbb028w.js";
3
+ } from "./rpc-runtime-8bbb028w.js";
4
4
  import {
5
- ClientError2
6
- } from "./service-probe-y2etg5bs.js";
5
+ ClientError3
6
+ } from "./rpc-runtime-7f0py9js.js";
7
7
  import {
8
- make3
9
- } from "./service-probe-ncbmhvtm.js";
8
+ make5
9
+ } from "./rpc-runtime-ff0ps5x1.js";
10
10
  import {
11
- make4,
11
+ make6,
12
12
  aborted2
13
- } from "./service-probe-9j12j8xw.js";
13
+ } from "./rpc-runtime-myz4ngx9.js";
14
14
  import {
15
15
  __export
16
- } from "./service-probe-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* make3(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(make4((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 "./service-probe-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 "./service-probe-xgnj2w4v.js";
3
+ } from "./rpc-runtime-xgnj2w4v.js";
4
4
  import {
5
5
  matchesVersion2
6
- } from "./service-probe-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 "./service-probe-vmytr4q8.js";
3
+ } from "./rpc-runtime-vmytr4q8.js";
4
4
  import {
5
- ClientError2
6
- } from "./service-probe-y2etg5bs.js";
5
+ ClientError3
6
+ } from "./rpc-runtime-7f0py9js.js";
7
7
  import {
8
8
  __export
9
- } from "./service-probe-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: () => make3
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)));
@@ -658,6 +658,6 @@ var adaptClient = (raw) => ({
658
658
  usage: adaptGroupUsage(raw["server.usage"]),
659
659
  config: adaptGroupConfig(raw["server.config"])
660
660
  });
661
- var make3 = (options) => HttpApiClient.make(ClientApi2, options).pipe(Effect.map(adaptClient));
661
+ var make5 = (options) => HttpApiClient.make(ClientApi2, options).pipe(Effect.map(adaptClient));
662
662
 
663
- export { make3, 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 "./service-probe-ryy6kscr.js";
6
+ } from "./rpc-runtime-ryy6kscr.js";
7
7
  import {
8
8
  __export
9
- } from "./service-probe-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: () => make4
16
+ make: () => make6
17
17
  });
18
18
  import { Effect, Stream } from "effect";
19
- function make4(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 { make4, aborted2, exports_rpc };
62
+ export { make6, aborted2, exports_rpc };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./service-probe-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 "./service-probe-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 "./service-probe-nwcpakzx.js";
2
+ ClientError2
3
+ } from "./rpc-runtime-js54wxgp.js";
4
4
  import {
5
5
  __export
6
- } from "./service-probe-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(`
@@ -1515,20 +1515,20 @@ async function json(response) {
1515
1515
  try {
1516
1516
  await response.body?.cancel();
1517
1517
  } catch {}
1518
- throw new ClientError3("UnsupportedContentType", { detail: response.headers.get("content-type") });
1518
+ throw new ClientError2("UnsupportedContentType", { detail: response.headers.get("content-type") });
1519
1519
  }
1520
1520
  let text;
1521
1521
  try {
1522
1522
  text = await response.text();
1523
1523
  } catch (cause) {
1524
- throw new ClientError3("Transport", { cause });
1524
+ throw new ClientError2("Transport", { cause });
1525
1525
  }
1526
1526
  if (text === "")
1527
- throw new ClientError3("MalformedResponse");
1527
+ throw new ClientError2("MalformedResponse");
1528
1528
  try {
1529
1529
  return JSON.parse(text);
1530
1530
  } catch (cause) {
1531
- throw new ClientError3("MalformedResponse", { cause });
1531
+ throw new ClientError2("MalformedResponse", { cause });
1532
1532
  }
1533
1533
  }
1534
1534
  function declared(body) {
@@ -1541,4 +1541,4 @@ function isContentType(response, expected) {
1541
1541
  return response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() === expected;
1542
1542
  }
1543
1543
 
1544
- 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/service-probe-vmytr4q8.js";
6
+ } from "./chunks/rpc-runtime-vmytr4q8.js";
7
7
  export {
8
8
  ClientApi2 as ClientApi,
9
9
  effectOmitEndpoints2 as effectOmitEndpoints,
@@ -1,15 +1,15 @@
1
1
  import {
2
- make2,
3
- exports_client
4
- } from "../chunks/service-probe-k6rgyy5p.js";
5
- import"../chunks/service-probe-6mptkzbc.js";
6
- import"../chunks/service-probe-ncbmhvtm.js";
7
- import"../chunks/service-probe-y2etg5bs.js";
8
- import"../chunks/service-probe-9j12j8xw.js";
9
- import"../chunks/service-probe-8bbb028w.js";
10
- import"../chunks/service-probe-vmytr4q8.js";
11
- import"../chunks/service-probe-ryy6kscr.js";
2
+ make4,
3
+ exports_client3
4
+ } from "../chunks/rpc-runtime-7saa3msa.js";
5
+ import"../chunks/rpc-runtime-6mptkzbc.js";
6
+ import"../chunks/rpc-runtime-ff0ps5x1.js";
7
+ import"../chunks/rpc-runtime-7f0py9js.js";
8
+ import"../chunks/rpc-runtime-myz4ngx9.js";
9
+ import"../chunks/rpc-runtime-ryy6kscr.js";
10
+ import"../chunks/rpc-runtime-vmytr4q8.js";
11
+ import"../chunks/rpc-runtime-8bbb028w.js";
12
12
  export {
13
- exports_client as OpenCode,
14
- make2 as make
13
+ exports_client3 as OpenCode,
14
+ make4 as make
15
15
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
- ClientError2
3
- } from "../../chunks/service-probe-y2etg5bs.js";
2
+ ClientError3
3
+ } from "../../chunks/rpc-runtime-7f0py9js.js";
4
4
  export {
5
- ClientError2 as ClientError
5
+ ClientError3 as ClientError
6
6
  };
@@ -1,8 +1,8 @@
1
1
  import {
2
- make3
3
- } from "../../chunks/service-probe-ncbmhvtm.js";
4
- import"../../chunks/service-probe-y2etg5bs.js";
5
- import"../../chunks/service-probe-vmytr4q8.js";
2
+ make5
3
+ } from "../../chunks/rpc-runtime-ff0ps5x1.js";
4
+ import"../../chunks/rpc-runtime-7f0py9js.js";
5
+ import"../../chunks/rpc-runtime-vmytr4q8.js";
6
6
  export {
7
- make3 as make
7
+ make5 as make
8
8
  };