@mcpview/compose 0.13.0 → 0.14.0

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 (155) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/README.md +131 -2
  3. package/esm/_dnt.polyfills.d.ts +11 -11
  4. package/esm/_dnt.polyfills.d.ts.map +1 -1
  5. package/esm/_dnt.polyfills.js +14 -14
  6. package/esm/src/code-mode/board.d.ts +18 -2
  7. package/esm/src/code-mode/board.d.ts.map +1 -1
  8. package/esm/src/code-mode/board.js +74 -2
  9. package/esm/src/code-mode/chain.d.ts +26 -1
  10. package/esm/src/code-mode/chain.d.ts.map +1 -1
  11. package/esm/src/code-mode/chain.js +248 -89
  12. package/esm/src/code-mode/connections.d.ts +1 -0
  13. package/esm/src/code-mode/connections.d.ts.map +1 -1
  14. package/esm/src/code-mode/connections.js +1 -0
  15. package/esm/src/code-mode/errors.d.ts +80 -0
  16. package/esm/src/code-mode/errors.d.ts.map +1 -0
  17. package/esm/src/code-mode/errors.js +140 -0
  18. package/esm/src/code-mode/guest-worker.d.ts +11 -0
  19. package/esm/src/code-mode/guest-worker.d.ts.map +1 -0
  20. package/esm/src/code-mode/guest-worker.js +80 -0
  21. package/esm/src/code-mode/layout-publisher.d.ts +69 -0
  22. package/esm/src/code-mode/layout-publisher.d.ts.map +1 -0
  23. package/esm/src/code-mode/layout-publisher.js +85 -0
  24. package/esm/src/code-mode/layout-runs.d.ts +35 -0
  25. package/esm/src/code-mode/layout-runs.d.ts.map +1 -0
  26. package/esm/src/code-mode/layout-runs.js +130 -0
  27. package/esm/src/code-mode/layout.d.ts +20 -0
  28. package/esm/src/code-mode/layout.d.ts.map +1 -0
  29. package/esm/src/code-mode/layout.js +54 -0
  30. package/esm/src/code-mode/mod.d.ts +4 -1
  31. package/esm/src/code-mode/mod.d.ts.map +1 -1
  32. package/esm/src/code-mode/mod.js +3 -0
  33. package/esm/src/code-mode/panel-contexts.d.ts +25 -0
  34. package/esm/src/code-mode/panel-contexts.d.ts.map +1 -0
  35. package/esm/src/code-mode/panel-contexts.js +115 -0
  36. package/esm/src/code-mode/providers.d.ts +3 -0
  37. package/esm/src/code-mode/providers.d.ts.map +1 -1
  38. package/esm/src/code-mode/sandbox-core.d.ts +61 -0
  39. package/esm/src/code-mode/sandbox-core.d.ts.map +1 -0
  40. package/esm/src/code-mode/sandbox-core.js +424 -0
  41. package/esm/src/code-mode/sandbox.d.ts +68 -7
  42. package/esm/src/code-mode/sandbox.d.ts.map +1 -1
  43. package/esm/src/code-mode/sandbox.js +180 -119
  44. package/esm/src/code-mode/sync.d.ts +11 -0
  45. package/esm/src/code-mode/sync.d.ts.map +1 -0
  46. package/esm/src/code-mode/sync.js +42 -0
  47. package/esm/src/code-mode/tool.d.ts +1 -1
  48. package/esm/src/code-mode/tool.d.ts.map +1 -1
  49. package/esm/src/code-mode/tool.js +14 -0
  50. package/esm/src/code-mode/worker-host.d.ts +70 -0
  51. package/esm/src/code-mode/worker-host.d.ts.map +1 -0
  52. package/esm/src/code-mode/worker-host.js +355 -0
  53. package/esm/src/code-mode/worker-protocol.d.ts +44 -0
  54. package/esm/src/code-mode/worker-protocol.d.ts.map +1 -0
  55. package/esm/src/code-mode/worker-protocol.js +7 -0
  56. package/esm/src/host/renderer/css/panel-controls.d.ts.map +1 -1
  57. package/esm/src/host/renderer/css/panel-controls.js +5 -1
  58. package/esm/src/host/renderer/html-generator.js +2 -2
  59. package/esm/src/host/renderer/js/card-height.d.ts +11 -1
  60. package/esm/src/host/renderer/js/card-height.d.ts.map +1 -1
  61. package/esm/src/host/renderer/js/card-height.js +57 -10
  62. package/esm/src/host/renderer/js/event-bus.d.ts +11 -0
  63. package/esm/src/host/renderer/js/event-bus.d.ts.map +1 -1
  64. package/esm/src/host/renderer/js/event-bus.js +49 -8
  65. package/esm/src/host/renderer/js/intrinsic-layout.d.ts +26 -0
  66. package/esm/src/host/renderer/js/intrinsic-layout.d.ts.map +1 -0
  67. package/esm/src/host/renderer/js/intrinsic-layout.js +44 -0
  68. package/esm/src/host/renderer/panel-controls.d.ts +7 -0
  69. package/esm/src/host/renderer/panel-controls.js +1 -0
  70. package/esm/src/host/renderer/panel-movement.d.ts.map +1 -1
  71. package/esm/src/host/renderer/panel-movement.js +5 -1
  72. package/esm/src/host/renderer/panel-resizing.d.ts.map +1 -1
  73. package/esm/src/host/renderer/panel-resizing.js +36 -0
  74. package/esm/src/host/renderer/panel-snapshot.d.ts +11 -0
  75. package/esm/src/host/renderer/panel-snapshot.d.ts.map +1 -0
  76. package/esm/src/host/renderer/panel-snapshot.js +65 -0
  77. package/esm/src/version.d.ts +1 -1
  78. package/esm/src/version.js +1 -1
  79. package/package.json +9 -1
  80. package/script/_dnt.polyfills.d.ts +11 -11
  81. package/script/_dnt.polyfills.d.ts.map +1 -1
  82. package/script/_dnt.polyfills.js +14 -14
  83. package/script/src/code-mode/board.d.ts +18 -2
  84. package/script/src/code-mode/board.d.ts.map +1 -1
  85. package/script/src/code-mode/board.js +81 -2
  86. package/script/src/code-mode/chain.d.ts +26 -1
  87. package/script/src/code-mode/chain.d.ts.map +1 -1
  88. package/script/src/code-mode/chain.js +247 -88
  89. package/script/src/code-mode/connections.d.ts +1 -0
  90. package/script/src/code-mode/connections.d.ts.map +1 -1
  91. package/script/src/code-mode/connections.js +1 -0
  92. package/script/src/code-mode/errors.d.ts +80 -0
  93. package/script/src/code-mode/errors.d.ts.map +1 -0
  94. package/script/src/code-mode/errors.js +148 -0
  95. package/script/src/code-mode/guest-worker.d.ts +11 -0
  96. package/script/src/code-mode/guest-worker.d.ts.map +1 -0
  97. package/script/src/code-mode/guest-worker.js +105 -0
  98. package/script/src/code-mode/layout-publisher.d.ts +69 -0
  99. package/script/src/code-mode/layout-publisher.d.ts.map +1 -0
  100. package/script/src/code-mode/layout-publisher.js +88 -0
  101. package/script/src/code-mode/layout-runs.d.ts +35 -0
  102. package/script/src/code-mode/layout-runs.d.ts.map +1 -0
  103. package/script/src/code-mode/layout-runs.js +134 -0
  104. package/script/src/code-mode/layout.d.ts +20 -0
  105. package/script/src/code-mode/layout.d.ts.map +1 -0
  106. package/script/src/code-mode/layout.js +57 -0
  107. package/script/src/code-mode/mod.d.ts +4 -1
  108. package/script/src/code-mode/mod.d.ts.map +1 -1
  109. package/script/src/code-mode/mod.js +14 -1
  110. package/script/src/code-mode/panel-contexts.d.ts +25 -0
  111. package/script/src/code-mode/panel-contexts.d.ts.map +1 -0
  112. package/script/src/code-mode/panel-contexts.js +118 -0
  113. package/script/src/code-mode/providers.d.ts +3 -0
  114. package/script/src/code-mode/providers.d.ts.map +1 -1
  115. package/script/src/code-mode/sandbox-core.d.ts +61 -0
  116. package/script/src/code-mode/sandbox-core.d.ts.map +1 -0
  117. package/script/src/code-mode/sandbox-core.js +430 -0
  118. package/script/src/code-mode/sandbox.d.ts +68 -7
  119. package/script/src/code-mode/sandbox.d.ts.map +1 -1
  120. package/script/src/code-mode/sandbox.js +188 -121
  121. package/script/src/code-mode/sync.d.ts +11 -0
  122. package/script/src/code-mode/sync.d.ts.map +1 -0
  123. package/script/src/code-mode/sync.js +51 -0
  124. package/script/src/code-mode/tool.d.ts +1 -1
  125. package/script/src/code-mode/tool.d.ts.map +1 -1
  126. package/script/src/code-mode/tool.js +14 -0
  127. package/script/src/code-mode/worker-host.d.ts +70 -0
  128. package/script/src/code-mode/worker-host.d.ts.map +1 -0
  129. package/script/src/code-mode/worker-host.js +389 -0
  130. package/script/src/code-mode/worker-protocol.d.ts +44 -0
  131. package/script/src/code-mode/worker-protocol.d.ts.map +1 -0
  132. package/script/src/code-mode/worker-protocol.js +8 -0
  133. package/script/src/host/renderer/css/panel-controls.d.ts.map +1 -1
  134. package/script/src/host/renderer/css/panel-controls.js +5 -1
  135. package/script/src/host/renderer/html-generator.js +2 -2
  136. package/script/src/host/renderer/js/card-height.d.ts +11 -1
  137. package/script/src/host/renderer/js/card-height.d.ts.map +1 -1
  138. package/script/src/host/renderer/js/card-height.js +57 -10
  139. package/script/src/host/renderer/js/event-bus.d.ts +11 -0
  140. package/script/src/host/renderer/js/event-bus.d.ts.map +1 -1
  141. package/script/src/host/renderer/js/event-bus.js +50 -8
  142. package/script/src/host/renderer/js/intrinsic-layout.d.ts +26 -0
  143. package/script/src/host/renderer/js/intrinsic-layout.d.ts.map +1 -0
  144. package/script/src/host/renderer/js/intrinsic-layout.js +48 -0
  145. package/script/src/host/renderer/panel-controls.d.ts +7 -0
  146. package/script/src/host/renderer/panel-controls.js +4 -1
  147. package/script/src/host/renderer/panel-movement.d.ts.map +1 -1
  148. package/script/src/host/renderer/panel-movement.js +5 -1
  149. package/script/src/host/renderer/panel-resizing.d.ts.map +1 -1
  150. package/script/src/host/renderer/panel-resizing.js +36 -0
  151. package/script/src/host/renderer/panel-snapshot.d.ts +11 -0
  152. package/script/src/host/renderer/panel-snapshot.d.ts.map +1 -0
  153. package/script/src/host/renderer/panel-snapshot.js +69 -0
  154. package/script/src/version.d.ts +1 -1
  155. package/script/src/version.js +1 -1
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Machine-readable failures of the Code Mode `execute` tool.
3
+ *
4
+ * An MCP host usually forwards only `error.message` to the model, so the message
5
+ * itself is the contract, in the format shared with other MCPView Code Mode
6
+ * servers:
7
+ *
8
+ * [execute] <CODE>: <detail>. Recovery: <recovery>.
9
+ *
10
+ * Guest programs see the same errors as `Error` objects that also carry
11
+ * `code`, `recovery` and `context`, so a program can branch on `e.code`.
12
+ *
13
+ * @module code-mode/errors
14
+ */
15
+ /** Every code the Code Mode tool can report. Codes are API: never rename one. */
16
+ export const CODE_MODE_ERROR_CODES = [
17
+ // Input checked before the program runs.
18
+ "INVALID_INPUT",
19
+ "PARAMS_INVALID",
20
+ "SAVED_CHAINS_UNAVAILABLE",
21
+ "SAVE_NAME_INVALID",
22
+ "SAVE_NAME_CONFLICT",
23
+ "SAVE_CATALOG_FULL",
24
+ "SAVE_FAILED",
25
+ "CATALOG_ERROR",
26
+ // The guest program and its sandbox.
27
+ "GUEST_ERROR",
28
+ "RESOURCE_LIMIT",
29
+ "TIME_LIMIT",
30
+ "RESULT_INVALID",
31
+ "GUEST_STALLED",
32
+ "UNAWAITED_OPERATION",
33
+ "OPERATION_LIMIT",
34
+ "ARGUMENT_INVALID",
35
+ "OPERATION_FAILED",
36
+ "SANDBOX_UNAVAILABLE",
37
+ "SANDBOX_FAILED",
38
+ // Providers and the board.
39
+ "PROVIDER_UNKNOWN",
40
+ "SNIPPET_NOT_APPROVED",
41
+ "PROVIDER_UNAVAILABLE",
42
+ "PROVIDER_ERROR",
43
+ "PROVIDER_RESULT_INVALID",
44
+ "RECEIPT_TOO_LARGE",
45
+ "PANEL_INVALID",
46
+ "SYNC_INVALID",
47
+ // After an upstream call was dispatched.
48
+ "EXECUTION_FAILED",
49
+ "INTERRUPTED",
50
+ ];
51
+ /** Recovery suffix used once an upstream operation may have completed. */
52
+ export const POSSIBLE_EFFECTS_RECOVERY = "One or more upstream operations may have completed. Check their effects before replaying the chain";
53
+ function sentence(text) {
54
+ const trimmed = text.trim();
55
+ return /[.!?]$/.test(trimmed) ? trimmed : `${trimmed}.`;
56
+ }
57
+ /**
58
+ * Render `[execute] CODE: detail. Recovery: recovery.`
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * formatCodeModeError("TIME_LIMIT", "The program used its 2000 ms of CPU", "Split the work");
63
+ * // "[execute] TIME_LIMIT: The program used its 2000 ms of CPU. Recovery: Split the work."
64
+ * ```
65
+ */
66
+ export function formatCodeModeError(code, detail, recovery) {
67
+ return `[execute] ${code}: ${detail.trim().replace(/[.!?]$/, "")}. Recovery: ${sentence(recovery)}`;
68
+ }
69
+ /**
70
+ * A Code Mode failure with a stable code, a recovery hint and context.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * throw new CodeModeError("PROVIDER_UNKNOWN", "No provider is configured as cad", "Use one of the listed aliases", {
75
+ * context: { available: ["slicer"] },
76
+ * });
77
+ * ```
78
+ */
79
+ export class CodeModeError extends Error {
80
+ name = "CodeModeError";
81
+ code;
82
+ /** What went wrong, without the code prefix or the recovery hint. */
83
+ detail;
84
+ recovery;
85
+ context;
86
+ effects;
87
+ constructor(code, detail, recovery, options = {}) {
88
+ super(formatCodeModeError(code, detail, recovery));
89
+ this.code = code;
90
+ this.detail = detail;
91
+ this.recovery = recovery;
92
+ this.context = freezeContext(options.context ?? {});
93
+ this.effects = options.effects ?? "none";
94
+ }
95
+ /** Plain fields, safe to post across a worker boundary. */
96
+ toJSON() {
97
+ return {
98
+ code: this.code,
99
+ detail: this.detail,
100
+ recovery: this.recovery,
101
+ context: this.context,
102
+ effects: this.effects,
103
+ };
104
+ }
105
+ }
106
+ function freezeContext(value) {
107
+ const entries = Object.entries(value).filter(([, item]) => typeof item === "string" || typeof item === "number" || typeof item === "boolean" ||
108
+ (Array.isArray(item) && item.every((entry) => typeof entry === "string"))).map(([key, item]) => [key, Array.isArray(item) ? Object.freeze([...item]) : item]);
109
+ return Object.freeze(Object.fromEntries(entries));
110
+ }
111
+ /** True for a {@link CodeModeError}. */
112
+ export function isCodeModeError(error) {
113
+ return error instanceof CodeModeError;
114
+ }
115
+ const KNOWN_CODES = new Set(CODE_MODE_ERROR_CODES);
116
+ /**
117
+ * Rebuild an error from {@link CodeModeErrorFields}, for example after it
118
+ * crossed a worker boundary. Returns undefined for any other shape.
119
+ */
120
+ export function codeModeErrorFromFields(value) {
121
+ if (!value || typeof value !== "object")
122
+ return undefined;
123
+ const fields = value;
124
+ if (typeof fields.code !== "string" || !KNOWN_CODES.has(fields.code) ||
125
+ typeof fields.detail !== "string" || typeof fields.recovery !== "string" ||
126
+ (fields.effects !== "none" && fields.effects !== "possible") ||
127
+ !fields.context || typeof fields.context !== "object" || Array.isArray(fields.context)) {
128
+ return undefined;
129
+ }
130
+ return new CodeModeError(fields.code, fields.detail, fields.recovery, {
131
+ context: fields.context,
132
+ effects: fields.effects,
133
+ });
134
+ }
135
+ /** The same failure, reported once an upstream operation may have completed. */
136
+ export function withPossibleEffects(error) {
137
+ if (error.effects === "possible")
138
+ return error;
139
+ return new CodeModeError(error.code, error.detail, `${error.recovery.trim().replace(/[.!?]$/, "")}. ${POSSIBLE_EFFECTS_RECOVERY}`, { context: error.context, effects: "possible" });
140
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Worker entry for Code Mode programs. It owns one QuickJS VM, runs one
3
+ * program, and asks the host for each api operation. The host terminates the
4
+ * worker afterwards. Loaded by `worker-host.ts` under Deno (Web Worker) and
5
+ * Node (`node:worker_threads`); keep it free of top-level await, which the
6
+ * CommonJS npm build rejects.
7
+ *
8
+ * @module code-mode/guest-worker
9
+ */
10
+ import "../../_dnt.polyfills.js";
11
+ //# sourceMappingURL=guest-worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guest-worker.d.ts","sourceRoot":"","sources":["../../../src/src/code-mode/guest-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,yBAAyB,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Worker entry for Code Mode programs. It owns one QuickJS VM, runs one
3
+ * program, and asks the host for each api operation. The host terminates the
4
+ * worker afterwards. Loaded by `worker-host.ts` under Deno (Web Worker) and
5
+ * Node (`node:worker_threads`); keep it free of top-level await, which the
6
+ * CommonJS npm build rejects.
7
+ *
8
+ * @module code-mode/guest-worker
9
+ */
10
+ import "../../_dnt.polyfills.js";
11
+ import * as dntShim from "../../_dnt.shims.js";
12
+ import { getQuickJS } from "quickjs-emscripten";
13
+ import { CodeModeError, codeModeErrorFromFields } from "./errors.js";
14
+ import { runVm } from "./sandbox-core.js";
15
+ /** The host port, or undefined when this module is loaded outside a worker. */
16
+ function connect() {
17
+ const deno = dntShim.dntGlobalThis.Deno;
18
+ if (typeof deno?.version?.deno === "string") {
19
+ const workerScope = dntShim.dntGlobalThis
20
+ .WorkerGlobalScope;
21
+ if (typeof workerScope !== "function" || !(dntShim.dntGlobalThis instanceof workerScope)) {
22
+ return Promise.resolve(undefined);
23
+ }
24
+ const scope = dntShim.dntGlobalThis;
25
+ return Promise.resolve({
26
+ post: (message) => scope.postMessage(message),
27
+ listen: (handler) => scope.addEventListener("message", (event) => handler(event.data)),
28
+ });
29
+ }
30
+ return import("node:worker_threads").then(({ parentPort }) => {
31
+ if (!parentPort)
32
+ return undefined;
33
+ return {
34
+ post: (message) => parentPort.postMessage(message),
35
+ listen: (handler) => parentPort.on("message", handler),
36
+ };
37
+ });
38
+ }
39
+ void connect().then((port) => {
40
+ if (!port)
41
+ return;
42
+ const waiting = new Map();
43
+ let nextCall = 0;
44
+ let started = false;
45
+ port.listen((message) => {
46
+ if (message.type === "reply") {
47
+ const waiter = waiting.get(message.id);
48
+ if (!waiter)
49
+ return;
50
+ waiting.delete(message.id);
51
+ if (message.ok)
52
+ waiter.resolve(JSON.parse(message.json));
53
+ else {
54
+ waiter.reject(codeModeErrorFromFields(message.error) ??
55
+ new CodeModeError("OPERATION_FAILED", "The operation failed", "Retry once"));
56
+ }
57
+ return;
58
+ }
59
+ if (message.type !== "run" || started)
60
+ return;
61
+ started = true;
62
+ const cancel = new Int32Array(message.cancel);
63
+ getQuickJS().then((quickjs) => runVm({
64
+ quickjs,
65
+ code: message.code,
66
+ params: message.params,
67
+ limits: message.limits,
68
+ isCancelled: () => Atomics.load(cancel, 0) === 1,
69
+ call: (operation, args) => new Promise((resolve, reject) => {
70
+ const id = nextCall++;
71
+ waiting.set(id, { resolve, reject });
72
+ port.post({ type: "call", id, operation, args });
73
+ }),
74
+ })).then((value) => port.post({ type: "done", value }), (error) => port.post({
75
+ type: "fail",
76
+ error: (error instanceof CodeModeError ? error : new CodeModeError("SANDBOX_FAILED", "The sandbox failed while running the program", "Run the program again")).toJSON(),
77
+ }));
78
+ });
79
+ port.post({ type: "ready" });
80
+ });
@@ -0,0 +1,69 @@
1
+ /** Browser-side transport for user-edited Code Mode dashboard layouts. @module */
2
+ import { capturePanelLayout } from "../host/renderer/panel-controls.js";
3
+ import type { PanelLayoutSnapshot } from "./layout.js";
4
+ /** The conversation receives a reference to the staged geometry. */
5
+ export interface SnippetLayoutReceipt {
6
+ /** Execution reference supplied by the server that owns the snippet. */
7
+ runId: string;
8
+ /** Monotonic revision within this mounted board. */
9
+ revision: number;
10
+ /** Whether the server has acknowledged this revision for saving. */
11
+ status: "pending" | "ready" | "failed";
12
+ }
13
+ /** State available to an App's translated layout feedback and retry controls. */
14
+ export type SnippetLayoutStatus = SnippetLayoutReceipt["status"] | "local" | "restore-failed";
15
+ /** MCP Apps host methods and the board's context writer, which can aggregate panel selections. */
16
+ export interface SnippetBoardLayoutOptions {
17
+ /** Connected MCP App providing the negotiated capabilities and the staging callback. */
18
+ host: {
19
+ getHostCapabilities(): {
20
+ serverTools?: unknown;
21
+ updateModelContext?: {
22
+ structuredContent?: unknown;
23
+ text?: unknown;
24
+ };
25
+ } | undefined;
26
+ callServerTool(params: {
27
+ name: string;
28
+ arguments: {
29
+ runId: string;
30
+ revision: number;
31
+ layout: PanelLayoutSnapshot;
32
+ };
33
+ }, options: {
34
+ signal: AbortSignal;
35
+ }): Promise<{
36
+ structuredContent?: unknown;
37
+ isError?: boolean;
38
+ }>;
39
+ };
40
+ /** The board's context writer, shared with the panels in this App. */
41
+ updateContext(update: {
42
+ structuredContent: {
43
+ snippetLayout: SnippetLayoutReceipt;
44
+ };
45
+ } | {
46
+ content: {
47
+ type: "text";
48
+ text: string;
49
+ }[];
50
+ }): Promise<object>;
51
+ /** App-only callback that stages the geometry and returns the matching run ID and revision. */
52
+ stageTool: string;
53
+ /** Execution metadata from the tool result. Without a reference, edits stay local. */
54
+ runId?: unknown;
55
+ /** Previously saved geometry supplied on replay. */
56
+ savedLayout?: unknown;
57
+ /** Signals the end of this board's display lifetime. */
58
+ signal: AbortSignal;
59
+ /** Receives updates for the App's own feedback, including recoverable errors. */
60
+ onStatus?(status: SnippetLayoutStatus): void;
61
+ }
62
+ /**
63
+ * Install the controls and restore a saved layout on a mounted board. Each
64
+ * committed gesture stages its geometry and publishes an acknowledgement for
65
+ * the next model turn. Pass the board's context writer when other panels share
66
+ * its context. The returned callback retries the current layout after an error.
67
+ */
68
+ export declare function connectSnippetBoardLayout(board: Parameters<typeof capturePanelLayout>[0], { host, updateContext, stageTool, runId, savedLayout, signal, onStatus }: SnippetBoardLayoutOptions): () => Promise<void>;
69
+ //# sourceMappingURL=layout-publisher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout-publisher.d.ts","sourceRoot":"","sources":["../../../src/src/code-mode/layout-publisher.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,OAAO,EACL,kBAAkB,EAInB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,oEAAoE;AACpE,MAAM,WAAW,oBAAoB;IACnC,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;CACxC;AAED,iFAAiF;AACjF,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAC,QAAQ,CAAC,GAAG,OAAO,GAAG,gBAAgB,CAAC;AAE9F,kGAAkG;AAClG,MAAM,WAAW,yBAAyB;IACxC,wFAAwF;IACxF,IAAI,EAAE;QACJ,mBAAmB,IAAI;YACrB,WAAW,CAAC,EAAE,OAAO,CAAC;YACtB,kBAAkB,CAAC,EAAE;gBAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC;gBAAC,IAAI,CAAC,EAAE,OAAO,CAAA;aAAE,CAAC;SACtE,GAAG,SAAS,CAAC;QACd,cAAc,CACZ,MAAM,EAAE;YACN,IAAI,EAAE,MAAM,CAAC;YACb,SAAS,EAAE;gBAAE,KAAK,EAAE,MAAM,CAAC;gBAAC,QAAQ,EAAE,MAAM,CAAC;gBAAC,MAAM,EAAE,mBAAmB,CAAA;aAAE,CAAC;SAC7E,EACD,OAAO,EAAE;YAAE,MAAM,EAAE,WAAW,CAAA;SAAE,GAC/B,OAAO,CAAC;YAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC;YAAC,OAAO,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC,CAAC;KAChE,CAAC;IACF,sEAAsE;IACtE,aAAa,CACX,MAAM,EACF;QAAE,iBAAiB,EAAE;YAAE,aAAa,EAAE,oBAAoB,CAAA;SAAE,CAAA;KAAE,GAC9D;QAAE,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,GAChD,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,+FAA+F;IAC/F,SAAS,EAAE,MAAM,CAAC;IAClB,sFAAsF;IACtF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oDAAoD;IACpD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,wDAAwD;IACxD,MAAM,EAAE,WAAW,CAAC;IACpB,iFAAiF;IACjF,QAAQ,CAAC,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC9C;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,EAC/C,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,EACtE,yBAAyB,GAC1B,MAAM,OAAO,CAAC,IAAI,CAAC,CA4ErB"}
@@ -0,0 +1,85 @@
1
+ /** Browser-side transport for user-edited Code Mode dashboard layouts. @module */
2
+ import { capturePanelLayout, installPanelMovement, installPanelResizing, restorePanelLayout, } from "../host/renderer/panel-controls.js";
3
+ /**
4
+ * Install the controls and restore a saved layout on a mounted board. Each
5
+ * committed gesture stages its geometry and publishes an acknowledgement for
6
+ * the next model turn. Pass the board's context writer when other panels share
7
+ * its context. The returned callback retries the current layout after an error.
8
+ */
9
+ export function connectSnippetBoardLayout(board, { host, updateContext, stageTool, runId, savedLayout, signal, onStatus }) {
10
+ installPanelMovement(board, signal);
11
+ installPanelResizing(board, signal);
12
+ if (!signal.aborted && savedLayout !== undefined && !restorePanelLayout(board, savedLayout)) {
13
+ onStatus?.("restore-failed");
14
+ }
15
+ const capabilities = host.getHostCapabilities();
16
+ const formats = capabilities?.updateModelContext;
17
+ const structured = typeof formats?.structuredContent === "object" &&
18
+ formats.structuredContent !== null;
19
+ const text = typeof formats?.text === "object" && formats.text !== null;
20
+ let latest = 0;
21
+ let contextSent = Promise.resolve();
22
+ function sendReceipt(receipt) {
23
+ // Wait for the preceding context write even if the host delivers requests out of order.
24
+ const next = contextSent.then(async () => {
25
+ signal.throwIfAborted();
26
+ if (receipt.status !== "pending" && receipt.revision !== latest)
27
+ return;
28
+ const value = { snippetLayout: receipt };
29
+ // Once sent, an App-wide context update may include live selections from
30
+ // other panels. Let its acknowledgement settle even if this board closes.
31
+ const response = await updateContext(structured
32
+ ? { structuredContent: value }
33
+ : { content: [{ type: "text", text: JSON.stringify(value) }] });
34
+ if ("isError" in response && response.isError)
35
+ throw new Error("Layout receipt rejected");
36
+ });
37
+ contextSent = next.catch(() => { });
38
+ return next;
39
+ }
40
+ async function commit() {
41
+ if (signal.aborted)
42
+ return;
43
+ if (typeof runId !== "string" || !capabilities?.serverTools || !(structured || text)) {
44
+ onStatus?.("local");
45
+ return;
46
+ }
47
+ const layout = capturePanelLayout(board);
48
+ if (!layout) {
49
+ onStatus?.("local");
50
+ return;
51
+ }
52
+ const revision = ++latest;
53
+ const current = () => latest === revision && !signal.aborted;
54
+ onStatus?.("pending");
55
+ try {
56
+ const [staged] = await Promise.all([
57
+ host.callServerTool({ name: stageTool, arguments: { runId, revision, layout } }, {
58
+ signal,
59
+ }),
60
+ sendReceipt({ runId, revision, status: "pending" }),
61
+ ]);
62
+ const ack = staged.structuredContent;
63
+ if (staged.isError || !ack || typeof ack !== "object" ||
64
+ !("runId" in ack) || ack.runId !== runId ||
65
+ !("revision" in ack) || ack.revision !== revision) {
66
+ throw new Error("Layout revision not acknowledged");
67
+ }
68
+ if (!current())
69
+ return;
70
+ await sendReceipt({ runId, revision, status: "ready" });
71
+ if (current())
72
+ onStatus?.("ready");
73
+ }
74
+ catch {
75
+ if (!current())
76
+ return;
77
+ onStatus?.("failed");
78
+ // Leave retry available even when a disconnected host rejects the failure notice.
79
+ await sendReceipt({ runId, revision, status: "failed" }).catch(() => { });
80
+ }
81
+ }
82
+ const events = board;
83
+ events.addEventListener("compose-panel-layout-committed", commit, { signal });
84
+ return commit;
85
+ }
@@ -0,0 +1,35 @@
1
+ /** Scoped layout drafts for saved Code Mode dashboards. @module */
2
+ import "../../_dnt.polyfills.js";
3
+ import { type PanelLayoutSnapshot } from "./layout.js";
4
+ /** Accepted widths per stable panel ID. Use an empty list for a fixed-width viewer. */
5
+ export type PanelWidths = ReadonlyMap<string, readonly number[]>;
6
+ /** Correlate app gestures and explicit snippet saves within a trusted execution scope. */
7
+ export declare class BoardLayoutRuns<Receipt = void> {
8
+ private readonly runs;
9
+ private readonly referenceTtlMs;
10
+ private readonly maxPendingReferences;
11
+ /** Pass the reference lifetime and capacity used by the snippet catalog. */
12
+ constructor(options?: {
13
+ referenceTtlMs?: number;
14
+ maxPendingReferences?: number;
15
+ });
16
+ /** Register a successful run and return the saved layout if it fits today's panel declarations. */
17
+ open(scope: string, runId: string, panels: PanelWidths, replayedName?: string, savedLayout?: unknown): PanelLayoutSnapshot | undefined;
18
+ private find;
19
+ /** Bind the name only after the scoped catalog has successfully saved the program. */
20
+ saved(scope: string, runId: string, name: string): void;
21
+ /** Acknowledge a committed layout, including an identical retry after a lost response. */
22
+ stage(scope: string, runId: unknown, revision: unknown, snapshot: unknown): {
23
+ runId: string;
24
+ revision: number;
25
+ };
26
+ /** Return only acknowledged geometry for save or update. An update must target a bound name. */
27
+ selected(scope: string, runId: string, revision?: unknown, updateName?: string): PanelLayoutSnapshot | undefined;
28
+ /**
29
+ * Apply the explicit update once per named board revision. Retain only the
30
+ * latest receipt per bound name until this execution expires. A failed
31
+ * write can be retried, and an older in-flight write finishes before a newer one.
32
+ */
33
+ commitUpdate(scope: string, runId: string, revision: number, name: string, write: (layout: PanelLayoutSnapshot) => Promise<Receipt>): Promise<Receipt>;
34
+ }
35
+ //# sourceMappingURL=layout-runs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout-runs.d.ts","sourceRoot":"","sources":["../../../src/src/code-mode/layout-runs.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAyB,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE9E,uFAAuF;AACvF,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;AA0BjE,0FAA0F;AAC1F,qBAAa,eAAe,CAAC,OAAO,GAAG,IAAI;IACzC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAwC;IAC7D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAE9C,4EAA4E;gBAChE,OAAO,GAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,CAAA;KAAO;IAUpF,mGAAmG;IACnG,IAAI,CACF,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,WAAW,EACnB,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,OAAO,GACpB,mBAAmB,GAAG,SAAS;IAuBlC,OAAO,CAAC,IAAI;IAKZ,sFAAsF;IACtF,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAQvD,0FAA0F;IAC1F,KAAK,CACH,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,GAChB;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAuBtC,gGAAgG;IAChG,QAAQ,CACN,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,QAAQ,CAAC,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,mBAAmB,GAAG,SAAS;IAgBlC;;;;OAIG;IACG,YAAY,CAChB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC,OAAO,CAAC,GACvD,OAAO,CAAC,OAAO,CAAC;CAiBpB"}
@@ -0,0 +1,130 @@
1
+ /** Scoped layout drafts for saved Code Mode dashboards. @module */
2
+ import "../../_dnt.polyfills.js";
3
+ import { isPanelLayoutSnapshot } from "./layout.js";
4
+ function matchesBoard(value, panels) {
5
+ return isPanelLayoutSnapshot(value) && value.order.length === panels.size &&
6
+ value.order.every((id) => panels.has(id)) &&
7
+ value.widths.every(({ panel, width }) => panels.get(panel)?.includes(width));
8
+ }
9
+ function copyLayout({ order, widths, placements }) {
10
+ return {
11
+ version: 1,
12
+ order: [...order],
13
+ widths: widths.map(({ panel, width }) => ({ panel, width })),
14
+ placements: placements.map(({ panel, beside, side }) => ({ panel, beside, side })),
15
+ };
16
+ }
17
+ /** Correlate app gestures and explicit snippet saves within a trusted execution scope. */
18
+ export class BoardLayoutRuns {
19
+ runs = new Map();
20
+ referenceTtlMs;
21
+ maxPendingReferences;
22
+ /** Pass the reference lifetime and capacity used by the snippet catalog. */
23
+ constructor(options = {}) {
24
+ this.referenceTtlMs = options.referenceTtlMs ?? 10 * 60_000;
25
+ this.maxPendingReferences = options.maxPendingReferences ?? 1024;
26
+ for (const limit of [this.referenceTtlMs, this.maxPendingReferences]) {
27
+ if (!Number.isSafeInteger(limit) || limit <= 0) {
28
+ throw new RangeError("Invalid reference limit");
29
+ }
30
+ }
31
+ }
32
+ /** Register a successful run and return the saved layout if it fits today's panel declarations. */
33
+ open(scope, runId, panels, replayedName, savedLayout) {
34
+ if (!scope.trim() || !runId.trim()) {
35
+ throw new TypeError("Dashboard runs require a scope and run ID");
36
+ }
37
+ const now = Date.now();
38
+ if ((this.runs.get(runId)?.expiresAt ?? 0) > now) {
39
+ throw new Error("Dashboard execution already registered");
40
+ }
41
+ for (const [key, run] of this.runs) {
42
+ if (run.expiresAt > now && this.runs.size < this.maxPendingReferences)
43
+ break;
44
+ this.runs.delete(key);
45
+ }
46
+ const initial = matchesBoard(savedLayout, panels) ? copyLayout(savedLayout) : undefined;
47
+ this.runs.set(runId, {
48
+ scope,
49
+ panels: new Map(Array.from(panels, ([id, widths]) => [id, [...widths]])),
50
+ names: new Map(replayedName === undefined ? [] : [[replayedName, undefined]]),
51
+ initial,
52
+ expiresAt: now + this.referenceTtlMs,
53
+ });
54
+ return initial && copyLayout(initial);
55
+ }
56
+ find(scope, runId) {
57
+ const run = this.runs.get(runId);
58
+ if (run?.scope === scope && run.expiresAt > Date.now())
59
+ return run;
60
+ }
61
+ /** Bind the name only after the scoped catalog has successfully saved the program. */
62
+ saved(scope, runId, name) {
63
+ const run = this.find(scope, runId);
64
+ if (!run || run.names.has(name))
65
+ return;
66
+ // Cap both bound aliases and retained receipts. A dropped alias can be reopened normally.
67
+ if (run.names.size >= 32)
68
+ run.names.delete(run.names.keys().next().value);
69
+ run.names.set(name, undefined);
70
+ }
71
+ /** Acknowledge a committed layout, including an identical retry after a lost response. */
72
+ stage(scope, runId, revision, snapshot) {
73
+ const run = typeof runId === "string" && this.find(scope, runId);
74
+ if (!run || typeof runId !== "string") {
75
+ throw new Error("Dashboard execution expired or unavailable. Reopen the dashboard.");
76
+ }
77
+ if (typeof revision !== "number" || !Number.isSafeInteger(revision) || revision < 1 ||
78
+ !matchesBoard(snapshot, run.panels)) {
79
+ throw new Error("Invalid layout for this dashboard execution.");
80
+ }
81
+ const layout = copyLayout(snapshot);
82
+ if (run.draft && (revision < run.draft.revision ||
83
+ (revision === run.draft.revision &&
84
+ JSON.stringify(layout) !== JSON.stringify(run.draft.layout)))) {
85
+ throw new Error("The dashboard layout revision is stale.");
86
+ }
87
+ run.draft = { revision, layout };
88
+ return { runId, revision };
89
+ }
90
+ /** Return only acknowledged geometry for save or update. An update must target a bound name. */
91
+ selected(scope, runId, revision, updateName) {
92
+ const run = this.find(scope, runId);
93
+ if (revision === undefined && updateName === undefined && !run?.draft) {
94
+ return run?.initial && copyLayout(run.initial);
95
+ }
96
+ if (!run?.draft || revision !== run.draft.revision) {
97
+ throw new Error("Use the latest ready snippetLayout runId and revision from the dashboard.");
98
+ }
99
+ if (updateName !== undefined && !run.names.has(updateName)) {
100
+ throw new Error("This dashboard belongs to a different snippet. Open or save the requested snippet first.");
101
+ }
102
+ return copyLayout(run.draft.layout);
103
+ }
104
+ /**
105
+ * Apply the explicit update once per named board revision. Retain only the
106
+ * latest receipt per bound name until this execution expires. A failed
107
+ * write can be retried, and an older in-flight write finishes before a newer one.
108
+ */
109
+ async commitUpdate(scope, runId, revision, name, write) {
110
+ const layout = this.selected(scope, runId, revision, name);
111
+ if (!layout)
112
+ throw new Error("The dashboard has no acknowledged layout.");
113
+ const run = this.runs.get(runId);
114
+ const previous = run.names.get(name);
115
+ if (previous?.revision === revision)
116
+ return await previous.receipt;
117
+ const receipt = (previous?.receipt ?? Promise.resolve())
118
+ .catch(() => { })
119
+ .then(() => write(layout));
120
+ run.names.set(name, { revision, receipt });
121
+ try {
122
+ return await receipt;
123
+ }
124
+ catch (error) {
125
+ if (run.names.get(name)?.receipt === receipt)
126
+ run.names.set(name, undefined);
127
+ throw error;
128
+ }
129
+ }
130
+ }
@@ -0,0 +1,20 @@
1
+ /** Versioned layout preferences for a Code Mode dashboard. @module */
2
+ /** User-selected panel positions and supported widths, independent of ERP data and chat context. */
3
+ import "../../_dnt.polyfills.js";
4
+ export type PanelLayoutSnapshot = {
5
+ readonly version: 1;
6
+ /** Panel IDs in the template's original slot order. */
7
+ readonly order: readonly string[];
8
+ readonly widths: readonly {
9
+ readonly panel: string;
10
+ readonly width: number;
11
+ }[];
12
+ readonly placements: readonly {
13
+ readonly panel: string;
14
+ readonly beside: string;
15
+ readonly side: "left" | "right" | "below";
16
+ }[];
17
+ };
18
+ /** Validate an untrusted JSON snapshot, including placement anchors and their dependencies. */
19
+ export declare function isPanelLayoutSnapshot(value: unknown): value is PanelLayoutSnapshot;
20
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/src/code-mode/layout.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,oGAAoG;AACpG,OAAO,yBAAyB,CAAC;AAEjC,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/E,QAAQ,CAAC,UAAU,EAAE,SAAS;QAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;KAC3C,EAAE,CAAC;CACL,CAAC;AAiBF,+FAA+F;AAC/F,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAsClF"}
@@ -0,0 +1,54 @@
1
+ /** Versioned layout preferences for a Code Mode dashboard. @module */
2
+ /** User-selected panel positions and supported widths, independent of ERP data and chat context. */
3
+ import "../../_dnt.polyfills.js";
4
+ // This is a versioned wire format. Only geometry crosses the snippet boundary.
5
+ const maxPanels = 128;
6
+ const maxIdLength = 256;
7
+ function fields(value, keys) {
8
+ return value !== null && typeof value === "object" && !Array.isArray(value) &&
9
+ Object.keys(value).length === keys.length &&
10
+ keys.every((key) => Object.hasOwn(value, key));
11
+ }
12
+ function validId(value) {
13
+ return typeof value === "string" && value.trim().length > 0 && value.length <= maxIdLength &&
14
+ !Array.from(value).some((ch) => ch.charCodeAt(0) < 32);
15
+ }
16
+ /** Validate an untrusted JSON snapshot, including placement anchors and their dependencies. */
17
+ export function isPanelLayoutSnapshot(value) {
18
+ if (!fields(value, ["version", "order", "widths", "placements"]) || value.version !== 1) {
19
+ return false;
20
+ }
21
+ const { order, widths, placements } = value;
22
+ if (!Array.isArray(order) || !order.length || order.length > maxPanels ||
23
+ !Array.isArray(widths) || widths.length > order.length ||
24
+ !Array.isArray(placements) || placements.length >= order.length)
25
+ return false;
26
+ const ids = new Set(order);
27
+ if (ids.size !== order.length || !Array.from(ids).every(validId))
28
+ return false;
29
+ const resized = new Set();
30
+ for (const item of widths) {
31
+ if (!fields(item, ["panel", "width"]) || !ids.has(item.panel) || resized.has(item.panel) ||
32
+ typeof item.width !== "number" || !Number.isSafeInteger(item.width) || item.width <= 0)
33
+ return false;
34
+ resized.add(item.panel);
35
+ }
36
+ const anchors = new Map();
37
+ for (const item of placements) {
38
+ if (!fields(item, ["panel", "beside", "side"]) || !ids.has(item.panel) || !ids.has(item.beside) ||
39
+ anchors.has(item.panel) ||
40
+ (item.side !== "left" && item.side !== "right" && item.side !== "below"))
41
+ return false;
42
+ anchors.set(item.panel, item.beside);
43
+ }
44
+ for (let id of anchors.keys()) {
45
+ const seen = new Set();
46
+ while (anchors.has(id)) {
47
+ if (seen.has(id))
48
+ return false;
49
+ seen.add(id);
50
+ id = anchors.get(id);
51
+ }
52
+ }
53
+ return true;
54
+ }
@@ -1,8 +1,11 @@
1
1
  /** Run selected snippets across host-configured MCP providers in one Code Mode call. */
2
2
  import "../../_dnt.polyfills.js";
3
- export { createSnippetChain, type SnippetChainExecutor, type SnippetPanelReceipt, } from "./chain.js";
3
+ export { createSnippetChain, type SnippetChainExecutor, type SnippetChainOptions, type SnippetPanelReceipt, } from "./chain.js";
4
+ export { CODE_MODE_ERROR_CODES, CodeModeError, type CodeModeErrorCode, type CodeModeErrorContext, type CodeModeErrorEffects, type CodeModeErrorFields, formatCodeModeError, isCodeModeError, } from "./errors.js";
5
+ export { assertSandboxIsolation, CODE_MODE_LIMITS, type SandboxIsolation, type SandboxLimits, } from "./sandbox.js";
4
6
  export { connectSnippetProviders, type SnippetMcpClient, type SnippetProviderBinding, type SnippetProviderConnections, } from "./connections.js";
5
7
  export type { SnippetChainContext, SnippetProvider } from "./providers.js";
6
8
  export { createSnippetExecuteTool, type SnippetExecuteToolOptions } from "./tool.js";
7
9
  export { type ProviderSnippetDefinition, registerSnippetProvider, type SnippetProviderOptions, } from "./provider-tools.js";
10
+ export { parseSnippetSyncRule, SNIPPET_SYNC_META_KEY, snippetSyncKey, supportsSnippetSync, } from "./sync.js";
8
11
  //# sourceMappingURL=mod.d.ts.map