devframe 0.9.0-beta.1 → 0.9.0-beta.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.
- package/dist/{_shared-DmpWW-HH.d.mts → _shared-Bm8p4-fD.d.mts} +1 -3
- package/dist/{dist-D8jAMwxU.mjs → _shared-CGPVmXUM.mjs} +67 -1
- package/dist/adapters/build.d.mts +1 -1
- package/dist/adapters/build.mjs +3 -3
- package/dist/adapters/cac.d.mts +1 -1
- package/dist/adapters/cac.mjs +4 -4
- package/dist/adapters/dev.d.mts +7 -7
- package/dist/adapters/dev.mjs +2 -2
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/initiate.d.mts +3 -3
- package/dist/adapters/initiate.mjs +1 -1
- package/dist/adapters/mcp.d.mts +1 -8
- package/dist/adapters/mcp.mjs +1 -1
- package/dist/{agent-tool-name-C3b5vEwJ.mjs → agent-tool-name-EgfoFO8C.mjs} +0 -3
- package/dist/cli/main.d.mts +0 -2
- package/dist/cli/main.mjs +3 -7
- package/dist/client/index.d.mts +5 -5
- package/dist/{context-C33rR7n0.mjs → context-CMSryXs-.mjs} +10 -1
- package/dist/{context-CSCwoABx.d.mts → context-DV4uWieM.d.mts} +19 -1
- package/dist/{context-Du11TLcO.mjs → context-b6iSomtv.mjs} +4 -5
- package/dist/{dev-BEveeA5H.mjs → dev-4xjiynUD.mjs} +6 -6
- package/dist/{devframe-Bdd9YXTy.d.mts → devframe-5oblos7I.d.mts} +52 -36
- package/dist/{diagnostics-DLYH5oD3.mjs → diagnostics-C7IGWppM.mjs} +2 -2
- package/dist/{host-agent-CpbAoqBx.mjs → host-agent-BBkKT27Q.mjs} +2 -6
- package/dist/{http-DLr_cJZ7.mjs → http-Z0w9baEe.mjs} +3 -10
- package/dist/{index-CZRd2K1C.d.mts → index-BzDl02lt.d.mts} +2 -2
- package/dist/{index-DSCq4M4q.d.mts → index-tdrk1bzV.d.mts} +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/{instance-registry-BQqGoDO9.mjs → instance-registry-Du_hbx-j.mjs} +1 -7
- package/dist/{instance-shell-DBTXTSjN.d.mts → instance-shell-B-BSVp37.d.mts} +3 -12
- package/dist/{instance-shell-KRdee1QF.mjs → instance-shell-B0TwOxCl.mjs} +9 -8
- package/dist/internal/index.d.mts +202 -9
- package/dist/internal/index.mjs +7 -5
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/hub-internals.d.mts +2 -2
- package/dist/node/hub-internals.mjs +2 -2
- package/dist/node/index.d.mts +3 -3
- package/dist/node/index.mjs +2 -2
- package/dist/recipes/common-rpc-functions.d.mts +3 -3
- package/dist/recipes/interactive-auth.d.mts +2 -2
- package/dist/recipes/interactive-auth.mjs +1 -1
- package/dist/rpc/dump.d.mts +1 -1
- package/dist/rpc/index.d.mts +2 -2
- package/dist/rpc/transports/sse-client.d.mts +1 -1
- package/dist/rpc/transports/sse-server.d.mts +2 -2
- package/dist/rpc/transports/ws-bun.d.mts +2 -2
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/{rpc-core-CGctXToO.d.mts → rpc-core-B4Qm66Qt.d.mts} +3 -3
- package/dist/{rpc-core-CqcJkAu9.mjs → rpc-core-Cva-0pw0.mjs} +1 -1
- package/dist/{sse-client-BsIK3hMD.d.mts → sse-client-CFBOIaUi.d.mts} +1 -1
- package/dist/{storage-BcmVEJRc.mjs → storage-CaUVrBrG.mjs} +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/{types-CnJSgRVa.d.mts → types-Djq7CBXh.d.mts} +0 -7
- package/dist/utils/agent-tool-name.d.mts +0 -3
- package/dist/utils/agent-tool-name.mjs +0 -3
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/{ws-client-CdNuATYa.d.mts → ws-client-DhjNyQo3.d.mts} +1 -1
- package/dist/{ws-server-Ces08fjP.d.mts → ws-server-D1d3QM9f.d.mts} +1 -1
- package/package.json +1 -2
- package/skills/devframe/SKILL.md +6 -6
- package/dist/_shared-CttmCMBi.mjs +0 -70
- package/dist/helpers/vite.d.mts +0 -104
- package/dist/helpers/vite.mjs +0 -93
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as RpcFunctionsCollectorBase } from "./index-
|
|
2
|
-
import { _ as RpcFunctionDefinition, v as RpcFunctionDefinitionAny } from "./types-
|
|
3
|
-
import { d as DevframeRpcConnection, u as DevframeNodeRpcSessionMeta } from "./ws-server-
|
|
1
|
+
import { d as RpcFunctionsCollectorBase } from "./index-tdrk1bzV.mjs";
|
|
2
|
+
import { _ as RpcFunctionDefinition, v as RpcFunctionDefinitionAny } from "./types-Djq7CBXh.mjs";
|
|
3
|
+
import { d as DevframeRpcConnection, u as DevframeNodeRpcSessionMeta } from "./ws-server-D1d3QM9f.mjs";
|
|
4
4
|
import { CAC } from "cac";
|
|
5
5
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
6
|
import { BirpcReturn } from "birpc";
|
|
@@ -119,9 +119,6 @@ interface EventEmitter<Events extends EventsMap> {
|
|
|
119
119
|
* Serializable description of an agent-exposed tool. This is the shape
|
|
120
120
|
* returned by the agent host manifest and surfaced over the wire by
|
|
121
121
|
* the `devframe:agent:list-tools` introspection RPC.
|
|
122
|
-
*
|
|
123
|
-
* @experimental The agent-native surface is experimental and may change
|
|
124
|
-
* without a major version bump until it stabilizes.
|
|
125
122
|
*/
|
|
126
123
|
interface AgentTool {
|
|
127
124
|
/** Stable identifier. For RPC-backed tools, matches the RPC name. */
|
|
@@ -159,8 +156,6 @@ interface AgentTool {
|
|
|
159
156
|
/**
|
|
160
157
|
* Input accepted by `DevframeAgentHost.registerTool()`. Handler is
|
|
161
158
|
* stripped from the serializable `AgentTool` projection.
|
|
162
|
-
*
|
|
163
|
-
* @experimental
|
|
164
159
|
*/
|
|
165
160
|
interface AgentToolInput {
|
|
166
161
|
id: string;
|
|
@@ -191,8 +186,6 @@ interface AgentToolInput {
|
|
|
191
186
|
/**
|
|
192
187
|
* Serializable description of an agent-readable resource. Resources
|
|
193
188
|
* surface structured or textual snapshots of devframe state.
|
|
194
|
-
*
|
|
195
|
-
* @experimental
|
|
196
189
|
*/
|
|
197
190
|
interface AgentResource {
|
|
198
191
|
id: string;
|
|
@@ -205,8 +198,6 @@ interface AgentResource {
|
|
|
205
198
|
}
|
|
206
199
|
/**
|
|
207
200
|
* Input accepted by `DevframeAgentHost.registerResource()`.
|
|
208
|
-
*
|
|
209
|
-
* @experimental
|
|
210
201
|
*/
|
|
211
202
|
interface AgentResourceInput {
|
|
212
203
|
id: string;
|
|
@@ -220,8 +211,6 @@ interface AgentResourceInput {
|
|
|
220
211
|
}
|
|
221
212
|
/**
|
|
222
213
|
* Payload returned by `AgentResourceInput.read`. Either `text` or `json` must be set.
|
|
223
|
-
*
|
|
224
|
-
* @experimental
|
|
225
214
|
*/
|
|
226
215
|
interface AgentResourceContent {
|
|
227
216
|
text?: string;
|
|
@@ -231,8 +220,6 @@ interface AgentResourceContent {
|
|
|
231
220
|
}
|
|
232
221
|
/**
|
|
233
222
|
* Unified view of the agent-exposed surface.
|
|
234
|
-
*
|
|
235
|
-
* @experimental
|
|
236
223
|
*/
|
|
237
224
|
interface AgentManifest {
|
|
238
225
|
tools: readonly AgentTool[];
|
|
@@ -240,8 +227,6 @@ interface AgentManifest {
|
|
|
240
227
|
}
|
|
241
228
|
/**
|
|
242
229
|
* Handle returned by `registerTool` / `registerResource`.
|
|
243
|
-
*
|
|
244
|
-
* @experimental
|
|
245
230
|
*/
|
|
246
231
|
interface AgentHandle {
|
|
247
232
|
unregister: () => void;
|
|
@@ -256,14 +241,10 @@ interface AgentHandle {
|
|
|
256
241
|
* Providers should namespace tool ids like any other tool; on an id
|
|
257
242
|
* collision the earlier source wins (registered tools, then RPC tools,
|
|
258
243
|
* then providers in registration order).
|
|
259
|
-
*
|
|
260
|
-
* @experimental
|
|
261
244
|
*/
|
|
262
245
|
type AgentToolProvider = () => readonly AgentToolInput[];
|
|
263
246
|
/**
|
|
264
247
|
* Handle returned by `registerToolProvider`.
|
|
265
|
-
*
|
|
266
|
-
* @experimental
|
|
267
248
|
*/
|
|
268
249
|
interface AgentToolProviderHandle extends AgentHandle {
|
|
269
250
|
/**
|
|
@@ -275,8 +256,6 @@ interface AgentToolProviderHandle extends AgentHandle {
|
|
|
275
256
|
}
|
|
276
257
|
/**
|
|
277
258
|
* Events emitted by `DevframeAgentHost`.
|
|
278
|
-
*
|
|
279
|
-
* @experimental
|
|
280
259
|
*/
|
|
281
260
|
interface DevframeAgentHostEvents {
|
|
282
261
|
'agent:tool:registered': (tool: AgentTool) => void;
|
|
@@ -294,9 +273,6 @@ interface DevframeAgentHostEvents {
|
|
|
294
273
|
* RPC functions flagged with `agent` and plugin-registered tools /
|
|
295
274
|
* resources. Consumed by protocol adapters such as the devframe MCP
|
|
296
275
|
* adapter.
|
|
297
|
-
*
|
|
298
|
-
* @experimental The agent-native surface is experimental and may change
|
|
299
|
-
* without a major version bump until it stabilizes.
|
|
300
276
|
*/
|
|
301
277
|
interface DevframeAgentHost {
|
|
302
278
|
readonly events: EventEmitter<DevframeAgentHostEvents>;
|
|
@@ -1303,8 +1279,6 @@ interface DevframeNodeContext {
|
|
|
1303
1279
|
diagnostics: DevframeDiagnosticsHost;
|
|
1304
1280
|
/**
|
|
1305
1281
|
* Agent host — aggregates the agent-exposed surface of this devtool.
|
|
1306
|
-
*
|
|
1307
|
-
* @experimental
|
|
1308
1282
|
*/
|
|
1309
1283
|
agent: DevframeAgentHost;
|
|
1310
1284
|
/**
|
|
@@ -1316,6 +1290,22 @@ interface DevframeNodeContext {
|
|
|
1316
1290
|
* absorb setup-order differences between provider and consumer.
|
|
1317
1291
|
*/
|
|
1318
1292
|
services: DevframeServicesHost;
|
|
1293
|
+
/**
|
|
1294
|
+
* This context's own {@link ConnectionMeta.configs} — static, boot-time
|
|
1295
|
+
* config a host publishes once through the connection handshake and every
|
|
1296
|
+
* client reads read-only. A plain, **non-reactive** object: mutate it
|
|
1297
|
+
* during `setup(ctx)` (a plugin sets its keys, a hub aggregates across
|
|
1298
|
+
* every installed devframe), never during the session — it's serialized
|
|
1299
|
+
* once, after setup, and changing it afterwards reaches no client.
|
|
1300
|
+
*
|
|
1301
|
+
* ```ts
|
|
1302
|
+
* ctx.staticConfig.dock = {
|
|
1303
|
+
* ...ctx.staticConfig.dock,
|
|
1304
|
+
* categoryOrder: { ...ctx.staticConfig.dock?.categoryOrder, ...myOrder },
|
|
1305
|
+
* }
|
|
1306
|
+
* ```
|
|
1307
|
+
*/
|
|
1308
|
+
staticConfig: Partial<DevframeConnectionConfigsRegistry>;
|
|
1319
1309
|
/**
|
|
1320
1310
|
* Create a namespace-scoped view of this context. The returned
|
|
1321
1311
|
* `ctx.scope('my-plugin')` auto-namespaces every RPC id, shared-state
|
|
@@ -1406,7 +1396,7 @@ interface ConnectionMeta {
|
|
|
1406
1396
|
* tooling (e.g. an MCP inspector) can discover it without guessing the
|
|
1407
1397
|
* path. `path` is relative to `__connection.json`'s location, like the
|
|
1408
1398
|
* WebSocket `path`. `port` is set when the endpoint lives on a side-car
|
|
1409
|
-
* server on its own port (bridge mode — `
|
|
1399
|
+
* server on its own port (bridge mode — `devframeViteBridge`,
|
|
1410
1400
|
* `@devframes/next`): the client combines the page hostname with `port`
|
|
1411
1401
|
* and resolves `path` against that origin, mirroring
|
|
1412
1402
|
* {@link ConnectionMetaWebsocket.port}.
|
|
@@ -1457,7 +1447,38 @@ interface ConnectionMeta {
|
|
|
1457
1447
|
* token same-origin until the requesting origin has been verified.
|
|
1458
1448
|
*/
|
|
1459
1449
|
viewerOriginToken?: string;
|
|
1450
|
+
/**
|
|
1451
|
+
* Static, host-declared configuration — baked in once at connect time and
|
|
1452
|
+
* fixed for the life of the server (e.g. a hub's UI rebrand, or its
|
|
1453
|
+
* aggregated dock-bar layout preferences). Read-only from the browser: a
|
|
1454
|
+
* client only ever reads `rpc.connectionMeta.configs`, never writes to it.
|
|
1455
|
+
*
|
|
1456
|
+
* Contrast this with {@link DevframeSettingsRegistry} (`ctx.scope(ns).settings`)
|
|
1457
|
+
* and a hub's `devframe:user-settings` shared-state key — both are
|
|
1458
|
+
* mutable, user-editable, and synced bidirectionally over RPC for the
|
|
1459
|
+
* life of the session. `configs` is the opposite: one-way, immutable,
|
|
1460
|
+
* decided by whoever assembled the server.
|
|
1461
|
+
*
|
|
1462
|
+
* Each key is owned by one package, contributed via declaration merging:
|
|
1463
|
+
*
|
|
1464
|
+
* ```ts
|
|
1465
|
+
* declare module 'devframe/types' {
|
|
1466
|
+
* interface DevframeConnectionConfigsRegistry {
|
|
1467
|
+
* 'my-key': { some: 'shape' }
|
|
1468
|
+
* }
|
|
1469
|
+
* }
|
|
1470
|
+
* ```
|
|
1471
|
+
*/
|
|
1472
|
+
configs?: Partial<DevframeConnectionConfigsRegistry>;
|
|
1460
1473
|
}
|
|
1474
|
+
/**
|
|
1475
|
+
* Augmentation point for {@link ConnectionMeta.configs}. Empty by default —
|
|
1476
|
+
* a package that wants to publish static, boot-time config through the
|
|
1477
|
+
* connection handshake augments this interface with its own key (see
|
|
1478
|
+
* {@link ConnectionMeta.configs} for the pattern). `@devframes/hub`
|
|
1479
|
+
* augments it with `dock`; `@devframes/hub-ui` augments it with `ui`.
|
|
1480
|
+
*/
|
|
1481
|
+
interface DevframeConnectionConfigsRegistry {}
|
|
1461
1482
|
//#endregion
|
|
1462
1483
|
//#region src/types/utils.d.ts
|
|
1463
1484
|
type Thenable<T> = T | Promise<T>;
|
|
@@ -1601,9 +1622,6 @@ interface DevframeSseOptions {
|
|
|
1601
1622
|
* the MCP Streamable-HTTP transport over the same origin as the SPA,
|
|
1602
1623
|
* exposing the definition's `ctx.agent` tools + shared-state resources to
|
|
1603
1624
|
* external MCP clients connected to the *running* server.
|
|
1604
|
-
*
|
|
1605
|
-
* @experimental The agent-native surface is experimental and may change
|
|
1606
|
-
* without a major version bump until it stabilizes.
|
|
1607
1625
|
*/
|
|
1608
1626
|
interface McpRouteOptions {
|
|
1609
1627
|
/**
|
|
@@ -1676,8 +1694,6 @@ interface DevframeCliOptions {
|
|
|
1676
1694
|
* - {@link McpRouteOptions} — customise the route path / allowed origins.
|
|
1677
1695
|
*
|
|
1678
1696
|
* The `--mcp` / `--no-mcp` CLI flags override this per run.
|
|
1679
|
-
*
|
|
1680
|
-
* @experimental
|
|
1681
1697
|
*/
|
|
1682
1698
|
mcp?: boolean | McpRouteOptions;
|
|
1683
1699
|
/** Author's SPA dist directory (served as the devframe's UI). */
|
|
@@ -1862,4 +1878,4 @@ interface DevframeDefinition {
|
|
|
1862
1878
|
spa?: DevframeSpaOptions;
|
|
1863
1879
|
}
|
|
1864
1880
|
//#endregion
|
|
1865
|
-
export {
|
|
1881
|
+
export { RpcStreamingHost as $, DevframeSettings as A, AgentToolProviderHandle as At, DevframeHost as B, DevframeServiceId as C, AgentManifest as Ct, DevframeScopedNodeContext as D, AgentTool as Dt, DevframeServicesRegistry as E, AgentResourceInput as Et, ScopedRpcFn as F, EventsMap as Ft, DevframeDiagnosticsLogger as G, DevframeDefineDiagnosticsOptions as H, ScopedServerFunctions as I, CliFlagsSchema as It, RpcFunctionsHost as J, DevframeNodeRpcSession as K, ScopedSharedStates as L, InferCliFlags as Lt, DevframeSettingsStore as M, DevframeAgentHostEvents as Mt, ScopedBroadcastOptions as N, EventEmitter as Nt, DevframeScopedNodeRpc as O, AgentToolInput as Ot, ScopedClientFunctions as P, EventUnsubscribe as Pt, RpcStreamingChannelOptions as Q, SettingsForNamespace as R, defineCliFlags as Rt, DevframeNodeContext as S, AgentHandle as St, DevframeServicesHost as T, AgentResourceContent as Tt, DevframeDiagnosticsDefinition as U, DevframeStorageScope as V, DevframeDiagnosticsHost as W, RpcSharedStateHost as X, RpcSharedStateGetOptions as Y, RpcStreamingChannel as Z, ConnectionMeta as _, SharedState as _t, DevframeDockDefaults as a, CreateStreamSinkOptions as at, DevframeCapabilities as b, SharedStatePatch as bt, DevframeSetupInfo as c, StreamSink as ct, DevframeWsOptions as d, createStreamSink as dt, DevframeRpcClientFunctions as et, McpRouteOptions as f, Immutable as ft, Thenable as g, ImmutableSet as gt, PartialWithoutId as h, ImmutableObject as ht, DevframeDeploymentKind as i, CreateStreamReaderOptions as it, DevframeSettingsRegistry as j, DevframeAgentHost as jt, DevframeScopedStreamingHost as k, AgentToolProvider as kt, DevframeSpaOptions as l, StreamSinkEvents as lt, EntriesToObject as m, ImmutableMap as mt, DevframeCliOptions as n, DevframeRpcSharedStates as nt, DevframeDuplicationStrategy as o, StreamErrorPayload as ot, DevframeAuthHandler as p, ImmutableArray as pt, RpcBroadcastOptions as q, DevframeDefinition as r, BufferedChunk as rt, DevframeRuntime as s, StreamReader as st, DevframeBrowserContext as t, DevframeRpcServerFunctions as tt, DevframeSseOptions as u, createStreamReader as ut, ConnectionMetaSse as v, SharedStateEvents as vt, DevframeServiceOf as w, AgentResource as wt, DevframeConnectionConfigsRegistry as x, createSharedState as xt, ConnectionMetaWebsocket as y, SharedStateOptions as yt, DevframeViewHost as z, parseCliFlags as zt };
|
|
@@ -38,7 +38,7 @@ const diagnostics = defineDiagnostics({
|
|
|
38
38
|
},
|
|
39
39
|
DF0033: {
|
|
40
40
|
why: (p) => `Failed to start dev RPC bridge for "${p.id}": ${p.reason}`,
|
|
41
|
-
fix: "Verify the bridge port is free and the devframe setup function does not throw. Pin a port via `cli.port` / `cli.portRange` on the definition, or via `
|
|
41
|
+
fix: "Verify the bridge port is free and the devframe setup function does not throw. Pin a port via `cli.port` / `cli.portRange` on the definition, or via `port` on `devframeViteBridge` (`@devframes/vite`)."
|
|
42
42
|
},
|
|
43
43
|
DF0034: {
|
|
44
44
|
why: (p) => `Scoped RPC registration for namespace "${p.namespace}" received an already-namespaced function name "${p.name}".`,
|
|
@@ -90,7 +90,7 @@ const diagnostics = defineDiagnostics({
|
|
|
90
90
|
},
|
|
91
91
|
DF0052: {
|
|
92
92
|
why: (p) => `Failed to listen on ${p.host}:${p.port}: ${p.reason}`,
|
|
93
|
-
fix: "The port is likely already taken by another process (often a previous devframe instance). Free it, or pick another via `--port`, `cli.port` / `cli.portRange` on the definition, or `
|
|
93
|
+
fix: "The port is likely already taken by another process (often a previous devframe instance). Free it, or pick another via `--port`, `cli.port` / `cli.portRange` on the definition, or `port` on `devframeViteBridge` (`@devframes/vite`). The original node error is available as `error.cause`."
|
|
94
94
|
},
|
|
95
95
|
DF0054: {
|
|
96
96
|
why: (p) => `connectionMeta() was called before initDevframe("${p.id}") finished initializing.`,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as diagnostics } from "./diagnostics-
|
|
2
|
-
import { i as createEventEmitter } from "./storage-
|
|
1
|
+
import { t as diagnostics } from "./diagnostics-C7IGWppM.mjs";
|
|
2
|
+
import { i as createEventEmitter } from "./storage-CaUVrBrG.mjs";
|
|
3
3
|
//#region src/node/agent-args.ts
|
|
4
4
|
/**
|
|
5
5
|
* Map the args payload an agent surface receives (MCP sends an object
|
|
@@ -14,8 +14,6 @@ import { i as createEventEmitter } from "./storage-BcmVEJRc.mjs";
|
|
|
14
14
|
* - without schemas, `arg0`/`arg1`/… keys are collected when present
|
|
15
15
|
* - an empty object becomes a zero-argument call
|
|
16
16
|
* - anything else follows the {@link AgentArgsFallback}
|
|
17
|
-
*
|
|
18
|
-
* @experimental
|
|
19
17
|
*/
|
|
20
18
|
function coerceAgentPositionalArgs(args, schemas, fallback = "wrap") {
|
|
21
19
|
if (Array.isArray(args)) return args;
|
|
@@ -43,8 +41,6 @@ function coerceAgentPositionalArgs(args, schemas, fallback = "wrap") {
|
|
|
43
41
|
* devframe. Auto-discovers RPC functions with an `agent` field from
|
|
44
42
|
* `ctx.rpc.definitions`, and accepts plugin-registered tools /
|
|
45
43
|
* resources via `registerTool` / `registerResource`.
|
|
46
|
-
*
|
|
47
|
-
* @experimental
|
|
48
44
|
*/
|
|
49
45
|
var DevframeAgentHost = class {
|
|
50
46
|
context;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-JspESFgx.mjs";
|
|
2
2
|
import { i as isAllowedOrigin } from "./ws-server-Bk1hOG3X.mjs";
|
|
3
|
-
import { t as diagnostics } from "./diagnostics-
|
|
4
|
-
import { t as createHostContext } from "./context-
|
|
5
|
-
import { t as toAgentToolName } from "./agent-tool-name-
|
|
3
|
+
import { t as diagnostics } from "./diagnostics-C7IGWppM.mjs";
|
|
4
|
+
import { t as createHostContext } from "./context-b6iSomtv.mjs";
|
|
5
|
+
import { t as toAgentToolName } from "./agent-tool-name-EgfoFO8C.mjs";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
import { Diagnostic } from "nostics";
|
|
8
8
|
import { join } from "pathe";
|
|
@@ -190,9 +190,6 @@ function buildMcpServerFromContext(ctx, options) {
|
|
|
190
190
|
/**
|
|
191
191
|
* Build an MCP server over the agent surface of a devframe definition.
|
|
192
192
|
* Currently supports `stdio` transport only.
|
|
193
|
-
*
|
|
194
|
-
* @experimental The agent-native surface is experimental and may change
|
|
195
|
-
* without a major version bump until it stabilizes.
|
|
196
193
|
*/
|
|
197
194
|
async function createMcpServer(definition, options = {}) {
|
|
198
195
|
const transport = options.transport ?? "stdio";
|
|
@@ -463,8 +460,6 @@ function parseResourceUri(uri) {
|
|
|
463
460
|
* loopback-default DNS-rebinding protection that — unlike the WS upgrade's
|
|
464
461
|
* `isAllowedOrigin` — also rejects `Origin`-less requests, so a route-based
|
|
465
462
|
* endpoint isn't reachable by an arbitrary local process.
|
|
466
|
-
*
|
|
467
|
-
* @experimental
|
|
468
463
|
*/
|
|
469
464
|
function createMcpFetchHandler(ctx, options) {
|
|
470
465
|
const sessions = /* @__PURE__ */ new Map();
|
|
@@ -547,8 +542,6 @@ var http_exports = /* @__PURE__ */ __exportAll({ mountMcpHttp: () => mountMcpHtt
|
|
|
547
542
|
* legitimate MCP 404 (unknown session) isn't swallowed by h3's
|
|
548
543
|
* "Response-with-404 falls through to the next handler" rule (which would
|
|
549
544
|
* otherwise hand the request to the SPA static catch-all).
|
|
550
|
-
*
|
|
551
|
-
* @experimental
|
|
552
545
|
*/
|
|
553
546
|
function mountMcpHttp(app, ctx, path, options) {
|
|
554
547
|
const handler = createMcpFetchHandler(ctx, options);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as InternalAnonymousAuthStorage } from "./context-
|
|
1
|
+
import { K as DevframeNodeRpcSession, S as DevframeNodeContext, _t as SharedState } from "./devframe-5oblos7I.mjs";
|
|
2
|
+
import { n as InternalAnonymousAuthStorage } from "./context-DV4uWieM.mjs";
|
|
3
3
|
//#region src/node/auth/revoke.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Flip `isTrusted` to false on any live WS clients connected with `token`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as RpcFunctionType, S as RpcFunctionSetupResult, T as RpcReturnSchema, _ as RpcFunctionDefinition, i as RpcArgsSchema, v as RpcFunctionDefinitionAny, w as RpcFunctionsCollector } from "./types-
|
|
1
|
+
import { C as RpcFunctionType, S as RpcFunctionSetupResult, T as RpcReturnSchema, _ as RpcFunctionDefinition, i as RpcArgsSchema, v as RpcFunctionDefinitionAny, w as RpcFunctionsCollector } from "./types-Djq7CBXh.mjs";
|
|
2
2
|
//#region src/rpc/cache.d.ts
|
|
3
3
|
interface RpcCacheOptions {
|
|
4
4
|
functions: string[];
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import "./index-
|
|
3
|
-
import { C as RpcFunctionType, T as RpcReturnSchema, _ as RpcFunctionDefinition, g as RpcFunctionAgentOptions, i as RpcArgsSchema } from "./types-
|
|
4
|
-
import { d as DevframeRpcConnection, f as DevframeRpcConnectionRequest, p as DevframeRpcTransportKind, u as DevframeNodeRpcSessionMeta } from "./ws-server-
|
|
1
|
+
import { $ as RpcStreamingHost, A as DevframeSettings, At as AgentToolProviderHandle, B as DevframeHost, C as DevframeServiceId, Ct as AgentManifest, D as DevframeScopedNodeContext, Dt as AgentTool, E as DevframeServicesRegistry, Et as AgentResourceInput, F as ScopedRpcFn, Ft as EventsMap, G as DevframeDiagnosticsLogger, H as DevframeDefineDiagnosticsOptions, I as ScopedServerFunctions, J as RpcFunctionsHost, K as DevframeNodeRpcSession, L as ScopedSharedStates, M as DevframeSettingsStore, Mt as DevframeAgentHostEvents, N as ScopedBroadcastOptions, Nt as EventEmitter, O as DevframeScopedNodeRpc, Ot as AgentToolInput, P as ScopedClientFunctions, Pt as EventUnsubscribe, Q as RpcStreamingChannelOptions, R as SettingsForNamespace, S as DevframeNodeContext, St as AgentHandle, T as DevframeServicesHost, Tt as AgentResourceContent, U as DevframeDiagnosticsDefinition, V as DevframeStorageScope, W as DevframeDiagnosticsHost, X as RpcSharedStateHost, Y as RpcSharedStateGetOptions, Z as RpcStreamingChannel, _ as ConnectionMeta, a as DevframeDockDefaults, b as DevframeCapabilities, c as DevframeSetupInfo, d as DevframeWsOptions, et as DevframeRpcClientFunctions, f as McpRouteOptions, g as Thenable, h as PartialWithoutId, i as DevframeDeploymentKind, j as DevframeSettingsRegistry, jt as DevframeAgentHost, k as DevframeScopedStreamingHost, kt as AgentToolProvider, l as DevframeSpaOptions, m as EntriesToObject, n as DevframeCliOptions, nt as DevframeRpcSharedStates, o as DevframeDuplicationStrategy, q as RpcBroadcastOptions, r as DevframeDefinition, s as DevframeRuntime, t as DevframeBrowserContext, tt as DevframeRpcServerFunctions, u as DevframeSseOptions, v as ConnectionMetaSse, w as DevframeServiceOf, wt as AgentResource, x as DevframeConnectionConfigsRegistry, y as ConnectionMetaWebsocket, z as DevframeViewHost } from "./devframe-5oblos7I.mjs";
|
|
2
|
+
import "./index-tdrk1bzV.mjs";
|
|
3
|
+
import { C as RpcFunctionType, T as RpcReturnSchema, _ as RpcFunctionDefinition, g as RpcFunctionAgentOptions, i as RpcArgsSchema } from "./types-Djq7CBXh.mjs";
|
|
4
|
+
import { d as DevframeRpcConnection, f as DevframeRpcConnectionRequest, p as DevframeRpcTransportKind, u as DevframeNodeRpcSessionMeta } from "./ws-server-D1d3QM9f.mjs";
|
|
5
5
|
//#region src/define.d.ts
|
|
6
6
|
declare const defineRpcFunction: <NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[], RETURN = void, const AS extends RpcArgsSchema | undefined = undefined, const RS extends RpcReturnSchema | undefined = undefined>(definition: RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeNodeContext>) => RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeNodeContext>;
|
|
7
7
|
/**
|
|
@@ -10,4 +10,4 @@ declare const defineRpcFunction: <NAME extends string, TYPE extends RpcFunctionT
|
|
|
10
10
|
*/
|
|
11
11
|
declare function defineDevframe(d: DevframeDefinition): DevframeDefinition;
|
|
12
12
|
//#endregion
|
|
13
|
-
export { type AgentHandle, type AgentManifest, type AgentResource, type AgentResourceContent, type AgentResourceInput, type AgentTool, type AgentToolInput, type AgentToolProvider, type AgentToolProviderHandle, type ConnectionMeta, type ConnectionMetaSse, type ConnectionMetaWebsocket, type DevframeAgentHost, type DevframeAgentHostEvents, type DevframeBrowserContext, type DevframeCapabilities, type DevframeCliOptions, type DevframeDefineDiagnosticsOptions, type DevframeDefinition, type DevframeDeploymentKind, type DevframeDiagnosticsDefinition, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, type DevframeDockDefaults, type DevframeDuplicationStrategy, type DevframeHost, type DevframeNodeContext, type DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, type DevframeRpcClientFunctions, type DevframeRpcConnection, type DevframeRpcConnectionRequest, type DevframeRpcServerFunctions, type DevframeRpcSharedStates, type DevframeRpcTransportKind, type DevframeRuntime, type DevframeScopedNodeContext, type DevframeScopedNodeRpc, type DevframeScopedStreamingHost, type DevframeServiceId, type DevframeServiceOf, type DevframeServicesHost, type DevframeServicesRegistry, type DevframeSettings, type DevframeSettingsRegistry, type DevframeSettingsStore, type DevframeSetupInfo, type DevframeSpaOptions, type DevframeSseOptions, type DevframeStorageScope, type DevframeViewHost, type DevframeWsOptions, type EntriesToObject, type EventEmitter, type EventUnsubscribe, type EventsMap, type McpRouteOptions, type PartialWithoutId, type RpcBroadcastOptions, type RpcFunctionAgentOptions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, type ScopedBroadcastOptions, type ScopedClientFunctions, type ScopedRpcFn, type ScopedServerFunctions, type ScopedSharedStates, type SettingsForNamespace, type Thenable, defineDevframe, defineRpcFunction };
|
|
13
|
+
export { type AgentHandle, type AgentManifest, type AgentResource, type AgentResourceContent, type AgentResourceInput, type AgentTool, type AgentToolInput, type AgentToolProvider, type AgentToolProviderHandle, type ConnectionMeta, type ConnectionMetaSse, type ConnectionMetaWebsocket, type DevframeAgentHost, type DevframeAgentHostEvents, type DevframeBrowserContext, type DevframeCapabilities, type DevframeCliOptions, type DevframeConnectionConfigsRegistry, type DevframeDefineDiagnosticsOptions, type DevframeDefinition, type DevframeDeploymentKind, type DevframeDiagnosticsDefinition, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, type DevframeDockDefaults, type DevframeDuplicationStrategy, type DevframeHost, type DevframeNodeContext, type DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, type DevframeRpcClientFunctions, type DevframeRpcConnection, type DevframeRpcConnectionRequest, type DevframeRpcServerFunctions, type DevframeRpcSharedStates, type DevframeRpcTransportKind, type DevframeRuntime, type DevframeScopedNodeContext, type DevframeScopedNodeRpc, type DevframeScopedStreamingHost, type DevframeServiceId, type DevframeServiceOf, type DevframeServicesHost, type DevframeServicesRegistry, type DevframeSettings, type DevframeSettingsRegistry, type DevframeSettingsStore, type DevframeSetupInfo, type DevframeSpaOptions, type DevframeSseOptions, type DevframeStorageScope, type DevframeViewHost, type DevframeWsOptions, type EntriesToObject, type EventEmitter, type EventUnsubscribe, type EventsMap, type McpRouteOptions, type PartialWithoutId, type RpcBroadcastOptions, type RpcFunctionAgentOptions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, type ScopedBroadcastOptions, type ScopedClientFunctions, type ScopedRpcFn, type ScopedServerFunctions, type ScopedSharedStates, type SettingsForNamespace, type Thenable, defineDevframe, defineRpcFunction };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-JspESFgx.mjs";
|
|
2
|
-
import { t as diagnostics } from "./diagnostics-
|
|
2
|
+
import { t as diagnostics } from "./diagnostics-C7IGWppM.mjs";
|
|
3
3
|
import { mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { join } from "pathe";
|
|
5
5
|
import process from "node:process";
|
|
@@ -42,8 +42,6 @@ function isRegistryDisabled() {
|
|
|
42
42
|
* crash are pruned by readers whose liveness probe fails. Registration never
|
|
43
43
|
* throws — a write failure degrades to a coded warning (`DF0045`), since a
|
|
44
44
|
* dev server must not die over discovery metadata.
|
|
45
|
-
*
|
|
46
|
-
* @experimental
|
|
47
45
|
*/
|
|
48
46
|
function registerDevframeInstance(record, options = {}) {
|
|
49
47
|
const dir = resolveInstancesDir(options.instancesDir);
|
|
@@ -78,8 +76,6 @@ function registerDevframeInstance(record, options = {}) {
|
|
|
78
76
|
/**
|
|
79
77
|
* Read every record in the registry directory, dropping unparseable files.
|
|
80
78
|
* Liveness is the caller's concern — see {@link probeDevframeInstance}.
|
|
81
|
-
*
|
|
82
|
-
* @experimental
|
|
83
79
|
*/
|
|
84
80
|
function readDevframeInstances(options = {}) {
|
|
85
81
|
const dir = resolveInstancesDir(options.instancesDir);
|
|
@@ -155,8 +151,6 @@ async function probeDevframeInstance(record, options = {}) {
|
|
|
155
151
|
* records left behind by killed processes shadow the server currently bound
|
|
156
152
|
* there: per `(port, basePath)` only the newest record survives, older
|
|
157
153
|
* ghosts are pruned with the dead.
|
|
158
|
-
*
|
|
159
|
-
* @experimental
|
|
160
154
|
*/
|
|
161
155
|
async function listLiveDevframeInstances(options = {}) {
|
|
162
156
|
const dir = resolveInstancesDir(options.instancesDir);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "./ws-server-
|
|
3
|
-
import "./index-
|
|
1
|
+
import { K as DevframeNodeRpcSession, S as DevframeNodeContext, _ as ConnectionMeta, d as DevframeWsOptions, et as DevframeRpcClientFunctions, p as DevframeAuthHandler, tt as DevframeRpcServerFunctions, u as DevframeSseOptions } from "./devframe-5oblos7I.mjs";
|
|
2
|
+
import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "./ws-server-D1d3QM9f.mjs";
|
|
3
|
+
import "./index-BzDl02lt.mjs";
|
|
4
4
|
import { BirpcGroup } from "birpc";
|
|
5
5
|
import { NodeAdapter } from "crossws/adapters/node";
|
|
6
6
|
import { Buffer } from "node:buffer";
|
|
@@ -11,9 +11,6 @@ import { H3 } from "h3";
|
|
|
11
11
|
/**
|
|
12
12
|
* One running devframe instance, as recorded in the instance registry.
|
|
13
13
|
* Records are self-describing JSON — additive fields are safe.
|
|
14
|
-
*
|
|
15
|
-
* @experimental The agent-native surface is experimental and may change
|
|
16
|
-
* without a major version bump until it stabilizes.
|
|
17
14
|
*/
|
|
18
15
|
interface DevframeInstanceRecord {
|
|
19
16
|
/** Process id of the dev server. */
|
|
@@ -42,8 +39,6 @@ interface DevframeInstanceRecord {
|
|
|
42
39
|
}
|
|
43
40
|
/**
|
|
44
41
|
* Handle returned by {@link registerDevframeInstance}.
|
|
45
|
-
*
|
|
46
|
-
* @experimental
|
|
47
42
|
*/
|
|
48
43
|
interface DevframeInstanceRegistration {
|
|
49
44
|
/** The registry file backing this registration. */
|
|
@@ -65,8 +60,6 @@ interface DevframeInstanceRegistration {
|
|
|
65
60
|
* crash are pruned by readers whose liveness probe fails. Registration never
|
|
66
61
|
* throws — a write failure degrades to a coded warning (`DF0045`), since a
|
|
67
62
|
* dev server must not die over discovery metadata.
|
|
68
|
-
*
|
|
69
|
-
* @experimental
|
|
70
63
|
*/
|
|
71
64
|
declare function registerDevframeInstance(record: DevframeInstanceRecord, options?: {
|
|
72
65
|
instancesDir?: string;
|
|
@@ -81,8 +74,6 @@ declare function registerDevframeInstance(record: DevframeInstanceRecord, option
|
|
|
81
74
|
* records left behind by killed processes shadow the server currently bound
|
|
82
75
|
* there: per `(port, basePath)` only the newest record survives, older
|
|
83
76
|
* ghosts are pruned with the dead.
|
|
84
|
-
*
|
|
85
|
-
* @experimental
|
|
86
77
|
*/
|
|
87
78
|
declare function listLiveDevframeInstances(options?: {
|
|
88
79
|
instancesDir?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./constants.mjs";
|
|
2
|
-
import { t as diagnostics } from "./diagnostics-
|
|
3
|
-
import { t as getInternalContext } from "./context-
|
|
2
|
+
import { t as diagnostics } from "./diagnostics-C7IGWppM.mjs";
|
|
3
|
+
import { t as getInternalContext } from "./context-CMSryXs-.mjs";
|
|
4
4
|
import { createInteractiveAuth } from "./recipes/interactive-auth.mjs";
|
|
5
5
|
import { createServer } from "node:http";
|
|
6
6
|
import process from "node:process";
|
|
@@ -83,7 +83,7 @@ async function bindHttpAndWs(options) {
|
|
|
83
83
|
const origin = normalizeHttpServerUrl(bindHost, resolvedPort);
|
|
84
84
|
const internal = getInternalContext(context);
|
|
85
85
|
const wsUrl = `ws://${formatHostForUrl(bindHost)}:${resolvedPort}${options.path ?? ""}`;
|
|
86
|
-
if (websocket) internal.
|
|
86
|
+
if (websocket) internal.setWsEndpoint({ url: wsUrl });
|
|
87
87
|
function connectionMeta() {
|
|
88
88
|
const jsonSerializableMethods = [];
|
|
89
89
|
for (const def of rpcHost.definitions.values()) if (def.jsonSerializable === true) jsonSerializableMethods.push(def.name);
|
|
@@ -103,7 +103,7 @@ async function bindHttpAndWs(options) {
|
|
|
103
103
|
async close() {
|
|
104
104
|
await closeWs();
|
|
105
105
|
if (ownsHttpServer) await new Promise((r) => httpServer.close(() => r()));
|
|
106
|
-
if (websocket && getInternalContext(context).wsEndpoint?.url === wsUrl) getInternalContext(context).
|
|
106
|
+
if (websocket && getInternalContext(context).wsEndpoint?.url === wsUrl) getInternalContext(context).setWsEndpoint(void 0);
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
}
|
|
@@ -197,7 +197,7 @@ function createInstanceShell(options) {
|
|
|
197
197
|
const origin = currentOrigin();
|
|
198
198
|
if (!cfg || registerPromise || !origin || !meta) return;
|
|
199
199
|
const resolvedMeta = meta;
|
|
200
|
-
registerPromise = import("./instance-registry-
|
|
200
|
+
registerPromise = import("./instance-registry-Du_hbx-j.mjs").then((n) => n.t).then(({ registerDevframeInstance }) => {
|
|
201
201
|
let port = 0;
|
|
202
202
|
try {
|
|
203
203
|
const url = new URL(origin);
|
|
@@ -257,7 +257,7 @@ function createInstanceShell(options) {
|
|
|
257
257
|
let resolvedAuth = false;
|
|
258
258
|
let corePromise;
|
|
259
259
|
function ensureCore() {
|
|
260
|
-
corePromise ??= import("./rpc-core-
|
|
260
|
+
corePromise ??= import("./rpc-core-Cva-0pw0.mjs").then((n) => n.n).then(({ createContextRpcServer }) => createContextRpcServer({
|
|
261
261
|
context: ctx,
|
|
262
262
|
auth: resolvedAuth,
|
|
263
263
|
onPeerConnect: options.onPeerConnect,
|
|
@@ -298,7 +298,7 @@ function createInstanceShell(options) {
|
|
|
298
298
|
allowedOrigins: options.allowedOrigins
|
|
299
299
|
});
|
|
300
300
|
if (ws.port != null) return await start(ws.port);
|
|
301
|
-
const { getPort } = await import("./
|
|
301
|
+
const { getPort } = await import("./_shared-CGPVmXUM.mjs").then((n) => n.a);
|
|
302
302
|
let lastError;
|
|
303
303
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
304
304
|
const port = attempt === 0 && options.resolveSidecarPort ? await options.resolveSidecarPort(sidecarHost) : await getPort({
|
|
@@ -347,6 +347,7 @@ function createInstanceShell(options) {
|
|
|
347
347
|
...sseEnabled ? { sse: { path: advertisedSsePath } } : {},
|
|
348
348
|
...result.mcp ? { mcp: result.mcp } : {}
|
|
349
349
|
};
|
|
350
|
+
if (Object.keys(ctx.staticConfig).length > 0) meta.configs = ctx.staticConfig;
|
|
350
351
|
await options.mount?.(ctx, meta, api);
|
|
351
352
|
maybePrintBanner();
|
|
352
353
|
maybeRegister();
|
|
@@ -434,7 +435,7 @@ function createInstanceShell(options) {
|
|
|
434
435
|
const address = server.address();
|
|
435
436
|
if (typeof address !== "object" || !address) return;
|
|
436
437
|
const host = options.host ?? (address.address === "::" || address.address === "0.0.0.0" ? "localhost" : address.address);
|
|
437
|
-
getInternalContext(ctx).
|
|
438
|
+
getInternalContext(ctx).setWsEndpoint({ url: `ws://${formatHostForUrl(host)}:${address.port}${routePath}` });
|
|
438
439
|
};
|
|
439
440
|
if (server.listening) record();
|
|
440
441
|
else server.once("listening", record);
|