@agent-native/core 0.14.4 → 0.14.6
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/thread-data-builder.d.ts +11 -1
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +133 -50
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/chat-threads/store.d.ts +6 -1
- package/dist/chat-threads/store.d.ts.map +1 -1
- package/dist/chat-threads/store.js +109 -40
- package/dist/chat-threads/store.js.map +1 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +8 -1
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +72 -5
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.js +2 -2
- package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
- package/dist/client/sharing/ShareButton.d.ts +18 -5
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +8 -45
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/dist/client/sharing/ShareButton.spec.js +13 -31
- package/dist/client/sharing/ShareButton.spec.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +6 -0
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/ssr-handler.d.ts.map +1 -1
- package/dist/server/ssr-handler.js +35 -2
- package/dist/server/ssr-handler.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;AA4Bf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+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KAAK,IAAI,CAAC;IACnD,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;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;AAy+C7B,eAAO,MAAM,aAAa,gGA4DxB,CAAC"}
|
|
@@ -238,6 +238,64 @@ function activeRunLooksStale(runInfo) {
|
|
|
238
238
|
function repoHasAssistantMessage(repo) {
|
|
239
239
|
return repo?.messages?.some((m) => (m.message?.role ?? m.role) === "assistant");
|
|
240
240
|
}
|
|
241
|
+
function getRepoMessages(repo) {
|
|
242
|
+
return Array.isArray(repo?.messages) ? repo.messages : [];
|
|
243
|
+
}
|
|
244
|
+
function getRepoMessage(entry) {
|
|
245
|
+
return entry?.message ?? entry;
|
|
246
|
+
}
|
|
247
|
+
function isAssistantMessageTerminal(message) {
|
|
248
|
+
const statusType = message?.status && typeof message.status === "object"
|
|
249
|
+
? message.status.type
|
|
250
|
+
: undefined;
|
|
251
|
+
return statusType === "complete" || statusType === "incomplete";
|
|
252
|
+
}
|
|
253
|
+
function repoTextLength(repo) {
|
|
254
|
+
let length = 0;
|
|
255
|
+
for (const entry of getRepoMessages(repo)) {
|
|
256
|
+
const message = getRepoMessage(entry);
|
|
257
|
+
const content = message?.content;
|
|
258
|
+
if (typeof content === "string") {
|
|
259
|
+
length += content.length;
|
|
260
|
+
}
|
|
261
|
+
else if (Array.isArray(content)) {
|
|
262
|
+
for (const part of content) {
|
|
263
|
+
if (part?.type === "text" && typeof part.text === "string") {
|
|
264
|
+
length += part.text.length;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return length;
|
|
270
|
+
}
|
|
271
|
+
function repoTerminalAssistantCount(repo) {
|
|
272
|
+
return getRepoMessages(repo).filter((entry) => {
|
|
273
|
+
const message = getRepoMessage(entry);
|
|
274
|
+
return message?.role === "assistant" && isAssistantMessageTerminal(message);
|
|
275
|
+
}).length;
|
|
276
|
+
}
|
|
277
|
+
function shouldImportServerThreadData(currentRepo, incomingRepo) {
|
|
278
|
+
const incomingCount = getRepoMessages(incomingRepo).length;
|
|
279
|
+
if (incomingCount === 0)
|
|
280
|
+
return false;
|
|
281
|
+
const currentCount = getRepoMessages(currentRepo).length;
|
|
282
|
+
if (currentCount === 0)
|
|
283
|
+
return true;
|
|
284
|
+
if (incomingCount < currentCount)
|
|
285
|
+
return false;
|
|
286
|
+
if (incomingCount === currentCount) {
|
|
287
|
+
const currentTerminalAssistants = repoTerminalAssistantCount(currentRepo);
|
|
288
|
+
const incomingTerminalAssistants = repoTerminalAssistantCount(incomingRepo);
|
|
289
|
+
if (incomingTerminalAssistants < currentTerminalAssistants) {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
if (incomingTerminalAssistants <= currentTerminalAssistants &&
|
|
293
|
+
repoTextLength(incomingRepo) < repoTextLength(currentRepo)) {
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
241
299
|
function clearPendingSelection() {
|
|
242
300
|
fetch(agentNativePath(`/_agent-native/application-state/${PENDING_SELECTION_KEY}`), {
|
|
243
301
|
method: "DELETE",
|
|
@@ -1433,7 +1491,7 @@ function ensureMessageMetadata(repo) {
|
|
|
1433
1491
|
return repo;
|
|
1434
1492
|
}
|
|
1435
1493
|
// Re-export for backwards compatibility
|
|
1436
|
-
import { extractThreadMeta } from "../agent/thread-data-builder.js";
|
|
1494
|
+
import { extractThreadMeta, normalizeThreadRepository, } from "../agent/thread-data-builder.js";
|
|
1437
1495
|
export { extractThreadMeta };
|
|
1438
1496
|
const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateText, suggestions, showHeader = true, onSwitchToCli, className, apiUrl, tabId, threadId, onMessageCountChange, onSaveThread, onGenerateTitle, composerSlot, composerDisabled = false, composerDisabledPlaceholder, isNewThread, onSlashCommand, execMode, onExecModeChange, planModeDisabled, planModeDisabledReason, selectedModel, defaultModel, selectedEngine, selectedEffort, availableModels, onModelChange, onEffortChange, onForkChat, }, ref) {
|
|
1439
1497
|
const scrollRef = useRef(null);
|
|
@@ -1498,12 +1556,21 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
|
|
|
1498
1556
|
onGenerateTitleRef.current = onGenerateTitle;
|
|
1499
1557
|
const titleGeneratedRef = useRef(false);
|
|
1500
1558
|
const importThreadData = useCallback((threadData, options) => {
|
|
1501
|
-
const repo = typeof threadData === "string" ? JSON.parse(threadData) : threadData;
|
|
1559
|
+
const repo = normalizeThreadRepository(typeof threadData === "string" ? JSON.parse(threadData) : threadData);
|
|
1502
1560
|
if (repo?.messages?.length > 0) {
|
|
1503
|
-
|
|
1504
|
-
|
|
1561
|
+
let shouldImport = true;
|
|
1562
|
+
try {
|
|
1563
|
+
shouldImport = shouldImportServerThreadData(normalizeThreadRepository(threadRuntime.export()), repo);
|
|
1564
|
+
}
|
|
1565
|
+
catch {
|
|
1566
|
+
shouldImport = true;
|
|
1567
|
+
}
|
|
1568
|
+
if (shouldImport) {
|
|
1569
|
+
if (options?.markTitleGenerated) {
|
|
1570
|
+
titleGeneratedRef.current = true;
|
|
1571
|
+
}
|
|
1572
|
+
threadRuntime.import(ensureMessageMetadata(repo));
|
|
1505
1573
|
}
|
|
1506
|
-
threadRuntime.import(ensureMessageMetadata(repo));
|
|
1507
1574
|
}
|
|
1508
1575
|
if (Array.isArray(repo?.queuedMessages)) {
|
|
1509
1576
|
setQueuedMessages(repo.queuedMessages);
|