devframe 0.7.3 → 0.7.4
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/adapters/build.d.mts +1 -1
- package/dist/adapters/build.mjs +1 -1
- package/dist/adapters/cac.d.mts +1 -1
- package/dist/adapters/cac.mjs +1 -1
- package/dist/adapters/cli.d.mts +1 -1
- package/dist/adapters/cli.mjs +1 -1
- package/dist/adapters/dev.d.mts +2 -2
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.mjs +1 -1
- package/dist/{build-server-Bo0G5XcS.mjs → build-server-vGNtqlOd.mjs} +7 -3
- package/dist/{cac-BFCgKymz.mjs → cac-CZk1y4rm.mjs} +2 -2
- package/dist/client/index.d.mts +18 -2
- package/dist/client/index.mjs +27 -4
- package/dist/{context-CKJheEtf.mjs → context-ClRdkpJ7.mjs} +1 -1
- package/dist/{context-B1sekkgB.d.mts → context-DxFsOWkc.d.mts} +1 -1
- package/dist/{dev-Bs4oRVnI.mjs → dev-CicFHIt8.mjs} +18 -5
- package/dist/{devframe-CnTVuGw9.d.mts → devframe-WHtcqYlZ.d.mts} +705 -554
- package/dist/helpers/vite.d.mts +1 -1
- package/dist/helpers/vite.mjs +2 -2
- package/dist/{host-h3-Dsf-Tgwx.mjs → host-h3-DBzbpjXk.mjs} +51 -4
- package/dist/{http-BirzlyE9.mjs → http-DHckZCYZ.mjs} +1 -1
- package/dist/{index-Dpsr-8dD.d.mts → index-Cj0M3G3F.d.mts} +3 -47
- package/dist/index.d.mts +3 -3
- package/dist/node/auth.d.mts +2 -1
- package/dist/node/hub-internals.d.mts +2 -2
- package/dist/node/hub-internals.mjs +1 -1
- package/dist/node/index.d.mts +23 -6
- package/dist/node/index.mjs +4 -4
- package/dist/recipes/interactive-auth.d.mts +2 -2
- package/dist/recipes/interactive-auth.mjs +1 -1
- package/dist/recipes/open-helpers.d.mts +1 -1
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/{server-4QH37sb-.d.mts → server-BRxA2OAh.d.mts} +3 -3
- package/dist/{server-CRFYfRqK.mjs → server-DvrOR1LG.mjs} +2 -2
- package/dist/{storage-yrUZaiib.mjs → storage-E9KrCsLr.mjs} +4 -0
- package/dist/types/index.d.mts +3 -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-server-CceOy6He.d.mts → ws-server-9-wn7MNQ.d.mts} +1 -1
- package/package.json +1 -1
package/dist/helpers/vite.d.mts
CHANGED
package/dist/helpers/vite.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_WS_ROUTE } from "../constants.mjs";
|
|
2
|
-
import { a as diagnostics } from "../storage-
|
|
2
|
+
import { a as diagnostics } from "../storage-E9KrCsLr.mjs";
|
|
3
3
|
import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-bWRzeSa0.mjs";
|
|
4
4
|
import { serveStaticNodeMiddleware } from "../utils/serve-static.mjs";
|
|
5
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
5
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-CicFHIt8.mjs";
|
|
6
6
|
import { resolve } from "pathe";
|
|
7
7
|
//#region src/helpers/vite.ts
|
|
8
8
|
/**
|
|
@@ -2,7 +2,7 @@ import { t as devframeReporter } from "./diagnostics-reporter-CsIG85Q5.mjs";
|
|
|
2
2
|
import { t as diagnostics } from "./diagnostics-BXwBQmoN.mjs";
|
|
3
3
|
import { RpcFunctionsCollectorBase } from "./rpc/index.mjs";
|
|
4
4
|
import { defineRpcFunction } from "./index.mjs";
|
|
5
|
-
import { a as diagnostics$1, i as createEventEmitter, n as createSharedState, r as nanoid, t as createStorage } from "./storage-
|
|
5
|
+
import { a as diagnostics$1, i as createEventEmitter, n as createSharedState, r as nanoid, t as createStorage } from "./storage-E9KrCsLr.mjs";
|
|
6
6
|
import { defineDiagnostics } from "nostics";
|
|
7
7
|
import { isatty } from "node:tty";
|
|
8
8
|
import { formatWithOptions, inspect } from "node:util";
|
|
@@ -1190,6 +1190,49 @@ var RpcFunctionsHost = class extends RpcFunctionsCollectorBase {
|
|
|
1190
1190
|
}
|
|
1191
1191
|
};
|
|
1192
1192
|
//#endregion
|
|
1193
|
+
//#region src/node/host-services.ts
|
|
1194
|
+
/**
|
|
1195
|
+
* Cross-plugin service registry (see `types/services.ts` for the contract).
|
|
1196
|
+
* Values are held per context instance; `whenAvailable` subscriptions make
|
|
1197
|
+
* the mechanism robust against setup ordering between provider and consumer.
|
|
1198
|
+
*/
|
|
1199
|
+
var DevframeServicesHostImpl = class {
|
|
1200
|
+
services = /* @__PURE__ */ new Map();
|
|
1201
|
+
listeners = /* @__PURE__ */ new Map();
|
|
1202
|
+
provide(id, service) {
|
|
1203
|
+
const key = id;
|
|
1204
|
+
if (this.services.has(key)) throw diagnostics$1.DF0037({ id: key });
|
|
1205
|
+
this.services.set(key, service);
|
|
1206
|
+
for (const listener of this.listeners.get(key) ?? []) listener(service);
|
|
1207
|
+
return () => {
|
|
1208
|
+
if (this.services.get(key) === service) this.services.delete(key);
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1211
|
+
get(id) {
|
|
1212
|
+
return this.services.get(id);
|
|
1213
|
+
}
|
|
1214
|
+
has(id) {
|
|
1215
|
+
return this.services.has(id);
|
|
1216
|
+
}
|
|
1217
|
+
whenAvailable(id, callback) {
|
|
1218
|
+
const key = id;
|
|
1219
|
+
if (this.services.has(key)) callback(this.services.get(key));
|
|
1220
|
+
let set = this.listeners.get(key);
|
|
1221
|
+
if (!set) {
|
|
1222
|
+
set = /* @__PURE__ */ new Set();
|
|
1223
|
+
this.listeners.set(key, set);
|
|
1224
|
+
}
|
|
1225
|
+
const listener = callback;
|
|
1226
|
+
set.add(listener);
|
|
1227
|
+
return () => {
|
|
1228
|
+
set.delete(listener);
|
|
1229
|
+
};
|
|
1230
|
+
}
|
|
1231
|
+
keys() {
|
|
1232
|
+
return Array.from(this.services.keys());
|
|
1233
|
+
}
|
|
1234
|
+
};
|
|
1235
|
+
//#endregion
|
|
1193
1236
|
//#region src/node/host-views.ts
|
|
1194
1237
|
var DevframeViewHost = class {
|
|
1195
1238
|
context;
|
|
@@ -1283,7 +1326,7 @@ function qualifyName(namespace, name) {
|
|
|
1283
1326
|
//#region src/node/settings.ts
|
|
1284
1327
|
const STORAGE_SCOPE = {
|
|
1285
1328
|
global: "global",
|
|
1286
|
-
project: "
|
|
1329
|
+
project: "project"
|
|
1287
1330
|
};
|
|
1288
1331
|
function createNodeSettingsStore(context, namespace, scope) {
|
|
1289
1332
|
const stateKey = `devframe:settings:${scope}:${namespace}`;
|
|
@@ -1403,6 +1446,7 @@ async function createHostContext(options) {
|
|
|
1403
1446
|
views: void 0,
|
|
1404
1447
|
diagnostics: void 0,
|
|
1405
1448
|
agent: void 0,
|
|
1449
|
+
services: void 0,
|
|
1406
1450
|
scope: void 0
|
|
1407
1451
|
};
|
|
1408
1452
|
const rpcHost = new RpcFunctionsHost(context);
|
|
@@ -1411,6 +1455,7 @@ async function createHostContext(options) {
|
|
|
1411
1455
|
context.rpc = rpcHost;
|
|
1412
1456
|
context.views = viewsHost;
|
|
1413
1457
|
context.diagnostics = diagnosticsHost;
|
|
1458
|
+
context.services = new DevframeServicesHostImpl();
|
|
1414
1459
|
context.agent = new DevframeAgentHost(context);
|
|
1415
1460
|
const scopedCache = /* @__PURE__ */ new Map();
|
|
1416
1461
|
context.scope = ((namespace) => {
|
|
@@ -1442,9 +1487,11 @@ function createH3DevframeHost(options) {
|
|
|
1442
1487
|
},
|
|
1443
1488
|
getStorageDir(scope) {
|
|
1444
1489
|
const namespace = `.${options.appName}/devframe`;
|
|
1445
|
-
|
|
1490
|
+
if (scope === "workspace") return join(workspaceRoot, ".devframe");
|
|
1491
|
+
if (scope === "project") return join(workspaceRoot, "node_modules", namespace);
|
|
1492
|
+
return join(homedir(), namespace);
|
|
1446
1493
|
}
|
|
1447
1494
|
};
|
|
1448
1495
|
}
|
|
1449
1496
|
//#endregion
|
|
1450
|
-
export { DevframeViewHost as a,
|
|
1497
|
+
export { DevframeViewHost as a, createRpcStreamingServerHost as c, DevframeAgentHost as d, createNodeSettings as i, createRpcSharedStateServerHost as l, createHostContext as n, DevframeServicesHostImpl as o, createScopedNodeContext as r, RpcFunctionsHost as s, createH3DevframeHost as t, DevframeDiagnosticsHost as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isAllowedOrigin } from "./rpc/transports/ws-server.mjs";
|
|
2
|
-
import { t as buildMcpServerFromContext } from "./build-server-
|
|
2
|
+
import { t as buildMcpServerFromContext } from "./build-server-vGNtqlOd.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { defineHandler } from "h3";
|
|
5
5
|
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
@@ -1,49 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./index-DgsLFhZg.mjs";
|
|
4
|
-
import { n as InternalAnonymousAuthStorage } from "./context-B1sekkgB.mjs";
|
|
5
|
-
import { Peer } from "crossws";
|
|
6
|
-
//#region src/node/auth/handler.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* A ready-made pre-auth RPC handler, as produced by
|
|
9
|
-
* `devframe/recipes/interactive-auth`'s `createInteractiveAuth`. Bundles
|
|
10
|
-
* everything a host adapter needs to wire an authenticated server:
|
|
11
|
-
* the handshake RPC functions, the resolver gate, the connect-time trust
|
|
12
|
-
* hook, and the startup banner.
|
|
13
|
-
*
|
|
14
|
-
* `startHttpAndWs` accepts one of these directly via its `auth` option —
|
|
15
|
-
* see {@link https://devfra.me | devframe}'s server docs — or a host can
|
|
16
|
-
* wire the four pieces itself against a lower-level transport.
|
|
17
|
-
*/
|
|
18
|
-
interface DevframeAuthHandler {
|
|
19
|
-
/**
|
|
20
|
-
* `anonymous:devframe:auth` + `anonymous:devframe:auth:exchange` (the
|
|
21
|
-
* handshake) and `devframe:auth:revoke` (self-revoke) — register these on
|
|
22
|
-
* the RPC host (e.g. `rpcHost.register(fn)` for each).
|
|
23
|
-
*/
|
|
24
|
-
rpcFunctions: RpcFunctionDefinitionAny[];
|
|
25
|
-
/**
|
|
26
|
-
* Resolver gate: whether `methodName` is callable given `session`'s
|
|
27
|
-
* current trust state. Defaults to allowing any `anonymous:`-prefixed
|
|
28
|
-
* method (see `isAnonymousRpcMethod`) plus anything once the session is
|
|
29
|
-
* trusted.
|
|
30
|
-
*/
|
|
31
|
-
authorize: (methodName: string, session: DevframeNodeRpcSession) => boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Connect-time trust: reads a bearer token off the peer's upgrade request
|
|
34
|
-
* (an `Authorization: Bearer <token>` header, or a static/pre-shared
|
|
35
|
-
* token from `clientAuthTokens`) and, when valid, marks the session
|
|
36
|
-
* trusted immediately — before the client's own handshake call.
|
|
37
|
-
*/
|
|
38
|
-
onConnect: (peer: Peer, session: DevframeNodeRpcSession) => void;
|
|
39
|
-
/**
|
|
40
|
-
* Print the current one-time code and its magic-link URL. Devframe stays
|
|
41
|
-
* headless — call this yourself once the server is listening. Safe to
|
|
42
|
-
* call repeatedly; it only prints once per code.
|
|
43
|
-
*/
|
|
44
|
-
printBanner: () => void;
|
|
45
|
-
}
|
|
46
|
-
//#endregion
|
|
1
|
+
import { U as DevframeNodeRpcSession, b as DevframeNodeContext, mt as SharedState } from "./devframe-WHtcqYlZ.mjs";
|
|
2
|
+
import { n as InternalAnonymousAuthStorage } from "./context-DxFsOWkc.mjs";
|
|
47
3
|
//#region src/node/auth/revoke.d.ts
|
|
48
4
|
/**
|
|
49
5
|
* Flip `isTrusted` to false on any live WS clients connected with `token`
|
|
@@ -104,4 +60,4 @@ declare function exchangeTempAuthCode(code: string, session: DevframeNodeRpcSess
|
|
|
104
60
|
origin: string;
|
|
105
61
|
}, storage: SharedState<InternalAnonymousAuthStorage>): string | null;
|
|
106
62
|
//#endregion
|
|
107
|
-
export { verifyAuthToken as a,
|
|
63
|
+
export { verifyAuthToken as a, refreshTempAuthCode as i, exchangeTempAuthCode as n, revokeActiveConnectionsForToken as o, getTempAuthCode as r, revokeAuthToken as s, buildOtpAuthUrl as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as DevframeRpcSharedStates, A as DevframeSettingsStore, At as EventsMap, B as DevframeDiagnosticsDefinition, C as DevframeServicesHost, Ct as AgentResourceInput, D as DevframeScopedStreamingHost, Dt as DevframeAgentHostEvents, E as DevframeScopedNodeRpc, Et as DevframeAgentHost, F as SettingsForNamespace, G as RpcFunctionsHost, H as DevframeDiagnosticsLogger, I as DevframeViewHost, J as RpcStreamingChannel, K as RpcSharedStateGetOptions, L as DevframeHost, M as ScopedClientFunctions, N as ScopedServerFunctions, O as DevframeSettings, Ot as EventEmitter, P as ScopedSharedStates, Q as DevframeRpcServerFunctions, R as DevframeStorageScope, S as DevframeServiceOf, St as AgentResourceContent, T as DevframeScopedNodeContext, Tt as AgentToolInput, U as DevframeNodeRpcSession, V as DevframeDiagnosticsHost, W as RpcBroadcastOptions, X as RpcStreamingHost, Y as RpcStreamingChannelOptions, Z as DevframeRpcClientFunctions, _ as ConnectionMeta, a as DevframeDockDefaults, b as DevframeNodeContext, bt as AgentManifest, c as DevframeSetupInfo, d as McpRouteOptions, f as defineDevframe, g as Thenable, h as PartialWithoutId, i as DevframeDeploymentKind, j as ScopedBroadcastOptions, k as DevframeSettingsRegistry, kt as EventUnsubscribe, l as DevframeSpaOptions, m as EntriesToObject, n as DevframeCliOptions, o as DevframeDuplicationStrategy, q as RpcSharedStateHost, r as DevframeDefinition, s as DevframeRuntime, t as DevframeBrowserContext, u as DevframeWsOptions, v as ConnectionMetaWebsocket, w as DevframeServicesRegistry, wt as AgentTool, x as DevframeServiceId, xt as AgentResource, y as DevframeCapabilities, yt as AgentHandle, z as DevframeDefineDiagnosticsOptions } from "./devframe-WHtcqYlZ.mjs";
|
|
2
2
|
import { C as RpcFunctionType, T as RpcReturnSchema, _ as RpcFunctionDefinition, g as RpcFunctionAgentOptions, i as RpcArgsSchema } from "./types-CrzNxXKq.mjs";
|
|
3
3
|
import "./index-DgsLFhZg.mjs";
|
|
4
|
-
import { t as DevframeNodeRpcSessionMeta } from "./ws-server-
|
|
4
|
+
import { t as DevframeNodeRpcSessionMeta } from "./ws-server-9-wn7MNQ.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
|
//#endregion
|
|
8
|
-
export { type AgentHandle, type AgentManifest, type AgentResource, type AgentResourceContent, type AgentResourceInput, type AgentTool, type AgentToolInput, type ConnectionMeta, 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 DevframeRpcServerFunctions, type DevframeRpcSharedStates, type DevframeRuntime, type DevframeScopedNodeContext, type DevframeScopedNodeRpc, type DevframeScopedStreamingHost, type DevframeSettings, type DevframeSettingsRegistry, type DevframeSettingsStore, type DevframeSetupInfo, type DevframeSpaOptions, 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 ScopedServerFunctions, type ScopedSharedStates, type SettingsForNamespace, type Thenable, type defineDevframe, defineRpcFunction };
|
|
8
|
+
export { type AgentHandle, type AgentManifest, type AgentResource, type AgentResourceContent, type AgentResourceInput, type AgentTool, type AgentToolInput, type ConnectionMeta, 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 DevframeRpcServerFunctions, type DevframeRpcSharedStates, 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 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 ScopedServerFunctions, type ScopedSharedStates, type SettingsForNamespace, type Thenable, type defineDevframe, defineRpcFunction };
|
package/dist/node/auth.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as DevframeAuthHandler } from "../devframe-WHtcqYlZ.mjs";
|
|
2
|
+
import { a as verifyAuthToken, i as refreshTempAuthCode, n as exchangeTempAuthCode, o as revokeActiveConnectionsForToken, r as getTempAuthCode, s as revokeAuthToken, t as buildOtpAuthUrl } from "../index-Cj0M3G3F.mjs";
|
|
2
3
|
export { DevframeAuthHandler, buildOtpAuthUrl, exchangeTempAuthCode, getTempAuthCode, refreshTempAuthCode, revokeActiveConnectionsForToken, revokeAuthToken, verifyAuthToken };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-
|
|
2
|
-
import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-
|
|
1
|
+
import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-WHtcqYlZ.mjs";
|
|
2
|
+
import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-DxFsOWkc.mjs";
|
|
3
3
|
//#region src/adapters/_shared.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Resolve the mount base path for a devframe's SPA. Hosted adapters
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as internalContextMap, t as getInternalContext } from "../context-
|
|
1
|
+
import { n as internalContextMap, t as getInternalContext } from "../context-ClRdkpJ7.mjs";
|
|
2
2
|
import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-bWRzeSa0.mjs";
|
|
3
3
|
export { getInternalContext, internalContextMap, normalizeBasePath, resolveBasePath };
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as DevframeServicesHost, Ct as AgentResourceInput, Dt as DevframeAgentHostEvents, Et as DevframeAgentHost$1, G as RpcFunctionsHost$1, H as DevframeDiagnosticsLogger, I as DevframeViewHost$1, L as DevframeHost, O as DevframeSettings, Ot as EventEmitter, Q as DevframeRpcServerFunctions, S as DevframeServiceOf, St as AgentResourceContent, T as DevframeScopedNodeContext, Tt as AgentToolInput, U as DevframeNodeRpcSession, V as DevframeDiagnosticsHost$1, W as RpcBroadcastOptions, X as RpcStreamingHost, Z as DevframeRpcClientFunctions, b as DevframeNodeContext, bt as AgentManifest, mt as SharedState, q as RpcSharedStateHost, wt as AgentTool, x as DevframeServiceId, xt as AgentResource, yt as AgentHandle } from "../devframe-WHtcqYlZ.mjs";
|
|
2
2
|
import { v as RpcFunctionDefinitionAny } from "../types-CrzNxXKq.mjs";
|
|
3
3
|
import { S as RpcFunctionsCollectorBase } from "../index-DgsLFhZg.mjs";
|
|
4
|
-
import { t as DevframeNodeRpcSessionMeta } from "../ws-server-
|
|
5
|
-
import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-
|
|
4
|
+
import { t as DevframeNodeRpcSessionMeta } from "../ws-server-9-wn7MNQ.mjs";
|
|
5
|
+
import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-BRxA2OAh.mjs";
|
|
6
6
|
import { BirpcGroup } from "birpc";
|
|
7
7
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
8
8
|
//#region src/node/context.d.ts
|
|
@@ -112,8 +112,9 @@ interface CreateH3DevframeHostOptions {
|
|
|
112
112
|
mount?: (base: string, distDir: string) => void | Promise<void>;
|
|
113
113
|
/**
|
|
114
114
|
* Namespace for storage paths returned by `getStorageDir`. Workspace
|
|
115
|
-
* state lives under `${workspaceRoot}
|
|
116
|
-
*
|
|
115
|
+
* state (committable) lives under `${workspaceRoot}/.devframe/`, project
|
|
116
|
+
* state under `${workspaceRoot}/node_modules/.<appName>/devframe/`, and
|
|
117
|
+
* global state under `${homedir()}/.<appName>/devframe/`. Pick the
|
|
117
118
|
* devtool's id (or another stable, filesystem-safe identifier) so the
|
|
118
119
|
* standalone host doesn't collide with other tools' storage.
|
|
119
120
|
*/
|
|
@@ -129,6 +130,22 @@ interface CreateH3DevframeHostOptions {
|
|
|
129
130
|
*/
|
|
130
131
|
declare function createH3DevframeHost(options: CreateH3DevframeHostOptions): DevframeHost;
|
|
131
132
|
//#endregion
|
|
133
|
+
//#region src/node/host-services.d.ts
|
|
134
|
+
/**
|
|
135
|
+
* Cross-plugin service registry (see `types/services.ts` for the contract).
|
|
136
|
+
* Values are held per context instance; `whenAvailable` subscriptions make
|
|
137
|
+
* the mechanism robust against setup ordering between provider and consumer.
|
|
138
|
+
*/
|
|
139
|
+
declare class DevframeServicesHostImpl implements DevframeServicesHost {
|
|
140
|
+
private services;
|
|
141
|
+
private listeners;
|
|
142
|
+
provide<ID extends DevframeServiceId>(id: ID, service: DevframeServiceOf<ID>): () => void;
|
|
143
|
+
get<ID extends DevframeServiceId>(id: ID): DevframeServiceOf<ID> | undefined;
|
|
144
|
+
has(id: DevframeServiceId): boolean;
|
|
145
|
+
whenAvailable<ID extends DevframeServiceId>(id: ID, callback: (service: DevframeServiceOf<ID>) => void): () => void;
|
|
146
|
+
keys(): string[];
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
132
149
|
//#region src/node/host-views.d.ts
|
|
133
150
|
declare class DevframeViewHost implements DevframeViewHost$1 {
|
|
134
151
|
readonly context: DevframeNodeContext;
|
|
@@ -188,4 +205,4 @@ declare function toDialableHost(host: string): string;
|
|
|
188
205
|
declare function formatHostForUrl(host: string): string;
|
|
189
206
|
declare function normalizeHttpServerUrl(host: string, port: number | string): string;
|
|
190
207
|
//#endregion
|
|
191
|
-
export { CreateH3DevframeHostOptions, CreateHostContextOptions, CreateStorageOptions, DevframeAgentHost, DevframeDiagnosticsHost, DevframeViewHost, RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
|
|
208
|
+
export { CreateH3DevframeHostOptions, CreateHostContextOptions, CreateStorageOptions, DevframeAgentHost, DevframeDiagnosticsHost, DevframeServicesHostImpl, DevframeViewHost, RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createStorage } from "../storage-
|
|
2
|
-
import { a as DevframeViewHost, c as
|
|
3
|
-
import { a as toDialableHost, i as normalizeHttpServerUrl, n as formatHostForUrl, r as isObject, t as startHttpAndWs } from "../server-
|
|
4
|
-
export { DevframeAgentHost, DevframeDiagnosticsHost, DevframeViewHost, RpcFunctionsHost, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
|
|
1
|
+
import { t as createStorage } from "../storage-E9KrCsLr.mjs";
|
|
2
|
+
import { a as DevframeViewHost, c as createRpcStreamingServerHost, d as DevframeAgentHost, i as createNodeSettings, l as createRpcSharedStateServerHost, n as createHostContext, o as DevframeServicesHostImpl, r as createScopedNodeContext, s as RpcFunctionsHost, t as createH3DevframeHost, u as DevframeDiagnosticsHost } from "../host-h3-DBzbpjXk.mjs";
|
|
3
|
+
import { a as toDialableHost, i as normalizeHttpServerUrl, n as formatHostForUrl, r as isObject, t as startHttpAndWs } from "../server-DvrOR1LG.mjs";
|
|
4
|
+
export { DevframeAgentHost, DevframeDiagnosticsHost, DevframeServicesHostImpl, DevframeViewHost, RpcFunctionsHost, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { b as DevframeNodeContext, p as DevframeAuthHandler } from "../devframe-WHtcqYlZ.mjs";
|
|
2
|
+
import "../index-Cj0M3G3F.mjs";
|
|
3
3
|
//#region src/recipes/interactive-auth.d.ts
|
|
4
4
|
interface CreateInteractiveAuthOptions {
|
|
5
5
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as colors } from "../diagnostics-reporter-CsIG85Q5.mjs";
|
|
2
2
|
import { isAnonymousRpcMethod } from "../constants.mjs";
|
|
3
3
|
import { n as defineRpcFunction } from "../define-BLWPsH6y.mjs";
|
|
4
|
-
import { t as getInternalContext } from "../context-
|
|
4
|
+
import { t as getInternalContext } from "../context-ClRdkpJ7.mjs";
|
|
5
5
|
import { a as verifyAuthToken, n as exchangeTempAuthCode, r as getTempAuthCode, t as buildOtpAuthUrl } from "../state-WX3HT5a3.mjs";
|
|
6
6
|
import * as v from "valibot";
|
|
7
7
|
//#region src/recipes/interactive-auth.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as isAllowedOrigin, i as attachWsRpcTransport, n as WsRpcTransport, o as isLoopbackHostname, r as WsRpcTransportOptions, t as DevframeNodeRpcSessionMeta } from "../../ws-server-
|
|
1
|
+
import { a as isAllowedOrigin, i as attachWsRpcTransport, n as WsRpcTransport, o as isLoopbackHostname, r as WsRpcTransportOptions, t as DevframeNodeRpcSessionMeta } from "../../ws-server-9-wn7MNQ.mjs";
|
|
2
2
|
export { DevframeNodeRpcSessionMeta, WsRpcTransport, WsRpcTransportOptions, attachWsRpcTransport, isAllowedOrigin, isLoopbackHostname };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { BirpcGroup, EventOptions } from "birpc";
|
|
1
|
+
import { Q as DevframeRpcServerFunctions, U as DevframeNodeRpcSession, Z as DevframeRpcClientFunctions, _ as ConnectionMeta, b as DevframeNodeContext, p as DevframeAuthHandler } from "./devframe-WHtcqYlZ.mjs";
|
|
2
|
+
import "./index-Cj0M3G3F.mjs";
|
|
4
3
|
import { Peer } from "crossws";
|
|
4
|
+
import { BirpcGroup, EventOptions } from "birpc";
|
|
5
5
|
import { NodeAdapter } from "crossws/adapters/node";
|
|
6
6
|
import { Server } from "node:http";
|
|
7
7
|
import { H3 } from "h3";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRpcServer } from "./rpc/server.mjs";
|
|
2
2
|
import { attachWsRpcTransport } from "./rpc/transports/ws-server.mjs";
|
|
3
|
-
import { a as diagnostics } from "./storage-
|
|
4
|
-
import { t as getInternalContext } from "./context-
|
|
3
|
+
import { a as diagnostics } from "./storage-E9KrCsLr.mjs";
|
|
4
|
+
import { t as getInternalContext } from "./context-ClRdkpJ7.mjs";
|
|
5
5
|
import { createServer } from "node:http";
|
|
6
6
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
7
|
import { H3, toNodeHandler } from "h3";
|
|
@@ -55,6 +55,10 @@ const diagnostics = defineDiagnostics({
|
|
|
55
55
|
DF0036: {
|
|
56
56
|
why: (p) => `RPC call to "${p.name}" was rejected: the caller is not authorized.`,
|
|
57
57
|
fix: "Complete the auth handshake (or connect with a static/pre-shared token) before calling a trusted method. Untrusted callers may only call `anonymous:`-prefixed methods — see `isAnonymousRpcMethod`."
|
|
58
|
+
},
|
|
59
|
+
DF0037: {
|
|
60
|
+
why: (p) => `A service is already provided under "${p.id}".`,
|
|
61
|
+
fix: "Service ids are unique per context. Revoke the existing provider first (the `provide()` call returns a revoke function), or namespace the id with your plugin id to avoid collisions."
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
});
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as DevframeRpcSharedStates, A as DevframeSettingsStore, At as EventsMap, B as DevframeDiagnosticsDefinition, C as DevframeServicesHost, Ct as AgentResourceInput, D as DevframeScopedStreamingHost, Dt as DevframeAgentHostEvents, E as DevframeScopedNodeRpc, Et as DevframeAgentHost, F as SettingsForNamespace, G as RpcFunctionsHost, H as DevframeDiagnosticsLogger, I as DevframeViewHost, J as RpcStreamingChannel, K as RpcSharedStateGetOptions, L as DevframeHost, M as ScopedClientFunctions, N as ScopedServerFunctions, O as DevframeSettings, Ot as EventEmitter, P as ScopedSharedStates, Q as DevframeRpcServerFunctions, R as DevframeStorageScope, S as DevframeServiceOf, St as AgentResourceContent, T as DevframeScopedNodeContext, Tt as AgentToolInput, U as DevframeNodeRpcSession, V as DevframeDiagnosticsHost, W as RpcBroadcastOptions, X as RpcStreamingHost, Y as RpcStreamingChannelOptions, Z as DevframeRpcClientFunctions, _ as ConnectionMeta, a as DevframeDockDefaults, b as DevframeNodeContext, bt as AgentManifest, c as DevframeSetupInfo, d as McpRouteOptions, f as defineDevframe, g as Thenable, h as PartialWithoutId, i as DevframeDeploymentKind, j as ScopedBroadcastOptions, k as DevframeSettingsRegistry, kt as EventUnsubscribe, l as DevframeSpaOptions, m as EntriesToObject, n as DevframeCliOptions, o as DevframeDuplicationStrategy, q as RpcSharedStateHost, r as DevframeDefinition, s as DevframeRuntime, t as DevframeBrowserContext, u as DevframeWsOptions, v as ConnectionMetaWebsocket, w as DevframeServicesRegistry, wt as AgentTool, x as DevframeServiceId, xt as AgentResource, y as DevframeCapabilities, yt as AgentHandle, z as DevframeDefineDiagnosticsOptions } from "../devframe-WHtcqYlZ.mjs";
|
|
2
2
|
import { g as RpcFunctionAgentOptions } from "../types-CrzNxXKq.mjs";
|
|
3
|
-
import { t as DevframeNodeRpcSessionMeta } from "../ws-server-
|
|
4
|
-
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ConnectionMeta, ConnectionMetaWebsocket, DevframeAgentHost, DevframeAgentHostEvents, DevframeBrowserContext, DevframeCapabilities, DevframeCliOptions, DevframeDefineDiagnosticsOptions, DevframeDefinition, DevframeDeploymentKind, DevframeDiagnosticsDefinition, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeDockDefaults, DevframeDuplicationStrategy, DevframeHost, DevframeNodeContext, DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, DevframeRpcClientFunctions, DevframeRpcServerFunctions, DevframeRpcSharedStates, DevframeRuntime, DevframeScopedNodeContext, DevframeScopedNodeRpc, DevframeScopedStreamingHost, DevframeSettings, DevframeSettingsRegistry, DevframeSettingsStore, DevframeSetupInfo, DevframeSpaOptions, DevframeViewHost, DevframeWsOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, McpRouteOptions, PartialWithoutId, RpcBroadcastOptions, type RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, ScopedBroadcastOptions, ScopedClientFunctions, ScopedServerFunctions, ScopedSharedStates, SettingsForNamespace, Thenable, defineDevframe };
|
|
3
|
+
import { t as DevframeNodeRpcSessionMeta } from "../ws-server-9-wn7MNQ.mjs";
|
|
4
|
+
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ConnectionMeta, ConnectionMetaWebsocket, DevframeAgentHost, DevframeAgentHostEvents, DevframeBrowserContext, DevframeCapabilities, DevframeCliOptions, DevframeDefineDiagnosticsOptions, DevframeDefinition, DevframeDeploymentKind, DevframeDiagnosticsDefinition, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeDockDefaults, DevframeDuplicationStrategy, DevframeHost, DevframeNodeContext, DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, DevframeRpcClientFunctions, DevframeRpcServerFunctions, DevframeRpcSharedStates, DevframeRuntime, DevframeScopedNodeContext, DevframeScopedNodeRpc, DevframeScopedStreamingHost, DevframeServiceId, DevframeServiceOf, DevframeServicesHost, DevframeServicesRegistry, DevframeSettings, DevframeSettingsRegistry, DevframeSettingsStore, DevframeSetupInfo, DevframeSpaOptions, DevframeStorageScope, DevframeViewHost, DevframeWsOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, McpRouteOptions, PartialWithoutId, RpcBroadcastOptions, type RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, ScopedBroadcastOptions, ScopedClientFunctions, ScopedServerFunctions, ScopedSharedStates, SettingsForNamespace, Thenable, defineDevframe };
|
package/dist/utils/events.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _t as SharedStatePatch, dt as ImmutableMap, ft as ImmutableObject, gt as SharedStateOptions, ht as SharedStateEvents, lt as Immutable, mt as SharedState, pt as ImmutableSet, ut as ImmutableArray, vt as createSharedState } from "../devframe-WHtcqYlZ.mjs";
|
|
2
2
|
export { Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableSet, SharedState, SharedStateEvents, SharedStateOptions, SharedStatePatch, createSharedState };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { at as StreamSink, ct as createStreamSink, et as BufferedChunk, it as StreamReader, nt as CreateStreamSinkOptions, ot as StreamSinkEvents, rt as StreamErrorPayload, st as createStreamReader, tt as CreateStreamReaderOptions } from "../devframe-WHtcqYlZ.mjs";
|
|
2
2
|
export { BufferedChunk, CreateStreamReaderOptions, CreateStreamSinkOptions, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, createStreamReader, createStreamSink };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { v as RpcFunctionDefinitionAny } from "./types-CrzNxXKq.mjs";
|
|
2
|
-
import { BirpcGroup, ChannelOptions } from "birpc";
|
|
3
2
|
import { Peer } from "crossws";
|
|
3
|
+
import { BirpcGroup, ChannelOptions } from "birpc";
|
|
4
4
|
import { NodeAdapter } from "crossws/adapters/node";
|
|
5
5
|
import { Server } from "node:http";
|
|
6
6
|
import { Server as Server$1, ServerOptions } from "node:https";
|