@agent-native/core 0.22.8 → 0.22.10
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/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +8 -12
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +7 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +106 -23
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/FeedbackButton.d.ts +5 -1
- package/dist/client/FeedbackButton.d.ts.map +1 -1
- package/dist/client/FeedbackButton.js +20 -3
- package/dist/client/FeedbackButton.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts +10 -0
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +6 -19
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/analytics.d.ts +1 -1
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +2 -40
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/clipboard.d.ts +2 -0
- package/dist/client/clipboard.d.ts.map +1 -0
- package/dist/client/clipboard.js +51 -0
- package/dist/client/clipboard.js.map +1 -0
- package/dist/client/feedback-context.d.ts +11 -0
- package/dist/client/feedback-context.d.ts.map +1 -0
- package/dist/client/feedback-context.js +73 -0
- package/dist/client/feedback-context.js.map +1 -0
- package/dist/client/url-scrub.d.ts +2 -0
- package/dist/client/url-scrub.d.ts.map +1 -0
- package/dist/client/url-scrub.js +41 -0
- package/dist/client/url-scrub.js.map +1 -0
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +7 -3
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/mcp/builtin-tools.js +3 -3
- package/dist/mcp/builtin-tools.js.map +1 -1
- package/dist/mcp/embed-app.js +3 -3
- package/dist/mcp/embed-app.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +5 -0
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +74 -59
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ChatModelAdapter, ExportedMessageRepository } from "@assistant-ui/react";
|
|
3
|
+
import { type AgentChatSurfaceKind } from "./agent-chat-adapter.js";
|
|
3
4
|
import { type AgentDynamicSuggestionsOption } from "./dynamic-suggestions.js";
|
|
4
5
|
import type { ReasoningEffort } from "../shared/reasoning-effort.js";
|
|
5
6
|
import type { ChatThreadScope, ChatThreadSnapshot } from "./use-chat-threads.js";
|
|
@@ -59,6 +60,7 @@ export interface AssistantChatAdapterContext {
|
|
|
59
60
|
scopeRef: {
|
|
60
61
|
current: ChatThreadScope | null | undefined;
|
|
61
62
|
};
|
|
63
|
+
surface: AgentChatSurfaceKind;
|
|
62
64
|
}
|
|
63
65
|
export interface AssistantChatProps {
|
|
64
66
|
/** API endpoint URL. Default: "/_agent-native/agent-chat" */
|
|
@@ -71,6 +73,11 @@ export interface AssistantChatProps {
|
|
|
71
73
|
threadId?: string;
|
|
72
74
|
/** Resource scope to include with chat requests for server-side context. */
|
|
73
75
|
contextScope?: ChatThreadScope | null;
|
|
76
|
+
/**
|
|
77
|
+
* Identifies which surface hosts this chat. Defaults to "app", which keeps
|
|
78
|
+
* dev filesystem/bash code-editing tools out of in-product sidebars.
|
|
79
|
+
*/
|
|
80
|
+
agentChatSurface?: AgentChatSurfaceKind;
|
|
74
81
|
/** Placeholder text for empty state */
|
|
75
82
|
emptyStateText?: string;
|
|
76
83
|
/** Suggestion prompts shown when no messages */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantChat.d.ts","sourceRoot":"","sources":["../../src/client/AssistantChat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAaf,OAAO,KAAK,EAEV,gBAA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G,OAAO,CAAC,CAAC;IAC5D,oEAAoE;IACpE,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,QAAQ,CAAC;IACjD;;;OAGG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,2BAA2B,KAAK,gBAAgB,CAAC;IAC3E;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAC;IACxE,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAC3C;AAED,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAEjD,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,QAI9C;AAqCD,OAAO,EACL,iBAAiB,EAElB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAyvD7B,eAAO,MAAM,aAAa,gGAuFxB,CAAC"}
|
|
@@ -5,12 +5,13 @@ import { CompositeAttachmentAdapter } from "@assistant-ui/react";
|
|
|
5
5
|
import { MarkdownTextPrimitive } from "@assistant-ui/react-markdown";
|
|
6
6
|
import ReactMarkdown, { defaultUrlTransform } from "react-markdown";
|
|
7
7
|
import remarkGfm from "remark-gfm";
|
|
8
|
-
import { createAgentChatAdapter } from "./agent-chat-adapter.js";
|
|
8
|
+
import { createAgentChatAdapter, } from "./agent-chat-adapter.js";
|
|
9
9
|
import { useAgentDynamicSuggestions, } from "./dynamic-suggestions.js";
|
|
10
10
|
import { getActiveRun } from "./active-run-state.js";
|
|
11
11
|
import { AgentAutoContinueSignal, readSSEStreamRaw, } from "./sse-event-processor.js";
|
|
12
12
|
import { captureError } from "./analytics.js";
|
|
13
13
|
import { cn } from "./utils.js";
|
|
14
|
+
import { writeClipboardText } from "./clipboard.js";
|
|
14
15
|
import { useNearBottomAutoscroll } from "./conversation/index.js";
|
|
15
16
|
import { TextAttachmentAdapter } from "./composer/attachment-accept.js";
|
|
16
17
|
import { AgentTaskCard } from "./AgentTaskCard.js";
|
|
@@ -374,6 +375,15 @@ function shouldImportServerThreadData(currentRepo, incomingRepo) {
|
|
|
374
375
|
}
|
|
375
376
|
return true;
|
|
376
377
|
}
|
|
378
|
+
function cloneContentParts(content) {
|
|
379
|
+
return content.map((part) => part.type === "text"
|
|
380
|
+
? { ...part }
|
|
381
|
+
: {
|
|
382
|
+
...part,
|
|
383
|
+
args: { ...part.args },
|
|
384
|
+
...(part.mcpApp ? { mcpApp: { ...part.mcpApp } } : {}),
|
|
385
|
+
});
|
|
386
|
+
}
|
|
377
387
|
function clearPendingSelection() {
|
|
378
388
|
fetch(agentNativePath(`/_agent-native/application-state/${PENDING_SELECTION_KEY}`), {
|
|
379
389
|
method: "DELETE",
|
|
@@ -882,11 +892,12 @@ function ToolDetailViewer({ payload }) {
|
|
|
882
892
|
}, []);
|
|
883
893
|
const copyValue = useCallback(async () => {
|
|
884
894
|
try {
|
|
885
|
-
await
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
895
|
+
if (await writeClipboardText(payload.copyText)) {
|
|
896
|
+
setCopied(true);
|
|
897
|
+
if (copyResetRef.current)
|
|
898
|
+
clearTimeout(copyResetRef.current);
|
|
899
|
+
copyResetRef.current = setTimeout(() => setCopied(false), 1200);
|
|
900
|
+
}
|
|
890
901
|
}
|
|
891
902
|
catch {
|
|
892
903
|
// Clipboard failures should not interrupt chat rendering.
|
|
@@ -1251,12 +1262,15 @@ function MessageActionsMenu({ showRevert, onRevert, } = {}) {
|
|
|
1251
1262
|
.filter((p) => p.type === "text")
|
|
1252
1263
|
.map((p) => p.text)
|
|
1253
1264
|
.join("\n");
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
setCopied(
|
|
1258
|
-
|
|
1259
|
-
|
|
1265
|
+
void writeClipboardText(text).then((ok) => {
|
|
1266
|
+
if (!ok)
|
|
1267
|
+
return;
|
|
1268
|
+
setCopied("message");
|
|
1269
|
+
setTimeout(() => {
|
|
1270
|
+
setCopied(null);
|
|
1271
|
+
setOpen(false);
|
|
1272
|
+
}, 1000);
|
|
1273
|
+
});
|
|
1260
1274
|
}, [messageRuntime]);
|
|
1261
1275
|
const handleCopyRequestId = useCallback(() => {
|
|
1262
1276
|
const m = messageRuntime.getState();
|
|
@@ -1271,12 +1285,15 @@ function MessageActionsMenu({ showRevert, onRevert, } = {}) {
|
|
|
1271
1285
|
(typeof window !== "undefined" ? getActiveRun()?.runId : null) ||
|
|
1272
1286
|
m.id ||
|
|
1273
1287
|
"";
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
setCopied(
|
|
1278
|
-
|
|
1279
|
-
|
|
1288
|
+
void writeClipboardText(runId).then((ok) => {
|
|
1289
|
+
if (!ok)
|
|
1290
|
+
return;
|
|
1291
|
+
setCopied("id");
|
|
1292
|
+
setTimeout(() => {
|
|
1293
|
+
setCopied(null);
|
|
1294
|
+
setOpen(false);
|
|
1295
|
+
}, 1000);
|
|
1296
|
+
});
|
|
1280
1297
|
}, [messageRuntime]);
|
|
1281
1298
|
const handleForkChat = useCallback(() => {
|
|
1282
1299
|
setOpen(false);
|
|
@@ -1547,9 +1564,12 @@ function RunErrorRecoveryCard({ info, onContinue, onRetry, onFork, onDismiss, })
|
|
|
1547
1564
|
]
|
|
1548
1565
|
.filter(Boolean)
|
|
1549
1566
|
.join("\n\n");
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1567
|
+
void writeClipboardText(text).then((ok) => {
|
|
1568
|
+
if (!ok)
|
|
1569
|
+
return;
|
|
1570
|
+
setCopied(true);
|
|
1571
|
+
setTimeout(() => setCopied(false), 1200);
|
|
1572
|
+
});
|
|
1553
1573
|
}, [info]);
|
|
1554
1574
|
const startNewChat = useCallback(() => {
|
|
1555
1575
|
window.dispatchEvent(new CustomEvent("agent-chat:new-chat"));
|
|
@@ -2633,7 +2653,68 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
2633
2653
|
setForceStopped(false);
|
|
2634
2654
|
}
|
|
2635
2655
|
}, [isReconnecting, forceStopped]);
|
|
2656
|
+
const materializeFrozenReconnectContent = useCallback(() => {
|
|
2657
|
+
if (!reconnectFrozen || reconnectContent.length === 0)
|
|
2658
|
+
return;
|
|
2659
|
+
try {
|
|
2660
|
+
const repo = normalizeThreadRepository(threadRuntime.export());
|
|
2661
|
+
const messages = getRepoMessages(repo);
|
|
2662
|
+
const lastEntry = messages[messages.length - 1];
|
|
2663
|
+
const lastMessage = getRepoMessage(lastEntry);
|
|
2664
|
+
const parentId = typeof repo.headId === "string"
|
|
2665
|
+
? repo.headId
|
|
2666
|
+
: typeof lastMessage?.id === "string"
|
|
2667
|
+
? lastMessage.id
|
|
2668
|
+
: null;
|
|
2669
|
+
const runId = runErrorInfo?.runId ?? reconnectRunIdRef.current;
|
|
2670
|
+
const id = `reconnect-${runId ?? Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
2671
|
+
repo.messages = [
|
|
2672
|
+
...messages,
|
|
2673
|
+
{
|
|
2674
|
+
parentId,
|
|
2675
|
+
message: {
|
|
2676
|
+
id,
|
|
2677
|
+
role: "assistant",
|
|
2678
|
+
createdAt: new Date(),
|
|
2679
|
+
content: cloneContentParts(reconnectContent),
|
|
2680
|
+
status: { type: "complete", reason: "stop" },
|
|
2681
|
+
metadata: {
|
|
2682
|
+
custom: {
|
|
2683
|
+
reconnectFrozen: true,
|
|
2684
|
+
...(runId ? { runId } : {}),
|
|
2685
|
+
},
|
|
2686
|
+
},
|
|
2687
|
+
},
|
|
2688
|
+
},
|
|
2689
|
+
];
|
|
2690
|
+
repo.headId = id;
|
|
2691
|
+
threadRuntime.import(ensureMessageMetadata(repo));
|
|
2692
|
+
setReconnectFrozen(false);
|
|
2693
|
+
setReconnectContent([]);
|
|
2694
|
+
}
|
|
2695
|
+
catch (err) {
|
|
2696
|
+
captureError(err, {
|
|
2697
|
+
tags: {
|
|
2698
|
+
source: "agent-chat-client",
|
|
2699
|
+
phase: "materialize-reconnect-content",
|
|
2700
|
+
},
|
|
2701
|
+
extra: {
|
|
2702
|
+
threadId: threadId ?? null,
|
|
2703
|
+
tabId: tabId ?? null,
|
|
2704
|
+
reconnectParts: reconnectContent.length,
|
|
2705
|
+
},
|
|
2706
|
+
});
|
|
2707
|
+
}
|
|
2708
|
+
}, [
|
|
2709
|
+
reconnectFrozen,
|
|
2710
|
+
reconnectContent,
|
|
2711
|
+
runErrorInfo?.runId,
|
|
2712
|
+
tabId,
|
|
2713
|
+
threadId,
|
|
2714
|
+
threadRuntime,
|
|
2715
|
+
]);
|
|
2636
2716
|
const addToQueue = useCallback(async (text, images, references, attachments, requestMode, intent = "queued") => {
|
|
2717
|
+
materializeFrozenReconnectContent();
|
|
2637
2718
|
setShowContinue(false);
|
|
2638
2719
|
setLoopLimitInfo(null);
|
|
2639
2720
|
setRunErrorInfo(null);
|
|
@@ -2692,7 +2773,7 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
2692
2773
|
...createUserMessageRunConfig(references, effectiveRequestMode),
|
|
2693
2774
|
});
|
|
2694
2775
|
}
|
|
2695
|
-
}, [execMode, isRunning, threadRuntime]);
|
|
2776
|
+
}, [execMode, isRunning, materializeFrozenReconnectContent, threadRuntime]);
|
|
2696
2777
|
// Expose imperative handle
|
|
2697
2778
|
useImperativeHandle(ref, () => ({
|
|
2698
2779
|
sendMessage(text) {
|
|
@@ -2930,6 +3011,7 @@ export const AssistantChat = forwardRef(function AssistantChat({ apiUrl = agentN
|
|
|
2930
3011
|
execModeRef.current = props.execMode;
|
|
2931
3012
|
const scopeRef = useRef(contextScope);
|
|
2932
3013
|
scopeRef.current = contextScope;
|
|
3014
|
+
const surface = props.agentChatSurface ?? "app";
|
|
2933
3015
|
const createAdapterRef = useRef(props.createAdapter);
|
|
2934
3016
|
createAdapterRef.current = props.createAdapter;
|
|
2935
3017
|
const adapter = useMemo(() => {
|
|
@@ -2943,6 +3025,7 @@ export const AssistantChat = forwardRef(function AssistantChat({ apiUrl = agentN
|
|
|
2943
3025
|
execModeRef,
|
|
2944
3026
|
browserTabId,
|
|
2945
3027
|
scopeRef,
|
|
3028
|
+
surface,
|
|
2946
3029
|
};
|
|
2947
3030
|
const createAdapter = createAdapterRef.current;
|
|
2948
3031
|
return createAdapter
|
|
@@ -2952,7 +3035,7 @@ export const AssistantChat = forwardRef(function AssistantChat({ apiUrl = agentN
|
|
|
2952
3035
|
// Adapter factories must be memoized and use refs for changing values.
|
|
2953
3036
|
// `adapterReloadKey` is an explicit opt-in for embedded hosts whose
|
|
2954
3037
|
// transport identity can change without changing tab/thread ids.
|
|
2955
|
-
[apiUrl, tabId, threadId, browserTabId, props.adapterReloadKey]);
|
|
3038
|
+
[apiUrl, tabId, threadId, browserTabId, surface, props.adapterReloadKey]);
|
|
2956
3039
|
const attachmentAdapter = useMemo(() => new CompositeAttachmentAdapter([
|
|
2957
3040
|
new DownscalingImageAttachmentAdapter(),
|
|
2958
3041
|
new BinaryDocumentAttachmentAdapter(),
|