@agent-native/core 0.80.9 → 0.80.11

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 (148) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +13 -0
  3. package/corpus/core/package.json +1 -1
  4. package/corpus/core/src/agent/production-agent.ts +108 -15
  5. package/corpus/core/src/cli/design-connect.ts +28 -2
  6. package/corpus/core/src/cli/skills.ts +45 -24
  7. package/corpus/core/src/client/AssistantChat.tsx +123 -26
  8. package/corpus/core/src/client/sse-event-processor.ts +9 -0
  9. package/corpus/templates/assets/.agents/skills/image-generation/SKILL.md +9 -2
  10. package/corpus/templates/assets/AGENTS.md +4 -0
  11. package/corpus/templates/assets/actions/_tool-activity.ts +46 -0
  12. package/corpus/templates/assets/actions/generate-image-batch.ts +26 -5
  13. package/corpus/templates/assets/actions/generate-image.ts +118 -67
  14. package/corpus/templates/assets/actions/list-draft-assets.ts +50 -0
  15. package/corpus/templates/assets/actions/rerun-generation-run.ts +52 -31
  16. package/corpus/templates/assets/app/components/create/RecentDraftsSection.tsx +100 -0
  17. package/corpus/templates/assets/app/i18n/zh-TW.ts +7 -0
  18. package/corpus/templates/assets/app/i18n-data.ts +61 -0
  19. package/corpus/templates/assets/app/routes/_index.tsx +4 -0
  20. package/corpus/templates/assets/app/routes/library.tsx +145 -38
  21. package/corpus/templates/assets/changelog/2026-06-29-image-generation-can-now-render-requested-text-and-respect-b.md +6 -0
  22. package/corpus/templates/assets/changelog/2026-06-30-image-generation-no-longer-looks-stuck-while-the-provider-is-still-working.md +6 -0
  23. package/corpus/templates/assets/changelog/2026-06-30-tagged-presets-now-control-the-image-aspect-ratio.md +6 -0
  24. package/corpus/templates/assets/server/lib/generation.ts +135 -11
  25. package/corpus/templates/assets/shared/api.ts +4 -0
  26. package/corpus/templates/clips/actions/list-ai-requests.ts +60 -0
  27. package/corpus/templates/clips/app/hooks/use-auto-title.ts +24 -25
  28. package/corpus/templates/design/DESIGN-STUDIO-PLAN.md +717 -0
  29. package/corpus/templates/design/actions/add-breakpoint.ts +143 -0
  30. package/corpus/templates/design/actions/add-localhost-screens.ts +5 -0
  31. package/corpus/templates/design/actions/apply-a11y-fix.ts +317 -0
  32. package/corpus/templates/design/actions/apply-component-prop-edit.ts +441 -0
  33. package/corpus/templates/design/actions/apply-design-state.ts +213 -0
  34. package/corpus/templates/design/actions/apply-design-token-edit.ts +202 -0
  35. package/corpus/templates/design/actions/apply-motion-edit.ts +413 -0
  36. package/corpus/templates/design/actions/apply-shader-fill.ts +404 -0
  37. package/corpus/templates/design/actions/apply-visual-edit.ts +191 -5
  38. package/corpus/templates/design/actions/capture-design-state.ts +224 -0
  39. package/corpus/templates/design/actions/connect-builder-app.ts +162 -0
  40. package/corpus/templates/design/actions/create-component.ts +447 -0
  41. package/corpus/templates/design/actions/create-design-branch.ts +263 -0
  42. package/corpus/templates/design/actions/create-design-state.ts +162 -0
  43. package/corpus/templates/design/actions/delete-design-state.ts +55 -0
  44. package/corpus/templates/design/actions/delete-design.ts +20 -0
  45. package/corpus/templates/design/actions/deploy-design-preview.ts +275 -0
  46. package/corpus/templates/design/actions/get-component-details.ts +251 -0
  47. package/corpus/templates/design/actions/get-design-branch-diff.ts +362 -0
  48. package/corpus/templates/design/actions/get-design-review.ts +314 -0
  49. package/corpus/templates/design/actions/get-design-surface-index.ts +582 -0
  50. package/corpus/templates/design/actions/get-motion-timeline.ts +99 -0
  51. package/corpus/templates/design/actions/index-components.ts +258 -0
  52. package/corpus/templates/design/actions/index-design-tokens.ts +277 -0
  53. package/corpus/templates/design/actions/list-design-extensions.ts +309 -0
  54. package/corpus/templates/design/actions/list-design-source-capabilities.ts +153 -0
  55. package/corpus/templates/design/actions/list-design-states.ts +90 -0
  56. package/corpus/templates/design/actions/migrate-inline-design-to-app.ts +298 -0
  57. package/corpus/templates/design/actions/open-component-source.ts +242 -0
  58. package/corpus/templates/design/actions/preview-component-prop-edit.ts +260 -0
  59. package/corpus/templates/design/actions/preview-design-token-edit.ts +113 -0
  60. package/corpus/templates/design/actions/preview-shader-fill.ts +187 -0
  61. package/corpus/templates/design/actions/remove-breakpoint.ts +103 -0
  62. package/corpus/templates/design/actions/remove-motion-timeline.ts +196 -0
  63. package/corpus/templates/design/actions/run-design-audit.ts +436 -0
  64. package/corpus/templates/design/actions/run-design-extension-action.ts +284 -0
  65. package/corpus/templates/design/actions/set-active-breakpoint.ts +39 -0
  66. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +1550 -82
  67. package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +649 -43
  68. package/corpus/templates/design/app/components/design/DrawOverlay.tsx +1 -1
  69. package/corpus/templates/design/app/components/design/EditPanel.tsx +1788 -52
  70. package/corpus/templates/design/app/components/design/LayersPanel.tsx +114 -33
  71. package/corpus/templates/design/app/components/design/LocalSourceEditBanner.tsx +157 -0
  72. package/corpus/templates/design/app/components/design/MotionDock.tsx +1071 -0
  73. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +1053 -99
  74. package/corpus/templates/design/app/components/design/ReviewPanel.tsx +766 -0
  75. package/corpus/templates/design/app/components/design/StatesPanel.tsx +581 -0
  76. package/corpus/templates/design/app/components/design/TokensPanel.tsx +578 -0
  77. package/corpus/templates/design/app/components/design/canvas-primitive-style.ts +241 -0
  78. package/corpus/templates/design/app/components/design/index.ts +16 -0
  79. package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +15 -6
  80. package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +66 -3
  81. package/corpus/templates/design/app/components/design/inspector/InspectorAiActions.tsx +145 -0
  82. package/corpus/templates/design/app/components/design/inspector/SHADER_INTEGRATION.md +42 -12
  83. package/corpus/templates/design/app/components/visual-editor/DrawOverlay.tsx +1 -1
  84. package/corpus/templates/design/app/hooks/useAgentEditRequest.ts +131 -0
  85. package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +3 -1
  86. package/corpus/templates/design/app/i18n/zh-TW.ts +32 -0
  87. package/corpus/templates/design/app/i18n-data.ts +280 -0
  88. package/corpus/templates/design/app/pages/DesignEditor.tsx +3087 -490
  89. package/corpus/templates/design/changelog/2026-06-29-added-a-review-panel-in-the-design-editor-s-inspector-with-a.md +6 -0
  90. package/corpus/templates/design/changelog/2026-06-29-copying-and-pasting-layers-no-longer-shows-success-notificat.md +6 -0
  91. package/corpus/templates/design/changelog/2026-06-29-device-presets-in-all-screens-view-resize-the-selected-previ.md +6 -0
  92. package/corpus/templates/design/changelog/2026-06-29-layer-and-canvas-drags-keep-the-layer-list-stable-while-chan.md +6 -0
  93. package/corpus/templates/design/changelog/2026-06-29-layer-moves-can-be-undone-and-redone-without-flashing-the-ca.md +6 -0
  94. package/corpus/templates/design/changelog/2026-06-29-screen-previews-use-a-single-blue-hover-border-in-all-screen.md +6 -0
  95. package/corpus/templates/design/changelog/2026-06-29-selected-containers-show-draggable-padding-and-gap-guides-on.md +6 -0
  96. package/corpus/templates/design/changelog/2026-06-29-the-design-editor-adds-a-studio-layer-with-tokens-respon.md +6 -0
  97. package/corpus/templates/design/changelog/2026-06-30-accessibility-findings-now-offer-a-one-click-fix.md +6 -0
  98. package/corpus/templates/design/changelog/2026-06-30-component-instances-now-have-editable-props-in-the-inspe.md +6 -0
  99. package/corpus/templates/design/changelog/2026-06-30-design-token-edits-now-stay-visible-in-previews-and-token-li.md +6 -0
  100. package/corpus/templates/design/changelog/2026-06-30-inspect-code-now-shows-the-elements-opening-tag-at-a-gla.md +6 -0
  101. package/corpus/templates/design/changelog/2026-06-30-shader-fill-presets-can-now-be-applied-to-an-element.md +6 -0
  102. package/corpus/templates/design/changelog/2026-06-30-the-motion-timeline-can-now-add-a-track-to-any-element-a.md +6 -0
  103. package/corpus/templates/design/changelog/2026-06-30-visual-editor-selection-layer-paint-and-drawing-controls-are-more-reliable.md +6 -0
  104. package/corpus/templates/design/e2e/global-setup.ts +94 -2
  105. package/corpus/templates/design/e2e/helpers.ts +10 -4
  106. package/corpus/templates/design/server/db/schema.ts +123 -0
  107. package/corpus/templates/design/server/plugins/db.ts +90 -0
  108. package/corpus/templates/design/shared/builder-app.ts +297 -0
  109. package/corpus/templates/design/shared/capability-resolver.ts +123 -0
  110. package/corpus/templates/design/shared/capture-sanitize.ts +70 -0
  111. package/corpus/templates/design/shared/code-layer.ts +1016 -71
  112. package/corpus/templates/design/shared/component-model.ts +274 -0
  113. package/corpus/templates/design/shared/design-review.ts +275 -0
  114. package/corpus/templates/design/shared/design-source-capabilities.ts +286 -0
  115. package/corpus/templates/design/shared/design-state.ts +112 -0
  116. package/corpus/templates/design/shared/design-surface-index.ts +258 -0
  117. package/corpus/templates/design/shared/motion-compiler.ts +349 -0
  118. package/corpus/templates/design/shared/motion-timeline.ts +193 -0
  119. package/corpus/templates/design/shared/resolve-tweaks.ts +32 -9
  120. package/corpus/templates/design/shared/responsive-classes.ts +452 -0
  121. package/corpus/templates/design/shared/shader-fill.ts +323 -0
  122. package/corpus/templates/design/shared/source-mode.ts +245 -0
  123. package/corpus/templates/plan/app/components/plan/CanvasArea.tsx +6 -2
  124. package/corpus/templates/plan/changelog/2026-06-29-plan-canvases-open-without-an-initial-pan-and-zoom-flicker.md +6 -0
  125. package/dist/agent/production-agent.d.ts.map +1 -1
  126. package/dist/agent/production-agent.js +94 -10
  127. package/dist/agent/production-agent.js.map +1 -1
  128. package/dist/cli/design-connect.d.ts.map +1 -1
  129. package/dist/cli/design-connect.js +28 -2
  130. package/dist/cli/design-connect.js.map +1 -1
  131. package/dist/cli/skills.d.ts.map +1 -1
  132. package/dist/cli/skills.js +37 -21
  133. package/dist/cli/skills.js.map +1 -1
  134. package/dist/client/AssistantChat.d.ts +14 -0
  135. package/dist/client/AssistantChat.d.ts.map +1 -1
  136. package/dist/client/AssistantChat.js +115 -22
  137. package/dist/client/AssistantChat.js.map +1 -1
  138. package/dist/client/sse-event-processor.d.ts.map +1 -1
  139. package/dist/client/sse-event-processor.js +10 -0
  140. package/dist/client/sse-event-processor.js.map +1 -1
  141. package/dist/collab/routes.d.ts +1 -1
  142. package/dist/file-upload/actions/upload-image.d.ts +2 -2
  143. package/dist/notifications/routes.d.ts +2 -2
  144. package/dist/observability/routes.d.ts +8 -8
  145. package/dist/resources/handlers.d.ts +2 -2
  146. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  147. package/dist/server/transcribe-voice.d.ts +1 -1
  148. package/package.json +1 -1
@@ -0,0 +1,284 @@
1
+ /**
2
+ * run-design-extension-action — thin dispatcher.
3
+ *
4
+ * Routes an extension action request to the correct first-party action via
5
+ * the existing action surface. Extensions add NO permanent editor chrome —
6
+ * this action is the single call-through so the agent doesn't need to remember
7
+ * which internal action backs each extension capability.
8
+ *
9
+ * For first-party extensions (design.asset-library, design.shader-fills,
10
+ * design.token-auditor, design.motion-presets), the action dispatches to the
11
+ * correct implementation. The caller can always call the underlying action
12
+ * directly; this dispatcher exists as a convenience layer for the agent and
13
+ * for extension iframe code that calls `appAction("run-design-extension-action")`.
14
+ *
15
+ * For user-created extensions (kind="user-extension"), the action does NOT
16
+ * inject content into or modify the extension iframe itself — the iframe
17
+ * bridge handles that. Instead, it records the request context so the agent
18
+ * can follow up.
19
+ *
20
+ * Reuses the existing extension infra:
21
+ * - Core `list-extensions` / `get-extension` for user extension resolution.
22
+ * - Per-action implementations for first-party capabilities.
23
+ * - The `design.editor.inspector` slot contract from DesignExtensionsPanel.tsx.
24
+ *
25
+ * Plan reference: DESIGN-STUDIO-PLAN.md §6.7 + §7 (`run-design-extension-action`).
26
+ */
27
+
28
+ import { defineAction } from "@agent-native/core";
29
+ import { resolveAccess } from "@agent-native/core/sharing";
30
+ import { z } from "zod";
31
+
32
+ // ─── Supported first-party extension ids ──────────────────────────────────────
33
+
34
+ const FIRST_PARTY_IDS = [
35
+ "design.asset-library",
36
+ "design.shader-fills",
37
+ "design.token-auditor",
38
+ "design.motion-presets",
39
+ ] as const;
40
+
41
+ type FirstPartyId = (typeof FIRST_PARTY_IDS)[number];
42
+
43
+ // ─── Capability routing map ───────────────────────────────────────────────────
44
+
45
+ /**
46
+ * Maps a `extensionId:capabilityId` pair to the action the caller should use.
47
+ * The dispatcher does NOT inline-call other actions (actions are not composable
48
+ * that way in this framework) — it returns routing guidance with the exact
49
+ * action name and params so the agent makes one follow-up call.
50
+ */
51
+ interface CapabilityRoute {
52
+ action: string;
53
+ paramHint: string;
54
+ readOnly: boolean;
55
+ gated?: boolean;
56
+ gateReason?: string;
57
+ }
58
+
59
+ const CAPABILITY_ROUTES: Record<string, CapabilityRoute> = {
60
+ // Asset Library
61
+ "design.asset-library:browse": {
62
+ action: "get-design-snapshot",
63
+ paramHint:
64
+ "Call get-design-snapshot to inspect the active design, then use the Assets MCP tool (generate-asset / open-asset-picker) or the Assets app via call-agent.",
65
+ readOnly: true,
66
+ },
67
+ "design.asset-library:insert": {
68
+ action: "insert-asset",
69
+ paramHint:
70
+ "Call insert-asset with { assetUrl, designId?, fileId?, ownerId? }. Pass ownerId from view-screen.designSelection for selection-aware placement.",
71
+ readOnly: false,
72
+ },
73
+ "design.asset-library:generate": {
74
+ action: "call-agent",
75
+ paramHint:
76
+ 'Delegate to the Assets app via call-agent with agent "assets" and a generation prompt. Pass the returned assetUrl to insert-asset.',
77
+ readOnly: false,
78
+ },
79
+
80
+ // Shader Fills
81
+ "design.shader-fills:catalog": {
82
+ action: "get-shader",
83
+ paramHint: "Call get-shader with an optional source context.",
84
+ readOnly: true,
85
+ },
86
+ "design.shader-fills:preview": {
87
+ action: "preview-shader-fill",
88
+ paramHint:
89
+ "Call preview-shader-fill with { descriptor: { preset, params?, colors?, speed? }, target? }. Returns previewCss + bridgeMessage; no writes.",
90
+ readOnly: true,
91
+ },
92
+ "design.shader-fills:code-snippet": {
93
+ action: "apply-shader",
94
+ paramHint:
95
+ "Call apply-shader with { descriptor, surface?, target?, source? }. Returns JSX import + snippet or HTML bridge mount for manual insertion.",
96
+ readOnly: true,
97
+ },
98
+ "design.shader-fills:apply": {
99
+ action: "apply-shader-fill",
100
+ paramHint:
101
+ "Call apply-shader-fill with { descriptor, target?, source?, surface? }. NOTE: currently returns gated:true — all safety conditions are unmet. Use preview or code-snippet instead.",
102
+ readOnly: false,
103
+ gated: true,
104
+ gateReason:
105
+ "apply-shader-fill is GATED until runtime rendering + source-write path + CSS fallback + diff proof are all in place. It will return { ok: false, gated: true } today.",
106
+ },
107
+
108
+ // Token Auditor
109
+ "design.token-auditor:index": {
110
+ action: "index-design-tokens",
111
+ paramHint:
112
+ "Call index-design-tokens with { designId? } to parse CSS vars from the design.",
113
+ readOnly: true,
114
+ },
115
+ "design.token-auditor:preview-edit": {
116
+ action: "preview-design-token-edit",
117
+ paramHint:
118
+ "Call preview-design-token-edit with { designId, tokenId, value } for a live CSS-var preview.",
119
+ readOnly: true,
120
+ },
121
+ "design.token-auditor:apply-edit": {
122
+ action: "apply-design-token-edit",
123
+ paramHint:
124
+ "Call apply-design-token-edit with { designId, tokenId, value } to persist via the Tweaks loop.",
125
+ readOnly: false,
126
+ },
127
+ "design.token-auditor:write-source": {
128
+ action: "apply-design-token-edit",
129
+ paramHint:
130
+ "Source write-back is planned. Call apply-design-token-edit — for inline designs it persists via Tweaks; for real-app sources with writeTokens capability it writes to the source file.",
131
+ readOnly: false,
132
+ gated: true,
133
+ gateReason:
134
+ "Source write-back to globals.css / tailwind.config is planned pending bridge hardening.",
135
+ },
136
+
137
+ // Motion Presets
138
+ "design.motion-presets:preview": {
139
+ action: "get-motion-timeline",
140
+ paramHint:
141
+ "Motion preview is a client-side postMessage bridge operation, not a server action. " +
142
+ "To inspect an existing timeline before committing, call get-motion-timeline with { designId }. " +
143
+ "To trigger a live scrub preview in the editor iframe, send a `motion-preview` postMessage from the extension UI.",
144
+ readOnly: true,
145
+ },
146
+ "design.motion-presets:apply": {
147
+ action: "apply-motion-edit",
148
+ paramHint:
149
+ "Call apply-motion-edit with { designId, fileId?, timeline: { tracks, durationMs } } for an atomic Write to CSS commit.",
150
+ readOnly: false,
151
+ },
152
+ "design.motion-presets:write-source": {
153
+ action: "apply-motion-edit",
154
+ paramHint:
155
+ "Real-source CSS module write-back is planned for fusion tier. Today apply-motion-edit writes to the managed <style> block for inline designs.",
156
+ readOnly: false,
157
+ gated: true,
158
+ gateReason:
159
+ "CSS module write-back is planned pending fusion bridge hardening.",
160
+ },
161
+ };
162
+
163
+ // ─── Action ──────────────────────────────────────────────────────────────────
164
+
165
+ export default defineAction({
166
+ description: `
167
+ Dispatch an action through a first-party Design Studio extension surface.
168
+
169
+ This is a thin routing layer — it does not call the underlying action itself;
170
+ instead it returns the exact action name + param hint so the agent makes one
171
+ follow-up call. This keeps the extension surface composable without
172
+ duplicating action logic.
173
+
174
+ Supported first-party extensions (extensionId):
175
+ design.asset-library — browse / insert / generate assets.
176
+ design.shader-fills — catalog / preview / code-snippet / apply (apply is GATED).
177
+ design.token-auditor — index / preview-edit / apply-edit / write-source.
178
+ design.motion-presets — preview / apply / write-source.
179
+
180
+ For user-created Alpine extensions, use list-extensions / get-extension / update-extension.
181
+ The extension iframe itself is not called by this action — only the backing action route.
182
+ `.trim(),
183
+ schema: z.object({
184
+ extensionId: z
185
+ .string()
186
+ .describe(
187
+ "First-party extension id. One of: " + FIRST_PARTY_IDS.join(", "),
188
+ ),
189
+ capabilityId: z
190
+ .string()
191
+ .describe(
192
+ "Capability to invoke within the extension. Call list-design-extensions to see available capabilities per extension.",
193
+ ),
194
+ context: z
195
+ .object({
196
+ designId: z.string().optional(),
197
+ fileId: z.string().optional(),
198
+ nodeId: z.string().optional(),
199
+ selector: z.string().optional(),
200
+ ownerId: z.string().optional(),
201
+ })
202
+ .optional()
203
+ .describe(
204
+ "Optional context from the current design editor state (view-screen output).",
205
+ ),
206
+ }),
207
+ readOnly: true, // This dispatcher only returns routing guidance; it never writes.
208
+ run: async ({ extensionId, capabilityId, context }) => {
209
+ // Enforce read access before doing anything else when a designId is given,
210
+ // so this dispatcher can't be used to probe whether a design exists.
211
+ if (context?.designId) {
212
+ const access = await resolveAccess("design", context.designId);
213
+ if (!access) {
214
+ const err = new Error("Design not found") as Error & {
215
+ statusCode: number;
216
+ };
217
+ err.statusCode = 404;
218
+ throw err;
219
+ }
220
+ }
221
+
222
+ // Validate extension id.
223
+ if (!FIRST_PARTY_IDS.includes(extensionId as FirstPartyId)) {
224
+ return {
225
+ ok: false,
226
+ error: `Unknown first-party extensionId: "${extensionId}".`,
227
+ knownExtensions: FIRST_PARTY_IDS,
228
+ hint: "For user-created extensions, use list-extensions / get-extension / update-extension.",
229
+ };
230
+ }
231
+
232
+ const routeKey = `${extensionId}:${capabilityId}`;
233
+ const route = CAPABILITY_ROUTES[routeKey];
234
+
235
+ if (!route) {
236
+ // Return available capabilities for this extension.
237
+ const availableCaps = Object.keys(CAPABILITY_ROUTES)
238
+ .filter((k) => k.startsWith(`${extensionId}:`))
239
+ .map((k) => k.split(":")[1]);
240
+
241
+ return {
242
+ ok: false,
243
+ error: `Unknown capabilityId "${capabilityId}" for extension "${extensionId}".`,
244
+ availableCapabilities: availableCaps,
245
+ hint: `Call list-design-extensions with extensionId "${extensionId}" to see all capabilities.`,
246
+ };
247
+ }
248
+
249
+ // Build a helpful context-aware param hint.
250
+ let contextualHint = route.paramHint;
251
+ if (context?.designId) {
252
+ contextualHint += ` Current designId: "${context.designId}".`;
253
+ }
254
+ if (context?.fileId) {
255
+ contextualHint += ` Current fileId: "${context.fileId}".`;
256
+ }
257
+ if (context?.nodeId ?? context?.selector) {
258
+ const target = context.nodeId
259
+ ? `nodeId="${context.nodeId}"`
260
+ : `selector="${context.selector}"`;
261
+ contextualHint += ` Current target: ${target}.`;
262
+ }
263
+ if (context?.ownerId) {
264
+ contextualHint += ` Current ownerId: "${context.ownerId}".`;
265
+ }
266
+
267
+ return {
268
+ ok: true,
269
+ extensionId,
270
+ capabilityId,
271
+ route: {
272
+ action: route.action,
273
+ paramHint: contextualHint,
274
+ readOnly: route.readOnly,
275
+ gated: route.gated ?? false,
276
+ gateReason: route.gateReason ?? null,
277
+ },
278
+ nextStep: route.gated
279
+ ? `NOTE: This capability is gated. ${route.gateReason ?? ""} The underlying action will return a clear gated result; do not imply the operation will succeed.`
280
+ : `Call the action "${route.action}" with the params described in paramHint.`,
281
+ slotId: "design.editor.inspector",
282
+ };
283
+ },
284
+ });
@@ -0,0 +1,39 @@
1
+ import { defineAction } from "@agent-native/core";
2
+ import { writeAppState } from "@agent-native/core/application-state";
3
+ import { assertAccess } from "@agent-native/core/sharing";
4
+ import { z } from "zod";
5
+
6
+ import "../server/db/index.js"; // ensure registerShareableResource runs
7
+
8
+ export default defineAction({
9
+ description:
10
+ "Set the active breakpoint for a design editor session. " +
11
+ "The active breakpoint controls which frame is the current edit scope: " +
12
+ "editing a layer while 'base' is active writes unprefixed Tailwind classes; " +
13
+ "editing while 'md' is active writes md: prefixed classes. " +
14
+ "Persists to application state so the agent and UI always agree on the active scope.",
15
+ schema: z.object({
16
+ designId: z.string().describe("Design project ID"),
17
+ breakpointId: z
18
+ .string()
19
+ .describe(
20
+ "Id of the BreakpointDefinition to activate, or the literal string 'auto' " +
21
+ "to reset to a single-frame (all-breakpoints) view.",
22
+ ),
23
+ }),
24
+ run: async ({ designId, breakpointId }) => {
25
+ await assertAccess("design", designId, "editor");
26
+
27
+ // Persist as application state so view-screen returns it and the UI reflects it.
28
+ await writeAppState(`design-active-breakpoint:${designId}`, {
29
+ designId,
30
+ activeBreakpointId: breakpointId,
31
+ setAt: new Date().toISOString(),
32
+ });
33
+
34
+ return {
35
+ designId,
36
+ activeBreakpointId: breakpointId,
37
+ };
38
+ },
39
+ });