@agent-native/core 0.35.3 → 0.37.0
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/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +249 -11
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +25 -25
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +32 -15
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +68 -24
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/composer/ComposerPlusMenu.d.ts.map +1 -1
- package/dist/client/composer/ComposerPlusMenu.js +174 -8
- package/dist/client/composer/ComposerPlusMenu.js.map +1 -1
- package/dist/client/composer/PromptComposer.d.ts +2 -0
- package/dist/client/composer/PromptComposer.d.ts.map +1 -1
- package/dist/client/composer/PromptComposer.js +2 -2
- package/dist/client/composer/PromptComposer.js.map +1 -1
- package/dist/client/composer/TiptapComposer.js +1 -1
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/context-xray/ContextMeter.d.ts +2 -1
- package/dist/client/context-xray/ContextMeter.d.ts.map +1 -1
- package/dist/client/context-xray/ContextMeter.js +19 -25
- package/dist/client/context-xray/ContextMeter.js.map +1 -1
- package/dist/client/context-xray/ContextXRayPanel.d.ts +1 -3
- package/dist/client/context-xray/ContextXRayPanel.d.ts.map +1 -1
- package/dist/client/context-xray/ContextXRayPanel.js +27 -24
- package/dist/client/context-xray/ContextXRayPanel.js.map +1 -1
- package/dist/client/conversation/AgentConversation.d.ts.map +1 -1
- package/dist/client/conversation/AgentConversation.js +2 -1
- package/dist/client/conversation/AgentConversation.js.map +1 -1
- package/dist/client/dynamic-suggestions.d.ts +13 -7
- package/dist/client/dynamic-suggestions.d.ts.map +1 -1
- package/dist/client/dynamic-suggestions.js +23 -12
- package/dist/client/dynamic-suggestions.js.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/route-state.d.ts +116 -0
- package/dist/client/route-state.d.ts.map +1 -0
- package/dist/client/route-state.js +205 -0
- package/dist/client/route-state.js.map +1 -0
- package/dist/client/sse-event-processor.d.ts +1 -0
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +62 -15
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/client/tool-display.d.ts +4 -0
- package/dist/client/tool-display.d.ts.map +1 -0
- package/dist/client/tool-display.js +28 -0
- package/dist/client/tool-display.js.map +1 -0
- package/dist/client/use-chat-threads.d.ts.map +1 -1
- package/dist/client/use-chat-threads.js +40 -31
- package/dist/client/use-chat-threads.js.map +1 -1
- package/dist/client/use-external-value.d.ts.map +1 -1
- package/dist/client/use-external-value.js +14 -7
- package/dist/client/use-external-value.js.map +1 -1
- package/dist/extensions/html-shell.d.ts +3 -2
- package/dist/extensions/html-shell.d.ts.map +1 -1
- package/dist/extensions/html-shell.js +12 -2
- package/dist/extensions/html-shell.js.map +1 -1
- package/dist/extensions/routes.js +2 -7
- package/dist/extensions/routes.js.map +1 -1
- package/dist/server/core-routes-plugin.js +2 -2
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/security-headers.d.ts +16 -19
- package/dist/server/security-headers.d.ts.map +1 -1
- package/dist/server/security-headers.js +24 -25
- package/dist/server/security-headers.js.map +1 -1
- package/dist/templates/default/AGENTS.md +7 -1
- package/dist/templates/default/app/hooks/use-navigation-state.ts +10 -76
- package/docs/content/context-awareness.md +90 -48
- package/docs/content/creating-templates.md +22 -1
- package/docs/content/external-agents.md +1 -1
- package/package.json +2 -1
- package/src/templates/default/AGENTS.md +7 -1
- package/src/templates/default/app/hooks/use-navigation-state.ts +10 -76
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-chat-adapter.d.ts","sourceRoot":"","sources":["../../src/client/agent-chat-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,qBAAqB,CAAC;AAgBhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAKrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,MAAM,oBAAoB;AAC9B;;;;GAIG;AACD,KAAK;AACP,0EAA0E;GACxE,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-chat-adapter.d.ts","sourceRoot":"","sources":["../../src/client/agent-chat-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,qBAAqB,CAAC;AAgBhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAKrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,MAAM,oBAAoB;AAC9B;;;;GAIG;AACD,KAAK;AACP,0EAA0E;GACxE,WAAW,CAAC;AAm6BhB;;;;GAIG;AACH;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IAC3C,SAAS,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IAC5C,SAAS,CAAC,EAAE;QAAE,OAAO,EAAE,eAAe,GAAG,SAAS,CAAA;KAAE,CAAC;IACrD,WAAW,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE;QAAE,OAAO,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,CAAA;KAAE,CAAC;IAC3D,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC,GAAG,gBAAgB,CA4/BnB"}
|
|
@@ -70,6 +70,8 @@ function contentToContinuationHistory(content) {
|
|
|
70
70
|
chunks.push(part.text.trim());
|
|
71
71
|
continue;
|
|
72
72
|
}
|
|
73
|
+
if (part.activity === true)
|
|
74
|
+
continue;
|
|
73
75
|
const toolSummary = [
|
|
74
76
|
`Tool: ${part.toolName}`,
|
|
75
77
|
part.argsText ? `Input: ${part.argsText}` : "",
|
|
@@ -317,6 +319,8 @@ function contentToStructuredMessages(content, nextToolCallId, options) {
|
|
|
317
319
|
continue;
|
|
318
320
|
}
|
|
319
321
|
if (isToolCallContentPart(part)) {
|
|
322
|
+
if (part.activity === true)
|
|
323
|
+
continue;
|
|
320
324
|
const toolCallId = nextToolCallId();
|
|
321
325
|
assistantParts.push({
|
|
322
326
|
type: "tool-call",
|
|
@@ -378,6 +382,8 @@ function assistantUiMessagesToStructuredHistory(messages) {
|
|
|
378
382
|
continue;
|
|
379
383
|
}
|
|
380
384
|
if (part?.type === "tool-call") {
|
|
385
|
+
if (part.activity === true)
|
|
386
|
+
continue;
|
|
381
387
|
const toolNameRaw = typeof part.toolName === "string"
|
|
382
388
|
? part.toolName
|
|
383
389
|
: typeof part.name === "string"
|
|
@@ -437,20 +443,6 @@ function limitPriorMessagesForRequest(messages) {
|
|
|
437
443
|
function combineContinuationHistory(fragments) {
|
|
438
444
|
return truncateForContinuation(fragments.filter(Boolean).join("\n\n"), 40_000).trim();
|
|
439
445
|
}
|
|
440
|
-
function visibleTransientContinuationContent(content) {
|
|
441
|
-
// NOTE: this intentionally keeps ONLY completed tool calls, dropping
|
|
442
|
-
// already-streamed text, on a transient continuation. Preserving the text
|
|
443
|
-
// here is desirable (it's the live "paragraphs disappear" flicker) BUT it
|
|
444
|
-
// breaks visibleContentForContinuation's part-count prefix slicing: the
|
|
445
|
-
// resumed run's text concatenates into the preserved trailing text part, so
|
|
446
|
-
// the "new chunk" reads as empty and the empty-continuation cap gives up
|
|
447
|
-
// prematurely on text-heavy multi-continuation turns. The durable fix
|
|
448
|
-
// (server-side foldAssistantTurn) already preserves the text in thread_data,
|
|
449
|
-
// so no data is lost — only the live render flickers. Fixing the flicker
|
|
450
|
-
// safely requires reworking the prefix/new-chunk detection to diff by text
|
|
451
|
-
// length rather than part count; see the agent-run reliability follow-up.
|
|
452
|
-
return content.filter((part) => part.type === "tool-call" && part.result !== undefined);
|
|
453
|
-
}
|
|
454
446
|
function hasContinuationProgress(content) {
|
|
455
447
|
return content.some((part) => part.type === "text"
|
|
456
448
|
? part.text.trim().length > 0
|
|
@@ -464,7 +456,9 @@ function hasContinuationProgress(content) {
|
|
|
464
456
|
* must not count this against the stalled/empty continuation budgets.
|
|
465
457
|
*/
|
|
466
458
|
function hasInFlightToolCall(content) {
|
|
467
|
-
return content.some((part) => part.type === "tool-call" &&
|
|
459
|
+
return content.some((part) => part.type === "tool-call" &&
|
|
460
|
+
part.result === undefined &&
|
|
461
|
+
part.activity !== true);
|
|
468
462
|
}
|
|
469
463
|
function lastActivityTool(trail) {
|
|
470
464
|
for (let i = trail.length - 1; i >= 0; i--) {
|
|
@@ -477,6 +471,59 @@ function lastActivityTool(trail) {
|
|
|
477
471
|
function snapshotContent(content) {
|
|
478
472
|
return content.map((part) => part.type === "text" ? { ...part } : { ...part, args: { ...part.args } });
|
|
479
473
|
}
|
|
474
|
+
function stableJson(value) {
|
|
475
|
+
try {
|
|
476
|
+
return JSON.stringify(value);
|
|
477
|
+
}
|
|
478
|
+
catch {
|
|
479
|
+
return String(value ?? "");
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
function toolContinuationKey(part) {
|
|
483
|
+
return [
|
|
484
|
+
part.toolCallId,
|
|
485
|
+
part.toolName,
|
|
486
|
+
part.argsText,
|
|
487
|
+
stableJson(part.args),
|
|
488
|
+
part.result === undefined ? "pending" : "done",
|
|
489
|
+
part.result ?? "",
|
|
490
|
+
part.activity === true ? "activity" : "tool",
|
|
491
|
+
part.mcpApp ? "mcp-app" : "",
|
|
492
|
+
].join("\u0000");
|
|
493
|
+
}
|
|
494
|
+
function contentAfterContinuationPrefix(content, prefix) {
|
|
495
|
+
if (prefix.length === 0)
|
|
496
|
+
return content;
|
|
497
|
+
const delta = [];
|
|
498
|
+
let contentIndex = 0;
|
|
499
|
+
for (const prefixPart of prefix) {
|
|
500
|
+
const currentPart = content[contentIndex];
|
|
501
|
+
if (!currentPart)
|
|
502
|
+
return content.slice(contentIndex);
|
|
503
|
+
if (prefixPart.type === "text" && currentPart.type === "text") {
|
|
504
|
+
if (currentPart.text === prefixPart.text) {
|
|
505
|
+
contentIndex += 1;
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
if (currentPart.text.startsWith(prefixPart.text)) {
|
|
509
|
+
const appendedText = currentPart.text.slice(prefixPart.text.length);
|
|
510
|
+
if (appendedText)
|
|
511
|
+
delta.push({ type: "text", text: appendedText });
|
|
512
|
+
contentIndex += 1;
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
return content.slice(contentIndex);
|
|
516
|
+
}
|
|
517
|
+
if (prefixPart.type === "tool-call" &&
|
|
518
|
+
currentPart.type === "tool-call" &&
|
|
519
|
+
toolContinuationKey(currentPart) === toolContinuationKey(prefixPart)) {
|
|
520
|
+
contentIndex += 1;
|
|
521
|
+
continue;
|
|
522
|
+
}
|
|
523
|
+
return content.slice(contentIndex);
|
|
524
|
+
}
|
|
525
|
+
return [...delta, ...content.slice(contentIndex)];
|
|
526
|
+
}
|
|
480
527
|
function autoContinueMessage(signal) {
|
|
481
528
|
const tool = lastActivityTool(signal.activityTrail);
|
|
482
529
|
const reason = signal.reason === "loop_limit"
|
|
@@ -1023,11 +1070,7 @@ export function createAgentChatAdapter(options) {
|
|
|
1023
1070
|
return false;
|
|
1024
1071
|
};
|
|
1025
1072
|
const visibleContentForContinuation = () => {
|
|
1026
|
-
|
|
1027
|
-
visibleContinuationPrefix.every((part, index) => content[index] === part)) {
|
|
1028
|
-
return content.slice(visibleContinuationPrefix.length);
|
|
1029
|
-
}
|
|
1030
|
-
return content;
|
|
1073
|
+
return contentAfterContinuationPrefix(content, visibleContinuationPrefix);
|
|
1031
1074
|
};
|
|
1032
1075
|
const prepareAutoContinuation = (signal) => {
|
|
1033
1076
|
lastAutoContinueReason = signal.reason;
|
|
@@ -1137,10 +1180,11 @@ export function createAgentChatAdapter(options) {
|
|
|
1137
1180
|
if (!isTransient) {
|
|
1138
1181
|
return { ok: true, resetVisibleContent: false };
|
|
1139
1182
|
}
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1183
|
+
// Keep everything visible during transient recovery. The continuation
|
|
1184
|
+
// prefix diff tracks what the next request has already seen, so
|
|
1185
|
+
// preserving text no longer causes duplicate continuation history.
|
|
1186
|
+
visibleContinuationPrefix = snapshotContent(content);
|
|
1187
|
+
return { ok: true, resetVisibleContent: false };
|
|
1144
1188
|
};
|
|
1145
1189
|
while (true) {
|
|
1146
1190
|
try {
|