devframe 1.3.1 → 1.3.3

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 (153) hide show
  1. package/dist/{_shared-Cm4iD0L3.d.mts → _shared-BxeuukaL.d.mts} +2 -4
  2. package/dist/{_shared-C61zPwIz.mjs → _shared-CtXCQFTV.mjs} +6 -9
  3. package/dist/adapters/build.d.mts +3 -5
  4. package/dist/adapters/build.mjs +7 -8
  5. package/dist/adapters/cac.d.mts +1 -3
  6. package/dist/adapters/cac.mjs +5 -7
  7. package/dist/adapters/dev.d.mts +6 -8
  8. package/dist/adapters/dev.mjs +2 -2
  9. package/dist/adapters/embedded.d.mts +2 -4
  10. package/dist/adapters/embedded.mjs +1 -2
  11. package/dist/adapters/initiate.d.mts +10 -10
  12. package/dist/adapters/initiate.mjs +1 -2
  13. package/dist/adapters/mcp.d.mts +2 -2
  14. package/dist/adapters/mcp.mjs +1 -2
  15. package/dist/{agentic-C6SCkdtj.d.mts → agentic-DVgUzwhV.d.mts} +1 -3
  16. package/dist/{browser-agent-Pu-FLk6I.mjs → browser-agent-DmAotroz.mjs} +1 -2
  17. package/dist/{browser-agent-rpc-KH4HHvHf.mjs → browser-agent-rpc-CS80Sphv.mjs} +3 -5
  18. package/dist/cli/main.d.mts +1 -3
  19. package/dist/cli/main.mjs +3 -4
  20. package/dist/client/index.d.mts +6 -30
  21. package/dist/client/index.mjs +47 -72
  22. package/dist/{client-agent-iBkMYxqn.mjs → client-agent-qNMgDUev.mjs} +7 -12
  23. package/dist/constants.d.mts +1 -5
  24. package/dist/constants.mjs +2 -3
  25. package/dist/{context-BGJi0ITA.d.mts → context-B-AARy_U.d.mts} +1 -3
  26. package/dist/{context-D_jSSdME.mjs → context-BTxC4QrJ.mjs} +4 -5
  27. package/dist/{context-CAJ5V017.mjs → context-C5FcbWQi.mjs} +25 -41
  28. package/dist/{crypto-token-TVbGGFuj.mjs → crypto-token-CUhPE_ei.mjs} +1 -2
  29. package/dist/{define-BLWPsH6y.mjs → define-C8h-fyD3.mjs} +1 -2
  30. package/dist/{dev-BKBjIpX3.mjs → dev-Cu_iwSCy.mjs} +9 -11
  31. package/dist/{diagnostics-E_PvUPsA.mjs → diagnostics-DC1-WcvN.mjs} +2 -3
  32. package/dist/{dist-CO98PBnQ.mjs → dist-BWGpvt-z.mjs} +1 -2
  33. package/dist/{dist-CZXfGEkd.mjs → dist-CZ-TySHD.mjs} +3 -11
  34. package/dist/{events-0wDwalmL.mjs → events-qWCKwD8-.mjs} +1 -2
  35. package/dist/{handler-DmaAfpGq.mjs → handler-DkLlj3-B.mjs} +3 -5
  36. package/dist/{hash-DdPnc4k3.mjs → hash-DHqpWeMO.mjs} +4 -8
  37. package/dist/{host-h3-BROI6SQ4.mjs → host-h3-D1uj5EM8.mjs} +1 -2
  38. package/dist/{import-runtime-module-BzlEQ9PI.mjs → import-runtime-module-DsdqJ1gK.mjs} +2 -3
  39. package/dist/in-page-channel/index.d.mts +3 -12
  40. package/dist/in-page-channel/index.mjs +10 -16
  41. package/dist/{index-CeEtxDmK.d.mts → index-BIRF0E5l.d.mts} +0 -2
  42. package/dist/{index-Bia1vKjL.d.mts → index-BKu9BxcT.d.mts} +0 -2
  43. package/dist/{context-BNxFOPbX.d.mts → index-BhUqJUHG.d.mts} +1408 -1442
  44. package/dist/index.d.mts +7 -8
  45. package/dist/index.mjs +3 -4
  46. package/dist/{instance-registry-C_4PpB6N.mjs → instance-registry-DwmnWyCK.mjs} +4 -10
  47. package/dist/{instance-shell-m4sY2oTG.mjs → instance-shell-Coid7CP6.mjs} +38 -17
  48. package/dist/{instance-shell-GihbmXoF.d.mts → instance-shell-DTk514M9.d.mts} +6 -10
  49. package/dist/{interactive-auth-DdDxs3WF.mjs → interactive-auth-BURwIAvE.mjs} +6 -8
  50. package/dist/internal/index.d.mts +9 -29
  51. package/dist/internal/index.mjs +13 -15
  52. package/dist/{mcp-content-QImBQO8e.d.mts → mcp-content-0a0mpCL5.d.mts} +1 -3
  53. package/dist/{mcp-content-DN3O212x.mjs → mcp-content-CqU8yaF7.mjs} +1 -2
  54. package/dist/{mrmime-40h5OOIp.mjs → mrmime-y_XyiVcd.mjs} +1 -2
  55. package/dist/node/auth.d.mts +84 -3
  56. package/dist/node/auth.mjs +2 -2
  57. package/dist/node/hub-internals.d.mts +11 -2
  58. package/dist/node/hub-internals.mjs +2 -2
  59. package/dist/node/index.d.mts +4 -6
  60. package/dist/node/index.mjs +2 -2
  61. package/dist/{nostics-D0PvLZsn.mjs → nostics-InlX4tmd.mjs} +2 -4
  62. package/dist/{origin-DZit9g29.mjs → origin-Ck7mLbKU.mjs} +1 -2
  63. package/dist/recipes/interactive-auth.d.mts +3 -5
  64. package/dist/recipes/interactive-auth.mjs +1 -2
  65. package/dist/{remote-assets-eBvSKZMS.d.mts → remote-assets-5AQMHZnV.d.mts} +0 -2
  66. package/dist/{remote-assets-B-n83kUY.mjs → remote-assets-DhonNeo_.mjs} +5 -8
  67. package/dist/{revoke-CeQUo6KI.mjs → revoke-D6KA3vwr.mjs} +2 -3
  68. package/dist/{rolldown-runtime-B4iAMlE-.mjs → rolldown-runtime-BVN1G_yT.mjs} +6 -7
  69. package/dist/rpc/client.d.mts +2 -4
  70. package/dist/rpc/client.mjs +2 -3
  71. package/dist/rpc/dump.d.mts +3 -11
  72. package/dist/rpc/dump.mjs +1 -2
  73. package/dist/rpc/index.d.mts +122 -4
  74. package/dist/rpc/index.mjs +6 -8
  75. package/dist/rpc/server.d.mts +2 -4
  76. package/dist/rpc/server.mjs +2 -3
  77. package/dist/rpc/transports/sse-client.d.mts +34 -2
  78. package/dist/rpc/transports/sse-client.mjs +2 -3
  79. package/dist/rpc/transports/sse-server.d.mts +5 -7
  80. package/dist/rpc/transports/sse-server.mjs +4 -5
  81. package/dist/rpc/transports/ws-bun.d.mts +3 -5
  82. package/dist/rpc/transports/ws-bun.mjs +2 -3
  83. package/dist/rpc/transports/ws-client.d.mts +27 -2
  84. package/dist/rpc/transports/ws-client.mjs +2 -3
  85. package/dist/rpc/transports/ws-deno.d.mts +3 -5
  86. package/dist/rpc/transports/ws-deno.mjs +2 -3
  87. package/dist/rpc/transports/ws-server.d.mts +151 -4
  88. package/dist/rpc/transports/ws-server.mjs +5 -6
  89. package/dist/{rpc-core-BLc5hm9X.mjs → rpc-core-BmDHiDR6.mjs} +4 -5
  90. package/dist/{rpc-core-CGTCla-R.d.mts → rpc-core-CblgPYJ_.d.mts} +5 -7
  91. package/dist/{serialization-BhuOoL80.mjs → serialization-iiTQ7n21.mjs} +3 -5
  92. package/dist/{services-install-D5YUwFXW.mjs → services-install-DCuDzMJ-.mjs} +1 -2
  93. package/dist/{session-DPfj6zQG.mjs → session-BjvoLH3r.mjs} +1 -2
  94. package/dist/{session-r6PDixP6.d.mts → session-Y9R6tqg4.d.mts} +0 -2
  95. package/dist/{shared-state-Cc-Jrhma.mjs → shared-state-COV7NCbd.mjs} +4 -6
  96. package/dist/{state-W4wI6X5X.mjs → state-B_yjfeqo.mjs} +3 -5
  97. package/dist/{storage-CWI9PZ-5.mjs → storage-DpJ52UB_.mjs} +3 -5
  98. package/dist/{structured-clone-CbAV5rFI.mjs → structured-clone-B1N_XQvA.mjs} +2 -4
  99. package/dist/{structured-clone-CgtQ61SA.mjs → structured-clone-D1dOCZvc.mjs} +2 -4
  100. package/dist/{tool-input-CES3Pc4y.mjs → tool-input-CcCgJ8jq.mjs} +6 -12
  101. package/dist/types/index.d.mts +5 -5
  102. package/dist/{types-BmDbfHCx.d.mts → types-KZOyhez5.d.mts} +2 -5
  103. package/dist/utils/agent-tool-name.d.mts +1 -3
  104. package/dist/utils/agent-tool-name.mjs +1 -2
  105. package/dist/utils/colors.d.mts +1 -3
  106. package/dist/utils/colors.mjs +1 -2
  107. package/dist/utils/crypto-token.d.mts +1 -3
  108. package/dist/utils/crypto-token.mjs +1 -2
  109. package/dist/utils/debounce.d.mts +6 -2
  110. package/dist/utils/debounce.mjs +1 -2
  111. package/dist/utils/events.d.mts +2 -4
  112. package/dist/utils/events.mjs +1 -2
  113. package/dist/utils/get-port.d.mts +0 -2
  114. package/dist/utils/get-port.mjs +1 -2
  115. package/dist/utils/hash.d.mts +1 -3
  116. package/dist/utils/hash.mjs +1 -2
  117. package/dist/utils/launch-editor.d.mts +1 -3
  118. package/dist/utils/launch-editor.mjs +25 -37
  119. package/dist/utils/nanoid.d.mts +1 -3
  120. package/dist/utils/nanoid.mjs +1 -2
  121. package/dist/utils/nostics.d.mts +40 -2
  122. package/dist/utils/nostics.mjs +1 -2
  123. package/dist/utils/open.d.mts +1 -3
  124. package/dist/utils/open.mjs +1 -2
  125. package/dist/utils/origin.d.mts +55 -2
  126. package/dist/utils/origin.mjs +1 -2
  127. package/dist/utils/remote-assets.d.mts +2 -4
  128. package/dist/utils/remote-assets.mjs +1 -2
  129. package/dist/utils/serve-static.d.mts +3 -5
  130. package/dist/utils/serve-static.mjs +3 -4
  131. package/dist/utils/shared-state.d.mts +1 -1
  132. package/dist/utils/shared-state.mjs +1 -2
  133. package/dist/utils/simple-schema.d.mts +1 -3
  134. package/dist/utils/simple-schema.mjs +1 -2
  135. package/dist/utils/streaming-channel.d.mts +1 -1
  136. package/dist/utils/streaming-channel.mjs +1 -2
  137. package/dist/utils/structured-clone.d.mts +1 -3
  138. package/dist/utils/structured-clone.mjs +1 -2
  139. package/dist/utils/url.d.mts +1 -3
  140. package/dist/utils/url.mjs +1 -2
  141. package/dist/utils/when.d.mts +1 -3
  142. package/dist/utils/when.mjs +2 -4
  143. package/dist/{validation-CMfDAti3.mjs → validation-Cjy1P58H.mjs} +7 -13
  144. package/dist/{wire-codec-B1W3zH3L.mjs → wire-codec-BdngvzfH.mjs} +3 -4
  145. package/dist/{write-DK7rBUN3.mjs → write-3miSvPaD.mjs} +10 -16
  146. package/package.json +8 -8
  147. package/dist/index-CxJatyA1.d.mts +0 -88
  148. package/dist/index-DuEm0sDH.d.mts +0 -135
  149. package/dist/nostics-DWvukRwa.d.mts +0 -42
  150. package/dist/origin-CY6BBHOy.d.mts +0 -58
  151. package/dist/sse-client-DNdscfu_.d.mts +0 -37
  152. package/dist/ws-client-6Mrz6eC4.d.mts +0 -30
  153. package/dist/ws-server-y2R76aSW.d.mts +0 -152
@@ -1,152 +0,0 @@
1
- import { a as ChannelOptions, n as BirpcGroup } from "./index-Bia1vKjL.mjs";
2
- import { g as RpcFunctionDefinitionAny } from "./types-BmDbfHCx.mjs";
3
- import { n as DevframeRpcConnection, t as DevframeNodeRpcSessionMeta } from "./session-r6PDixP6.mjs";
4
- import { Hooks } from "crossws";
5
- import { NodeAdapter } from "crossws/adapters/node";
6
- import { Buffer } from "node:buffer";
7
- import { IncomingMessage, Server } from "node:http";
8
- import { Server as Server$1, ServerOptions } from "node:https";
9
- import { AddressInfo } from "node:net";
10
- import { Duplex } from "node:stream";
11
- //#region src/rpc/transports/ws-server.d.ts
12
- interface WsRpcTransportOptions {
13
- /**
14
- * Attach to an existing HTTP(S) server, sharing its port. Combine with
15
- * `path` to bind the WS endpoint to a single route so it coexists with
16
- * other upgrade handlers on the same server (e.g. a Vite dev server's HMR
17
- * socket). The shared server's lifecycle is owned by the caller; closing
18
- * this transport detaches the upgrade listener without closing the server.
19
- */
20
- server?: Server | Server$1;
21
- /**
22
- * Port for the standalone WebSocket server. Defaults to `0`, which lets the
23
- * operating system assign an available port.
24
- */
25
- port?: number;
26
- /** Host for the standalone WebSocket server. Defaults to `localhost`. */
27
- host?: string;
28
- /**
29
- * Restrict the WS endpoint to a single upgrade route (e.g. `/__ws`). When
30
- * sharing a `server`, non-matching upgrade requests are left untouched for
31
- * other listeners to handle, so devframe's socket can sit alongside
32
- * framework sockets (Vite HMR, etc.).
33
- */
34
- path?: string;
35
- /**
36
- * Create the adapter without binding it to anything: no server is created,
37
- * no port is bound, no `upgrade` listener is installed. The caller drives
38
- * the socket itself through {@link WsRpcTransport.handleUpgrade} (from its
39
- * own `upgrade` listener) or {@link WsRpcTransport.attach} (to bind a
40
- * server later). Takes precedence over `server` / `port` / `https`.
41
- */
42
- unbound?: boolean;
43
- /**
44
- * Destroy upgrade requests that don't match `path` instead of leaving them
45
- * for other listeners. Enable this when devframe owns the shared server
46
- * outright (nothing else handles its upgrades), so an off-route client is
47
- * rejected promptly rather than left hanging. Default: `false`
48
- * (coexist-friendly); servers this transport creates itself always
49
- * destroy unmatched upgrades.
50
- */
51
- destroyUnmatched?: boolean;
52
- /** When set, a new https.Server is created and the WS endpoint is attached to it. */
53
- https?: ServerOptions;
54
- /**
55
- * Extra origins to accept on the WS upgrade beyond the loopback default.
56
- * Add your LAN/tunnel origin here when reaching the tool from another host.
57
- * Pass `false` to disable origin checking entirely (not recommended).
58
- * Default: loopback-only.
59
- */
60
- allowedOrigins?: readonly string[] | WsOriginRegistry | false;
61
- /**
62
- * RPC function definitions, used by the per-call wire serializer to
63
- * dispatch between strict-JSON and structured-clone encoding based
64
- * on each function's `jsonSerializable` flag.
65
- *
66
- * When omitted, all messages fall back to structured-clone: safe but
67
- * loses dev-time validation for `jsonSerializable: true` declarations.
68
- */
69
- definitions?: ReadonlyMap<string, Pick<RpcFunctionDefinitionAny, 'jsonSerializable'>>;
70
- onConnected?: (connection: DevframeRpcConnection, meta: DevframeNodeRpcSessionMeta) => void;
71
- onDisconnected?: (connection: DevframeRpcConnection, meta: DevframeNodeRpcSessionMeta) => void;
72
- /** Override the default per-call serializer. Most callers should leave this unset. */
73
- serialize?: ChannelOptions['serialize'];
74
- /** Override the default per-call deserializer. Most callers should leave this unset. */
75
- deserialize?: ChannelOptions['deserialize'];
76
- }
77
- interface CreateWsOriginRegistryOptions {
78
- /** Origins allowed before any external viewers are registered. */
79
- allowedOrigins?: readonly string[];
80
- /** Additional validation to run after the registration token is verified. */
81
- validateOrigin?: (origin: string) => boolean;
82
- }
83
- interface WsOriginRegistry {
84
- /** Registration token to include in connection metadata. */
85
- readonly token: string;
86
- /** Read and register an origin from a connection bootstrap URL. */
87
- registerFromUrl: (url: string) => string | undefined;
88
- /** Check whether an origin is currently allowed. */
89
- isAllowed: (origin: string | undefined) => boolean;
90
- }
91
- /**
92
- * Create a live, token-protected origin allowlist for external browser
93
- * viewers. Pass it to {@link WsRpcTransportOptions.allowedOrigins}, then use
94
- * `registerFromUrl()` in the connection metadata handler to authorize a
95
- * viewer without sharing a mutable array or disabling DNS-rebinding protection.
96
- */
97
- declare function createWsOriginRegistry(options?: CreateWsOriginRegistryOptions): WsOriginRegistry;
98
- interface WsRpcTransport {
99
- /**
100
- * The crossws node adapter driving the socket; exposes the connected
101
- * `peers` and pub/sub. See https://crossws.h3.dev.
102
- */
103
- ws: NodeAdapter;
104
- /** Resolves when the transport-owned server is listening. */
105
- ready: Promise<void>;
106
- /** Returns the bound address, or `null` when the server is not listening. */
107
- address: () => AddressInfo | string | null;
108
- /**
109
- * Complete a `node:http` `upgrade` event on this transport, applying the
110
- * same `path` filter and origin gate the transport's own listener uses.
111
- * Wire it into a host server directly (`server.on('upgrade',
112
- * transport.handleUpgrade)`) or call it from an existing listener.
113
- */
114
- handleUpgrade: (req: IncomingMessage, socket: Duplex, head: Buffer) => void;
115
- /**
116
- * Route a server's `upgrade` events to this transport, returning a detach
117
- * function. Use it to bind an `unbound` transport once the host server
118
- * exists; {@link WsRpcTransport.close} detaches every server attached this
119
- * way (without closing them, since the caller owns their lifecycle).
120
- */
121
- attach: (server: Server | Server$1) => () => void;
122
- /** Remove the upgrade listener from a shared `server` (a no-op otherwise). */
123
- detach: () => void;
124
- /**
125
- * Tear the transport down deterministically: detach from a shared server,
126
- * force-terminate every connected peer, and close any server this
127
- * transport created itself (`port` / `https` modes).
128
- */
129
- close: () => Promise<void>;
130
- }
131
- /**
132
- * The per-peer lifecycle hooks driving a devframe RPC WebSocket, shaped for
133
- * any [crossws](https://crossws.h3.dev) adapter. {@link attachWsRpcTransport}
134
- * feeds them to the Node adapter; runtime-specific attachments (e.g. Bun's
135
- * fetch-upgrade adapter) reuse the same hooks so every transport speaks the
136
- * identical wire protocol: one birpc channel per peer, per-method
137
- * `jsonSerializable` dispatch between strict JSON and structured-clone.
138
- */
139
- declare function createWsRpcPeerHooks<ClientFunctions extends object, ServerFunctions extends object>(rpcGroup: BirpcGroup<ClientFunctions, ServerFunctions, false>, options?: Pick<WsRpcTransportOptions, 'onConnected' | 'onDisconnected' | 'definitions' | 'serialize' | 'deserialize'>): Partial<Hooks>;
140
- /**
141
- * Attach a WebSocket transport to an existing RPC group, powered by
142
- * [crossws](https://crossws.h3.dev). Either attach to an existing HTTP(S)
143
- * `server` (sharing its port, optionally scoped to a `path`), or let this
144
- * helper create a standalone server from `port` / `host` / `https`.
145
- *
146
- * Returns the crossws node adapter, standalone-server readiness/address
147
- * accessors, `detach` (remove the upgrade listener from a shared `server`),
148
- * and `close` (full deterministic teardown).
149
- */
150
- declare function attachWsRpcTransport<ClientFunctions extends object, ServerFunctions extends object>(rpcGroup: BirpcGroup<ClientFunctions, ServerFunctions, false>, options?: WsRpcTransportOptions): WsRpcTransport;
151
- //#endregion
152
- export { attachWsRpcTransport as a, WsRpcTransportOptions as i, WsOriginRegistry as n, createWsOriginRegistry as o, WsRpcTransport as r, createWsRpcPeerHooks as s, CreateWsOriginRegistryOptions as t };