devframe 0.1.21 → 0.1.22

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 (89) hide show
  1. package/README.md +41 -18
  2. package/dist/{_shared-iZy45oG3.mjs → _shared-DcJX9-Az.mjs} +2 -2
  3. package/dist/adapters/build.d.mts +5 -5
  4. package/dist/adapters/build.mjs +13 -12
  5. package/dist/adapters/cli.d.mts +2 -2
  6. package/dist/adapters/cli.mjs +5 -5
  7. package/dist/adapters/dev.d.mts +18 -9
  8. package/dist/adapters/dev.mjs +1 -1
  9. package/dist/adapters/embedded.d.mts +5 -5
  10. package/dist/adapters/embedded.mjs +2 -2
  11. package/dist/adapters/mcp.d.mts +3 -3
  12. package/dist/adapters/mcp.mjs +5 -5
  13. package/dist/adapters/vite.d.mts +45 -12
  14. package/dist/adapters/vite.mjs +81 -18
  15. package/dist/chunk-e9Ob2GDo.mjs +26 -0
  16. package/dist/client/index.d.mts +10 -5
  17. package/dist/client/index.mjs +19 -10
  18. package/dist/colors-Bl4W18Mh.mjs +123 -0
  19. package/dist/{context-internal-saIAfNVw.d.mts → context-DBd794Rn.d.mts} +2 -2
  20. package/dist/{context-BJ4r2SmR.mjs → context-DUibxhrR.mjs} +14 -31
  21. package/dist/{dev-CdAy400a.mjs → dev-BGpTpYiR.mjs} +19 -20
  22. package/dist/{devtool-CNvLs2_Y.d.mts → devframe-DulcIxwu.d.mts} +49 -58
  23. package/dist/{diagnostics-DxPnRoXO.mjs → diagnostics-BFhNNmST.mjs} +7 -2
  24. package/dist/hash-BHZbo80D.mjs +126 -0
  25. package/dist/{human-id-BLoGo_e5.mjs → human-id-adtUWQLr.mjs} +12 -3
  26. package/dist/{index-CuLRIMto.d.mts → index-DB2Ie0Or.d.mts} +2 -3
  27. package/dist/index.d.mts +4 -5
  28. package/dist/index.mjs +2 -5
  29. package/dist/launch-editor-KA_21J1T.mjs +581 -0
  30. package/dist/node/auth.d.mts +44 -0
  31. package/dist/node/auth.mjs +55 -0
  32. package/dist/node/index.d.mts +10 -51
  33. package/dist/node/index.mjs +6 -62
  34. package/dist/{internal/index.d.mts → node/internal.d.mts} +5 -5
  35. package/dist/node/internal.mjs +50 -0
  36. package/dist/{open-Dede_w9r.mjs → open-DmFp0qZA.mjs} +12 -3
  37. package/dist/recipes/open-helpers.d.mts +4 -9
  38. package/dist/recipes/open-helpers.mjs +7 -12
  39. package/dist/revoke-DIMz1r7-.mjs +35 -0
  40. package/dist/rpc/index.d.mts +3 -3
  41. package/dist/rpc/index.mjs +4 -4
  42. package/dist/rpc/transports/ws-client.d.mts +1 -1
  43. package/dist/rpc/transports/ws-client.mjs +2 -1
  44. package/dist/rpc/transports/ws-server.d.mts +1 -1
  45. package/dist/rpc/transports/ws-server.mjs +2 -1
  46. package/dist/{rpc-INbWfHoX.mjs → rpc-CkZuoz-m.mjs} +3 -2
  47. package/dist/{serialization-DwKi05Pn.mjs → serialization-CwO31axa.mjs} +1 -2
  48. package/dist/{server-CBsxXIH5.mjs → server-ma8-ZVyX.mjs} +1 -1
  49. package/dist/{server-BAqOajx_.d.mts → server-zKEDxgqD.d.mts} +4 -3
  50. package/dist/shared-state-DCDs0e7y.mjs +928 -0
  51. package/dist/{static-dump-D5VH8Iqk.mjs → static-dump-D7AvjrgL.mjs} +1 -1
  52. package/dist/{context-internal-Dx_NoSv1.mjs → storage-CNC38eU-.mjs} +4 -86
  53. package/dist/structured-clone-DcDc2Dds.mjs +221 -0
  54. package/dist/types/index.d.mts +4 -4
  55. package/dist/types/index.mjs +11 -2
  56. package/dist/utils/colors.d.mts +28 -0
  57. package/dist/utils/colors.mjs +2 -0
  58. package/dist/utils/events.d.mts +1 -1
  59. package/dist/utils/hash.d.mts +7 -0
  60. package/dist/utils/hash.mjs +2 -0
  61. package/dist/utils/human-id.d.mts +6 -8
  62. package/dist/utils/human-id.mjs +1 -2
  63. package/dist/utils/launch-editor.d.mts +13 -0
  64. package/dist/utils/launch-editor.mjs +2 -0
  65. package/dist/utils/open.d.mts +16 -0
  66. package/dist/utils/open.mjs +2 -0
  67. package/dist/utils/serve-static.d.mts +30 -0
  68. package/dist/utils/serve-static.mjs +152 -0
  69. package/dist/utils/shared-state.d.mts +1 -1
  70. package/dist/utils/shared-state.mjs +1 -35
  71. package/dist/utils/streaming-channel.d.mts +1 -1
  72. package/dist/utils/structured-clone.d.mts +21 -0
  73. package/dist/utils/structured-clone.mjs +2 -0
  74. package/dist/utils/when.d.mts +32 -49
  75. package/dist/utils/when.mjs +20 -2
  76. package/dist/{ws-client-CjPuPFbA.d.mts → ws-client-Bavoya6-.d.mts} +1 -1
  77. package/dist/{ws-server-C7LnhOHi.d.mts → ws-server-DjvlwLuM.d.mts} +1 -1
  78. package/package.json +23 -10
  79. package/skills/devframe/SKILL.md +45 -23
  80. package/skills/devframe/templates/{counter-devtool.ts → counter-devframe.ts} +4 -4
  81. package/skills/devframe/templates/{spa-devtool.ts → spa-devframe.ts} +3 -3
  82. package/skills/devframe/templates/vite-client.ts +2 -2
  83. package/dist/internal/index.mjs +0 -3
  84. package/dist/utils/state.d.mts +0 -50
  85. package/dist/utils/state.mjs +0 -26
  86. package/dist/{define-Bb4zh-Dc.mjs → define-CW9gLnyG.mjs} +0 -0
  87. package/dist/{host-h3-9jeHcltx.mjs → host-h3-Dz8YnFgu.mjs} +1 -1
  88. /package/dist/{transports-DSV5_5QM.mjs → transports-BnCs4rj9.mjs} +0 -0
  89. /package/dist/{types-C5OVe4AC.d.mts → types-4rdUEi2R.d.mts} +0 -0
@@ -1,53 +1,12 @@
1
- import { $ as AgentHandle, P as SharedState, Q as DevToolsDiagnosticsLogger, U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, Y as DevToolsHost, Z as DevToolsDiagnosticsHost$1, at as AgentToolInput, ct as EventEmitter, d as DevToolsNodeContext, et as AgentManifest, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, it as AgentTool, m as RpcFunctionsHost$1, nt as AgentResourceContent, ot as DevToolsAgentHost$1, p as RpcBroadcastOptions, rt as AgentResourceInput, st as DevToolsAgentHostEvents, tt as AgentResource, y as RpcStreamingHost, z as DevToolsViewHost$1 } from "../devtool-CNvLs2_Y.mjs";
2
- import { g as RpcFunctionsCollectorBase } from "../index-CuLRIMto.mjs";
3
- import { g as RpcFunctionDefinitionAny } from "../types-C5OVe4AC.mjs";
4
- import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-C7LnhOHi.mjs";
5
- import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-BAqOajx_.mjs";
6
- import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevToolsInternalContext } from "../context-internal-saIAfNVw.mjs";
1
+ import { D as RpcStreamingHost, H as SharedState, Q as DevToolsRpcServerFunctions, S as RpcFunctionsHost$1, Z as DevToolsRpcClientFunctions, at as AgentManifest, b as DevToolsNodeRpcSession, ct as AgentResourceInput, dt as DevToolsAgentHost$1, et as DevToolsHost, ft as DevToolsAgentHostEvents, it as AgentHandle, lt as AgentTool, nt as DevToolsDiagnosticsHost$1, ot as AgentResource, pt as EventEmitter, q as DevToolsViewHost$1, rt as DevToolsDiagnosticsLogger, st as AgentResourceContent, ut as AgentToolInput, w as RpcSharedStateHost, x as RpcBroadcastOptions, y as DevToolsNodeContext } from "../devframe-DulcIxwu.mjs";
2
+ import { f as RpcFunctionsCollectorBase } from "../index-DB2Ie0Or.mjs";
3
+ import { g as RpcFunctionDefinitionAny } from "../types-4rdUEi2R.mjs";
4
+ import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-DjvlwLuM.mjs";
5
+ import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-zKEDxgqD.mjs";
7
6
  import { createLogger, defineDiagnostics } from "logs-sdk";
8
7
  import { BirpcGroup } from "birpc";
9
8
  import { AsyncLocalStorage } from "node:async_hooks";
10
9
 
11
- //#region src/node/auth-revoke.d.ts
12
- /**
13
- * Flip `isTrusted` to false on any live WS clients connected with `token`
14
- * and broadcast the `auth:revoked` event so they can react.
15
- *
16
- * Shared between persisted-auth revocation and remote-dock token revocation.
17
- */
18
- declare function revokeActiveConnectionsForToken(context: DevToolsNodeContext, token: string): Promise<void>;
19
- /**
20
- * Revoke an auth token: remove from storage and notify all connected clients
21
- * using this token that they are no longer trusted.
22
- */
23
- declare function revokeAuthToken(context: DevToolsNodeContext, storage: SharedState<InternalAnonymousAuthStorage>, token: string): Promise<void>;
24
- //#endregion
25
- //#region src/node/auth-state.d.ts
26
- interface PendingAuthRequest {
27
- clientAuthToken: string;
28
- session: DevToolsNodeRpcSession;
29
- ua: string;
30
- origin: string;
31
- resolve: (result: {
32
- isTrusted: boolean;
33
- }) => void;
34
- abortController: AbortController;
35
- timeout: ReturnType<typeof setTimeout>;
36
- }
37
- declare function getTempAuthToken(): string;
38
- declare function refreshTempAuthToken(): string;
39
- declare function getPendingAuth(): PendingAuthRequest | null;
40
- declare function setPendingAuth(request: PendingAuthRequest | null): void;
41
- /**
42
- * Abort and clean up any existing pending auth request.
43
- */
44
- declare function abortPendingAuth(): void;
45
- /**
46
- * Consume the temp auth ID: verify it matches, trust the pending client, and clean up.
47
- * Returns the client's authToken if successful, null otherwise.
48
- */
49
- declare function consumeTempAuthToken(id: string, storage: SharedState<InternalAnonymousAuthStorage>): string | null;
50
- //#endregion
51
10
  //#region src/node/context.d.ts
52
11
  interface CreateHostContextOptions {
53
12
  cwd: string;
@@ -64,10 +23,10 @@ interface CreateHostContextOptions {
64
23
  /**
65
24
  * Framework-neutral core of the DevTools node context. Wires the RPC
66
25
  * host, view (HTTP file-serving) host, diagnostics, and agent
67
- * subsystems plus the JSON-render factory. Hub-level subsystems
68
- * (`docks`, `terminals`, `messages`, `commands`) are owned by
26
+ * subsystems. Hub-level subsystems (`docks`, `terminals`, `messages`,
27
+ * `commands`, `createJsonRenderer`) are owned by
69
28
  * `@vitejs/devtools-kit` — its `createKitContext` wraps this and
70
- * attaches them when the devtool is mounted into a multi-integration
29
+ * attaches them when the devframe is mounted into a multi-integration
71
30
  * hub.
72
31
  */
73
32
  declare function createHostContext(options: CreateHostContextOptions): Promise<DevToolsNodeContext>;
@@ -75,7 +34,7 @@ declare function createHostContext(options: CreateHostContextOptions): Promise<D
75
34
  //#region src/node/host-agent.d.ts
76
35
  /**
77
36
  * Framework-neutral host aggregating the agent-exposed surface of a
78
- * devtool. Auto-discovers RPC functions with an `agent` field from
37
+ * devframe. Auto-discovers RPC functions with an `agent` field from
79
38
  * `ctx.rpc.definitions`, and accepts plugin-registered tools /
80
39
  * resources via `registerTool` / `registerResource`.
81
40
  *
@@ -246,4 +205,4 @@ declare function createStorage<T extends object>(options: CreateStorageOptions<T
246
205
  declare function isObject(value: unknown): value is Record<string, any>;
247
206
  declare function normalizeHttpServerUrl(host: string, port: number | string): string;
248
207
  //#endregion
249
- export { CreateH3DevToolsHostOptions, CreateHostContextOptions, CreateStorageOptions, DevToolsAgentHost, DevToolsDiagnosticsHost, DevToolsInternalContext, DevToolsViewHost, InternalAnonymousAuthStorage, PendingAuthRequest, RemoteTokenRecord, RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, StaticRpcDumpCollection, StaticRpcDumpFile, StaticRpcDumpManifest, StaticRpcDumpManifestQueryEntry, StaticRpcDumpManifestStaticEntry, StaticRpcDumpManifestValue, StaticRpcDumpSerialization, abortPendingAuth, collectStaticRpcDump, consumeTempAuthToken, createH3DevToolsHost, createHostContext, createRpcSharedStateServerHost, createRpcStreamingServerHost, createStorage, getInternalContext, getPendingAuth, getTempAuthToken, internalContextMap, isObject, normalizeHttpServerUrl, refreshTempAuthToken, revokeActiveConnectionsForToken, revokeAuthToken, setPendingAuth, startHttpAndWs };
208
+ export { CreateH3DevToolsHostOptions, CreateHostContextOptions, CreateStorageOptions, DevToolsAgentHost, DevToolsDiagnosticsHost, DevToolsViewHost, RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, StaticRpcDumpCollection, StaticRpcDumpFile, StaticRpcDumpManifest, StaticRpcDumpManifestQueryEntry, StaticRpcDumpManifestStaticEntry, StaticRpcDumpManifestValue, StaticRpcDumpSerialization, collectStaticRpcDump, createH3DevToolsHost, createHostContext, createRpcSharedStateServerHost, createRpcStreamingServerHost, createStorage, isObject, normalizeHttpServerUrl, startHttpAndWs };
@@ -1,65 +1,9 @@
1
- import { t as import_dist } from "../human-id-BLoGo_e5.mjs";
2
- import { a as revokeAuthToken, i as revokeActiveConnectionsForToken, n as internalContextMap, r as createStorage, t as getInternalContext } from "../context-internal-Dx_NoSv1.mjs";
3
- import { a as createRpcSharedStateServerHost, i as createRpcStreamingServerHost, n as DevToolsViewHost, o as DevToolsDiagnosticsHost, r as RpcFunctionsHost, s as DevToolsAgentHost, t as createHostContext } from "../context-BJ4r2SmR.mjs";
4
- import { t as createH3DevToolsHost } from "../host-h3-9jeHcltx.mjs";
5
- import { t as startHttpAndWs } from "../server-CBsxXIH5.mjs";
6
- import { t as collectStaticRpcDump } from "../static-dump-D5VH8Iqk.mjs";
1
+ import { a as createRpcSharedStateServerHost, i as createRpcStreamingServerHost, n as DevToolsViewHost, o as DevToolsDiagnosticsHost, r as RpcFunctionsHost, s as DevToolsAgentHost, t as createHostContext } from "../context-DUibxhrR.mjs";
2
+ import { t as createH3DevToolsHost } from "../host-h3-Dz8YnFgu.mjs";
3
+ import { t as startHttpAndWs } from "../server-ma8-ZVyX.mjs";
4
+ import { t as collectStaticRpcDump } from "../static-dump-D7AvjrgL.mjs";
5
+ import { t as createStorage } from "../storage-CNC38eU-.mjs";
7
6
  import { isIP } from "node:net";
8
- //#region src/node/auth-state.ts
9
- let pendingAuth = null;
10
- let tempAuthToken = generateTempId();
11
- function generateTempId() {
12
- return (0, import_dist.humanId)({
13
- separator: "-",
14
- capitalize: false
15
- });
16
- }
17
- function getTempAuthToken() {
18
- return tempAuthToken;
19
- }
20
- function refreshTempAuthToken() {
21
- tempAuthToken = generateTempId();
22
- return tempAuthToken;
23
- }
24
- function getPendingAuth() {
25
- return pendingAuth;
26
- }
27
- function setPendingAuth(request) {
28
- pendingAuth = request;
29
- }
30
- /**
31
- * Abort and clean up any existing pending auth request.
32
- */
33
- function abortPendingAuth() {
34
- if (pendingAuth) {
35
- pendingAuth.abortController.abort();
36
- clearTimeout(pendingAuth.timeout);
37
- pendingAuth = null;
38
- }
39
- }
40
- /**
41
- * Consume the temp auth ID: verify it matches, trust the pending client, and clean up.
42
- * Returns the client's authToken if successful, null otherwise.
43
- */
44
- function consumeTempAuthToken(id, storage) {
45
- if (id !== tempAuthToken || !pendingAuth) return null;
46
- const { clientAuthToken, session, ua, origin, resolve } = pendingAuth;
47
- storage.mutate((state) => {
48
- state.trusted[clientAuthToken] = {
49
- authToken: clientAuthToken,
50
- ua,
51
- origin,
52
- timestamp: Date.now()
53
- };
54
- });
55
- session.meta.clientAuthToken = clientAuthToken;
56
- session.meta.isTrusted = true;
57
- resolve({ isTrusted: true });
58
- abortPendingAuth();
59
- refreshTempAuthToken();
60
- return clientAuthToken;
61
- }
62
- //#endregion
63
7
  //#region src/node/utils.ts
64
8
  function isObject(value) {
65
9
  return Object.prototype.toString.call(value) === "[object Object]";
@@ -68,4 +12,4 @@ function normalizeHttpServerUrl(host, port) {
68
12
  return `http://${host === "127.0.0.1" ? "localhost" : isIP(host) === 6 ? `[${host}]` : host}:${port}`;
69
13
  }
70
14
  //#endregion
71
- export { DevToolsAgentHost, DevToolsDiagnosticsHost, DevToolsViewHost, RpcFunctionsHost, abortPendingAuth, collectStaticRpcDump, consumeTempAuthToken, createH3DevToolsHost, createHostContext, createRpcSharedStateServerHost, createRpcStreamingServerHost, createStorage, getInternalContext, getPendingAuth, getTempAuthToken, internalContextMap, isObject, normalizeHttpServerUrl, refreshTempAuthToken, revokeActiveConnectionsForToken, revokeAuthToken, setPendingAuth, startHttpAndWs };
15
+ export { DevToolsAgentHost, DevToolsDiagnosticsHost, DevToolsViewHost, RpcFunctionsHost, collectStaticRpcDump, createH3DevToolsHost, createHostContext, createRpcSharedStateServerHost, createRpcStreamingServerHost, createStorage, isObject, normalizeHttpServerUrl, startHttpAndWs };
@@ -1,16 +1,16 @@
1
- import { i as DevtoolDeploymentKind, r as DevtoolDefinition } from "../devtool-CNvLs2_Y.mjs";
2
- import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevToolsInternalContext } from "../context-internal-saIAfNVw.mjs";
1
+ import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-DulcIxwu.mjs";
2
+ import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevToolsInternalContext } from "../context-DBd794Rn.mjs";
3
3
 
4
4
  //#region src/adapters/_shared.d.ts
5
5
  /**
6
- * Resolve the mount base path for a devtool's SPA. Hosted adapters
6
+ * Resolve the mount base path for a devframe's SPA. Hosted adapters
7
7
  * (`vite`, `kit`, `embedded`) default to `/__<id>/` so they don't
8
8
  * collide with the host app; standalone adapters (`cli`, `spa`,
9
9
  * `build`) default to `/` because they own the origin.
10
10
  *
11
- * The devtool author can override with `basePath` on the definition.
11
+ * The devframe author can override with `basePath` on the definition.
12
12
  */
13
- declare function resolveBasePath(def: DevtoolDefinition, kind: DevtoolDeploymentKind): string;
13
+ declare function resolveBasePath(def: DevframeDefinition, kind: DevframeDeploymentKind): string;
14
14
  declare function normalizeBasePath(base: string): string;
15
15
  //#endregion
16
16
  export { type DevToolsInternalContext, type InternalAnonymousAuthStorage, type RemoteTokenRecord, getInternalContext, internalContextMap, normalizeBasePath, resolveBasePath };
@@ -0,0 +1,50 @@
1
+ import { t as createStorage } from "../storage-CNC38eU-.mjs";
2
+ import { n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "../revoke-DIMz1r7-.mjs";
3
+ import { t as humanId } from "../human-id-adtUWQLr.mjs";
4
+ import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-DcJX9-Az.mjs";
5
+ import { join } from "pathe";
6
+ //#region src/node/internal/context.ts
7
+ const internalContextMap = /* @__PURE__ */ new WeakMap();
8
+ function getInternalContext(context) {
9
+ if (!internalContextMap.has(context)) {
10
+ const storage = createStorage({
11
+ filepath: join(context.host.getStorageDir("global"), "auth.json"),
12
+ initialValue: { trusted: {} }
13
+ });
14
+ const remoteTokens = /* @__PURE__ */ new Map();
15
+ function revokeRemoteToken(token) {
16
+ if (!remoteTokens.delete(token)) return;
17
+ revokeActiveConnectionsForToken(context, token);
18
+ }
19
+ const internalContext = {
20
+ storage: { auth: storage },
21
+ revokeAuthToken: (token) => revokeAuthToken(context, storage, token),
22
+ remoteTokens,
23
+ allocateRemoteToken(dockId, origin, originLock) {
24
+ const token = humanId();
25
+ remoteTokens.set(token, {
26
+ dockId,
27
+ origin,
28
+ originLock
29
+ });
30
+ return token;
31
+ },
32
+ revokeRemoteToken,
33
+ revokeRemoteTokensForDock(dockId) {
34
+ const tokensToRevoke = [];
35
+ for (const [token, record] of remoteTokens) if (record.dockId === dockId) tokensToRevoke.push(token);
36
+ for (const token of tokensToRevoke) revokeRemoteToken(token);
37
+ },
38
+ isRemoteTokenTrusted(token, requestOrigin) {
39
+ const record = remoteTokens.get(token);
40
+ if (!record) return false;
41
+ if (!record.originLock) return true;
42
+ return !!requestOrigin && record.origin === requestOrigin;
43
+ }
44
+ };
45
+ internalContextMap.set(context, internalContext);
46
+ }
47
+ return internalContextMap.get(context);
48
+ }
49
+ //#endregion
50
+ export { getInternalContext, internalContextMap, normalizeBasePath, resolveBasePath };
@@ -2,10 +2,10 @@ import { promisify } from "node:util";
2
2
  import fs from "node:fs";
3
3
  import os from "node:os";
4
4
  import process from "node:process";
5
- import fs$1, { constants } from "node:fs/promises";
6
5
  import path from "node:path";
7
6
  import { fileURLToPath } from "node:url";
8
7
  import childProcess, { execFile } from "node:child_process";
8
+ import fs$1, { constants } from "node:fs/promises";
9
9
  import { Buffer } from "node:buffer";
10
10
  //#region ../../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
11
11
  let isDockerCached;
@@ -475,7 +475,7 @@ const baseOpen = async (options) => {
475
475
  });
476
476
  });
477
477
  };
478
- const open = (target, options) => {
478
+ const open$1 = (target, options) => {
479
479
  if (typeof target !== "string") throw new TypeError("Expected a `target`");
480
480
  return baseOpen({
481
481
  ...options,
@@ -530,4 +530,13 @@ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
530
530
  }, { wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe" }));
531
531
  defineLazyProperty(apps, "safari", () => detectPlatformBinary({ darwin: "Safari" }));
532
532
  //#endregion
533
- export { open as default };
533
+ //#region src/utils/open.ts
534
+ /**
535
+ * Open a URL, file, or other target in its default OS handler
536
+ * (browser for URLs, Finder/Explorer for paths, etc.).
537
+ */
538
+ async function open(target, options) {
539
+ await open$1(target, options);
540
+ }
541
+ //#endregion
542
+ export { open as t };
@@ -1,17 +1,16 @@
1
- import { b as RpcFunctionSetupResult, m as RpcFunctionAgentOptions, s as RpcDump, w as Thenable } from "../types-C5OVe4AC.mjs";
1
+ import { b as RpcFunctionSetupResult, m as RpcFunctionAgentOptions, s as RpcDump, w as Thenable } from "../types-4rdUEi2R.mjs";
2
2
  import * as v from "valibot";
3
3
 
4
4
  //#region src/recipes/open-helpers.d.ts
5
5
  /**
6
- * Prebuilt RPC action that opens a file in the user's configured editor
7
- * via [`launch-editor`](https://www.npmjs.com/package/launch-editor).
6
+ * Prebuilt RPC action that opens a file in the user's configured editor.
8
7
  *
9
8
  * Registered name: `devframe:open-in-editor`.
10
9
  *
11
10
  * ```ts
12
11
  * import { openInEditor } from 'devframe/recipes/open-helpers'
13
12
  *
14
- * defineDevtool({
13
+ * defineDevframe({
15
14
  * id: 'my-tool',
16
15
  * name: 'My Tool',
17
16
  * setup(ctx) {
@@ -19,9 +18,6 @@ import * as v from "valibot";
19
18
  * },
20
19
  * })
21
20
  * ```
22
- *
23
- * Requires `launch-editor` to be installed by the consumer (declared as
24
- * an optional peer dependency on devframe).
25
21
  */
26
22
  declare const openInEditor: {
27
23
  name: "devframe:open-in-editor";
@@ -39,8 +35,7 @@ declare const openInEditor: {
39
35
  __promise?: Thenable<RpcFunctionSetupResult<[string], void>> | undefined;
40
36
  };
41
37
  /**
42
- * Prebuilt RPC action that reveals a path in the OS file explorer via
43
- * [`open`](https://www.npmjs.com/package/open).
38
+ * Prebuilt RPC action that reveals a path in the OS file explorer.
44
39
  *
45
40
  * Registered name: `devframe:open-in-finder`.
46
41
  *
@@ -1,16 +1,17 @@
1
- import { n as defineRpcFunction } from "../define-Bb4zh-Dc.mjs";
1
+ import { n as defineRpcFunction } from "../define-CW9gLnyG.mjs";
2
+ import { t as launchEditor } from "../launch-editor-KA_21J1T.mjs";
3
+ import { t as open } from "../open-DmFp0qZA.mjs";
2
4
  import * as v from "valibot";
3
5
  //#region src/recipes/open-helpers.ts
4
6
  /**
5
- * Prebuilt RPC action that opens a file in the user's configured editor
6
- * via [`launch-editor`](https://www.npmjs.com/package/launch-editor).
7
+ * Prebuilt RPC action that opens a file in the user's configured editor.
7
8
  *
8
9
  * Registered name: `devframe:open-in-editor`.
9
10
  *
10
11
  * ```ts
11
12
  * import { openInEditor } from 'devframe/recipes/open-helpers'
12
13
  *
13
- * defineDevtool({
14
+ * defineDevframe({
14
15
  * id: 'my-tool',
15
16
  * name: 'My Tool',
16
17
  * setup(ctx) {
@@ -18,9 +19,6 @@ import * as v from "valibot";
18
19
  * },
19
20
  * })
20
21
  * ```
21
- *
22
- * Requires `launch-editor` to be installed by the consumer (declared as
23
- * an optional peer dependency on devframe).
24
22
  */
25
23
  const openInEditor = defineRpcFunction({
26
24
  name: "devframe:open-in-editor",
@@ -29,13 +27,11 @@ const openInEditor = defineRpcFunction({
29
27
  args: [v.string()],
30
28
  returns: v.void(),
31
29
  async handler(filename) {
32
- const mod = await import("launch-editor");
33
- (mod.default ?? mod)(filename);
30
+ launchEditor(filename);
34
31
  }
35
32
  });
36
33
  /**
37
- * Prebuilt RPC action that reveals a path in the OS file explorer via
38
- * [`open`](https://www.npmjs.com/package/open).
34
+ * Prebuilt RPC action that reveals a path in the OS file explorer.
39
35
  *
40
36
  * Registered name: `devframe:open-in-finder`.
41
37
  *
@@ -52,7 +48,6 @@ const openInFinder = defineRpcFunction({
52
48
  args: [v.string()],
53
49
  returns: v.void(),
54
50
  async handler(path) {
55
- const { default: open } = await import("../open-Dede_w9r.mjs");
56
51
  await open(path);
57
52
  }
58
53
  });
@@ -0,0 +1,35 @@
1
+ //#region src/node/auth/revoke.ts
2
+ /**
3
+ * Flip `isTrusted` to false on any live WS clients connected with `token`
4
+ * and broadcast the `auth:revoked` event so they can react.
5
+ *
6
+ * Shared between persisted-auth revocation and remote-dock token revocation.
7
+ */
8
+ async function revokeActiveConnectionsForToken(context, token) {
9
+ const rpcHost = context.rpc;
10
+ if (!rpcHost?._rpcGroup) return;
11
+ const affectedSessionIds = /* @__PURE__ */ new Set();
12
+ for (const client of rpcHost._rpcGroup.clients) if (client.$meta.clientAuthToken === token) {
13
+ affectedSessionIds.add(client.$meta.id);
14
+ client.$meta.isTrusted = false;
15
+ client.$meta.clientAuthToken = void 0;
16
+ }
17
+ if (affectedSessionIds.size === 0) return;
18
+ await rpcHost.broadcast({
19
+ method: "devframe:auth:revoked",
20
+ args: [],
21
+ filter: (client) => affectedSessionIds.has(client.$meta.id)
22
+ });
23
+ }
24
+ /**
25
+ * Revoke an auth token: remove from storage and notify all connected clients
26
+ * using this token that they are no longer trusted.
27
+ */
28
+ async function revokeAuthToken(context, storage, token) {
29
+ storage.mutate((state) => {
30
+ delete state.trusted[token];
31
+ });
32
+ await revokeActiveConnectionsForToken(context, token);
33
+ }
34
+ //#endregion
35
+ export { revokeAuthToken as n, revokeActiveConnectionsForToken as t };
@@ -1,3 +1,3 @@
1
- import { _ as RpcCacheManager, a as structuredCloneDeserialize, c as structuredCloneStringify, d as createClientFromDump, f as dumpFunctions, g as RpcFunctionsCollectorBase, h as defineRpcFunction, i as strictJsonStringify, l as getRpcHandler, m as createDefineWrapperWithContext, n as validateDefinitions, o as structuredCloneParse, p as getDefinitionsWithDumps, r as STRUCTURED_CLONE_PREFIX, s as structuredCloneSerialize, t as validateDefinition, u as getRpcResolvedSetupResult, v as RpcCacheOptions } from "../index-CuLRIMto.mjs";
2
- import { C as RpcReturnSchema, S as RpcFunctionsCollector, _ as RpcFunctionDefinitionAnyWithContext, a as RpcDefinitionsFilter, b as RpcFunctionSetupResult, c as RpcDumpClientOptions, d as RpcDumpGetter, f as RpcDumpRecord, g as RpcFunctionDefinitionAny, h as RpcFunctionDefinition, i as RpcArgsSchema, l as RpcDumpCollectionOptions, m as RpcFunctionAgentOptions, n as BirpcReturn, o as RpcDefinitionsToFunctions, p as RpcDumpStore, r as EntriesToObject, s as RpcDump, t as BirpcFn, u as RpcDumpDefinition, v as RpcFunctionDefinitionBase, w as Thenable, x as RpcFunctionType, y as RpcFunctionDefinitionToFunction } from "../types-C5OVe4AC.mjs";
3
- export { BirpcFn, BirpcReturn, EntriesToObject, RpcArgsSchema, RpcCacheManager, RpcCacheOptions, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcDump, RpcDumpClientOptions, RpcDumpCollectionOptions, RpcDumpDefinition, RpcDumpGetter, RpcDumpRecord, RpcDumpStore, RpcFunctionAgentOptions, RpcFunctionDefinition, RpcFunctionDefinitionAny, RpcFunctionDefinitionAnyWithContext, RpcFunctionDefinitionBase, RpcFunctionDefinitionToFunction, RpcFunctionSetupResult, RpcFunctionType, RpcFunctionsCollector, RpcFunctionsCollectorBase, RpcReturnSchema, STRUCTURED_CLONE_PREFIX, Thenable, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, strictJsonStringify, structuredCloneDeserialize, structuredCloneParse, structuredCloneSerialize, structuredCloneStringify, validateDefinition, validateDefinitions };
1
+ import { a as getRpcHandler, c as dumpFunctions, d as defineRpcFunction, f as RpcFunctionsCollectorBase, i as strictJsonStringify, l as getDefinitionsWithDumps, m as RpcCacheOptions, n as validateDefinitions, o as getRpcResolvedSetupResult, p as RpcCacheManager, r as STRUCTURED_CLONE_PREFIX, s as createClientFromDump, t as validateDefinition, u as createDefineWrapperWithContext } from "../index-DB2Ie0Or.mjs";
2
+ import { C as RpcReturnSchema, S as RpcFunctionsCollector, _ as RpcFunctionDefinitionAnyWithContext, a as RpcDefinitionsFilter, b as RpcFunctionSetupResult, c as RpcDumpClientOptions, d as RpcDumpGetter, f as RpcDumpRecord, g as RpcFunctionDefinitionAny, h as RpcFunctionDefinition, i as RpcArgsSchema, l as RpcDumpCollectionOptions, m as RpcFunctionAgentOptions, n as BirpcReturn, o as RpcDefinitionsToFunctions, p as RpcDumpStore, r as EntriesToObject, s as RpcDump, t as BirpcFn, u as RpcDumpDefinition, v as RpcFunctionDefinitionBase, w as Thenable, x as RpcFunctionType, y as RpcFunctionDefinitionToFunction } from "../types-4rdUEi2R.mjs";
3
+ export { BirpcFn, BirpcReturn, EntriesToObject, RpcArgsSchema, RpcCacheManager, RpcCacheOptions, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcDump, RpcDumpClientOptions, RpcDumpCollectionOptions, RpcDumpDefinition, RpcDumpGetter, RpcDumpRecord, RpcDumpStore, RpcFunctionAgentOptions, RpcFunctionDefinition, RpcFunctionDefinitionAny, RpcFunctionDefinitionAnyWithContext, RpcFunctionDefinitionBase, RpcFunctionDefinitionToFunction, RpcFunctionSetupResult, RpcFunctionType, RpcFunctionsCollector, RpcFunctionsCollectorBase, RpcReturnSchema, STRUCTURED_CLONE_PREFIX, Thenable, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, strictJsonStringify, validateDefinition, validateDefinitions };
@@ -1,4 +1,4 @@
1
- import { a as validateDefinitions, c as getRpcResolvedSetupResult, i as validateDefinition, l as RpcCacheManager, n as dumpFunctions, o as RpcFunctionsCollectorBase, r as getDefinitionsWithDumps, s as getRpcHandler, t as createClientFromDump } from "../rpc-INbWfHoX.mjs";
2
- import { a as structuredCloneSerialize, i as structuredCloneParse, n as strictJsonStringify, o as structuredCloneStringify, r as structuredCloneDeserialize, t as STRUCTURED_CLONE_PREFIX } from "../serialization-DwKi05Pn.mjs";
3
- import { n as defineRpcFunction, t as createDefineWrapperWithContext } from "../define-Bb4zh-Dc.mjs";
4
- export { RpcCacheManager, RpcFunctionsCollectorBase, STRUCTURED_CLONE_PREFIX, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, strictJsonStringify, structuredCloneDeserialize, structuredCloneParse, structuredCloneSerialize, structuredCloneStringify, validateDefinition, validateDefinitions };
1
+ import { a as validateDefinitions, c as getRpcResolvedSetupResult, i as validateDefinition, l as RpcCacheManager, n as dumpFunctions, o as RpcFunctionsCollectorBase, r as getDefinitionsWithDumps, s as getRpcHandler, t as createClientFromDump } from "../rpc-CkZuoz-m.mjs";
2
+ import { n as strictJsonStringify, t as STRUCTURED_CLONE_PREFIX } from "../serialization-CwO31axa.mjs";
3
+ import { n as defineRpcFunction, t as createDefineWrapperWithContext } from "../define-CW9gLnyG.mjs";
4
+ export { RpcCacheManager, RpcFunctionsCollectorBase, STRUCTURED_CLONE_PREFIX, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, strictJsonStringify, validateDefinition, validateDefinitions };
@@ -1,2 +1,2 @@
1
- import { n as createWsRpcChannel, t as WsRpcChannelOptions } from "../../ws-client-CjPuPFbA.mjs";
1
+ import { n as createWsRpcChannel, t as WsRpcChannelOptions } from "../../ws-client-Bavoya6-.mjs";
2
2
  export { WsRpcChannelOptions, createWsRpcChannel };
@@ -1,4 +1,5 @@
1
- import { i as structuredCloneParse, n as strictJsonStringify, o as structuredCloneStringify } from "../../serialization-DwKi05Pn.mjs";
1
+ import { n as strictJsonStringify } from "../../serialization-CwO31axa.mjs";
2
+ import { i as structuredCloneStringify, n as structuredCloneParse } from "../../structured-clone-DcDc2Dds.mjs";
2
3
  //#region src/rpc/transports/ws-client.ts
3
4
  function NOOP() {}
4
5
  const EMPTY_DEFS = /* @__PURE__ */ new Map();
@@ -1,2 +1,2 @@
1
- import { n as WsRpcTransportOptions, r as attachWsRpcTransport, t as DevToolsNodeRpcSessionMeta } from "../../ws-server-C7LnhOHi.mjs";
1
+ import { n as WsRpcTransportOptions, r as attachWsRpcTransport, t as DevToolsNodeRpcSessionMeta } from "../../ws-server-DjvlwLuM.mjs";
2
2
  export { DevToolsNodeRpcSessionMeta, WsRpcTransportOptions, attachWsRpcTransport };
@@ -1,4 +1,5 @@
1
- import { i as structuredCloneParse, n as strictJsonStringify, o as structuredCloneStringify } from "../../serialization-DwKi05Pn.mjs";
1
+ import { n as strictJsonStringify } from "../../serialization-CwO31axa.mjs";
2
+ import { i as structuredCloneStringify, n as structuredCloneParse } from "../../structured-clone-DcDc2Dds.mjs";
2
3
  import { createServer } from "node:https";
3
4
  import { WebSocketServer } from "ws";
4
5
  //#region src/rpc/transports/ws-server.ts
@@ -1,5 +1,5 @@
1
- import { c as logger } from "./serialization-DwKi05Pn.mjs";
2
- import { hash } from "ohash";
1
+ import { t as hash } from "./hash-BHZbo80D.mjs";
2
+ import { i as logger } from "./serialization-CwO31axa.mjs";
3
3
  //#region src/rpc/cache.ts
4
4
  /**
5
5
  * @experimental API is expected to change.
@@ -56,6 +56,7 @@ async function getRpcHandler(definition, context) {
56
56
  //#endregion
57
57
  //#region src/rpc/collector.ts
58
58
  var RpcFunctionsCollectorBase = class {
59
+ context;
59
60
  definitions = /* @__PURE__ */ new Map();
60
61
  functions;
61
62
  _onChanged = [];
@@ -1,5 +1,4 @@
1
1
  import { consoleReporter, createLogger, defineDiagnostics, plainFormatter } from "logs-sdk";
2
- import { deserialize as structuredCloneDeserialize, parse as structuredCloneParse, serialize as structuredCloneSerialize, stringify as structuredCloneStringify } from "structured-clone-es";
3
2
  //#region src/rpc/diagnostics.ts
4
3
  const diagnostics = defineDiagnostics({
5
4
  docsBase: "https://devfra.me/errors",
@@ -109,4 +108,4 @@ function formatPath(parent, key) {
109
108
  return key;
110
109
  }
111
110
  //#endregion
112
- export { structuredCloneSerialize as a, logger as c, structuredCloneParse as i, strictJsonStringify as n, structuredCloneStringify as o, structuredCloneDeserialize as r, diagnostics as s, STRUCTURED_CLONE_PREFIX as t };
111
+ export { logger as i, strictJsonStringify as n, diagnostics as r, STRUCTURED_CLONE_PREFIX as t };
@@ -6,7 +6,7 @@ import { createServer } from "node:http";
6
6
  import { createApp, toNodeListener } from "h3";
7
7
  //#region src/node/server.ts
8
8
  /**
9
- * Compose an h3 + WebSocket server for a devtool context. The RPC
9
+ * Compose an h3 + WebSocket server for a devframe context. The RPC
10
10
  * group is bound to `context.rpc.functions`; the WS endpoint lives on
11
11
  * the same port as the HTTP server.
12
12
  */
@@ -1,4 +1,4 @@
1
- import { U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, d as DevToolsNodeContext } from "./devtool-CNvLs2_Y.mjs";
1
+ import { Q as DevToolsRpcServerFunctions, Z as DevToolsRpcClientFunctions, y as DevToolsNodeContext } from "./devframe-DulcIxwu.mjs";
2
2
  import { BirpcGroup } from "birpc";
3
3
  import { WebSocketServer } from "ws";
4
4
  import { App } from "h3";
@@ -10,7 +10,8 @@ interface StartHttpAndWsOptions {
10
10
  port: number;
11
11
  /**
12
12
  * Optional h3 app to mount on. When omitted a fresh one is created;
13
- * when provided, callers can add their own routes (sirv etc.) first.
13
+ * when provided, callers can add their own routes (static handlers,
14
+ * auth middleware, etc.) first.
14
15
  */
15
16
  app?: App;
16
17
  /**
@@ -45,7 +46,7 @@ interface StartedServer {
45
46
  close: () => Promise<void>;
46
47
  }
47
48
  /**
48
- * Compose an h3 + WebSocket server for a devtool context. The RPC
49
+ * Compose an h3 + WebSocket server for a devframe context. The RPC
49
50
  * group is bound to `context.rpc.functions`; the WS endpoint lives on
50
51
  * the same port as the HTTP server.
51
52
  */