devframe 0.8.2 → 0.9.0-beta.10

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 (127) hide show
  1. package/dist/_shared-BPmX9fqK.d.mts +41 -0
  2. package/dist/_shared-CbZ_yhbz.mjs +68 -0
  3. package/dist/adapters/build.d.mts +10 -12
  4. package/dist/adapters/build.mjs +26 -29
  5. package/dist/adapters/cac.d.mts +1 -1
  6. package/dist/adapters/cac.mjs +156 -1
  7. package/dist/adapters/dev.d.mts +38 -46
  8. package/dist/adapters/dev.mjs +2 -1
  9. package/dist/adapters/embedded.d.mts +1 -1
  10. package/dist/adapters/initiate.d.mts +224 -0
  11. package/dist/adapters/initiate.mjs +2 -0
  12. package/dist/adapters/mcp.d.mts +24 -7
  13. package/dist/adapters/mcp.mjs +2 -2
  14. package/dist/{agent-tool-name-C3b5vEwJ.mjs → agent-tool-name-EgfoFO8C.mjs} +0 -3
  15. package/dist/cli/main.d.mts +0 -2
  16. package/dist/cli/main.mjs +4 -8
  17. package/dist/client/index.d.mts +71 -7
  18. package/dist/client/index.mjs +720 -1540
  19. package/dist/constants.d.mts +28 -7
  20. package/dist/constants.mjs +28 -7
  21. package/dist/{context-DoSozfvx.d.mts → context-B3YUu_95.d.mts} +19 -1
  22. package/dist/{host-h3-D2hYZvDK.mjs → context-CEe4PBz1.mjs} +25 -557
  23. package/dist/{context-CBg8iRbQ.mjs → context-xdynGSLP.mjs} +10 -1
  24. package/dist/dev--rAPzbvO.mjs +239 -0
  25. package/dist/{devframe-mQ4qZAuo.d.mts → devframe-DJMg0WLe.d.mts} +181 -134
  26. package/dist/{diagnostics-hwjXp_UV.mjs → diagnostics-CD8nlgll.mjs} +1 -3
  27. package/dist/{diagnostics-D7wM2cwM.mjs → diagnostics-DOQPnQmX.mjs} +51 -5
  28. package/dist/dist-eNI9qM_I.mjs +228 -0
  29. package/dist/host-agent-xLCSe65D.mjs +264 -0
  30. package/dist/host-h3-Crkzm42q.mjs +26 -0
  31. package/dist/{fetch-BKaD0Vb3.mjs → http-DYpK0cUi.mjs} +42 -11
  32. package/dist/{index-b64Uuhy2.d.mts → index-CB-fSUyn.d.mts} +2 -2
  33. package/dist/{index-Dbw1p5ch.d.mts → index-tdrk1bzV.d.mts} +3 -32
  34. package/dist/index.d.mts +12 -5
  35. package/dist/index.mjs +8 -1
  36. package/dist/{instance-registry-BnnA2Eoh.mjs → instance-registry-WvQkt42E.mjs} +9 -8
  37. package/dist/instance-shell-CMFyszWJ.mjs +486 -0
  38. package/dist/instance-shell-CljiKq1c.d.mts +255 -0
  39. package/dist/internal/index.d.mts +397 -0
  40. package/dist/internal/index.mjs +9 -0
  41. package/dist/node/auth.d.mts +2 -2
  42. package/dist/node/auth.mjs +1 -1
  43. package/dist/node/hub-internals.d.mts +2 -14
  44. package/dist/node/hub-internals.mjs +2 -2
  45. package/dist/node/index.d.mts +4 -268
  46. package/dist/node/index.mjs +3 -5
  47. package/dist/nostics-CzECRXpE.mjs +59 -0
  48. package/dist/nostics-SPGDgHEP.d.mts +33 -0
  49. package/dist/recipes/common-rpc-functions.d.mts +4 -4
  50. package/dist/recipes/interactive-auth.d.mts +3 -3
  51. package/dist/recipes/interactive-auth.mjs +8 -8
  52. package/dist/remote-assets-Bg4gCUZ_.d.mts +123 -0
  53. package/dist/remote-assets-nTTxY2MU.mjs +636 -0
  54. package/dist/rolldown-runtime-JspESFgx.mjs +35 -0
  55. package/dist/rpc/dump.d.mts +77 -1
  56. package/dist/rpc/dump.mjs +1 -1
  57. package/dist/rpc/index.d.mts +3 -3
  58. package/dist/rpc/index.mjs +4 -18
  59. package/dist/rpc/transports/sse-client.d.mts +2 -0
  60. package/dist/rpc/transports/sse-client.mjs +142 -0
  61. package/dist/rpc/transports/sse-server.d.mts +61 -0
  62. package/dist/rpc/transports/sse-server.mjs +209 -0
  63. package/dist/rpc/transports/ws-bun.d.mts +35 -0
  64. package/dist/rpc/transports/ws-bun.mjs +31 -0
  65. package/dist/rpc/transports/ws-client.d.mts +1 -1
  66. package/dist/rpc/transports/ws-client.mjs +10 -18
  67. package/dist/rpc/transports/ws-server.d.mts +2 -2
  68. package/dist/rpc/transports/ws-server.mjs +2 -235
  69. package/dist/rpc-core-Cc4lucI0.d.mts +48 -0
  70. package/dist/rpc-core-DMTe-hLo.mjs +81 -0
  71. package/dist/{serialization-C8Mnw9hK.mjs → serialization-BGzEwAdr.mjs} +2 -2
  72. package/dist/{shared-state-6kHolYZy.mjs → shared-state-fRRbRUtD.mjs} +1 -1
  73. package/dist/sse-client-CFBOIaUi.d.mts +37 -0
  74. package/dist/state-Cc1IeSmQ.mjs +1291 -0
  75. package/dist/{dump-CgZShDRB.mjs → static-BPZ1_OPA.mjs} +3 -266
  76. package/dist/storage-CYye7P7L.mjs +137 -0
  77. package/dist/types/index.d.mts +6 -4
  78. package/dist/types/index.mjs +1 -6
  79. package/dist/{types-CnJSgRVa.d.mts → types-Djq7CBXh.d.mts} +0 -7
  80. package/dist/utils/agent-tool-name.d.mts +0 -3
  81. package/dist/utils/agent-tool-name.mjs +0 -3
  82. package/dist/utils/events.d.mts +1 -1
  83. package/dist/utils/get-port.d.mts +17 -0
  84. package/dist/utils/get-port.mjs +2 -0
  85. package/dist/utils/launch-editor.mjs +1 -25
  86. package/dist/utils/nostics.d.mts +2 -0
  87. package/dist/utils/nostics.mjs +2 -0
  88. package/dist/utils/open.d.mts +2 -10
  89. package/dist/utils/open.mjs +56 -1
  90. package/dist/utils/remote-assets.d.mts +15 -0
  91. package/dist/utils/remote-assets.mjs +2 -0
  92. package/dist/utils/serve-static.d.mts +13 -5
  93. package/dist/utils/serve-static.mjs +119 -9
  94. package/dist/utils/shared-state.d.mts +1 -1
  95. package/dist/utils/shared-state.mjs +1 -1
  96. package/dist/utils/simple-schema.d.mts +101 -1
  97. package/dist/utils/streaming-channel.d.mts +1 -1
  98. package/dist/validation-CpXFB6Dz.mjs +266 -0
  99. package/dist/wire-codec-0K-o5MYW.mjs +56 -0
  100. package/dist/{ws-client-B6Tnr0ic.d.mts → ws-client-DhjNyQo3.d.mts} +7 -2
  101. package/dist/ws-server-BdSLrhxE.mjs +267 -0
  102. package/dist/{ws-server-uKQcClcJ.d.mts → ws-server-D1d3QM9f.d.mts} +90 -9
  103. package/package.json +13 -12
  104. package/skills/devframe/SKILL.md +91 -93
  105. package/dist/_shared-bWRzeSa0.mjs +0 -19
  106. package/dist/adapters/cli.d.mts +0 -11
  107. package/dist/adapters/cli.mjs +0 -6
  108. package/dist/cac-D4_9ok0z.mjs +0 -157
  109. package/dist/dev-Bc49u3qg.mjs +0 -439
  110. package/dist/diagnostics-reporter-CsIG85Q5.mjs +0 -38
  111. package/dist/helpers/vite.d.mts +0 -100
  112. package/dist/helpers/vite.mjs +0 -105
  113. package/dist/http-C4T68YV6.mjs +0 -38
  114. package/dist/index-vAX6bYuc.d.mts +0 -78
  115. package/dist/open-Deb5xmIT.mjs +0 -547
  116. package/dist/recipes/open-helpers.d.mts +0 -6
  117. package/dist/recipes/open-helpers.mjs +0 -6
  118. package/dist/server-CD8XmBXl.mjs +0 -167
  119. package/dist/server-UHWae43Q.d.mts +0 -149
  120. package/dist/simple-schema-BDzLeJDk.d.mts +0 -102
  121. package/dist/state-BeUHDDjk.mjs +0 -108
  122. package/dist/storage-CTNVbuFB.mjs +0 -1122
  123. package/dist/utils/promise.d.mts +0 -8
  124. package/dist/utils/promise.mjs +0 -15
  125. package/dist/utils/scope.d.mts +0 -11
  126. package/dist/utils/scope.mjs +0 -15
  127. package/skills/devframe/templates/spa-devframe.ts +0 -38
@@ -1,132 +1,6 @@
1
- import { t as diagnostics } from "./diagnostics-hwjXp_UV.mjs";
1
+ import { n as validateDefinitions, r as getRpcHandler, s as hash } from "./validation-CpXFB6Dz.mjs";
2
+ import { t as diagnostics } from "./diagnostics-CD8nlgll.mjs";
2
3
  import { DEVFRAME_RPC_DUMP_DIRNAME } from "./constants.mjs";
3
- import { createHash } from "node:crypto";
4
- //#region ../../node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/shared/ohash.D__AXeF1.mjs
5
- function serialize(o) {
6
- return typeof o == "string" ? `'${o}'` : new c().serialize(o);
7
- }
8
- const c = /*@__PURE__*/ function() {
9
- class o {
10
- #t = /* @__PURE__ */ new Map();
11
- compare(t, r) {
12
- const e = typeof t, n = typeof r;
13
- return e === "string" && n === "string" ? t.localeCompare(r) : e === "number" && n === "number" ? t - r : String.prototype.localeCompare.call(this.serialize(t, true), this.serialize(r, true));
14
- }
15
- serialize(t, r) {
16
- if (t === null) return "null";
17
- switch (typeof t) {
18
- case "string": return r ? t : `'${t}'`;
19
- case "bigint": return `${t}n`;
20
- case "object": return this.$object(t);
21
- case "function": return this.$function(t);
22
- }
23
- return String(t);
24
- }
25
- serializeObject(t) {
26
- const r = Object.prototype.toString.call(t);
27
- if (r !== "[object Object]") return this.serializeBuiltInType(r.length < 10 ? `unknown:${r}` : r.slice(8, -1), t);
28
- const e = t.constructor, n = e === Object || e === void 0 ? "" : e.name;
29
- if (n !== "" && globalThis[n] === e) return this.serializeBuiltInType(n, t);
30
- if (typeof t.toJSON == "function") {
31
- const i = t.toJSON();
32
- return n + (i !== null && typeof i == "object" ? this.$object(i) : `(${this.serialize(i)})`);
33
- }
34
- return this.serializeObjectEntries(n, Object.entries(t));
35
- }
36
- serializeBuiltInType(t, r) {
37
- const e = this["$" + t];
38
- if (e) return e.call(this, r);
39
- if (typeof r?.entries == "function") return this.serializeObjectEntries(t, r.entries());
40
- throw new Error(`Cannot serialize ${t}`);
41
- }
42
- serializeObjectEntries(t, r) {
43
- const e = Array.from(r).sort((i, a) => this.compare(i[0], a[0]));
44
- let n = `${t}{`;
45
- for (let i = 0; i < e.length; i++) {
46
- const [a, l] = e[i];
47
- n += `${this.serialize(a, true)}:${this.serialize(l)}`, i < e.length - 1 && (n += ",");
48
- }
49
- return n + "}";
50
- }
51
- $object(t) {
52
- let r = this.#t.get(t);
53
- return r === void 0 && (this.#t.set(t, `#${this.#t.size}`), r = this.serializeObject(t), this.#t.set(t, r)), r;
54
- }
55
- $function(t) {
56
- const r = Function.prototype.toString.call(t);
57
- return r.slice(-15) === "[native code] }" ? `${t.name || ""}()[native]` : `${t.name}(${t.length})${r.replace(/\s*\n\s*/g, "")}`;
58
- }
59
- $Array(t) {
60
- let r = "[";
61
- for (let e = 0; e < t.length; e++) r += this.serialize(t[e]), e < t.length - 1 && (r += ",");
62
- return r + "]";
63
- }
64
- $Date(t) {
65
- try {
66
- return `Date(${t.toISOString()})`;
67
- } catch {
68
- return "Date(null)";
69
- }
70
- }
71
- $ArrayBuffer(t) {
72
- return `ArrayBuffer[${new Uint8Array(t).join(",")}]`;
73
- }
74
- $Set(t) {
75
- return `Set${this.$Array(Array.from(t).sort((r, e) => this.compare(r, e)))}`;
76
- }
77
- $Map(t) {
78
- return this.serializeObjectEntries("Map", t.entries());
79
- }
80
- }
81
- for (const s of [
82
- "Error",
83
- "RegExp",
84
- "URL"
85
- ]) o.prototype["$" + s] = function(t) {
86
- return `${s}(${t})`;
87
- };
88
- for (const s of [
89
- "Int8Array",
90
- "Uint8Array",
91
- "Uint8ClampedArray",
92
- "Int16Array",
93
- "Uint16Array",
94
- "Int32Array",
95
- "Uint32Array",
96
- "Float32Array",
97
- "Float64Array"
98
- ]) o.prototype["$" + s] = function(t) {
99
- return `${s}[${t.join(",")}]`;
100
- };
101
- for (const s of ["BigInt64Array", "BigUint64Array"]) o.prototype["$" + s] = function(t) {
102
- return `${s}[${t.join("n,")}${t.length > 0 ? "n" : ""}]`;
103
- };
104
- return o;
105
- }();
106
- //#endregion
107
- //#region ../../node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/crypto/node/index.mjs
108
- const e = globalThis.process?.getBuiltinModule?.("crypto")?.hash;
109
- const r = "sha256";
110
- const s = "base64url";
111
- function digest(t) {
112
- if (e) return e(r, t, s);
113
- const o = createHash(r).update(t);
114
- return globalThis.process?.versions?.webcontainer ? o.digest().toString(s) : o.digest(s);
115
- }
116
- //#endregion
117
- //#region ../../node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/index.mjs
118
- function hash$1(input) {
119
- return digest(serialize(input));
120
- }
121
- //#endregion
122
- //#region src/utils/hash.ts
123
- /**
124
- * Stable, deterministic hash of any structured-cloneable value.
125
- */
126
- function hash(value) {
127
- return hash$1(value);
128
- }
129
- //#endregion
130
4
  //#region ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
131
5
  var Node = class {
132
6
  value;
@@ -254,35 +128,6 @@ function validateConcurrency(concurrency) {
254
128
  if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) throw new TypeError("Expected `concurrency` to be a number from 1 and up");
255
129
  }
256
130
  //#endregion
257
- //#region src/rpc/validation.ts
258
- /**
259
- * Validates RPC function definitions.
260
- * Action and event functions cannot have dumps (side effects should not be cached).
261
- *
262
- * @throws {Error} If an action or event function has a dump configuration
263
- */
264
- function validateDefinitions(definitions) {
265
- for (const definition of definitions) {
266
- const type = definition.type || "query";
267
- if ((type === "action" || type === "event") && definition.dump) throw diagnostics.DF0027({
268
- name: definition.name,
269
- type
270
- });
271
- if (definition.snapshot && type !== "query") throw diagnostics.DF0028({
272
- name: definition.name,
273
- type
274
- });
275
- }
276
- }
277
- /**
278
- * Validates a single RPC function definition.
279
- *
280
- * @throws {Error} If an action or event function has a dump configuration
281
- */
282
- function validateDefinition(definition) {
283
- validateDefinitions([definition]);
284
- }
285
- //#endregion
286
131
  //#region src/rpc/dump/error.ts
287
132
  /**
288
133
  * Normalize a thrown value into a plain object suitable for storage in
@@ -498,114 +343,6 @@ function getDefinitionsWithDumps(definitions) {
498
343
  return definitions.filter((def) => def.dump !== void 0);
499
344
  }
500
345
  //#endregion
501
- //#region src/rpc/validate-io.ts
502
- /**
503
- * Run a single [Standard Schema](https://standardschema.dev) validator,
504
- * awaiting the result when the validator is asynchronous.
505
- */
506
- async function runStandardSchema(schema, value) {
507
- const result = schema["~standard"].validate(value);
508
- return result instanceof Promise ? await result : result;
509
- }
510
- /**
511
- * Render Standard Schema issues into a single human-readable line for a
512
- * diagnostic message, prefixing each with its dotted path when present.
513
- */
514
- function formatIssues(issues) {
515
- return issues.map((issue) => {
516
- const path = issue.path?.map((segment) => typeof segment === "object" ? segment.key : segment).join(".");
517
- return path ? `${path}: ${issue.message}` : issue.message;
518
- }).join("; ");
519
- }
520
- /**
521
- * Validate positional arguments against their declared schemas. Only
522
- * indices with a schema are checked; extra arguments pass through
523
- * untouched. Throws `DF0038` on the first failing argument.
524
- *
525
- * Validation guards the payload without rewriting it: the original values
526
- * are handed to the handler unchanged, so a schema that describes a subset
527
- * of an object never silently strips the sender's extra fields (and any
528
- * declared transforms stay a purely type-level concern).
529
- *
530
- * @internal
531
- */
532
- async function validateRpcArgs(name, argsSchema, args) {
533
- const original = args.slice();
534
- if (!argsSchema || argsSchema.length === 0) return original;
535
- for (let index = 0; index < argsSchema.length; index++) {
536
- const schema = argsSchema[index];
537
- if (!schema) continue;
538
- const result = await runStandardSchema(schema, args[index]);
539
- if (result.issues) throw diagnostics.DF0043({
540
- name,
541
- index,
542
- issues: formatIssues(result.issues)
543
- });
544
- }
545
- return original;
546
- }
547
- /**
548
- * Validate a handler's resolved return value against its declared schema.
549
- * Throws `DF0039` when the value fails the schema, otherwise returns the
550
- * original value unchanged (guard-only, never rewriting the payload — see
551
- * {@link validateRpcArgs}). Passes through when no return schema is set.
552
- *
553
- * @internal
554
- */
555
- async function validateRpcReturn(name, returnSchema, value) {
556
- if (!returnSchema) return value;
557
- const result = await runStandardSchema(returnSchema, value);
558
- if (result.issues) throw diagnostics.DF0044({
559
- name,
560
- issues: formatIssues(result.issues)
561
- });
562
- return value;
563
- }
564
- //#endregion
565
- //#region src/rpc/handler.ts
566
- async function getRpcResolvedSetupResult(definition, context) {
567
- if (!definition.setup) return {};
568
- if (typeof context === "object" && context !== null) {
569
- definition.__cache ??= /* @__PURE__ */ new WeakMap();
570
- const cache = definition.__cache;
571
- let promise = cache.get(context);
572
- if (!promise) {
573
- promise = Promise.resolve(definition.setup(context));
574
- promise.catch(() => {
575
- if (cache.get(context) === promise) cache.delete(context);
576
- });
577
- cache.set(context, promise);
578
- }
579
- return await promise;
580
- }
581
- if (!definition.__promise) {
582
- const promise = Promise.resolve(definition.setup(context));
583
- promise.catch(() => {
584
- if (definition.__promise === promise) definition.__promise = void 0;
585
- });
586
- definition.__promise = promise;
587
- }
588
- return await definition.__promise;
589
- }
590
- async function getRpcHandler(definition, context) {
591
- let handler = definition.handler;
592
- if (!handler) {
593
- const result = await getRpcResolvedSetupResult(definition, context);
594
- if (!result.handler) throw diagnostics.DF0024({ name: definition.name });
595
- handler = result.handler;
596
- }
597
- const argsSchema = definition.args;
598
- const returnSchema = definition.returns;
599
- if (!argsSchema && !returnSchema) return handler;
600
- const inner = handler;
601
- const validating = async (...args) => {
602
- const validatedArgs = await validateRpcArgs(definition.name, argsSchema, args);
603
- const output = await inner(...validatedArgs);
604
- return await validateRpcReturn(definition.name, returnSchema, output);
605
- };
606
- return validating;
607
- }
608
- //#endregion
609
346
  //#region src/rpc/dump/static.ts
610
347
  function makeDumpKey(name) {
611
348
  return encodeURIComponent(name.replaceAll(":", "~"));
@@ -683,4 +420,4 @@ async function collectStaticRpcDump(definitions, context) {
683
420
  };
684
421
  }
685
422
  //#endregion
686
- export { validateRpcReturn as a, getDefinitionsWithDumps as c, validateDefinition as d, validateDefinitions as f, validateRpcArgs as i, reviveDumpError as l, getRpcHandler as n, createClientFromDump as o, hash as p, getRpcResolvedSetupResult as r, dumpFunctions as s, collectStaticRpcDump as t, serializeDumpError as u };
423
+ export { reviveDumpError as a, getDefinitionsWithDumps as i, createClientFromDump as n, serializeDumpError as o, dumpFunctions as r, collectStaticRpcDump as t };
@@ -0,0 +1,137 @@
1
+ import { t as diagnostics } from "./diagnostics-DOQPnQmX.mjs";
2
+ import { createSharedState } from "devframe/utils/shared-state";
3
+ import fs from "node:fs";
4
+ import { dirname } from "pathe";
5
+ import process from "node:process";
6
+ //#region ../../node_modules/.pnpm/perfect-debounce@2.1.0/node_modules/perfect-debounce/dist/index.mjs
7
+ const DEBOUNCE_DEFAULTS = { trailing: true };
8
+ /**
9
+ Debounce functions
10
+ @param fn - Promise-returning/async function to debounce.
11
+ @param wait - Milliseconds to wait before calling `fn`. Default value is 25ms
12
+ @returns A function that delays calling `fn` until after `wait` milliseconds have elapsed since the last time it was called.
13
+ @example
14
+ ```
15
+ import { debounce } from 'perfect-debounce';
16
+ const expensiveCall = async input => input;
17
+ const debouncedFn = debounce(expensiveCall, 200);
18
+ for (const number of [1, 2, 3]) {
19
+ console.log(await debouncedFn(number));
20
+ }
21
+ //=> 1
22
+ //=> 2
23
+ //=> 3
24
+ ```
25
+ */
26
+ function debounce(fn, wait = 25, options = {}) {
27
+ options = {
28
+ ...DEBOUNCE_DEFAULTS,
29
+ ...options
30
+ };
31
+ if (!Number.isFinite(wait)) throw new TypeError("Expected `wait` to be a finite number");
32
+ let leadingValue;
33
+ let timeout;
34
+ let resolveList = [];
35
+ let currentPromise;
36
+ let trailingArgs;
37
+ const applyFn = (_this, args) => {
38
+ currentPromise = _applyPromised(fn, _this, args);
39
+ currentPromise.finally(() => {
40
+ currentPromise = null;
41
+ if (options.trailing && trailingArgs && !timeout) {
42
+ const promise = applyFn(_this, trailingArgs);
43
+ trailingArgs = null;
44
+ return promise;
45
+ }
46
+ });
47
+ return currentPromise;
48
+ };
49
+ const debounced = function(...args) {
50
+ if (options.trailing) trailingArgs = args;
51
+ if (currentPromise) return currentPromise;
52
+ return new Promise((resolve) => {
53
+ const shouldCallNow = !timeout && options.leading;
54
+ clearTimeout(timeout);
55
+ timeout = setTimeout(() => {
56
+ timeout = null;
57
+ const promise = options.leading ? leadingValue : applyFn(this, args);
58
+ trailingArgs = null;
59
+ for (const _resolve of resolveList) _resolve(promise);
60
+ resolveList = [];
61
+ }, wait);
62
+ if (shouldCallNow) {
63
+ leadingValue = applyFn(this, args);
64
+ resolve(leadingValue);
65
+ } else resolveList.push(resolve);
66
+ });
67
+ };
68
+ const _clearTimeout = (timer) => {
69
+ if (timer) {
70
+ clearTimeout(timer);
71
+ timeout = null;
72
+ }
73
+ };
74
+ debounced.isPending = () => !!timeout;
75
+ debounced.cancel = () => {
76
+ _clearTimeout(timeout);
77
+ resolveList = [];
78
+ trailingArgs = null;
79
+ };
80
+ debounced.flush = () => {
81
+ _clearTimeout(timeout);
82
+ if (!trailingArgs || currentPromise) return;
83
+ const args = trailingArgs;
84
+ trailingArgs = null;
85
+ return applyFn(this, args);
86
+ };
87
+ return debounced;
88
+ }
89
+ async function _applyPromised(fn, _this, args) {
90
+ return await fn.apply(_this, args);
91
+ }
92
+ //#endregion
93
+ //#region src/node/storage.ts
94
+ function safeJsonParse(text) {
95
+ return JSON.parse(text, (key, value) => {
96
+ if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) return void 0;
97
+ return value;
98
+ });
99
+ }
100
+ function createStorage(options) {
101
+ const { mergeInitialValue = (initialValue, savedValue) => ({
102
+ ...initialValue,
103
+ ...savedValue
104
+ }), debounce: debounceTime = 100 } = options;
105
+ let initialValue = options.initialValue;
106
+ if (fs.existsSync(options.filepath)) try {
107
+ const savedValue = safeJsonParse(fs.readFileSync(options.filepath, "utf-8"));
108
+ initialValue = mergeInitialValue ? mergeInitialValue(options.initialValue, savedValue) : savedValue;
109
+ } catch (error) {
110
+ diagnostics.DF0012({
111
+ filepath: options.filepath,
112
+ cause: error
113
+ }, { method: "warn" });
114
+ initialValue = options.initialValue;
115
+ }
116
+ const state = createSharedState({
117
+ initialValue,
118
+ enablePatches: false
119
+ });
120
+ state.on("updated", debounce((newState) => {
121
+ try {
122
+ const dir = dirname(options.filepath);
123
+ fs.mkdirSync(dir, { recursive: true });
124
+ const tmp = `${options.filepath}.${process.pid}.tmp`;
125
+ fs.writeFileSync(tmp, `${JSON.stringify(newState, null, 2)}\n`);
126
+ fs.renameSync(tmp, options.filepath);
127
+ } catch (error) {
128
+ diagnostics.DF0035({
129
+ filepath: options.filepath,
130
+ cause: error
131
+ }, { method: "error" });
132
+ }
133
+ }, debounceTime));
134
+ return state;
135
+ }
136
+ //#endregion
137
+ export { createStorage as t };
@@ -1,4 +1,6 @@
1
- import { $ as DevframeRpcServerFunctions, A as DevframeSettingsStore, At as DevframeAgentHostEvents, B as DevframeDefineDiagnosticsOptions, C as DevframeServicesHost, Ct as AgentResourceContent, D as DevframeScopedStreamingHost, Dt as AgentToolProvider, E as DevframeScopedNodeRpc, Et as AgentToolInput, F as ScopedSharedStates, G as RpcBroadcastOptions, H as DevframeDiagnosticsHost, I as SettingsForNamespace, J as RpcSharedStateHost, K as RpcFunctionsHost, L as DevframeViewHost, M as ScopedClientFunctions, Mt as EventUnsubscribe, N as ScopedRpcFn, Nt as EventsMap, O as DevframeSettings, Ot as AgentToolProviderHandle, P as ScopedServerFunctions, Q as DevframeRpcClientFunctions, R as DevframeHost, S as DevframeServiceOf, St as AgentResource, T as DevframeScopedNodeContext, Tt as AgentTool, U as DevframeDiagnosticsLogger, V as DevframeDiagnosticsDefinition, W as DevframeNodeRpcSession, X as RpcStreamingChannelOptions, Y as RpcStreamingChannel, Z as RpcStreamingHost, _ as ConnectionMeta, a as DevframeDockDefaults, b as DevframeNodeContext, bt as AgentHandle, c as DevframeSetupInfo, d as McpRouteOptions, et as DevframeRpcSharedStates, f as defineDevframe, g as Thenable, h as PartialWithoutId, i as DevframeDeploymentKind, j as ScopedBroadcastOptions, jt as EventEmitter, k as DevframeSettingsRegistry, kt as DevframeAgentHost, l as DevframeSpaOptions, m as EntriesToObject, n as DevframeCliOptions, o as DevframeDuplicationStrategy, q as RpcSharedStateGetOptions, r as DevframeDefinition, s as DevframeRuntime, t as DevframeBrowserContext, u as DevframeWsOptions, v as ConnectionMetaWebsocket, w as DevframeServicesRegistry, wt as AgentResourceInput, x as DevframeServiceId, xt as AgentManifest, y as DevframeCapabilities, z as DevframeStorageScope } from "../devframe-mQ4qZAuo.mjs";
2
- import { g as RpcFunctionAgentOptions } from "../types-CnJSgRVa.mjs";
3
- import { n as DevframeNodeRpcSessionMeta } from "../ws-server-uKQcClcJ.mjs";
4
- export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, AgentToolProvider, AgentToolProviderHandle, ConnectionMeta, ConnectionMetaWebsocket, DevframeAgentHost, DevframeAgentHostEvents, DevframeBrowserContext, DevframeCapabilities, DevframeCliOptions, DevframeDefineDiagnosticsOptions, DevframeDefinition, DevframeDeploymentKind, DevframeDiagnosticsDefinition, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeDockDefaults, DevframeDuplicationStrategy, DevframeHost, DevframeNodeContext, DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, DevframeRpcClientFunctions, DevframeRpcServerFunctions, DevframeRpcSharedStates, DevframeRuntime, DevframeScopedNodeContext, DevframeScopedNodeRpc, DevframeScopedStreamingHost, DevframeServiceId, DevframeServiceOf, DevframeServicesHost, DevframeServicesRegistry, DevframeSettings, DevframeSettingsRegistry, DevframeSettingsStore, DevframeSetupInfo, DevframeSpaOptions, DevframeStorageScope, DevframeViewHost, DevframeWsOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, McpRouteOptions, PartialWithoutId, RpcBroadcastOptions, type RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, ScopedBroadcastOptions, ScopedClientFunctions, ScopedRpcFn, ScopedServerFunctions, ScopedSharedStates, SettingsForNamespace, Thenable, defineDevframe };
1
+ import { A as ScopedServerFunctions, B as RpcFunctionsHost, C as DevframeScopedStreamingHost, Ct as DevframeAgentHost, D as ScopedBroadcastOptions, Dt as EventsMap, E as DevframeSettingsStore, Et as EventUnsubscribe, F as DevframeStorageScope, G as RpcStreamingHost, H as RpcSharedStateHost, I as DevframeDiagnosticsHost, J as DevframeRpcSharedStates, K as DevframeRpcClientFunctions, L as DevframeDiagnosticsLogger, M as SettingsForNamespace, N as DevframeViewHost, O as ScopedClientFunctions, P as DevframeHost, R as DevframeNodeRpcSession, S as DevframeScopedNodeRpc, St as AgentToolProviderHandle, T as DevframeSettingsRegistry, Tt as EventEmitter, U as RpcStreamingChannel, V as RpcSharedStateGetOptions, W as RpcStreamingChannelOptions, _ as DevframeServiceId, _t as AgentResourceContent, a as DevframeDuplicationStrategy, b as DevframeServicesRegistry, bt as AgentToolInput, c as DevframeWsOptions, d as ConnectionMeta, f as ConnectionMetaSse, g as DevframeNodeContext, gt as AgentResource, h as DevframeConnectionConfigsRegistry, ht as AgentManifest, i as DevframeDockDefaults, j as ScopedSharedStates, k as ScopedRpcFn, l as McpRouteOptions, m as DevframeCapabilities, mt as AgentHandle, n as DevframeDefinition, o as DevframeSetupInfo, p as ConnectionMetaWebsocket, q as DevframeRpcServerFunctions, r as DevframeDeploymentKind, s as DevframeSseOptions, t as DevframeCliOptions, v as DevframeServiceOf, vt as AgentResourceInput, w as DevframeSettings, wt as DevframeAgentHostEvents, x as DevframeScopedNodeContext, xt as AgentToolProvider, y as DevframeServicesHost, yt as AgentTool, z as RpcBroadcastOptions } from "../devframe-DJMg0WLe.mjs";
2
+ import { g as RpcFunctionAgentOptions } from "../types-Djq7CBXh.mjs";
3
+ import { d as DevframeRpcConnection, f as DevframeRpcConnectionRequest, p as DevframeRpcTransportKind, u as DevframeNodeRpcSessionMeta } from "../ws-server-D1d3QM9f.mjs";
4
+ import { i as DevframeDefineDiagnosticsOptions } from "../nostics-SPGDgHEP.mjs";
5
+ import { a as RemoteAssetsStore, i as RemoteAssetsProviderCustom, n as RemoteAssetsErrorMessage, o as StaticAssetsSource, r as RemoteAssetsProvider, t as RemoteAssets } from "../remote-assets-Bg4gCUZ_.mjs";
6
+ export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, AgentToolProvider, AgentToolProviderHandle, ConnectionMeta, ConnectionMetaSse, ConnectionMetaWebsocket, DevframeAgentHost, DevframeAgentHostEvents, DevframeCapabilities, DevframeCliOptions, DevframeConnectionConfigsRegistry, type DevframeDefineDiagnosticsOptions, DevframeDefinition, DevframeDeploymentKind, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeDockDefaults, DevframeDuplicationStrategy, DevframeHost, DevframeNodeContext, DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, DevframeRpcClientFunctions, type DevframeRpcConnection, type DevframeRpcConnectionRequest, DevframeRpcServerFunctions, DevframeRpcSharedStates, type DevframeRpcTransportKind, DevframeScopedNodeContext, DevframeScopedNodeRpc, DevframeScopedStreamingHost, DevframeServiceId, DevframeServiceOf, DevframeServicesHost, DevframeServicesRegistry, DevframeSettings, DevframeSettingsRegistry, DevframeSettingsStore, DevframeSetupInfo, DevframeSseOptions, DevframeStorageScope, DevframeViewHost, DevframeWsOptions, EventEmitter, EventUnsubscribe, EventsMap, McpRouteOptions, RemoteAssets, RemoteAssetsErrorMessage, RemoteAssetsProvider, RemoteAssetsProviderCustom, RemoteAssetsStore, RpcBroadcastOptions, type RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, ScopedBroadcastOptions, ScopedClientFunctions, ScopedRpcFn, ScopedServerFunctions, ScopedSharedStates, SettingsForNamespace, StaticAssetsSource };
@@ -1,6 +1 @@
1
- //#region src/types/devframe.ts
2
- function defineDevframe(d) {
3
- return d;
4
- }
5
- //#endregion
6
- export { defineDevframe };
1
+ export {};
@@ -24,9 +24,6 @@ type RpcFunctionType = 'static' | 'action' | 'event' | 'query';
24
24
  * the function is surfaced to agents (e.g. via the devframe MCP adapter)
25
25
  * as a callable tool. Functions without an `agent` field are not exposed —
26
26
  * default-deny.
27
- *
28
- * @experimental The agent-native surface is experimental and may change
29
- * without a major version bump until it stabilizes.
30
27
  */
31
28
  interface RpcFunctionAgentOptions {
32
29
  /**
@@ -233,8 +230,6 @@ type RpcFunctionDefinition<NAME extends string, TYPE extends RpcFunctionType = '
233
230
  /**
234
231
  * Expose this function to agents (e.g. via the MCP adapter).
235
232
  * When omitted, the function is not agent-exposed (default-deny).
236
- *
237
- * @experimental
238
233
  */
239
234
  agent?: RpcFunctionAgentOptions;
240
235
  /** Setup function called with context to initialize handler and dump */
@@ -280,8 +275,6 @@ type RpcFunctionDefinition<NAME extends string, TYPE extends RpcFunctionType = '
280
275
  /**
281
276
  * Expose this function to agents (e.g. via the MCP adapter).
282
277
  * When omitted, the function is not agent-exposed (default-deny).
283
- *
284
- * @experimental
285
278
  */
286
279
  agent?: RpcFunctionAgentOptions;
287
280
  /** Setup function called with context to initialize handler and dump */
@@ -18,9 +18,6 @@
18
18
  * A plain string transform with no node dependency, so browser-side UIs
19
19
  * that display a tool's id (e.g. the inspect plugin's agent view) can
20
20
  * import it too and show the name a client actually calls.
21
- *
22
- * @experimental The agent-native surface is experimental and may change
23
- * without a major version bump until it stabilizes.
24
21
  */
25
22
  declare function toAgentToolName(id: string): string;
26
23
  //#endregion
@@ -23,9 +23,6 @@ const MAX_TOOL_NAME_LENGTH = 128;
23
23
  * A plain string transform with no node dependency, so browser-side UIs
24
24
  * that display a tool's id (e.g. the inspect plugin's agent view) can
25
25
  * import it too and show the name a client actually calls.
26
- *
27
- * @experimental The agent-native surface is experimental and may change
28
- * without a major version bump until it stabilizes.
29
26
  */
30
27
  function toAgentToolName(id) {
31
28
  return id.replace(/[^\w-]+/g, "_").slice(0, MAX_TOOL_NAME_LENGTH);
@@ -1,4 +1,4 @@
1
- import { Nt as EventsMap, jt as EventEmitter } from "../devframe-mQ4qZAuo.mjs";
1
+ import { Dt as EventsMap, Tt as EventEmitter } from "../devframe-DJMg0WLe.mjs";
2
2
  //#region src/utils/events.d.ts
3
3
  /**
4
4
  * Create event emitter.
@@ -0,0 +1,17 @@
1
+ //#region ../../node_modules/.pnpm/get-port-please@3.2.0/node_modules/get-port-please/dist/index.d.mts
2
+ interface GetPortOptions {
3
+ name: string;
4
+ random: boolean;
5
+ port: number;
6
+ ports: number[];
7
+ portRange: [fromInclusive: number, toInclusive: number];
8
+ alternativePortRange: [fromInclusive: number, toInclusive: number];
9
+ host: string;
10
+ verbose?: boolean;
11
+ public?: boolean;
12
+ }
13
+ type GetPortInput = Partial<GetPortOptions> | number | string;
14
+ type PortNumber = number;
15
+ declare function getPort(_userOptions?: GetPortInput): Promise<PortNumber>;
16
+ //#endregion
17
+ export { type GetPortInput, type GetPortOptions, getPort };
@@ -0,0 +1,2 @@
1
+ import { n as getPort } from "../dist-eNI9qM_I.mjs";
2
+ export { getPort };
@@ -1,28 +1,4 @@
1
- import { createRequire } from "node:module";
2
- //#region \0rolldown/runtime.js
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
21
- value: mod,
22
- enumerable: true
23
- }) : target, mod));
24
- var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
25
- //#endregion
1
+ import { i as __toESM, r as __require, t as __commonJSMin } from "../rolldown-runtime-JspESFgx.mjs";
26
2
  //#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
27
3
  var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
28
4
  let p = process || {};
@@ -0,0 +1,2 @@
1
+ import { a as Diagnostic, c as DiagnosticHandle, d as Diagnostics, f as ansiFormatter, g as formatDiagnostic, h as defineProdDiagnostics, i as DevframeDefineDiagnosticsOptions, l as DiagnosticInit, m as defineDiagnostics, n as ConsoleMethod, o as DiagnosticCallParams, p as createConsoleReporter, r as ConsoleReporterOptions, s as DiagnosticDefinition, t as AnyDiagnosticReporter, u as DiagnosticReporter } from "../nostics-SPGDgHEP.mjs";
2
+ export { type AnyDiagnosticReporter, type ConsoleMethod, type ConsoleReporterOptions, DevframeDefineDiagnosticsOptions, type Diagnostic, type DiagnosticCallParams, type DiagnosticDefinition, type DiagnosticHandle, type DiagnosticInit, type DiagnosticReporter, type Diagnostics, ansiFormatter, createConsoleReporter, defineDiagnostics, defineProdDiagnostics, formatDiagnostic };
@@ -0,0 +1,2 @@
1
+ import { a as defineProdDiagnostics, i as defineDiagnostics, n as ansiFormatter, o as formatDiagnostic, r as createConsoleReporter, t as Diagnostic } from "../nostics-CzECRXpE.mjs";
2
+ export { Diagnostic, ansiFormatter, createConsoleReporter, defineDiagnostics, defineProdDiagnostics, formatDiagnostic };
@@ -1,16 +1,8 @@
1
1
  //#region src/utils/open.d.ts
2
- interface OpenOptions {
3
- /**
4
- * Resolve only after the launched app exits.
5
- *
6
- * @default false
7
- */
8
- wait?: boolean;
9
- }
10
2
  /**
11
3
  * Open a URL, file, or other target in its default OS handler
12
4
  * (browser for URLs, Finder/Explorer for paths, etc.).
13
5
  */
14
- declare function open(target: string, options?: OpenOptions): Promise<void>;
6
+ declare function open(target: string): Promise<void>;
15
7
  //#endregion
16
- export { OpenOptions, open };
8
+ export { open };
@@ -1,2 +1,57 @@
1
- import { t as open } from "../open-Deb5xmIT.mjs";
1
+ import fs from "node:fs";
2
+ import process from "node:process";
3
+ import { spawn } from "node:child_process";
4
+ //#region src/utils/open.ts
5
+ /**
6
+ * Launches `command` detached from the current process and resolves once
7
+ * the OS has accepted the spawn (not once the launched app exits) — the
8
+ * same "fire and forget" behavior `open`'s default (`wait: false`) gave us.
9
+ */
10
+ function spawnDetached(command, args) {
11
+ return new Promise((resolve, reject) => {
12
+ const child = spawn(command, args, {
13
+ detached: true,
14
+ stdio: "ignore",
15
+ windowsHide: true
16
+ });
17
+ child.once("error", reject);
18
+ child.once("spawn", () => {
19
+ child.unref();
20
+ resolve();
21
+ });
22
+ });
23
+ }
24
+ function isWsl() {
25
+ if (process.platform !== "linux") return false;
26
+ try {
27
+ return fs.readFileSync("/proc/version", "utf-8").toLowerCase().includes("microsoft");
28
+ } catch {
29
+ return false;
30
+ }
31
+ }
32
+ /**
33
+ * Open a URL, file, or other target in its default OS handler
34
+ * (browser for URLs, Finder/Explorer for paths, etc.).
35
+ */
36
+ async function open(target) {
37
+ if (process.platform === "darwin") return spawnDetached("open", [target]);
38
+ if (process.platform === "win32") return spawnDetached("cmd", [
39
+ "/c",
40
+ "start",
41
+ "\"\"",
42
+ target
43
+ ]);
44
+ if (isWsl()) try {
45
+ return await spawnDetached("wslview", [target]);
46
+ } catch {
47
+ return spawnDetached("cmd.exe", [
48
+ "/c",
49
+ "start",
50
+ "\"\"",
51
+ target
52
+ ]);
53
+ }
54
+ return spawnDetached("xdg-open", [target]);
55
+ }
56
+ //#endregion
2
57
  export { open };