@agent-native/core 0.12.22 → 0.12.23
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/agent/engine/ai-sdk-engine.d.ts +2 -0
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +4 -2
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/engine/anthropic-engine.d.ts.map +1 -1
- package/dist/agent/engine/anthropic-engine.js +2 -1
- package/dist/agent/engine/anthropic-engine.js.map +1 -1
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +117 -8
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +24 -13
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/production-agent.d.ts +1 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +20 -10
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/client/AgentPanel.js +1 -1
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +120 -5
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/FeedbackButton.js +1 -1
- package/dist/client/FeedbackButton.js.map +1 -1
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +26 -0
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/components/ui/tooltip.js +1 -1
- package/dist/client/components/ui/tooltip.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +2 -6
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +1 -1
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +3 -0
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/extensions/html-shell.d.ts.map +1 -1
- package/dist/extensions/html-shell.js +12 -0
- package/dist/extensions/html-shell.js.map +1 -1
- package/dist/mcp-client/errors.d.ts +2 -0
- package/dist/mcp-client/errors.d.ts.map +1 -0
- package/dist/mcp-client/errors.js +47 -0
- package/dist/mcp-client/errors.js.map +1 -0
- package/dist/mcp-client/manager.d.ts.map +1 -1
- package/dist/mcp-client/manager.js +44 -15
- package/dist/mcp-client/manager.js.map +1 -1
- package/dist/mcp-client/routes.d.ts +1 -2
- package/dist/mcp-client/routes.d.ts.map +1 -1
- package/dist/mcp-client/routes.js +2 -27
- package/dist/mcp-client/routes.js.map +1 -1
- package/dist/progress/store.d.ts +2 -0
- package/dist/progress/store.d.ts.map +1 -1
- package/dist/progress/store.js +44 -0
- package/dist/progress/store.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +31 -9
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/credential-provider.d.ts +8 -0
- package/dist/server/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +29 -3
- package/dist/server/credential-provider.js.map +1 -1
- package/dist/terminal/terminal-plugin.d.ts.map +1 -1
- package/dist/terminal/terminal-plugin.js +4 -3
- package/dist/terminal/terminal-plugin.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantChat.d.ts","sourceRoot":"","sources":["../../src/client/AssistantChat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AA6Bf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"AssistantChat.d.ts","sourceRoot":"","sources":["../../src/client/AssistantChat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AA6Bf,OAAO,KAAK,EAAE,eAAe,EA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C,EAAE,MAAM,QAI9C;AAqCD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAk3C7B,eAAO,MAAM,aAAa,gGA4DxB,CAAC"}
|
|
@@ -70,6 +70,111 @@ function getFileDataURL(file) {
|
|
|
70
70
|
reader.readAsDataURL(file);
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
+
function escapeQueuedAttachmentAttribute(value) {
|
|
74
|
+
return value.replace(/&/g, "&").replace(/"/g, """);
|
|
75
|
+
}
|
|
76
|
+
function isTextLikeFile(file) {
|
|
77
|
+
if (file.type.startsWith("text/"))
|
|
78
|
+
return true;
|
|
79
|
+
if (file.type === "application/json")
|
|
80
|
+
return true;
|
|
81
|
+
return /\.(txt|md|markdown|csv|json|yaml|yml)$/i.test(file.name);
|
|
82
|
+
}
|
|
83
|
+
function textFileAttachmentEnvelope(file, text) {
|
|
84
|
+
const contentType = file.type || "text/plain";
|
|
85
|
+
return `<attachment name="${escapeQueuedAttachmentAttribute(file.name)}" contentType="${escapeQueuedAttachmentAttribute(contentType)}">\n${text}\n</attachment>`;
|
|
86
|
+
}
|
|
87
|
+
function serializeAttachmentContentPart(part) {
|
|
88
|
+
if (part.type === "image" && typeof part.image === "string") {
|
|
89
|
+
return { type: "image", image: part.image };
|
|
90
|
+
}
|
|
91
|
+
if (part.type === "text" && typeof part.text === "string") {
|
|
92
|
+
return { type: "text", text: part.text };
|
|
93
|
+
}
|
|
94
|
+
if (part.type === "file" && typeof part.data === "string") {
|
|
95
|
+
return {
|
|
96
|
+
type: "file",
|
|
97
|
+
data: part.data,
|
|
98
|
+
mimeType: typeof part.mimeType === "string"
|
|
99
|
+
? part.mimeType
|
|
100
|
+
: "application/octet-stream",
|
|
101
|
+
...(typeof part.filename === "string" ? { filename: part.filename } : {}),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
async function serializeQueuedAttachments(attachments) {
|
|
107
|
+
const queued = [];
|
|
108
|
+
for (const raw of attachments ?? []) {
|
|
109
|
+
const attachment = raw;
|
|
110
|
+
const name = attachment.name || attachment.file?.name || "attachment";
|
|
111
|
+
const id = attachment.id || name;
|
|
112
|
+
const type = attachment.type || "file";
|
|
113
|
+
const contentType = attachment.contentType || attachment.file?.type;
|
|
114
|
+
if (Array.isArray(attachment.content) && attachment.content.length > 0) {
|
|
115
|
+
const content = attachment.content
|
|
116
|
+
.map((part) => serializeAttachmentContentPart(part))
|
|
117
|
+
.filter((part) => !!part);
|
|
118
|
+
if (content.length > 0) {
|
|
119
|
+
queued.push({
|
|
120
|
+
id,
|
|
121
|
+
type,
|
|
122
|
+
name,
|
|
123
|
+
contentType,
|
|
124
|
+
status: { type: "complete" },
|
|
125
|
+
content,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (typeof File !== "undefined" && attachment.file instanceof File) {
|
|
131
|
+
const file = attachment.file;
|
|
132
|
+
if (file.type.startsWith("image/")) {
|
|
133
|
+
queued.push({
|
|
134
|
+
id,
|
|
135
|
+
type: "image",
|
|
136
|
+
name,
|
|
137
|
+
contentType: file.type,
|
|
138
|
+
status: { type: "complete" },
|
|
139
|
+
content: [{ type: "image", image: await getFileDataURL(file) }],
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
else if (isTextLikeFile(file)) {
|
|
143
|
+
queued.push({
|
|
144
|
+
id,
|
|
145
|
+
type: "file",
|
|
146
|
+
name,
|
|
147
|
+
contentType: file.type || "text/plain",
|
|
148
|
+
status: { type: "complete" },
|
|
149
|
+
content: [
|
|
150
|
+
{
|
|
151
|
+
type: "text",
|
|
152
|
+
text: textFileAttachmentEnvelope(file, await file.text()),
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
queued.push({
|
|
159
|
+
id,
|
|
160
|
+
type: "document",
|
|
161
|
+
name,
|
|
162
|
+
contentType: inferDocumentContentType(file),
|
|
163
|
+
status: { type: "complete" },
|
|
164
|
+
content: [
|
|
165
|
+
{
|
|
166
|
+
type: "file",
|
|
167
|
+
filename: file.name,
|
|
168
|
+
data: await getFileDataURL(file),
|
|
169
|
+
mimeType: inferDocumentContentType(file),
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return queued.length > 0 ? queued : undefined;
|
|
177
|
+
}
|
|
73
178
|
// ─── Markdown Text ──────────────────────────────────────────────────────────
|
|
74
179
|
const markdownStyles = `
|
|
75
180
|
.agent-markdown > :first-child { margin-top: 0; }
|
|
@@ -1709,6 +1814,9 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1709
1814
|
threadRuntime.append({
|
|
1710
1815
|
role: "user",
|
|
1711
1816
|
content,
|
|
1817
|
+
...(next.attachments && next.attachments.length > 0
|
|
1818
|
+
? { attachments: next.attachments }
|
|
1819
|
+
: {}),
|
|
1712
1820
|
...(next.references && next.references.length > 0
|
|
1713
1821
|
? { runConfig: { custom: { references: next.references } } }
|
|
1714
1822
|
: {}),
|
|
@@ -1747,7 +1855,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1747
1855
|
setForceStopped(false);
|
|
1748
1856
|
}
|
|
1749
1857
|
}, [isReconnecting, forceStopped]);
|
|
1750
|
-
const addToQueue = useCallback((text, images, references) => {
|
|
1858
|
+
const addToQueue = useCallback(async (text, images, references, attachments) => {
|
|
1751
1859
|
setShowContinue(false);
|
|
1752
1860
|
setLoopLimitInfo(null);
|
|
1753
1861
|
setRunErrorInfo(null);
|
|
@@ -1758,6 +1866,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1758
1866
|
// Selection context attached via Cmd+I is one-shot — clear it as soon
|
|
1759
1867
|
// as the user actually sends a message so it can't be re-used.
|
|
1760
1868
|
clearPendingSelection();
|
|
1869
|
+
const queuedAttachments = await serializeQueuedAttachments(attachments);
|
|
1761
1870
|
if (isRunning) {
|
|
1762
1871
|
setQueuedMessages((prev) => [
|
|
1763
1872
|
...prev,
|
|
@@ -1767,6 +1876,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1767
1876
|
: `q-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
1768
1877
|
text,
|
|
1769
1878
|
images,
|
|
1879
|
+
attachments: queuedAttachments,
|
|
1770
1880
|
references,
|
|
1771
1881
|
},
|
|
1772
1882
|
]);
|
|
@@ -1778,7 +1888,13 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1778
1888
|
content.push({ type: "image", image: img });
|
|
1779
1889
|
}
|
|
1780
1890
|
}
|
|
1781
|
-
threadRuntime.append({
|
|
1891
|
+
threadRuntime.append({
|
|
1892
|
+
role: "user",
|
|
1893
|
+
content,
|
|
1894
|
+
...(queuedAttachments && queuedAttachments.length > 0
|
|
1895
|
+
? { attachments: queuedAttachments }
|
|
1896
|
+
: {}),
|
|
1897
|
+
});
|
|
1782
1898
|
}
|
|
1783
1899
|
}, [isRunning, threadRuntime]);
|
|
1784
1900
|
// Expose imperative handle
|
|
@@ -1979,8 +2095,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1979
2095
|
return (_jsx("div", { className: "flex justify-end group", children: _jsxs("div", { className: "relative max-w-[85%] rounded-lg bg-accent/50 text-foreground/60 px-3 py-2 text-sm leading-relaxed whitespace-pre-wrap break-words", children: [_jsxs("div", { className: "flex items-center gap-1.5 text-[10px] text-muted-foreground mb-1 font-medium uppercase tracking-wide", children: [_jsx(IconClock, { className: "h-3 w-3" }), "Queued"] }), displayText, msg.images && msg.images.length > 0 && (_jsx("div", { className: "flex flex-wrap gap-1.5 mt-1.5", children: msg.images.map((img, j) => (_jsx("img", { src: img, alt: "", className: "h-12 w-12 rounded object-cover border border-border/50" }, j))) })), _jsx("button", { type: "button", onClick: () => setQueuedMessages((prev) => prev.filter((m) => m.id !== msg.id)), "aria-label": "Remove from queue", className: "absolute -top-2 -right-2 flex h-5 w-5 items-center justify-center rounded-full border border-border bg-background text-muted-foreground opacity-0 group-hover:opacity-100 focus-visible:opacity-100 hover:text-foreground hover:bg-accent shadow-sm", children: _jsx(IconX, { className: "h-3 w-3" }) })] }) }, msg.id));
|
|
1980
2096
|
})] })) }), showScrollToBottom && (_jsx("div", { className: "shrink-0 flex justify-center -mb-1", children: _jsx("button", { type: "button", onClick: scrollToBottom, className: "flex h-7 w-7 items-center justify-center rounded-full border border-border bg-background shadow-sm hover:bg-accent", "aria-label": "Scroll to bottom", children: _jsx(IconChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground" }) }) })), composerSlot, _jsx(SelectionAttachedPill, {}), _jsx("div", { className: cn("agent-composer-area shrink-0 px-3 py-2", missingApiKey && "cursor-pointer", isComposerDisabled && "opacity-70"), onClick: missingApiKey
|
|
1981
2097
|
? () => setMissingKeyBouncePulse((p) => p + 1)
|
|
1982
|
-
: undefined, children: _jsxs(ComposerPrimitive.Root, { className:
|
|
1983
|
-
"border-amber-500/50 bg-amber-500/[0.03] focus-within:ring-amber-500/30"), children: [_jsx(ComposerAttachmentPreviewStrip, {}), _jsx(TiptapComposer, { focusRef: tiptapRef, disabled: isComposerDisabled, placeholder: missingApiKey
|
|
2098
|
+
: undefined, children: _jsxs(ComposerPrimitive.Root, { className: "flex flex-col rounded-lg border border-input bg-background focus-within:ring-1 focus-within:ring-ring", children: [_jsx(ComposerAttachmentPreviewStrip, {}), _jsx(TiptapComposer, { focusRef: tiptapRef, disabled: isComposerDisabled, placeholder: missingApiKey
|
|
1984
2099
|
? "Connect an AI engine above to start chatting…"
|
|
1985
2100
|
: composerDisabled
|
|
1986
2101
|
? (composerDisabledPlaceholder ??
|
|
@@ -1990,7 +2105,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1990
2105
|
? `${queuedMessages.length} queued — type another...`
|
|
1991
2106
|
: "Queue a message..."
|
|
1992
2107
|
: undefined, onSubmit: isRunning
|
|
1993
|
-
? (text, references) => addToQueue(text, undefined, references.length > 0 ? references : undefined)
|
|
2108
|
+
? (text, references, attachments) => void addToQueue(text, undefined, references.length > 0 ? references : undefined, attachments)
|
|
1994
2109
|
: undefined, onSlashCommand: onSlashCommand, execMode: execMode, onExecModeChange: onExecModeChange, planModeDisabled: planModeDisabled, planModeDisabledReason: planModeDisabledReason, selectedModel: selectedModel ?? defaultModel, selectedEffort: selectedEffort, availableModels: availableModels, onModelChange: onModelChange, onEffortChange: onEffortChange, draftScope: threadId || tabId, interceptBuildRequestsForBuilder: true, extraActionButton: showRunningInUI ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", onClick: () => {
|
|
1995
2110
|
// Nuclear stop: flip forceStopped so isRunning is false
|
|
1996
2111
|
// immediately. This unblocks submission even if the
|