devframe 0.2.3 → 0.3.0

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 (62) hide show
  1. package/dist/adapters/build.d.mts +1 -1
  2. package/dist/adapters/build.mjs +6 -6
  3. package/dist/adapters/cli.d.mts +1 -1
  4. package/dist/adapters/cli.mjs +2 -2
  5. package/dist/adapters/dev.d.mts +2 -2
  6. package/dist/adapters/dev.mjs +1 -1
  7. package/dist/adapters/embedded.d.mts +1 -1
  8. package/dist/adapters/mcp.d.mts +1 -1
  9. package/dist/adapters/mcp.mjs +9 -8
  10. package/dist/client/index.d.mts +1 -1
  11. package/dist/client/index.mjs +44 -37
  12. package/dist/{context-GUzIxrEK.d.mts → context-CwjX6sCG.d.mts} +1 -1
  13. package/dist/{dev-BVtS7qBK.mjs → dev-BbmanqL7.mjs} +4 -4
  14. package/dist/{devframe-C4DNeFuG.d.mts → devframe-sc4cb5xr.d.mts} +48 -41
  15. package/dist/diagnostics-GitRGKbr.mjs +33 -0
  16. package/dist/diagnostics-reporter-CBBZwoMv.mjs +38 -0
  17. package/dist/{dump-C5LPsKJC.mjs → dump-zMleojnD.mjs} +10 -10
  18. package/dist/helpers/vite.d.mts +1 -1
  19. package/dist/helpers/vite.mjs +7 -6
  20. package/dist/{host-h3-DYFKJxAV.mjs → host-h3-TTunNr_n.mjs} +31 -39
  21. package/dist/{index-DWczSqdd.d.mts → index-C5PmWqBf.d.mts} +1 -1
  22. package/dist/{index-CSi2Y5JU.d.mts → index-CTK6fuXs.d.mts} +2 -2
  23. package/dist/{index-aNunf5Za.d.mts → index-DTeZXHSi.d.mts} +1 -1
  24. package/dist/index.d.mts +4 -4
  25. package/dist/index.mjs +1 -1
  26. package/dist/node/auth.d.mts +2 -2
  27. package/dist/node/auth.mjs +1 -1
  28. package/dist/node/index.d.mts +10 -14
  29. package/dist/node/index.mjs +3 -3
  30. package/dist/node/internal.d.mts +2 -2
  31. package/dist/node/internal.mjs +3 -3
  32. package/dist/recipes/open-helpers.d.mts +1 -1
  33. package/dist/recipes/open-helpers.mjs +2 -2
  34. package/dist/rpc/dump.d.mts +1 -1
  35. package/dist/rpc/dump.mjs +1 -1
  36. package/dist/rpc/index.d.mts +2 -2
  37. package/dist/rpc/index.mjs +8 -8
  38. package/dist/rpc/transports/ws-client.d.mts +1 -1
  39. package/dist/rpc/transports/ws-client.mjs +2 -2
  40. package/dist/rpc/transports/ws-server.d.mts +1 -1
  41. package/dist/rpc/transports/ws-server.mjs +2 -2
  42. package/dist/{serialization-lBLV02kQ.mjs → serialization-BlqLh4_J.mjs} +3 -3
  43. package/dist/{server-DjMtJQhO.d.mts → server-ouL4gZbu.d.mts} +1 -1
  44. package/dist/{shared-state-SzgfilJP.mjs → shared-state-CasqoUba.mjs} +25 -64
  45. package/dist/{storage-CTlHUtXI.mjs → storage-K-OxR1xf.mjs} +5 -2
  46. package/dist/types/index.d.mts +4 -4
  47. package/dist/utils/events.d.mts +1 -1
  48. package/dist/utils/open.mjs +1 -1
  49. package/dist/utils/shared-state.d.mts +1 -1
  50. package/dist/utils/streaming-channel.d.mts +1 -1
  51. package/dist/{ws-server-lHQaafrS.d.mts → ws-server-DOwLJL23.d.mts} +1 -1
  52. package/package.json +2 -2
  53. package/skills/devframe/SKILL.md +1 -1
  54. package/dist/diagnostics-D7miaTpL.mjs +0 -36
  55. /package/dist/{_shared-BNoPn1NG.mjs → _shared-CUFqO4kJ.mjs} +0 -0
  56. /package/dist/{define-Bb4zh-Dc.mjs → define-CW9gLnyG.mjs} +0 -0
  57. /package/dist/{human-id-CiBWzVcg.mjs → human-id-Dq-qgtES.mjs} +0 -0
  58. /package/dist/{open-CX4CiMyw.mjs → open-DiQn6zCH.mjs} +0 -0
  59. /package/dist/{server-DxiOFSpu.mjs → server-BO8IDVsJ.mjs} +0 -0
  60. /package/dist/{structured-clone-qP1sPovr.mjs → structured-clone-jegjz0hM.mjs} +0 -0
  61. /package/dist/{transports-Bl1zuYhZ.mjs → transports-DTFoMUbE.mjs} +0 -0
  62. /package/dist/{types-kKDaD2NT.d.mts → types-BXL7EIDM.d.mts} +0 -0
@@ -1,4 +1,4 @@
1
- import { r as DevframeDefinition } from "../devframe-C4DNeFuG.mjs";
1
+ import { r as DevframeDefinition } from "../devframe-sc4cb5xr.mjs";
2
2
 
3
3
  //#region src/adapters/build.d.ts
4
4
  interface CreateBuildOptions {
@@ -1,10 +1,10 @@
1
- import { t as collectStaticRpcDump } from "../dump-C5LPsKJC.mjs";
1
+ import { t as collectStaticRpcDump } from "../dump-zMleojnD.mjs";
2
+ import { n as colors } from "../diagnostics-reporter-CBBZwoMv.mjs";
2
3
  import { DEVTOOLS_CONNECTION_META_FILENAME, DEVTOOLS_RPC_DUMP_DIRNAME, DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME } from "../constants.mjs";
3
- import { n as strictJsonStringify } from "../serialization-lBLV02kQ.mjs";
4
- import { n as structuredCloneStringify } from "../structured-clone-qP1sPovr.mjs";
5
- import { o as colors } from "../shared-state-SzgfilJP.mjs";
6
- import { n as createHostContext, t as createH3DevToolsHost } from "../host-h3-DYFKJxAV.mjs";
7
- import { n as resolveBasePath } from "../_shared-BNoPn1NG.mjs";
4
+ import { n as strictJsonStringify } from "../serialization-BlqLh4_J.mjs";
5
+ import { n as structuredCloneStringify } from "../structured-clone-jegjz0hM.mjs";
6
+ import { n as createHostContext, t as createH3DevToolsHost } from "../host-h3-TTunNr_n.mjs";
7
+ import { n as resolveBasePath } from "../_shared-CUFqO4kJ.mjs";
8
8
  import { existsSync } from "node:fs";
9
9
  import process from "node:process";
10
10
  import { dirname, resolve } from "pathe";
@@ -1,4 +1,4 @@
1
- import { G as InferCliFlags, K as defineCliFlags, W as CliFlagsSchema, q as parseCliFlags, r as DevframeDefinition } from "../devframe-C4DNeFuG.mjs";
1
+ import { G as CliFlagsSchema, J as parseCliFlags, K as InferCliFlags, q as defineCliFlags, r as DevframeDefinition } from "../devframe-sc4cb5xr.mjs";
2
2
  import { H3 } from "h3";
3
3
  import { CAC } from "cac";
4
4
 
@@ -1,6 +1,6 @@
1
- import { o as colors } from "../shared-state-SzgfilJP.mjs";
1
+ import { n as colors } from "../diagnostics-reporter-CBBZwoMv.mjs";
2
2
  import { createBuild } from "./build.mjs";
3
- import { n as resolveDevServerPort, t as createDevServer } from "../dev-BVtS7qBK.mjs";
3
+ import { n as resolveDevServerPort, t as createDevServer } from "../dev-BbmanqL7.mjs";
4
4
  import process from "node:process";
5
5
  import cac from "cac";
6
6
  import { safeParse } from "valibot";
@@ -1,5 +1,5 @@
1
- import { r as DevframeDefinition } from "../devframe-C4DNeFuG.mjs";
2
- import { n as StartedServer } from "../server-DjMtJQhO.mjs";
1
+ import { r as DevframeDefinition } from "../devframe-sc4cb5xr.mjs";
2
+ import { n as StartedServer } from "../server-ouL4gZbu.mjs";
3
3
  import { H3 } from "h3";
4
4
 
5
5
  //#region src/adapters/dev.d.ts
@@ -1,2 +1,2 @@
1
- import { n as resolveDevServerPort, t as createDevServer } from "../dev-BVtS7qBK.mjs";
1
+ import { n as resolveDevServerPort, t as createDevServer } from "../dev-BbmanqL7.mjs";
2
2
  export { createDevServer, resolveDevServerPort };
@@ -1,4 +1,4 @@
1
- import { d as DevToolsNodeContext, r as DevframeDefinition } from "../devframe-C4DNeFuG.mjs";
1
+ import { d as DevToolsNodeContext, r as DevframeDefinition } from "../devframe-sc4cb5xr.mjs";
2
2
 
3
3
  //#region src/adapters/embedded.d.ts
4
4
  interface CreateEmbeddedOptions {
@@ -1,4 +1,4 @@
1
- import { r as DevframeDefinition } from "../devframe-C4DNeFuG.mjs";
1
+ import { r as DevframeDefinition } from "../devframe-sc4cb5xr.mjs";
2
2
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
3
 
4
4
  //#region src/adapters/mcp/build-server.d.ts
@@ -1,5 +1,5 @@
1
- import { a as logger } from "../shared-state-SzgfilJP.mjs";
2
- import { n as createHostContext } from "../host-h3-DYFKJxAV.mjs";
1
+ import { i as diagnostics } from "../shared-state-CasqoUba.mjs";
2
+ import { n as createHostContext } from "../host-h3-TTunNr_n.mjs";
3
3
  import { homedir } from "node:os";
4
4
  import process from "node:process";
5
5
  import { join } from "pathe";
@@ -185,10 +185,10 @@ function buildMcpServerFromContext(ctx, options) {
185
185
  */
186
186
  async function createMcpServer(definition, options = {}) {
187
187
  const transport = options.transport ?? "stdio";
188
- if (transport !== "stdio") throw logger.DF0017({
188
+ if (transport !== "stdio") throw diagnostics.DF0017.throw({
189
189
  transport,
190
190
  reason: "Only stdio transport is supported in this release."
191
- }).throw();
191
+ });
192
192
  const ctx = await createHostContext({
193
193
  cwd: process.cwd(),
194
194
  mode: "dev",
@@ -204,16 +204,17 @@ async function createMcpServer(definition, options = {}) {
204
204
  serverVersion: options.serverVersion ?? definition.version ?? "0.0.0",
205
205
  exposeSharedState: options.exposeSharedState ?? true
206
206
  });
207
- const { startStdioTransport } = await import("../transports-Bl1zuYhZ.mjs");
207
+ const { startStdioTransport } = await import("../transports-DTFoMUbE.mjs");
208
208
  let stop;
209
209
  try {
210
210
  stop = await startStdioTransport(server);
211
211
  } catch (error) {
212
212
  const reason = error instanceof Error ? error.message : String(error);
213
- throw logger.DF0017({
213
+ throw diagnostics.DF0017.throw({
214
214
  transport,
215
- reason
216
- }, { cause: error }).throw();
215
+ reason,
216
+ cause: error
217
+ });
217
218
  }
218
219
  options.onReady?.({ transport: "stdio" });
219
220
  return { async stop() {
@@ -1,4 +1,4 @@
1
- import { D as RpcCacheOptions, E as RpcCacheManager, O as RpcFunctionDefinitionAny, i as DevToolsRpcServerFunctions, k as RpcFunctionsCollector, l as StreamReader, n as RpcSharedStateHost, r as DevToolsRpcClientFunctions, t as ConnectionMeta, u as StreamSink, w as EventEmitter } from "../index-aNunf5Za.mjs";
1
+ import { D as RpcCacheOptions, E as RpcCacheManager, O as RpcFunctionDefinitionAny, i as DevToolsRpcServerFunctions, k as RpcFunctionsCollector, l as StreamReader, n as RpcSharedStateHost, r as DevToolsRpcClientFunctions, t as ConnectionMeta, u as StreamSink, w as EventEmitter } from "../index-DTeZXHSi.mjs";
2
2
  import { BirpcOptions, BirpcReturn } from "birpc";
3
3
 
4
4
  //#region src/rpc/transports/ws-client.d.ts
@@ -1,45 +1,52 @@
1
1
  import { t as hash } from "../hash-bwOD8RgU.mjs";
2
+ import { colors } from "../utils/colors.mjs";
2
3
  import { createEventEmitter } from "../utils/events.mjs";
3
4
  import { humanId } from "../utils/human-id.mjs";
4
5
  import { t as createSharedState } from "../shared-state-u0y123fi.mjs";
5
6
  import { i as structuredCloneStringify, n as structuredCloneParse, t as structuredCloneDeserialize } from "../structured-clone-PdCZwt7F.mjs";
6
7
  import { createStreamReader, createStreamSink } from "../utils/streaming-channel.mjs";
7
8
  import { promiseWithResolver } from "../utils/promise.mjs";
8
- import { consoleReporter, createLogger, defineDiagnostics, plainFormatter } from "logs-sdk";
9
+ import { defineDiagnostics } from "nostics";
10
+ import { ansiFormatter } from "nostics/formatters/ansi";
9
11
  import { createBirpc } from "birpc";
10
12
  //#region src/constants.ts
11
13
  const DEVTOOLS_CONNECTION_META_FILENAME = "__connection.json";
12
14
  const DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME = "__rpc-dump/index.json";
13
- const logger = createLogger({
14
- diagnostics: [defineDiagnostics({
15
- docsBase: "https://devfra.me/errors",
16
- codes: {
17
- DF0019: {
18
- message: (p) => `RPC function "${p.name}" has \`agent\` set but \`jsonSerializable\` is not \`true\` — MCP requires JSON-serializable data.`,
19
- hint: "Set `jsonSerializable: true` if the payload is JSON-safe, or remove `agent` to keep it RPC-only."
20
- },
21
- DF0020: {
22
- message: (p) => `RPC function "${p.name}" declares \`jsonSerializable: true\` but the value at "${p.path}" is a ${p.type}.`,
23
- hint: "Either drop `jsonSerializable: true` (falls back to structured-clone) or change the value to a JSON-safe shape."
24
- },
25
- DF0021: {
26
- message: (p) => `RPC function "${p.name}" is already registered`,
27
- hint: "Use the `force` parameter to overwrite an existing registration."
28
- },
29
- DF0022: { message: (p) => `RPC function "${p.name}" is not registered. Use register() to add new functions.` },
30
- DF0023: { message: (p) => `RPC function "${p.name}" is not registered` },
31
- DF0024: { message: (p) => `Either handler or setup function must be provided for RPC function "${p.name}"` },
32
- DF0025: { message: (p) => `Function "${p.name}" not found in dump store` },
33
- DF0026: { message: (p) => `No dump match for "${p.name}" with args: ${p.args}` },
34
- DF0027: { message: (p) => `Function "${p.name}" with type "${p.type}" cannot have dump configuration. Only "static" and "query" types support dumps.` },
35
- DF0028: {
36
- message: (p) => `Function "${p.name}" with type "${p.type}" cannot use \`snapshot: true\`. Only "query" functions support this sugar; "static" functions have equivalent default behavior already.`,
37
- hint: "Remove `snapshot: true`, or change the function type to `query`."
38
- }
15
+ //#endregion
16
+ //#region src/utils/diagnostics-reporter.ts
17
+ const formatAnsi = ansiFormatter(colors);
18
+ function devframeReporter(d, { method = "warn" } = {}) {
19
+ console[method](formatAnsi(d));
20
+ }
21
+ //#endregion
22
+ //#region src/rpc/diagnostics.ts
23
+ const diagnostics = defineDiagnostics({
24
+ docsBase: "https://devfra.me/errors",
25
+ reporters: [devframeReporter],
26
+ codes: {
27
+ DF0019: {
28
+ why: (p) => `RPC function "${p.name}" has \`agent\` set but \`jsonSerializable\` is not \`true\` — MCP requires JSON-serializable data.`,
29
+ fix: "Set `jsonSerializable: true` if the payload is JSON-safe, or remove `agent` to keep it RPC-only."
30
+ },
31
+ DF0020: {
32
+ why: (p) => `RPC function "${p.name}" declares \`jsonSerializable: true\` but the value at "${p.path}" is a ${p.type}.`,
33
+ fix: "Either drop `jsonSerializable: true` (falls back to structured-clone) or change the value to a JSON-safe shape."
34
+ },
35
+ DF0021: {
36
+ why: (p) => `RPC function "${p.name}" is already registered`,
37
+ fix: "Use the `force` parameter to overwrite an existing registration."
38
+ },
39
+ DF0022: { why: (p) => `RPC function "${p.name}" is not registered. Use register() to add new functions.` },
40
+ DF0023: { why: (p) => `RPC function "${p.name}" is not registered` },
41
+ DF0024: { why: (p) => `Either handler or setup function must be provided for RPC function "${p.name}"` },
42
+ DF0025: { why: (p) => `Function "${p.name}" not found in dump store` },
43
+ DF0026: { why: (p) => `No dump match for "${p.name}" with args: ${p.args}` },
44
+ DF0027: { why: (p) => `Function "${p.name}" with type "${p.type}" cannot have dump configuration. Only "static" and "query" types support dumps.` },
45
+ DF0028: {
46
+ why: (p) => `Function "${p.name}" with type "${p.type}" cannot use \`snapshot: true\`. Only "query" functions support this sugar; "static" functions have equivalent default behavior already.`,
47
+ fix: "Remove `snapshot: true`, or change the function type to `query`."
39
48
  }
40
- })],
41
- formatter: plainFormatter,
42
- reporters: consoleReporter
49
+ }
43
50
  });
44
51
  //#endregion
45
52
  //#region src/rpc/dump/error.ts
@@ -76,7 +83,7 @@ async function getRpcResolvedSetupResult(definition, context) {
76
83
  async function getRpcHandler(definition, context) {
77
84
  if (definition.handler) return definition.handler;
78
85
  const result = await getRpcResolvedSetupResult(definition, context);
79
- if (!result.handler) throw logger.DF0024({ name: definition.name }).throw();
86
+ if (!result.handler) throw diagnostics.DF0024.throw({ name: definition.name });
80
87
  return result.handler;
81
88
  }
82
89
  //#endregion
@@ -148,13 +155,13 @@ var RpcFunctionsCollectorBase = class {
148
155
  });
149
156
  }
150
157
  register(fn, force = false) {
151
- if (this.definitions.has(fn.name) && !force) throw logger.DF0021({ name: fn.name }).throw();
158
+ if (this.definitions.has(fn.name) && !force) throw diagnostics.DF0021.throw({ name: fn.name });
152
159
  assertAgentJsonSerializable(fn);
153
160
  this.definitions.set(fn.name, fn);
154
161
  this._onChanged.forEach((cb) => cb(fn.name));
155
162
  }
156
163
  update(fn, force = false) {
157
- if (!this.definitions.has(fn.name) && !force) throw logger.DF0022({ name: fn.name }).throw();
164
+ if (!this.definitions.has(fn.name) && !force) throw diagnostics.DF0022.throw({ name: fn.name });
158
165
  assertAgentJsonSerializable(fn);
159
166
  this.definitions.set(fn.name, fn);
160
167
  this._onChanged.forEach((cb) => cb(fn.name));
@@ -171,7 +178,7 @@ var RpcFunctionsCollectorBase = class {
171
178
  }
172
179
  getSchema(name) {
173
180
  const definition = this.definitions.get(name);
174
- if (!definition) throw logger.DF0023({ name: String(name) }).throw();
181
+ if (!definition) throw diagnostics.DF0023.throw({ name: String(name) });
175
182
  return {
176
183
  args: definition.args,
177
184
  returns: definition.returns
@@ -188,7 +195,7 @@ var RpcFunctionsCollectorBase = class {
188
195
  }
189
196
  };
190
197
  function assertAgentJsonSerializable(fn) {
191
- if (fn.agent && fn.jsonSerializable !== true) throw logger.DF0019({ name: fn.name }).throw();
198
+ if (fn.agent && fn.jsonSerializable !== true) throw diagnostics.DF0019.throw({ name: fn.name });
192
199
  }
193
200
  //#endregion
194
201
  //#region src/rpc/serialization.ts
@@ -236,11 +243,11 @@ function strictJsonStringify(value, fnName = "") {
236
243
  }
237
244
  function nonJsonAt(fnName, type, parent, key) {
238
245
  const path = formatPath(parent, key);
239
- return logger.DF0020({
246
+ return diagnostics.DF0020.throw({
240
247
  name: fnName || "<anonymous>",
241
248
  type,
242
249
  path
243
- }).throw();
250
+ });
244
251
  }
245
252
  function formatPath(parent, key) {
246
253
  if (Array.isArray(parent)) return `[${key}]`;
@@ -1,4 +1,4 @@
1
- import { b as SharedState, d as DevToolsNodeContext } from "./devframe-C4DNeFuG.mjs";
1
+ import { b as SharedState, d as DevToolsNodeContext } from "./devframe-sc4cb5xr.mjs";
2
2
 
3
3
  //#region src/node/internal/context.d.ts
4
4
  interface InternalAnonymousAuthStorage {
@@ -1,8 +1,8 @@
1
1
  import { DEVTOOLS_CONNECTION_META_FILENAME } from "./constants.mjs";
2
- import { n as createHostContext, t as createH3DevToolsHost } from "./host-h3-DYFKJxAV.mjs";
3
- import { t as startHttpAndWs } from "./server-DxiOFSpu.mjs";
4
- import { n as resolveBasePath, t as normalizeBasePath } from "./_shared-BNoPn1NG.mjs";
5
- import { t as open } from "./open-CX4CiMyw.mjs";
2
+ import { n as createHostContext, t as createH3DevToolsHost } from "./host-h3-TTunNr_n.mjs";
3
+ import { t as startHttpAndWs } from "./server-BO8IDVsJ.mjs";
4
+ import { n as resolveBasePath, t as normalizeBasePath } from "./_shared-CUFqO4kJ.mjs";
5
+ import { t as open } from "./open-DiQn6zCH.mjs";
6
6
  import { mountStaticHandler } from "./utils/serve-static.mjs";
7
7
  import { networkInterfaces } from "node:os";
8
8
  import process$1 from "node:process";
@@ -1,6 +1,6 @@
1
- import { S as RpcFunctionsCollectorBase } from "./index-CSi2Y5JU.mjs";
2
- import { t as DevToolsNodeRpcSessionMeta } from "./ws-server-lHQaafrS.mjs";
3
- import { Logger, createLogger, defineDiagnostics } from "logs-sdk";
1
+ import { S as RpcFunctionsCollectorBase } from "./index-CTK6fuXs.mjs";
2
+ import { t as DevToolsNodeRpcSessionMeta } from "./ws-server-DOwLJL23.mjs";
3
+ import { Diagnostic, DiagnosticDefinition, defineDiagnostics } from "nostics";
4
4
  import { BirpcReturn } from "birpc";
5
5
  import { CAC } from "cac";
6
6
  import { GenericSchema, InferOutput } from "valibot";
@@ -289,17 +289,31 @@ interface DevToolsAgentHost {
289
289
  * A diagnostics definition object built with `defineDiagnostics`. Typed as
290
290
  * `unknown` because each integration's definition has a distinct narrow shape
291
291
  * (e.g. specific code keys like `DF0001` / `MYP0001`), and TypeScript's mapped
292
- * types don't allow assigning a narrow-keyed `DiagnosticsResult` to a
293
- * generically-keyed one. The host stores them in a heterogeneous list and
294
- * rebuilds the logger on `register()`.
292
+ * types don't allow assigning a narrow-keyed result to a generically-keyed
293
+ * one. The host stores them in a heterogeneous registry.
295
294
  */
296
- type DevToolsDiagnosticsDefinition = ReturnType<typeof defineDiagnostics<any>>;
297
- /** A `logs-sdk` Logger instance built with `createLogger`. */
298
- type DevToolsDiagnosticsLogger = Logger<readonly any[]>;
295
+ type DevToolsDiagnosticsDefinition = ReturnType<typeof defineDiagnostics<any, any>>;
299
296
  /**
300
- * Host for structured diagnostics a thin layer over `logs-sdk` that lets
301
- * integrations register their own coded errors/warnings into the shared
302
- * logger without taking a direct dependency on `logs-sdk`.
297
+ * The shared diagnostics lookup exposed by the host. A `Proxy` that resolves
298
+ * any registered code name to its `nostics` handle (with `.report()` and
299
+ * `.throw()` methods). Typed loosely because it spans heterogeneous
300
+ * definitions registered by different integrations.
301
+ */
302
+ type DevToolsDiagnosticsLogger = Record<string, any>;
303
+ /**
304
+ * Options accepted by the host's `defineDiagnostics()` factory — mirrors
305
+ * `nostics`'s shape but the host pre-wires its ANSI console reporter, so
306
+ * plugins typically omit `reporters`.
307
+ */
308
+ interface DevToolsDefineDiagnosticsOptions<Codes extends Record<string, DiagnosticDefinition>> {
309
+ docsBase?: string | ((code: keyof Codes) => string | undefined);
310
+ codes: Codes;
311
+ reporters?: ReadonlyArray<(d: Diagnostic, o?: any) => void>;
312
+ }
313
+ /**
314
+ * Host for structured diagnostics — a thin layer over `nostics` that lets
315
+ * integrations register their own coded errors/warnings into a shared
316
+ * registry without taking a direct dependency on `nostics`.
303
317
  *
304
318
  * Typical usage from a plugin's `setup(ctx)`:
305
319
  *
@@ -307,47 +321,40 @@ type DevToolsDiagnosticsLogger = Logger<readonly any[]>;
307
321
  * const myDiagnostics = ctx.diagnostics.defineDiagnostics({
308
322
  * docsBase: 'https://example.com/errors',
309
323
  * codes: {
310
- * MYP0001: { message: 'Something went wrong' },
324
+ * MYP0001: { why: 'Something went wrong' },
311
325
  * },
312
326
  * })
313
327
  * ctx.diagnostics.register(myDiagnostics)
314
328
  *
315
- * // Later (loose typing):
316
- * ctx.diagnostics.logger.MYP0001().warn()
329
+ * // Through the shared lookup (loose typing):
330
+ * ctx.diagnostics.logger.MYP0001.throw()
317
331
  *
318
- * // Or with full typing, keep your own logger reference:
319
- * const logger = ctx.diagnostics.createLogger({ diagnostics: [myDiagnostics] })
320
- * logger.MYP0001().warn()
332
+ * // Or directly on the typed handle returned from `defineDiagnostics`:
333
+ * myDiagnostics.MYP0001.throw()
321
334
  * ```
322
335
  */
323
336
  interface DevToolsDiagnosticsHost {
324
337
  /**
325
- * The combined `logs-sdk` Logger including all registered diagnostic
326
- * definitions. The getter always returns the freshest logger — it is
327
- * rebuilt each time `register()` is called, so cached references to
328
- * older loggers will not see codes registered later.
338
+ * Proxy-backed lookup of every registered diagnostic handle by code name.
339
+ * Resolves to a `nostics` `DiagnosticHandle` with `.report()` / `.throw()`.
340
+ * Loosely typed for autocompletion, keep a reference to the typed
341
+ * result of `defineDiagnostics()` instead.
329
342
  */
330
343
  readonly logger: DevToolsDiagnosticsLogger;
331
344
  /**
332
- * Register an additional diagnostic definition with this host. After
333
- * registration, codes from the new definition are accessible on
334
- * `host.logger`. Accepts any `DiagnosticsResult` produced by
335
- * `defineDiagnostics` the parameter is typed as `unknown` to avoid
336
- * mapped-type variance issues with narrowly-keyed definitions.
337
- */
338
- register: (definitions: unknown) => void;
339
- /**
340
- * Re-export of `logs-sdk`'s `defineDiagnostics`. Integrations can build
341
- * their own diagnostic definitions without taking a direct dependency on
342
- * `logs-sdk`.
345
+ * Register additional diagnostic definitions with this host. After
346
+ * registration, codes from the new definition are reachable via
347
+ * `host.logger.CODE`. Plugins that want shared output formatting should
348
+ * build their diagnostics via `host.defineDiagnostics()` first — that
349
+ * factory pre-wires the host's ANSI console reporter.
343
350
  */
344
- defineDiagnostics: typeof defineDiagnostics;
351
+ register: (definitions: Record<string, unknown>) => void;
345
352
  /**
346
- * Re-export of `logs-sdk`'s `createLogger`. Use this when an integration
347
- * wants its own typed Logger reference instead of going through
348
- * `host.logger` (which is loosely typed).
353
+ * Build a typed diagnostics object with the host's ANSI console reporter
354
+ * pre-wired. Mirrors `nostics`'s `defineDiagnostics` so integrations don't
355
+ * need to take a direct dependency on `nostics`.
349
356
  */
350
- createLogger: typeof createLogger;
357
+ defineDiagnostics: <const Codes extends Record<string, DiagnosticDefinition>>(options: DevToolsDefineDiagnosticsOptions<Codes>) => ReturnType<typeof defineDiagnostics<Codes, any>>;
351
358
  }
352
359
  //#endregion
353
360
  //#region src/types/host.d.ts
@@ -849,8 +856,8 @@ interface DevToolsNodeContext {
849
856
  rpc: RpcFunctionsHost;
850
857
  views: DevToolsViewHost;
851
858
  /**
852
- * Structured diagnostics host — wraps `logs-sdk` and lets integrations
853
- * register their own coded errors/warnings into the shared logger.
859
+ * Structured diagnostics host — wraps `nostics` and lets integrations
860
+ * register their own coded errors/warnings into the shared lookup.
854
861
  */
855
862
  diagnostics: DevToolsDiagnosticsHost;
856
863
  /**
@@ -998,4 +1005,4 @@ interface DevframeDefinition {
998
1005
  }
999
1006
  declare function defineDevframe(d: DevframeDefinition): DevframeDefinition;
1000
1007
  //#endregion
1001
- export { DevToolsDiagnosticsHost as A, DevToolsAgentHostEvents as B, PartialWithoutId as C, DevToolsRpcSharedStates as D, DevToolsRpcServerFunctions as E, AgentResourceContent as F, InferCliFlags as G, EventUnsubscribe as H, AgentResourceInput as I, defineCliFlags as K, AgentTool as L, AgentHandle as M, AgentManifest as N, DevToolsHost as O, AgentResource as P, AgentToolInput as R, EntriesToObject as S, DevToolsRpcClientFunctions as T, EventsMap as U, EventEmitter as V, CliFlagsSchema as W, RpcStreamingChannel as _, DevframeRuntime as a, SharedState as b, defineDevframe as c, DevToolsNodeContext as d, DevToolsNodeRpcSession as f, RpcSharedStateHost as g, RpcSharedStateGetOptions as h, DevframeDeploymentKind as i, DevToolsDiagnosticsLogger as j, DevToolsDiagnosticsDefinition as k, ConnectionMeta as l, RpcFunctionsHost as m, DevframeCliOptions as n, DevframeSetupInfo as o, RpcBroadcastOptions as p, parseCliFlags as q, DevframeDefinition as r, DevframeSpaOptions as s, DevframeBrowserContext as t, DevToolsCapabilities as u, RpcStreamingChannelOptions as v, Thenable as w, DevToolsViewHost as x, RpcStreamingHost as y, DevToolsAgentHost as z };
1008
+ export { DevToolsDiagnosticsDefinition as A, DevToolsAgentHost as B, PartialWithoutId as C, DevToolsRpcSharedStates as D, DevToolsRpcServerFunctions as E, AgentResource as F, CliFlagsSchema as G, EventEmitter as H, AgentResourceContent as I, parseCliFlags as J, InferCliFlags as K, AgentResourceInput as L, DevToolsDiagnosticsLogger as M, AgentHandle as N, DevToolsHost as O, AgentManifest as P, AgentTool as R, EntriesToObject as S, DevToolsRpcClientFunctions as T, EventUnsubscribe as U, DevToolsAgentHostEvents as V, EventsMap as W, RpcStreamingChannel as _, DevframeRuntime as a, SharedState as b, defineDevframe as c, DevToolsNodeContext as d, DevToolsNodeRpcSession as f, RpcSharedStateHost as g, RpcSharedStateGetOptions as h, DevframeDeploymentKind as i, DevToolsDiagnosticsHost as j, DevToolsDefineDiagnosticsOptions as k, ConnectionMeta as l, RpcFunctionsHost as m, DevframeCliOptions as n, DevframeSetupInfo as o, RpcBroadcastOptions as p, defineCliFlags as q, DevframeDefinition as r, DevframeSpaOptions as s, DevframeBrowserContext as t, DevToolsCapabilities as u, RpcStreamingChannelOptions as v, Thenable as w, DevToolsViewHost as x, RpcStreamingHost as y, AgentToolInput as z };
@@ -0,0 +1,33 @@
1
+ import { t as devframeReporter } from "./diagnostics-reporter-CBBZwoMv.mjs";
2
+ import { defineDiagnostics } from "nostics";
3
+ //#region src/rpc/diagnostics.ts
4
+ const diagnostics = defineDiagnostics({
5
+ docsBase: "https://devfra.me/errors",
6
+ reporters: [devframeReporter],
7
+ codes: {
8
+ DF0019: {
9
+ why: (p) => `RPC function "${p.name}" has \`agent\` set but \`jsonSerializable\` is not \`true\` — MCP requires JSON-serializable data.`,
10
+ fix: "Set `jsonSerializable: true` if the payload is JSON-safe, or remove `agent` to keep it RPC-only."
11
+ },
12
+ DF0020: {
13
+ why: (p) => `RPC function "${p.name}" declares \`jsonSerializable: true\` but the value at "${p.path}" is a ${p.type}.`,
14
+ fix: "Either drop `jsonSerializable: true` (falls back to structured-clone) or change the value to a JSON-safe shape."
15
+ },
16
+ DF0021: {
17
+ why: (p) => `RPC function "${p.name}" is already registered`,
18
+ fix: "Use the `force` parameter to overwrite an existing registration."
19
+ },
20
+ DF0022: { why: (p) => `RPC function "${p.name}" is not registered. Use register() to add new functions.` },
21
+ DF0023: { why: (p) => `RPC function "${p.name}" is not registered` },
22
+ DF0024: { why: (p) => `Either handler or setup function must be provided for RPC function "${p.name}"` },
23
+ DF0025: { why: (p) => `Function "${p.name}" not found in dump store` },
24
+ DF0026: { why: (p) => `No dump match for "${p.name}" with args: ${p.args}` },
25
+ DF0027: { why: (p) => `Function "${p.name}" with type "${p.type}" cannot have dump configuration. Only "static" and "query" types support dumps.` },
26
+ DF0028: {
27
+ why: (p) => `Function "${p.name}" with type "${p.type}" cannot use \`snapshot: true\`. Only "query" functions support this sugar; "static" functions have equivalent default behavior already.`,
28
+ fix: "Remove `snapshot: true`, or change the function type to `query`."
29
+ }
30
+ }
31
+ });
32
+ //#endregion
33
+ export { diagnostics as t };
@@ -0,0 +1,38 @@
1
+ import { ansiFormatter } from "nostics/formatters/ansi";
2
+ //#region src/utils/colors.ts
3
+ function makeColor(open, close) {
4
+ const o = `\x1B[${open}m`;
5
+ const c = `\x1B[${close}m`;
6
+ return ((arg, ...values) => {
7
+ if (Array.isArray(arg) && "raw" in arg) {
8
+ const strings = arg;
9
+ let out = "";
10
+ for (let i = 0; i < strings.length; i++) {
11
+ out += strings[i];
12
+ if (i < values.length) out += String(values[i]);
13
+ }
14
+ return `${o}${out}${c}`;
15
+ }
16
+ return `${o}${String(arg)}${c}`;
17
+ });
18
+ }
19
+ const colors = {
20
+ blue: makeColor(34, 39),
21
+ cyan: makeColor(36, 39),
22
+ gray: makeColor(90, 39),
23
+ green: makeColor(32, 39),
24
+ red: makeColor(31, 39),
25
+ yellow: makeColor(33, 39),
26
+ bold: makeColor(1, 22),
27
+ dim: makeColor(2, 22),
28
+ reset: makeColor(0, 0),
29
+ underline: makeColor(4, 24)
30
+ };
31
+ //#endregion
32
+ //#region src/utils/diagnostics-reporter.ts
33
+ const formatAnsi = ansiFormatter(colors);
34
+ function devframeReporter(d, { method = "warn" } = {}) {
35
+ console[method](formatAnsi(d));
36
+ }
37
+ //#endregion
38
+ export { colors as n, devframeReporter as t };
@@ -1,4 +1,4 @@
1
- import { n as logger } from "./diagnostics-D7miaTpL.mjs";
1
+ import { t as diagnostics } from "./diagnostics-GitRGKbr.mjs";
2
2
  import { DEVTOOLS_RPC_DUMP_DIRNAME } from "./constants.mjs";
3
3
  import { createHash } from "node:crypto";
4
4
  //#region ../../node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/shared/ohash.D__AXeF1.mjs
@@ -262,14 +262,14 @@ function validateConcurrency(concurrency) {
262
262
  function validateDefinitions(definitions) {
263
263
  for (const definition of definitions) {
264
264
  const type = definition.type || "query";
265
- if ((type === "action" || type === "event") && definition.dump) throw logger.DF0027({
265
+ if ((type === "action" || type === "event") && definition.dump) throw diagnostics.DF0027.throw({
266
266
  name: definition.name,
267
267
  type
268
- }).throw();
269
- if (definition.snapshot && type !== "query") throw logger.DF0028({
268
+ });
269
+ if (definition.snapshot && type !== "query") throw diagnostics.DF0028.throw({
270
270
  name: definition.name,
271
271
  type
272
- }).throw();
272
+ });
273
273
  }
274
274
  }
275
275
  /**
@@ -364,7 +364,7 @@ async function dumpFunctions(definitions, context, options = {}) {
364
364
  if (definition.type === "event" || definition.type === "action") return;
365
365
  const setupResult = definition.setup ? await Promise.resolve(definition.setup(context)) : {};
366
366
  const handler = setupResult.handler || definition.handler;
367
- if (!handler) throw logger.DF0024({ name: definition.name }).throw();
367
+ if (!handler) throw diagnostics.DF0024.throw({ name: definition.name });
368
368
  let dump = setupResult.dump ?? definition.dump;
369
369
  if (!dump && definition.type === "static") dump = { inputs: [[]] };
370
370
  if (!dump && definition.snapshot) dump = async (_ctx, h) => {
@@ -449,7 +449,7 @@ function createClientFromDump(store, options = {}) {
449
449
  const { onMiss } = options;
450
450
  return new Proxy({}, {
451
451
  get(_, functionName) {
452
- if (!(functionName in store.definitions)) throw logger.DF0025({ name: functionName }).throw();
452
+ if (!(functionName in store.definitions)) throw diagnostics.DF0025.throw({ name: functionName });
453
453
  return async (...args) => {
454
454
  const recordKey = getDumpRecordKey(functionName, args);
455
455
  const recordOrGetter = store.records[recordKey];
@@ -467,10 +467,10 @@ function createClientFromDump(store, options = {}) {
467
467
  if (fallbackRecord && typeof fallbackRecord.output === "function") return await fallbackRecord.output();
468
468
  if (fallbackRecord) return fallbackRecord.output;
469
469
  }
470
- throw logger.DF0026({
470
+ throw diagnostics.DF0026.throw({
471
471
  name: functionName,
472
472
  args: JSON.stringify(args)
473
- }).throw();
473
+ });
474
474
  };
475
475
  },
476
476
  has(_, functionName) {
@@ -510,7 +510,7 @@ async function getRpcResolvedSetupResult(definition, context) {
510
510
  async function getRpcHandler(definition, context) {
511
511
  if (definition.handler) return definition.handler;
512
512
  const result = await getRpcResolvedSetupResult(definition, context);
513
- if (!result.handler) throw logger.DF0024({ name: definition.name }).throw();
513
+ if (!result.handler) throw diagnostics.DF0024.throw({ name: definition.name });
514
514
  return result.handler;
515
515
  }
516
516
  //#endregion
@@ -1,4 +1,4 @@
1
- import { r as DevframeDefinition } from "../devframe-C4DNeFuG.mjs";
1
+ import { r as DevframeDefinition } from "../devframe-sc4cb5xr.mjs";
2
2
 
3
3
  //#region src/helpers/vite.d.ts
4
4
  interface ViteDevBridgeOptions {
@@ -1,8 +1,8 @@
1
1
  import { DEVTOOLS_CONNECTION_META_FILENAME } from "../constants.mjs";
2
- import { a as logger } from "../shared-state-SzgfilJP.mjs";
3
- import { n as resolveBasePath } from "../_shared-BNoPn1NG.mjs";
2
+ import { i as diagnostics } from "../shared-state-CasqoUba.mjs";
3
+ import { n as resolveBasePath } from "../_shared-CUFqO4kJ.mjs";
4
4
  import { serveStaticNodeMiddleware } from "../utils/serve-static.mjs";
5
- import { n as resolveDevServerPort, t as createDevServer } from "../dev-BVtS7qBK.mjs";
5
+ import { n as resolveDevServerPort, t as createDevServer } from "../dev-BbmanqL7.mjs";
6
6
  import { resolve } from "pathe";
7
7
  //#region src/helpers/vite.ts
8
8
  /**
@@ -54,10 +54,11 @@ function viteDevBridge(d, options = {}) {
54
54
  openBrowser: false
55
55
  });
56
56
  } catch (e) {
57
- logger.DF0033({
57
+ diagnostics.DF0033.report({
58
58
  id: d.id,
59
- reason: String(e)
60
- }, { cause: e }).log();
59
+ reason: String(e),
60
+ cause: e
61
+ }, { method: "warn" });
61
62
  return;
62
63
  }
63
64
  const metaPath = `${base}${DEVTOOLS_CONNECTION_META_FILENAME}`;