@opencode/client 2.1.4 → 2.2.1

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 (74) hide show
  1. package/dist/chunks/{contract-hg9t2gnm.js → mcp-0e9xp5b3.js} +6 -6
  2. package/dist/chunks/{contract-15p82y03.js → mcp-15p82y03.js} +2 -2
  3. package/dist/chunks/{contract-w10x3kfx.js → mcp-4z60zgnr.js} +245 -112
  4. package/dist/chunks/mcp-60xe5cbf.js +4 -0
  5. package/dist/chunks/mcp-6mq2wh8y.js +33 -0
  6. package/dist/chunks/{contract-vwtmm97t.js → mcp-6v8v0sqq.js} +5 -5
  7. package/dist/chunks/{contract-2ny4vxct.js → mcp-8ye1ye6f.js} +2 -2
  8. package/dist/chunks/{contract-1x65x4hv.js → mcp-csehnca4.js} +101 -56
  9. package/dist/chunks/{contract-c46qzyff.js → mcp-cvg5j6d1.js} +10 -5
  10. package/dist/chunks/{contract-8bbb028w.js → mcp-gecjxyvt.js} +5 -1
  11. package/dist/chunks/{contract-skhp7hxc.js → mcp-kdshn947.js} +1 -1
  12. package/dist/chunks/{contract-9kmsh4jj.js → mcp-qhd5h5hk.js} +2 -2
  13. package/dist/chunks/{contract-ryy6kscr.js → mcp-ryy6kscr.js} +1 -1
  14. package/dist/chunks/{contract-s2hya144.js → mcp-yn2a71yh.js} +523 -325
  15. package/dist/contract.d.ts +1 -1
  16. package/dist/contract.js +3 -1
  17. package/dist/effect/api/api.d.ts +704 -355
  18. package/dist/effect/api.d.ts +1 -0
  19. package/dist/effect/client.d.ts +439 -218
  20. package/dist/effect/client.js +8 -8
  21. package/dist/effect/generated/client-error.js +1 -1
  22. package/dist/effect/generated/client.d.ts +374 -123
  23. package/dist/effect/generated/client.js +3 -3
  24. package/dist/effect/generated/index.js +4 -4
  25. package/dist/effect/index.js +8 -8
  26. package/dist/effect/rpc.js +2 -2
  27. package/dist/effect/service.js +6 -6
  28. package/dist/promise/api.d.ts +4 -0
  29. package/dist/promise/client.d.ts +209 -133
  30. package/dist/promise/client.js +7 -7
  31. package/dist/promise/generated/client-error.js +1 -1
  32. package/dist/promise/generated/client.d.ts +245 -134
  33. package/dist/promise/generated/client.js +2 -2
  34. package/dist/promise/generated/index.js +22 -12
  35. package/dist/promise/generated/types.d.ts +1641 -3781
  36. package/dist/promise/generated/types.js +15 -5
  37. package/dist/promise/index.d.ts +1 -0
  38. package/dist/promise/index.js +24 -14
  39. package/dist/promise/rpc.js +2 -2
  40. package/dist/promise/service.d.ts +2 -2
  41. package/dist/promise/service.js +7 -6
  42. package/dist/pty-handoff.js +4 -4
  43. package/dist/rpc-runtime.js +1 -1
  44. package/dist/service-contender.js +1 -1
  45. package/dist/service-probe.js +3 -3
  46. package/dist/service-timing.js +1 -1
  47. package/dist/service-version.js +1 -1
  48. package/dist/service.js +1 -1
  49. package/dist/shared-events.d.ts +7 -2
  50. package/dist/shared-events.js +1 -1
  51. package/dist/solid/connection.js +1 -1
  52. package/dist/solid/data.d.ts +11 -1
  53. package/dist/solid/data.js +9 -9
  54. package/dist/solid/index.d.ts +1 -0
  55. package/dist/solid/index.js +16 -12
  56. package/dist/solid/pty.js +1 -1
  57. package/dist/solid/retention.d.ts +10 -0
  58. package/dist/solid/retention.js +6 -0
  59. package/dist/solid/usage.js +1 -1
  60. package/package.json +8 -7
  61. package/dist/chunks/contract-vmytr4q8.js +0 -4
  62. /package/dist/chunks/{contract-6mptkzbc.js → mcp-6mptkzbc.js} +0 -0
  63. /package/dist/chunks/{contract-8s2anffy.js → mcp-8s2anffy.js} +0 -0
  64. /package/dist/chunks/{contract-9rqn6x4v.js → mcp-9rqn6x4v.js} +0 -0
  65. /package/dist/chunks/{contract-gne7h7mq.js → mcp-gne7h7mq.js} +0 -0
  66. /package/dist/chunks/{contract-m2eywc8w.js → mcp-m2eywc8w.js} +0 -0
  67. /package/dist/chunks/{contract-nwcpakzx.js → mcp-nwcpakzx.js} +0 -0
  68. /package/dist/chunks/{contract-qav6mfdz.js → mcp-qav6mfdz.js} +0 -0
  69. /package/dist/chunks/{contract-sxt88q69.js → mcp-sxt88q69.js} +0 -0
  70. /package/dist/chunks/{contract-ve4aws36.js → mcp-ve4aws36.js} +0 -0
  71. /package/dist/chunks/{contract-vyas3vgt.js → mcp-vyas3vgt.js} +0 -0
  72. /package/dist/chunks/{contract-xgnj2w4v.js → mcp-xgnj2w4v.js} +0 -0
  73. /package/dist/chunks/{contract-y2etg5bs.js → mcp-y2etg5bs.js} +0 -0
  74. /package/dist/chunks/{contract-ydhz1zrh.js → mcp-ydhz1zrh.js} +0 -0
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  make7
3
- } from "./contract-8bbb028w.js";
3
+ } from "./mcp-gecjxyvt.js";
4
4
  import {
5
5
  make6
6
- } from "./contract-s2hya144.js";
6
+ } from "./mcp-yn2a71yh.js";
7
7
  import {
8
8
  makeRpc2
9
- } from "./contract-skhp7hxc.js";
9
+ } from "./mcp-kdshn947.js";
10
10
  import {
11
11
  __export
12
- } from "./contract-9rqn6x4v.js";
12
+ } from "./mcp-9rqn6x4v.js";
13
13
 
14
14
  // src/promise/client.ts
15
15
  var exports_client3 = {};
@@ -19,7 +19,7 @@ __export(exports_client3, {
19
19
  });
20
20
  function make5(options) {
21
21
  const raw = make6(options);
22
- const events = make7((signal, onActivity) => raw.event.subscribe({ signal, onActivity }));
22
+ const events = make7((signal, onActivity) => raw.event.subscribe(undefined, { signal, onActivity }));
23
23
  return {
24
24
  ...raw,
25
25
  rpc: Object.assign(makeRpc2(raw, events), raw.rpc),
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  defaultEnsureTiming2
3
- } from "./contract-xgnj2w4v.js";
3
+ } from "./mcp-xgnj2w4v.js";
4
4
  import {
5
5
  matchesVersion2
6
- } from "./contract-sxt88q69.js";
6
+ } from "./mcp-sxt88q69.js";
7
7
 
8
8
  // src/service-probe.ts
9
9
  import { homedir } from "node:os";
@@ -2,7 +2,7 @@ import {
2
2
  isFormNotFoundError2,
3
3
  isFormAlreadySettledError2,
4
4
  isPermissionNotFoundError2
5
- } from "./contract-c46qzyff.js";
5
+ } from "./mcp-cvg5j6d1.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;
@@ -294,6 +307,8 @@ function createData2(config) {
294
307
  message.update(sessionID, (draft, index) => message.append(draft, index, item));
295
308
  },
296
309
  editAssistant(sessionID, messageID, fn) {
310
+ if (!messageIndex.get(sessionID)?.has(messageID))
311
+ return;
297
312
  message.update(sessionID, (draft, index) => {
298
313
  const position = index.get(messageID);
299
314
  const item = position === undefined ? undefined : draft[position];
@@ -454,6 +469,10 @@ function createData2(config) {
454
469
  });
455
470
  activeUpdates = undefined;
456
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
+ });
457
476
  }).catch(() => {
458
477
  if (activeUpdates === updates)
459
478
  activeUpdates = undefined;
@@ -536,6 +555,10 @@ function createData2(config) {
536
555
  if (store.session.info[event.data.sessionID])
537
556
  setStore("session", "info", event.data.sessionID, "permissions", event.data.permissions);
538
557
  return;
558
+ case "session.metadata.updated":
559
+ if (store.session.info[event.data.sessionID])
560
+ setStore("session", "info", event.data.sessionID, "metadata", reconcile(event.data.metadata));
561
+ return;
539
562
  case "session.archived":
540
563
  if (store.session.info[event.data.sessionID])
541
564
  setStore("session", "info", event.data.sessionID, "time", "archived", event.created);
@@ -667,6 +690,8 @@ function createData2(config) {
667
690
  });
668
691
  return;
669
692
  case "session.shell.ended":
693
+ if (!store.session.message[event.data.sessionID])
694
+ return;
670
695
  message.update(event.data.sessionID, (draft) => {
671
696
  const match = message.shell(draft, event.data.shell.id);
672
697
  if (!match)
@@ -732,6 +757,8 @@ function createData2(config) {
732
757
  return;
733
758
  }
734
759
  case "session.step.failed":
760
+ if (event.location && (event.data.error.type === "provider.budget-limit" || event.data.error.type === "provider.model-budget-limit"))
761
+ refreshUsageLimits(event.location);
735
762
  message.editAssistant(event.data.sessionID, event.data.assistantMessageID, (assistant) => {
736
763
  assistant.time.completed = event.created;
737
764
  assistant.finish = event.data.finish ?? "error";
@@ -805,7 +832,7 @@ function createData2(config) {
805
832
  status: "completed",
806
833
  input: tool.state.input,
807
834
  metadata: event.data.metadata,
808
- content: [...event.data.content]
835
+ content: config.omitToolFileData ? omitFileData(event.data.content) : [...event.data.content]
809
836
  };
810
837
  tool.executed = event.data.executed || tool.executed === true;
811
838
  if (event.data.native)
@@ -822,7 +849,7 @@ function createData2(config) {
822
849
  error: event.data.error,
823
850
  input: typeof tool.state.input === "string" ? {} : tool.state.input,
824
851
  metadata: event.data.metadata,
825
- content: event.data.content
852
+ content: config.omitToolFileData && event.data.content ? omitFileData(event.data.content) : event.data.content
826
853
  };
827
854
  tool.executed = event.data.executed || tool.executed === true;
828
855
  if (event.data.native)
@@ -930,6 +957,8 @@ function createData2(config) {
930
957
  });
931
958
  return;
932
959
  case "session.compaction.delta":
960
+ if (!store.session.message[event.data.sessionID])
961
+ return;
933
962
  message.update(event.data.sessionID, (draft) => {
934
963
  const current = message.compaction(draft);
935
964
  if (current?.status === "running")
@@ -1012,27 +1041,30 @@ function createData2(config) {
1012
1041
  Object.keys(store.location).forEach((key) => {
1013
1042
  const ref = JSON.parse(key);
1014
1043
  const location = { directory: ref[0], workspaceID: ref[1] ?? undefined };
1044
+ refreshUsageLimits(location);
1015
1045
  if (event.type === "credential.updated") {
1016
- result.location.integration.invalidate(location);
1017
- refresh(() => result.location.integration.sync(location));
1046
+ refreshLocation("integration", result.location.integration, location);
1018
1047
  return;
1019
1048
  }
1020
- setStore("location", key, (data) => ({
1021
- integration: data?.integration?.map((integration) => {
1022
- if (integration.id !== event.data.integrationID)
1023
- return integration;
1024
- const active = integration.connections.find((connection) => connection.type === "credential" && connection.id === event.data.credentialID);
1025
- if (!active)
1026
- return integration;
1027
- return {
1028
- ...integration,
1029
- connections: [active, ...integration.connections.filter((connection) => connection !== active)]
1030
- };
1031
- })
1032
- }));
1049
+ if (store.location[key]?.integration)
1050
+ setStore("location", key, (data) => ({
1051
+ integration: data?.integration?.map((integration) => {
1052
+ if (integration.id !== event.data.integrationID)
1053
+ return integration;
1054
+ const active = integration.connections.find((connection) => connection.type === "credential" && connection.id === event.data.credentialID);
1055
+ if (!active)
1056
+ return integration;
1057
+ return {
1058
+ ...integration,
1059
+ connections: [active, ...integration.connections.filter((connection) => connection !== active)]
1060
+ };
1061
+ })
1062
+ }));
1063
+ const active = hasLocation("integration", location) || hasLocation("model", location) || hasLocation("provider", location);
1033
1064
  result.location.model.invalidate(location);
1034
1065
  result.location.provider.invalidate(location);
1035
- refresh(() => Promise.all([result.location.model.sync(location), result.location.provider.sync(location)]));
1066
+ if (active)
1067
+ refresh(() => Promise.all([result.location.model.sync(location), result.location.provider.sync(location)]));
1036
1068
  });
1037
1069
  return;
1038
1070
  }
@@ -1041,34 +1073,22 @@ function createData2(config) {
1041
1073
  const location = event.location;
1042
1074
  switch (event.type) {
1043
1075
  case "provider.updated":
1044
- result.location.provider.invalidate(location);
1045
- refresh(() => result.location.provider.sync(location));
1076
+ refreshLocation("provider", result.location.provider, location);
1046
1077
  break;
1047
1078
  case "model.updated":
1048
- result.location.model.invalidate(location);
1049
- refresh(() => result.location.model.sync(location));
1079
+ refreshLocation("model", result.location.model, location);
1050
1080
  break;
1051
1081
  case "agent.updated":
1052
- result.location.agent.invalidate(location);
1053
- refresh(() => result.location.agent.sync(location));
1082
+ refreshLocation("agent", result.location.agent, location);
1054
1083
  break;
1055
1084
  case "command.updated":
1056
- result.location.command.invalidate(location);
1057
- refresh(() => result.location.command.sync(location));
1085
+ refreshLocation("command", result.location.command, location);
1058
1086
  break;
1059
1087
  case "skill.updated":
1060
- result.location.skill.invalidate(location);
1061
- refresh(() => result.location.skill.sync(location));
1088
+ refreshLocation("skill", result.location.skill, location);
1062
1089
  break;
1063
1090
  case "vcs.branch.updated":
1064
- setStore("location", locationKey2(location), (data) => ({
1065
- vcs: {
1066
- branch: {
1067
- ...data?.vcs?.branch,
1068
- current: event.data.branch
1069
- }
1070
- }
1071
- }));
1091
+ refreshLocation("vcs", result.location.vcs, location);
1072
1092
  break;
1073
1093
  case "form.created":
1074
1094
  if (store.session.form[event.data.form.sessionID]?.some((form) => form.id === event.data.form.id))
@@ -1088,43 +1108,66 @@ function createData2(config) {
1088
1108
  break;
1089
1109
  case "shell.exited":
1090
1110
  case "shell.deleted":
1111
+ if (!store.location[locationKey2(location)]?.shell?.[event.data.id])
1112
+ break;
1091
1113
  setStore("location", locationKey2(location), (data) => ({
1092
1114
  shell: Object.fromEntries(Object.entries(data?.shell ?? {}).filter(([id]) => id !== event.data.id))
1093
1115
  }));
1094
1116
  break;
1095
1117
  case "reference.updated":
1096
- result.location.reference.invalidate(location);
1097
- refresh(() => result.location.reference.sync(location));
1118
+ refreshLocation("reference", result.location.reference, location);
1098
1119
  break;
1099
- case "integration.updated":
1120
+ case "integration.updated": {
1121
+ refreshUsageLimits(location);
1122
+ const active = hasLocation("integration", location) || hasLocation("model", location) || hasLocation("provider", location);
1100
1123
  result.location.integration.invalidate(location);
1101
1124
  result.location.model.invalidate(location);
1102
1125
  result.location.provider.invalidate(location);
1103
- refresh(() => Promise.all([
1104
- result.location.integration.sync(location),
1105
- result.location.model.sync(location),
1106
- result.location.provider.sync(location)
1107
- ]));
1126
+ if (active)
1127
+ refresh(() => Promise.all([
1128
+ result.location.integration.sync(location),
1129
+ result.location.model.sync(location),
1130
+ result.location.provider.sync(location)
1131
+ ]));
1108
1132
  break;
1133
+ }
1109
1134
  case "config.updated":
1110
- result.location.config.invalidate(location);
1111
- if (result.location.config.list(location) !== undefined || sync.has(`location.config:${locationKey2(location)}`))
1112
- refresh(() => result.location.config.sync(location));
1113
- refresh(() => result.location.websearch.refresh(location));
1135
+ refreshLocation("config", result.location.config, location);
1136
+ if (hasLocation("websearch", location))
1137
+ refresh(() => result.location.websearch.refresh(location));
1114
1138
  break;
1115
1139
  case "websearch.updated":
1116
- refresh(() => result.location.websearch.refresh(location));
1140
+ if (hasLocation("websearch", location))
1141
+ refresh(() => result.location.websearch.refresh(location));
1117
1142
  break;
1118
- case "mcp.status.changed":
1143
+ case "mcp.status.changed": {
1144
+ const active = hasLocation("mcpServer", location);
1119
1145
  result.location.mcp.server.invalidate(location);
1120
- settle(`mcp.status:${locationKey2(location)}`, () => result.location.mcp.server.sync(location));
1146
+ if (active)
1147
+ settle(`mcp.status:${locationKey2(location)}`, () => result.location.mcp.server.sync(location));
1121
1148
  break;
1149
+ }
1122
1150
  case "mcp.resources.changed":
1123
- result.location.mcp.resource.invalidate(location);
1124
- refresh(() => result.location.mcp.resource.sync(location));
1151
+ refreshLocation("mcpResource", result.location.mcp.resource, location);
1125
1152
  break;
1126
1153
  }
1127
1154
  }
1155
+ function hasLocation(field, ref) {
1156
+ const id = locationKey2(ref ?? defaultLocation());
1157
+ return store.location[id]?.[field] !== undefined || sync.has(`location.${field}:${id}`);
1158
+ }
1159
+ function refreshLocation(field, resource, location) {
1160
+ const active = hasLocation(field, location);
1161
+ resource.invalidate(location);
1162
+ if (active)
1163
+ refresh(() => resource.sync(location));
1164
+ }
1165
+ function refreshUsageLimits(location) {
1166
+ const loaded = store.location[locationKey2(location)]?.usageLimits !== undefined || sync.has(`location.usageLimits:${locationKey2(location)}`);
1167
+ usageLimits.invalidate(location);
1168
+ if (loaded)
1169
+ refresh(() => usageLimits.sync(location));
1170
+ }
1128
1171
  function locationResource(field, load, options) {
1129
1172
  const publish = (key, value) => setStore("location", key, { [field]: value });
1130
1173
  return {
@@ -1144,6 +1187,7 @@ function createData2(config) {
1144
1187
  };
1145
1188
  }
1146
1189
  const vcs = locationResource("vcs", (location) => api().vcs.get({ location }));
1190
+ const usageLimits = locationResource("usageLimits", (location) => api().experimental.usage.limits({ location }));
1147
1191
  const shells = locationResource("shell", async (location) => {
1148
1192
  const response = await api().shell.list({ location });
1149
1193
  const ref = { directory: response.location.directory };
@@ -1411,7 +1455,7 @@ function createData2(config) {
1411
1455
  limit: config.initialMessageLimit?.() ?? messagePageLimit,
1412
1456
  order: "desc"
1413
1457
  });
1414
- const fetched = response.data.toReversed();
1458
+ const fetched = response.data.toReversed().map(stored);
1415
1459
  const ids = new Set(fetched.map((item) => item.id));
1416
1460
  const admitted = new Set((store.session.pending[sessionID] ?? []).flatMap((item) => item.type === "user" || item.type === "synthetic" ? [item.id] : []));
1417
1461
  const local = (store.session.message[sessionID] ?? []).filter((item) => !ids.has(item.id) && (outbox.has(item.id) || admitted.has(item.id)));
@@ -1464,7 +1508,7 @@ function createData2(config) {
1464
1508
  }, { signal });
1465
1509
  if (signal?.aborted)
1466
1510
  return;
1467
- fetched.push(...response.data);
1511
+ fetched.push(...response.data.map(stored));
1468
1512
  next = response.cursor.next ?? undefined;
1469
1513
  if (!options?.all)
1470
1514
  break;
@@ -1656,6 +1700,7 @@ function createData2(config) {
1656
1700
  result.session.form.invalidate("global", location);
1657
1701
  },
1658
1702
  vcs: { info: vcs.list, sync: vcs.sync, invalidate: vcs.invalidate },
1703
+ usage: { limits: usageLimits.list, sync: usageLimits.sync, invalidate: usageLimits.invalidate },
1659
1704
  agent: locationResource("agent", (location) => api().agent.list({ location })),
1660
1705
  command: locationResource("command", (location) => api().command.list({ location })),
1661
1706
  config: locationResource("config", async (location) => ({
@@ -4,20 +4,24 @@ var isUnauthorizedError2 = (value) => typeof value === "object" && value !== nul
4
4
  var isLocationNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "LocationNotFoundError";
5
5
  var isServiceUnavailableError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ServiceUnavailableError";
6
6
  var isAgentNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "AgentNotFoundError";
7
+ var isPluginNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "PluginNotFoundError";
7
8
  var isInvalidCursorError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "InvalidCursorError";
8
9
  var isSessionNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "SessionNotFoundError";
9
- var isConflictError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ConflictError";
10
- var isUnknownError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "UnknownError";
11
10
  var isMessageNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "MessageNotFoundError";
11
+ var isConflictError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ConflictError";
12
12
  var isCommandNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "CommandNotFoundError";
13
13
  var isCommandExecutionError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "CommandExecutionError";
14
- var isSkillNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "SkillNotFoundError";
15
14
  var isSessionBusyError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "SessionBusyError";
16
- var isInstructionEntryValueTooLargeError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "InstructionEntryValueTooLargeError";
15
+ var isUnknownError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "UnknownError";
17
16
  var isFormNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "FormNotFoundError";
18
17
  var isFormInvalidAnswerError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "FormInvalidAnswerError";
19
18
  var isFormAlreadySettledError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "FormAlreadySettledError";
19
+ var isSkillNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "SkillNotFoundError";
20
+ var isInstructionEntryValueTooLargeError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "InstructionEntryValueTooLargeError";
20
21
  var isProviderNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ProviderNotFoundError";
22
+ var isModelNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ModelNotFoundError";
23
+ var isUnsupportedModelError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "UnsupportedModelError";
24
+ var isProviderRequestError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ProviderRequestError";
21
25
  var isIntegrationNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "IntegrationNotFoundError";
22
26
  var isIntegrationAttemptNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "IntegrationAttemptNotFoundError";
23
27
  var isIntegrationMethodNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "IntegrationMethodNotFoundError";
@@ -30,8 +34,9 @@ var isFileNotFoundError2 = (value) => typeof value === "object" && value !== nul
30
34
  var isRpcError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcError";
31
35
  var isRpcInternalError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "RpcInternalError";
32
36
  var isPtyNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "PtyNotFoundError";
37
+ var isScheduleNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ScheduleNotFoundError";
33
38
  var isShellNotFoundError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "ShellNotFoundError";
34
39
  var isWorktreeError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "WorktreeError";
35
40
  var isVcsInitNotSupportedError2 = (value) => typeof value === "object" && value !== null && ("_tag" in value) && value["_tag"] === "VcsInitNotSupportedError";
36
41
 
37
- export { isInvalidRequestError2, isUnauthorizedError2, isLocationNotFoundError2, isServiceUnavailableError2, isAgentNotFoundError2, isInvalidCursorError2, isSessionNotFoundError2, isConflictError2, isUnknownError2, isMessageNotFoundError2, isCommandNotFoundError2, isCommandExecutionError2, isSkillNotFoundError2, isSessionBusyError2, isInstructionEntryValueTooLargeError2, isFormNotFoundError2, isFormInvalidAnswerError2, isFormAlreadySettledError2, isProviderNotFoundError2, isIntegrationNotFoundError2, isIntegrationAttemptNotFoundError2, isIntegrationMethodNotFoundError2, isMcpServerNotFoundError2, isForbiddenError2, isProjectNotFoundError2, isPermissionSavedNotFoundError2, isPermissionNotFoundError2, isFileNotFoundError2, isRpcError2, isRpcInternalError2, isPtyNotFoundError2, isShellNotFoundError2, isWorktreeError2, isVcsInitNotSupportedError2 };
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 };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./contract-9rqn6x4v.js";
3
+ } from "./mcp-9rqn6x4v.js";
4
4
 
5
5
  // src/shared-events.ts
6
6
  var exports_shared_events = {};
@@ -56,6 +56,8 @@ function make7(connect) {
56
56
  let started = false;
57
57
  let completion;
58
58
  let connection;
59
+ const types = options?.types?.length ? new Set(options.types) : undefined;
60
+ const selected = (value) => !types || value.type === "server.connected" || types.has(value.type);
59
61
  function finish(result, discard = true) {
60
62
  completion = result;
61
63
  if (discard)
@@ -81,6 +83,8 @@ function make7(connect) {
81
83
  push(value) {
82
84
  if (completion)
83
85
  return;
86
+ if (!selected(value))
87
+ return;
84
88
  const request = pending.shift();
85
89
  if (request) {
86
90
  request.resolve({ done: false, value });
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isRpcError2,
3
3
  isRpcInternalError2
4
- } from "./contract-c46qzyff.js";
4
+ } from "./mcp-cvg5j6d1.js";
5
5
 
6
6
  // src/promise/rpc.ts
7
7
  function makeRpc2(raw, events) {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  headers2
3
- } from "./contract-2ny4vxct.js";
3
+ } from "./mcp-8ye1ye6f.js";
4
4
  import {
5
5
  __export
6
- } from "./contract-9rqn6x4v.js";
6
+ } from "./mcp-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 "./contract-9rqn6x4v.js";
3
+ } from "./mcp-9rqn6x4v.js";
4
4
 
5
5
  // src/rpc-runtime.ts
6
6
  var exports_rpc_runtime = {};