@agent-native/core 0.153.10 → 0.154.1

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 (149) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/AGENTS.md +20 -30
  3. package/corpus/templates/analytics/actions/search-dashboard-references.ts +58 -0
  4. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +1 -1
  5. package/corpus/templates/analytics/app/lib/utils.ts +1 -1
  6. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/ViewSqlPopover.tsx +1 -1
  7. package/corpus/templates/analytics/server/lib/agent-chat-plan-mode.ts +2 -0
  8. package/corpus/templates/analytics/server/lib/dashboards-store.ts +366 -3
  9. package/corpus/templates/analytics/server/lib/real-data-actions.ts +3 -1
  10. package/corpus/templates/analytics/server/plugins/agent-chat.ts +6 -2
  11. package/corpus/templates/calendar/app/components/calendar/EventDialog.tsx +1 -1
  12. package/corpus/templates/calendar/app/lib/utils.ts +1 -1
  13. package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +32 -5
  14. package/corpus/templates/clips/app/components/sharing/share-ui.tsx +15 -15
  15. package/corpus/templates/clips/app/i18n/en-US.ts +3 -3
  16. package/corpus/templates/clips/app/lib/utils.ts +5 -6
  17. package/corpus/templates/clips/chrome-extension/src/offscreen.ts +43 -8
  18. package/corpus/templates/clips/desktop/src/app.tsx +26 -12
  19. package/corpus/templates/clips/desktop/src/lib/recorder.ts +23 -9
  20. package/corpus/templates/clips/desktop/src-tauri/src/native_screen/custom_capture.rs +261 -11
  21. package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +21 -3
  22. package/corpus/templates/clips/shared/mic-audio-cleanup.ts +350 -0
  23. package/corpus/templates/content/actions/resolve-content-landing.ts +162 -32
  24. package/corpus/templates/content/app/i18n-data.ts +10 -10
  25. package/corpus/templates/content/scripts/check-native-deps.mjs +181 -15
  26. package/corpus/templates/content/shared/content-landing.ts +5 -0
  27. package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +79 -7
  28. package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +14 -2
  29. package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +2 -2
  30. package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +35 -11
  31. package/corpus/templates/design/actions/get-design-system.ts +103 -3
  32. package/corpus/templates/design/actions/import-design-tokens.ts +37 -8
  33. package/corpus/templates/design/actions/import-github.ts +32 -138
  34. package/corpus/templates/design/actions/index-design-system-with-builder.ts +49 -16
  35. package/corpus/templates/design/actions/present-design-variants.ts +93 -4
  36. package/corpus/templates/design/actions/run-design-audit.ts +229 -0
  37. package/corpus/templates/design/actions/sync-design-system-with-builder.ts +64 -0
  38. package/corpus/templates/design/app/components/design/code-workbench/commands.ts +2 -2
  39. package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +17 -4
  40. package/corpus/templates/design/app/components/design/inspector/GradientEditor.tsx +5 -1
  41. package/corpus/templates/design/app/components/design/inspector/ImageFillControls.tsx +5 -1
  42. package/corpus/templates/design/app/hooks/use-question-flow.ts +81 -5
  43. package/corpus/templates/design/app/i18n/en-US.ts +1 -1
  44. package/corpus/templates/design/app/i18n-data.ts +32 -1
  45. package/corpus/templates/design/app/i18n-keyboard-shortcuts.ts +10 -10
  46. package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +83 -11
  47. package/corpus/templates/design/app/pages/DesignSystems.tsx +14 -0
  48. package/corpus/templates/design/app/pages/design-editor/generation-prompt-directives.ts +22 -0
  49. package/corpus/templates/design/changelog/2026-08-13-a-screen-that-would-render-behind-an-invisible-alpine-overla.md +6 -0
  50. package/corpus/templates/design/changelog/2026-08-13-attach-a-ui-screenshot-and-the-design-is-reproduced-not-rein.md +6 -0
  51. package/corpus/templates/design/changelog/2026-08-13-linking-a-design-system-means-you-never-get-generic-directio.md +6 -0
  52. package/corpus/templates/design/changelog/2026-08-13-the-design-audit-now-reports-when-a-screen-ignores-its-linke.md +6 -0
  53. package/corpus/templates/design/changelog/2026-08-13-the-design-system-preview-now-shows-how-many-named-tokens-we.md +6 -0
  54. package/corpus/templates/design/changelog/2026-08-13-your-design-system-prompt-and-reference-screenshots-now-reac.md +6 -0
  55. package/corpus/templates/design/server/lib/builder-design-system-proxy.ts +18 -2
  56. package/corpus/templates/design/shared/design-review.ts +1 -0
  57. package/corpus/templates/design/shared/html-integrity.ts +171 -0
  58. package/corpus/templates/mail/app/lib/utils.ts +1 -1
  59. package/corpus/templates/slides/.agents/skills/design-systems/SKILL.md +10 -6
  60. package/corpus/templates/slides/actions/index-design-system-with-builder.ts +41 -3
  61. package/corpus/templates/slides/actions/patch-deck.ts +12 -3
  62. package/corpus/templates/slides/actions/sync-design-system-with-builder.ts +64 -0
  63. package/corpus/templates/slides/app/components/deck/DeckCard.tsx +1 -1
  64. package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +193 -20
  65. package/corpus/templates/slides/app/components/editor/EditorActionCluster.tsx +73 -1
  66. package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +64 -34
  67. package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +34 -41
  68. package/corpus/templates/slides/app/components/editor/ExportMenu.tsx +119 -91
  69. package/corpus/templates/slides/app/components/editor/ImageOverlay.tsx +16 -0
  70. package/corpus/templates/slides/app/components/editor/NewDeckReferenceStep.tsx +15 -0
  71. package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +158 -31
  72. package/corpus/templates/slides/app/components/editor/SlideOverflowWarning.tsx +30 -14
  73. package/corpus/templates/slides/app/components/editor/SpeakerNotesPanel.tsx +2 -2
  74. package/corpus/templates/slides/app/components/editor/canvas-interactions/slides-canvas-adapter.ts +4 -1
  75. package/corpus/templates/slides/app/components/editor/rich-text-selection.ts +14 -0
  76. package/corpus/templates/slides/app/components/editor/slide-text-targets.ts +24 -0
  77. package/corpus/templates/slides/app/context/DeckContext.tsx +19 -31
  78. package/corpus/templates/slides/app/global.css +24 -0
  79. package/corpus/templates/slides/app/hooks/use-navigation-state.ts +20 -17
  80. package/corpus/templates/slides/app/i18n/en-US.ts +19 -10
  81. package/corpus/templates/slides/app/lib/deck-filter.ts +47 -0
  82. package/corpus/templates/slides/app/lib/export-google-slides-client.ts +15 -4
  83. package/corpus/templates/slides/app/lib/export-pptx-client.ts +637 -1
  84. package/corpus/templates/slides/app/lib/image-download.ts +84 -0
  85. package/corpus/templates/slides/app/lib/utils.ts +1 -1
  86. package/corpus/templates/slides/app/pages/DeckEditor.tsx +9 -0
  87. package/corpus/templates/slides/app/pages/Index.tsx +25 -9
  88. package/corpus/templates/slides/changelog/2026-08-13-clicking-a-slide-thumbnail-now-focuses-it-so-the-slide-shortc.md +6 -0
  89. package/corpus/templates/slides/changelog/2026-08-13-duplicating-or-restoring-a-slide-now-keeps-its-transition-ani.md +6 -0
  90. package/corpus/templates/slides/changelog/2026-08-13-opening-presentation-mode-from-the-agent-now-starts-on-the-re.md +6 -0
  91. package/corpus/templates/slides/changelog/2026-08-13-slide-transitions-can-be-set-from-a-visible-control-in-the-sl.md +6 -0
  92. package/corpus/templates/slides/netlify.toml +1 -0
  93. package/corpus/templates/slides/server/lib/builder-design-system-proxy.ts +14 -2
  94. package/dist/a2a/audience.d.ts +2 -0
  95. package/dist/a2a/audience.js +23 -0
  96. package/dist/a2a/client.d.ts +4 -0
  97. package/dist/a2a/client.js +32 -14
  98. package/dist/a2a/server.d.ts +9 -4
  99. package/dist/a2a/server.js +52 -25
  100. package/dist/a2a/types.d.ts +4 -4
  101. package/dist/agent/production-agent.js +1 -1
  102. package/dist/brand-kit/types.d.ts +10 -2
  103. package/dist/cli/code.js +1 -1
  104. package/dist/cli/index.js +30 -1
  105. package/dist/cli/native-dependencies.d.ts +24 -0
  106. package/dist/cli/native-dependencies.js +264 -0
  107. package/dist/cli/plan-local.js +1 -1
  108. package/dist/cli/skills-content/design-visual-edit-skill.d.ts +1 -1
  109. package/dist/cli/skills-content/design-visual-edit-skill.js +2 -2
  110. package/dist/cli/visualize-repo.js +1 -1
  111. package/dist/client/FeedbackButton.js +12 -12
  112. package/dist/client/agent-chat-adapter.js +3 -4
  113. package/dist/client/assistant-ui-recovery.d.ts +1 -1
  114. package/dist/client/assistant-ui-recovery.js +4 -0
  115. package/dist/client/chat/message-components.d.ts +11 -3
  116. package/dist/client/chat/message-components.js +31 -5
  117. package/dist/client/chat/tool-call-display.d.ts +2 -1
  118. package/dist/client/chat/tool-call-display.js +33 -15
  119. package/dist/client/db-admin/SqlEditor.js +1 -1
  120. package/dist/client/dev-overlay/DevOverlay.js +2 -2
  121. package/dist/client/extensions/portable-extension.js +4 -0
  122. package/dist/client/guided-questions.d.ts +8 -0
  123. package/dist/client/guided-questions.js +12 -3
  124. package/dist/client/sharing/ShareButton.js +16 -24
  125. package/dist/client/sse-event-processor.js +35 -15
  126. package/dist/client/tool-display.d.ts +9 -0
  127. package/dist/client/tool-display.js +39 -0
  128. package/dist/client/vite-dev-recovery-script.js +1 -1
  129. package/dist/collab/awareness.d.ts +2 -2
  130. package/dist/collab/routes.d.ts +1 -1
  131. package/dist/collab/struct-routes.d.ts +1 -1
  132. package/dist/extensions/html-shell.js +5 -0
  133. package/dist/notifications/routes.d.ts +1 -1
  134. package/dist/observability/routes.d.ts +3 -3
  135. package/dist/provider-api/actions/custom-provider-registration.d.ts +2 -2
  136. package/dist/server/agent-capabilities.js +0 -0
  137. package/dist/server/agent-chat/action-filters-a2a.d.ts +14 -13
  138. package/dist/server/agent-chat/action-filters-a2a.js +59 -23
  139. package/dist/server/agent-chat/prompt-resources.js +17 -16
  140. package/dist/server/agent-chat-plugin.d.ts +9 -0
  141. package/dist/server/agent-chat-plugin.js +29 -7
  142. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  143. package/dist/server/builder-design-systems.d.ts +33 -1
  144. package/dist/server/builder-design-systems.js +293 -11
  145. package/dist/server/design-token-utils.d.ts +11 -0
  146. package/dist/server/design-token-utils.js +68 -16
  147. package/dist/server/index.d.ts +1 -1
  148. package/dist/server/index.js +1 -1
  149. package/package.json +2 -2
package/dist/cli/index.js CHANGED
@@ -7,6 +7,7 @@ import { fileURLToPath } from "url";
7
7
  import * as Sentry from "@sentry/node";
8
8
  import { clearAgentNativeNitroPresetMarker, resolveAgentNativeNitroPreset, } from "../deploy/nitro-preset.js";
9
9
  import { resolveDeployPostBuildInvocation } from "./deploy-build.js";
10
+ import { assertNativeDependencies, assertNodeRuntimeMarker, ensureNativeDependencies, writeNodeRuntimeMarker, } from "./native-dependencies.js";
10
11
  import { cliSpawnOptions } from "./process.js";
11
12
  import { shouldTrackCliRun } from "./telemetry-routing.js";
12
13
  import { createCliTelemetry } from "./telemetry.js";
@@ -527,6 +528,13 @@ if (shouldTrackCliRun(command, args))
527
528
  trackCli("cli.run");
528
529
  switch (command) {
529
530
  case "dev": {
531
+ try {
532
+ ensureNativeDependencies({ repair: true, label: "dev" });
533
+ }
534
+ catch (error) {
535
+ console.error(error instanceof Error ? error.message : String(error));
536
+ process.exit(1);
537
+ }
530
538
  if (isWorkspaceRoot()) {
531
539
  import("./workspace-dev.js")
532
540
  .then((m) => m.runWorkspaceDev({ args }))
@@ -586,6 +594,7 @@ switch (command) {
586
594
  // child exits non-zero, runBuildStep calls process.exit itself; the
587
595
  // continuation only runs on success.
588
596
  (async () => {
597
+ ensureNativeDependencies({ repair: true, label: "build" });
589
598
  // Doctor pre-step: scans app source for the security-critical guard
590
599
  // invariants (see `agent-native doctor --help`). Findings fail by
591
600
  // default; only an explicit `doctor.failOnBuild: false` opt-out keeps
@@ -640,6 +649,14 @@ switch (command) {
640
649
  console.warn("[build] Deploy build script not found and no deploy preset is configured. Skipping post-build step.");
641
650
  }
642
651
  }
652
+ const serverDirectory = path.resolve(".output/server");
653
+ if (fs.existsSync(serverDirectory)) {
654
+ assertNativeDependencies({
655
+ fromDirectory: serverDirectory,
656
+ label: "build output",
657
+ });
658
+ writeNodeRuntimeMarker(serverDirectory);
659
+ }
643
660
  console.log("\nBuild complete.");
644
661
  })().catch((err) => {
645
662
  // runBuildStep handles its own failures and exits, so reaching here
@@ -662,7 +679,19 @@ switch (command) {
662
679
  console.error('No production build found. Run "agent-native build" first.');
663
680
  process.exit(1);
664
681
  }
665
- run("node", [serverEntry, ...args]);
682
+ const serverDirectory = path.dirname(serverEntry);
683
+ try {
684
+ assertNodeRuntimeMarker(serverDirectory);
685
+ assertNativeDependencies({
686
+ fromDirectory: serverDirectory,
687
+ label: "start output",
688
+ });
689
+ }
690
+ catch (error) {
691
+ console.error(error instanceof Error ? error.message : String(error));
692
+ process.exit(1);
693
+ }
694
+ run(process.execPath, [serverEntry, ...args]);
666
695
  break;
667
696
  }
668
697
  case "action": {
@@ -0,0 +1,24 @@
1
+ type NativeDependencyCheck = {
2
+ status: "absent";
3
+ packageName: string;
4
+ } | {
5
+ status: "healthy";
6
+ packageName: string;
7
+ packageDir: string;
8
+ } | {
9
+ status: "broken";
10
+ packageName: string;
11
+ packageDir: string;
12
+ error: unknown;
13
+ };
14
+ export interface NativeDependencyOptions {
15
+ fromDirectory?: string;
16
+ label?: string;
17
+ repair?: boolean;
18
+ }
19
+ export declare function checkNativeDependencies(fromDirectory?: string): NativeDependencyCheck;
20
+ export declare function ensureNativeDependencies(options?: NativeDependencyOptions): NativeDependencyCheck;
21
+ export declare function assertNativeDependencies(options?: Omit<NativeDependencyOptions, "repair">): NativeDependencyCheck;
22
+ export declare function writeNodeRuntimeMarker(serverDirectory: string): string | null;
23
+ export declare function assertNodeRuntimeMarker(serverDirectory: string): void;
24
+ export {};
@@ -0,0 +1,264 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import fs from "node:fs";
3
+ import { createRequire } from "node:module";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ const BETTER_SQLITE3 = "better-sqlite3";
7
+ const REBUILD_LOCK = ".agent-native-better-sqlite3-rebuild.lock";
8
+ const RUNTIME_MARKER = ".agent-native-node-runtime.json";
9
+ const LOCK_INITIALIZATION_TIMEOUT_MS = 5_000;
10
+ const REBUILD_WAIT_MS = 250;
11
+ const REBUILD_TIMEOUT_MS = 10 * 60 * 1000;
12
+ function corePackageDirectory() {
13
+ return path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
14
+ }
15
+ function packageRootFromManifest(packageName, manifestPath) {
16
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
17
+ return manifest.name === packageName ? path.dirname(manifestPath) : null;
18
+ }
19
+ function resolvePackageDirectory(packageName, fromDirectory) {
20
+ const requireFromDirectory = createRequire(path.join(path.resolve(fromDirectory), "package.json"));
21
+ try {
22
+ const manifestPath = requireFromDirectory.resolve(`${packageName}/package.json`);
23
+ return packageRootFromManifest(packageName, manifestPath);
24
+ }
25
+ catch {
26
+ try {
27
+ const entryPath = requireFromDirectory.resolve(packageName);
28
+ let current = path.dirname(entryPath);
29
+ while (true) {
30
+ const manifestPath = path.join(current, "package.json");
31
+ if (fs.existsSync(manifestPath)) {
32
+ const packageDir = packageRootFromManifest(packageName, manifestPath);
33
+ if (packageDir)
34
+ return packageDir;
35
+ }
36
+ const parent = path.dirname(current);
37
+ if (parent === current)
38
+ return null;
39
+ current = parent;
40
+ }
41
+ }
42
+ catch {
43
+ return null;
44
+ }
45
+ }
46
+ }
47
+ function probeBetterSqlite3(packageDir) {
48
+ try {
49
+ const requireFromPackage = createRequire(path.join(packageDir, "package.json"));
50
+ const Database = requireFromPackage(BETTER_SQLITE3);
51
+ const database = new Database(":memory:");
52
+ database.prepare("select 1 as ok").get();
53
+ database.close();
54
+ return null;
55
+ }
56
+ catch (error) {
57
+ return error;
58
+ }
59
+ }
60
+ export function checkNativeDependencies(fromDirectory = corePackageDirectory()) {
61
+ const packageDir = resolvePackageDirectory(BETTER_SQLITE3, fromDirectory);
62
+ if (!packageDir) {
63
+ return { status: "absent", packageName: BETTER_SQLITE3 };
64
+ }
65
+ const error = probeBetterSqlite3(packageDir);
66
+ return error === null
67
+ ? { status: "healthy", packageName: BETTER_SQLITE3, packageDir }
68
+ : { status: "broken", packageName: BETTER_SQLITE3, packageDir, error };
69
+ }
70
+ function errorMessage(error) {
71
+ return error instanceof Error ? error.message : String(error);
72
+ }
73
+ function npmExecutable() {
74
+ const sibling = path.join(path.dirname(process.execPath), process.platform === "win32" ? "npm.cmd" : "npm");
75
+ return fs.existsSync(sibling) ? sibling : "npm";
76
+ }
77
+ function sleepSync(milliseconds) {
78
+ const signal = new Int32Array(new SharedArrayBuffer(4));
79
+ Atomics.wait(signal, 0, 0, milliseconds);
80
+ }
81
+ function processIsRunning(pid) {
82
+ try {
83
+ process.kill(pid, 0);
84
+ return true;
85
+ }
86
+ catch (error) {
87
+ return error instanceof Error && "code" in error && error.code !== "ESRCH";
88
+ }
89
+ }
90
+ function acquireRebuildLock(packageDir, label) {
91
+ const lockPath = path.join(packageDir, REBUILD_LOCK);
92
+ const startedWaiting = Date.now();
93
+ while (true) {
94
+ try {
95
+ const lockFd = fs.openSync(lockPath, "wx");
96
+ fs.writeSync(lockFd, JSON.stringify({
97
+ pid: process.pid,
98
+ startedAt: new Date().toISOString(),
99
+ }));
100
+ return () => {
101
+ try {
102
+ fs.closeSync(lockFd);
103
+ }
104
+ finally {
105
+ try {
106
+ fs.unlinkSync(lockPath);
107
+ }
108
+ catch (error) {
109
+ if (!(error instanceof Error &&
110
+ "code" in error &&
111
+ error.code === "ENOENT")) {
112
+ throw error;
113
+ }
114
+ }
115
+ }
116
+ };
117
+ }
118
+ catch (error) {
119
+ if (!(error instanceof Error && "code" in error && error.code === "EEXIST")) {
120
+ throw error;
121
+ }
122
+ let ownerPid = null;
123
+ let lockAge = 0;
124
+ try {
125
+ const lock = JSON.parse(fs.readFileSync(lockPath, "utf8"));
126
+ ownerPid = typeof lock.pid === "number" ? lock.pid : null;
127
+ }
128
+ catch {
129
+ // The owner may be between creating and writing the lock metadata.
130
+ }
131
+ try {
132
+ lockAge = Date.now() - fs.statSync(lockPath).mtimeMs;
133
+ }
134
+ catch {
135
+ continue;
136
+ }
137
+ if ((ownerPid !== null && !processIsRunning(ownerPid)) ||
138
+ (ownerPid === null && lockAge > LOCK_INITIALIZATION_TIMEOUT_MS)) {
139
+ try {
140
+ fs.unlinkSync(lockPath);
141
+ continue;
142
+ }
143
+ catch (unlinkError) {
144
+ if (!(unlinkError instanceof Error &&
145
+ "code" in unlinkError &&
146
+ unlinkError.code === "ENOENT")) {
147
+ throw unlinkError;
148
+ }
149
+ continue;
150
+ }
151
+ }
152
+ if (Date.now() - startedWaiting > REBUILD_TIMEOUT_MS) {
153
+ throw new Error(`[${label}] Timed out waiting for another process to finish rebuilding ${BETTER_SQLITE3}.`);
154
+ }
155
+ sleepSync(REBUILD_WAIT_MS);
156
+ }
157
+ }
158
+ }
159
+ function rebuildNativeDependency(packageDir) {
160
+ execFileSync(npmExecutable(), ["run", "build-release", "--prefix", packageDir], {
161
+ cwd: packageDir,
162
+ stdio: "inherit",
163
+ shell: process.platform === "win32",
164
+ });
165
+ }
166
+ function brokenDependencyMessage(check, label) {
167
+ return [
168
+ `[${label}] ${check.packageName} cannot load its native binding.`,
169
+ `Package: ${check.packageDir}`,
170
+ `Node: ${process.version} (ABI ${process.versions.modules}, ${process.platform}-${process.arch})`,
171
+ `Original error: ${errorMessage(check.error)}`,
172
+ "The installed native binary was built for a different Node runtime or is otherwise stale.",
173
+ ].join("\n");
174
+ }
175
+ export function ensureNativeDependencies(options = {}) {
176
+ const label = options.label ?? "native preflight";
177
+ const check = checkNativeDependencies(options.fromDirectory);
178
+ if (check.status !== "broken")
179
+ return check;
180
+ if (!options.repair) {
181
+ throw new Error(brokenDependencyMessage(check, label));
182
+ }
183
+ console.warn(`${brokenDependencyMessage(check, label)}\n[${label}] Rebuilding it with the current Node runtime...`);
184
+ const releaseLock = acquireRebuildLock(check.packageDir, label);
185
+ try {
186
+ const current = checkNativeDependencies(options.fromDirectory);
187
+ if (current.status === "healthy")
188
+ return current;
189
+ if (current.status !== "broken") {
190
+ throw new Error(`[${label}] ${BETTER_SQLITE3} disappeared before its native rebuild.`);
191
+ }
192
+ rebuildNativeDependency(current.packageDir);
193
+ const repaired = checkNativeDependencies(options.fromDirectory);
194
+ if (repaired.status === "healthy") {
195
+ console.log(`[${label}] ${repaired.packageName} is ready for Node ABI ${process.versions.modules}.`);
196
+ return repaired;
197
+ }
198
+ if (repaired.status === "broken") {
199
+ throw new Error(brokenDependencyMessage(repaired, label));
200
+ }
201
+ throw new Error(`[${label}] ${BETTER_SQLITE3} disappeared after its native rebuild.`);
202
+ }
203
+ finally {
204
+ releaseLock();
205
+ }
206
+ }
207
+ export function assertNativeDependencies(options = {}) {
208
+ const check = checkNativeDependencies(options.fromDirectory);
209
+ if (check.status === "broken") {
210
+ throw new Error(brokenDependencyMessage(check, options.label ?? "runtime"));
211
+ }
212
+ return check;
213
+ }
214
+ export function writeNodeRuntimeMarker(serverDirectory) {
215
+ if (!fs.existsSync(serverDirectory))
216
+ return null;
217
+ const markerPath = path.join(serverDirectory, RUNTIME_MARKER);
218
+ const marker = {
219
+ nodeVersion: process.version,
220
+ nodeAbi: process.versions.modules,
221
+ platform: process.platform,
222
+ arch: process.arch,
223
+ };
224
+ fs.writeFileSync(markerPath, `${JSON.stringify(marker)}\n`);
225
+ return markerPath;
226
+ }
227
+ export function assertNodeRuntimeMarker(serverDirectory) {
228
+ const markerPath = path.join(serverDirectory, RUNTIME_MARKER);
229
+ if (!fs.existsSync(markerPath))
230
+ return;
231
+ let marker;
232
+ try {
233
+ marker = JSON.parse(fs.readFileSync(markerPath, "utf8"));
234
+ }
235
+ catch (error) {
236
+ throw new Error(`[runtime] Could not read ${RUNTIME_MARKER}: ${errorMessage(error)}`);
237
+ }
238
+ const mismatches = [
239
+ marker.nodeAbi !== process.versions.modules
240
+ ? `Node ABI ${marker.nodeAbi} (build) vs ${process.versions.modules} (runtime)`
241
+ : null,
242
+ marker.platform !== process.platform
243
+ ? `platform ${marker.platform} (build) vs ${process.platform} (runtime)`
244
+ : null,
245
+ marker.arch !== process.arch
246
+ ? `architecture ${marker.arch} (build) vs ${process.arch} (runtime)`
247
+ : null,
248
+ ].filter((value) => value !== null);
249
+ if (mismatches.length > 0) {
250
+ throw new Error([
251
+ `[runtime] Production output was built for a different Node runtime: ${mismatches.join(", ")}.`,
252
+ `Build Node: ${marker.nodeVersion}; runtime Node: ${process.version}.`,
253
+ "Run the build and start commands with the same Node installation.",
254
+ ].join("\n"));
255
+ }
256
+ }
257
+ function isDirectExecution() {
258
+ const entryPoint = process.argv[1];
259
+ return (entryPoint !== undefined &&
260
+ path.resolve(entryPoint) === path.resolve(fileURLToPath(import.meta.url)));
261
+ }
262
+ if (isDirectExecution() && process.argv.includes("--repair")) {
263
+ ensureNativeDependencies({ repair: true, label: "native repair" });
264
+ }
@@ -2169,7 +2169,7 @@ async function runServe(args) {
2169
2169
  bridgeUrl: bridge.result.bridgeUrl,
2170
2170
  }),
2171
2171
  "Keep this bridge command running while the Plan page is open; stopping it makes this URL unreachable.",
2172
- "Press Ctrl+C to stop.",
2172
+ "Press Ctrl C to stop.",
2173
2173
  ]
2174
2174
  .filter(Boolean)
2175
2175
  .join("\n") + "\n");
@@ -1 +1 @@
1
- export declare const DESIGN_VISUAL_EDIT_SKILL_MD = "---\nname: visual-edit\ndescription: >-\n Open a running local app in Design overview mode as URL-backed iframe screens\n for visual editing, flow review, duplication, and route-state exploration.\n Use when the user asks to inspect, compare, or edit a real local app visually\n in Design.\nmetadata:\n visibility: exported\n---\n\n# Visual Edit\n\nUse `/visual-edit` when the user wants to inspect or edit a real local app\nvisually instead of generating standalone Alpine HTML. The source of truth is\nthe running localhost app plus its route URLs. Design shows those routes as\niframe-backed screens on the infinite canvas.\n\n## Installing this skill for an external MCP host\n\nThe hosted install path\n(`npx @agent-native/core@latest skills add visual-edit`, or `design` for the\nfull Design bundle) installs the exported instructions and registers the\nhosted Design MCP connector together. The open Skills CLI path\n(`npx skills@latest add BuilderIO/agent-native --skill visual-edit`) installs\nexported instructions only, with no MCP connector registration.\n\n## Put Design Beside The Chat\n\nPrefer the interactive MCP App returned by `open-visual-edit` when the coding\nhost renders it. The user gets the Design canvas beside the conversation, and\n**Apply design updates** can submit the bounded source-edit handoff back to the\ncurrent host conversation through the standard MCP Apps message bridge. The\nhost may ask the user to confirm the current conversation or choose a new one.\n\nOtherwise, `openUrl` is a credential-free, read-only fallback that is safe to\nshow in model text or retain in logs. Do not claim that fallback is editable:\nthe edit capability is intentionally available only to the host-managed MCP App\nlauncher, where it is hidden from the model and redeemed once.\n\n- In Codex Desktop, prefer the rendered MCP App. Use the in-app Browser for the\n credential-free `openUrl` only when a read-only fallback is acceptable.\n- In Claude Code Desktop's Code tab, prefer the rendered MCP App. Preview\n `openUrl` in the Browser pane only as the read-only fallback.\n- In VS Code, use the Agent Native Design webview/deep link described below.\n- Inline browser availability is host-dependent. CLI, remote, or restricted\n sessions may not expose one. If the inline surface is unavailable or disabled,\n return the normal **Open design** link instead of claiming it opened.\n\nPrefer the MCP App surface for a connected Design plugin, then the host's\nbrowser/preview tool as the universal fallback. Keep the canvas beside chat\nwhen the host supports rearrangeable panes.\n\nInside Design, use **Show/Hide UI** from the `Cmd+K` menu or press Figma's\n`Shift+\\` shortcut to toggle all editing chrome so only the canvas remains.\nThe same action is available from Design's empty-canvas context menu.\n\n## Core Model\n\n- Each screen is a URL-backed iframe, not copied HTML.\n- Each screen keeps URL metadata: `connectionId`, `routeId`, `path`,\n `url`, `bridgeUrl`, title, and viewport size.\n- Localhost Edit mode renders the running app through the local bridge as a live\n iframe with the same editor bridge used by HTML designs. It is never a frozen\n static DOM snapshot. Editing is direct DOM manipulation against that live\n document; the parallel `/snapshot` fetch feeds the editable source model only\n and must never be rendered in the frame.\n- **The `/visual-edit` skill needs no Design account sign-in.**\n `open-visual-edit` mints a five-minute, single-use capability for the exact\n `/visual-edit/:designId` local-editor route. The MCP host redeems it outside\n model-visible text, then opens the existing editor with localhost edit access.\n This capability is not an account session: `/_agent-native/session` remains\n signed out, and account-backed save/share/generate actions remain denied.\n- The skill enters through local `pnpm action open-visual-edit`. When that CLI\n has no account session, the action uses a stable, workspace-scoped local\n principal to register the bridge, create/reuse the local design, and place\n screens. That principal exists only inside the in-process CLI call; it is not\n a browser login and cannot be selected by an HTTP, MCP, or tunneled caller.\n- Public links are always read-only, including on loopback. Loopback peer\n identity is not an authentication boundary because a tunnel or reverse proxy\n can make a remote request appear local. A bare `/visual-edit/:designId` or\n `/design/:designId` URL carries no capability and must never release the\n connection's `previewToken`.\n- The live editor is same-origin through the local bridge proxy. This boots\n CSR apps and root-relative assets, but it is still a localhost editing proxy:\n app-origin cookies, WebSockets/HMR, SSE, and non-GET app API calls may need a\n future dev-server/plugin integration for perfect parity with the app's own\n origin.\n- **There are exactly two views.** The infinite canvas is where all editing\n happens, and the responsive interactive view (Interact) is where the app runs\n for real. There is no third \"full view\"/focused-edit state \u2014 clicking a screen\n in the Screens list, or the view toggle, opens the responsive view, and\n closing it returns to the canvas.\n- Interact keeps the left and right rails and adds a device bar above the canvas\n (device preset, editable width/height, zoom, close). It renders the app's\n normal URL so navigation, scrolling, links, and form controls behave as they\n would in the browser, and the wheel scrolls the app rather than panning the\n canvas. The canvas view is the opposite: the wheel pans and zooms it, and\n native interaction inside the frame is suppressed.\n- While a localhost screen has pending live visual edits, do not switch back to\n Interact until the user either applies the edits to source or explicitly\n aborts/discards the preview.\n- Alt-drag duplicates a screen. For localhost screens, duplication copies the\n iframe frame and URL metadata; change the copy's path/query for a new state.\n- Flow visualization is multiple URL states: `/checkout?step=shipping`,\n `/checkout?step=payment`, `/checkout?step=done`, etc.\n- When the user gives a named flow or numbered screen list, preserve that order\n and create one screen per URL/path. Shorthand like\n `localhost:1234/onboarding/1` means\n `http://localhost:1234/onboarding/1`.\n\n## Useful Canvas Sets\n\nTranslate the user's requested review into the smallest useful set of frames:\n\n- **Multi-step flow:** one ordered frame per route or query state, such as cart,\n shipping, payment, and confirmation.\n- **Multiple pages:** one frame per meaningful route, such as home, pricing,\n docs, and account settings.\n- **Responsive comparison:** repeat the same route at the requested desktop,\n tablet, and mobile viewports so they align in one row.\n- **State review:** repeat a route for meaningful URL-addressable states such as\n empty, loading, error, modal-open, or selected-item views.\n\nDo not expand every discovered route or every viewport unless the user asks for\nan exhaustive audit. Preserve the user's labels and sequence so the canvas reads\nlike the workflow they described.\n\n## Select And Reprompt\n\nWhen a chat message begins with `[Reprompt selection]`, the selected subtree is\na hard write boundary. The only mutation path is `propose-node-rewrite` with\nthe exact `repromptId`, target, and `baseVersionHash` captured in\n`design-reprompt-pending:<designId>:<fileId>`. Never use `apply-visual-edit`,\n`apply-source-edit`, `write-source`, `write-local-file`, `edit-design`, or any\nother content-writing action for that request. Clarifying questions are allowed,\nbut a requested change must remain a proposal.\n\nProduce one variant by default. Produce two or three only when the instruction\nasks for options. A retry includes `priorProposalId`; keep the same target and\nbase version, incorporate the feedback, and call `propose-node-rewrite` again.\nThe UI previews the returned subtree without persisting it.\n\nUse `resolve-node-rewrite` for the accept/reject lifecycle. Accept applies the\nchosen variant as one version-checked inline/Yjs content transaction so one\nundo restores the prior structure; reject clears the proposal without changing\ncontent. For conversational resolution such as \"apply the second one,\" call\n`view-screen`, read the active `design.reprompt.proposal`, and pass its\n`proposalId` plus the zero-based `variantIndex` to `resolve-node-rewrite`.\n\n## Review Quality\n\n- Treat the running app as the truth. Preserve its component language, tokens,\n route state, and real content unless the user explicitly asks for a new visual\n direction.\n- Use multiple URL states to reveal meaningful UX moments: empty/loading/error\n states, focused panels, modals, responsive breakpoints, and completed flow\n steps when those matter to the review.\n- For visual edits, compare before/after at the relevant viewport sizes and\n check key hover/focus/scroll states when the app exposes them.\n\n## Account And Sharing Model\n\n- `/visual-edit/:id` is the dedicated local-editor surface. The one-time\n handoff returned by `open-visual-edit` opens it with edit access without a\n Design login. A copied or bare `/visual-edit/:id` URL is read-only because it\n does not carry the capability.\n- The capability permits live iframe inspection and session-local edits,\n undo/redo, **Apply design updates** through the connected host/local agent,\n and **Copy prompt**. Those flows hand bounded source instructions back to the\n coding agent; they do not silently persist account-owned Design data.\n- Public `/design/:id` links stay read-only without a signed-in owner/editor\n session. Never use the local capability to upgrade that ordinary sharing\n surface.\n- Prefer links returned by Design actions or `/_agent-native/open` deep links.\n Do not surface URLs with `_session=` tokens or hand-build capability URLs.\n- Do not attempt account-backed write actions with the browser capability. The\n trusted local `open-visual-edit` CLI call may register its bridge, create or\n reuse its workspace-owned local design, and place screens without an account.\n Direct source-file action writes, generation, saving into an account, and\n sharing still require an authenticated action caller. If a signed-out visitor\n wants those durable account operations, send them through the framework\n sign-in return flow first.\n\n## Required Local Bridge\n\nThe live-edit bridge is unlocked by a shared secret (the \"bridge token\") that\nmust match on two sides: the local bridge process, and the user's connection row\nin Design (which the browser reads to authorize `/live-edit-bridge`,\n`/read-file`, `/write-file`). Get them to match by letting the\n`open-visual-edit` action mint the token, then starting the\nbridge with it. This is the only ordering that works for the remote-MCP flow \u2014\nthe bridge cannot push its own token to the server without a CLI auth token, so\nthe server mints instead and the bridge adopts.\n\nFrom the target app repo, make sure its dev server is running, then:\n\n**1. Discover routes without starting a durable bridge** (one-shot, exits):\n\n```bash\nnpx @agent-native/core@latest design connect --url http://localhost:5173 --root . --json\n```\n\nThis prints the manifest (routes + capabilities). Parse it to build\n`routeManifest` for the next step. (Skip this if the user already gave explicit\npaths/URLs to place.)\n\nInside the agent-native monorepo itself, use the workspace CLI instead of\n`npx` \u2014 `npx` installs the last published `@agent-native/core`, which will not\ncontain local changes and costs a slow install on every call:\n\n```bash\npnpm dev:cli design connect --url http://localhost:5173 --root templates/<app> --json\n```\n\n**2. Call `open-visual-edit`** (see Action Flow below) with NO `bridgeToken`.\nThe server mints one, stores it on the user's connection row, copies it into the\nplaced screens' metadata, and returns it to you as `bridgeToken`. Capture it.\n\n**3. Start the persistent bridge adopting that token** (single line; prefer the\nenv var so the secret does not appear in `ps`):\n\n```bash\nAGENT_NATIVE_BRIDGE_TOKEN=\"<bridgeToken from step 2>\" npx @agent-native/core@latest design connect --url http://localhost:5173 --root . --daemon\n```\n\n(Equivalently, pass `--bridge-token <token>`.) This starts a detached bridge on\n`http://127.0.0.1:7331`, adopts the server-minted token \u2014 so bridge and row\nagree and live-edit authorizes with no self-registration \u2014 and stays alive after\nthe command exits.\n\nFor a manual health/manifest check on the running bridge:\n\n```bash\ncurl http://127.0.0.1:7331/health\n```\n\n`/health` needs no token. The full manifest at `/manifest.json` is\npreview-token protected, so an unauthenticated `curl` of it returns\n`{\"ok\":false,\"error\":\"invalid or missing preview token\"}` \u2014 that response means\nthe bridge is up, not that it is broken.\n\nOnly use `--json` for the step-1 route probe. Never use `--json`, `--once`,\nor `--dry-run` for the durable step-3 bridge: they print the manifest and exit,\nso Design falls back to a non-editable live iframe.\n\nThe bridge listens on a single fixed port (7331) and refuses to start for a\nsecond, different app. It is detached with no log file, so if `--daemon` reports\na timeout, check for a stale process (`lsof -ti:7331`) before retrying.\n\n## Action Flow\n\nPrefer the single `open-visual-edit` action. It registers or\nrefreshes the localhost bridge connection, mints and stores the bridge token,\ncreates or reuses a Design project, places URL-backed screens, stores the active\nvisual-edit context, and navigates to overview mode in one call. This avoids\ncreating a private design under a synthetic CLI user and then handing the browser\na tokenized URL that may be shadowed by an existing session.\n\nCall it BEFORE starting the durable bridge (step 3 above): it does not contact\nthe bridge, so the bridge need not be running yet, and you need its returned\n`bridgeToken` to start the bridge with a matching secret. Omit `bridgeToken`\non the call so the server mints one.\n\n```bash\npnpm action open-visual-edit '{\n \"title\": \"Docs homepage visual edit\",\n \"devServerUrl\": \"http://localhost:5173\",\n \"bridgeUrl\": \"http://127.0.0.1:7331\",\n \"rootPath\": \"/absolute/path/to/app\",\n \"routeManifest\": { \"...\": \"from /manifest.json\" },\n \"paths\": [\"/\", \"/pricing\", \"/checkout?step=payment\"]\n}'\n```\n\nThe action returns `designId`, `connectionId`, `bridgeToken`, `screens`,\n`urlPath`, and a credential-free `openUrl`. Its MCP App metadata separately\ncarries the one-time editor launcher so the host can redeem it without showing\nthe capability to the model or retaining it in the action link. Keep\n`designId`/`connectionId` in the chat context for follow-ups, and pass\n`bridgeToken` to `design connect` (step 3) to start the bridge. On follow-up\ncalls reusing an existing `connectionId`, the same token is returned (it is\nminted once and reused), so the running bridge stays valid.\n\n### Desktop and mobile side by side\n\nPass `viewports` to place every requested route once per viewport. Frames lay\nout as a grid: one row per route, one column per viewport. Presets are\n`desktop` (1280x900), `laptop` (1440x900), `tablet` (834x1112), and `mobile`\n(390x844); an explicit `{ \"label\": \"...\", \"width\": N, \"height\": N }` also works.\n\n```bash\npnpm action open-visual-edit '{\n \"title\": \"Tasks responsive visual edit\",\n \"devServerUrl\": \"http://localhost:5173\",\n \"bridgeUrl\": \"http://127.0.0.1:7331\",\n \"rootPath\": \"/absolute/path/to/app\",\n \"paths\": [\"/tasks\", \"/inbox\"],\n \"viewports\": [\"desktop\", \"mobile\"]\n}'\n```\n\nPrefer this over two separate calls with `defaultWidth`/`defaultHeight`: it\nkeeps each route's viewports aligned in a row and titles them\n`Tasks \u2014 Desktop` / `Tasks \u2014 Mobile` so the canvas reads clearly. `viewports`\noverrides `defaultWidth`/`defaultHeight`. With no `routes`/`paths`, it expands\nevery route in the localhost manifest, which is usually far more frames than\nthe user wants \u2014 name the paths.\n\n### Adding more page frames later\n\nCall `open-visual-edit` again with the same `designId` and `connectionId` and\nonly the new paths. Existing frames for the same route and viewport are\nrefreshed in place rather than duplicated, and a frame the user has dragged or\nresized keeps its position unless you explicitly pass `x`/`y`/`width`/`height`.\n\n```bash\npnpm action open-visual-edit '{\n \"designId\": \"<existing-design-id>\",\n \"connectionId\": \"<existing-connection-id>\",\n \"devServerUrl\": \"http://localhost:5173\",\n \"paths\": [\"/settings\", \"/team\"],\n \"startY\": 2200\n}'\n```\n\nDo NOT add `defaultWidth`/`defaultHeight` just to restate the default size:\nsupplying either one marks the viewport as explicitly requested, which\noverwrites frame sizes the user has already adjusted on the canvas.\n\nFor a numbered flow the user describes in chat, keep the labels and order:\n\n```bash\npnpm action open-visual-edit '{\n \"designId\": \"<existing-design-id>\",\n \"connectionId\": \"<existing-connection-id>\",\n \"devServerUrl\": \"http://localhost:1234\",\n \"routes\": [\n { \"url\": \"localhost:1234/onboarding/1\", \"title\": \"Screen 1\" },\n { \"url\": \"localhost:1234/onboarding/2\", \"title\": \"Screen 2\" },\n { \"url\": \"localhost:1234/onboarding/3\", \"title\": \"Screen 3\" }\n ]\n}'\n```\n\nIf no `routes` or `paths` are supplied, `open-visual-edit` uses every route\nfrom the localhost manifest.\n\nFallback, only when `open-visual-edit` is unavailable:\n\n1. Register or refresh the bridge with `connect-localhost`, passing the\n `/manifest.json` result as `routeManifest` and `capabilities`.\n2. Create or reuse a Design project with `create-design`.\n3. Place URL-backed screens with `add-localhost-screens`.\n4. Navigate to overview mode with `navigate`.\n\n## Open The Design Surface\n\n- Use the `link`, `deepLink`, or MCP App embed returned by Design actions so\n the user sees the canvas. Follow **Put Design Beside The Chat**: prefer the\n MCP App; otherwise surface the credential-free **Open design** link.\n- Return or open the MCP App first. Its host-managed launcher carries the\n one-time local-editor capability. The credential-free `openUrl` / action link\n is the safe read-only fallback; never build a capability URL yourself.\n- Never return or open a hand-built `/design/:id?_session=...` URL.\n- If the user is working in VS Code, the Agent Native extension can open the\n same URL via\n `vscode://builder.agent-native/open?url=<encoded-design-url>`. Its\n `Agent Native: Open Design Canvas` command also starts the local bridge and\n opens hosted Design in the VS Code side panel.\n- After `open-visual-edit`, confirm the Design editor is in overview mode\n with the requested URL-backed frames visible, and that they render the app\n rather than a spinner. Do not stop at \"screens added\" when the user asked to\n inspect or edit visually.\n\n## Applying Visual Edits Back To Source\n\nCanvas edits on a localhost screen do not write source as you make them. They\naccumulate as pending edits and the editor shows an **Apply design updates**\nbutton on the canvas. In an MCP App, clicking it hands the bounded structured\nprompt to the current host coding conversation. In an ordinary browser or\nstandalone Design page, it falls back to the local Design agent. The dropdown's\n**Copy prompt to your agent** action is the universal manual fallback.\n\n- Style, text, and drag/drop structure edits all collect into the same pending\n batch, so the user can make several changes and apply once.\n- After the write lands, the target app's own dev-server HMR refreshes the\n frames \u2014 no manual reload. If frames do not refresh, the write did not land;\n say so rather than assuming.\n- The separate disk-icon \"Apply to source\" button is the deterministic\n whole-file HTML/CSS writer. It is intentionally disabled for compiled\n `.jsx`/`.tsx` routes \u2014 those must go through the agent path above.\n\n## Editing URLs\n\nKeep localhost screens as URL files plus `screenMetadata[fileId]`. Do not\nreplace them with copied `srcdoc` HTML unless the user explicitly asks for a\nfrozen snapshot. To change a state, rerun `open-visual-edit` with the new\npath/query or duplicate the screen and update the copy's URL metadata.\n\n## Local Files in the Code Tab\n\nOnce a connection is registered, the design editor's Code panel (left rail \u2192\nCode, or `navigate --view editor --designId <id> --leftPanel code`) shows a\nlocal-files workspace root for that connection next to the design's own files.\nTreat that root like VS Code opened at the connected project directory: file\ntree, search, open/edit, and save are backed by the real local files. It lists\nthe connected app's text/code files through the bridge\n(`list-local-files` / `read-local-file`); build output, `node_modules`,\n`.git`, and secret-looking paths (`.env*`, key files) are always excluded.\n\n- Browsing and reading need only editor access on the design plus the running\n bridge.\n- Saving goes through `write-local-file`: the first save opens the\n write-consent dialog (an 8-hour, folder-scoped grant) and retries\n automatically once granted. Only text/code files are writable; secret paths\n are always blocked.\n- If the agent calls `write-local-file` directly (not through a UI save) and it\n fails with \"no write-consent grant\", call `request-localhost-write-consent`.\n It opens the write-consent dialog in the editor, or reports `alreadyGranted`\n if one already exists. Granting is human-only \u2014\n `grant-localhost-write-consent` is hidden from agents, so you cannot approve\n it yourself. Tell the user to click \"Allow writes\", then retry\n `write-local-file` once. Do not keep retrying blindly: the write stays\n blocked until the user approves.\n- Saves are conflict-checked against the file's on-disk version \u2014 a file that\n changed since it was read fails with a version conflict instead of being\n overwritten.\n\n## React Source Writeback\n\n- Use compiler/debug provenance (project-relative file, line, column,\n component, and runtime multiplicity) to locate React/TSX source. Treat it as\n evidence, not as permission for a generic AST structural transform.\n- Read `positionPrecision` on every anchor before you trust `line`/`column`.\n `authored` means those are the real JSX coordinates. `transformed` means they\n are the dev server's own output coordinates \u2014 React 19 removed `_debugSource`\n and exposes only an owner stack, so this is the normal case on a Vite/Next\n dev server, and the line will not match the file. `unknown` means no tier was\n reported. On anything but `authored`, use the file and component to find the\n element by its JSX shape and re-derive the line from the file you read; never\n edit at the reported line.\n- A single-instance leaf text edit, literal `className`/`class` edit, or flat\n literal `style={{ ... }}` property may use `apply-visual-edit` with a\n `local-file` source and a complete `target.sourceAnchor`. Forward the\n anchor's `positionPrecision` with it \u2014 the action refuses a `transformed`\n anchor with `status: \"needsAgent\"` instead of seeking to a line that means\n something else in the authored file. Preview first (omit `persist`), inspect\n `proposedDiff`, then call with `persist: true`.\n- Reparenting, grouping/ungrouping, wrappers, dynamic expressions, repeated\n `.map()` instances, shared components, breakpoint-scoped edits, and\n cross-file changes go through the coding agent with complete subject/target\n anchors and their runtime relationship. `apply-visual-edit` refuses these\n with `status: \"needsAgent\"` rather than guessing.\n- Before each write, read the file and pass its exact `versionHash` to\n `write-local-file` with `requireExpectedVersionHash: true`; on conflict,\n re-read and re-plan. Keep the optimistic preview until HMR/runtime confirms\n the result. Human write consent remains mandatory and agents cannot grant it.\n\n## Verification\n\n- `list-localhost-connections` returns the expected connection and routes.\n- The Design editor opens in overview mode.\n- Every requested screen renders the intended localhost URL, showing real app\n content rather than an endless loading spinner.\n- The screen iframe carries a `src`, not a `srcdoc`. A localhost screen with a\n `srcdoc` is a bug, not a slow load \u2014 check it in the browser devtools before\n reporting the canvas as working.\n- Alt-dragging a screen copies the URL-backed frame, not an inline HTML clone.\n- A query/path edit changes only the target screen's URL metadata and iframe.\n- The Code tab shows a local-files root for the connection and opens its files.\n";
1
+ export declare const DESIGN_VISUAL_EDIT_SKILL_MD = "---\nname: visual-edit\ndescription: >-\n Open a running local app in Design overview mode as URL-backed iframe screens\n for visual editing, flow review, duplication, and route-state exploration.\n Use when the user asks to inspect, compare, or edit a real local app visually\n in Design.\nmetadata:\n visibility: exported\n---\n\n# Visual Edit\n\nUse `/visual-edit` when the user wants to inspect or edit a real local app\nvisually instead of generating standalone Alpine HTML. The source of truth is\nthe running localhost app plus its route URLs. Design shows those routes as\niframe-backed screens on the infinite canvas.\n\n## Installing this skill for an external MCP host\n\nThe hosted install path\n(`npx @agent-native/core@latest skills add visual-edit`, or `design` for the\nfull Design bundle) installs the exported instructions and registers the\nhosted Design MCP connector together. The open Skills CLI path\n(`npx skills@latest add BuilderIO/agent-native --skill visual-edit`) installs\nexported instructions only, with no MCP connector registration.\n\n## Put Design Beside The Chat\n\nPrefer the interactive MCP App returned by `open-visual-edit` when the coding\nhost renders it. The user gets the Design canvas beside the conversation, and\n**Apply design updates** can submit the bounded source-edit handoff back to the\ncurrent host conversation through the standard MCP Apps message bridge. The\nhost may ask the user to confirm the current conversation or choose a new one.\n\nOtherwise, `openUrl` is a credential-free, read-only fallback that is safe to\nshow in model text or retain in logs. Do not claim that fallback is editable:\nthe edit capability is intentionally available only to the host-managed MCP App\nlauncher, where it is hidden from the model and redeemed once.\n\n- In Codex Desktop, prefer the rendered MCP App. Use the in-app Browser for the\n credential-free `openUrl` only when a read-only fallback is acceptable.\n- In Claude Code Desktop's Code tab, prefer the rendered MCP App. Preview\n `openUrl` in the Browser pane only as the read-only fallback.\n- In VS Code, use the Agent Native Design webview/deep link described below.\n- Inline browser availability is host-dependent. CLI, remote, or restricted\n sessions may not expose one. If the inline surface is unavailable or disabled,\n return the normal **Open design** link instead of claiming it opened.\n\nPrefer the MCP App surface for a connected Design plugin, then the host's\nbrowser/preview tool as the universal fallback. Keep the canvas beside chat\nwhen the host supports rearrangeable panes.\n\nInside Design, use **Show/Hide UI** from the `Cmd K` menu or press Figma's\n`Shift \\` shortcut to toggle all editing chrome so only the canvas remains.\nThe same action is available from Design's empty-canvas context menu.\n\n## Core Model\n\n- Each screen is a URL-backed iframe, not copied HTML.\n- Each screen keeps URL metadata: `connectionId`, `routeId`, `path`,\n `url`, `bridgeUrl`, title, and viewport size.\n- Localhost Edit mode renders the running app through the local bridge as a live\n iframe with the same editor bridge used by HTML designs. It is never a frozen\n static DOM snapshot. Editing is direct DOM manipulation against that live\n document; the parallel `/snapshot` fetch feeds the editable source model only\n and must never be rendered in the frame.\n- **The `/visual-edit` skill needs no Design account sign-in.**\n `open-visual-edit` mints a five-minute, single-use capability for the exact\n `/visual-edit/:designId` local-editor route. The MCP host redeems it outside\n model-visible text, then opens the existing editor with localhost edit access.\n This capability is not an account session: `/_agent-native/session` remains\n signed out, and account-backed save/share/generate actions remain denied.\n- The skill enters through local `pnpm action open-visual-edit`. When that CLI\n has no account session, the action uses a stable, workspace-scoped local\n principal to register the bridge, create/reuse the local design, and place\n screens. That principal exists only inside the in-process CLI call; it is not\n a browser login and cannot be selected by an HTTP, MCP, or tunneled caller.\n- Public links are always read-only, including on loopback. Loopback peer\n identity is not an authentication boundary because a tunnel or reverse proxy\n can make a remote request appear local. A bare `/visual-edit/:designId` or\n `/design/:designId` URL carries no capability and must never release the\n connection's `previewToken`.\n- The live editor is same-origin through the local bridge proxy. This boots\n CSR apps and root-relative assets, but it is still a localhost editing proxy:\n app-origin cookies, WebSockets/HMR, SSE, and non-GET app API calls may need a\n future dev-server/plugin integration for perfect parity with the app's own\n origin.\n- **There are exactly two views.** The infinite canvas is where all editing\n happens, and the responsive interactive view (Interact) is where the app runs\n for real. There is no third \"full view\"/focused-edit state \u2014 clicking a screen\n in the Screens list, or the view toggle, opens the responsive view, and\n closing it returns to the canvas.\n- Interact keeps the left and right rails and adds a device bar above the canvas\n (device preset, editable width/height, zoom, close). It renders the app's\n normal URL so navigation, scrolling, links, and form controls behave as they\n would in the browser, and the wheel scrolls the app rather than panning the\n canvas. The canvas view is the opposite: the wheel pans and zooms it, and\n native interaction inside the frame is suppressed.\n- While a localhost screen has pending live visual edits, do not switch back to\n Interact until the user either applies the edits to source or explicitly\n aborts/discards the preview.\n- Alt-drag duplicates a screen. For localhost screens, duplication copies the\n iframe frame and URL metadata; change the copy's path/query for a new state.\n- Flow visualization is multiple URL states: `/checkout?step=shipping`,\n `/checkout?step=payment`, `/checkout?step=done`, etc.\n- When the user gives a named flow or numbered screen list, preserve that order\n and create one screen per URL/path. Shorthand like\n `localhost:1234/onboarding/1` means\n `http://localhost:1234/onboarding/1`.\n\n## Useful Canvas Sets\n\nTranslate the user's requested review into the smallest useful set of frames:\n\n- **Multi-step flow:** one ordered frame per route or query state, such as cart,\n shipping, payment, and confirmation.\n- **Multiple pages:** one frame per meaningful route, such as home, pricing,\n docs, and account settings.\n- **Responsive comparison:** repeat the same route at the requested desktop,\n tablet, and mobile viewports so they align in one row.\n- **State review:** repeat a route for meaningful URL-addressable states such as\n empty, loading, error, modal-open, or selected-item views.\n\nDo not expand every discovered route or every viewport unless the user asks for\nan exhaustive audit. Preserve the user's labels and sequence so the canvas reads\nlike the workflow they described.\n\n## Select And Reprompt\n\nWhen a chat message begins with `[Reprompt selection]`, the selected subtree is\na hard write boundary. The only mutation path is `propose-node-rewrite` with\nthe exact `repromptId`, target, and `baseVersionHash` captured in\n`design-reprompt-pending:<designId>:<fileId>`. Never use `apply-visual-edit`,\n`apply-source-edit`, `write-source`, `write-local-file`, `edit-design`, or any\nother content-writing action for that request. Clarifying questions are allowed,\nbut a requested change must remain a proposal.\n\nProduce one variant by default. Produce two or three only when the instruction\nasks for options. A retry includes `priorProposalId`; keep the same target and\nbase version, incorporate the feedback, and call `propose-node-rewrite` again.\nThe UI previews the returned subtree without persisting it.\n\nUse `resolve-node-rewrite` for the accept/reject lifecycle. Accept applies the\nchosen variant as one version-checked inline/Yjs content transaction so one\nundo restores the prior structure; reject clears the proposal without changing\ncontent. For conversational resolution such as \"apply the second one,\" call\n`view-screen`, read the active `design.reprompt.proposal`, and pass its\n`proposalId` plus the zero-based `variantIndex` to `resolve-node-rewrite`.\n\n## Review Quality\n\n- Treat the running app as the truth. Preserve its component language, tokens,\n route state, and real content unless the user explicitly asks for a new visual\n direction.\n- Use multiple URL states to reveal meaningful UX moments: empty/loading/error\n states, focused panels, modals, responsive breakpoints, and completed flow\n steps when those matter to the review.\n- For visual edits, compare before/after at the relevant viewport sizes and\n check key hover/focus/scroll states when the app exposes them.\n\n## Account And Sharing Model\n\n- `/visual-edit/:id` is the dedicated local-editor surface. The one-time\n handoff returned by `open-visual-edit` opens it with edit access without a\n Design login. A copied or bare `/visual-edit/:id` URL is read-only because it\n does not carry the capability.\n- The capability permits live iframe inspection and session-local edits,\n undo/redo, **Apply design updates** through the connected host/local agent,\n and **Copy prompt**. Those flows hand bounded source instructions back to the\n coding agent; they do not silently persist account-owned Design data.\n- Public `/design/:id` links stay read-only without a signed-in owner/editor\n session. Never use the local capability to upgrade that ordinary sharing\n surface.\n- Prefer links returned by Design actions or `/_agent-native/open` deep links.\n Do not surface URLs with `_session=` tokens or hand-build capability URLs.\n- Do not attempt account-backed write actions with the browser capability. The\n trusted local `open-visual-edit` CLI call may register its bridge, create or\n reuse its workspace-owned local design, and place screens without an account.\n Direct source-file action writes, generation, saving into an account, and\n sharing still require an authenticated action caller. If a signed-out visitor\n wants those durable account operations, send them through the framework\n sign-in return flow first.\n\n## Required Local Bridge\n\nThe live-edit bridge is unlocked by a shared secret (the \"bridge token\") that\nmust match on two sides: the local bridge process, and the user's connection row\nin Design (which the browser reads to authorize `/live-edit-bridge`,\n`/read-file`, `/write-file`). Get them to match by letting the\n`open-visual-edit` action mint the token, then starting the\nbridge with it. This is the only ordering that works for the remote-MCP flow \u2014\nthe bridge cannot push its own token to the server without a CLI auth token, so\nthe server mints instead and the bridge adopts.\n\nFrom the target app repo, make sure its dev server is running, then:\n\n**1. Discover routes without starting a durable bridge** (one-shot, exits):\n\n```bash\nnpx @agent-native/core@latest design connect --url http://localhost:5173 --root . --json\n```\n\nThis prints the manifest (routes + capabilities). Parse it to build\n`routeManifest` for the next step. (Skip this if the user already gave explicit\npaths/URLs to place.)\n\nInside the agent-native monorepo itself, use the workspace CLI instead of\n`npx` \u2014 `npx` installs the last published `@agent-native/core`, which will not\ncontain local changes and costs a slow install on every call:\n\n```bash\npnpm dev:cli design connect --url http://localhost:5173 --root templates/<app> --json\n```\n\n**2. Call `open-visual-edit`** (see Action Flow below) with NO `bridgeToken`.\nThe server mints one, stores it on the user's connection row, copies it into the\nplaced screens' metadata, and returns it to you as `bridgeToken`. Capture it.\n\n**3. Start the persistent bridge adopting that token** (single line; prefer the\nenv var so the secret does not appear in `ps`):\n\n```bash\nAGENT_NATIVE_BRIDGE_TOKEN=\"<bridgeToken from step 2>\" npx @agent-native/core@latest design connect --url http://localhost:5173 --root . --daemon\n```\n\n(Equivalently, pass `--bridge-token <token>`.) This starts a detached bridge on\n`http://127.0.0.1:7331`, adopts the server-minted token \u2014 so bridge and row\nagree and live-edit authorizes with no self-registration \u2014 and stays alive after\nthe command exits.\n\nFor a manual health/manifest check on the running bridge:\n\n```bash\ncurl http://127.0.0.1:7331/health\n```\n\n`/health` needs no token. The full manifest at `/manifest.json` is\npreview-token protected, so an unauthenticated `curl` of it returns\n`{\"ok\":false,\"error\":\"invalid or missing preview token\"}` \u2014 that response means\nthe bridge is up, not that it is broken.\n\nOnly use `--json` for the step-1 route probe. Never use `--json`, `--once`,\nor `--dry-run` for the durable step-3 bridge: they print the manifest and exit,\nso Design falls back to a non-editable live iframe.\n\nThe bridge listens on a single fixed port (7331) and refuses to start for a\nsecond, different app. It is detached with no log file, so if `--daemon` reports\na timeout, check for a stale process (`lsof -ti:7331`) before retrying.\n\n## Action Flow\n\nPrefer the single `open-visual-edit` action. It registers or\nrefreshes the localhost bridge connection, mints and stores the bridge token,\ncreates or reuses a Design project, places URL-backed screens, stores the active\nvisual-edit context, and navigates to overview mode in one call. This avoids\ncreating a private design under a synthetic CLI user and then handing the browser\na tokenized URL that may be shadowed by an existing session.\n\nCall it BEFORE starting the durable bridge (step 3 above): it does not contact\nthe bridge, so the bridge need not be running yet, and you need its returned\n`bridgeToken` to start the bridge with a matching secret. Omit `bridgeToken`\non the call so the server mints one.\n\n```bash\npnpm action open-visual-edit '{\n \"title\": \"Docs homepage visual edit\",\n \"devServerUrl\": \"http://localhost:5173\",\n \"bridgeUrl\": \"http://127.0.0.1:7331\",\n \"rootPath\": \"/absolute/path/to/app\",\n \"routeManifest\": { \"...\": \"from /manifest.json\" },\n \"paths\": [\"/\", \"/pricing\", \"/checkout?step=payment\"]\n}'\n```\n\nThe action returns `designId`, `connectionId`, `bridgeToken`, `screens`,\n`urlPath`, and a credential-free `openUrl`. Its MCP App metadata separately\ncarries the one-time editor launcher so the host can redeem it without showing\nthe capability to the model or retaining it in the action link. Keep\n`designId`/`connectionId` in the chat context for follow-ups, and pass\n`bridgeToken` to `design connect` (step 3) to start the bridge. On follow-up\ncalls reusing an existing `connectionId`, the same token is returned (it is\nminted once and reused), so the running bridge stays valid.\n\n### Desktop and mobile side by side\n\nPass `viewports` to place every requested route once per viewport. Frames lay\nout as a grid: one row per route, one column per viewport. Presets are\n`desktop` (1280x900), `laptop` (1440x900), `tablet` (834x1112), and `mobile`\n(390x844); an explicit `{ \"label\": \"...\", \"width\": N, \"height\": N }` also works.\n\n```bash\npnpm action open-visual-edit '{\n \"title\": \"Tasks responsive visual edit\",\n \"devServerUrl\": \"http://localhost:5173\",\n \"bridgeUrl\": \"http://127.0.0.1:7331\",\n \"rootPath\": \"/absolute/path/to/app\",\n \"paths\": [\"/tasks\", \"/inbox\"],\n \"viewports\": [\"desktop\", \"mobile\"]\n}'\n```\n\nPrefer this over two separate calls with `defaultWidth`/`defaultHeight`: it\nkeeps each route's viewports aligned in a row and titles them\n`Tasks \u2014 Desktop` / `Tasks \u2014 Mobile` so the canvas reads clearly. `viewports`\noverrides `defaultWidth`/`defaultHeight`. With no `routes`/`paths`, it expands\nevery route in the localhost manifest, which is usually far more frames than\nthe user wants \u2014 name the paths.\n\n### Adding more page frames later\n\nCall `open-visual-edit` again with the same `designId` and `connectionId` and\nonly the new paths. Existing frames for the same route and viewport are\nrefreshed in place rather than duplicated, and a frame the user has dragged or\nresized keeps its position unless you explicitly pass `x`/`y`/`width`/`height`.\n\n```bash\npnpm action open-visual-edit '{\n \"designId\": \"<existing-design-id>\",\n \"connectionId\": \"<existing-connection-id>\",\n \"devServerUrl\": \"http://localhost:5173\",\n \"paths\": [\"/settings\", \"/team\"],\n \"startY\": 2200\n}'\n```\n\nDo NOT add `defaultWidth`/`defaultHeight` just to restate the default size:\nsupplying either one marks the viewport as explicitly requested, which\noverwrites frame sizes the user has already adjusted on the canvas.\n\nFor a numbered flow the user describes in chat, keep the labels and order:\n\n```bash\npnpm action open-visual-edit '{\n \"designId\": \"<existing-design-id>\",\n \"connectionId\": \"<existing-connection-id>\",\n \"devServerUrl\": \"http://localhost:1234\",\n \"routes\": [\n { \"url\": \"localhost:1234/onboarding/1\", \"title\": \"Screen 1\" },\n { \"url\": \"localhost:1234/onboarding/2\", \"title\": \"Screen 2\" },\n { \"url\": \"localhost:1234/onboarding/3\", \"title\": \"Screen 3\" }\n ]\n}'\n```\n\nIf no `routes` or `paths` are supplied, `open-visual-edit` uses every route\nfrom the localhost manifest.\n\nFallback, only when `open-visual-edit` is unavailable:\n\n1. Register or refresh the bridge with `connect-localhost`, passing the\n `/manifest.json` result as `routeManifest` and `capabilities`.\n2. Create or reuse a Design project with `create-design`.\n3. Place URL-backed screens with `add-localhost-screens`.\n4. Navigate to overview mode with `navigate`.\n\n## Open The Design Surface\n\n- Use the `link`, `deepLink`, or MCP App embed returned by Design actions so\n the user sees the canvas. Follow **Put Design Beside The Chat**: prefer the\n MCP App; otherwise surface the credential-free **Open design** link.\n- Return or open the MCP App first. Its host-managed launcher carries the\n one-time local-editor capability. The credential-free `openUrl` / action link\n is the safe read-only fallback; never build a capability URL yourself.\n- Never return or open a hand-built `/design/:id?_session=...` URL.\n- If the user is working in VS Code, the Agent Native extension can open the\n same URL via\n `vscode://builder.agent-native/open?url=<encoded-design-url>`. Its\n `Agent Native: Open Design Canvas` command also starts the local bridge and\n opens hosted Design in the VS Code side panel.\n- After `open-visual-edit`, confirm the Design editor is in overview mode\n with the requested URL-backed frames visible, and that they render the app\n rather than a spinner. Do not stop at \"screens added\" when the user asked to\n inspect or edit visually.\n\n## Applying Visual Edits Back To Source\n\nCanvas edits on a localhost screen do not write source as you make them. They\naccumulate as pending edits and the editor shows an **Apply design updates**\nbutton on the canvas. In an MCP App, clicking it hands the bounded structured\nprompt to the current host coding conversation. In an ordinary browser or\nstandalone Design page, it falls back to the local Design agent. The dropdown's\n**Copy prompt to your agent** action is the universal manual fallback.\n\n- Style, text, and drag/drop structure edits all collect into the same pending\n batch, so the user can make several changes and apply once.\n- After the write lands, the target app's own dev-server HMR refreshes the\n frames \u2014 no manual reload. If frames do not refresh, the write did not land;\n say so rather than assuming.\n- The separate disk-icon \"Apply to source\" button is the deterministic\n whole-file HTML/CSS writer. It is intentionally disabled for compiled\n `.jsx`/`.tsx` routes \u2014 those must go through the agent path above.\n\n## Editing URLs\n\nKeep localhost screens as URL files plus `screenMetadata[fileId]`. Do not\nreplace them with copied `srcdoc` HTML unless the user explicitly asks for a\nfrozen snapshot. To change a state, rerun `open-visual-edit` with the new\npath/query or duplicate the screen and update the copy's URL metadata.\n\n## Local Files in the Code Tab\n\nOnce a connection is registered, the design editor's Code panel (left rail \u2192\nCode, or `navigate --view editor --designId <id> --leftPanel code`) shows a\nlocal-files workspace root for that connection next to the design's own files.\nTreat that root like VS Code opened at the connected project directory: file\ntree, search, open/edit, and save are backed by the real local files. It lists\nthe connected app's text/code files through the bridge\n(`list-local-files` / `read-local-file`); build output, `node_modules`,\n`.git`, and secret-looking paths (`.env*`, key files) are always excluded.\n\n- Browsing and reading need only editor access on the design plus the running\n bridge.\n- Saving goes through `write-local-file`: the first save opens the\n write-consent dialog (an 8-hour, folder-scoped grant) and retries\n automatically once granted. Only text/code files are writable; secret paths\n are always blocked.\n- If the agent calls `write-local-file` directly (not through a UI save) and it\n fails with \"no write-consent grant\", call `request-localhost-write-consent`.\n It opens the write-consent dialog in the editor, or reports `alreadyGranted`\n if one already exists. Granting is human-only \u2014\n `grant-localhost-write-consent` is hidden from agents, so you cannot approve\n it yourself. Tell the user to click \"Allow writes\", then retry\n `write-local-file` once. Do not keep retrying blindly: the write stays\n blocked until the user approves.\n- Saves are conflict-checked against the file's on-disk version \u2014 a file that\n changed since it was read fails with a version conflict instead of being\n overwritten.\n\n## React Source Writeback\n\n- Use compiler/debug provenance (project-relative file, line, column,\n component, and runtime multiplicity) to locate React/TSX source. Treat it as\n evidence, not as permission for a generic AST structural transform.\n- Read `positionPrecision` on every anchor before you trust `line`/`column`.\n `authored` means those are the real JSX coordinates. `transformed` means they\n are the dev server's own output coordinates \u2014 React 19 removed `_debugSource`\n and exposes only an owner stack, so this is the normal case on a Vite/Next\n dev server, and the line will not match the file. `unknown` means no tier was\n reported. On anything but `authored`, use the file and component to find the\n element by its JSX shape and re-derive the line from the file you read; never\n edit at the reported line.\n- A single-instance leaf text edit, literal `className`/`class` edit, or flat\n literal `style={{ ... }}` property may use `apply-visual-edit` with a\n `local-file` source and a complete `target.sourceAnchor`. Forward the\n anchor's `positionPrecision` with it \u2014 the action refuses a `transformed`\n anchor with `status: \"needsAgent\"` instead of seeking to a line that means\n something else in the authored file. Preview first (omit `persist`), inspect\n `proposedDiff`, then call with `persist: true`.\n- Reparenting, grouping/ungrouping, wrappers, dynamic expressions, repeated\n `.map()` instances, shared components, breakpoint-scoped edits, and\n cross-file changes go through the coding agent with complete subject/target\n anchors and their runtime relationship. `apply-visual-edit` refuses these\n with `status: \"needsAgent\"` rather than guessing.\n- Before each write, read the file and pass its exact `versionHash` to\n `write-local-file` with `requireExpectedVersionHash: true`; on conflict,\n re-read and re-plan. Keep the optimistic preview until HMR/runtime confirms\n the result. Human write consent remains mandatory and agents cannot grant it.\n\n## Verification\n\n- `list-localhost-connections` returns the expected connection and routes.\n- The Design editor opens in overview mode.\n- Every requested screen renders the intended localhost URL, showing real app\n content rather than an endless loading spinner.\n- The screen iframe carries a `src`, not a `srcdoc`. A localhost screen with a\n `srcdoc` is a bug, not a slow load \u2014 check it in the browser devtools before\n reporting the canvas as working.\n- Alt-dragging a screen copies the URL-backed frame, not an inline HTML clone.\n- A query/path edit changes only the target screen's URL metadata and iframe.\n- The Code tab shows a local-files root for the connection and opens its files.\n";
@@ -51,8 +51,8 @@ Prefer the MCP App surface for a connected Design plugin, then the host's
51
51
  browser/preview tool as the universal fallback. Keep the canvas beside chat
52
52
  when the host supports rearrangeable panes.
53
53
 
54
- Inside Design, use **Show/Hide UI** from the \`Cmd+K\` menu or press Figma's
55
- \`Shift+\\\` shortcut to toggle all editing chrome so only the canvas remains.
54
+ Inside Design, use **Show/Hide UI** from the \`Cmd K\` menu or press Figma's
55
+ \`Shift \\\` shortcut to toggle all editing chrome so only the canvas remains.
56
56
  The same action is available from Design's empty-canvas context menu.
57
57
 
58
58
  ## Core Model
@@ -536,7 +536,7 @@ export async function runVisualizeRepo(argv) {
536
536
  bridge.result.urlFile
537
537
  ? `Open URL written to ${bridge.result.urlFile}`
538
538
  : "",
539
- "Press Ctrl+C to stop.",
539
+ "Press Ctrl C to stop.",
540
540
  ]
541
541
  .filter(Boolean)
542
542
  .join("\n") + "\n");
@@ -24,7 +24,7 @@ const FEEDBACK_COPY = {
24
24
  invalidUrl: "Invalid feedback URL",
25
25
  emptyError: "Please write something first",
26
26
  sendError: "Couldn't send feedback",
27
- keyboardHint: "{{shortcut}}+Enter to send",
27
+ keyboardHint: "{{shortcut}} Enter to send",
28
28
  },
29
29
  "zh-CN": {
30
30
  label: "反馈",
@@ -36,7 +36,7 @@ const FEEDBACK_COPY = {
36
36
  invalidUrl: "反馈 URL 无效",
37
37
  emptyError: "请先写点内容",
38
38
  sendError: "无法发送反馈",
39
- keyboardHint: "{{shortcut}}+Enter 发送",
39
+ keyboardHint: "{{shortcut}} Enter 发送",
40
40
  },
41
41
  "zh-TW": {
42
42
  label: "意見回饋",
@@ -48,7 +48,7 @@ const FEEDBACK_COPY = {
48
48
  invalidUrl: "意見回饋 URL 無效",
49
49
  emptyError: "請先輸入內容",
50
50
  sendError: "無法送出意見回饋",
51
- keyboardHint: "{{shortcut}}+Enter 送出",
51
+ keyboardHint: "{{shortcut}} Enter 送出",
52
52
  },
53
53
  "es-ES": {
54
54
  label: "Comentarios",
@@ -60,7 +60,7 @@ const FEEDBACK_COPY = {
60
60
  invalidUrl: "URL de comentarios no válida",
61
61
  emptyError: "Escribe algo primero",
62
62
  sendError: "No se pudieron enviar los comentarios",
63
- keyboardHint: "{{shortcut}}+Enter para enviar",
63
+ keyboardHint: "{{shortcut}} Enter para enviar",
64
64
  },
65
65
  "fr-FR": {
66
66
  label: "Retour",
@@ -72,7 +72,7 @@ const FEEDBACK_COPY = {
72
72
  invalidUrl: "URL de retour invalide",
73
73
  emptyError: "Écrivez quelque chose d'abord",
74
74
  sendError: "Impossible d'envoyer le retour",
75
- keyboardHint: "{{shortcut}}+Entrée pour envoyer",
75
+ keyboardHint: "{{shortcut}} Entrée pour envoyer",
76
76
  },
77
77
  "de-DE": {
78
78
  label: "Feedback",
@@ -84,7 +84,7 @@ const FEEDBACK_COPY = {
84
84
  invalidUrl: "Ungültige Feedback-URL",
85
85
  emptyError: "Bitte zuerst etwas schreiben",
86
86
  sendError: "Feedback konnte nicht gesendet werden",
87
- keyboardHint: "{{shortcut}}+Enter zum Senden",
87
+ keyboardHint: "{{shortcut}} Enter zum Senden",
88
88
  },
89
89
  "ja-JP": {
90
90
  label: "フィードバック",
@@ -96,7 +96,7 @@ const FEEDBACK_COPY = {
96
96
  invalidUrl: "フィードバック URL が無効です",
97
97
  emptyError: "先に内容を入力してください",
98
98
  sendError: "送信できませんでした",
99
- keyboardHint: "{{shortcut}}+Enter で送信",
99
+ keyboardHint: "{{shortcut}} Enter で送信",
100
100
  },
101
101
  "ko-KR": {
102
102
  label: "피드백",
@@ -108,7 +108,7 @@ const FEEDBACK_COPY = {
108
108
  invalidUrl: "피드백 URL이 올바르지 않습니다",
109
109
  emptyError: "먼저 내용을 입력해 주세요",
110
110
  sendError: "피드백을 보낼 수 없습니다",
111
- keyboardHint: "{{shortcut}}+Enter로 보내기",
111
+ keyboardHint: "{{shortcut}} Enter로 보내기",
112
112
  },
113
113
  "pt-BR": {
114
114
  label: "Feedback",
@@ -120,7 +120,7 @@ const FEEDBACK_COPY = {
120
120
  invalidUrl: "URL de feedback inválida",
121
121
  emptyError: "Escreva algo primeiro",
122
122
  sendError: "Não foi possível enviar o feedback",
123
- keyboardHint: "{{shortcut}}+Enter para enviar",
123
+ keyboardHint: "{{shortcut}} Enter para enviar",
124
124
  },
125
125
  "hi-IN": {
126
126
  label: "फ़ीडबैक",
@@ -132,7 +132,7 @@ const FEEDBACK_COPY = {
132
132
  invalidUrl: "फ़ीडबैक URL अमान्य है",
133
133
  emptyError: "पहले कुछ लिखें",
134
134
  sendError: "फ़ीडबैक भेजा नहीं जा सका",
135
- keyboardHint: "भेजने के लिए {{shortcut}}+Enter",
135
+ keyboardHint: "भेजने के लिए {{shortcut}} Enter",
136
136
  },
137
137
  "ar-SA": {
138
138
  label: "ملاحظات",
@@ -144,7 +144,7 @@ const FEEDBACK_COPY = {
144
144
  invalidUrl: "رابط الملاحظات غير صالح",
145
145
  emptyError: "اكتب شيئا أولا",
146
146
  sendError: "تعذر إرسال الملاحظات",
147
- keyboardHint: "{{shortcut}}+Enter للإرسال",
147
+ keyboardHint: "{{shortcut}} Enter للإرسال",
148
148
  },
149
149
  };
150
150
  function parseTarget(url) {
@@ -373,6 +373,6 @@ function FeedbackPopoverButton({ variant = "sidebar", label, url, className, sid
373
373
  submit();
374
374
  }, placeholder: resolvedPlaceholder, rows: 5, maxLength: 10000, className: "w-full resize-none rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring" }), _jsx("input", { type: "text", tabIndex: -1, autoComplete: "off", "aria-hidden": "true", value: honeypot, onChange: (e) => setHoneypot(e.target.value), style: honeypotStyle }), _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsx("div", { className: cn("text-[11px]", error ? "text-destructive" : "text-muted-foreground/75"), children: error ??
375
375
  copy.keyboardHint.replace("{{shortcut}}", /Mac|iPhone|iPad/.test(navigator.userAgent)
376
- ? "⌘"
376
+ ? "Cmd"
377
377
  : "Ctrl") }), _jsx("button", { type: "submit", disabled: submitting || !value.trim(), className: "inline-flex h-8 items-center justify-center rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50", children: submitting ? copy.submitting : copy.submit })] })] })) }) })] }));
378
378
  }
@@ -7,6 +7,7 @@ import { captureError } from "./analytics.js";
7
7
  import { agentNativePath } from "./api-path.js";
8
8
  import { formatChatErrorText, normalizeChatError } from "./error-format.js";
9
9
  import { AgentAutoContinueSignal, INTERRUPTED_TOOL_RESULT, appendMissingFinalResponseWarning, readSSEStream, settleInterruptedToolCalls, } from "./sse-event-processor.js";
10
+ import { isDelegatedAgentToolCall, isToolCallInFlight, } from "./tool-display.js";
10
11
  const TEXT_ATTACHMENT_CONTENT_TYPES = new Set([
11
12
  "application/json",
12
13
  "application/x-ndjson",
@@ -891,7 +892,7 @@ function describeContinuationAdvance(content, preparingToolName) {
891
892
  }
892
893
  continue;
893
894
  }
894
- if (part.activity === true) {
895
+ if (part.activity === true && !isDelegatedAgentToolCall(part)) {
895
896
  work.add(`preparing ${part.toolName}`);
896
897
  stall ??= { kind: "preparing", toolName: part.toolName };
897
898
  }
@@ -923,9 +924,7 @@ function describeContinuationAdvance(content, preparingToolName) {
923
924
  * must not count this against the stalled/empty continuation budgets.
924
925
  */
925
926
  export function hasInFlightToolCall(content) {
926
- return content.some((part) => part.type === "tool-call" &&
927
- part.result === undefined &&
928
- part.activity !== true);
927
+ return content.some((part) => isToolCallInFlight(part));
929
928
  }
930
929
  /**
931
930
  * Server truth for "does this run still look alive?", used to keep the client
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- type AssistantUiRecoverableErrorKind = "assistant-ui-stale-message-index" | "assistant-ui-duplicate-resource-key" | "assistant-ui-react-fiber-unmount";
2
+ type AssistantUiRecoverableErrorKind = "assistant-ui-stale-message-index" | "assistant-ui-duplicate-resource-key" | "assistant-ui-react-fiber-unmount" | "assistant-ui-react-update-depth";
3
3
  export declare function assistantUiRecoverableRenderErrorKind(error: unknown): AssistantUiRecoverableErrorKind | null;
4
4
  export declare function isAssistantUiStaleIndexError(error: unknown): boolean;
5
5
  export declare function isAssistantUiRecoverableRenderError(error: unknown): boolean;