devframe 0.8.2 → 0.9.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/_shared-CttmCMBi.mjs +70 -0
  2. package/dist/_shared-DmpWW-HH.d.mts +43 -0
  3. package/dist/adapters/build.d.mts +1 -1
  4. package/dist/adapters/build.mjs +6 -5
  5. package/dist/adapters/cac.d.mts +1 -1
  6. package/dist/adapters/cac.mjs +157 -1
  7. package/dist/adapters/dev.d.mts +20 -42
  8. package/dist/adapters/dev.mjs +2 -1
  9. package/dist/adapters/embedded.d.mts +1 -1
  10. package/dist/adapters/initiate.d.mts +223 -0
  11. package/dist/adapters/initiate.mjs +2 -0
  12. package/dist/adapters/mcp.d.mts +26 -2
  13. package/dist/adapters/mcp.mjs +2 -2
  14. package/dist/cli/main.mjs +2 -2
  15. package/dist/client/index.d.mts +70 -6
  16. package/dist/client/index.mjs +743 -408
  17. package/dist/constants.d.mts +19 -6
  18. package/dist/constants.mjs +19 -6
  19. package/dist/{context-CBg8iRbQ.mjs → context-C33rR7n0.mjs} +1 -1
  20. package/dist/{context-DoSozfvx.d.mts → context-CSCwoABx.d.mts} +1 -1
  21. package/dist/{host-h3-D2hYZvDK.mjs → context-Du11TLcO.mjs} +5 -255
  22. package/dist/dev-BEveeA5H.mjs +233 -0
  23. package/dist/{devframe-mQ4qZAuo.d.mts → devframe-Bdd9YXTy.d.mts} +88 -25
  24. package/dist/{diagnostics-D7wM2cwM.mjs → diagnostics-DLYH5oD3.mjs} +16 -0
  25. package/dist/dist-D8jAMwxU.mjs +227 -0
  26. package/dist/helpers/vite.d.mts +43 -39
  27. package/dist/helpers/vite.mjs +26 -38
  28. package/dist/host-agent-CpbAoqBx.mjs +230 -0
  29. package/dist/host-h3-CzCZwtuV.mjs +26 -0
  30. package/dist/{fetch-BKaD0Vb3.mjs → http-DLr_cJZ7.mjs} +42 -4
  31. package/dist/{index-b64Uuhy2.d.mts → index-CZRd2K1C.d.mts} +2 -2
  32. package/dist/{index-Dbw1p5ch.d.mts → index-DSCq4M4q.d.mts} +2 -31
  33. package/dist/index.d.mts +9 -4
  34. package/dist/index.mjs +8 -1
  35. package/dist/{instance-registry-BnnA2Eoh.mjs → instance-registry-BQqGoDO9.mjs} +9 -2
  36. package/dist/instance-shell-DBTXTSjN.d.mts +264 -0
  37. package/dist/instance-shell-KRdee1QF.mjs +485 -0
  38. package/dist/internal/index.d.mts +150 -0
  39. package/dist/internal/index.mjs +7 -0
  40. package/dist/node/auth.d.mts +2 -2
  41. package/dist/node/hub-internals.d.mts +2 -14
  42. package/dist/node/hub-internals.mjs +2 -2
  43. package/dist/node/index.d.mts +3 -267
  44. package/dist/node/index.mjs +3 -5
  45. package/dist/recipes/common-rpc-functions.d.mts +3 -3
  46. package/dist/recipes/interactive-auth.d.mts +3 -3
  47. package/dist/recipes/interactive-auth.mjs +6 -6
  48. package/dist/rolldown-runtime-JspESFgx.mjs +35 -0
  49. package/dist/rpc/dump.d.mts +77 -1
  50. package/dist/rpc/dump.mjs +1 -1
  51. package/dist/rpc/index.d.mts +2 -2
  52. package/dist/rpc/index.mjs +3 -17
  53. package/dist/rpc/transports/sse-client.d.mts +2 -0
  54. package/dist/rpc/transports/sse-client.mjs +142 -0
  55. package/dist/rpc/transports/sse-server.d.mts +61 -0
  56. package/dist/rpc/transports/sse-server.mjs +209 -0
  57. package/dist/rpc/transports/ws-bun.d.mts +35 -0
  58. package/dist/rpc/transports/ws-bun.mjs +31 -0
  59. package/dist/rpc/transports/ws-client.d.mts +1 -1
  60. package/dist/rpc/transports/ws-client.mjs +10 -18
  61. package/dist/rpc/transports/ws-server.d.mts +2 -2
  62. package/dist/rpc/transports/ws-server.mjs +2 -235
  63. package/dist/rpc-core-CGctXToO.d.mts +48 -0
  64. package/dist/rpc-core-CqcJkAu9.mjs +81 -0
  65. package/dist/{serialization-C8Mnw9hK.mjs → serialization-BHY8M5NQ.mjs} +1 -1
  66. package/dist/{shared-state-6kHolYZy.mjs → shared-state-fRRbRUtD.mjs} +1 -1
  67. package/dist/sse-client-BsIK3hMD.d.mts +37 -0
  68. package/dist/{dump-CgZShDRB.mjs → static-CvjkO8QE.mjs} +2 -265
  69. package/dist/{storage-CTNVbuFB.mjs → storage-BcmVEJRc.mjs} +2 -2
  70. package/dist/types/index.d.mts +3 -3
  71. package/dist/types/index.mjs +1 -6
  72. package/dist/utils/events.d.mts +1 -1
  73. package/dist/utils/launch-editor.mjs +1 -25
  74. package/dist/utils/open.mjs +1 -1
  75. package/dist/utils/serve-static.mjs +1 -1
  76. package/dist/utils/shared-state.d.mts +1 -1
  77. package/dist/utils/shared-state.mjs +1 -1
  78. package/dist/utils/simple-schema.d.mts +101 -1
  79. package/dist/utils/streaming-channel.d.mts +1 -1
  80. package/dist/validation-BiuDXTKW.mjs +266 -0
  81. package/dist/wire-codec-9VhIKnyp.mjs +58 -0
  82. package/dist/{ws-client-B6Tnr0ic.d.mts → ws-client-CdNuATYa.d.mts} +6 -1
  83. package/dist/ws-server-Bk1hOG3X.mjs +267 -0
  84. package/dist/{ws-server-uKQcClcJ.d.mts → ws-server-Ces08fjP.d.mts} +89 -8
  85. package/package.json +10 -9
  86. package/skills/devframe/SKILL.md +84 -85
  87. package/dist/_shared-bWRzeSa0.mjs +0 -19
  88. package/dist/adapters/cli.d.mts +0 -11
  89. package/dist/adapters/cli.mjs +0 -6
  90. package/dist/cac-D4_9ok0z.mjs +0 -157
  91. package/dist/dev-Bc49u3qg.mjs +0 -439
  92. package/dist/http-C4T68YV6.mjs +0 -38
  93. package/dist/index-vAX6bYuc.d.mts +0 -78
  94. package/dist/recipes/open-helpers.d.mts +0 -6
  95. package/dist/recipes/open-helpers.mjs +0 -6
  96. package/dist/server-CD8XmBXl.mjs +0 -167
  97. package/dist/server-UHWae43Q.d.mts +0 -149
  98. package/dist/simple-schema-BDzLeJDk.d.mts +0 -102
  99. package/dist/utils/promise.d.mts +0 -8
  100. package/dist/utils/promise.mjs +0 -15
  101. package/dist/utils/scope.d.mts +0 -11
  102. package/dist/utils/scope.mjs +0 -15
  103. package/dist/{open-Deb5xmIT.mjs → open-Dz4V4irZ.mjs} +1 -1
@@ -1,4 +1,5 @@
1
- import { b as DevframeNodeContext, r as DevframeDefinition } from "../devframe-mQ4qZAuo.mjs";
1
+ import { r as DevframeDefinition, x as DevframeNodeContext } from "../devframe-Bdd9YXTy.mjs";
2
+ import { H3 } from "h3";
2
3
  import "@modelcontextprotocol/server";
3
4
  //#region src/adapters/mcp/build-server.d.ts
4
5
  interface CreateMcpServerOptions {
@@ -85,4 +86,27 @@ interface McpFetchHandler {
85
86
  */
86
87
  declare function createMcpFetchHandler(ctx: DevframeNodeContext, options: CreateMcpFetchHandlerOptions): McpFetchHandler;
87
88
  //#endregion
88
- export { type CreateMcpFetchHandlerOptions, type CreateMcpServerOptions, type McpFetchHandler, type McpServerHandle, createMcpFetchHandler, createMcpServer };
89
+ //#region src/adapters/mcp/http.d.ts
90
+ interface MountMcpHttpOptions extends CreateMcpFetchHandlerOptions {}
91
+ interface MountedMcpHttp {
92
+ /** Tear down every live MCP session (closes servers, drops subscriptions). */
93
+ dispose: () => Promise<void>;
94
+ }
95
+ /**
96
+ * Mount an MCP Streamable-HTTP endpoint on an h3 app at `path` — the h3
97
+ * binding over {@link createMcpFetchHandler}, which owns the sessions, the
98
+ * origin gate, and the transport plumbing.
99
+ *
100
+ * The handler is web-standard — it takes the h3 event's web `Request` and
101
+ * returns a web `Response` (an SSE `ReadableStream` body for the
102
+ * server→client stream). We copy that response onto `event.res` and return
103
+ * its body rather than returning the `Response` object directly, so a
104
+ * legitimate MCP 404 (unknown session) isn't swallowed by h3's
105
+ * "Response-with-404 falls through to the next handler" rule (which would
106
+ * otherwise hand the request to the SPA static catch-all).
107
+ *
108
+ * @experimental
109
+ */
110
+ declare function mountMcpHttp(app: H3, ctx: DevframeNodeContext, path: string, options: MountMcpHttpOptions): MountedMcpHttp;
111
+ //#endregion
112
+ export { type CreateMcpFetchHandlerOptions, type CreateMcpServerOptions, type McpFetchHandler, type McpServerHandle, type MountMcpHttpOptions, type MountedMcpHttp, createMcpFetchHandler, createMcpServer, mountMcpHttp };
@@ -1,2 +1,2 @@
1
- import { n as createMcpServer, t as createMcpFetchHandler } from "../fetch-BKaD0Vb3.mjs";
2
- export { createMcpFetchHandler, createMcpServer };
1
+ import { i as createMcpServer, n as mountMcpHttp, r as createMcpFetchHandler } from "../http-DLr_cJZ7.mjs";
2
+ export { createMcpFetchHandler, createMcpServer, mountMcpHttp };
package/dist/cli/main.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { t as diagnostics } from "../diagnostics-D7wM2cwM.mjs";
2
- import { n as probeDevframeOrigin, t as listLiveDevframeInstances } from "../instance-registry-BnnA2Eoh.mjs";
1
+ import { t as diagnostics } from "../diagnostics-DLYH5oD3.mjs";
2
+ import { n as listLiveDevframeInstances, r as probeDevframeOrigin } from "../instance-registry-BQqGoDO9.mjs";
3
3
  import { t as toAgentToolName } from "../agent-tool-name-C3b5vEwJ.mjs";
4
4
  import { Diagnostic } from "nostics";
5
5
  import process from "node:process";
@@ -1,7 +1,8 @@
1
- import { $ as DevframeRpcServerFunctions, F as ScopedSharedStates, I as SettingsForNamespace, J as RpcSharedStateHost, N as ScopedRpcFn, O as DevframeSettings, P as ScopedServerFunctions, Q as DevframeRpcClientFunctions, _ as ConnectionMeta, at as StreamReader, ht as SharedState, jt as EventEmitter, ot as StreamSink, q as RpcSharedStateGetOptions } from "../devframe-mQ4qZAuo.mjs";
1
+ import { $ as DevframeRpcClientFunctions, F as ScopedServerFunctions, I as ScopedSharedStates, J as RpcSharedStateGetOptions, L as SettingsForNamespace, Mt as EventEmitter, P as ScopedRpcFn, Y as RpcSharedStateHost, _ as ConnectionMeta, et as DevframeRpcServerFunctions, gt as SharedState, k as DevframeSettings, ot as StreamReader, st as StreamSink } from "../devframe-Bdd9YXTy.mjs";
2
+ import { f as RpcCacheManager, p as RpcCacheOptions } from "../index-DSCq4M4q.mjs";
2
3
  import { _ as RpcFunctionDefinition, w as RpcFunctionsCollector } from "../types-CnJSgRVa.mjs";
3
- import { E as RpcCacheOptions, T as RpcCacheManager } from "../index-Dbw1p5ch.mjs";
4
- import { t as WsRpcChannelOptions } from "../ws-client-B6Tnr0ic.mjs";
4
+ import { t as SseRpcChannelOptions } from "../sse-client-BsIK3hMD.mjs";
5
+ import { t as WsRpcChannelOptions } from "../ws-client-CdNuATYa.mjs";
5
6
  import { BirpcOptions, BirpcReturn } from "birpc";
6
7
  //#region src/client/connection.d.ts
7
8
  interface DevframeConnection {
@@ -251,7 +252,24 @@ interface DevframeRpcClientOptions extends SetupDevframeConnectionOptions {
251
252
  * @default true
252
253
  */
253
254
  simpleAuth?: boolean;
255
+ /**
256
+ * Which live transport to connect over:
257
+ *
258
+ * - `'auto'` (default) — trust the server's advertisement: its declared
259
+ * primary (`backend`), preferring the WebSocket when both endpoints are
260
+ * present. A server that couldn't bind a socket advertises SSE as its
261
+ * primary, so no client-side fallback probing is needed.
262
+ * - `'websocket'` / `'sse'` — pin one transport; connecting fails with a
263
+ * clear error when the server doesn't advertise it. Reach for
264
+ * `transport: 'sse'` when an intermediary silently strips WS upgrades —
265
+ * something the server cannot detect.
266
+ *
267
+ * A `static` backend ignores this option (there is no live transport).
268
+ */
269
+ transport?: 'auto' | 'websocket' | 'sse';
254
270
  wsOptions?: Partial<WsRpcChannelOptions>;
271
+ /** Channel overrides for the SSE transport — the `wsOptions` counterpart. */
272
+ sseOptions?: Partial<SseRpcChannelOptions>;
255
273
  rpcOptions?: Partial<BirpcOptions<DevframeRpcServerFunctions, DevframeRpcClientFunctions, boolean>>;
256
274
  cacheOptions?: boolean | Partial<RpcCacheOptions>;
257
275
  /**
@@ -282,10 +300,16 @@ interface DevframeRpcClient {
282
300
  */
283
301
  readonly status: DevframeConnectionStatus;
284
302
  /**
285
- * The most recent connection-level error (WebSocket error, refused trust, or
286
- * failed connection-meta load), or `null` when the connection is healthy.
303
+ * The most recent connection-level error (transport error, refused trust,
304
+ * or failed connection-meta load), or `null` when the connection is healthy.
287
305
  */
288
306
  readonly connectionError: Error | null;
307
+ /**
308
+ * The transport this client is actually connected over — `'websocket'`,
309
+ * `'sse'`, or `'static'`. Reflects the resolution of the `transport`
310
+ * option against the server's advertisement.
311
+ */
312
+ readonly transport: 'websocket' | 'sse' | 'static';
289
313
  /**
290
314
  * The complete connection used by this client, including the metadata source
291
315
  * URL external viewers use to resolve relative resources.
@@ -362,8 +386,27 @@ interface DevframeRpcClient {
362
386
  <NS extends string>(namespace: NS): DevframeScopedClientContext<NS, SettingsForNamespace<NS>>;
363
387
  (namespace?: null | ''): DevframeRpcClient;
364
388
  };
389
+ /**
390
+ * Close the connection. A `static` backend is a no-op (there is no live socket to close);
391
+ * a `websocket` backend closes the underlying `WebSocket`, which the server observes as a
392
+ * normal disconnect. Mirrors {@link WsRpcTransport.close} on the server side.
393
+ *
394
+ * There is no corresponding "reconnect" — a closed client is done. Discard it and call
395
+ * {@link getDevframeRpcClient} again to reconnect.
396
+ *
397
+ * Optional so a `DevframeRpcClientMode` implemented before this method existed — a custom
398
+ * transport, a hand-typed mock — still satisfies the interface; an absent `close` is treated
399
+ * as nothing to close.
400
+ */
401
+ close?: () => void;
365
402
  }
366
403
  interface DevframeRpcClientMode {
404
+ /**
405
+ * The transport this mode speaks. Optional so a mode implemented before
406
+ * this field existed — a custom transport, a hand-typed mock — still
407
+ * satisfies the interface; an absent value reads as `'websocket'`.
408
+ */
409
+ readonly transport?: 'websocket' | 'sse' | 'static';
367
410
  readonly isTrusted: boolean;
368
411
  readonly status: DevframeConnectionStatus;
369
412
  readonly connectionError: Error | null;
@@ -378,7 +421,17 @@ interface DevframeRpcClientMode {
378
421
  call: DevframeRpcClient['call'];
379
422
  callEvent: DevframeRpcClient['callEvent'];
380
423
  callOptional: DevframeRpcClient['callOptional'];
424
+ /** See {@link DevframeRpcClient.close}. */
425
+ close?: () => void;
381
426
  }
427
+ /**
428
+ * Resolve the requested `transport` option against what the server
429
+ * advertises. `'auto'` trusts the advertisement — the server's declared
430
+ * primary (`backend`), preferring the WebSocket when both endpoints are
431
+ * present; an explicit `'websocket'` / `'sse'` pins that transport and
432
+ * throws when the server doesn't advertise it.
433
+ */
434
+ declare function resolveClientTransport(requested: 'auto' | 'websocket' | 'sse', meta: ConnectionMeta): 'websocket' | 'sse' | 'static';
382
435
  declare function getDevframeRpcClient(options?: DevframeRpcClientOptions): Promise<DevframeRpcClient>;
383
436
  //#endregion
384
437
  //#region src/client/otp.d.ts
@@ -431,6 +484,17 @@ interface WsUrlLocation {
431
484
  */
432
485
  declare function resolveWsUrl(websocket: ConnectionMeta['websocket'], metaBaseUrl: string, loc: WsUrlLocation): string;
433
486
  //#endregion
487
+ //#region src/client/rpc-sse.d.ts
488
+ /**
489
+ * Resolve a {@link ConnectionMeta.sse} descriptor into a concrete
490
+ * `http(s)://` URL, with the same proxy-safe rules as `resolveWsUrl`: the
491
+ * object / relative-path forms resolve against where `__connection.json`
492
+ * was loaded (the client trusts its own location, never a server-baked
493
+ * hostname), while an explicit `port`/`host` (or a full `http(s)://` URL
494
+ * string) opts into a cross-origin endpoint.
495
+ */
496
+ declare function resolveSseUrl(sse: ConnectionMeta['sse'], metaBaseUrl: string, loc: WsUrlLocation): string;
497
+ //#endregion
434
498
  //#region src/client/settings.d.ts
435
499
  /**
436
500
  * Build the client-side `settings` surface for a scope namespace. Mirrors
@@ -441,4 +505,4 @@ declare function createClientSettings<T extends Record<string, any> = Record<str
441
505
  //#region src/client/index.d.ts
442
506
  declare const connectDevframe: typeof getDevframeRpcClient;
443
507
  //#endregion
444
- export { DevframeClientRpcHost, DevframeConnection, DevframeConnectionError, DevframeConnectionErrorKind, DevframeConnectionStatus, DevframeRpcClient, DevframeRpcClientCall, DevframeRpcClientCallEvent, DevframeRpcClientCallOptional, DevframeRpcClientMode, DevframeRpcClientOptions, DevframeRpcContext, DevframeScopedClientContext, DevframeScopedClientRpc, DevframeScopedClientStreamingHost, RpcClientEvents, RpcStreamingClientHost, SetupDevframeConnectionOptions, StreamingSubscribeOptions, type WsUrlLocation, authenticateWithUrlOtp, connectDevframe, consumeOtpFromUrl, createClientSettings, createRpcStreamingClientHost, createScopedClientContext, getDevframeConnection, getDevframeRpcClient, isCallableStatus, readOtpFromUrl, registerDevframeViewerOrigin, resolveWsUrl, setupDevframeConnection };
508
+ export { DevframeClientRpcHost, DevframeConnection, DevframeConnectionError, DevframeConnectionErrorKind, DevframeConnectionStatus, DevframeRpcClient, DevframeRpcClientCall, DevframeRpcClientCallEvent, DevframeRpcClientCallOptional, DevframeRpcClientMode, DevframeRpcClientOptions, DevframeRpcContext, DevframeScopedClientContext, DevframeScopedClientRpc, DevframeScopedClientStreamingHost, RpcClientEvents, RpcStreamingClientHost, SetupDevframeConnectionOptions, StreamingSubscribeOptions, type WsUrlLocation, authenticateWithUrlOtp, connectDevframe, consumeOtpFromUrl, createClientSettings, createRpcStreamingClientHost, createScopedClientContext, getDevframeConnection, getDevframeRpcClient, isCallableStatus, readOtpFromUrl, registerDevframeViewerOrigin, resolveClientTransport, resolveSseUrl, resolveWsUrl, setupDevframeConnection };