@agent-native/core 0.163.4 → 0.164.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.
- package/corpus/README.md +1 -1
- package/corpus/templates/analytics/app/hooks/use-dashboard-chat-context.ts +29 -0
- package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +1 -2
- package/corpus/templates/analytics/netlify.toml +2 -0
- package/corpus/templates/assets/netlify.toml +2 -0
- package/corpus/templates/brain/netlify.toml +2 -0
- package/corpus/templates/calendar/app/components/calendar/DayView.tsx +2 -1
- package/corpus/templates/calendar/changelog/2026-08-19-calendar-page-loads-stay-fast-after-idle-periods.md +6 -0
- package/corpus/templates/calendar/netlify.toml +2 -0
- package/corpus/templates/chat/netlify.toml +2 -0
- package/corpus/templates/clips/app/components/player/player-controls.tsx +3 -3
- package/corpus/templates/clips/app/components/player/reaction-emojis.ts +12 -0
- package/corpus/templates/clips/app/components/player/reactions-tray.tsx +90 -9
- package/corpus/templates/clips/app/components/player/scrubber.tsx +43 -10
- package/corpus/templates/clips/app/components/player/video-player.tsx +105 -15
- package/corpus/templates/clips/app/routes/_app.settings._index.tsx +1 -2
- package/corpus/templates/clips/app/routes/_index.tsx +10 -2
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +13 -8
- package/corpus/templates/clips/app/routes/share.$shareId.tsx +15 -8
- package/corpus/templates/clips/netlify.toml +2 -0
- package/corpus/templates/clips/server/routes/[...page].head.ts +5 -0
- package/corpus/templates/content/netlify.toml +2 -0
- package/corpus/templates/design/.agents/skills/design-editor-architecture/SKILL.md +103 -0
- package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +2 -1
- package/corpus/templates/design/AGENTS.md +3 -1
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +3 -2
- package/corpus/templates/design/app/components/design/editor/AgentNativeMenuMark.tsx +25 -0
- package/corpus/templates/design/app/components/design/editor/DesignBottomToolbar.tsx +411 -0
- package/corpus/templates/design/app/components/design/editor/DesignCollaborators.tsx +153 -0
- package/corpus/templates/design/app/components/design/editor/DesignWorkspaceRail.tsx +231 -0
- package/corpus/templates/design/app/components/design/editor/MakeRealDialog.tsx +223 -0
- package/corpus/templates/design/app/components/design/editor/PendingScreenDeletionDialog.tsx +58 -0
- package/corpus/templates/design/app/components/design/editor/PendingVisualStyleWarningDialog.tsx +56 -0
- package/corpus/templates/design/app/components/design/editor/ReadOnlyEditorPanel.tsx +23 -0
- package/corpus/templates/design/app/components/design/editor/SaveTemplateDialog.tsx +161 -0
- package/corpus/templates/design/app/components/design/editor/toolbar-controls.tsx +185 -0
- package/corpus/templates/design/app/pages/DesignEditor.tsx +20913 -0
- package/corpus/templates/design/app/pages/design-editor/command-types.ts +120 -0
- package/corpus/templates/design/app/pages/design-editor/commands/README.md +193 -0
- package/corpus/templates/design/app/pages/design-editor/commands/add-auto-layout.ts +416 -0
- package/corpus/templates/design/app/pages/design-editor/commands/add-screen.ts +112 -0
- package/corpus/templates/design/app/pages/design-editor/commands/align-selection.ts +183 -0
- package/corpus/templates/design/app/pages/design-editor/commands/apply-design-editor-command.ts +243 -0
- package/corpus/templates/design/app/pages/design-editor/commands/apply-file-content-update.ts +236 -0
- package/corpus/templates/design/app/pages/design-editor/commands/apply-local-content-update.ts +304 -0
- package/corpus/templates/design/app/pages/design-editor/commands/apply-pending-visual-styles-with-agent.ts +376 -0
- package/corpus/templates/design/app/pages/design-editor/commands/apply-to-source.ts +132 -0
- package/corpus/templates/design/app/pages/design-editor/commands/can-move-layer.ts +117 -0
- package/corpus/templates/design/app/pages/design-editor/commands/change-selected-z-index.ts +212 -0
- package/corpus/templates/design/app/pages/design-editor/commands/commit-relative-style-delta-to-selected-layers.ts +176 -0
- package/corpus/templates/design/app/pages/design-editor/commands/commit-styles-to-selected-layers.ts +175 -0
- package/corpus/templates/design/app/pages/design-editor/commands/commit-visual-styles.ts +710 -0
- package/corpus/templates/design/app/pages/design-editor/commands/confirm-make-real.ts +99 -0
- package/corpus/templates/design/app/pages/design-editor/commands/copy-as-figma-svg.ts +95 -0
- package/corpus/templates/design/app/pages/design-editor/commands/copy-selection.ts +156 -0
- package/corpus/templates/design/app/pages/design-editor/commands/create-primitive.ts +291 -0
- package/corpus/templates/design/app/pages/design-editor/commands/create-screen-frame.ts +131 -0
- package/corpus/templates/design/app/pages/design-editor/commands/cross-screen-element-drop.ts +577 -0
- package/corpus/templates/design/app/pages/design-editor/commands/delete-files.ts +364 -0
- package/corpus/templates/design/app/pages/design-editor/commands/delete-selection.ts +521 -0
- package/corpus/templates/design/app/pages/design-editor/commands/detach-instance-menu-action.ts +88 -0
- package/corpus/templates/design/app/pages/design-editor/commands/distribute-selection.ts +114 -0
- package/corpus/templates/design/app/pages/design-editor/commands/download-all-screens-pdf.ts +116 -0
- package/corpus/templates/design/app/pages/design-editor/commands/download-pdf.ts +103 -0
- package/corpus/templates/design/app/pages/design-editor/commands/download-svg.ts +159 -0
- package/corpus/templates/design/app/pages/design-editor/commands/duplicate-screen.ts +201 -0
- package/corpus/templates/design/app/pages/design-editor/commands/duplicate-selection.ts +279 -0
- package/corpus/templates/design/app/pages/design-editor/commands/editor-paste.ts +81 -0
- package/corpus/templates/design/app/pages/design-editor/commands/enter-hotkey.ts +155 -0
- package/corpus/templates/design/app/pages/design-editor/commands/enter-single-screen.ts +168 -0
- package/corpus/templates/design/app/pages/design-editor/commands/escape-hotkey.ts +212 -0
- package/corpus/templates/design/app/pages/design-editor/commands/frame-selection.ts +119 -0
- package/corpus/templates/design/app/pages/design-editor/commands/geometry-commit.ts +169 -0
- package/corpus/templates/design/app/pages/design-editor/commands/get-selected-layer-snapshots.ts +177 -0
- package/corpus/templates/design/app/pages/design-editor/commands/group-selection.ts +127 -0
- package/corpus/templates/design/app/pages/design-editor/commands/iframe-context-menu.ts +121 -0
- package/corpus/templates/design/app/pages/design-editor/commands/import-figma-clipboard-into-design.ts +119 -0
- package/corpus/templates/design/app/pages/design-editor/commands/layer-marquee-selection-change.ts +163 -0
- package/corpus/templates/design/app/pages/design-editor/commands/layer-move-to-screen.ts +331 -0
- package/corpus/templates/design/app/pages/design-editor/commands/layer-move.ts +517 -0
- package/corpus/templates/design/app/pages/design-editor/commands/layer-rename.ts +247 -0
- package/corpus/templates/design/app/pages/design-editor/commands/layer-selection-change.ts +161 -0
- package/corpus/templates/design/app/pages/design-editor/commands/mode-change.ts +122 -0
- package/corpus/templates/design/app/pages/design-editor/commands/nudge-selection.ts +213 -0
- package/corpus/templates/design/app/pages/design-editor/commands/overview-primitive-reparent.ts +318 -0
- package/corpus/templates/design/app/pages/design-editor/commands/paste-copied-screens.ts +114 -0
- package/corpus/templates/design/app/pages/design-editor/commands/paste-over-selection.ts +70 -0
- package/corpus/templates/design/app/pages/design-editor/commands/paste-selection.ts +436 -0
- package/corpus/templates/design/app/pages/design-editor/commands/paste-to-replace.ts +135 -0
- package/corpus/templates/design/app/pages/design-editor/commands/pasted-image-files.ts +209 -0
- package/corpus/templates/design/app/pages/design-editor/commands/persist-frame-geometry-save.ts +113 -0
- package/corpus/templates/design/app/pages/design-editor/commands/persist-tweak-save.ts +160 -0
- package/corpus/templates/design/app/pages/design-editor/commands/primitive-created.ts +168 -0
- package/corpus/templates/design/app/pages/design-editor/commands/record-pending-live-layer-state-edit.ts +149 -0
- package/corpus/templates/design/app/pages/design-editor/commands/record-pending-live-structure-edit.ts +200 -0
- package/corpus/templates/design/app/pages/design-editor/commands/record-pending-live-text-edit.ts +152 -0
- package/corpus/templates/design/app/pages/design-editor/commands/record-pending-visual-style-edit.ts +247 -0
- package/corpus/templates/design/app/pages/design-editor/commands/redo.ts +1086 -0
- package/corpus/templates/design/app/pages/design-editor/commands/render-png-blob.ts +200 -0
- package/corpus/templates/design/app/pages/design-editor/commands/save-file-content.ts +207 -0
- package/corpus/templates/design/app/pages/design-editor/commands/screen-element-select.ts +262 -0
- package/corpus/templates/design/app/pages/design-editor/commands/screen-text-content-change.ts +216 -0
- package/corpus/templates/design/app/pages/design-editor/commands/screen-visual-duplicate-change.ts +108 -0
- package/corpus/templates/design/app/pages/design-editor/commands/screen-visual-structure-change.ts +280 -0
- package/corpus/templates/design/app/pages/design-editor/commands/screen-visual-style-change.ts +151 -0
- package/corpus/templates/design/app/pages/design-editor/commands/send-overview-annotations.ts +88 -0
- package/corpus/templates/design/app/pages/design-editor/commands/send-runtime-layer-move-semantic-handoff.ts +122 -0
- package/corpus/templates/design/app/pages/design-editor/commands/send-runtime-layer-semantic-handoff.ts +143 -0
- package/corpus/templates/design/app/pages/design-editor/commands/send-runtime-layer-state-semantic-handoff.ts +115 -0
- package/corpus/templates/design/app/pages/design-editor/commands/start-retry-generation.ts +152 -0
- package/corpus/templates/design/app/pages/design-editor/commands/start-sidebar-resize.ts +99 -0
- package/corpus/templates/design/app/pages/design-editor/commands/style-change.ts +152 -0
- package/corpus/templates/design/app/pages/design-editor/commands/styles-change.ts +155 -0
- package/corpus/templates/design/app/pages/design-editor/commands/suggest-auto-layout.ts +125 -0
- package/corpus/templates/design/app/pages/design-editor/commands/text-content-change.ts +201 -0
- package/corpus/templates/design/app/pages/design-editor/commands/tidy-up.ts +123 -0
- package/corpus/templates/design/app/pages/design-editor/commands/toggle-layer-hidden.ts +167 -0
- package/corpus/templates/design/app/pages/design-editor/commands/toggle-layer-locked.ts +175 -0
- package/corpus/templates/design/app/pages/design-editor/commands/toggle-motion-keyframe.ts +99 -0
- package/corpus/templates/design/app/pages/design-editor/commands/tweak-prompt-submit.ts +84 -0
- package/corpus/templates/design/app/pages/design-editor/commands/undo.ts +906 -0
- package/corpus/templates/design/app/pages/design-editor/commands/ungroup-selection.ts +170 -0
- package/corpus/templates/design/app/pages/design-editor/commands/visual-duplicate-change.ts +119 -0
- package/corpus/templates/design/app/pages/design-editor/commands/visual-structure-change.ts +274 -0
- package/corpus/templates/design/app/pages/design-editor/commands/write-frame-geometry-snapshot.ts +99 -0
- package/corpus/templates/design/app/pages/design-editor/derive/design-breakpoints.ts +56 -0
- package/corpus/templates/design/app/pages/design-editor/derive/overview-screens.ts +146 -0
- package/corpus/templates/design/app/pages/design-editor/domains/use-tweaks.ts +326 -0
- package/corpus/templates/design/app/pages/design-editor/editor-constants.ts +54 -0
- package/corpus/templates/design/app/pages/design-editor/editor-helpers.ts +183 -0
- package/corpus/templates/design/app/pages/design-editor/effects/adopt-db-file-content.ts +270 -0
- package/corpus/templates/design/app/pages/design-editor/effects/mirror-selection-to-agent-chat.ts +134 -0
- package/corpus/templates/design/app/pages/design-editor/effects/motion-autosave.ts +335 -0
- package/corpus/templates/design/app/pages/design-editor/effects/observe-collab-text.ts +183 -0
- package/corpus/templates/design/app/pages/design-editor/effects/publish-agent-selection-context.ts +252 -0
- package/corpus/templates/design/app/pages/design-editor/effects/resume-pending-generation.ts +178 -0
- package/corpus/templates/design/app/pages/design-editor/effects/seed-collab-content.ts +157 -0
- package/corpus/templates/design/app/pages/design-editor/preview-html.ts +19 -0
- package/corpus/templates/design/netlify.toml +2 -0
- package/corpus/templates/design/shared/board-file.ts +2 -1
- package/corpus/templates/dispatch/netlify.toml +2 -0
- package/corpus/templates/forms/netlify.toml +2 -0
- package/corpus/templates/mail/netlify.toml +2 -0
- package/corpus/templates/plan/netlify.toml +2 -0
- package/corpus/templates/slides/netlify.toml +2 -0
- package/dist/agent/engine/builder-engine.d.ts +6 -4
- package/dist/agent/engine/builder-engine.js +91 -26
- package/dist/agent/engine/registry.js +16 -0
- package/dist/cli/code-agent-agent-tools.d.ts +2 -0
- package/dist/cli/code-agent-agent-tools.js +188 -0
- package/dist/cli/code-agent-collaboration.d.ts +34 -0
- package/dist/cli/code-agent-collaboration.js +104 -0
- package/dist/cli/code-agent-executor.js +6 -0
- package/dist/cli/code-agent-schedules.d.ts +54 -0
- package/dist/cli/code-agent-schedules.js +198 -0
- package/dist/client/AgentPanel.js +1 -1
- package/dist/client/ConnectBuilderCard.js +5 -2
- package/dist/client/EnvironmentBadge.js +6 -5
- package/dist/client/chat/run-recovery.js +3 -2
- package/dist/client/chat/tool-call-display.js +2 -3
- package/dist/client/components/CodeRequiredDialog.js +4 -2
- package/dist/client/i18n.js +5 -4
- package/dist/client/settings/SettingsPanel.js +1 -1
- package/dist/client/settings/VoiceTranscriptionSection.js +1 -1
- package/dist/client/settings/useBuilderStatus.d.ts +6 -1
- package/dist/client/settings/useBuilderStatus.js +22 -33
- package/dist/client/transcription/BuilderTranscriptionCta.js +1 -1
- package/dist/code-agents/index.d.ts +2 -0
- package/dist/code-agents/index.js +2 -0
- package/dist/collab/routes.d.ts +1 -1
- package/dist/localization/shared.d.ts +2 -0
- package/dist/localization/shared.js +5 -0
- package/dist/mcp-client/oauth-client.d.ts +1 -0
- package/dist/mcp-client/oauth-client.js +50 -1
- package/dist/observability/routes.d.ts +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/provider-api.d.ts +2 -2
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/server/auth-marketing-locales.d.ts +7 -0
- package/dist/server/auth-marketing-locales.js +1322 -0
- package/dist/server/auth-marketing.d.ts +1 -0
- package/dist/server/auth-marketing.js +35 -6
- package/dist/server/auth.js +4 -17
- package/dist/server/builder-browser.d.ts +22 -0
- package/dist/server/builder-browser.js +77 -1
- package/dist/server/builder-oauth.d.ts +50 -0
- package/dist/server/builder-oauth.js +263 -0
- package/dist/server/core-routes-plugin.d.ts +11 -0
- package/dist/server/core-routes-plugin.js +291 -415
- package/dist/server/credential-provider.d.ts +1 -1
- package/dist/server/credential-provider.js +1 -1
- package/dist/server/csrf.js +2 -2
- package/dist/server/onboarding-html.js +52 -120
- package/dist/settings/store.d.ts +9 -0
- package/dist/settings/store.js +19 -0
- package/dist/templates/chat/netlify.toml +2 -0
- package/docs/content/deployment.mdx +2 -0
- package/docs/content/multi-app-workspace.mdx +1 -1
- package/package.json +2 -2
- package/src/templates/chat/netlify.toml +2 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { CodeLayerNode } from "@shared/code-layer";
|
|
2
|
+
import type { MotionEase } from "@shared/motion-timeline";
|
|
3
|
+
import {
|
|
4
|
+
MOTION_PROPERTY_PRESETS,
|
|
5
|
+
createMotionTrackFromPreset,
|
|
6
|
+
upsertMotionKeyframeAtTime,
|
|
7
|
+
} from "@shared/motion-timeline";
|
|
8
|
+
import type { Dispatch, RefObject, SetStateAction } from "react";
|
|
9
|
+
|
|
10
|
+
import type { MotionDockTrack } from "@/components/design/MotionDock";
|
|
11
|
+
import type { ElementInfo } from "@/components/design/types";
|
|
12
|
+
import {
|
|
13
|
+
MOTION_KEYFRAME_TIME_EPSILON,
|
|
14
|
+
computedMotionStyleValue,
|
|
15
|
+
} from "@/pages/design-editor/motion-state";
|
|
16
|
+
|
|
17
|
+
export interface ToggleMotionKeyframeArgs {
|
|
18
|
+
canEditDesign: boolean;
|
|
19
|
+
markMotionTracksDirty: () => void;
|
|
20
|
+
motionDefaultEase: string;
|
|
21
|
+
motionLivePlayheadRef: RefObject<number | null>;
|
|
22
|
+
motionPlayhead: number;
|
|
23
|
+
selectedCodeLayerNode: CodeLayerNode | null;
|
|
24
|
+
selectedElement: ElementInfo | null;
|
|
25
|
+
selectedMotionTargetNodeId: string | null;
|
|
26
|
+
setMotionTracks: Dispatch<SetStateAction<MotionDockTrack[]>>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function runToggleMotionKeyframe(
|
|
30
|
+
{
|
|
31
|
+
canEditDesign,
|
|
32
|
+
markMotionTracksDirty,
|
|
33
|
+
motionDefaultEase,
|
|
34
|
+
motionLivePlayheadRef,
|
|
35
|
+
motionPlayhead,
|
|
36
|
+
selectedCodeLayerNode,
|
|
37
|
+
selectedElement,
|
|
38
|
+
selectedMotionTargetNodeId,
|
|
39
|
+
setMotionTracks,
|
|
40
|
+
}: ToggleMotionKeyframeArgs,
|
|
41
|
+
cssProperty: string,
|
|
42
|
+
) {
|
|
43
|
+
if (!canEditDesign || !selectedMotionTargetNodeId) return;
|
|
44
|
+
const preset = MOTION_PROPERTY_PRESETS.find(
|
|
45
|
+
(candidate) => candidate.property === cssProperty,
|
|
46
|
+
);
|
|
47
|
+
if (!preset) return;
|
|
48
|
+
const activePlayhead = motionLivePlayheadRef.current ?? motionPlayhead;
|
|
49
|
+
const playheadT = Math.max(0, Math.min(1, activePlayhead));
|
|
50
|
+
const currentValue =
|
|
51
|
+
computedMotionStyleValue(selectedElement?.computedStyles, cssProperty) ??
|
|
52
|
+
preset.to;
|
|
53
|
+
const label =
|
|
54
|
+
selectedCodeLayerNode?.layerName ||
|
|
55
|
+
selectedElement?.tagName ||
|
|
56
|
+
"Selected element";
|
|
57
|
+
setMotionTracks((current) => {
|
|
58
|
+
const existingIndex = current.findIndex(
|
|
59
|
+
(track) =>
|
|
60
|
+
track.targetNodeId === selectedMotionTargetNodeId &&
|
|
61
|
+
track.property === cssProperty,
|
|
62
|
+
);
|
|
63
|
+
const ease = motionDefaultEase as MotionEase;
|
|
64
|
+
if (existingIndex === -1) {
|
|
65
|
+
const track = createMotionTrackFromPreset(
|
|
66
|
+
selectedMotionTargetNodeId,
|
|
67
|
+
preset,
|
|
68
|
+
ease,
|
|
69
|
+
);
|
|
70
|
+
const seeded: MotionDockTrack = {
|
|
71
|
+
...track,
|
|
72
|
+
label,
|
|
73
|
+
keyframes: upsertMotionKeyframeAtTime(
|
|
74
|
+
track.keyframes,
|
|
75
|
+
{ t: playheadT, value: currentValue, ease },
|
|
76
|
+
MOTION_KEYFRAME_TIME_EPSILON,
|
|
77
|
+
),
|
|
78
|
+
};
|
|
79
|
+
return [...current, seeded];
|
|
80
|
+
}
|
|
81
|
+
const track = current[existingIndex]!;
|
|
82
|
+
const existingAtPlayhead = track.keyframes.find(
|
|
83
|
+
(kf) => Math.abs(kf.t - playheadT) <= MOTION_KEYFRAME_TIME_EPSILON,
|
|
84
|
+
);
|
|
85
|
+
const nextKeyframes = existingAtPlayhead
|
|
86
|
+
? track.keyframes.filter((kf) => kf !== existingAtPlayhead)
|
|
87
|
+
: upsertMotionKeyframeAtTime(
|
|
88
|
+
track.keyframes,
|
|
89
|
+
{ t: playheadT, value: currentValue, ease },
|
|
90
|
+
MOTION_KEYFRAME_TIME_EPSILON,
|
|
91
|
+
);
|
|
92
|
+
return current.map((candidate, index) =>
|
|
93
|
+
index === existingIndex
|
|
94
|
+
? { ...candidate, keyframes: nextKeyframes }
|
|
95
|
+
: candidate,
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
markMotionTracksDirty();
|
|
99
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { PromptComposerSubmitOptions } from "@agent-native/core/client/composer";
|
|
2
|
+
import type { TweakDefinition } from "@shared/api";
|
|
3
|
+
import type { TweakSelections } from "@shared/resolve-tweaks";
|
|
4
|
+
import { toast } from "sonner";
|
|
5
|
+
|
|
6
|
+
import type { UploadedFile } from "@/components/editor/PromptDialog";
|
|
7
|
+
import { sendToDesignAgentChat } from "@/lib/agent-chat";
|
|
8
|
+
import { TWEAK_CONTROLS_EDIT_ACCESS_MESSAGE } from "@/pages/design-editor/editor-constants";
|
|
9
|
+
import {
|
|
10
|
+
formatTweakDefinitionsContext,
|
|
11
|
+
formatUploadedFileContext,
|
|
12
|
+
imageAttachmentsFromUploadedFiles,
|
|
13
|
+
} from "@/pages/design-editor/generation-prompt-directives";
|
|
14
|
+
import type { DesignData, DesignFile } from "@/pages/design-editor/types";
|
|
15
|
+
|
|
16
|
+
export interface TweakPromptSubmitArgs {
|
|
17
|
+
activeFile: DesignFile;
|
|
18
|
+
canEditDesign: boolean;
|
|
19
|
+
design: DesignData | null;
|
|
20
|
+
handleTweakPromptOpenChange: (open: boolean) => void;
|
|
21
|
+
id: string | undefined;
|
|
22
|
+
tweakSelections: TweakSelections;
|
|
23
|
+
tweaks: TweakDefinition[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function runTweakPromptSubmit(
|
|
27
|
+
{
|
|
28
|
+
activeFile,
|
|
29
|
+
canEditDesign,
|
|
30
|
+
design,
|
|
31
|
+
handleTweakPromptOpenChange,
|
|
32
|
+
id,
|
|
33
|
+
tweakSelections,
|
|
34
|
+
tweaks,
|
|
35
|
+
}: TweakPromptSubmitArgs,
|
|
36
|
+
prompt: string,
|
|
37
|
+
files: UploadedFile[],
|
|
38
|
+
options: PromptComposerSubmitOptions,
|
|
39
|
+
) {
|
|
40
|
+
if (!canEditDesign) {
|
|
41
|
+
toast.error(TWEAK_CONTROLS_EDIT_ACCESS_MESSAGE);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (!design) return;
|
|
45
|
+
const trimmed = prompt.trim();
|
|
46
|
+
if (!trimmed) return;
|
|
47
|
+
const fileContext = formatUploadedFileContext(files);
|
|
48
|
+
const images = imageAttachmentsFromUploadedFiles(files);
|
|
49
|
+
const currentSelections =
|
|
50
|
+
Object.keys(tweakSelections).length > 0
|
|
51
|
+
? JSON.stringify(tweakSelections, null, 2)
|
|
52
|
+
: "None yet.";
|
|
53
|
+
const context = [
|
|
54
|
+
`The user is in the Design editor tweaks panel for design id "${id}" (title: "${design.title}").`,
|
|
55
|
+
activeFile
|
|
56
|
+
? `Active file: "${activeFile.filename}" (file id: "${activeFile.id}").`
|
|
57
|
+
: "There is no active file yet.",
|
|
58
|
+
`User request: "${trimmed}"`,
|
|
59
|
+
"",
|
|
60
|
+
"Existing tweak definitions:",
|
|
61
|
+
formatTweakDefinitionsContext(tweaks),
|
|
62
|
+
"",
|
|
63
|
+
"Current selected tweak values:",
|
|
64
|
+
currentSelections,
|
|
65
|
+
fileContext,
|
|
66
|
+
"",
|
|
67
|
+
"Add or update live tweak controls for this design. Keep existing useful tweak controls unless the user explicitly asks to replace them.",
|
|
68
|
+
"If a requested control needs a new CSS custom property, first read the live design with `get-design-snapshot`, update the relevant HTML/CSS so the property is used, then persist the complete updated tweak definition list through `generate-design`.",
|
|
69
|
+
"For tiny source changes, prefer `edit-design`, but make sure the tweak definitions are saved so the Tweaks panel updates.",
|
|
70
|
+
].join("\n");
|
|
71
|
+
|
|
72
|
+
sendToDesignAgentChat({
|
|
73
|
+
message: `Add tweak controls to "${design.title}": ${trimmed}`,
|
|
74
|
+
context,
|
|
75
|
+
submit: true,
|
|
76
|
+
openSidebar: true,
|
|
77
|
+
newTab: true,
|
|
78
|
+
model: options.model,
|
|
79
|
+
engine: options.engine,
|
|
80
|
+
effort: options.effort,
|
|
81
|
+
images,
|
|
82
|
+
});
|
|
83
|
+
handleTweakPromptOpenChange(false);
|
|
84
|
+
}
|