@agent-native/core 0.92.11 → 0.92.12
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/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +6 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/agent/production-agent.ts +33 -2
- package/corpus/core/src/agent/run-manager.ts +41 -10
- package/corpus/core/src/agent/run-store.ts +72 -27
- package/corpus/core/src/client/agent-chat-adapter.ts +56 -12
- package/corpus/templates/clips/app/components/player/transcript-panel.tsx +27 -5
- package/corpus/templates/clips/app/hooks/use-player-shortcuts.ts +1 -0
- package/corpus/templates/clips/changelog/2026-07-10-fixed-copying-agent-responses-and-transcript-text-from-recor.md +6 -0
- package/corpus/templates/content/actions/_builder-cms-read-client.ts +82 -7
- package/corpus/templates/content/actions/_database-source-utils.ts +149 -30
- package/corpus/templates/content/actions/add-content-database-source-field-property.ts +4 -7
- package/corpus/templates/content/actions/attach-content-database-source.ts +41 -17
- package/corpus/templates/content/actions/change-content-database-source-role.ts +46 -8
- package/corpus/templates/content/actions/suggest-source-join-key.ts +8 -1
- package/corpus/templates/content/changelog/2026-07-09-builder-source-refreshes-now-keep-mapped-fields-such-as-topi.md +6 -0
- package/corpus/templates/content/shared/api.ts +1 -0
- package/dist/agent/production-agent.d.ts +3 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +19 -3
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +34 -9
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +68 -22
- package/dist/agent/run-store.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +48 -12
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/progress/routes.d.ts +1 -1
- package/dist/resources/handlers.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { actionPreparationContinuationNote } from "../agent/action-continuation-guidance.js";
|
|
2
|
+
import { LLM_MISSING_CREDENTIALS_ERROR_CODE, LLM_MISSING_CREDENTIALS_MESSAGE, } from "../agent/engine/credential-errors.js";
|
|
2
3
|
import { setActiveRun, updateActiveRunSeq, clearActiveRun, } from "./active-run-state.js";
|
|
3
4
|
import { captureError } from "./analytics.js";
|
|
4
5
|
import { agentNativePath } from "./api-path.js";
|
|
@@ -102,12 +103,16 @@ const BACKGROUND_FOLLOW_IDLE_TIMEOUT_MS = 150_000;
|
|
|
102
103
|
* (`agent_runs.terminal_reason`, surfaced by /runs/active). These runs died in
|
|
103
104
|
* server-side handoff machinery where no richer error event may exist, so the
|
|
104
105
|
* client owns the message. Keys are matched after stripping an optional
|
|
105
|
-
* `error:` prefix (`terminalReasonForEvent` records `error:<code>`).
|
|
106
|
+
* `error:` prefix (`terminalReasonForEvent` records `error:<code>`). Keep this
|
|
107
|
+
* map scoped to terminal failures, including reasons that must override a
|
|
108
|
+
* mistakenly completed row.
|
|
106
109
|
*/
|
|
107
110
|
const BACKGROUND_TERMINAL_REASON_MESSAGES = {
|
|
108
111
|
background_worker_never_started: "The agent run was handed off to a background worker that never started. It was recovered so you can try again.",
|
|
109
112
|
background_continuation_dispatch_failed: "The agent's background worker could not hand off the next step of this run. Retry to continue from the preserved context.",
|
|
110
113
|
dispatch_payload_missing: "The agent's background run lost its saved request data and could not continue. Retry to start a fresh run.",
|
|
114
|
+
missing_api_key: LLM_MISSING_CREDENTIALS_MESSAGE,
|
|
115
|
+
missing_credentials: LLM_MISSING_CREDENTIALS_MESSAGE,
|
|
111
116
|
turn_continuation_budget_exhausted: "This request needed more automatic continuations than allowed and was stopped. Try breaking it into smaller steps.",
|
|
112
117
|
};
|
|
113
118
|
function normalizeMentions(text) {
|
|
@@ -1399,6 +1404,11 @@ export function createAgentChatAdapter(options) {
|
|
|
1399
1404
|
}
|
|
1400
1405
|
};
|
|
1401
1406
|
const reconnectCursorForRun = (nextRunId, previousRunId) => {
|
|
1407
|
+
if (previousRunId !== nextRunId) {
|
|
1408
|
+
lastAutoContinueReason = null;
|
|
1409
|
+
lastRecoverableRunError = null;
|
|
1410
|
+
lastActivityTrail = [];
|
|
1411
|
+
}
|
|
1402
1412
|
const rememberedSeq = seenRunSeqs.get(nextRunId);
|
|
1403
1413
|
if (rememberedSeq !== undefined) {
|
|
1404
1414
|
lastSeq = rememberedSeq;
|
|
@@ -1705,6 +1715,9 @@ export function createAgentChatAdapter(options) {
|
|
|
1705
1715
|
...(runId ? { runId } : {}),
|
|
1706
1716
|
};
|
|
1707
1717
|
if (typeof window !== "undefined") {
|
|
1718
|
+
if (args.errorCode === LLM_MISSING_CREDENTIALS_ERROR_CODE) {
|
|
1719
|
+
dispatchMissingApiKey();
|
|
1720
|
+
}
|
|
1708
1721
|
window.dispatchEvent(new CustomEvent("agent-chat:run-error", {
|
|
1709
1722
|
detail: { ...runError, tabId },
|
|
1710
1723
|
}));
|
|
@@ -1735,7 +1748,41 @@ export function createAgentChatAdapter(options) {
|
|
|
1735
1748
|
: "";
|
|
1736
1749
|
// terminal_reason is either a bare reason ("dispatch_payload_missing")
|
|
1737
1750
|
// or "error:<errorCode>" when derived from a terminal error event.
|
|
1751
|
+
const hasErrorTerminalReason = rawTerminalReason.startsWith("error:");
|
|
1738
1752
|
const terminalReason = rawTerminalReason.replace(/^error:/, "");
|
|
1753
|
+
const mappedMessage = terminalReason
|
|
1754
|
+
? BACKGROUND_TERMINAL_REASON_MESSAGES[terminalReason]
|
|
1755
|
+
: undefined;
|
|
1756
|
+
const mappedErrorCode = terminalReason === "missing_api_key" ||
|
|
1757
|
+
terminalReason === LLM_MISSING_CREDENTIALS_ERROR_CODE
|
|
1758
|
+
? LLM_MISSING_CREDENTIALS_ERROR_CODE
|
|
1759
|
+
: terminalReason;
|
|
1760
|
+
if (mappedMessage) {
|
|
1761
|
+
yield* emitBackgroundTerminalError({
|
|
1762
|
+
message: mappedMessage,
|
|
1763
|
+
errorCode: mappedErrorCode,
|
|
1764
|
+
details: `terminal_reason: ${rawTerminalReason}`,
|
|
1765
|
+
});
|
|
1766
|
+
return;
|
|
1767
|
+
}
|
|
1768
|
+
if (hasErrorTerminalReason) {
|
|
1769
|
+
if (lastRecoverableRunError) {
|
|
1770
|
+
yield* emitBackgroundTerminalError({
|
|
1771
|
+
message: lastRecoverableRunError.message,
|
|
1772
|
+
errorCode: lastRecoverableRunError.errorCode ||
|
|
1773
|
+
mappedErrorCode ||
|
|
1774
|
+
"background_run_failed",
|
|
1775
|
+
details: lastRecoverableRunError.details,
|
|
1776
|
+
});
|
|
1777
|
+
return;
|
|
1778
|
+
}
|
|
1779
|
+
yield* emitBackgroundTerminalError({
|
|
1780
|
+
message: "The agent's background run failed before its final response could be recovered. You can retry from the preserved chat context.",
|
|
1781
|
+
errorCode: mappedErrorCode || "background_run_failed",
|
|
1782
|
+
details: `terminal_reason: ${rawTerminalReason}`,
|
|
1783
|
+
});
|
|
1784
|
+
return;
|
|
1785
|
+
}
|
|
1739
1786
|
if (status === "completed") {
|
|
1740
1787
|
// The turn finished server-side; the events we managed to fold are
|
|
1741
1788
|
// the durable transcript. Finalize with them.
|
|
@@ -1750,17 +1797,6 @@ export function createAgentChatAdapter(options) {
|
|
|
1750
1797
|
clearActiveRun();
|
|
1751
1798
|
return;
|
|
1752
1799
|
}
|
|
1753
|
-
const mappedMessage = terminalReason
|
|
1754
|
-
? BACKGROUND_TERMINAL_REASON_MESSAGES[terminalReason]
|
|
1755
|
-
: undefined;
|
|
1756
|
-
if (mappedMessage) {
|
|
1757
|
-
yield* emitBackgroundTerminalError({
|
|
1758
|
-
message: mappedMessage,
|
|
1759
|
-
errorCode: terminalReason,
|
|
1760
|
-
details: `terminal_reason: ${rawTerminalReason}`,
|
|
1761
|
-
});
|
|
1762
|
-
return;
|
|
1763
|
-
}
|
|
1764
1800
|
if (lastRecoverableRunError) {
|
|
1765
1801
|
// A replayed terminal error event already carried the real
|
|
1766
1802
|
// message (recoverable errors replay as auto-continue signals
|