devframe 0.1.22 → 0.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 (75) hide show
  1. package/README.md +20 -77
  2. package/dist/{_shared-DcJX9-Az.mjs → _shared-C_yZKUmx.mjs} +3 -3
  3. package/dist/adapters/build.d.mts +1 -1
  4. package/dist/adapters/build.mjs +5 -6
  5. package/dist/adapters/cli.d.mts +3 -3
  6. package/dist/adapters/cli.mjs +2 -2
  7. package/dist/adapters/dev.d.mts +7 -7
  8. package/dist/adapters/dev.mjs +1 -1
  9. package/dist/adapters/embedded.d.mts +1 -1
  10. package/dist/adapters/mcp.d.mts +2 -2
  11. package/dist/adapters/mcp.mjs +73 -18
  12. package/dist/client/index.d.mts +5 -7
  13. package/dist/client/index.mjs +10 -23
  14. package/dist/colors-DS7k8ljB.mjs +123 -0
  15. package/dist/{context-DBd794Rn.d.mts → context-BaX-SZti.d.mts} +1 -1
  16. package/dist/{dev-BGpTpYiR.mjs → dev-CA0-8Amw.mjs} +14 -18
  17. package/dist/{devframe-DulcIxwu.d.mts → devframe-BXZUBuy6.d.mts} +12 -28
  18. package/dist/{diagnostics-BFhNNmST.mjs → diagnostics-Cg9ycFIM.mjs} +2 -2
  19. package/dist/hash-CIBte1yS.mjs +263 -0
  20. package/dist/{adapters → helpers}/vite.d.mts +7 -8
  21. package/dist/{adapters → helpers}/vite.mjs +8 -9
  22. package/dist/{context-DUibxhrR.mjs → host-h3-CpYkiCIU.mjs} +36 -14
  23. package/dist/{index-DB2Ie0Or.d.mts → index-BO4daMzR.d.mts} +51 -3
  24. package/dist/index.d.mts +4 -4
  25. package/dist/{launch-editor-KA_21J1T.mjs → launch-editor-1dAC7Uk5.mjs} +9 -9
  26. package/dist/node/auth.d.mts +2 -2
  27. package/dist/node/auth.mjs +2 -2
  28. package/dist/node/index.d.mts +12 -44
  29. package/dist/node/index.mjs +4 -6
  30. package/dist/node/internal.d.mts +5 -5
  31. package/dist/node/internal.mjs +4 -4
  32. package/dist/{open-DmFp0qZA.mjs → open-CWL4Zasd.mjs} +26 -21
  33. package/dist/recipes/open-helpers.d.mts +1 -1
  34. package/dist/recipes/open-helpers.mjs +2 -2
  35. package/dist/rpc/index.d.mts +3 -3
  36. package/dist/rpc/index.mjs +2 -2
  37. package/dist/rpc/transports/ws-client.d.mts +1 -1
  38. package/dist/rpc/transports/ws-client.mjs +2 -2
  39. package/dist/rpc/transports/ws-server.d.mts +1 -1
  40. package/dist/rpc/transports/ws-server.mjs +2 -2
  41. package/dist/{rpc-CkZuoz-m.mjs → rpc-BlVCyk9W.mjs} +138 -14
  42. package/dist/{server-zKEDxgqD.d.mts → server-CgqyJG9m.d.mts} +5 -5
  43. package/dist/{server-ma8-ZVyX.mjs → server-G1ymmN3_.mjs} +3 -3
  44. package/dist/{shared-state-DCDs0e7y.mjs → shared-state-q9-1EOSX.mjs} +1 -1
  45. package/dist/{storage-CNC38eU-.mjs → storage-BaLJK6e_.mjs} +3 -3
  46. package/dist/{structured-clone-DcDc2Dds.mjs → structured-clone-CD2l4fI3.mjs} +1 -1
  47. package/dist/{transports-BnCs4rj9.mjs → transports-BLwT342H.mjs} +1 -1
  48. package/dist/types/index.d.mts +4 -4
  49. package/dist/types/index.mjs +1 -10
  50. package/dist/{types-4rdUEi2R.d.mts → types-ip8THGH1.d.mts} +21 -5
  51. package/dist/utils/colors.mjs +1 -1
  52. package/dist/utils/events.d.mts +1 -1
  53. package/dist/utils/hash.mjs +1 -1
  54. package/dist/utils/human-id.mjs +1 -1
  55. package/dist/utils/launch-editor.mjs +1 -1
  56. package/dist/utils/open.mjs +1 -1
  57. package/dist/utils/serve-static.d.mts +13 -3
  58. package/dist/utils/serve-static.mjs +41 -20
  59. package/dist/utils/shared-state.d.mts +1 -1
  60. package/dist/utils/shared-state.mjs +1 -1
  61. package/dist/utils/streaming-channel.d.mts +1 -1
  62. package/dist/utils/structured-clone.mjs +1 -1
  63. package/dist/utils/when.d.mts +1 -1
  64. package/dist/utils/when.mjs +1 -1
  65. package/dist/{ws-client-Bavoya6-.d.mts → ws-client-DFUf-xgm.d.mts} +1 -1
  66. package/dist/{ws-server-DjvlwLuM.d.mts → ws-server-kW8RZXTw.d.mts} +1 -1
  67. package/package.json +18 -11
  68. package/skills/devframe/SKILL.md +24 -21
  69. package/skills/devframe/templates/spa-devframe.ts +2 -2
  70. package/dist/colors-Bl4W18Mh.mjs +0 -123
  71. package/dist/hash-BHZbo80D.mjs +0 -126
  72. package/dist/host-h3-Dz8YnFgu.mjs +0 -24
  73. package/dist/static-dump-D7AvjrgL.mjs +0 -80
  74. /package/dist/{human-id-adtUWQLr.mjs → human-id-mPh1HcFO.mjs} +0 -0
  75. /package/dist/{revoke-DIMz1r7-.mjs → revoke-CWSPBbJH.mjs} +0 -0
@@ -1,5 +1,6 @@
1
- import { t as hash } from "./hash-BHZbo80D.mjs";
1
+ import { t as hash } from "./hash-CIBte1yS.mjs";
2
2
  import { i as logger } from "./serialization-CwO31axa.mjs";
3
+ import { DEVTOOLS_RPC_DUMP_DIRNAME } from "./constants.mjs";
3
4
  //#region src/rpc/cache.ts
4
5
  /**
5
6
  * @experimental API is expected to change.
@@ -129,7 +130,7 @@ function assertAgentJsonSerializable(fn) {
129
130
  if (fn.agent && fn.jsonSerializable !== true) throw logger.DF0019({ name: fn.name }).throw();
130
131
  }
131
132
  //#endregion
132
- //#region ../../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
133
+ //#region ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
133
134
  var Node = class {
134
135
  value;
135
136
  next;
@@ -187,7 +188,7 @@ var Queue = class {
187
188
  }
188
189
  };
189
190
  //#endregion
190
- //#region ../../../node_modules/.pnpm/p-limit@7.3.0/node_modules/p-limit/index.js
191
+ //#region ../../node_modules/.pnpm/p-limit@7.3.0/node_modules/p-limit/index.js
191
192
  function pLimit(concurrency) {
192
193
  let rejectOnClear = false;
193
194
  if (typeof concurrency === "object") ({concurrency, rejectOnClear = false} = concurrency);
@@ -285,7 +286,60 @@ function validateDefinition(definition) {
285
286
  validateDefinitions([definition]);
286
287
  }
287
288
  //#endregion
288
- //#region src/rpc/dumps.ts
289
+ //#region src/rpc/dump/error.ts
290
+ /**
291
+ * Normalize a thrown value into a plain object suitable for storage in
292
+ * a dump record. Preserves `message`, `name`, `cause`, and any own
293
+ * enumerable properties of an `Error` so consumers reading the dump can
294
+ * reconstruct a richer Error than just `{ message, name }`.
295
+ *
296
+ * Non-`Error` throws are wrapped as `{ name: 'Error', message: String(thrown) }`.
297
+ */
298
+ function serializeDumpError(error) {
299
+ return serializeWithSeen(error, /* @__PURE__ */ new WeakSet());
300
+ }
301
+ function serializeWithSeen(error, seen) {
302
+ if (!(error instanceof Error)) return {
303
+ name: "Error",
304
+ message: String(error)
305
+ };
306
+ if (seen.has(error)) return {
307
+ name: error.name,
308
+ message: error.message
309
+ };
310
+ seen.add(error);
311
+ const out = {
312
+ name: error.name,
313
+ message: error.message
314
+ };
315
+ const cause = error.cause;
316
+ if (cause !== void 0) out.cause = cause instanceof Error ? serializeWithSeen(cause, seen) : cause;
317
+ for (const key of Object.keys(error)) {
318
+ if (key === "name" || key === "message" || key === "cause") continue;
319
+ out[key] = error[key];
320
+ }
321
+ return out;
322
+ }
323
+ /**
324
+ * Inverse of {@link serializeDumpError}: rebuild a thrown `Error` from
325
+ * the plain object stored in a dump record. Preserves `cause`, restores
326
+ * the original `name`, and re-attaches any custom own properties.
327
+ */
328
+ function reviveDumpError(stored) {
329
+ const cause = stored.cause instanceof Error ? stored.cause : isPlainErrorShape(stored.cause) ? reviveDumpError(stored.cause) : stored.cause;
330
+ const error = cause !== void 0 ? new Error(stored.message, { cause }) : new Error(stored.message);
331
+ error.name = stored.name;
332
+ for (const key of Object.keys(stored)) {
333
+ if (key === "name" || key === "message" || key === "cause") continue;
334
+ error[key] = stored[key];
335
+ }
336
+ return error;
337
+ }
338
+ function isPlainErrorShape(value) {
339
+ return typeof value === "object" && value !== null && typeof value.message === "string" && typeof value.name === "string";
340
+ }
341
+ //#endregion
342
+ //#region src/rpc/dump/index.ts
289
343
  function getDumpRecordKey(functionName, args) {
290
344
  return `${functionName}---${hash(args)}`;
291
345
  }
@@ -374,10 +428,7 @@ async function dumpFunctions(definitions, context, options = {}) {
374
428
  } catch (error) {
375
429
  store.records[recordKey] = {
376
430
  inputs: input,
377
- error: {
378
- message: error.message,
379
- name: error.name
380
- }
431
+ error: serializeDumpError(error)
381
432
  };
382
433
  }
383
434
  });
@@ -409,11 +460,7 @@ function createClientFromDump(store, options = {}) {
409
460
  const recordOrGetter = store.records[recordKey];
410
461
  if (recordOrGetter) {
411
462
  const record = await resolveGetter(recordOrGetter);
412
- if (record.error) {
413
- const error = new Error(record.error.message);
414
- error.name = record.error.name;
415
- throw error;
416
- }
463
+ if (record.error) throw reviveDumpError(record.error);
417
464
  if (typeof record.output === "function") return await record.output();
418
465
  return record.output;
419
466
  }
@@ -454,4 +501,81 @@ function getDefinitionsWithDumps(definitions) {
454
501
  return definitions.filter((def) => def.dump !== void 0);
455
502
  }
456
503
  //#endregion
457
- export { validateDefinitions as a, getRpcResolvedSetupResult as c, validateDefinition as i, RpcCacheManager as l, dumpFunctions as n, RpcFunctionsCollectorBase as o, getDefinitionsWithDumps as r, getRpcHandler as s, createClientFromDump as t };
504
+ //#region src/rpc/dump/static.ts
505
+ function makeDumpKey(name) {
506
+ return encodeURIComponent(name.replaceAll(":", "~"));
507
+ }
508
+ function makeStaticPath(name) {
509
+ return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.static.json`;
510
+ }
511
+ function makeQueryRecordPath(name, hash) {
512
+ return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.record.${hash}.json`;
513
+ }
514
+ function makeQueryFallbackPath(name) {
515
+ return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.fallback.json`;
516
+ }
517
+ async function resolveRecord(record) {
518
+ return typeof record === "function" ? await record() : record;
519
+ }
520
+ async function collectStaticRpcDump(definitions, context) {
521
+ const manifest = {};
522
+ const files = {};
523
+ for (const definition of definitions) {
524
+ const type = definition.type ?? "query";
525
+ const serialization = definition.jsonSerializable === true ? "json" : "structured-clone";
526
+ if (type === "static") {
527
+ const handler = await getRpcHandler(definition, context);
528
+ const path = makeStaticPath(definition.name);
529
+ files[path] = {
530
+ serialization,
531
+ fnName: definition.name,
532
+ data: { output: await Promise.resolve(handler()) }
533
+ };
534
+ manifest[definition.name] = {
535
+ type: "static",
536
+ path,
537
+ serialization
538
+ };
539
+ continue;
540
+ }
541
+ if (type !== "query") continue;
542
+ const store = await dumpFunctions([definition], context);
543
+ if (!(definition.name in store.definitions)) continue;
544
+ const queryEntry = {
545
+ type: "query",
546
+ records: {},
547
+ serialization
548
+ };
549
+ const prefix = `${definition.name}---`;
550
+ for (const [recordKey, recordOrGetter] of Object.entries(store.records)) {
551
+ if (!recordKey.startsWith(prefix)) continue;
552
+ const key = recordKey.slice(prefix.length);
553
+ const record = await resolveRecord(recordOrGetter);
554
+ if (key === "fallback") {
555
+ const path = makeQueryFallbackPath(definition.name);
556
+ files[path] = {
557
+ serialization,
558
+ fnName: definition.name,
559
+ data: record
560
+ };
561
+ queryEntry.fallback = path;
562
+ } else {
563
+ const path = makeQueryRecordPath(definition.name, key);
564
+ files[path] = {
565
+ serialization,
566
+ fnName: definition.name,
567
+ data: record
568
+ };
569
+ queryEntry.records[key] = path;
570
+ }
571
+ }
572
+ if (!Object.keys(queryEntry.records).length && !queryEntry.fallback) continue;
573
+ manifest[definition.name] = queryEntry;
574
+ }
575
+ return {
576
+ manifest,
577
+ files
578
+ };
579
+ }
580
+ //#endregion
581
+ export { reviveDumpError as a, validateDefinitions as c, getRpcResolvedSetupResult as d, RpcCacheManager as f, getDefinitionsWithDumps as i, RpcFunctionsCollectorBase as l, createClientFromDump as n, serializeDumpError as o, dumpFunctions as r, validateDefinition as s, collectStaticRpcDump as t, getRpcHandler as u };
@@ -1,7 +1,7 @@
1
- import { Q as DevToolsRpcServerFunctions, Z as DevToolsRpcClientFunctions, y as DevToolsNodeContext } from "./devframe-DulcIxwu.mjs";
1
+ import { U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, d as DevToolsNodeContext } from "./devframe-BXZUBuy6.mjs";
2
2
  import { BirpcGroup } from "birpc";
3
3
  import { WebSocketServer } from "ws";
4
- import { App } from "h3";
4
+ import { H3 } from "h3";
5
5
 
6
6
  //#region src/node/server.d.ts
7
7
  interface StartHttpAndWsOptions {
@@ -13,7 +13,7 @@ interface StartHttpAndWsOptions {
13
13
  * when provided, callers can add their own routes (static handlers,
14
14
  * auth middleware, etc.) first.
15
15
  */
16
- app?: App;
16
+ app?: H3;
17
17
  /**
18
18
  * When `false`, the RPC server is started without a trust handshake.
19
19
  * Intended for single-user localhost tools where an auth round-trip
@@ -33,14 +33,14 @@ interface StartHttpAndWsOptions {
33
33
  onReady?: (info: {
34
34
  origin: string;
35
35
  port: number;
36
- app: App;
36
+ app: H3;
37
37
  }) => void | Promise<void>;
38
38
  }
39
39
  interface StartedServer {
40
40
  /** Listening origin, e.g. `http://localhost:9999`. */
41
41
  origin: string;
42
42
  port: number;
43
- app: App;
43
+ app: H3;
44
44
  wss: WebSocketServer;
45
45
  rpcGroup: BirpcGroup<DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, false>;
46
46
  close: () => Promise<void>;
@@ -3,7 +3,7 @@ import { attachWsRpcTransport } from "./rpc/transports/ws-server.mjs";
3
3
  import { WebSocketServer } from "ws";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { createServer } from "node:http";
6
- import { createApp, toNodeListener } from "h3";
6
+ import { H3, toNodeHandler } from "h3";
7
7
  //#region src/node/server.ts
8
8
  /**
9
9
  * Compose an h3 + WebSocket server for a devframe context. The RPC
@@ -13,8 +13,8 @@ import { createApp, toNodeListener } from "h3";
13
13
  async function startHttpAndWs(options) {
14
14
  const { context, port } = options;
15
15
  const bindHost = options.host ?? "localhost";
16
- const app = options.app ?? createApp();
17
- const httpServer = createServer(toNodeListener(app));
16
+ const app = options.app ?? new H3();
17
+ const httpServer = createServer(toNodeHandler(app));
18
18
  const wss = new WebSocketServer({ server: httpServer });
19
19
  const rpcHost = context.rpc;
20
20
  const asyncStorage = new AsyncLocalStorage();
@@ -1,6 +1,6 @@
1
1
  import { createEventEmitter } from "./utils/events.mjs";
2
2
  import { nanoid } from "./utils/nanoid.mjs";
3
- //#region ../../../node_modules/.pnpm/immer@11.1.8/node_modules/immer/dist/immer.mjs
3
+ //#region ../../node_modules/.pnpm/immer@11.1.8/node_modules/immer/dist/immer.mjs
4
4
  var NOTHING = Symbol.for("immer-nothing");
5
5
  var DRAFTABLE = Symbol.for("immer-draftable");
6
6
  var DRAFT_STATE = Symbol.for("immer-state");
@@ -1,8 +1,8 @@
1
- import { n as logger } from "./diagnostics-BFhNNmST.mjs";
2
- import { t as createSharedState } from "./shared-state-DCDs0e7y.mjs";
1
+ import { n as logger } from "./diagnostics-Cg9ycFIM.mjs";
2
+ import { t as createSharedState } from "./shared-state-q9-1EOSX.mjs";
3
3
  import fs from "node:fs";
4
4
  import { dirname } from "pathe";
5
- //#region ../../../node_modules/.pnpm/perfect-debounce@2.1.0/node_modules/perfect-debounce/dist/index.mjs
5
+ //#region ../../node_modules/.pnpm/perfect-debounce@2.1.0/node_modules/perfect-debounce/dist/index.mjs
6
6
  const DEBOUNCE_DEFAULTS = { trailing: true };
7
7
  /**
8
8
  Debounce functions
@@ -1,4 +1,4 @@
1
- //#region ../../../node_modules/.pnpm/structured-clone-es@2.0.0/node_modules/structured-clone-es/dist/index.mjs
1
+ //#region ../../node_modules/.pnpm/structured-clone-es@2.0.0/node_modules/structured-clone-es/dist/index.mjs
2
2
  const env = typeof self === "object" ? self : globalThis;
3
3
  function deserializer($, _) {
4
4
  const as = (out, index) => {
@@ -1,5 +1,5 @@
1
1
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2
- //#region src/node/mcp/transports.ts
2
+ //#region src/adapters/mcp/transports.ts
3
3
  /**
4
4
  * Start the MCP server on stdio. Returns a stop function.
5
5
  * @internal
@@ -1,4 +1,4 @@
1
- import { $ as DevToolsRpcSharedStates, C as RpcSharedStateGetOptions, D as RpcStreamingHost, E as RpcStreamingChannelOptions, J as EntriesToObject, Q as DevToolsRpcServerFunctions, S as RpcFunctionsHost, T as RpcStreamingChannel, X as Thenable, Y as PartialWithoutId, Z as DevToolsRpcClientFunctions, _ as ConnectionMeta, a as DevframeRuntime, at as AgentManifest, b as DevToolsNodeRpcSession, c as DevtoolBrowserContext, ct as AgentResourceInput, d as DevtoolDeploymentKind, dt as DevToolsAgentHost, et as DevToolsHost, f as DevtoolRuntime, ft as DevToolsAgentHostEvents, g as defineDevtool, h as defineDevframe, ht as EventsMap, i as DevframeDeploymentKind, it as AgentHandle, l as DevtoolCliOptions, lt as AgentTool, m as DevtoolSpaOptions, mt as EventUnsubscribe, n as DevframeCliOptions, nt as DevToolsDiagnosticsHost, o as DevframeSetupInfo, ot as AgentResource, p as DevtoolSetupInfo, pt as EventEmitter, q as DevToolsViewHost, r as DevframeDefinition, rt as DevToolsDiagnosticsLogger, s as DevframeSpaOptions, st as AgentResourceContent, t as DevframeBrowserContext, tt as DevToolsDiagnosticsDefinition, u as DevtoolDefinition, ut as AgentToolInput, v as DevToolsCapabilities, w as RpcSharedStateHost, x as RpcBroadcastOptions, y as DevToolsNodeContext } from "../devframe-DulcIxwu.mjs";
2
- import { m as RpcFunctionAgentOptions } from "../types-4rdUEi2R.mjs";
3
- import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-DjvlwLuM.mjs";
4
- export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ConnectionMeta, DevToolsAgentHost, DevToolsAgentHostEvents, DevToolsCapabilities, DevToolsDiagnosticsDefinition, DevToolsDiagnosticsHost, DevToolsDiagnosticsLogger, DevToolsHost, DevToolsNodeContext, DevToolsNodeRpcSession, DevToolsNodeRpcSessionMeta, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevToolsRpcSharedStates, DevToolsViewHost, DevframeBrowserContext, DevframeCliOptions, DevframeDefinition, DevframeDeploymentKind, DevframeRuntime, DevframeSetupInfo, DevframeSpaOptions, DevtoolBrowserContext, DevtoolCliOptions, DevtoolDefinition, DevtoolDeploymentKind, DevtoolRuntime, DevtoolSetupInfo, DevtoolSpaOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, PartialWithoutId, RpcBroadcastOptions, RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, Thenable, defineDevframe, defineDevtool };
1
+ import { $ as AgentResourceContent, B as EntriesToObject, G as DevToolsRpcSharedStates, H as Thenable, J as DevToolsDiagnosticsHost, K as DevToolsHost, Q as AgentResource, U as DevToolsRpcClientFunctions, V as PartialWithoutId, W as DevToolsRpcServerFunctions, X as AgentHandle, Y as DevToolsDiagnosticsLogger, Z as AgentManifest, _ as RpcStreamingChannel, a as DevframeRuntime, at as EventEmitter, c as defineDevframe, d as DevToolsNodeContext, et as AgentResourceInput, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, h as RpcSharedStateGetOptions, i as DevframeDeploymentKind, it as DevToolsAgentHostEvents, l as ConnectionMeta, m as RpcFunctionsHost, n as DevframeCliOptions, nt as AgentToolInput, o as DevframeSetupInfo, ot as EventUnsubscribe, p as RpcBroadcastOptions, q as DevToolsDiagnosticsDefinition, r as DevframeDefinition, rt as DevToolsAgentHost, s as DevframeSpaOptions, st as EventsMap, t as DevframeBrowserContext, tt as AgentTool, u as DevToolsCapabilities, v as RpcStreamingChannelOptions, y as RpcStreamingHost, z as DevToolsViewHost } from "../devframe-BXZUBuy6.mjs";
2
+ import { h as RpcFunctionAgentOptions } from "../types-ip8THGH1.mjs";
3
+ import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-kW8RZXTw.mjs";
4
+ export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ConnectionMeta, DevToolsAgentHost, DevToolsAgentHostEvents, DevToolsCapabilities, DevToolsDiagnosticsDefinition, DevToolsDiagnosticsHost, DevToolsDiagnosticsLogger, DevToolsHost, DevToolsNodeContext, DevToolsNodeRpcSession, DevToolsNodeRpcSessionMeta, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevToolsRpcSharedStates, DevToolsViewHost, DevframeBrowserContext, DevframeCliOptions, DevframeDefinition, DevframeDeploymentKind, DevframeRuntime, DevframeSetupInfo, DevframeSpaOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, PartialWithoutId, RpcBroadcastOptions, RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, Thenable, defineDevframe };
@@ -2,14 +2,5 @@
2
2
  function defineDevframe(d) {
3
3
  return d;
4
4
  }
5
- let warnedDefineDevtool = false;
6
- /** @deprecated Use `defineDevframe`. */
7
- function defineDevtool(d) {
8
- if (!warnedDefineDevtool) {
9
- warnedDefineDevtool = true;
10
- console.warn("[devframe] `defineDevtool` is deprecated; use `defineDevframe` instead.");
11
- }
12
- return d;
13
- }
14
5
  //#endregion
15
- export { defineDevframe, defineDevtool };
6
+ export { defineDevframe };
@@ -94,6 +94,25 @@ interface RpcFunctionSetupResult<ARGS extends any[], RETURN = void> {
94
94
  type RpcArgsSchema = readonly GenericSchema[];
95
95
  /** Valibot schema for validating function return value */
96
96
  type RpcReturnSchema = GenericSchema;
97
+ /**
98
+ * Serialized representation of a thrown value in a dump record.
99
+ *
100
+ * Errors are stored as plain objects so they round-trip through both the
101
+ * strict-JSON and structured-clone codecs. `message` and `name` are always
102
+ * present; `cause` and any own enumerable properties of the original
103
+ * `Error` are preserved on a best-effort basis. Non-`Error` throws are
104
+ * normalized to `{ name: 'Error', message: String(thrown) }`.
105
+ */
106
+ interface RpcDumpRecordError {
107
+ /** Error message (mirrors `Error.message`). */
108
+ message: string;
109
+ /** Error type name (e.g., "Error", "TypeError"). */
110
+ name: string;
111
+ /** `Error.cause`, recursively serialized when it is itself an `Error`. */
112
+ cause?: unknown;
113
+ /** Own enumerable properties of the original error (excluding `message`/`name`/`cause`). */
114
+ [key: string]: unknown;
115
+ }
97
116
  /**
98
117
  * Single record in a dump store with pre-computed results.
99
118
  */
@@ -103,10 +122,7 @@ interface RpcDumpRecord<ARGS extends any[] = any[], RETURN = any> {
103
122
  /** Result (value or lazy function) */
104
123
  output?: RETURN;
105
124
  /** Error if execution failed */
106
- error?: {
107
- /** Error message */message: string; /** Error type name (e.g., "Error", "TypeError") */
108
- name: string;
109
- };
125
+ error?: RpcDumpRecordError;
110
126
  }
111
127
  /**
112
128
  * Defines argument combinations to pre-compute for a function.
@@ -270,4 +286,4 @@ type RpcDefinitionsFilter<T extends readonly RpcFunctionDefinitionAny[], Type ex
270
286
  type: Type;
271
287
  } ? T[K] : never };
272
288
  //#endregion
273
- export { RpcReturnSchema as C, RpcFunctionsCollector as S, RpcFunctionDefinitionAnyWithContext as _, RpcDefinitionsFilter as a, RpcFunctionSetupResult as b, RpcDumpClientOptions as c, RpcDumpGetter as d, RpcDumpRecord as f, RpcFunctionDefinitionAny as g, RpcFunctionDefinition as h, RpcArgsSchema as i, RpcDumpCollectionOptions as l, RpcFunctionAgentOptions as m, BirpcReturn$1 as n, RpcDefinitionsToFunctions as o, RpcDumpStore as p, EntriesToObject as r, RpcDump as s, BirpcFn as t, RpcDumpDefinition as u, RpcFunctionDefinitionBase as v, Thenable as w, RpcFunctionType as x, RpcFunctionDefinitionToFunction as y };
289
+ export { RpcFunctionsCollector as C, RpcFunctionType as S, Thenable as T, RpcFunctionDefinitionAny as _, RpcDefinitionsFilter as a, RpcFunctionDefinitionToFunction as b, RpcDumpClientOptions as c, RpcDumpGetter as d, RpcDumpRecord as f, RpcFunctionDefinition as g, RpcFunctionAgentOptions as h, RpcArgsSchema as i, RpcDumpCollectionOptions as l, RpcDumpStore as m, BirpcReturn$1 as n, RpcDefinitionsToFunctions as o, RpcDumpRecordError as p, EntriesToObject as r, RpcDump as s, BirpcFn as t, RpcDumpDefinition as u, RpcFunctionDefinitionAnyWithContext as v, RpcReturnSchema as w, RpcFunctionSetupResult as x, RpcFunctionDefinitionBase as y };
@@ -1,2 +1,2 @@
1
- import { t as colors } from "../colors-Bl4W18Mh.mjs";
1
+ import { t as colors } from "../colors-DS7k8ljB.mjs";
2
2
  export { colors };
@@ -1,4 +1,4 @@
1
- import { ht as EventsMap, pt as EventEmitter } from "../devframe-DulcIxwu.mjs";
1
+ import { at as EventEmitter, st as EventsMap } from "../devframe-BXZUBuy6.mjs";
2
2
 
3
3
  //#region src/utils/events.d.ts
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { t as hash } from "../hash-BHZbo80D.mjs";
1
+ import { t as hash } from "../hash-CIBte1yS.mjs";
2
2
  export { hash };
@@ -1,2 +1,2 @@
1
- import { t as humanId } from "../human-id-adtUWQLr.mjs";
1
+ import { t as humanId } from "../human-id-mPh1HcFO.mjs";
2
2
  export { humanId };
@@ -1,2 +1,2 @@
1
- import { t as launchEditor } from "../launch-editor-KA_21J1T.mjs";
1
+ import { t as launchEditor } from "../launch-editor-1dAC7Uk5.mjs";
2
2
  export { launchEditor };
@@ -1,2 +1,2 @@
1
- import { t as open } from "../open-DmFp0qZA.mjs";
1
+ import { t as open } from "../open-CWL4Zasd.mjs";
2
2
  export { open };
@@ -1,5 +1,5 @@
1
1
  import { IncomingMessage, ServerResponse } from "node:http";
2
- import { EventHandler, EventHandlerRequest } from "h3";
2
+ import { EventHandler, H3 } from "h3";
3
3
 
4
4
  //#region src/utils/serve-static.d.ts
5
5
  interface ServeStaticOptions {
@@ -17,7 +17,17 @@ interface ServeStaticOptions {
17
17
  * file extension falls back to `<dir>/index.html` so client-side routing
18
18
  * works.
19
19
  */
20
- declare function serveStaticHandler(dir: string, options?: ServeStaticOptions): EventHandler<EventHandlerRequest>;
20
+ declare function serveStaticHandler(dir: string, options?: ServeStaticOptions): EventHandler;
21
+ /**
22
+ * Mount {@link serveStaticHandler} on an h3 app at `base`, handling the
23
+ * route pattern and prefix-stripping required by h3 v2.
24
+ *
25
+ * h3 v2's `app.use(base, handler)` only matches the exact `base` path and
26
+ * does not strip the prefix from `event.url.pathname`. Static serving
27
+ * needs both subpath matching (`/base/**`) and the URL stripped so the
28
+ * file resolver sees paths relative to `dir` — this helper bundles both.
29
+ */
30
+ declare function mountStaticHandler(app: H3, base: string, dir: string, options?: ServeStaticOptions): void;
21
31
  /**
22
32
  * Connect/Express-style Node middleware variant of {@link serveStaticHandler}.
23
33
  *
@@ -27,4 +37,4 @@ declare function serveStaticHandler(dir: string, options?: ServeStaticOptions):
27
37
  */
28
38
  declare function serveStaticNodeMiddleware(dir: string, options?: ServeStaticOptions): (req: IncomingMessage, res: ServerResponse, next?: (err?: Error) => void) => void;
29
39
  //#endregion
30
- export { ServeStaticOptions, serveStaticHandler, serveStaticNodeMiddleware };
40
+ export { ServeStaticOptions, mountStaticHandler, serveStaticHandler, serveStaticNodeMiddleware };
@@ -1,7 +1,8 @@
1
1
  import { createReadStream } from "node:fs";
2
2
  import { extname, join, normalize, resolve, sep } from "pathe";
3
- import { defineEventHandler, sendStream, setResponseHeader, setResponseStatus } from "h3";
3
+ import { defineHandler, withBase } from "h3";
4
4
  import { stat } from "node:fs/promises";
5
+ import { Readable } from "node:stream";
5
6
  import { lookup } from "mrmime";
6
7
  //#region src/utils/serve-static.ts
7
8
  const HTML_EXTENSIONS = [".html", ".htm"];
@@ -55,11 +56,16 @@ function contentTypeFor(abs) {
55
56
  if (type === "text/html") return "text/html; charset=utf-8";
56
57
  return type;
57
58
  }
58
- function setStaticHeaders(res, file) {
59
- res.setHeader("Content-Type", contentTypeFor(file.abs));
60
- res.setHeader("Content-Length", file.size);
61
- res.setHeader("Last-Modified", file.mtime.toUTCString());
62
- res.setHeader("Cache-Control", "no-store");
59
+ function staticHeadersFor(file) {
60
+ return {
61
+ "Content-Type": contentTypeFor(file.abs),
62
+ "Content-Length": String(file.size),
63
+ "Last-Modified": file.mtime.toUTCString(),
64
+ "Cache-Control": "no-store"
65
+ };
66
+ }
67
+ function applyStaticHeadersToNode(res, file) {
68
+ for (const [k, v] of Object.entries(staticHeadersFor(file))) res.setHeader(k, v);
63
69
  }
64
70
  function normalizeOptions(options) {
65
71
  return {
@@ -79,27 +85,42 @@ function normalizeOptions(options) {
79
85
  function serveStaticHandler(dir, options) {
80
86
  const absDir = resolve(dir);
81
87
  const opts = normalizeOptions(options);
82
- return defineEventHandler(async (event) => {
83
- const method = event.node.req.method;
88
+ return defineHandler(async (event) => {
89
+ const method = event.req.method;
84
90
  if (method !== "GET" && method !== "HEAD") {
85
- setResponseStatus(event, 405);
86
- setResponseHeader(event, "Allow", "GET, HEAD");
91
+ event.res.status = 405;
92
+ event.res.headers.set("Allow", "GET, HEAD");
87
93
  return "";
88
94
  }
89
- const file = await resolveTarget(absDir, event.node.req.url ?? "/", opts.indexNames, opts.single);
95
+ const file = await resolveTarget(absDir, event.url.pathname, opts.indexNames, opts.single);
90
96
  if (!file) {
91
- setResponseStatus(event, 404);
92
- return "";
93
- }
94
- setStaticHeaders(event.node.res, file);
95
- if (method === "HEAD") {
96
- event.node.res.end();
97
+ event.res.status = 404;
97
98
  return "";
98
99
  }
99
- return sendStream(event, createReadStream(file.abs));
100
+ for (const [k, v] of Object.entries(staticHeadersFor(file))) event.res.headers.set(k, v);
101
+ if (method === "HEAD") return "";
102
+ return Readable.toWeb(createReadStream(file.abs));
100
103
  });
101
104
  }
102
105
  /**
106
+ * Mount {@link serveStaticHandler} on an h3 app at `base`, handling the
107
+ * route pattern and prefix-stripping required by h3 v2.
108
+ *
109
+ * h3 v2's `app.use(base, handler)` only matches the exact `base` path and
110
+ * does not strip the prefix from `event.url.pathname`. Static serving
111
+ * needs both subpath matching (`/base/**`) and the URL stripped so the
112
+ * file resolver sees paths relative to `dir` — this helper bundles both.
113
+ */
114
+ function mountStaticHandler(app, base, dir, options) {
115
+ const trimmed = base.replace(/\/$/, "");
116
+ const handler = serveStaticHandler(dir, options);
117
+ if (trimmed === "") {
118
+ app.use("/**", handler);
119
+ return;
120
+ }
121
+ app.use(`${trimmed}/**`, withBase(trimmed, handler));
122
+ }
123
+ /**
103
124
  * Connect/Express-style Node middleware variant of {@link serveStaticHandler}.
104
125
  *
105
126
  * Use when mounting onto `viteServer.middlewares.use(base, …)` or any other
@@ -132,7 +153,7 @@ function serveStaticNodeMiddleware(dir, options) {
132
153
  res.end();
133
154
  return;
134
155
  }
135
- setStaticHeaders(res, file);
156
+ applyStaticHeadersToNode(res, file);
136
157
  if (method === "HEAD") {
137
158
  res.end();
138
159
  return;
@@ -149,4 +170,4 @@ function serveStaticNodeMiddleware(dir, options) {
149
170
  };
150
171
  }
151
172
  //#endregion
152
- export { serveStaticHandler, serveStaticNodeMiddleware };
173
+ export { mountStaticHandler, serveStaticHandler, serveStaticNodeMiddleware };
@@ -1,2 +1,2 @@
1
- import { B as ImmutableObject, G as SharedStatePatch, H as SharedState, K as createSharedState, L as Immutable, R as ImmutableArray, U as SharedStateEvents, V as ImmutableSet, W as SharedStateOptions, z as ImmutableMap } from "../devframe-DulcIxwu.mjs";
1
+ import { A as ImmutableArray, F as SharedStateEvents, I as SharedStateOptions, L as SharedStatePatch, M as ImmutableObject, N as ImmutableSet, P as SharedState, R as createSharedState, j as ImmutableMap, k as Immutable } from "../devframe-BXZUBuy6.mjs";
2
2
  export { Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableSet, SharedState, SharedStateEvents, SharedStateOptions, SharedStatePatch, createSharedState };
@@ -1,2 +1,2 @@
1
- import { t as createSharedState } from "../shared-state-DCDs0e7y.mjs";
1
+ import { t as createSharedState } from "../shared-state-q9-1EOSX.mjs";
2
2
  export { createSharedState };
@@ -1,2 +1,2 @@
1
- import { A as CreateStreamSinkOptions, F as createStreamReader, I as createStreamSink, M as StreamReader, N as StreamSink, O as BufferedChunk, P as StreamSinkEvents, j as StreamErrorPayload, k as CreateStreamReaderOptions } from "../devframe-DulcIxwu.mjs";
1
+ import { C as StreamErrorPayload, D as createStreamReader, E as StreamSinkEvents, O as createStreamSink, S as CreateStreamSinkOptions, T as StreamSink, b as BufferedChunk, w as StreamReader, x as CreateStreamReaderOptions } from "../devframe-BXZUBuy6.mjs";
2
2
  export { BufferedChunk, CreateStreamReaderOptions, CreateStreamSinkOptions, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, createStreamReader, createStreamSink };
@@ -1,2 +1,2 @@
1
- import { i as structuredCloneStringify, n as structuredCloneParse, r as structuredCloneSerialize, t as structuredCloneDeserialize } from "../structured-clone-DcDc2Dds.mjs";
1
+ import { i as structuredCloneStringify, n as structuredCloneParse, r as structuredCloneSerialize, t as structuredCloneDeserialize } from "../structured-clone-CD2l4fI3.mjs";
2
2
  export { structuredCloneDeserialize, structuredCloneParse, structuredCloneSerialize, structuredCloneStringify };
@@ -1,4 +1,4 @@
1
- //#region ../../../node_modules/.pnpm/whenexpr@0.1.2/node_modules/whenexpr/dist/index.d.mts
1
+ //#region ../../node_modules/.pnpm/whenexpr@0.1.2/node_modules/whenexpr/dist/index.d.mts
2
2
  //#region src/paths.d.ts
3
3
  /**
4
4
  * Union of valid context paths for `T` — both flat keys (`keyof T`) and
@@ -1,4 +1,4 @@
1
- //#region ../../../node_modules/.pnpm/whenexpr@0.1.2/node_modules/whenexpr/dist/index.mjs
1
+ //#region ../../node_modules/.pnpm/whenexpr@0.1.2/node_modules/whenexpr/dist/index.mjs
2
2
  const OPS = [
3
3
  "===",
4
4
  "!==",
@@ -1,4 +1,4 @@
1
- import { g as RpcFunctionDefinitionAny } from "./types-4rdUEi2R.mjs";
1
+ import { _ as RpcFunctionDefinitionAny } from "./types-ip8THGH1.mjs";
2
2
  import { ChannelOptions } from "birpc";
3
3
 
4
4
  //#region src/rpc/transports/ws-client.d.ts
@@ -1,4 +1,4 @@
1
- import { g as RpcFunctionDefinitionAny } from "./types-4rdUEi2R.mjs";
1
+ import { _ as RpcFunctionDefinitionAny } from "./types-ip8THGH1.mjs";
2
2
  import { BirpcGroup, ChannelOptions } from "birpc";
3
3
  import { ServerOptions } from "node:https";
4
4
  import { WebSocket, WebSocketServer } from "ws";