devframe 1.3.1 → 1.3.2

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 (153) hide show
  1. package/dist/{_shared-C61zPwIz.mjs → _shared-BGb9aDxr.mjs} +6 -9
  2. package/dist/{_shared-Cm4iD0L3.d.mts → _shared-CnKu5myY.d.mts} +2 -4
  3. package/dist/adapters/build.d.mts +3 -5
  4. package/dist/adapters/build.mjs +7 -8
  5. package/dist/adapters/cac.d.mts +1 -3
  6. package/dist/adapters/cac.mjs +5 -7
  7. package/dist/adapters/dev.d.mts +6 -8
  8. package/dist/adapters/dev.mjs +2 -2
  9. package/dist/adapters/embedded.d.mts +2 -4
  10. package/dist/adapters/embedded.mjs +1 -2
  11. package/dist/adapters/initiate.d.mts +9 -9
  12. package/dist/adapters/initiate.mjs +1 -2
  13. package/dist/adapters/mcp.d.mts +2 -2
  14. package/dist/adapters/mcp.mjs +1 -2
  15. package/dist/{agentic-C6SCkdtj.d.mts → agentic-CCstJ5yv.d.mts} +1 -3
  16. package/dist/{browser-agent-Pu-FLk6I.mjs → browser-agent-DmAotroz.mjs} +1 -2
  17. package/dist/{browser-agent-rpc-KH4HHvHf.mjs → browser-agent-rpc-CS80Sphv.mjs} +3 -5
  18. package/dist/cli/main.d.mts +1 -3
  19. package/dist/cli/main.mjs +3 -4
  20. package/dist/client/index.d.mts +6 -30
  21. package/dist/client/index.mjs +47 -72
  22. package/dist/{client-agent-iBkMYxqn.mjs → client-agent-qNMgDUev.mjs} +7 -12
  23. package/dist/constants.d.mts +1 -5
  24. package/dist/constants.mjs +2 -3
  25. package/dist/{context-D_jSSdME.mjs → context-BTxC4QrJ.mjs} +4 -5
  26. package/dist/{context-CAJ5V017.mjs → context-C5FcbWQi.mjs} +25 -41
  27. package/dist/{context-BGJi0ITA.d.mts → context-CsdPs3po.d.mts} +1 -3
  28. package/dist/{context-BNxFOPbX.d.mts → context-WxTq6kqb.d.mts} +7 -41
  29. package/dist/{crypto-token-TVbGGFuj.mjs → crypto-token-CUhPE_ei.mjs} +1 -2
  30. package/dist/{define-BLWPsH6y.mjs → define-C8h-fyD3.mjs} +1 -2
  31. package/dist/{dev-BKBjIpX3.mjs → dev-DaHYh5YK.mjs} +9 -11
  32. package/dist/{diagnostics-E_PvUPsA.mjs → diagnostics-DC1-WcvN.mjs} +2 -3
  33. package/dist/{dist-CO98PBnQ.mjs → dist-BWGpvt-z.mjs} +1 -2
  34. package/dist/{dist-CZXfGEkd.mjs → dist-DJydMELP.mjs} +3 -10
  35. package/dist/{events-0wDwalmL.mjs → events-qWCKwD8-.mjs} +1 -2
  36. package/dist/{handler-DmaAfpGq.mjs → handler-DkLlj3-B.mjs} +3 -5
  37. package/dist/{hash-DdPnc4k3.mjs → hash-DHqpWeMO.mjs} +4 -8
  38. package/dist/{host-h3-BROI6SQ4.mjs → host-h3-D1uj5EM8.mjs} +1 -2
  39. package/dist/{import-runtime-module-BzlEQ9PI.mjs → import-runtime-module-DsdqJ1gK.mjs} +2 -3
  40. package/dist/in-page-channel/index.d.mts +2 -12
  41. package/dist/in-page-channel/index.mjs +10 -16
  42. package/dist/{index-CeEtxDmK.d.mts → index-BIRF0E5l.d.mts} +0 -2
  43. package/dist/{index-Bia1vKjL.d.mts → index-BKu9BxcT.d.mts} +0 -2
  44. package/dist/{index-DuEm0sDH.d.mts → index-D0qrBkhO.d.mts} +1 -15
  45. package/dist/{index-CxJatyA1.d.mts → index-HMJPlexc.d.mts} +2 -6
  46. package/dist/index.d.mts +6 -8
  47. package/dist/index.mjs +3 -4
  48. package/dist/{instance-registry-C_4PpB6N.mjs → instance-registry-CmZfF5u3.mjs} +4 -10
  49. package/dist/{instance-shell-GihbmXoF.d.mts → instance-shell-Bujp0BhE.d.mts} +5 -9
  50. package/dist/{instance-shell-m4sY2oTG.mjs → instance-shell-Dk2SejFT.mjs} +38 -17
  51. package/dist/{interactive-auth-DdDxs3WF.mjs → interactive-auth-BURwIAvE.mjs} +6 -8
  52. package/dist/internal/index.d.mts +9 -29
  53. package/dist/internal/index.mjs +13 -15
  54. package/dist/{mcp-content-QImBQO8e.d.mts → mcp-content-CQQBt2An.d.mts} +1 -3
  55. package/dist/{mcp-content-DN3O212x.mjs → mcp-content-CqU8yaF7.mjs} +1 -2
  56. package/dist/{mrmime-40h5OOIp.mjs → mrmime-y_XyiVcd.mjs} +1 -2
  57. package/dist/node/auth.d.mts +2 -2
  58. package/dist/node/auth.mjs +2 -2
  59. package/dist/node/hub-internals.d.mts +2 -2
  60. package/dist/node/hub-internals.mjs +2 -2
  61. package/dist/node/index.d.mts +2 -6
  62. package/dist/node/index.mjs +2 -2
  63. package/dist/{nostics-DWvukRwa.d.mts → nostics-Dgwh7ytT.d.mts} +0 -2
  64. package/dist/{nostics-D0PvLZsn.mjs → nostics-InlX4tmd.mjs} +2 -4
  65. package/dist/{origin-DZit9g29.mjs → origin-Ck7mLbKU.mjs} +1 -2
  66. package/dist/{origin-CY6BBHOy.d.mts → origin-D5i7K_Zb.d.mts} +0 -2
  67. package/dist/recipes/interactive-auth.d.mts +3 -5
  68. package/dist/recipes/interactive-auth.mjs +1 -2
  69. package/dist/{remote-assets-eBvSKZMS.d.mts → remote-assets-5AQMHZnV.d.mts} +0 -2
  70. package/dist/{remote-assets-B-n83kUY.mjs → remote-assets-DhonNeo_.mjs} +5 -8
  71. package/dist/{revoke-CeQUo6KI.mjs → revoke-D6KA3vwr.mjs} +2 -3
  72. package/dist/{rolldown-runtime-B4iAMlE-.mjs → rolldown-runtime-DYf_mQCB.mjs} +2 -3
  73. package/dist/rpc/client.d.mts +2 -4
  74. package/dist/rpc/client.mjs +2 -3
  75. package/dist/rpc/dump.d.mts +3 -11
  76. package/dist/rpc/dump.mjs +1 -2
  77. package/dist/rpc/index.d.mts +3 -3
  78. package/dist/rpc/index.mjs +6 -8
  79. package/dist/rpc/server.d.mts +2 -4
  80. package/dist/rpc/server.mjs +2 -3
  81. package/dist/rpc/transports/sse-client.d.mts +1 -1
  82. package/dist/rpc/transports/sse-client.mjs +2 -3
  83. package/dist/rpc/transports/sse-server.d.mts +5 -7
  84. package/dist/rpc/transports/sse-server.mjs +4 -5
  85. package/dist/rpc/transports/ws-bun.d.mts +3 -5
  86. package/dist/rpc/transports/ws-bun.mjs +2 -3
  87. package/dist/rpc/transports/ws-client.d.mts +1 -1
  88. package/dist/rpc/transports/ws-client.mjs +2 -3
  89. package/dist/rpc/transports/ws-deno.d.mts +3 -5
  90. package/dist/rpc/transports/ws-deno.mjs +2 -3
  91. package/dist/rpc/transports/ws-server.d.mts +3 -3
  92. package/dist/rpc/transports/ws-server.mjs +5 -6
  93. package/dist/{rpc-core-BLc5hm9X.mjs → rpc-core-CDUizUQB.mjs} +4 -5
  94. package/dist/{rpc-core-CGTCla-R.d.mts → rpc-core-CFwyV10r.d.mts} +5 -7
  95. package/dist/{serialization-BhuOoL80.mjs → serialization-iiTQ7n21.mjs} +3 -5
  96. package/dist/{services-install-D5YUwFXW.mjs → services-install-DCuDzMJ-.mjs} +1 -2
  97. package/dist/{session-DPfj6zQG.mjs → session-BjvoLH3r.mjs} +1 -2
  98. package/dist/{session-r6PDixP6.d.mts → session-Y9R6tqg4.d.mts} +0 -2
  99. package/dist/{shared-state-Cc-Jrhma.mjs → shared-state-COV7NCbd.mjs} +4 -6
  100. package/dist/{sse-client-DNdscfu_.d.mts → sse-client-B2PrSz-H.d.mts} +2 -4
  101. package/dist/{state-W4wI6X5X.mjs → state-B_yjfeqo.mjs} +3 -5
  102. package/dist/{storage-CWI9PZ-5.mjs → storage-DpJ52UB_.mjs} +3 -5
  103. package/dist/{structured-clone-CbAV5rFI.mjs → structured-clone-B1N_XQvA.mjs} +2 -4
  104. package/dist/{structured-clone-CgtQ61SA.mjs → structured-clone-D1dOCZvc.mjs} +2 -4
  105. package/dist/{tool-input-CES3Pc4y.mjs → tool-input-CcCgJ8jq.mjs} +6 -12
  106. package/dist/types/index.d.mts +5 -5
  107. package/dist/{types-BmDbfHCx.d.mts → types-844OBepb.d.mts} +1 -5
  108. package/dist/utils/agent-tool-name.d.mts +1 -3
  109. package/dist/utils/agent-tool-name.mjs +1 -2
  110. package/dist/utils/colors.d.mts +1 -3
  111. package/dist/utils/colors.mjs +1 -2
  112. package/dist/utils/crypto-token.d.mts +1 -3
  113. package/dist/utils/crypto-token.mjs +1 -2
  114. package/dist/utils/debounce.d.mts +0 -2
  115. package/dist/utils/debounce.mjs +1 -2
  116. package/dist/utils/events.d.mts +2 -4
  117. package/dist/utils/events.mjs +1 -2
  118. package/dist/utils/get-port.d.mts +0 -2
  119. package/dist/utils/get-port.mjs +1 -2
  120. package/dist/utils/hash.d.mts +1 -3
  121. package/dist/utils/hash.mjs +1 -2
  122. package/dist/utils/launch-editor.d.mts +1 -3
  123. package/dist/utils/launch-editor.mjs +25 -37
  124. package/dist/utils/nanoid.d.mts +1 -3
  125. package/dist/utils/nanoid.mjs +1 -2
  126. package/dist/utils/nostics.d.mts +1 -1
  127. package/dist/utils/nostics.mjs +1 -2
  128. package/dist/utils/open.d.mts +1 -3
  129. package/dist/utils/open.mjs +1 -2
  130. package/dist/utils/origin.d.mts +1 -1
  131. package/dist/utils/origin.mjs +1 -2
  132. package/dist/utils/remote-assets.d.mts +2 -4
  133. package/dist/utils/remote-assets.mjs +1 -2
  134. package/dist/utils/serve-static.d.mts +2 -4
  135. package/dist/utils/serve-static.mjs +3 -4
  136. package/dist/utils/shared-state.d.mts +1 -1
  137. package/dist/utils/shared-state.mjs +1 -2
  138. package/dist/utils/simple-schema.d.mts +1 -3
  139. package/dist/utils/simple-schema.mjs +1 -2
  140. package/dist/utils/streaming-channel.d.mts +1 -1
  141. package/dist/utils/streaming-channel.mjs +1 -2
  142. package/dist/utils/structured-clone.d.mts +1 -3
  143. package/dist/utils/structured-clone.mjs +1 -2
  144. package/dist/utils/url.d.mts +1 -3
  145. package/dist/utils/url.mjs +1 -2
  146. package/dist/utils/when.d.mts +1 -3
  147. package/dist/utils/when.mjs +2 -4
  148. package/dist/{validation-CMfDAti3.mjs → validation-Cjy1P58H.mjs} +7 -13
  149. package/dist/{wire-codec-B1W3zH3L.mjs → wire-codec-BdngvzfH.mjs} +3 -4
  150. package/dist/{write-DK7rBUN3.mjs → write-3miSvPaD.mjs} +10 -16
  151. package/dist/{ws-client-6Mrz6eC4.d.mts → ws-client-lqOeANcn.d.mts} +2 -4
  152. package/dist/{ws-server-y2R76aSW.d.mts → ws-server-CYHkeyA-.d.mts} +3 -5
  153. package/package.json +8 -8
@@ -1,12 +1,13 @@
1
- import { a as defineDiagnostics, i as createBirpc, n as argsToJsonSchema, o as DEVFRAME_EVENTS, r as resolveAgentSafety, t as toolInputToRpcArgs } from "../tool-input-CES3Pc4y.mjs";
2
- import { t as hash } from "../hash-DdPnc4k3.mjs";
1
+ import { a as defineDiagnostics, i as createBirpc, n as argsToJsonSchema, o as DEVFRAME_EVENTS, r as resolveAgentSafety, t as toolInputToRpcArgs } from "../tool-input-CcCgJ8jq.mjs";
2
+ import { t as hash } from "../hash-DHqpWeMO.mjs";
3
3
  import { createEventEmitter } from "../utils/events.mjs";
4
4
  import { withBase, withProtocol } from "../utils/url.mjs";
5
- import { t as createSharedState } from "../shared-state-Cc-Jrhma.mjs";
6
- import { i as structuredCloneStringify, n as structuredCloneParse, t as structuredCloneDeserialize } from "../structured-clone-CgtQ61SA.mjs";
5
+ import { nanoid } from "../utils/nanoid.mjs";
6
+ import { t as createSharedState } from "../shared-state-COV7NCbd.mjs";
7
+ import { i as structuredCloneStringify, n as structuredCloneParse, t as structuredCloneDeserialize } from "../structured-clone-D1dOCZvc.mjs";
7
8
  import { createStreamReader, createStreamSink } from "../utils/streaming-channel.mjs";
8
9
  import { toAgentToolName } from "../utils/agent-tool-name.mjs";
9
- //#region src/constants.ts
10
+ // src/constants.ts
10
11
  /** Devframe runtime routes and static output conventions. */
11
12
  const DEVFRAME_CONNECTION_META_FILENAME = "__connection.json";
12
13
  /**
@@ -53,8 +54,7 @@ const DEVFRAME_VIEWER_ORIGIN_QUERY_PARAM = "devframe_viewer_origin";
53
54
  /** Token that authorizes an external viewer origin registration. */
54
55
  const DEVFRAME_VIEWER_ORIGIN_TOKEN_QUERY_PARAM = "devframe_viewer_origin_token";
55
56
  DEVFRAME_EVENTS.postMessage.remoteAssetsError;
56
- //#endregion
57
- //#region src/rpc/cache.ts
57
+ // src/rpc/cache.ts
58
58
  /**
59
59
  * @experimental API is expected to change.
60
60
  */
@@ -92,8 +92,7 @@ var RpcCacheManager = class {
92
92
  else this.cacheMap.clear();
93
93
  }
94
94
  };
95
- //#endregion
96
- //#region src/rpc/diagnostics.ts
95
+ // src/rpc/diagnostics.ts
97
96
  const diagnostics = defineDiagnostics({
98
97
  docsBase: "https://devfra.me/errors",
99
98
  codes: {
@@ -129,8 +128,7 @@ const diagnostics = defineDiagnostics({
129
128
  }
130
129
  }
131
130
  });
132
- //#endregion
133
- //#region src/rpc/agent-json-serialization.ts
131
+ // src/rpc/agent-json-serialization.ts
134
132
  /**
135
133
  * Prevents using a coding-agent-exposed RPC function that is explicitly
136
134
  * marked as non-serializable, and marks these functions as serializable by
@@ -142,8 +140,7 @@ function ensureAgentJsonSerializable(fnDef) {
142
140
  if (fnDef.agent && fnDef.jsonSerializable === false) throw diagnostics.DF0019({ name: fnDef.name });
143
141
  if (fnDef.agent && !fnDef.jsonSerializable) fnDef.jsonSerializable = true;
144
142
  }
145
- //#endregion
146
- //#region src/rpc/validate-io.ts
143
+ // src/rpc/validate-io.ts
147
144
  /**
148
145
  * Run a single [Standard Schema](https://standardschema.dev) validator,
149
146
  * awaiting the result when the validator is asynchronous.
@@ -206,8 +203,7 @@ async function validateRpcReturn(name, returnSchema, value) {
206
203
  });
207
204
  return value;
208
205
  }
209
- //#endregion
210
- //#region src/rpc/handler.ts
206
+ // src/rpc/handler.ts
211
207
  async function getRpcResolvedSetupResult(definition, context) {
212
208
  if (!definition.setup) return {};
213
209
  if (typeof context === "object" && context !== null) {
@@ -250,8 +246,7 @@ async function getRpcHandler(definition, context) {
250
246
  };
251
247
  return validating;
252
248
  }
253
- //#endregion
254
- //#region src/rpc/collector.ts
249
+ // src/rpc/collector.ts
255
250
  var RpcFunctionsCollectorBase = class {
256
251
  context;
257
252
  definitions = /* @__PURE__ */ new Map();
@@ -322,8 +317,7 @@ var RpcFunctionsCollectorBase = class {
322
317
  return Array.from(this.definitions.keys());
323
318
  }
324
319
  };
325
- //#endregion
326
- //#region src/rpc/serialization.ts
320
+ // src/rpc/serialization.ts
327
321
  /**
328
322
  * `JSON.stringify` with a single-pass strict replacer.
329
323
  *
@@ -381,8 +375,7 @@ function formatPath(parent, key) {
381
375
  if (key === "") return "<root>";
382
376
  return key;
383
377
  }
384
- //#endregion
385
- //#region src/client/connection-storage.ts
378
+ // src/client/connection-storage.ts
386
379
  const CONNECTION_META_KEY = "__DEVFRAME_CONNECTION_META__";
387
380
  const CONNECTION_AUTH_TOKEN_KEY = "__DEVFRAME_CONNECTION_AUTH_TOKEN__";
388
381
  function readFromWindows(key) {
@@ -434,8 +427,7 @@ function storeAuthToken(token) {
434
427
  authToken: token
435
428
  };
436
429
  }
437
- //#endregion
438
- //#region src/client/connection.ts
430
+ // src/client/connection.ts
439
431
  /**
440
432
  * Allow an external viewer to connect by registering its browser origin with
441
433
  * the Devframe host. Returns `false` if the host did not provide an origin
@@ -560,8 +552,7 @@ var DevframeConnectionError = class extends Error {
560
552
  function isCallableStatus(status) {
561
553
  return status === "connected" || status === "connecting";
562
554
  }
563
- //#endregion
564
- //#region src/client/otp.ts
555
+ // src/client/otp.ts
565
556
  /**
566
557
  * Read a one-time authentication code (OTP) from the current page URL's
567
558
  * fragment, without side effects. Returns `undefined` when the parameter is
@@ -612,8 +603,7 @@ async function authenticateWithUrlOtp(rpc, options = {}) {
612
603
  if (rpc.isTrusted) return true;
613
604
  return rpc.requestTrustWithCode(code);
614
605
  }
615
- //#endregion
616
- //#region src/client/rpc-services.ts
606
+ // src/client/rpc-services.ts
617
607
  /** @internal */
618
608
  function createDevframeServicesClient(rpc) {
619
609
  let current = {};
@@ -649,8 +639,7 @@ function createDevframeServicesClient(rpc) {
649
639
  }
650
640
  };
651
641
  }
652
- //#endregion
653
- //#region src/client/rpc-shared-state.ts
642
+ // src/client/rpc-shared-state.ts
654
643
  function createRpcSharedStateClientHost(rpc) {
655
644
  const sharedState = /* @__PURE__ */ new Map();
656
645
  const stateDisposers = /* @__PURE__ */ new Map();
@@ -683,10 +672,10 @@ function createRpcSharedStateClientHost(rpc) {
683
672
  state.patch(patches, syncId);
684
673
  }
685
674
  });
686
- function registerSharedState(key, state) {
675
+ function registerSharedState(key, state, initialSyncId) {
687
676
  const offs = [];
688
677
  offs.push(state.on("updated", (fullState, patches, syncId) => {
689
- if (isStaticBackend) return;
678
+ if (isStaticBackend || syncId === initialSyncId) return;
690
679
  if (patches) rpc.callEvent("devframe:rpc:server-state:patch", key, patches, syncId);
691
680
  else rpc.callEvent("devframe:rpc:server-state:set", key, fullState, syncId);
692
681
  }));
@@ -722,12 +711,17 @@ function createRpcSharedStateClientHost(rpc) {
722
711
  if (options?.initialValue !== void 0) {
723
712
  sharedState.set(key, state);
724
713
  for (const fn of keyAddedListeners) fn(key);
714
+ let stateUpdated = false;
715
+ const stopTrackingUpdates = state.on("updated", () => {
716
+ stateUpdated = true;
717
+ });
718
+ const initialSyncId = nanoid();
725
719
  rpc.call("devframe:rpc:server-state:get", key).then((serverState) => {
726
- if (serverState !== void 0) state.mutate(() => mergeWithInitialValue(key, serverState));
720
+ if (serverState !== void 0 && sharedState.get(key) === state && !stateUpdated) state.mutate(() => mergeWithInitialValue(key, serverState), initialSyncId);
727
721
  }).catch((error) => {
728
722
  console.error("Error getting server state", error);
729
- });
730
- stateDisposers.set(key, registerSharedState(key, state));
723
+ }).finally(stopTrackingUpdates);
724
+ stateDisposers.set(key, registerSharedState(key, state, initialSyncId));
731
725
  return state;
732
726
  } else {
733
727
  const serverValue = await rpc.call("devframe:rpc:server-state:get", key);
@@ -753,8 +747,7 @@ function createRpcSharedStateClientHost(rpc) {
753
747
  }
754
748
  };
755
749
  }
756
- //#endregion
757
- //#region src/rpc/wire-codec.ts
750
+ // src/rpc/wire-codec.ts
758
751
  const EMPTY_WIRE_DEFS = /* @__PURE__ */ new Map();
759
752
  /**
760
753
  * Build the per-connection wire codec every live transport (WS server, WS
@@ -787,8 +780,7 @@ function createRpcWireCodec(definitions = EMPTY_WIRE_DEFS) {
787
780
  }
788
781
  };
789
782
  }
790
- //#endregion
791
- //#region src/rpc/transports/sse-client.ts
783
+ // src/rpc/transports/sse-client.ts
792
784
  function NOOP$1() {}
793
785
  /** Split the next complete SSE frame (up to a blank line) off the buffer. */
794
786
  function takeFrame(buffer) {
@@ -942,8 +934,7 @@ function createSseRpcChannel(options) {
942
934
  deserialize: codec.deserialize
943
935
  };
944
936
  }
945
- //#endregion
946
- //#region src/rpc/client.ts
937
+ // src/rpc/client.ts
947
938
  function createRpcClient(functions, options) {
948
939
  const { channel, rpcOptions = {} } = options;
949
940
  return createBirpc(functions, {
@@ -953,8 +944,7 @@ function createRpcClient(functions, options) {
953
944
  proxify: false
954
945
  });
955
946
  }
956
- //#endregion
957
- //#region src/client/rpc-live.ts
947
+ // src/client/rpc-live.ts
958
948
  /**
959
949
  * The transport-independent half of a live RPC client mode (connection
960
950
  * status, pending-call guarding, and the trust handshake), shared by the
@@ -1162,8 +1152,7 @@ function createLiveRpcClientMode(options) {
1162
1152
  }
1163
1153
  };
1164
1154
  }
1165
- //#endregion
1166
- //#region src/client/rpc-sse.ts
1155
+ // src/client/rpc-sse.ts
1167
1156
  /**
1168
1157
  * Resolve a {@link ConnectionMeta.sse} descriptor into a concrete
1169
1158
  * `http(s)://` URL, with the same proxy-safe rules as `resolveWsUrl`: the
@@ -1227,8 +1216,7 @@ function createSseRpcClientMode(options) {
1227
1216
  })
1228
1217
  });
1229
1218
  }
1230
- //#endregion
1231
- //#region src/rpc/dump/error.ts
1219
+ // src/rpc/dump/error.ts
1232
1220
  /**
1233
1221
  * Inverse of {@link serializeDumpError}: rebuild a thrown `Error` from
1234
1222
  * the plain object stored in a dump record. Preserves `cause`, restores
@@ -1245,8 +1233,7 @@ function reviveDumpError(stored) {
1245
1233
  function isPlainErrorShape(value) {
1246
1234
  return typeof value === "object" && value !== null && typeof value.message === "string" && typeof value.name === "string";
1247
1235
  }
1248
- //#endregion
1249
- //#region src/client/static-rpc.ts
1236
+ // src/client/static-rpc.ts
1250
1237
  function isStaticEntry(value) {
1251
1238
  return typeof value === "object" && value !== null && value.type === "static" && typeof value.path === "string";
1252
1239
  }
@@ -1313,8 +1300,7 @@ function createStaticRpcCaller(manifest, fetchJson) {
1313
1300
  callEvent: async (_functionName, _args) => {}
1314
1301
  };
1315
1302
  }
1316
- //#endregion
1317
- //#region src/client/rpc-static.ts
1303
+ // src/client/rpc-static.ts
1318
1304
  async function createStaticRpcClientMode(options) {
1319
1305
  const staticCaller = createStaticRpcCaller(await options.fetchJsonFromBases(DEVFRAME_RPC_DUMP_MANIFEST_FILENAME), options.fetchJsonFromBases);
1320
1306
  return {
@@ -1340,8 +1326,7 @@ async function createStaticRpcClientMode(options) {
1340
1326
  close: () => {}
1341
1327
  };
1342
1328
  }
1343
- //#endregion
1344
- //#region src/client/rpc-streaming.ts
1329
+ // src/client/rpc-streaming.ts
1345
1330
  const STREAM_KEY_SEPARATOR = "";
1346
1331
  function streamKey(channel, id) {
1347
1332
  return `${channel}${STREAM_KEY_SEPARATOR}${id}`;
@@ -1441,8 +1426,7 @@ function createRpcStreamingClientHost(rpc) {
1441
1426
  upload
1442
1427
  };
1443
1428
  }
1444
- //#endregion
1445
- //#region src/rpc/transports/ws-client.ts
1429
+ // src/rpc/transports/ws-client.ts
1446
1430
  function NOOP() {}
1447
1431
  const EMPTY_DEFS = /* @__PURE__ */ new Map();
1448
1432
  /**
@@ -1502,8 +1486,7 @@ function createWsRpcChannel(options) {
1502
1486
  deserialize: codec.deserialize
1503
1487
  };
1504
1488
  }
1505
- //#endregion
1506
- //#region src/client/rpc-ws.ts
1489
+ // src/client/rpc-ws.ts
1507
1490
  /**
1508
1491
  * Resolve a {@link ConnectionMeta.websocket} descriptor into a concrete
1509
1492
  * `ws(s)://` URL.
@@ -1574,8 +1557,7 @@ function createWsRpcClientMode(options) {
1574
1557
  })
1575
1558
  });
1576
1559
  }
1577
- //#endregion
1578
- //#region src/utils/scope.ts
1560
+ // src/utils/scope.ts
1579
1561
  /** Whether a name is already namespaced (contains a `:` separator). */
1580
1562
  function isQualifiedName(name) {
1581
1563
  return name.includes(":");
@@ -1588,8 +1570,7 @@ function isQualifiedName(name) {
1588
1570
  function qualifyName(namespace, name) {
1589
1571
  return isQualifiedName(name) ? name : `${namespace}:${name}`;
1590
1572
  }
1591
- //#endregion
1592
- //#region src/settings-store.ts
1573
+ // src/settings-store.ts
1593
1574
  /**
1594
1575
  * The key-value store surface over a lazily-resolved shared state, shared by
1595
1576
  * the node-side (file-backed) and client-side (RPC-mirrored) settings stores.
@@ -1620,8 +1601,7 @@ function createSettingsStore(store) {
1620
1601
  }
1621
1602
  };
1622
1603
  }
1623
- //#endregion
1624
- //#region src/client/settings.ts
1604
+ // src/client/settings.ts
1625
1605
  function createClientSettingsStore(rpc, namespace, scope) {
1626
1606
  const stateKey = `devframe:settings:${scope}:${namespace}`;
1627
1607
  let statePromise;
@@ -1647,8 +1627,7 @@ function createClientSettings(rpc, namespace) {
1647
1627
  project: createClientSettingsStore(rpc, namespace, "project")
1648
1628
  };
1649
1629
  }
1650
- //#endregion
1651
- //#region src/client/scope.ts
1630
+ // src/client/scope.ts
1652
1631
  /**
1653
1632
  * Build a namespace-scoped view of a {@link DevframeRpcClient}. Every RPC
1654
1633
  * id, shared-state key, and streaming channel passed through the returned
@@ -1680,8 +1659,7 @@ function createScopedClientContext(rpc, namespace) {
1680
1659
  scope: rpc.scope
1681
1660
  };
1682
1661
  }
1683
- //#endregion
1684
- //#region src/client/webmcp.ts
1662
+ // src/client/webmcp.ts
1685
1663
  /**
1686
1664
  * The page's WebMCP model context, when the browser (or a polyfill)
1687
1665
  * provides one. Checks `document.modelContext` (current draft) first,
@@ -1790,8 +1768,7 @@ function formatError(error) {
1790
1768
  const cause = error.cause instanceof Error ? ` (cause: ${error.cause.message})` : "";
1791
1769
  return `${error.name}: ${error.message}${cause}`;
1792
1770
  }
1793
- //#endregion
1794
- //#region src/client/rpc.ts
1771
+ // src/client/rpc.ts
1795
1772
  /**
1796
1773
  * Resolve the requested `transport` option against what the server
1797
1774
  * advertises. `'auto'` trusts the advertisement: the server's declared
@@ -2044,7 +2021,7 @@ async function getDevframeRpcClient(options = {}) {
2044
2021
  }, () => {
2045
2022
  bootstrapAuthSettled = true;
2046
2023
  });
2047
- if (connectionMeta.mcp) import("../browser-agent-rpc-KH4HHvHf.mjs").then(({ setupBrowserAgentRpcBridge }) => {
2024
+ if (connectionMeta.mcp) import("../browser-agent-rpc-CS80Sphv.mjs").then(({ setupBrowserAgentRpcBridge }) => {
2048
2025
  if (!closed) disposeBrowserAgentBridge = setupBrowserAgentRpcBridge(rpc);
2049
2026
  }).catch(() => {});
2050
2027
  if (authChannel) authChannel.onmessage = (event) => {
@@ -2052,8 +2029,6 @@ async function getDevframeRpcClient(options = {}) {
2052
2029
  };
2053
2030
  return rpc;
2054
2031
  }
2055
- //#endregion
2056
- //#region src/client/index.ts
2032
+ // src/client/index.ts
2057
2033
  const connectDevframe = getDevframeRpcClient;
2058
- //#endregion
2059
2034
  export { DevframeConnectionError, authenticateWithUrlOtp, connectDevframe, consumeOtpFromUrl, createClientSettings, createRpcStreamingClientHost, createScopedClientContext, getDevframeConnection, getDevframeRpcClient, isCallableStatus, readOtpFromUrl, registerDevframeViewerOrigin, registerWebMcpTools, resolveClientTransport, resolveSseUrl, resolveWebMcpModelContext, resolveWsUrl, setupDevframeConnection, storeConnection };
@@ -1,6 +1,6 @@
1
- import { t as DEVFRAME_EVENTS } from "./events-0wDwalmL.mjs";
2
- import { t as diagnostics } from "./diagnostics-E_PvUPsA.mjs";
3
- //#region src/utils/events.ts
1
+ import { t as DEVFRAME_EVENTS } from "./events-qWCKwD8-.mjs";
2
+ import { t as diagnostics } from "./diagnostics-DC1-WcvN.mjs";
3
+ // src/utils/events.ts
4
4
  /**
5
5
  * Create event emitter.
6
6
  */
@@ -38,8 +38,7 @@ function createEventEmitter() {
38
38
  once
39
39
  };
40
40
  }
41
- //#endregion
42
- //#region src/agent/safety.ts
41
+ // src/agent/safety.ts
43
42
  /**
44
43
  * An agent tool's safety classification: the explicit `agent.safety`, else
45
44
  * inferred from the function `type` (`static`/`query` are read-only, the rest
@@ -49,8 +48,7 @@ function resolveAgentSafety(type, agent) {
49
48
  if (agent.safety) return agent.safety;
50
49
  return type === "static" || type === "query" || type == null ? "read" : "action";
51
50
  }
52
- //#endregion
53
- //#region src/tool-input.ts
51
+ // src/tool-input.ts
54
52
  /**
55
53
  * Convert an object-shaped tool input into positional arguments.
56
54
  *
@@ -78,8 +76,7 @@ function toolInputToRpcArgs(input, argumentCount) {
78
76
  function toolInputToCommandArgs(input, argumentCount) {
79
77
  return collectPositionalArgs(input, argumentCount) ?? [];
80
78
  }
81
- //#endregion
82
- //#region src/node/host-agent.ts
79
+ // src/node/host-agent.ts
83
80
  /**
84
81
  * Framework-neutral host aggregating the agent-exposed surface of a
85
82
  * devframe. Auto-discovers RPC functions with an `agent` field from
@@ -273,8 +270,7 @@ var DevframeAgentHost = class {
273
270
  if (def?.agent) return def;
274
271
  }
275
272
  };
276
- //#endregion
277
- //#region src/node/client-agent.ts
273
+ // src/node/client-agent.ts
278
274
  /** Id of the built-in tool listing connected browser tabs (wire name `devframe_agent_list-clients`). */
279
275
  const LIST_CLIENTS_TOOL = "devframe:agent:list-clients";
280
276
  /** Reserved argument a forwarded client tool accepts to address one tab. */
@@ -419,5 +415,4 @@ function removeClientAgentSession(context, meta) {
419
415
  const state = states.get(context);
420
416
  if (state?.sessions.delete(meta)) state.notifyChanged();
421
417
  }
422
- //#endregion
423
418
  export { toolInputToCommandArgs as a, DevframeAgentHost as i, removeClientAgentSession as n, createEventEmitter as o, syncClientAgentTools as r, LIST_CLIENTS_TOOL as t };
@@ -1,4 +1,3 @@
1
- //#region src/events.d.ts
2
1
  /**
3
2
  * Centralized registry of the core devframe event names: the node-side host
4
3
  * bus events, the client RPC connection events, and the server→client
@@ -76,8 +75,6 @@ export declare const DEVFRAME_EVENTS: {
76
75
  readonly inPageChannel: "devframe:in-page-channel";
77
76
  };
78
77
  };
79
- //#endregion
80
- //#region src/constants.d.ts
81
78
  /** Devframe runtime routes and static output conventions. */
82
79
  export declare const DEVFRAME_CONNECTION_META_FILENAME = "__connection.json";
83
80
  /**
@@ -179,5 +176,4 @@ export declare const ANONYMOUS_RPC_PREFIX = "anonymous:";
179
176
  * the RPC server binding (via an `authorize` function) and by host adapters that
180
177
  * implement their own transport.
181
178
  */
182
- export declare function isAnonymousRpcMethod(name: string): boolean;
183
- //#endregion
179
+ export declare function isAnonymousRpcMethod(name: string): boolean;
@@ -1,5 +1,5 @@
1
- import { t as DEVFRAME_EVENTS } from "./events-0wDwalmL.mjs";
2
- //#region src/constants.ts
1
+ import { t as DEVFRAME_EVENTS } from "./events-qWCKwD8-.mjs";
2
+ // src/constants.ts
3
3
  /** Devframe runtime routes and static output conventions. */
4
4
  const DEVFRAME_CONNECTION_META_FILENAME = "__connection.json";
5
5
  /**
@@ -104,5 +104,4 @@ const ANONYMOUS_RPC_PREFIX = "anonymous:";
104
104
  function isAnonymousRpcMethod(name) {
105
105
  return name.startsWith(ANONYMOUS_RPC_PREFIX);
106
106
  }
107
- //#endregion
108
107
  export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_KEY, DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DOCK_IMPORTS_FILENAME, DEVFRAME_EVENTS, DEVFRAME_MCP_ROUTE, DEVFRAME_OTP_URL_PARAM, DEVFRAME_REMOTE_ASSETS_ERROR_MESSAGE_TYPE, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME, DEVFRAME_SERVICES_STATE_KEY, DEVFRAME_SSE_ROUTE, DEVFRAME_SSE_SESSION_HEADER, DEVFRAME_VIEWER_ORIGIN_QUERY_PARAM, DEVFRAME_VIEWER_ORIGIN_TOKEN_QUERY_PARAM, DEVFRAME_WS_ROUTE, REMOTE_CONNECTION_KEY, isAnonymousRpcMethod };
@@ -1,8 +1,8 @@
1
- import { n as randomToken } from "./crypto-token-TVbGGFuj.mjs";
2
- import { t as createStorage } from "./storage-CWI9PZ-5.mjs";
3
- import { n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "./revoke-CeQUo6KI.mjs";
1
+ import { n as randomToken } from "./crypto-token-CUhPE_ei.mjs";
2
+ import { n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "./revoke-D6KA3vwr.mjs";
3
+ import { t as createStorage } from "./storage-DpJ52UB_.mjs";
4
4
  import { join } from "pathe";
5
- //#region src/node/hub-internals/context.ts
5
+ // src/node/hub-internals/context.ts
6
6
  const internalContextMap = /* @__PURE__ */ new WeakMap();
7
7
  function getInternalContext(context) {
8
8
  if (!internalContextMap.has(context)) {
@@ -54,5 +54,4 @@ function getInternalContext(context) {
54
54
  }
55
55
  return internalContextMap.get(context);
56
56
  }
57
- //#endregion
58
57
  export { internalContextMap as n, getInternalContext as t };
@@ -1,19 +1,19 @@
1
- import { i as defineDiagnostics } from "./nostics-D0PvLZsn.mjs";
2
- import { r as diagnostics } from "./serialization-BhuOoL80.mjs";
3
- import { RpcFunctionsCollectorBase } from "./rpc/index.mjs";
1
+ import { r as diagnostics } from "./serialization-iiTQ7n21.mjs";
2
+ import { t as diagnostics$1 } from "./diagnostics-DC1-WcvN.mjs";
3
+ import { i as DevframeAgentHost, n as removeClientAgentSession, o as createEventEmitter, r as syncClientAgentTools } from "./client-agent-qNMgDUev.mjs";
4
+ import { i as defineDiagnostics } from "./nostics-InlX4tmd.mjs";
4
5
  import { defineRpcFunction } from "./index.mjs";
5
- import { t as DEVFRAME_EVENTS } from "./events-0wDwalmL.mjs";
6
+ import { t as DEVFRAME_EVENTS } from "./events-qWCKwD8-.mjs";
7
+ import { RpcFunctionsCollectorBase } from "./rpc/index.mjs";
8
+ import { n as createDebug, t as resolveStaticAssetsSource } from "./remote-assets-DhonNeo_.mjs";
9
+ import { t as createStorage } from "./storage-DpJ52UB_.mjs";
6
10
  import { DEVFRAME_SERVICES_STATE_KEY } from "./constants.mjs";
7
- import { t as diagnostics$1 } from "./diagnostics-E_PvUPsA.mjs";
8
- import { i as DevframeAgentHost, n as removeClientAgentSession, o as createEventEmitter, r as syncClientAgentTools } from "./client-agent-iBkMYxqn.mjs";
9
- import { n as createDebug, t as resolveStaticAssetsSource } from "./remote-assets-B-n83kUY.mjs";
10
- import { t as createStorage } from "./storage-CWI9PZ-5.mjs";
11
- import { a as satisfiesVersionRange, n as expandResolveFrom, r as importServicePackage, t as deepMergeOptionSets } from "./services-install-D5YUwFXW.mjs";
11
+ import { a as satisfiesVersionRange, n as expandResolveFrom, r as importServicePackage, t as deepMergeOptionSets } from "./services-install-DCuDzMJ-.mjs";
12
12
  import { isAbsolute, join, relative } from "pathe";
13
13
  import { createSharedState } from "devframe/utils/shared-state";
14
14
  import { existsSync } from "node:fs";
15
15
  import process from "node:process";
16
- //#region src/node/host-diagnostics.ts
16
+ // src/node/host-diagnostics.ts
17
17
  var DevframeDiagnosticsHost = class {
18
18
  context;
19
19
  _registry = {};
@@ -31,8 +31,7 @@ var DevframeDiagnosticsHost = class {
31
31
  Object.assign(this._registry, diagnostics);
32
32
  }
33
33
  };
34
- //#endregion
35
- //#region src/node/rpc-shared-state.ts
34
+ // src/node/rpc-shared-state.ts
36
35
  const debug$2 = createDebug("devframe:rpc:state:changed");
37
36
  const debugSubscribe = createDebug("devframe:rpc:state:subscribe");
38
37
  function createRpcSharedStateServerHost(rpc, resolveState) {
@@ -167,8 +166,7 @@ function createRpcSharedStateServerHost(rpc, resolveState) {
167
166
  });
168
167
  return host;
169
168
  }
170
- //#endregion
171
- //#region src/utils/nanoid.ts
169
+ // src/utils/nanoid.ts
172
170
  const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
173
171
  function nanoid(size = 21) {
174
172
  let id = "";
@@ -176,8 +174,7 @@ function nanoid(size = 21) {
176
174
  while (i--) id += urlAlphabet[Math.random() * 64 | 0];
177
175
  return id;
178
176
  }
179
- //#endregion
180
- //#region src/utils/streaming-channel.ts
177
+ // src/utils/streaming-channel.ts
181
178
  const DEFAULT_HIGH_WATER_MARK = 256;
182
179
  var StreamClosedError = class extends Error {
183
180
  name = "StreamClosedError";
@@ -431,8 +428,7 @@ function toErrorPayload(reason) {
431
428
  };
432
429
  }
433
430
  }
434
- //#endregion
435
- //#region src/node/rpc-streaming.ts
431
+ // src/node/rpc-streaming.ts
436
432
  const debug$1 = createDebug("devframe:rpc:streaming");
437
433
  const STREAM_KEY_SEPARATOR = "";
438
434
  function streamKey(channel, id) {
@@ -737,8 +733,7 @@ function createRpcStreamingServerHost(rpc) {
737
733
  }
738
734
  };
739
735
  }
740
- //#endregion
741
- //#region src/settings-store.ts
736
+ // src/settings-store.ts
742
737
  /**
743
738
  * The key-value store surface over a lazily-resolved shared state, shared by
744
739
  * the node-side (file-backed) and client-side (RPC-mirrored) settings stores.
@@ -769,8 +764,7 @@ function createSettingsStore(store) {
769
764
  }
770
765
  };
771
766
  }
772
- //#endregion
773
- //#region src/node/settings.ts
767
+ // src/node/settings.ts
774
768
  const STORAGE_SCOPE = {
775
769
  global: "global",
776
770
  project: "project"
@@ -810,8 +804,7 @@ function createNodeSettings(context, namespace) {
810
804
  project: createNodeSettingsStore(context, namespace, "project")
811
805
  };
812
806
  }
813
- //#endregion
814
- //#region src/node/host-functions.ts
807
+ // src/node/host-functions.ts
815
808
  const debugBroadcast = createDebug("devframe:rpc:broadcast");
816
809
  /**
817
810
  * Concrete implementation backing `ctx.rpc`. Internal: consumers should
@@ -879,8 +872,7 @@ var RpcFunctionsHostImpl = class extends RpcFunctionsCollectorBase {
879
872
  return this._asyncStorage.getStore();
880
873
  }
881
874
  };
882
- //#endregion
883
- //#region src/node/host-services.ts
875
+ // src/node/host-services.ts
884
876
  const debug = createDebug("devframe:services");
885
877
  /**
886
878
  * Per-RPC-host registry of the services already installed against it, keyed
@@ -1140,8 +1132,7 @@ var DevframeServicesHostImpl = class {
1140
1132
  });
1141
1133
  }
1142
1134
  };
1143
- //#endregion
1144
- //#region src/node/host-views.ts
1135
+ // src/node/host-views.ts
1145
1136
  var DevframeViewHost = class {
1146
1137
  context;
1147
1138
  importMetaUrl;
@@ -1164,8 +1155,7 @@ var DevframeViewHost = class {
1164
1155
  this.context.host.mountStatic(baseUrl, resolved);
1165
1156
  }
1166
1157
  };
1167
- //#endregion
1168
- //#region src/node/rpc/agent-invoke-tool.ts
1158
+ // src/node/rpc/agent-invoke-tool.ts
1169
1159
  const agentInvokeTool = defineRpcFunction({
1170
1160
  name: "devframe:agent:invoke-tool",
1171
1161
  type: "action",
@@ -1175,8 +1165,7 @@ const agentInvokeTool = defineRpcFunction({
1175
1165
  } };
1176
1166
  }
1177
1167
  });
1178
- //#endregion
1179
- //#region src/node/rpc/agent-list-resources.ts
1168
+ // src/node/rpc/agent-list-resources.ts
1180
1169
  const agentListResources = defineRpcFunction({
1181
1170
  name: "devframe:agent:list-resources",
1182
1171
  type: "query",
@@ -1187,8 +1176,7 @@ const agentListResources = defineRpcFunction({
1187
1176
  } };
1188
1177
  }
1189
1178
  });
1190
- //#endregion
1191
- //#region src/node/rpc/index.ts
1179
+ // src/node/rpc/index.ts
1192
1180
  /**
1193
1181
  * Built-in agent introspection RPC functions. Registered automatically
1194
1182
  * by `createHostContext`. Not themselves agent-exposed (no `agent`
@@ -1227,8 +1215,7 @@ const BUILTIN_AGENT_RPC = [
1227
1215
  } })
1228
1216
  })
1229
1217
  ];
1230
- //#endregion
1231
- //#region src/utils/scope.ts
1218
+ // src/utils/scope.ts
1232
1219
  /** Whether a name is already namespaced (contains a `:` separator). */
1233
1220
  function isQualifiedName(name) {
1234
1221
  return name.includes(":");
@@ -1241,8 +1228,7 @@ function isQualifiedName(name) {
1241
1228
  function qualifyName(namespace, name) {
1242
1229
  return isQualifiedName(name) ? name : `${namespace}:${name}`;
1243
1230
  }
1244
- //#endregion
1245
- //#region src/node/scope.ts
1231
+ // src/node/scope.ts
1246
1232
  function prefixDefinition(namespace, fn) {
1247
1233
  if (isQualifiedName(fn.name)) throw diagnostics$1.DF0034({
1248
1234
  namespace,
@@ -1292,8 +1278,7 @@ function createScopedNodeContext(context, namespace) {
1292
1278
  scope: context.scope
1293
1279
  };
1294
1280
  }
1295
- //#endregion
1296
- //#region src/node/context.ts
1281
+ // src/node/context.ts
1297
1282
  /**
1298
1283
  * Framework- and build-tool-agnostic core of the Devframe node context.
1299
1284
  * Wires the RPC host, view (HTTP file-serving) host, diagnostics, and
@@ -1339,5 +1324,4 @@ async function createHostContext(options) {
1339
1324
  for (const fn of builtinRpcDeclarations) rpcHost.register(fn);
1340
1325
  return context;
1341
1326
  }
1342
- //#endregion
1343
1327
  export { createHostContext as t };
@@ -1,5 +1,4 @@
1
- import { k as SharedState, o as DevframeNodeContext } from "./context-BNxFOPbX.mjs";
2
- //#region src/node/hub-internals/context.d.ts
1
+ import { k as SharedState, o as DevframeNodeContext } from "./context-WxTq6kqb.mjs";
3
2
  interface InternalAnonymousAuthStorage {
4
3
  trusted: Record<string, {
5
4
  authToken: string;
@@ -65,5 +64,4 @@ interface DevframeInternalContext {
65
64
  }
66
65
  declare const internalContextMap: WeakMap<DevframeNodeContext, DevframeInternalContext>;
67
66
  declare function getInternalContext(context: DevframeNodeContext): DevframeInternalContext;
68
- //#endregion
69
67
  export { internalContextMap as a, getInternalContext as i, InternalAnonymousAuthStorage as n, RemoteTokenRecord as r, DevframeInternalContext as t };