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,15 +1,3 @@
1
- import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-mQ4qZAuo.mjs";
2
- import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-DoSozfvx.mjs";
3
- //#region src/adapters/_shared.d.ts
4
- /**
5
- * Resolve the mount base path for a devframe's SPA. Hosted adapters
6
- * (`vite`, `embedded`) default to `/__<id>/` so they don't collide
7
- * with the host app; standalone adapters (`cli`, `spa`, `build`)
8
- * default to `/` because they own the origin.
9
- *
10
- * The devframe author can override with `basePath` on the definition.
11
- */
12
- declare function resolveBasePath(def: DevframeDefinition, kind: DevframeDeploymentKind): string;
13
- declare function normalizeBasePath(base: string): string;
14
- //#endregion
1
+ import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-B3YUu_95.mjs";
2
+ import { n as normalizeBasePath, r as resolveBasePath } from "../_shared-BPmX9fqK.mjs";
15
3
  export { type DevframeInternalContext, type InternalAnonymousAuthStorage, type RemoteTokenRecord, getInternalContext, internalContextMap, normalizeBasePath, resolveBasePath };
@@ -1,3 +1,3 @@
1
- import { n as internalContextMap, t as getInternalContext } from "../context-CBg8iRbQ.mjs";
2
- import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-bWRzeSa0.mjs";
1
+ import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-CbZ_yhbz.mjs";
2
+ import { n as internalContextMap, t as getInternalContext } from "../context-xdynGSLP.mjs";
3
3
  export { getInternalContext, internalContextMap, normalizeBasePath, resolveBasePath };
@@ -1,38 +1,7 @@
1
- import { At as DevframeAgentHostEvents, C as DevframeServicesHost, Ct as AgentResourceContent, Dt as AgentToolProvider, Et as AgentToolInput, H as DevframeDiagnosticsHost$1, J as RpcSharedStateHost, K as RpcFunctionsHost, L as DevframeViewHost$1, O as DevframeSettings, Ot as AgentToolProviderHandle, R as DevframeHost, S as DevframeServiceOf, St as AgentResource, T as DevframeScopedNodeContext, Tt as AgentTool, U as DevframeDiagnosticsLogger, Z as RpcStreamingHost, b as DevframeNodeContext, bt as AgentHandle, ht as SharedState, jt as EventEmitter, kt as DevframeAgentHost$1, wt as AgentResourceInput, x as DevframeServiceId, xt as AgentManifest } from "../devframe-mQ4qZAuo.mjs";
2
- import { v as RpcFunctionDefinitionAny } from "../types-CnJSgRVa.mjs";
3
- import "../index-Dbw1p5ch.mjs";
4
- import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-UHWae43Q.mjs";
1
+ import { B as RpcFunctionsHost, P as DevframeHost, g as DevframeNodeContext, lt as SharedState } from "../devframe-DJMg0WLe.mjs";
2
+ import "../index-tdrk1bzV.mjs";
3
+ import { v as RpcFunctionDefinitionAny } from "../types-Djq7CBXh.mjs";
5
4
  import { BirpcGroup } from "birpc";
6
- //#region src/node/agent-args.d.ts
7
- /**
8
- * How {@link coerceAgentPositionalArgs} treats an args object that carries
9
- * neither declared schemas nor `arg0`/`arg1`/… keys:
10
- *
11
- * - `'wrap'` — pass the object itself as the single positional argument.
12
- * RPC-backed tools use this: an untyped RPC may take one raw object.
13
- * - `'drop'` — call with zero arguments. Command-backed tools use this:
14
- * a handler's positional parameters come solely from its declared
15
- * `agent.args` schemas, so undeclared payload is ignored.
16
- */
17
- type AgentArgsFallback = 'wrap' | 'drop';
18
- /**
19
- * Map the args payload an agent surface receives (MCP sends an object
20
- * keyed `arg0`/`arg1`/…, matching the schema the adapter advertises) onto
21
- * a handler's positional parameters. Shared by the agent host's RPC
22
- * bridge and the hub's command-derived tools so the coercion cannot
23
- * drift between them.
24
- *
25
- * - an array passes through as-is
26
- * - `null`/`undefined` become a zero-argument call
27
- * - with declared schemas, each schema reads its own `argN` key, in order
28
- * - without schemas, `arg0`/`arg1`/… keys are collected when present
29
- * - an empty object becomes a zero-argument call
30
- * - anything else follows the {@link AgentArgsFallback}
31
- *
32
- * @experimental
33
- */
34
- declare function coerceAgentPositionalArgs(args: unknown, schemas: readonly unknown[] | undefined, fallback?: AgentArgsFallback): unknown[];
35
- //#endregion
36
5
  //#region src/node/context.d.ts
37
6
  interface CreateHostContextOptions {
38
7
  cwd: string;
@@ -56,231 +25,6 @@ interface CreateHostContextOptions {
56
25
  */
57
26
  declare function createHostContext(options: CreateHostContextOptions): Promise<DevframeNodeContext>;
58
27
  //#endregion
59
- //#region src/node/host-agent.d.ts
60
- /**
61
- * Framework-neutral host aggregating the agent-exposed surface of a
62
- * devframe. Auto-discovers RPC functions with an `agent` field from
63
- * `ctx.rpc.definitions`, and accepts plugin-registered tools /
64
- * resources via `registerTool` / `registerResource`.
65
- *
66
- * @experimental
67
- */
68
- declare class DevframeAgentHost implements DevframeAgentHost$1 {
69
- readonly context: DevframeNodeContext;
70
- readonly events: EventEmitter<DevframeAgentHostEvents>;
71
- private readonly tools;
72
- private readonly resources;
73
- private readonly providers;
74
- private _rpcUnsubscribe;
75
- constructor(context: DevframeNodeContext);
76
- registerTool(input: AgentToolInput): AgentHandle;
77
- unregisterTool(id: string): boolean;
78
- registerToolProvider(provider: AgentToolProvider): AgentToolProviderHandle;
79
- registerResource(input: AgentResourceInput): AgentHandle;
80
- unregisterResource(id: string): boolean;
81
- list(): AgentManifest;
82
- getTool(id: string): AgentTool | undefined;
83
- getResource(id: string): AgentResource | undefined;
84
- invoke(id: string, args: unknown): Promise<unknown>;
85
- read(id: string): Promise<AgentResourceContent>;
86
- /** @internal */
87
- _dispose(): void;
88
- private _validateToolId;
89
- private _projectTool;
90
- /** Query every registered provider, projecting inputs to serializable tools. */
91
- private _collectProviderTools;
92
- private _collectRpcTools;
93
- private _findRpcDefinition;
94
- }
95
- //#endregion
96
- //#region src/node/host-diagnostics.d.ts
97
- declare class DevframeDiagnosticsHost implements DevframeDiagnosticsHost$1 {
98
- readonly context: DevframeNodeContext;
99
- private _registry;
100
- readonly logger: DevframeDiagnosticsLogger;
101
- readonly defineDiagnostics: DevframeDiagnosticsHost$1['defineDiagnostics'];
102
- constructor(context: DevframeNodeContext, initialDefinitions?: Array<Record<string, unknown>>);
103
- register(diagnostics: Record<string, unknown>): void;
104
- }
105
- //#endregion
106
- //#region src/node/host-h3.d.ts
107
- interface CreateH3DevframeHostOptions {
108
- /** The h3 app instance — registered once the CLI adapter lands. */
109
- app?: unknown;
110
- /**
111
- * Host the standalone server listens on, e.g. `http://localhost:9999`.
112
- * Consumed by `resolveOrigin` for dock entries that need an absolute URL.
113
- */
114
- origin: string;
115
- /**
116
- * Register a static-file handler at `base` serving files from `distDir`.
117
- * Wired into the h3 app once the CLI adapter lands (commit 5). For now
118
- * the CLI isn't running, so the default is a no-op.
119
- */
120
- mount?: (base: string, distDir: string) => void | Promise<void>;
121
- /**
122
- * Namespace for storage paths returned by `getStorageDir`. Workspace
123
- * state (committable) lives under `${workspaceRoot}/.devframe/`, project
124
- * state under `${workspaceRoot}/node_modules/.<appName>/devframe/`, and
125
- * global state under `${homedir()}/.<appName>/devframe/`. Pick the
126
- * devtool's id (or another stable, filesystem-safe identifier) so the
127
- * standalone host doesn't collide with other tools' storage.
128
- */
129
- appName: string;
130
- /**
131
- * Workspace root used as the parent of the per-project storage
132
- * directory. Defaults to `process.cwd()`.
133
- */
134
- workspaceRoot?: string;
135
- }
136
- /**
137
- * h3-backed {@link DevframeHost} — used by the standalone CLI adapter.
138
- */
139
- declare function createH3DevframeHost(options: CreateH3DevframeHostOptions): DevframeHost;
140
- //#endregion
141
- //#region src/node/host-services.d.ts
142
- /**
143
- * Cross-plugin service registry (see `types/services.ts` for the contract).
144
- * Values are held per context instance; `whenAvailable` subscriptions make
145
- * the mechanism robust against setup ordering between provider and consumer.
146
- */
147
- declare class DevframeServicesHostImpl implements DevframeServicesHost {
148
- private services;
149
- private listeners;
150
- provide<ID extends DevframeServiceId>(id: ID, service: DevframeServiceOf<ID>): () => void;
151
- get<ID extends DevframeServiceId>(id: ID): DevframeServiceOf<ID> | undefined;
152
- has(id: DevframeServiceId): boolean;
153
- whenAvailable<ID extends DevframeServiceId>(id: ID, callback: (service: DevframeServiceOf<ID>) => void): () => void;
154
- keys(): string[];
155
- }
156
- //#endregion
157
- //#region src/node/host-views.d.ts
158
- declare class DevframeViewHost implements DevframeViewHost$1 {
159
- readonly context: DevframeNodeContext;
160
- /**
161
- * @internal
162
- */
163
- buildStaticDirs: {
164
- baseUrl: string;
165
- distDir: string;
166
- }[];
167
- constructor(context: DevframeNodeContext);
168
- hostStatic(baseUrl: string, distDir: string): void;
169
- }
170
- //#endregion
171
- //#region src/node/instance-registry.d.ts
172
- /**
173
- * One running devframe instance, as recorded in the instance registry.
174
- * Records are self-describing JSON — additive fields are safe.
175
- *
176
- * @experimental The agent-native surface is experimental and may change
177
- * without a major version bump until it stabilizes.
178
- */
179
- interface DevframeInstanceRecord {
180
- /** Process id of the dev server. */
181
- pid: number;
182
- /** Listening port. */
183
- port: number;
184
- /** Dialable HTTP origin, e.g. `http://127.0.0.1:9876`. */
185
- origin: string;
186
- /** Base path the devframe is mounted at (trailing slash). */
187
- basePath: string;
188
- /** Definition id. */
189
- id: string;
190
- /** Definition display name. */
191
- name?: string;
192
- /** Working directory the instance was started from. */
193
- rootDir: string;
194
- /**
195
- * Absolute URL path of the MCP Streamable-HTTP endpoint on `origin`, or
196
- * `null` when the instance runs without an MCP route.
197
- */
198
- mcp: {
199
- path: string;
200
- } | null;
201
- /** Epoch-ms timestamp of registration. */
202
- startedAt: number;
203
- }
204
- /**
205
- * Handle returned by {@link registerDevframeInstance}.
206
- *
207
- * @experimental
208
- */
209
- interface DevframeInstanceRegistration {
210
- /** The registry file backing this registration. */
211
- readonly file: string;
212
- /** Remove the record (idempotent). Call on server close. */
213
- unregister: () => void;
214
- }
215
- /**
216
- * Record a running devframe instance in the global instance registry so
217
- * discovery tooling (`devframe connect`, editor integrations) can find it
218
- * without port guessing.
219
- *
220
- * `createDevServer` registers automatically; custom hosts that serve a
221
- * devframe in-process (e.g. `@devframes/next`'s host inside a Next dev
222
- * server) call this explicitly with the origin they are reachable at.
223
- *
224
- * The record is written atomically to `<dir>/<pid>-<port>.json` and removed
225
- * by {@link DevframeInstanceRegistration.unregister}. Records surviving a
226
- * crash are pruned by readers whose liveness probe fails. Registration never
227
- * throws — a write failure degrades to a coded warning (`DF0045`), since a
228
- * dev server must not die over discovery metadata.
229
- *
230
- * @experimental
231
- */
232
- declare function registerDevframeInstance(record: DevframeInstanceRecord, options?: {
233
- instancesDir?: string;
234
- }): DevframeInstanceRegistration;
235
- /**
236
- * Read the registry and split records into live and dead by probing each
237
- * one's `__connection.json`, deleting dead records (prune-on-read). Live
238
- * records carry the dialable origin the probe confirmed (a `localhost`
239
- * record may come back as `127.0.0.1` / `[::1]`).
240
- *
241
- * A liveness probe only proves *something* answers on the record's port, so
242
- * records left behind by killed processes shadow the server currently bound
243
- * there: per `(port, basePath)` only the newest record survives, older
244
- * ghosts are pruned with the dead.
245
- *
246
- * @experimental
247
- */
248
- declare function listLiveDevframeInstances(options?: {
249
- instancesDir?: string;
250
- timeoutMs?: number;
251
- }): Promise<{
252
- live: DevframeInstanceRecord[];
253
- pruned: DevframeInstanceRecord[];
254
- }>;
255
- //#endregion
256
- //#region src/node/rpc-shared-state.d.ts
257
- declare function createRpcSharedStateServerHost(rpc: RpcFunctionsHost): RpcSharedStateHost;
258
- //#endregion
259
- //#region src/node/rpc-streaming.d.ts
260
- /**
261
- * Build the server-side streaming host. Mirrors the layout of
262
- * `createRpcSharedStateServerHost` — registers a fixed set of internal
263
- * RPC methods (`subscribe` / `unsubscribe` / `cancel`) once, then per-channel
264
- * state lives in a `Map<channelName, ChannelState>`.
265
- */
266
- declare function createRpcStreamingServerHost(rpc: RpcFunctionsHost): RpcStreamingHost;
267
- //#endregion
268
- //#region src/node/scope.d.ts
269
- /**
270
- * Build a namespace-scoped view of a {@link DevframeNodeContext}. Every
271
- * RPC id, shared-state key, and streaming channel passed through the
272
- * returned `rpc` surface is auto-namespaced with `<namespace>:`.
273
- */
274
- declare function createScopedNodeContext<NS extends string = string>(context: DevframeNodeContext, namespace: NS): DevframeScopedNodeContext<NS>;
275
- //#endregion
276
- //#region src/node/settings.d.ts
277
- /**
278
- * Build the node-side `settings` surface for a scope namespace. `project`
279
- * persists under the host's `workspace` storage dir, `global` under its
280
- * `global` dir. Each is a file-backed, client-synced key-value store.
281
- */
282
- declare function createNodeSettings<T extends Record<string, any> = Record<string, any>>(context: DevframeNodeContext, namespace: string): DevframeSettings<T>;
283
- //#endregion
284
28
  //#region src/node/storage.d.ts
285
29
  interface CreateStorageOptions<T extends object> {
286
30
  filepath: string;
@@ -290,12 +34,4 @@ interface CreateStorageOptions<T extends object> {
290
34
  }
291
35
  declare function createStorage<T extends object>(options: CreateStorageOptions<T>): SharedState<T>;
292
36
  //#endregion
293
- //#region src/node/utils.d.ts
294
- declare function isObject(value: unknown): value is Record<string, any>;
295
- /** Map a bind host to a host a client can actually connect to. */
296
- declare function toDialableHost(host: string): string;
297
- /** Format a bind host for use in a URL authority (dialable, IPv6-bracketed). */
298
- declare function formatHostForUrl(host: string): string;
299
- declare function normalizeHttpServerUrl(host: string, port: number | string): string;
300
- //#endregion
301
- export { AgentArgsFallback, CreateH3DevframeHostOptions, CreateHostContextOptions, CreateStorageOptions, DevframeAgentHost, DevframeDiagnosticsHost, type DevframeInstanceRecord, type DevframeInstanceRegistration, DevframeServicesHostImpl, DevframeViewHost, type RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, coerceAgentPositionalArgs, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, listLiveDevframeInstances, normalizeHttpServerUrl, registerDevframeInstance, startHttpAndWs, toDialableHost };
37
+ export { CreateHostContextOptions, CreateStorageOptions, type RpcFunctionsHost, createHostContext, createStorage };
@@ -1,5 +1,3 @@
1
- import { a as DevframeViewHost, c as createRpcSharedStateServerHost, d as coerceAgentPositionalArgs, i as createNodeSettings, l as DevframeDiagnosticsHost, n as createHostContext, o as DevframeServicesHostImpl, r as createScopedNodeContext, s as createRpcStreamingServerHost, t as createH3DevframeHost, u as DevframeAgentHost } from "../host-h3-D2hYZvDK.mjs";
2
- import { t as createStorage } from "../storage-CTNVbuFB.mjs";
3
- import { r as registerDevframeInstance, t as listLiveDevframeInstances } from "../instance-registry-BnnA2Eoh.mjs";
4
- import { a as toDialableHost, i as normalizeHttpServerUrl, n as formatHostForUrl, r as isObject, t as startHttpAndWs } from "../server-CD8XmBXl.mjs";
5
- export { DevframeAgentHost, DevframeDiagnosticsHost, DevframeServicesHostImpl, DevframeViewHost, coerceAgentPositionalArgs, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, listLiveDevframeInstances, normalizeHttpServerUrl, registerDevframeInstance, startHttpAndWs, toDialableHost };
1
+ import { t as createHostContext } from "../context-CEe4PBz1.mjs";
2
+ import { t as createStorage } from "../storage-CYye7P7L.mjs";
3
+ export { createHostContext, createStorage };
@@ -0,0 +1,59 @@
1
+ import { Diagnostic, createConsoleReporter, defineDiagnostics, defineProdDiagnostics, formatDiagnostic } from "nostics";
2
+ import { ansiFormatter, ansiFormatter as ansiFormatter$1 } from "nostics/formatters/ansi";
3
+ //#region src/utils/colors.ts
4
+ function makeColor(open, close) {
5
+ const o = `\x1B[${open}m`;
6
+ const c = `\x1B[${close}m`;
7
+ return ((arg, ...values) => {
8
+ if (Array.isArray(arg) && "raw" in arg) {
9
+ const strings = arg;
10
+ let out = "";
11
+ for (let i = 0; i < strings.length; i++) {
12
+ out += strings[i];
13
+ if (i < values.length) out += String(values[i]);
14
+ }
15
+ return `${o}${out}${c}`;
16
+ }
17
+ return `${o}${String(arg)}${c}`;
18
+ });
19
+ }
20
+ const colors = {
21
+ blue: makeColor(34, 39),
22
+ cyan: makeColor(36, 39),
23
+ gray: makeColor(90, 39),
24
+ green: makeColor(32, 39),
25
+ red: makeColor(31, 39),
26
+ yellow: makeColor(33, 39),
27
+ bold: makeColor(1, 22),
28
+ dim: makeColor(2, 22),
29
+ reset: makeColor(0, 0),
30
+ underline: makeColor(4, 24)
31
+ };
32
+ //#endregion
33
+ //#region src/utils/nostics.ts
34
+ const formatAnsi = ansiFormatter(colors);
35
+ /**
36
+ * The reporter every {@link defineDiagnostics} call below wires in ahead of
37
+ * any caller-supplied ones: prints the diagnostic through devframe's own
38
+ * ANSI colors via `console[method]` (default `'warn'`).
39
+ */
40
+ function devframeReporter(d, { method = "warn" } = {}) {
41
+ console[method](formatAnsi(d));
42
+ }
43
+ /**
44
+ * Drop-in replacement for `nostics`'s `defineDiagnostics()` with devframe's
45
+ * ANSI console reporter pre-wired ahead of any `reporters` passed in. Every
46
+ * `diagnostics.ts` in devframe core, `@devframes/hub`, `@devframes/json-render`,
47
+ * and the built-in plugins defines its codes through this instead of
48
+ * `nostics`'s own `defineDiagnostics` — the reporter registration lives
49
+ * here, once, so none of them need to build their own reporter (`colors`,
50
+ * `ansiFormatter`) or take a direct dependency on `nostics` themselves.
51
+ */
52
+ function defineDiagnostics$1(options) {
53
+ return defineDiagnostics({
54
+ ...options,
55
+ reporters: [devframeReporter, ...options.reporters ?? []]
56
+ });
57
+ }
58
+ //#endregion
59
+ export { defineProdDiagnostics as a, defineDiagnostics$1 as i, ansiFormatter$1 as n, formatDiagnostic as o, createConsoleReporter as r, colors as s, Diagnostic as t };
@@ -0,0 +1,33 @@
1
+ import { AnyDiagnosticReporter, AnyDiagnosticReporter as AnyDiagnosticReporter$1, ConsoleMethod, ConsoleReporterOptions, Diagnostic, Diagnostic as Diagnostic$1, DiagnosticCallParams, DiagnosticDefinition, DiagnosticDefinition as DiagnosticDefinition$1, DiagnosticHandle, DiagnosticInit, DiagnosticReporter, Diagnostics, Diagnostics as Diagnostics$1, createConsoleReporter, defineProdDiagnostics, formatDiagnostic } from "nostics";
2
+ import { ansiFormatter } from "nostics/formatters/ansi";
3
+ //#region src/utils/nostics.d.ts
4
+ /**
5
+ * The reporter every {@link defineDiagnostics} call below wires in ahead of
6
+ * any caller-supplied ones: prints the diagnostic through devframe's own
7
+ * ANSI colors via `console[method]` (default `'warn'`).
8
+ */
9
+ declare function devframeReporter(d: Diagnostic, { method }?: {
10
+ method?: 'log' | 'warn' | 'error';
11
+ }): void;
12
+ /**
13
+ * Options accepted by {@link defineDiagnostics} — identical to `nostics`'s
14
+ * own `DefineDiagnosticsOptions`, minus the reporter devframe already
15
+ * prepends.
16
+ */
17
+ type DevframeDefineDiagnosticsOptions<Codes extends Record<string, DiagnosticDefinition>, Reporters extends readonly AnyDiagnosticReporter[] = []> = Parameters<typeof defineDiagnostics<Codes, Reporters>>[0];
18
+ /**
19
+ * Drop-in replacement for `nostics`'s `defineDiagnostics()` with devframe's
20
+ * ANSI console reporter pre-wired ahead of any `reporters` passed in. Every
21
+ * `diagnostics.ts` in devframe core, `@devframes/hub`, `@devframes/json-render`,
22
+ * and the built-in plugins defines its codes through this instead of
23
+ * `nostics`'s own `defineDiagnostics` — the reporter registration lives
24
+ * here, once, so none of them need to build their own reporter (`colors`,
25
+ * `ansiFormatter`) or take a direct dependency on `nostics` themselves.
26
+ */
27
+ declare function defineDiagnostics<const Codes extends Record<string, DiagnosticDefinition>, const Reporters extends readonly AnyDiagnosticReporter[] = []>(options: {
28
+ docsBase?: string | ((code: keyof Codes) => string | undefined);
29
+ codes: Codes;
30
+ reporters?: Reporters;
31
+ }): Diagnostics<Codes, readonly [typeof devframeReporter, ...Reporters]>;
32
+ //#endregion
33
+ export { Diagnostic$1 as a, DiagnosticHandle as c, Diagnostics$1 as d, ansiFormatter as f, formatDiagnostic as g, defineProdDiagnostics as h, DevframeDefineDiagnosticsOptions as i, DiagnosticInit as l, defineDiagnostics as m, ConsoleMethod as n, DiagnosticCallParams as o, createConsoleReporter as p, ConsoleReporterOptions as r, DiagnosticDefinition$1 as s, AnyDiagnosticReporter$1 as t, DiagnosticReporter as u };
@@ -1,7 +1,7 @@
1
- import "../devframe-mQ4qZAuo.mjs";
2
- import { E as Thenable, S as RpcFunctionSetupResult, c as RpcDump, g as RpcFunctionAgentOptions } from "../types-CnJSgRVa.mjs";
3
- import "../index-Dbw1p5ch.mjs";
4
- import { t as SimpleSchema } from "../simple-schema-BDzLeJDk.mjs";
1
+ import "../devframe-DJMg0WLe.mjs";
2
+ import "../index-tdrk1bzV.mjs";
3
+ import { E as Thenable, S as RpcFunctionSetupResult, c as RpcDump, g as RpcFunctionAgentOptions } from "../types-Djq7CBXh.mjs";
4
+ import { SimpleSchema } from "../utils/simple-schema.mjs";
5
5
  //#region src/recipes/common-rpc-functions.d.ts
6
6
  /**
7
7
  * Editor commands that `launch-editor` (the library behind
@@ -1,5 +1,5 @@
1
- import { b as DevframeNodeContext, p as DevframeAuthHandler } from "../devframe-mQ4qZAuo.mjs";
2
- import "../index-b64Uuhy2.mjs";
1
+ import { g as DevframeNodeContext, u as DevframeAuthHandler } from "../devframe-DJMg0WLe.mjs";
2
+ import "../index-CB-fSUyn.mjs";
3
3
  //#region src/recipes/interactive-auth.d.ts
4
4
  interface CreateInteractiveAuthOptions {
5
5
  /**
@@ -44,7 +44,7 @@ interface CreateInteractiveAuthOptions {
44
44
  * auth.printBanner()
45
45
  *
46
46
  * // wire `auth.authorize` / `auth.onConnect` into your transport, or pass
47
- * // the whole handler to `startHttpAndWs({ auth, ... })`.
47
+ * // the whole handler to `initDevframe` / `initHub` via their `auth` option.
48
48
  * ```
49
49
  */
50
50
  declare function createInteractiveAuth(context: DevframeNodeContext, options?: CreateInteractiveAuthOptions): DevframeAuthHandler;
@@ -1,8 +1,8 @@
1
- import { n as colors } from "../diagnostics-reporter-CsIG85Q5.mjs";
2
- import { isAnonymousRpcMethod } from "../constants.mjs";
1
+ import { s as colors } from "../nostics-CzECRXpE.mjs";
3
2
  import { n as defineRpcFunction } from "../define-BLWPsH6y.mjs";
4
- import { t as getInternalContext } from "../context-CBg8iRbQ.mjs";
5
- import { a as verifyAuthToken, n as exchangeTempAuthCode, r as getTempAuthCode, t as buildOtpAuthUrl } from "../state-BeUHDDjk.mjs";
3
+ import { isAnonymousRpcMethod } from "../constants.mjs";
4
+ import { a as verifyAuthToken, n as exchangeTempAuthCode, r as getTempAuthCode, t as buildOtpAuthUrl } from "../state-Cc1IeSmQ.mjs";
5
+ import { t as getInternalContext } from "../context-xdynGSLP.mjs";
6
6
  import { t as s } from "../simple-schema-DQPZrAaZ.mjs";
7
7
  //#region src/recipes/interactive-auth.ts
8
8
  function defaultBanner(info) {
@@ -26,7 +26,7 @@ function defaultBanner(info) {
26
26
  * auth.printBanner()
27
27
  *
28
28
  * // wire `auth.authorize` / `auth.onConnect` into your transport, or pass
29
- * // the whole handler to `startHttpAndWs({ auth, ... })`.
29
+ * // the whole handler to `initDevframe` / `initHub` via their `auth` option.
30
30
  * ```
31
31
  */
32
32
  function createInteractiveAuth(context, options = {}) {
@@ -105,14 +105,14 @@ function createInteractiveAuth(context, options = {}) {
105
105
  if (isAnonymousRpcMethod(methodName)) return true;
106
106
  return !!session.meta.isTrusted;
107
107
  }
108
- function onConnect(peer, session) {
108
+ function onConnect(connection, session) {
109
109
  let token;
110
110
  let requestOrigin;
111
111
  try {
112
- token = new URL(peer.request?.url ?? "", "http://localhost").searchParams.get("devframe_auth_token") ?? void 0;
112
+ token = new URL(connection.request?.url ?? "", "http://localhost").searchParams.get("devframe_auth_token") ?? void 0;
113
113
  } catch {}
114
114
  try {
115
- requestOrigin = peer.request?.headers?.get?.("origin") ?? void 0;
115
+ requestOrigin = connection.request?.headers?.get?.("origin") ?? void 0;
116
116
  } catch {}
117
117
  if (!token) return;
118
118
  if (isStaticToken(token)) {
@@ -0,0 +1,123 @@
1
+ //#region src/types/remote-assets.d.ts
2
+ /**
3
+ * A version-locked pointer at browser assets published as their own npm
4
+ * package (e.g. `@devframes/plugin-git-client`), served through devframe's
5
+ * caching back-proxy instead of a directory shipped inside the node package.
6
+ *
7
+ * Resolution order at serve time:
8
+ *
9
+ * 1. The package installed locally (resolved from {@link resolveFrom})
10
+ * — the zero-network / air-gap path. Version skew warns; a major
11
+ * version mismatch throws.
12
+ * 2. The per-file cache under
13
+ * `<storageDir project>/.remote-assets/<package>@<version>/`.
14
+ * 3. The CDN {@link provider} — each requested file streams through to
15
+ * the browser while being written into the cache.
16
+ *
17
+ * Anywhere a static mount accepts a dist directory (`cli.distDir`,
18
+ * `hostStatic`, `mountStatic`) it also accepts this object — see
19
+ * {@link StaticAssetsSource}.
20
+ */
21
+ interface RemoteAssets {
22
+ /** npm package name that ships the assets, e.g. `@devframes/plugin-git-client`. */
23
+ package: string;
24
+ /** Exact version to serve, e.g. `1.2.3`. Typically the host package's own version. */
25
+ version: string;
26
+ /**
27
+ * Subpath inside the package the served assets live under.
28
+ *
29
+ * @default 'dist'
30
+ */
31
+ path?: string;
32
+ /**
33
+ * CDN that mirrors npm and serves individual package files.
34
+ *
35
+ * @default 'jsdelivr'
36
+ */
37
+ provider?: RemoteAssetsProvider;
38
+ /**
39
+ * `import.meta.url` of the declaring module. When set, a locally
40
+ * installed copy of {@link package} is resolved from this module's own
41
+ * dependency graph first (works under pnpm's strict layout) and served
42
+ * with zero network. Omitting it skips the installed-package step —
43
+ * cache + CDN still work.
44
+ */
45
+ resolveFrom?: string | null;
46
+ /** Custom fetch implementation (proxies, tests). Defaults to the global `fetch`. */
47
+ fetch?: typeof globalThis.fetch;
48
+ /**
49
+ * Never touch the network: serve only from the locally installed package
50
+ * or files already in the cache.
51
+ *
52
+ * @default false
53
+ */
54
+ offline?: boolean;
55
+ }
56
+ /**
57
+ * Built-in CDN providers (`'jsdelivr'` — default, `'unpkg'`) or a custom
58
+ * provider for corp mirrors.
59
+ */
60
+ type RemoteAssetsProvider = 'jsdelivr' | 'unpkg' | RemoteAssetsProviderCustom;
61
+ /** A custom {@link RemoteAssets} CDN provider (e.g. an internal npm mirror). */
62
+ interface RemoteAssetsProviderCustom {
63
+ /**
64
+ * Absolute URL serving `filePath` (package-relative, POSIX, no leading
65
+ * slash) of `pkg@version`.
66
+ */
67
+ fileUrl: (pkg: string, version: string, filePath: string) => string;
68
+ /**
69
+ * List every file path in `pkg@version` (package-relative, no leading
70
+ * slash). Powers request-path resolution (correct 404s / SPA fallback)
71
+ * and build-time materialization. When omitted, requests are resolved by
72
+ * probing {@link fileUrl} directly and builds cannot materialize from
73
+ * this provider.
74
+ */
75
+ listFiles?: (pkg: string, version: string, fetchImpl: typeof globalThis.fetch) => Promise<string[]>;
76
+ }
77
+ /**
78
+ * What every static-assets seam accepts: a local dist directory, or a
79
+ * {@link RemoteAssets} pointer served through the caching back-proxy.
80
+ */
81
+ type StaticAssetsSource = string | RemoteAssets;
82
+ /**
83
+ * What the remote-assets fallback page posts to `window.parent` when a
84
+ * devframe's client assets could be served from neither a local install nor
85
+ * their provider. A viewer embedding the devframe in an iframe listens for
86
+ * `DEVFRAME_REMOTE_ASSETS_ERROR_MESSAGE_TYPE` (`devframe/constants`) and can
87
+ * render the failure in its own design, with the two ways out the page also
88
+ * spells out: install `package@version` locally, or restore network access.
89
+ */
90
+ interface RemoteAssetsErrorMessage {
91
+ type: 'devframe:remote-assets-error';
92
+ /** npm package the assets are published as. */
93
+ package: string;
94
+ /** Exact version the devframe asked for. */
95
+ version: string;
96
+ /** Why the fetch failed, as reported by the provider or the network stack. */
97
+ reason: string;
98
+ }
99
+ /**
100
+ * A resolved, servable handle over a {@link RemoteAssets} declaration —
101
+ * produced by `resolveStaticAssetsSource()` (`devframe/utils/remote-assets`)
102
+ * and consumed by the static-serving engine (`devframe/utils/serve-static`).
103
+ */
104
+ interface RemoteAssetsStore {
105
+ /** The declaration this store serves (with defaults applied). */
106
+ readonly assets: RemoteAssets & {
107
+ path: string;
108
+ };
109
+ /**
110
+ * Resolve a request path (relative to the mount base, SPA fallback to
111
+ * `index.html`) and return a `Response`: streamed from the cache when
112
+ * present, otherwise through the provider while being written into the
113
+ * cache. `null` on a miss (404); throws on provider/network failure.
114
+ */
115
+ serve: (urlPath: string) => Promise<Response | null>;
116
+ /**
117
+ * Download every listed file under `assets.path` into `targetDir`
118
+ * (paths relative to `assets.path`). Requires a provider file listing.
119
+ */
120
+ materialize: (targetDir: string) => Promise<void>;
121
+ }
122
+ //#endregion
123
+ export { RemoteAssetsStore as a, RemoteAssetsProviderCustom as i, RemoteAssetsErrorMessage as n, StaticAssetsSource as o, RemoteAssetsProvider as r, RemoteAssets as t };