devframe 0.9.11 → 0.9.13

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 (55) hide show
  1. package/dist/adapters/build.d.mts +4 -5
  2. package/dist/adapters/build.mjs +2 -2
  3. package/dist/adapters/cac.d.mts +4 -4
  4. package/dist/adapters/cac.mjs +1 -1
  5. package/dist/adapters/dev.d.mts +4 -4
  6. package/dist/adapters/dev.mjs +1 -1
  7. package/dist/adapters/embedded.d.mts +3 -4
  8. package/dist/adapters/initiate.d.mts +7 -8
  9. package/dist/adapters/initiate.mjs +1 -1
  10. package/dist/adapters/mcp.d.mts +4 -4
  11. package/dist/adapters/mcp.mjs +9 -15
  12. package/dist/cli/main.d.mts +2 -3
  13. package/dist/client/index.d.mts +133 -35
  14. package/dist/client/index.mjs +231 -57
  15. package/dist/constants.d.mts +20 -21
  16. package/dist/{context-Bq27SDK-.mjs → context-Cdj9z9m2.mjs} +39 -21
  17. package/dist/{dev-B32EVw5w.mjs → dev-SPZzBTrH.mjs} +2 -2
  18. package/dist/in-page-channel/index.d.mts +75 -37
  19. package/dist/in-page-channel/index.mjs +56 -22
  20. package/dist/index.d.mts +4 -4
  21. package/dist/{instance-shell-BWh0JQuo.d.mts → instance-shell-BUyYrKlu.d.mts} +9 -2
  22. package/dist/{instance-shell-DvYCwrDy.mjs → instance-shell-xuu6jg51.mjs} +7 -2
  23. package/dist/internal/index.d.mts +12 -12
  24. package/dist/internal/index.mjs +1 -1
  25. package/dist/node/index.d.mts +5 -5
  26. package/dist/node/index.mjs +1 -1
  27. package/dist/nostics-DD6gsDZA.mjs +108 -0
  28. package/dist/recipes/common-rpc-functions.d.mts +6 -7
  29. package/dist/recipes/interactive-auth.d.mts +36 -11
  30. package/dist/recipes/interactive-auth.mjs +47 -4
  31. package/dist/rpc/client.d.mts +2 -3
  32. package/dist/rpc/dump.d.mts +16 -17
  33. package/dist/rpc/dump.mjs +1 -1
  34. package/dist/rpc/server.d.mts +2 -3
  35. package/dist/rpc/transports/sse-server.d.mts +4 -5
  36. package/dist/rpc/transports/ws-bun.d.mts +5 -6
  37. package/dist/rpc/transports/ws-deno.d.mts +4 -5
  38. package/dist/{shared-state-CaxB1q0h.mjs → shared-state-eQVYHNqA.mjs} +4 -1
  39. package/dist/utils/agent-tool-name.d.mts +2 -3
  40. package/dist/utils/colors.d.mts +4 -5
  41. package/dist/utils/crypto-token.d.mts +4 -5
  42. package/dist/utils/events.d.mts +2 -3
  43. package/dist/utils/hash.d.mts +2 -3
  44. package/dist/utils/launch-editor.d.mts +2 -3
  45. package/dist/utils/nanoid.d.mts +2 -3
  46. package/dist/utils/open.d.mts +2 -3
  47. package/dist/utils/remote-assets.d.mts +2 -3
  48. package/dist/utils/serve-static.d.mts +6 -7
  49. package/dist/utils/shared-state.mjs +1 -1
  50. package/dist/utils/simple-schema.d.mts +17 -18
  51. package/dist/utils/streaming-channel.mjs +4 -1
  52. package/dist/utils/structured-clone.d.mts +5 -6
  53. package/dist/utils/when.d.mts +6 -7
  54. package/dist/{write-BuLCrn9h.mjs → write-D2AJqVT8.mjs} +1 -1
  55. package/package.json +4 -4
@@ -0,0 +1,108 @@
1
+ import { colors } from "./utils/colors.mjs";
2
+ import { defineDiagnostics } from "nostics";
3
+ import { ansiFormatter } from "nostics/formatters/ansi";
4
+ //#region src/events.ts
5
+ /**
6
+ * Centralized registry of the core devframe event names: the node-side host
7
+ * bus events, the client RPC connection events, and the server→client
8
+ * broadcast notifications, so these names live in one place instead of
9
+ * scattered string literals.
10
+ *
11
+ * **Keep this in sync with [`docs/content/8.references/3.events.md`](../../../docs/content/8.references/3.events.md)**
12
+ * (the "Core devframe events" section): every name here appears in that page's
13
+ * tables, and every name there resolves to an entry here. Add, rename, or
14
+ * remove a name in both places in the same change, and reference
15
+ * `DEVFRAME_EVENTS.*` from call sites instead of re-typing a literal.
16
+ *
17
+ * This map covers **notifications** (events, broadcasts). The request/response
18
+ * RPC endpoints of the shared-state, streaming, and auth-handshake protocols
19
+ * (`devframe:rpc:server-state:*`, `devframe:streaming:subscribe`,
20
+ * `anonymous:devframe:auth`, …) are defined at their handlers and typed in
21
+ * `types/rpc-augments.ts`; they aren't events and stay out of this map.
22
+ *
23
+ * The `EventEmitter` maps (`RpcClientEvents`, `DevframeAgentHostEvents`) and the
24
+ * `DevframeRpcClientFunctions` augmentation declare these names as type-level
25
+ * keys (a literal is unavoidable in a type position); those declarations mirror
26
+ * this map and move with it.
27
+ */
28
+ const DEVFRAME_EVENTS = {
29
+ /**
30
+ * Node-side host `EventEmitter` events. The agent host (`ctx.agent.events`)
31
+ * emits these as its tool/resource surface changes; protocol adapters (e.g.
32
+ * MCP) subscribe to re-publish their manifest.
33
+ */
34
+ bus: {
35
+ agentManifestChanged: "agent:manifest:changed",
36
+ agentToolRegistered: "agent:tool:registered",
37
+ agentToolUnregistered: "agent:tool:unregistered",
38
+ agentResourceRegistered: "agent:resource:registered",
39
+ agentResourceUnregistered: "agent:resource:unregistered"
40
+ },
41
+ /**
42
+ * Client-side RPC connection `EventEmitter` events (`rpc.events`) a UI
43
+ * subscribes to for connection lifecycle and error surfacing.
44
+ */
45
+ client: {
46
+ isTrustedUpdated: "rpc:is-trusted:updated",
47
+ error: "rpc:error",
48
+ connectionStatus: "connection:status",
49
+ connectionError: "connection:error"
50
+ },
51
+ /**
52
+ * Broadcast notifications the server pushes to clients (server → client),
53
+ * `devframe:` prefix. The paired request methods (subscribe/get/set/…) are
54
+ * RPC endpoints, not events, and are omitted deliberately.
55
+ */
56
+ broadcast: {
57
+ authRevoked: "devframe:auth:revoked",
58
+ clientStateUpdated: "devframe:rpc:client-state:updated",
59
+ clientStatePatch: "devframe:rpc:client-state:patch",
60
+ streamingChunk: "devframe:streaming:chunk",
61
+ streamingEnd: "devframe:streaming:end",
62
+ streamingUploadCancel: "devframe:streaming:upload-cancel"
63
+ },
64
+ /**
65
+ * In-page channel notifications the page script pushes to its panels
66
+ * (page script → panel), `devframe:` prefix. The paired request methods
67
+ * (`devframe:in-page:page-state:subscribe`/`set`/`patch`) are call
68
+ * endpoints, not events, and are defined at their handlers
69
+ * (`in-page-channel/state.ts`).
70
+ */
71
+ inPageChannel: {
72
+ panelStateUpdated: "devframe:in-page:panel-state:updated",
73
+ panelStatePatch: "devframe:in-page:panel-state:patch"
74
+ },
75
+ /** `postMessage` channels the runtime posts across window boundaries. */
76
+ postMessage: {
77
+ remoteAssetsError: "devframe:remote-assets-error",
78
+ inPageChannel: "devframe:in-page-channel"
79
+ }
80
+ };
81
+ //#endregion
82
+ //#region src/utils/nostics.ts
83
+ const formatAnsi = ansiFormatter(colors);
84
+ /**
85
+ * The reporter every {@link defineDiagnostics} call below wires in ahead of
86
+ * any caller-supplied ones: prints the diagnostic through devframe's own
87
+ * ANSI colors via `console[method]` (default `'warn'`).
88
+ */
89
+ function devframeReporter(d, { method = "warn" } = {}) {
90
+ console[method](formatAnsi(d));
91
+ }
92
+ /**
93
+ * Drop-in replacement for `nostics`'s `defineDiagnostics()` with devframe's
94
+ * ANSI console reporter pre-wired ahead of any `reporters` passed in. Every
95
+ * `diagnostics.ts` in devframe core, `@devframes/hub`, `@devframes/json-render`,
96
+ * and the built-in plugins defines its codes through this instead of
97
+ * `nostics`'s own `defineDiagnostics`; the reporter registration lives
98
+ * here, once, so none of them need to build their own reporter (`colors`,
99
+ * `ansiFormatter`) or take a direct dependency on `nostics` themselves.
100
+ */
101
+ function defineDiagnostics$1(options) {
102
+ return defineDiagnostics({
103
+ ...options,
104
+ reporters: [devframeReporter, ...options.reporters ?? []]
105
+ });
106
+ }
107
+ //#endregion
108
+ export { DEVFRAME_EVENTS as n, defineDiagnostics$1 as t };
@@ -10,9 +10,9 @@ import { SimpleSchema } from "../utils/simple-schema.mjs";
10
10
  * is restricted to this union, so the RPC surface can't be used to spawn an
11
11
  * arbitrary command.
12
12
  */
13
- type KnownEditor = 'atom' | 'subl' | 'sublime' | 'sublime_text' | 'wstorm' | 'charm' | 'zed' | 'notepad++' | 'vim' | 'mvim' | 'joe' | 'gvim' | 'emacs' | 'emacsclient' | 'rmate' | 'mate' | 'code' | 'code-insiders' | 'codium' | 'vscodium' | 'trae' | 'antigravity' | 'cursor' | 'appcode' | 'clion' | 'idea' | 'phpstorm' | 'pycharm' | 'rubymine' | 'webstorm' | 'goland' | 'rider';
13
+ export type KnownEditor = 'atom' | 'subl' | 'sublime' | 'sublime_text' | 'wstorm' | 'charm' | 'zed' | 'notepad++' | 'vim' | 'mvim' | 'joe' | 'gvim' | 'emacs' | 'emacsclient' | 'rmate' | 'mate' | 'code' | 'code-insiders' | 'codium' | 'vscodium' | 'trae' | 'antigravity' | 'cursor' | 'appcode' | 'clion' | 'idea' | 'phpstorm' | 'pycharm' | 'rubymine' | 'webstorm' | 'goland' | 'rider';
14
14
  /** Runtime list of every {@link KnownEditor}. */
15
- declare const KNOWN_EDITORS: KnownEditor[];
15
+ export declare const KNOWN_EDITORS: KnownEditor[];
16
16
  /**
17
17
  * Prebuilt RPC action that opens a file in the user's configured editor.
18
18
  *
@@ -38,7 +38,7 @@ declare const KNOWN_EDITORS: KnownEditor[];
38
38
  * host-level installation shared by every plugin and feature-detectable from
39
39
  * clients, with workspace-root path containment on top of the editor gating.
40
40
  */
41
- declare const openInEditor: {
41
+ export declare const openInEditor: {
42
42
  name: "devframe:open-in-editor";
43
43
  type?: "action" | undefined;
44
44
  cacheable?: boolean;
@@ -68,7 +68,7 @@ declare const openInEditor: {
68
68
  * host-level installation shared by every plugin and feature-detectable from
69
69
  * clients, with workspace-root path containment.
70
70
  */
71
- declare const openInFinder: {
71
+ export declare const openInFinder: {
72
72
  name: "devframe:open-in-finder";
73
73
  type?: "action" | undefined;
74
74
  cacheable?: boolean;
@@ -95,7 +95,7 @@ declare const openInFinder: {
95
95
  *
96
96
  * @deprecated Use the `@devframes/service-open` wire service instead.
97
97
  */
98
- declare const commonRpcFunctions: readonly [{
98
+ export declare const commonRpcFunctions: readonly [{
99
99
  name: "devframe:open-in-editor";
100
100
  type?: "action" | undefined;
101
101
  cacheable?: boolean;
@@ -124,5 +124,4 @@ declare const commonRpcFunctions: readonly [{
124
124
  __cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string], Thenable<void>>>> | undefined;
125
125
  __promise?: Thenable<RpcFunctionSetupResult<[string], Thenable<void>>> | undefined;
126
126
  }];
127
- //#endregion
128
- export { KNOWN_EDITORS, KnownEditor, commonRpcFunctions, openInEditor, openInFinder };
127
+ //#endregion
@@ -1,7 +1,8 @@
1
1
  import { Tt as DevframeAuthHandler, o as DevframeNodeContext, s as DevframeNodeRpcSession } from "../context-BBWPLDHh.mjs";
2
2
  import "../index-1ezCLThh.mjs";
3
+ import { ColorFn } from "../utils/colors.mjs";
3
4
  //#region src/recipes/interactive-auth.d.ts
4
- interface CreateInteractiveAuthOptions {
5
+ export interface CreateInteractiveAuthOptions {
5
6
  /**
6
7
  * Static, pre-shared bearer tokens that are always trusted, for CI runs
7
8
  * or shared machines where the interactive code prompt would only get in
@@ -12,14 +13,12 @@ interface CreateInteractiveAuthOptions {
12
13
  /**
13
14
  * Print the current code + magic-link URL. Devframe stays headless, so
14
15
  * there is no default banner printed automatically; call
15
- * `auth.printBanner()` yourself once the server is listening. Override
16
- * this to customize the format; defaults to a small boxed message on
17
- * stdout.
16
+ * `auth.printBanner()` yourself once the server is listening. Defaults to
17
+ * {@link createAuthBanner}'s output; pass its result here directly to
18
+ * rebrand the box (title / colors), or your own function to replace the
19
+ * format outright.
18
20
  */
19
- banner?: (info: {
20
- code: string;
21
- url: string;
22
- }) => void;
21
+ banner?: AuthBannerFunction;
23
22
  /**
24
23
  * Called once a code exchange succeeds, so a host rendering its own
25
24
  * banner can retract it. Fires after the rotated code is printed, so
@@ -37,6 +36,33 @@ interface CreateInteractiveAuthOptions {
37
36
  */
38
37
  serverUrl?: () => string;
39
38
  }
39
+ /** Signature of `options.banner`: render the current auth code + magic-link URL. */
40
+ export type AuthBannerFunction = (info: {
41
+ code: string;
42
+ url: string;
43
+ }) => void;
44
+ /** Palette for {@link createAuthBanner}'s box - one color per part, so a host can rebrand a subset. */
45
+ export interface CreateAuthBannerColorsOptions {
46
+ border: ColorFn;
47
+ title: ColorFn;
48
+ label: ColorFn;
49
+ code: ColorFn;
50
+ url: ColorFn;
51
+ }
52
+ export interface CreateAuthBannerOptions {
53
+ /** Box title. Defaults to `'Devframe'` - set to your product name for branding. */
54
+ title?: string;
55
+ /** Palette overrides; unset colors fall back to dim/bold/cyan defaults. */
56
+ colors?: Partial<CreateAuthBannerColorsOptions>;
57
+ }
58
+ /**
59
+ * Build a {@link AuthBannerFunction} that renders the auth code + magic-link
60
+ * URL as a small bordered box, its two rows label-aligned. `createInteractiveAuth`
61
+ * falls back to `createAuthBanner()` when no `banner` is given; call this
62
+ * yourself to rebrand the box (`title` / `colors`) and pass the result as
63
+ * `options.banner`.
64
+ */
65
+ export declare function createAuthBanner(options?: CreateAuthBannerOptions): AuthBannerFunction;
40
66
  /**
41
67
  * Package the interactive OTP auth protocol devframe's primitives
42
68
  * (`exchangeTempAuthCode`, `verifyAuthToken`, `revokeAuthToken`,
@@ -58,6 +84,5 @@ interface CreateInteractiveAuthOptions {
58
84
  * // the whole handler to `initDevframe` / `initHub` via their `auth` option.
59
85
  * ```
60
86
  */
61
- declare function createInteractiveAuth(context: DevframeNodeContext, options?: CreateInteractiveAuthOptions): DevframeAuthHandler;
62
- //#endregion
63
- export { CreateInteractiveAuthOptions, createInteractiveAuth };
87
+ export declare function createInteractiveAuth(context: DevframeNodeContext, options?: CreateInteractiveAuthOptions): DevframeAuthHandler;
88
+ //#endregion
@@ -5,8 +5,50 @@ import { a as verifyAuthToken, n as exchangeTempAuthCode, r as getTempAuthCode,
5
5
  import { t as getInternalContext } from "../context-jXO5vzjH.mjs";
6
6
  import { t as s } from "../simple-schema-Bi40l-P6.mjs";
7
7
  //#region src/recipes/interactive-auth.ts
8
- function defaultBanner(info) {
9
- console.log(`\n ${colors.dim("devframe auth code")} ${colors.bold(info.code)}\n ${colors.dim("or open")} ${colors.cyan(info.url)}\n`);
8
+ /**
9
+ * Build a {@link AuthBannerFunction} that renders the auth code + magic-link
10
+ * URL as a small bordered box, its two rows label-aligned. `createInteractiveAuth`
11
+ * falls back to `createAuthBanner()` when no `banner` is given; call this
12
+ * yourself to rebrand the box (`title` / `colors`) and pass the result as
13
+ * `options.banner`.
14
+ */
15
+ function createAuthBanner(options = {}) {
16
+ const title = options.title ?? "Devframe";
17
+ const palette = {
18
+ border: colors.dim,
19
+ title: colors.bold,
20
+ label: colors.dim,
21
+ code: colors.bold,
22
+ url: colors.cyan,
23
+ ...options.colors
24
+ };
25
+ return (info) => {
26
+ const rows = [[
27
+ "auth code",
28
+ info.code,
29
+ palette.code
30
+ ], [
31
+ "or open",
32
+ info.url,
33
+ palette.url
34
+ ]];
35
+ const labelWidth = Math.max(...rows.map(([label]) => label.length));
36
+ const contentWidth = Math.max(...rows.map(([, value]) => labelWidth + 2 + value.length));
37
+ const titleBarLength = title.length + 3;
38
+ const lineWidth = Math.max(contentWidth, titleBarLength - 2);
39
+ const top = [
40
+ palette.border(`╭─`),
41
+ palette.title(title),
42
+ palette.border(`${"─".repeat(Math.max(lineWidth + 2 - titleBarLength, 0))}╮`)
43
+ ].join(" ");
44
+ const bottom = `╰${"─".repeat(lineWidth + 2)}╯`;
45
+ const body = rows.map(([label, value, color]) => {
46
+ const plain = `${label.padEnd(labelWidth)} ${value}`;
47
+ const pad = " ".repeat(lineWidth - plain.length);
48
+ return `${palette.border("│")} ${palette.label(label.padEnd(labelWidth))} ${color(value)}${pad} ${palette.border("│")}`;
49
+ });
50
+ console.log(`\n${palette.border(top)}\n${body.join("\n")}\n${palette.border(bottom)}\n`);
51
+ };
10
52
  }
11
53
  /**
12
54
  * Package the interactive OTP auth protocol devframe's primitives
@@ -39,13 +81,14 @@ function createInteractiveAuth(context, options = {}) {
39
81
  function resolveServerUrl() {
40
82
  return options.serverUrl?.() ?? context.host.resolveOrigin();
41
83
  }
84
+ const banner = options.banner ?? createAuthBanner();
42
85
  let bannerPrintedForCode;
43
86
  function printBanner() {
44
87
  const code = getTempAuthCode();
45
88
  if (code === bannerPrintedForCode) return;
46
89
  bannerPrintedForCode = code;
47
90
  const url = buildOtpAuthUrl(resolveServerUrl(), code);
48
- (options.banner ?? defaultBanner)({
91
+ banner({
49
92
  code,
50
93
  url
51
94
  });
@@ -146,4 +189,4 @@ function createInteractiveAuth(context, options = {}) {
146
189
  };
147
190
  }
148
191
  //#endregion
149
- export { createInteractiveAuth };
192
+ export { createAuthBanner, createInteractiveAuth };
@@ -1,8 +1,7 @@
1
1
  import { BirpcOptions, BirpcReturn, ChannelOptions } from "birpc";
2
2
  //#region src/rpc/client.d.ts
3
- declare function createRpcClient<ServerFunctions extends object = Record<string, never>, ClientFunctions extends object = Record<string, never>>(functions: ClientFunctions, options: {
3
+ export declare function createRpcClient<ServerFunctions extends object = Record<string, never>, ClientFunctions extends object = Record<string, never>>(functions: ClientFunctions, options: {
4
4
  channel: ChannelOptions;
5
5
  rpcOptions?: Partial<BirpcOptions<ServerFunctions, ClientFunctions, boolean>>;
6
6
  }): BirpcReturn<ServerFunctions, ClientFunctions, false>;
7
- //#endregion
8
- export { createRpcClient };
7
+ //#endregion
@@ -1,6 +1,6 @@
1
1
  import { h as RpcDumpStore, l as RpcDumpClientOptions, m as RpcDumpRecordError, n as BirpcReturn, o as RpcDefinitionsToFunctions, u as RpcDumpCollectionOptions, v as RpcFunctionDefinitionAny } from "../types-Dq4i156u.mjs";
2
2
  //#region src/rpc/dump/collect.d.ts
3
- declare function dumpFunctions<T extends readonly RpcFunctionDefinitionAny[]>(definitions: T, context?: any, options?: RpcDumpCollectionOptions): Promise<RpcDumpStore<RpcDefinitionsToFunctions<T>>>;
3
+ export declare function dumpFunctions<T extends readonly RpcFunctionDefinitionAny[]>(definitions: T, context?: any, options?: RpcDumpCollectionOptions): Promise<RpcDumpStore<RpcDefinitionsToFunctions<T>>>;
4
4
  /**
5
5
  * Creates a client that serves pre-computed results from a dump store.
6
6
  * Uses argument hashing to match calls to stored records.
@@ -11,12 +11,12 @@ declare function dumpFunctions<T extends readonly RpcFunctionDefinitionAny[]>(de
11
11
  * await client.greet('Alice')
12
12
  * ```
13
13
  */
14
- declare function createClientFromDump<T extends Record<string, any>>(store: RpcDumpStore<T>, options?: RpcDumpClientOptions): BirpcReturn<T>;
14
+ export declare function createClientFromDump<T extends Record<string, any>>(store: RpcDumpStore<T>, options?: RpcDumpClientOptions): BirpcReturn<T>;
15
15
  /**
16
16
  * Filters function definitions to only those with dump definitions.
17
17
  * Note: Only checks the definition itself, not setup results.
18
18
  */
19
- declare function getDefinitionsWithDumps<T extends readonly RpcFunctionDefinitionAny[]>(definitions: T): RpcFunctionDefinitionAny[];
19
+ export declare function getDefinitionsWithDumps<T extends readonly RpcFunctionDefinitionAny[]>(definitions: T): RpcFunctionDefinitionAny[];
20
20
  //#endregion
21
21
  //#region src/rpc/dump/error.d.ts
22
22
  /**
@@ -27,32 +27,32 @@ declare function getDefinitionsWithDumps<T extends readonly RpcFunctionDefinitio
27
27
  *
28
28
  * Non-`Error` throws are wrapped as `{ name: 'Error', message: String(thrown) }`.
29
29
  */
30
- declare function serializeDumpError(error: unknown): RpcDumpRecordError;
30
+ export declare function serializeDumpError(error: unknown): RpcDumpRecordError;
31
31
  /**
32
32
  * Inverse of {@link serializeDumpError}: rebuild a thrown `Error` from
33
33
  * the plain object stored in a dump record. Preserves `cause`, restores
34
34
  * the original `name`, and re-attaches any custom own properties.
35
35
  */
36
- declare function reviveDumpError(stored: RpcDumpRecordError): Error;
36
+ export declare function reviveDumpError(stored: RpcDumpRecordError): Error;
37
37
  //#endregion
38
38
  //#region src/rpc/dump/static.d.ts
39
- type StaticRpcDumpSerialization = 'json' | 'structured-clone';
40
- interface StaticRpcDumpManifestStaticEntry {
39
+ export type StaticRpcDumpSerialization = 'json' | 'structured-clone';
40
+ export interface StaticRpcDumpManifestStaticEntry {
41
41
  type: 'static';
42
42
  path: string;
43
43
  /** Encoder used when this entry's file was written. Default: `'json'`. */
44
44
  serialization?: StaticRpcDumpSerialization;
45
45
  }
46
- interface StaticRpcDumpManifestQueryEntry {
46
+ export interface StaticRpcDumpManifestQueryEntry {
47
47
  type: 'query';
48
48
  records: Record<string, string>;
49
49
  fallback?: string;
50
50
  /** Encoder used when each record/fallback file was written. Default: `'json'`. */
51
51
  serialization?: StaticRpcDumpSerialization;
52
52
  }
53
- type StaticRpcDumpManifestValue = StaticRpcDumpManifestStaticEntry | StaticRpcDumpManifestQueryEntry | any;
54
- type StaticRpcDumpManifest = Record<string, StaticRpcDumpManifestValue>;
55
- interface StaticRpcDumpFile {
53
+ export type StaticRpcDumpManifestValue = StaticRpcDumpManifestStaticEntry | StaticRpcDumpManifestQueryEntry | any;
54
+ export type StaticRpcDumpManifest = Record<string, StaticRpcDumpManifestValue>;
55
+ export interface StaticRpcDumpFile {
56
56
  /** Whether this file was written via `JSON.stringify` or `structured-clone-es.stringify`. */
57
57
  serialization: StaticRpcDumpSerialization;
58
58
  /** Function name the file belongs to, used to scope `DF0019` errors during write. */
@@ -60,14 +60,14 @@ interface StaticRpcDumpFile {
60
60
  /** Payload to encode. */
61
61
  data: unknown;
62
62
  }
63
- interface StaticRpcDumpCollection {
63
+ export interface StaticRpcDumpCollection {
64
64
  manifest: StaticRpcDumpManifest;
65
65
  files: Record<string, StaticRpcDumpFile>;
66
66
  }
67
- declare function collectStaticRpcDump(definitions: Iterable<RpcFunctionDefinitionAny>, context: any): Promise<StaticRpcDumpCollection>;
67
+ export declare function collectStaticRpcDump(definitions: Iterable<RpcFunctionDefinitionAny>, context: any): Promise<StaticRpcDumpCollection>;
68
68
  //#endregion
69
69
  //#region src/rpc/dump/write.d.ts
70
- interface WriteStaticRpcDumpOptions {
70
+ export interface WriteStaticRpcDumpOptions {
71
71
  /**
72
72
  * Pretty-print RPC dump JSON files. Defaults to `false` so payload
73
73
  * shards (which can be multiple MB for graph-heavy tools) ship
@@ -80,6 +80,5 @@ interface WriteStaticRpcDumpOptions {
80
80
  * the `__rpc-dump/index.json` manifest, under `outDir`. Shared by the build
81
81
  * adapter (`createBuild`) and `@devframes/hub`'s `buildHub`.
82
82
  */
83
- declare function writeStaticRpcDump(dump: StaticRpcDumpCollection, outDir: string, options?: WriteStaticRpcDumpOptions): Promise<void>;
84
- //#endregion
85
- export { StaticRpcDumpCollection, StaticRpcDumpFile, StaticRpcDumpManifest, StaticRpcDumpManifestQueryEntry, StaticRpcDumpManifestStaticEntry, StaticRpcDumpManifestValue, StaticRpcDumpSerialization, WriteStaticRpcDumpOptions, collectStaticRpcDump, createClientFromDump, dumpFunctions, getDefinitionsWithDumps, reviveDumpError, serializeDumpError, writeStaticRpcDump };
83
+ export declare function writeStaticRpcDump(dump: StaticRpcDumpCollection, outDir: string, options?: WriteStaticRpcDumpOptions): Promise<void>;
84
+ //#endregion
package/dist/rpc/dump.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as getDefinitionsWithDumps, i as dumpFunctions, n as collectStaticRpcDump, o as reviveDumpError, r as createClientFromDump, s as serializeDumpError, t as writeStaticRpcDump } from "../write-BuLCrn9h.mjs";
1
+ import { a as getDefinitionsWithDumps, i as dumpFunctions, n as collectStaticRpcDump, o as reviveDumpError, r as createClientFromDump, s as serializeDumpError, t as writeStaticRpcDump } from "../write-D2AJqVT8.mjs";
2
2
  export { collectStaticRpcDump, createClientFromDump, dumpFunctions, getDefinitionsWithDumps, reviveDumpError, serializeDumpError, writeStaticRpcDump };
@@ -1,7 +1,6 @@
1
1
  import { BirpcGroup, EventOptions } from "birpc";
2
2
  //#region src/rpc/server.d.ts
3
- declare function createRpcServer<ClientFunctions extends object = Record<string, never>, ServerFunctions extends object = Record<string, never>>(functions: ServerFunctions, options?: {
3
+ export declare function createRpcServer<ClientFunctions extends object = Record<string, never>, ServerFunctions extends object = Record<string, never>>(functions: ServerFunctions, options?: {
4
4
  rpcOptions?: EventOptions<ClientFunctions, ServerFunctions, false>;
5
5
  }): BirpcGroup<ClientFunctions, ServerFunctions, false>;
6
- //#endregion
7
- export { createRpcServer };
6
+ //#endregion
@@ -2,7 +2,7 @@ import { v as RpcFunctionDefinitionAny } from "../../types-Dq4i156u.mjs";
2
2
  import { c as DevframeNodeRpcSessionMeta, l as DevframeRpcConnection, n as WsOriginRegistry } from "../../ws-server-D2nv68Hg.mjs";
3
3
  import { BirpcGroup } from "birpc";
4
4
  //#region src/rpc/transports/sse-server.d.ts
5
- interface SseRpcTransportOptions {
5
+ export interface SseRpcTransportOptions {
6
6
  /**
7
7
  * Same contract as `WsRpcTransportOptions.allowedOrigins`: extra origins
8
8
  * to accept beyond the loopback default, a live origin registry, or
@@ -28,7 +28,7 @@ interface SseRpcTransportOptions {
28
28
  /** Mint a session id. Default: `crypto.randomUUID`. */
29
29
  generateSessionId?: () => string;
30
30
  }
31
- interface SseRpcTransport {
31
+ export interface SseRpcTransport {
32
32
  /**
33
33
  * Web-standard handler for the SSE route: `GET` opens the event stream,
34
34
  * `POST` carries RPC frames (session id in the `x-birpc-session` header),
@@ -56,6 +56,5 @@ interface SseRpcTransport {
56
56
  * - server-initiated calls/events stream down as `event: message`
57
57
  * frames, and the client's replies up via `POST` get a bare `202`.
58
58
  */
59
- declare function attachSseRpcTransport<ClientFunctions extends object, ServerFunctions extends object>(rpcGroup: BirpcGroup<ClientFunctions, ServerFunctions, false>, options?: SseRpcTransportOptions): SseRpcTransport;
60
- //#endregion
61
- export { SseRpcTransport, SseRpcTransportOptions, attachSseRpcTransport };
59
+ export declare function attachSseRpcTransport<ClientFunctions extends object, ServerFunctions extends object>(rpcGroup: BirpcGroup<ClientFunctions, ServerFunctions, false>, options?: SseRpcTransportOptions): SseRpcTransport;
60
+ //#endregion
@@ -1,7 +1,7 @@
1
1
  import { n as WsOriginRegistry } from "../../ws-server-D2nv68Hg.mjs";
2
2
  import { t as ContextRpcServer } from "../../rpc-core-DiCr5etS.mjs";
3
3
  //#region src/rpc/transports/ws-bun.d.ts
4
- interface AttachBunWsTransportOptions {
4
+ export interface AttachBunWsTransportOptions {
5
5
  /** Same contract as `WsRpcTransportOptions.allowedOrigins`. */
6
6
  allowedOrigins?: readonly string[] | WsOriginRegistry | false;
7
7
  }
@@ -10,13 +10,13 @@ interface AttachBunWsTransportOptions {
10
10
  * crossws Bun adapter produces, typed loosely so devframe carries no
11
11
  * dependency on Bun's own types.
12
12
  */
13
- interface BunWsTierWebSocket {
13
+ export interface BunWsTierWebSocket {
14
14
  open?: (ws: unknown) => unknown;
15
15
  message: (ws: unknown, message: unknown) => unknown;
16
16
  close?: (ws: unknown, code?: number, reason?: string) => unknown;
17
17
  drain?: (ws: unknown) => unknown;
18
18
  }
19
- interface BunWsTier {
19
+ export interface BunWsTier {
20
20
  /** Complete a WS upgrade request; `Bun.serve`'s server as 2nd argument. */
21
21
  handleUpgrade: (request: Request, server: unknown) => Promise<Response | undefined>;
22
22
  /** The handlers to spread into `Bun.serve({ websocket })`. */
@@ -30,6 +30,5 @@ interface BunWsTier {
30
30
  * app's own origin, with no side-car server. Load it dynamically so the Bun
31
31
  * adapter never enters a Node-only bundle path.
32
32
  */
33
- declare function attachBunWsTransport(core: ContextRpcServer, options?: AttachBunWsTransportOptions): Promise<BunWsTier>;
34
- //#endregion
35
- export { AttachBunWsTransportOptions, BunWsTier, BunWsTierWebSocket, attachBunWsTransport };
33
+ export declare function attachBunWsTransport(core: ContextRpcServer, options?: AttachBunWsTransportOptions): Promise<BunWsTier>;
34
+ //#endregion
@@ -1,11 +1,11 @@
1
1
  import { n as WsOriginRegistry } from "../../ws-server-D2nv68Hg.mjs";
2
2
  import { t as ContextRpcServer } from "../../rpc-core-DiCr5etS.mjs";
3
3
  //#region src/rpc/transports/ws-deno.d.ts
4
- interface AttachDenoWsTransportOptions {
4
+ export interface AttachDenoWsTransportOptions {
5
5
  /** Same contract as `WsRpcTransportOptions.allowedOrigins`. */
6
6
  allowedOrigins?: readonly string[] | WsOriginRegistry | false;
7
7
  }
8
- interface DenoWsTier {
8
+ export interface DenoWsTier {
9
9
  /**
10
10
  * Complete a WS upgrade request; `Deno.serve`'s handler info as the 2nd
11
11
  * argument. Unlike Bun, Deno's adapter attaches the socket to the returned
@@ -21,6 +21,5 @@ interface DenoWsTier {
21
21
  * app's own origin, with no side-car server. Load it dynamically so the Deno
22
22
  * adapter never enters a Node-only bundle path.
23
23
  */
24
- declare function attachDenoWsTransport(core: ContextRpcServer, options?: AttachDenoWsTransportOptions): Promise<DenoWsTier>;
25
- //#endregion
26
- export { AttachDenoWsTransportOptions, DenoWsTier, attachDenoWsTransport };
24
+ export declare function attachDenoWsTransport(core: ContextRpcServer, options?: AttachDenoWsTransportOptions): Promise<DenoWsTier>;
25
+ //#endregion
@@ -932,10 +932,13 @@ function createSharedState(options) {
932
932
  rememberSyncId(syncIds, syncId);
933
933
  if (enablePatches$1) {
934
934
  const [nextState, patches] = produceWithPatches(state, fn);
935
+ if (nextState === state) return;
935
936
  state = nextState;
936
937
  events.emit("updated", state, patches, syncId);
937
938
  } else {
938
- state = produce(state, fn);
939
+ const nextState = produce(state, fn);
940
+ if (nextState === state) return;
941
+ state = nextState;
939
942
  events.emit("updated", state, void 0, syncId);
940
943
  }
941
944
  },
@@ -19,6 +19,5 @@
19
19
  * that display a tool's id (e.g. the inspect plugin's agent view) can
20
20
  * import it too and show the name a client actually calls.
21
21
  */
22
- declare function toAgentToolName(id: string): string;
23
- //#endregion
24
- export { toAgentToolName };
22
+ export declare function toAgentToolName(id: string): string;
23
+ //#endregion
@@ -3,7 +3,7 @@
3
3
  * A colorizer, callable as a function (`colors.red('foo')`) or as a
4
4
  * tagged template (``colors.red`foo ${bar}` ``).
5
5
  */
6
- interface ColorFn {
6
+ export interface ColorFn {
7
7
  (text: unknown): string;
8
8
  (template: TemplateStringsArray, ...values: unknown[]): string;
9
9
  }
@@ -11,7 +11,7 @@ interface ColorFn {
11
11
  * Minimal terminal color palette. Each entry is callable as both a
12
12
  * plain function and a tagged template.
13
13
  */
14
- interface Colors {
14
+ export interface Colors {
15
15
  blue: ColorFn;
16
16
  cyan: ColorFn;
17
17
  gray: ColorFn;
@@ -23,6 +23,5 @@ interface Colors {
23
23
  reset: ColorFn;
24
24
  underline: ColorFn;
25
25
  }
26
- declare const colors: Colors;
27
- //#endregion
28
- export { ColorFn, Colors, colors };
26
+ export declare const colors: Colors;
27
+ //#endregion
@@ -4,13 +4,13 @@
4
4
  * bearer credential, e.g. the persistent client auth token or an ephemeral
5
5
  * remote-dock token. Defaults to 16 bytes (128 bits) of entropy.
6
6
  */
7
- declare function randomToken(byteLength?: number): string;
7
+ export declare function randomToken(byteLength?: number): string;
8
8
  /**
9
9
  * Generate a uniformly-distributed string of decimal digits using rejection
10
10
  * sampling to avoid modulo bias. Intended for short, human-typed one-time
11
11
  * codes (e.g. a 6-digit authentication code). Leading zeros are preserved.
12
12
  */
13
- declare function randomDigits(length: number): string;
13
+ export declare function randomDigits(length: number): string;
14
14
  /**
15
15
  * Constant-time string equality. Compares every character so the comparison
16
16
  * time does not depend on the position of the first mismatch, mitigating
@@ -19,6 +19,5 @@ declare function randomDigits(length: number): string;
19
19
  * Length is treated as public (it short-circuits on differing lengths), which
20
20
  * is appropriate for fixed-length codes and tokens.
21
21
  */
22
- declare function timingSafeEqual(a: string, b: string): boolean;
23
- //#endregion
24
- export { randomDigits, randomToken, timingSafeEqual };
22
+ export declare function timingSafeEqual(a: string, b: string): boolean;
23
+ //#endregion
@@ -3,6 +3,5 @@ import { Ut as EventsMap, Vt as EventEmitter } from "../context-BBWPLDHh.mjs";
3
3
  /**
4
4
  * Create event emitter.
5
5
  */
6
- declare function createEventEmitter<Events extends EventsMap>(): EventEmitter<Events>;
7
- //#endregion
8
- export { createEventEmitter };
6
+ export declare function createEventEmitter<Events extends EventsMap>(): EventEmitter<Events>;
7
+ //#endregion
@@ -2,6 +2,5 @@
2
2
  /**
3
3
  * Stable, deterministic hash of any structured-cloneable value.
4
4
  */
5
- declare function hash(value: unknown): string;
6
- //#endregion
7
- export { hash };
5
+ export declare function hash(value: unknown): string;
6
+ //#endregion
@@ -8,6 +8,5 @@
8
8
  * `'subl'`) or absolute binary path. Otherwise the editor is auto-detected
9
9
  * via the `LAUNCH_EDITOR` env var with a fallback to common defaults.
10
10
  */
11
- declare function launchEditor(target: string, editor?: string): void;
12
- //#endregion
13
- export { launchEditor };
11
+ export declare function launchEditor(target: string, editor?: string): void;
12
+ //#endregion
@@ -1,4 +1,3 @@
1
1
  //#region src/utils/nanoid.d.ts
2
- declare function nanoid(size?: number): string;
3
- //#endregion
4
- export { nanoid };
2
+ export declare function nanoid(size?: number): string;
3
+ //#endregion
@@ -3,6 +3,5 @@
3
3
  * Open a URL, file, or other target in its default OS handler
4
4
  * (browser for URLs, Finder/Explorer for paths, etc.).
5
5
  */
6
- declare function open(target: string): Promise<void>;
7
- //#endregion
8
- export { open };
6
+ export declare function open(target: string): Promise<void>;
7
+ //#endregion
@@ -16,6 +16,5 @@ import { a as RemoteAssetsStore, o as StaticAssetsSource } from "../remote-asset
16
16
  * per-source string still wins and an explicit `null` still opts out of the
17
17
  * installed-copy lookup.
18
18
  */
19
- declare function resolveStaticAssetsSource(source: StaticAssetsSource, projectStorageDir: string, defaultResolveFrom?: string | null): string | RemoteAssetsStore;
20
- //#endregion
21
- export { resolveStaticAssetsSource };
19
+ export declare function resolveStaticAssetsSource(source: StaticAssetsSource, projectStorageDir: string, defaultResolveFrom?: string | null): string | RemoteAssetsStore;
20
+ //#endregion