@agent-native/core 0.37.1 → 0.37.3
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/dist/brand-kit/fig/decode.d.ts +33 -0
- package/dist/brand-kit/fig/decode.d.ts.map +1 -0
- package/dist/brand-kit/fig/decode.js +358 -0
- package/dist/brand-kit/fig/decode.js.map +1 -0
- package/dist/brand-kit/fig/extract-design-system.d.ts +44 -0
- package/dist/brand-kit/fig/extract-design-system.d.ts.map +1 -0
- package/dist/brand-kit/fig/extract-design-system.js +752 -0
- package/dist/brand-kit/fig/extract-design-system.js.map +1 -0
- package/dist/brand-kit/fig/fig-to-html.d.ts +246 -0
- package/dist/brand-kit/fig/fig-to-html.d.ts.map +1 -0
- package/dist/brand-kit/fig/fig-to-html.js +1506 -0
- package/dist/brand-kit/fig/fig-to-html.js.map +1 -0
- package/dist/brand-kit/fig/index.d.ts +30 -0
- package/dist/brand-kit/fig/index.d.ts.map +1 -0
- package/dist/brand-kit/fig/index.js +43 -0
- package/dist/brand-kit/fig/index.js.map +1 -0
- package/dist/cli/skills.d.ts +4 -0
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +841 -378
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +6 -104
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/context-xray/ContextMeter.js +1 -1
- package/dist/client/context-xray/ContextMeter.js.map +1 -1
- package/dist/client/context-xray/ContextSegmentRow.d.ts.map +1 -1
- package/dist/client/context-xray/ContextSegmentRow.js +4 -4
- package/dist/client/context-xray/ContextSegmentRow.js.map +1 -1
- package/dist/client/context-xray/ContextTreemap.d.ts.map +1 -1
- package/dist/client/context-xray/ContextTreemap.js +2 -2
- package/dist/client/context-xray/ContextTreemap.js.map +1 -1
- package/dist/client/context-xray/ContextXRayPanel.d.ts.map +1 -1
- package/dist/client/context-xray/ContextXRayPanel.js +19 -18
- package/dist/client/context-xray/ContextXRayPanel.js.map +1 -1
- package/dist/client/sharing/ShareButton.d.ts +4 -0
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +6 -4
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/package.json +6 -1
|
@@ -19,7 +19,7 @@ import { TextAttachmentAdapter } from "./composer/attachment-accept.js";
|
|
|
19
19
|
import { AgentTaskCard } from "./AgentTaskCard.js";
|
|
20
20
|
import { ConnectBuilderCard } from "./ConnectBuilderCard.js";
|
|
21
21
|
import { McpAppRenderer } from "./mcp-apps/McpAppRenderer.js";
|
|
22
|
-
import {
|
|
22
|
+
import { humanizeToolName } from "./tool-display.js";
|
|
23
23
|
import { useBuilderConnectFlow } from "./settings/useBuilderStatus.js";
|
|
24
24
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "./components/ui/tooltip.js";
|
|
25
25
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "./components/ui/dropdown-menu.js";
|
|
@@ -115,7 +115,6 @@ function getFileDataURL(file) {
|
|
|
115
115
|
// images on the client before we ever serialize them.
|
|
116
116
|
const MAX_IMAGE_BYTES = 4 * 1024 * 1024;
|
|
117
117
|
const MAX_IMAGE_DIMENSION = 2048;
|
|
118
|
-
const SHOW_AGENT_ACTIVITY_STEPS = true;
|
|
119
118
|
function loadImage(url) {
|
|
120
119
|
return new Promise((resolve, reject) => {
|
|
121
120
|
const img = new Image();
|
|
@@ -1100,36 +1099,6 @@ function ToolDetailViewer({ payload }) {
|
|
|
1100
1099
|
}, [payload.copyText]);
|
|
1101
1100
|
return (_jsxs("div", { className: "rounded-md border border-border/50 bg-background/60", children: [_jsxs("div", { className: "flex min-h-9 flex-wrap items-center gap-2 border-b border-border/50 px-2.5 py-1.5", children: [_jsx("div", { className: "min-w-0 flex-1", children: _jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: "truncate text-[11px] font-medium text-foreground/85", children: payload.title }), payload.lang !== "text" && (_jsx("span", { className: "shrink-0 rounded border border-border/60 px-1 py-0.5 font-mono text-[9px] uppercase leading-none text-muted-foreground", children: payload.lang }))] }) }), _jsx("button", { type: "button", onClick: () => setSearchOpen((v) => !v), "aria-label": `Search ${payload.title.toLowerCase()}`, "aria-pressed": searchOpen, className: cn("inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground", searchOpen && "bg-accent text-foreground"), children: _jsx(IconSearch, { size: 12 }) }), _jsx("button", { type: "button", onClick: () => setExpanded((v) => !v), "aria-label": expanded ? "Shrink code viewer" : "Expand code viewer", "aria-pressed": expanded, className: "inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground", children: expanded ? (_jsx(IconArrowsMinimize, { size: 12 })) : (_jsx(IconArrowsMaximize, { size: 12 })) }), _jsxs("button", { type: "button", onClick: copyValue, className: "inline-flex h-6 items-center gap-1 rounded-md px-1.5 font-sans text-[11px] text-muted-foreground hover:bg-accent hover:text-foreground", children: [copied ? _jsx(IconCheck, { size: 12 }) : _jsx(IconCopy, { size: 12 }), copied ? "Copied" : "Copy"] })] }), searchOpen && (_jsxs("div", { className: "flex items-center gap-2 border-b border-border/50 px-2.5 py-2", children: [_jsx("input", { value: search, onChange: (e) => setSearch(e.target.value), placeholder: "Find", className: "h-7 min-w-0 flex-1 rounded-md border border-border bg-background px-2 text-xs text-foreground outline-none placeholder:text-muted-foreground focus:ring-1 focus:ring-ring" }), _jsx("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: search.trim() ? matchCount : "" })] })), _jsx("div", { className: cn("agent-tool-code overflow-auto font-mono text-[11px] leading-relaxed text-foreground", expanded ? "max-h-[70vh]" : "max-h-72"), children: search.trim() ? (_jsx("pre", { children: _jsx("code", { children: renderHighlightedSearchText(payload.text, search) }) })) : (_jsx(HighlightedCodeBlock, { code: payload.text, lang: payload.lang })) })] }));
|
|
1102
1101
|
}
|
|
1103
|
-
function activityTrailFromMetadata(message) {
|
|
1104
|
-
const meta = message?.metadata;
|
|
1105
|
-
const raw = meta?.custom?.activityTrail ?? meta?.activityTrail;
|
|
1106
|
-
if (!Array.isArray(raw))
|
|
1107
|
-
return [];
|
|
1108
|
-
return raw
|
|
1109
|
-
.map((item, index) => {
|
|
1110
|
-
if (!item || typeof item !== "object")
|
|
1111
|
-
return null;
|
|
1112
|
-
const label = item.label;
|
|
1113
|
-
const tool = item.tool;
|
|
1114
|
-
if (typeof label !== "string" || !label.trim())
|
|
1115
|
-
return null;
|
|
1116
|
-
return {
|
|
1117
|
-
id: `trail-${index}-${label}`,
|
|
1118
|
-
label: label.trim(),
|
|
1119
|
-
...(typeof tool === "string" && tool.trim()
|
|
1120
|
-
? { tool: tool.trim() }
|
|
1121
|
-
: {}),
|
|
1122
|
-
};
|
|
1123
|
-
})
|
|
1124
|
-
.filter((item) => item !== null);
|
|
1125
|
-
}
|
|
1126
|
-
function RunActivityTrail({ steps }) {
|
|
1127
|
-
const [open, setOpen] = useState(false);
|
|
1128
|
-
if (steps.length === 0)
|
|
1129
|
-
return null;
|
|
1130
|
-
const visibleSteps = steps.slice(-6);
|
|
1131
|
-
return (_jsxs("div", { className: "mt-1.5", children: [_jsxs("button", { type: "button", onClick: () => setOpen((v) => !v), "aria-expanded": open, className: "inline-flex items-center gap-1 text-[11px] font-medium text-muted-foreground hover:text-foreground", children: [_jsx(IconChevronDown, { size: 12, className: cn("transition-transform", open && "rotate-180") }), "Steps"] }), open && (_jsx("div", { className: "mt-1 rounded-md border border-border/60 bg-muted/25 px-2.5 py-2 text-[11px] text-muted-foreground", children: _jsx("div", { className: "space-y-1", children: visibleSteps.map((step) => (_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(IconCheck, { className: "h-3 w-3 shrink-0 text-emerald-500" }), _jsx("span", { className: "truncate", children: step.label })] }, step.id))) }) }))] }));
|
|
1132
|
-
}
|
|
1133
1102
|
function ToolCallDisplay({ toolName, argsText, args, result, mcpApp, isRunning, }) {
|
|
1134
1103
|
const streamRef = useRef(null);
|
|
1135
1104
|
const isAgentCall = toolName.startsWith("agent:");
|
|
@@ -1440,9 +1409,6 @@ function AssistantMessage() {
|
|
|
1440
1409
|
const chatRunning = React.useContext(ChatRunningContext);
|
|
1441
1410
|
const msg = messageRuntime.getState();
|
|
1442
1411
|
const timestamp = formatMessageTimestamp(msg.createdAt);
|
|
1443
|
-
const activityTrail = SHOW_AGENT_ACTIVITY_STEPS
|
|
1444
|
-
? activityTrailFromMetadata(msg)
|
|
1445
|
-
: [];
|
|
1446
1412
|
const isLast = thread.messages.length > 0 &&
|
|
1447
1413
|
thread.messages[thread.messages.length - 1].id === msg.id;
|
|
1448
1414
|
const isComplete = !isLast || !chatRunning;
|
|
@@ -1498,7 +1464,7 @@ function AssistantMessage() {
|
|
|
1498
1464
|
tools: {
|
|
1499
1465
|
Fallback: ToolCallFallback,
|
|
1500
1466
|
},
|
|
1501
|
-
} }) }),
|
|
1467
|
+
} }) }), isComplete && (_jsxs("div", { className: "mt-1 flex items-center justify-between", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(MessageActionsMenu, { showRevert: showRestore && restoreState === "idle", onRevert: handleRestore }), timestamp && (_jsx(MessageTimestamp, { timestamp: timestamp, className: "opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100" }))] }), showRestore && restoreState === "confirming" ? (_jsxs("div", { className: "flex items-center gap-1 text-xs", children: [_jsx("button", { onClick: handleRestore, className: "rounded-md bg-destructive px-1.5 py-0.5 text-destructive-foreground hover:bg-destructive/90", children: "Restore to here?" }), _jsx("button", { onClick: cancelRestore, className: "rounded-md px-1.5 py-0.5 text-muted-foreground hover:bg-accent", children: "Cancel" })] })) : showRestore && restoreState === "restoring" ? (_jsxs("span", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [_jsx(IconLoader2, { className: "h-3 w-3 animate-spin" }), "Restoring..."] })) : (_jsx(ThumbsFeedback, { threadId: cpCtx?.threadId ?? "", runId: (() => {
|
|
1502
1468
|
const meta = messageRuntime.getState().metadata;
|
|
1503
1469
|
return ((typeof meta?.custom?.runId === "string" &&
|
|
1504
1470
|
meta.custom.runId) ||
|
|
@@ -1506,17 +1472,9 @@ function AssistantMessage() {
|
|
|
1506
1472
|
"");
|
|
1507
1473
|
})(), messageSeq: thread.messages.findIndex((m) => m.id === msg.id) }))] }))] }));
|
|
1508
1474
|
}
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
const visibleSteps = steps.slice(-4);
|
|
1513
|
-
return (_jsx("div", { className: cn("max-w-[85%] rounded-md border border-border/60 bg-muted/30 px-2.5 py-2 text-xs text-muted-foreground", className), "aria-live": "polite", children: _jsx("div", { className: "space-y-1", children: visibleSteps.map((step, index) => {
|
|
1514
|
-
const isCurrent = index === visibleSteps.length - 1;
|
|
1515
|
-
return (_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [isCurrent ? (_jsx(IconLoader2, { className: "h-3 w-3 shrink-0 animate-spin" })) : (_jsx(IconCheck, { className: "h-3 w-3 shrink-0 text-emerald-500" })), _jsx("span", { className: "truncate", children: step.label })] }, step.id));
|
|
1516
|
-
}) }) }));
|
|
1517
|
-
}
|
|
1518
|
-
function RunningActivityStatus({ steps, label, }) {
|
|
1519
|
-
return (_jsx("div", { className: "agent-running-activity shrink-0 px-4 pb-2", children: _jsxs("div", { className: "flex flex-col gap-2", children: [SHOW_AGENT_ACTIVITY_STEPS && (_jsx(ActivitySteps, { steps: steps, className: "max-w-full" })), _jsx(ThinkingIndicator, { label: label })] }) }));
|
|
1475
|
+
// ─── Thinking Indicator ─────────────────────────────────────────────────────
|
|
1476
|
+
function RunningActivityStatus({ label }) {
|
|
1477
|
+
return (_jsx("div", { className: "agent-running-activity shrink-0 px-4 pb-2", children: _jsx(ThinkingIndicator, { label: label }) }));
|
|
1520
1478
|
}
|
|
1521
1479
|
function ThinkingIndicator({ label = "Thinking" } = {}) {
|
|
1522
1480
|
const [dots, setDots] = useState(0);
|
|
@@ -2135,8 +2093,6 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
2135
2093
|
const userStoppedRunRef = useRef(null);
|
|
2136
2094
|
const [isReconnecting, setIsReconnecting] = useState(false);
|
|
2137
2095
|
const [reconnectContent, setReconnectContent] = useState([]);
|
|
2138
|
-
const [activityLabel, setActivityLabel] = useState(null);
|
|
2139
|
-
const activityStepIdCounter = useRef(0);
|
|
2140
2096
|
// When stop is clicked during reconnect, keep content visible (don't wipe it)
|
|
2141
2097
|
const [reconnectFrozen, setReconnectFrozen] = useState(false);
|
|
2142
2098
|
const reconnectRunIdRef = useRef(null);
|
|
@@ -2156,7 +2112,6 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
2156
2112
|
const wasRunningRef = useRef(false);
|
|
2157
2113
|
const lastBroadcastRunningRef = useRef(isRunning);
|
|
2158
2114
|
const tiptapRef = useRef(null);
|
|
2159
|
-
const [activitySteps, setActivitySteps] = useState([]);
|
|
2160
2115
|
useEffect(() => {
|
|
2161
2116
|
if (lastBroadcastRunningRef.current === isRunning)
|
|
2162
2117
|
return;
|
|
@@ -2821,53 +2776,6 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
2821
2776
|
window.addEventListener("agent-chat:run-error", handler);
|
|
2822
2777
|
return () => window.removeEventListener("agent-chat:run-error", handler);
|
|
2823
2778
|
}, [tabId]);
|
|
2824
|
-
useEffect(() => {
|
|
2825
|
-
const handler = (e) => {
|
|
2826
|
-
const detail = e.detail;
|
|
2827
|
-
if (tabId && detail?.tabId && detail.tabId !== tabId)
|
|
2828
|
-
return;
|
|
2829
|
-
if (SHOW_AGENT_ACTIVITY_STEPS &&
|
|
2830
|
-
typeof detail?.label === "string" &&
|
|
2831
|
-
detail.label.trim()) {
|
|
2832
|
-
const label = detail.label.trim();
|
|
2833
|
-
const tool = detail.tool?.trim() || undefined;
|
|
2834
|
-
const displayLabel = humanizeToolLabelText(label, tool);
|
|
2835
|
-
setActivityLabel(displayLabel);
|
|
2836
|
-
setActivitySteps((prev) => {
|
|
2837
|
-
const last = prev[prev.length - 1];
|
|
2838
|
-
if (last?.label === displayLabel && last.tool === tool)
|
|
2839
|
-
return prev;
|
|
2840
|
-
return [
|
|
2841
|
-
...prev,
|
|
2842
|
-
{
|
|
2843
|
-
id: `${Date.now()}-${++activityStepIdCounter.current}`,
|
|
2844
|
-
label: displayLabel,
|
|
2845
|
-
...(tool ? { tool } : {}),
|
|
2846
|
-
},
|
|
2847
|
-
].slice(-6);
|
|
2848
|
-
});
|
|
2849
|
-
}
|
|
2850
|
-
};
|
|
2851
|
-
window.addEventListener("agent-chat:activity", handler);
|
|
2852
|
-
return () => window.removeEventListener("agent-chat:activity", handler);
|
|
2853
|
-
}, [tabId]);
|
|
2854
|
-
useEffect(() => {
|
|
2855
|
-
const handler = (e) => {
|
|
2856
|
-
const detail = e.detail;
|
|
2857
|
-
if (tabId && detail?.tabId && detail.tabId !== tabId)
|
|
2858
|
-
return;
|
|
2859
|
-
setActivityLabel(null);
|
|
2860
|
-
setActivitySteps([]);
|
|
2861
|
-
};
|
|
2862
|
-
window.addEventListener("agent-chat:activity-clear", handler);
|
|
2863
|
-
return () => window.removeEventListener("agent-chat:activity-clear", handler);
|
|
2864
|
-
}, [tabId]);
|
|
2865
|
-
useEffect(() => {
|
|
2866
|
-
if (!showRunningInUI) {
|
|
2867
|
-
setActivityLabel(null);
|
|
2868
|
-
setActivitySteps([]);
|
|
2869
|
-
}
|
|
2870
|
-
}, [showRunningInUI]);
|
|
2871
2779
|
// Auto-dequeue: when agent finishes running, send the next queued message
|
|
2872
2780
|
useEffect(() => {
|
|
2873
2781
|
if (wasRunningRef.current && !isRunning && queuedMessages.length > 0) {
|
|
@@ -2993,8 +2901,6 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
2993
2901
|
setLoopLimitInfo(null);
|
|
2994
2902
|
setRunErrorInfo(null);
|
|
2995
2903
|
setDismissedRunErrorKey(null);
|
|
2996
|
-
setActivityLabel(null);
|
|
2997
|
-
setActivitySteps([]);
|
|
2998
2904
|
userStoppedRunRef.current = null;
|
|
2999
2905
|
// Selection context attached via Cmd+I is one-shot — clear it as soon
|
|
3000
2906
|
// as the user actually sends a message so it can't be re-used.
|
|
@@ -3291,11 +3197,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
3291
3197
|
? { skipLabel: guidedQuestionsSkipLabel }
|
|
3292
3198
|
: {}), ...(guidedQuestionsSubmitLabel
|
|
3293
3199
|
? { submitLabel: guidedQuestionsSubmitLabel }
|
|
3294
|
-
: {}), className: "h-auto items-stretch justify-stretch bg-transparent" }) }) })), showPlanModeCallout && (_jsx(PlanModeCallout, { canImplementPlan: canImplementPlan, onImplementPlan: handleImplementPlan, onSwitchToAct: handleSwitchToAct })), _jsx(SelectionAttachedPill, {}), showRunningInUI && (_jsx(RunningActivityStatus, {
|
|
3295
|
-
? "Reconnecting"
|
|
3296
|
-
: SHOW_AGENT_ACTIVITY_STEPS
|
|
3297
|
-
? (activityLabel ?? "Thinking")
|
|
3298
|
-
: "Thinking" })), _jsxs(AgentComposerFrame, { layoutVariant: composerLayoutVariant, className: cn(composerAreaClassName, missingApiKey && "cursor-pointer", isComposerDisabled && "opacity-70"), onClick: missingApiKey
|
|
3200
|
+
: {}), className: "h-auto items-stretch justify-stretch bg-transparent" }) }) })), showPlanModeCallout && (_jsx(PlanModeCallout, { canImplementPlan: canImplementPlan, onImplementPlan: handleImplementPlan, onSwitchToAct: handleSwitchToAct })), _jsx(SelectionAttachedPill, {}), showRunningInUI && (_jsx(RunningActivityStatus, { label: isReconnecting ? "Reconnecting" : "Thinking" })), _jsxs(AgentComposerFrame, { layoutVariant: composerLayoutVariant, className: cn(composerAreaClassName, missingApiKey && "cursor-pointer", isComposerDisabled && "opacity-70"), onClick: missingApiKey
|
|
3299
3201
|
? () => setMissingKeyBouncePulse((p) => p + 1)
|
|
3300
3202
|
: undefined, children: [_jsx(ComposerAttachmentPreviewStrip, {}), _jsx(TiptapComposer, { focusRef: tiptapRef, disabled: isComposerDisabled, placeholder: missingApiKey
|
|
3301
3203
|
? "Connect an AI engine above to start chatting…"
|