@agent-native/core 0.84.1 → 0.84.2
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.
- package/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +7 -0
- package/corpus/core/docs/design/durable-agent-runs.md +34 -35
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/agent/engine/builder-engine.ts +81 -9
- package/corpus/core/src/agent/run-manager.ts +8 -7
- package/corpus/core/src/cli/design-connect.ts +175 -0
- package/corpus/core/src/cli/skills.ts +5 -7
- package/corpus/core/src/client/AgentPanel.tsx +8 -0
- package/corpus/core/src/client/MultiTabAssistantChat.tsx +4 -1
- package/corpus/core/src/client/agent-chat-adapter.ts +45 -15
- package/corpus/core/src/client/sse-event-processor.ts +31 -4
- package/corpus/core/src/templates/workspace-core/.agents/skills/reliable-mutations/SKILL.md +15 -17
- package/corpus/templates/design/actions/apply-motion-edit.ts +50 -18
- package/corpus/templates/design/actions/get-motion-timeline.ts +4 -14
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +156 -12
- package/corpus/templates/design/app/components/design/MotionDock.tsx +2 -3
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +217 -75
- package/corpus/templates/design/app/components/design/QuestionFlow.tsx +39 -39
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +558 -37
- package/corpus/templates/design/app/components/design/bridge/hit-test.bridge.ts +75 -3
- package/corpus/templates/design/app/components/design/types.ts +13 -0
- package/corpus/templates/design/app/components/layout/Layout.tsx +1 -0
- package/corpus/templates/design/app/i18n/zh-TW.ts +17 -0
- package/corpus/templates/design/app/i18n-data.ts +245 -0
- package/corpus/templates/design/app/pages/DesignEditor.tsx +762 -153
- package/corpus/templates/design/changelog/2026-06-30-copying-or-dragging-screen-elements-onto-the-infinite-canvas.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-design-questions-now-use-tighter-editor-typography-and-contr.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-element-drags-can-be-cancelled-with-escape-before-they-commi.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-pending-visual-style-edits-now-warn-before-you-leave-the-edi.md +6 -0
- package/corpus/templates/design/changelog/2026-06-30-visual-style-drags-stay-live-while-pending-edits-can-be-appl.md +6 -0
- package/corpus/templates/design/changelog/2026-07-01-design-chat-no-longer-shows-a-redundant-context-tab-above-the-composer.md +6 -0
- package/corpus/templates/design/changelog/2026-07-01-motion-track-creation-no-longer-fails-in-local-editors.md +6 -0
- package/corpus/templates/design/server/plugins/db.ts +10 -0
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +61 -10
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/run-manager.d.ts +8 -7
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +8 -7
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/cli/design-connect.d.ts +2 -0
- package/dist/cli/design-connect.d.ts.map +1 -1
- package/dist/cli/design-connect.js +140 -0
- package/dist/cli/design-connect.js.map +1 -1
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +5 -7
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AgentPanel.d.ts +5 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +4 -4
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts +3 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +2 -2
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +37 -14
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/sse-event-processor.d.ts +14 -1
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +21 -5
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/routes.d.ts +2 -2
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +2 -2
- package/dist/resources/handlers.d.ts +2 -2
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/templates/workspace-core/.agents/skills/reliable-mutations/SKILL.md +15 -17
- package/docs/design/durable-agent-runs.md +34 -35
- package/package.json +1 -1
- package/src/templates/workspace-core/.agents/skills/reliable-mutations/SKILL.md +15 -17
|
@@ -333,6 +333,13 @@ interface DesignCanvasProps {
|
|
|
333
333
|
contentOffsetY?: number;
|
|
334
334
|
};
|
|
335
335
|
boardSurface?: boolean;
|
|
336
|
+
/**
|
|
337
|
+
* Optional live document replacement channel. When paired with
|
|
338
|
+
* `runtimeReplacementKey`, this lets callers update iframe DOM through the
|
|
339
|
+
* editor bridge without changing `srcDoc` and reloading the iframe.
|
|
340
|
+
*/
|
|
341
|
+
runtimeReplacementContent?: string;
|
|
342
|
+
runtimeReplacementKey?: string;
|
|
336
343
|
embeddedFrameBackground?: string;
|
|
337
344
|
transparentBackground?: boolean;
|
|
338
345
|
editorChromeScaleX?: number;
|
|
@@ -367,6 +374,7 @@ interface DesignCanvasProps {
|
|
|
367
374
|
onElementDblClickText?: (info: ElementInfo) => void;
|
|
368
375
|
onIframeHotkey?: (event: IframeHotkeyPayload) => void;
|
|
369
376
|
onIframeContextMenu?: (event: IframeContextMenuPayload) => void;
|
|
377
|
+
onEditorDragStateChange?: (active: boolean) => void;
|
|
370
378
|
onVisualStructureChange?: (
|
|
371
379
|
selector: string,
|
|
372
380
|
anchorSelector: string,
|
|
@@ -376,6 +384,9 @@ interface DesignCanvasProps {
|
|
|
376
384
|
sourceId?: string;
|
|
377
385
|
anchorSourceId?: string;
|
|
378
386
|
requestId?: string;
|
|
387
|
+
dropMode?: "flow-insert" | "absolute-container";
|
|
388
|
+
sourceRect?: { x: number; y: number; width: number; height: number };
|
|
389
|
+
anchorRect?: { x: number; y: number; width: number; height: number };
|
|
379
390
|
},
|
|
380
391
|
) => boolean | void;
|
|
381
392
|
onVisualDuplicateChange?: (
|
|
@@ -571,6 +582,26 @@ function injectEmbeddedFrameStyle(content: string, style: string): string {
|
|
|
571
582
|
return `${style}${content}`;
|
|
572
583
|
}
|
|
573
584
|
|
|
585
|
+
export function getEmbeddedFrameDocumentContent(args: {
|
|
586
|
+
content: string;
|
|
587
|
+
embeddedFrameBackground?: string;
|
|
588
|
+
transparentBackground?: boolean;
|
|
589
|
+
contentOffsetX?: number;
|
|
590
|
+
contentOffsetY?: number;
|
|
591
|
+
}): string {
|
|
592
|
+
const frameStyle = [
|
|
593
|
+
getEmbeddedFrameBackgroundStyle({
|
|
594
|
+
embeddedFrameBackground: args.embeddedFrameBackground,
|
|
595
|
+
transparentBackground: args.transparentBackground,
|
|
596
|
+
}),
|
|
597
|
+
embeddedContentOffsetStyle(
|
|
598
|
+
args.contentOffsetX ?? 0,
|
|
599
|
+
args.contentOffsetY ?? 0,
|
|
600
|
+
),
|
|
601
|
+
].join("");
|
|
602
|
+
return injectEmbeddedFrameStyle(args.content, frameStyle);
|
|
603
|
+
}
|
|
604
|
+
|
|
574
605
|
export interface IframeHotkeyPayload {
|
|
575
606
|
key: string;
|
|
576
607
|
code: string;
|
|
@@ -602,6 +633,8 @@ export function DesignCanvas({
|
|
|
602
633
|
deviceFrame,
|
|
603
634
|
embeddedFrame,
|
|
604
635
|
boardSurface = false,
|
|
636
|
+
runtimeReplacementContent,
|
|
637
|
+
runtimeReplacementKey,
|
|
605
638
|
embeddedFrameBackground,
|
|
606
639
|
transparentBackground = false,
|
|
607
640
|
editorChromeScaleX = 1,
|
|
@@ -621,6 +654,7 @@ export function DesignCanvas({
|
|
|
621
654
|
onElementDblClickText,
|
|
622
655
|
onIframeHotkey,
|
|
623
656
|
onIframeContextMenu,
|
|
657
|
+
onEditorDragStateChange,
|
|
624
658
|
onVisualStructureChange,
|
|
625
659
|
onVisualDuplicateChange,
|
|
626
660
|
tweakValues,
|
|
@@ -652,6 +686,9 @@ export function DesignCanvas({
|
|
|
652
686
|
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
|
653
687
|
const zoomRef = useRef(zoom);
|
|
654
688
|
const previousContentKeyRef = useRef(contentKey);
|
|
689
|
+
const runtimeReplacementContentRef = useRef(runtimeReplacementContent);
|
|
690
|
+
const runtimeReplacementKeyRef = useRef(runtimeReplacementKey);
|
|
691
|
+
const lastRuntimeReplacementKeyRef = useRef(runtimeReplacementKey);
|
|
655
692
|
const [renderedContent, setRenderedContent] = useState(content);
|
|
656
693
|
const [annotationPins, setAnnotationPins] = useState<CanvasPin[]>([]);
|
|
657
694
|
const [pinSubmitSignal, setPinSubmitSignal] = useState(0);
|
|
@@ -707,6 +744,8 @@ export function DesignCanvas({
|
|
|
707
744
|
const waitingForEditableExternalSnapshot =
|
|
708
745
|
requiresEditableExternalSnapshot && !activeExternalSnapshotHtml;
|
|
709
746
|
zoomRef.current = zoom;
|
|
747
|
+
runtimeReplacementContentRef.current = runtimeReplacementContent;
|
|
748
|
+
runtimeReplacementKeyRef.current = runtimeReplacementKey;
|
|
710
749
|
|
|
711
750
|
useEffect(() => {
|
|
712
751
|
onExternalContentSnapshotRef.current = onExternalContentSnapshot;
|
|
@@ -819,6 +858,7 @@ export function DesignCanvas({
|
|
|
819
858
|
useEffect(() => {
|
|
820
859
|
if (previousContentKeyRef.current !== contentKey) {
|
|
821
860
|
previousContentKeyRef.current = contentKey;
|
|
861
|
+
lastRuntimeReplacementKeyRef.current = runtimeReplacementKey;
|
|
822
862
|
setRenderedContent(content);
|
|
823
863
|
}
|
|
824
864
|
// Same-screen visual edits are already applied optimistically inside the
|
|
@@ -826,7 +866,7 @@ export function DesignCanvas({
|
|
|
826
866
|
// reloads the iframe, flashes unstyled content, and drops selection. Only a
|
|
827
867
|
// content-key change (screen switch / explicit remount) should replace the
|
|
828
868
|
// iframe document here; the bridge replays inspector state after that load.
|
|
829
|
-
}, [content, contentKey]);
|
|
869
|
+
}, [content, contentKey, runtimeReplacementKey]);
|
|
830
870
|
|
|
831
871
|
usePinchZoom({
|
|
832
872
|
containerRef: scrollContainerRef,
|
|
@@ -879,6 +919,20 @@ export function DesignCanvas({
|
|
|
879
919
|
NAV_BRIDGE_SCRIPT +
|
|
880
920
|
embeddedWheelBridge +
|
|
881
921
|
editorChromeBridge;
|
|
922
|
+
const frameContent = getEmbeddedFrameDocumentContent({
|
|
923
|
+
content: iframeRenderContent,
|
|
924
|
+
embeddedFrameBackground,
|
|
925
|
+
transparentBackground,
|
|
926
|
+
contentOffsetX: embeddedFrame?.contentOffsetX ?? 0,
|
|
927
|
+
contentOffsetY: embeddedFrame?.contentOffsetY ?? 0,
|
|
928
|
+
});
|
|
929
|
+
if (frameContent.includes("</body>")) {
|
|
930
|
+
return frameContent.replace("</body>", bridgeToInject + "</body>"); // i18n-ignore generated iframe HTML injection
|
|
931
|
+
}
|
|
932
|
+
if (frameContent.includes("</html>")) {
|
|
933
|
+
return frameContent.replace("</html>", bridgeToInject + "</html>"); // i18n-ignore generated iframe HTML injection
|
|
934
|
+
}
|
|
935
|
+
// No body/html tags — wrap it
|
|
882
936
|
const frameStyle = [
|
|
883
937
|
getEmbeddedFrameBackgroundStyle({
|
|
884
938
|
embeddedFrameBackground,
|
|
@@ -889,17 +943,6 @@ export function DesignCanvas({
|
|
|
889
943
|
embeddedFrame?.contentOffsetY ?? 0,
|
|
890
944
|
),
|
|
891
945
|
].join("");
|
|
892
|
-
const frameContent = injectEmbeddedFrameStyle(
|
|
893
|
-
iframeRenderContent,
|
|
894
|
-
frameStyle,
|
|
895
|
-
);
|
|
896
|
-
if (frameContent.includes("</body>")) {
|
|
897
|
-
return frameContent.replace("</body>", bridgeToInject + "</body>"); // i18n-ignore generated iframe HTML injection
|
|
898
|
-
}
|
|
899
|
-
if (frameContent.includes("</html>")) {
|
|
900
|
-
return frameContent.replace("</html>", bridgeToInject + "</html>"); // i18n-ignore generated iframe HTML injection
|
|
901
|
-
}
|
|
902
|
-
// No body/html tags — wrap it
|
|
903
946
|
return `<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">${frameStyle}</head><body>${iframeRenderContent}${bridgeToInject}</body></html>`;
|
|
904
947
|
// editorChromeScaleX/Y are intentionally NOT deps: they only seed the initial
|
|
905
948
|
// baked chrome scale. Live zoom updates flow through the set-editor-chrome-scale
|
|
@@ -968,6 +1011,10 @@ export function DesignCanvas({
|
|
|
968
1011
|
if (e.data.type === "element-hover") {
|
|
969
1012
|
onElementHover(e.data.payload);
|
|
970
1013
|
}
|
|
1014
|
+
if (e.data.type === "agent-native:editor-drag-state") {
|
|
1015
|
+
onEditorDragStateChange?.(Boolean(e.data.active));
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
971
1018
|
if (e.data.type === "visual-style-change") {
|
|
972
1019
|
const selector = String(e.data.selector || "");
|
|
973
1020
|
const styles =
|
|
@@ -1001,6 +1048,39 @@ export function DesignCanvas({
|
|
|
1001
1048
|
typeof e.data.anchorSourceId === "string"
|
|
1002
1049
|
? e.data.anchorSourceId
|
|
1003
1050
|
: undefined;
|
|
1051
|
+
const dropMode =
|
|
1052
|
+
e.data.dropMode === "flow-insert" ||
|
|
1053
|
+
e.data.dropMode === "absolute-container"
|
|
1054
|
+
? e.data.dropMode
|
|
1055
|
+
: undefined;
|
|
1056
|
+
const sourceRect =
|
|
1057
|
+
e.data.sourceRect &&
|
|
1058
|
+
typeof e.data.sourceRect === "object" &&
|
|
1059
|
+
Number.isFinite(e.data.sourceRect.x) &&
|
|
1060
|
+
Number.isFinite(e.data.sourceRect.y) &&
|
|
1061
|
+
Number.isFinite(e.data.sourceRect.width) &&
|
|
1062
|
+
Number.isFinite(e.data.sourceRect.height)
|
|
1063
|
+
? {
|
|
1064
|
+
x: Number(e.data.sourceRect.x),
|
|
1065
|
+
y: Number(e.data.sourceRect.y),
|
|
1066
|
+
width: Number(e.data.sourceRect.width),
|
|
1067
|
+
height: Number(e.data.sourceRect.height),
|
|
1068
|
+
}
|
|
1069
|
+
: undefined;
|
|
1070
|
+
const anchorRect =
|
|
1071
|
+
e.data.anchorRect &&
|
|
1072
|
+
typeof e.data.anchorRect === "object" &&
|
|
1073
|
+
Number.isFinite(e.data.anchorRect.x) &&
|
|
1074
|
+
Number.isFinite(e.data.anchorRect.y) &&
|
|
1075
|
+
Number.isFinite(e.data.anchorRect.width) &&
|
|
1076
|
+
Number.isFinite(e.data.anchorRect.height)
|
|
1077
|
+
? {
|
|
1078
|
+
x: Number(e.data.anchorRect.x),
|
|
1079
|
+
y: Number(e.data.anchorRect.y),
|
|
1080
|
+
width: Number(e.data.anchorRect.width),
|
|
1081
|
+
height: Number(e.data.anchorRect.height),
|
|
1082
|
+
}
|
|
1083
|
+
: undefined;
|
|
1004
1084
|
if (
|
|
1005
1085
|
(selector || sourceId) &&
|
|
1006
1086
|
(anchorSelector || anchorSourceId) &&
|
|
@@ -1017,6 +1097,9 @@ export function DesignCanvas({
|
|
|
1017
1097
|
requestId,
|
|
1018
1098
|
sourceId,
|
|
1019
1099
|
anchorSourceId,
|
|
1100
|
+
dropMode,
|
|
1101
|
+
sourceRect,
|
|
1102
|
+
anchorRect,
|
|
1020
1103
|
},
|
|
1021
1104
|
);
|
|
1022
1105
|
if (requestId) {
|
|
@@ -1209,6 +1292,7 @@ export function DesignCanvas({
|
|
|
1209
1292
|
onElementDblClickText,
|
|
1210
1293
|
onIframeHotkey,
|
|
1211
1294
|
onIframeContextMenu,
|
|
1295
|
+
onEditorDragStateChange,
|
|
1212
1296
|
onVisualStructureChange,
|
|
1213
1297
|
onVisualDuplicateChange,
|
|
1214
1298
|
onZoomChange,
|
|
@@ -1519,6 +1603,66 @@ export function DesignCanvas({
|
|
|
1519
1603
|
[],
|
|
1520
1604
|
);
|
|
1521
1605
|
|
|
1606
|
+
const replaceRuntimeContentInPlace = useCallback(
|
|
1607
|
+
(nextContent: string) => {
|
|
1608
|
+
if (externalPreviewUrl) return false;
|
|
1609
|
+
return replacePreviewContent(
|
|
1610
|
+
getEmbeddedFrameDocumentContent({
|
|
1611
|
+
content: nextContent,
|
|
1612
|
+
embeddedFrameBackground,
|
|
1613
|
+
transparentBackground,
|
|
1614
|
+
contentOffsetX: embeddedFrame?.contentOffsetX ?? 0,
|
|
1615
|
+
contentOffsetY: embeddedFrame?.contentOffsetY ?? 0,
|
|
1616
|
+
}),
|
|
1617
|
+
null,
|
|
1618
|
+
[],
|
|
1619
|
+
{ forceFullDocument: true },
|
|
1620
|
+
);
|
|
1621
|
+
},
|
|
1622
|
+
[
|
|
1623
|
+
embeddedFrame?.contentOffsetX,
|
|
1624
|
+
embeddedFrame?.contentOffsetY,
|
|
1625
|
+
embeddedFrameBackground,
|
|
1626
|
+
externalPreviewUrl,
|
|
1627
|
+
replacePreviewContent,
|
|
1628
|
+
transparentBackground,
|
|
1629
|
+
],
|
|
1630
|
+
);
|
|
1631
|
+
|
|
1632
|
+
useEffect(() => {
|
|
1633
|
+
if (
|
|
1634
|
+
runtimeReplacementKey === undefined ||
|
|
1635
|
+
runtimeReplacementContent === undefined ||
|
|
1636
|
+
lastRuntimeReplacementKeyRef.current === runtimeReplacementKey
|
|
1637
|
+
) {
|
|
1638
|
+
return;
|
|
1639
|
+
}
|
|
1640
|
+
if (replaceRuntimeContentInPlace(runtimeReplacementContent)) {
|
|
1641
|
+
lastRuntimeReplacementKeyRef.current = runtimeReplacementKey;
|
|
1642
|
+
}
|
|
1643
|
+
}, [
|
|
1644
|
+
replaceRuntimeContentInPlace,
|
|
1645
|
+
runtimeReplacementContent,
|
|
1646
|
+
runtimeReplacementKey,
|
|
1647
|
+
]);
|
|
1648
|
+
|
|
1649
|
+
const runtimeReplacementEnabled = runtimeReplacementKey !== undefined;
|
|
1650
|
+
useEffect(() => {
|
|
1651
|
+
if (!runtimeReplacementEnabled) return;
|
|
1652
|
+
const iframe = iframeRef.current;
|
|
1653
|
+
if (!iframe) return;
|
|
1654
|
+
const replaceLatestRuntimeContent = () => {
|
|
1655
|
+
const nextContent = runtimeReplacementContentRef.current;
|
|
1656
|
+
if (nextContent === undefined) return;
|
|
1657
|
+
if (replaceRuntimeContentInPlace(nextContent)) {
|
|
1658
|
+
lastRuntimeReplacementKeyRef.current = runtimeReplacementKeyRef.current;
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
iframe.addEventListener("load", replaceLatestRuntimeContent);
|
|
1662
|
+
return () =>
|
|
1663
|
+
iframe.removeEventListener("load", replaceLatestRuntimeContent);
|
|
1664
|
+
}, [replaceRuntimeContentInPlace, runtimeReplacementEnabled]);
|
|
1665
|
+
|
|
1522
1666
|
const deleteRuntimeElement = useCallback(
|
|
1523
1667
|
(selector?: string | null, candidates?: string[]) => {
|
|
1524
1668
|
const iframe = iframeRef.current;
|
|
@@ -449,15 +449,14 @@ export function MotionDock({
|
|
|
449
449
|
|
|
450
450
|
{/* Dock toolbar */}
|
|
451
451
|
<div className="flex h-8 shrink-0 items-center gap-1 border-b border-border px-2">
|
|
452
|
-
{/* Collapse toggle. The
|
|
452
|
+
{/* Collapse toggle. The rail owns the visible Motion label. */}
|
|
453
453
|
<button
|
|
454
454
|
type="button"
|
|
455
|
-
className="-ml-1 flex
|
|
455
|
+
className="-ml-1 flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-1 focus-visible:ring-[var(--design-editor-accent-color)]"
|
|
456
456
|
onClick={() => setOpen(false)}
|
|
457
457
|
aria-label="Collapse motion dock"
|
|
458
458
|
>
|
|
459
459
|
<IconChevronDown className="size-3.5" />
|
|
460
|
-
<span>Motion</span>
|
|
461
460
|
</button>
|
|
462
461
|
|
|
463
462
|
<>
|