@agent-native/core 0.84.39 → 0.84.40
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/action-continuation-guidance.ts +38 -0
- package/corpus/core/src/agent/production-agent.ts +209 -4
- package/corpus/core/src/agent/run-loop-with-resume.ts +128 -16
- package/corpus/core/src/agent/types.ts +8 -0
- package/corpus/core/src/client/agent-chat-adapter.ts +2 -40
- package/dist/agent/action-continuation-guidance.d.ts +3 -0
- package/dist/agent/action-continuation-guidance.d.ts.map +1 -0
- package/dist/agent/action-continuation-guidance.js +38 -0
- package/dist/agent/action-continuation-guidance.js.map +1 -0
- package/dist/agent/production-agent.d.ts +6 -2
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +160 -4
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-loop-with-resume.d.ts.map +1 -1
- package/dist/agent/run-loop-with-resume.js +69 -18
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/agent/types.d.ts +2 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +2 -39
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/observability/routes.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ChatModelAdapter, ChatModelRunResult } from "@assistant-ui/react";
|
|
2
2
|
|
|
3
|
+
import { actionPreparationContinuationNote } from "../agent/action-continuation-guidance.js";
|
|
3
4
|
import type {
|
|
4
5
|
AgentChatStructuredContentPart,
|
|
5
6
|
AgentChatStructuredMessage,
|
|
@@ -927,42 +928,6 @@ function contentAfterContinuationPrefix(
|
|
|
927
928
|
return [...delta, ...content.slice(contentIndex)];
|
|
928
929
|
}
|
|
929
930
|
|
|
930
|
-
// Concrete "ship a compact first version, then refine incrementally" guidance
|
|
931
|
-
// keyed by the large-payload action the model was cut off while preparing. A run
|
|
932
|
-
// cut off mid-stream while streaming one big tool input (extension HTML, a full
|
|
933
|
-
// design file set, an entire dashboard config) re-streams the SAME oversized
|
|
934
|
-
// payload on every continuation and never finishes inside the soft-timeout
|
|
935
|
-
// window — the classic thrash loop. Pointing the resumed model at the
|
|
936
|
-
// incremental-edit path for that specific action is what breaks the loop.
|
|
937
|
-
// Returns undefined for tools with no known incremental counterpart so the
|
|
938
|
-
// caller falls back to generic compact-first advice.
|
|
939
|
-
function incrementalActionGuidance(tool: string): string | undefined {
|
|
940
|
-
switch (tool) {
|
|
941
|
-
case "create-extension":
|
|
942
|
-
case "update-extension":
|
|
943
|
-
return "create a compact working v1 with `create-extension`, then use focused `update-extension` edits for refinements";
|
|
944
|
-
case "generate-design":
|
|
945
|
-
case "update-design":
|
|
946
|
-
return 'if an existing design file or snapshot is already in history, especially after a Design variant pick, stop retrying `generate-design`: call `get-design-snapshot` for the selected file, then call `edit-design` once on that same `fileId` (`mode: "replace-file"` for a compact full-file replacement, or search/replace for smaller edits). Use `generate-design` only for a brand-new compact first file when no target file exists yet';
|
|
947
|
-
case "edit-design":
|
|
948
|
-
return "retry with a smaller `edit-design` payload: prefer a handful of exact search/replace edits against the already-snapshotted file, and avoid `replacementContent` for a huge full-file rewrite. If a selected variant needs expansion, upgrade the highest-value visible sections first, save once, and summarize any remaining refinements";
|
|
949
|
-
case "present-design-variants":
|
|
950
|
-
return 'call `present-design-variants` with concise labels, descriptions, accent colors, and feature bullets; omit large `content` HTML when needed so the action can render compact representative screens. After the user picks a direction, delete unchosen screens, snapshot the selected `fileId`, and refine that same file with `edit-design` (`mode: "replace-file"` for placeholder expansion). Do not call `generate-design` after the variant pick';
|
|
951
|
-
case "create-visual-plan":
|
|
952
|
-
case "create-ui-plan":
|
|
953
|
-
case "create-plan-design":
|
|
954
|
-
case "create-prototype-plan":
|
|
955
|
-
return "create the plan with its core sections or first screen, then expand it with `update-visual-plan`/`patch-visual-plan-source` follow-up edits";
|
|
956
|
-
case "update-visual-plan":
|
|
957
|
-
case "patch-visual-plan-source":
|
|
958
|
-
return "apply smaller, targeted `patch-visual-plan-source` edits rather than rewriting the whole plan in one call";
|
|
959
|
-
case "update-dashboard":
|
|
960
|
-
return "save a small dashboard first, then add panels one at a time with `update-dashboard` incremental `ops` edits instead of authoring the whole config in one call";
|
|
961
|
-
default:
|
|
962
|
-
return undefined;
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
|
|
966
931
|
function autoContinueMessage(signal: AgentAutoContinueSignal): string {
|
|
967
932
|
const tool = lastActivityTool(signal.activityTrail);
|
|
968
933
|
const reason =
|
|
@@ -987,10 +952,7 @@ function autoContinueMessage(signal: AgentAutoContinueSignal): string {
|
|
|
987
952
|
signal.reason === "no_progress";
|
|
988
953
|
let actionInputNote = "";
|
|
989
954
|
if (cutoffPreparingAction && tool) {
|
|
990
|
-
|
|
991
|
-
actionInputNote = guidance
|
|
992
|
-
? `\n\nThe previous run was cut off while preparing the \`${tool}\` action input before the action could finish. Avoid spending another whole run assembling one large tool payload — ${guidance}.`
|
|
993
|
-
: `\n\nThe previous run was cut off while preparing the \`${tool}\` action input before the action could finish. Avoid re-assembling one large tool payload: produce a compact first result you can finish in a single run, then refine it with smaller follow-up edits.`;
|
|
955
|
+
actionInputNote = actionPreparationContinuationNote(tool);
|
|
994
956
|
}
|
|
995
957
|
return `${AUTO_CONTINUE_PROMPT}\n\n${AUTO_CONTINUE_COMPLETION_GUARD}\n\nInternal note: ${reason}${actionInputNote}`;
|
|
996
958
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-continuation-guidance.d.ts","sourceRoot":"","sources":["../../src/agent/action-continuation-guidance.ts"],"names":[],"mappings":"AAKA,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAyB1E;AAED,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKtE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Concrete "ship a compact first version, then refine incrementally" guidance
|
|
2
|
+
// keyed by the large-payload action the model was cut off while preparing.
|
|
3
|
+
// A run cut off before the tool starts tends to reassemble the same oversized
|
|
4
|
+
// payload on every continuation; pointing the model at the incremental path is
|
|
5
|
+
// what breaks that loop.
|
|
6
|
+
export function incrementalActionGuidance(tool) {
|
|
7
|
+
switch (tool) {
|
|
8
|
+
case "create-extension":
|
|
9
|
+
case "update-extension":
|
|
10
|
+
return "create a compact working v1 with `create-extension`, then use focused `update-extension` edits for refinements";
|
|
11
|
+
case "generate-design":
|
|
12
|
+
case "update-design":
|
|
13
|
+
return 'if an existing design file or snapshot is already in history, especially after a Design variant pick, stop retrying `generate-design`: call `get-design-snapshot` for the selected file, then call `edit-design` once on that same `fileId` (`mode: "replace-file"` for a compact full-file replacement, or search/replace for smaller edits). Use `generate-design` only for a brand-new compact first file when no target file exists yet';
|
|
14
|
+
case "edit-design":
|
|
15
|
+
return "retry with a smaller `edit-design` payload: prefer a handful of exact search/replace edits against the already-snapshotted file, and avoid `replacementContent` for a huge full-file rewrite. If a selected variant needs expansion, upgrade the highest-value visible sections first, save once, and summarize any remaining refinements";
|
|
16
|
+
case "present-design-variants":
|
|
17
|
+
return 'call `present-design-variants` with concise labels, descriptions, accent colors, and feature bullets; omit large `content` HTML when needed so the action can render compact representative screens. After the user picks a direction, delete unchosen screens, snapshot the selected `fileId`, and refine that same file with `edit-design` (`mode: "replace-file"` for placeholder expansion). Do not call `generate-design` after the variant pick';
|
|
18
|
+
case "create-visual-plan":
|
|
19
|
+
case "create-ui-plan":
|
|
20
|
+
case "create-plan-design":
|
|
21
|
+
case "create-prototype-plan":
|
|
22
|
+
return "create the plan with its core sections or first screen, then expand it with `update-visual-plan`/`patch-visual-plan-source` follow-up edits";
|
|
23
|
+
case "update-visual-plan":
|
|
24
|
+
case "patch-visual-plan-source":
|
|
25
|
+
return "apply smaller, targeted `patch-visual-plan-source` edits rather than rewriting the whole plan in one call";
|
|
26
|
+
case "update-dashboard":
|
|
27
|
+
return "save a small dashboard first, then add panels one at a time with `update-dashboard` incremental `ops` edits instead of authoring the whole config in one call";
|
|
28
|
+
default:
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function actionPreparationContinuationNote(tool) {
|
|
33
|
+
const guidance = incrementalActionGuidance(tool);
|
|
34
|
+
return guidance
|
|
35
|
+
? `\n\nThe previous run was cut off while preparing the \`${tool}\` action input before the action could finish. Avoid spending another whole run assembling one large tool payload - ${guidance}.`
|
|
36
|
+
: `\n\nThe previous run was cut off while preparing the \`${tool}\` action input before the action could finish. Avoid re-assembling one large tool payload: produce a compact first result you can finish in a single run, then refine it with smaller follow-up edits.`;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=action-continuation-guidance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-continuation-guidance.js","sourceRoot":"","sources":["../../src/agent/action-continuation-guidance.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,2EAA2E;AAC3E,8EAA8E;AAC9E,+EAA+E;AAC/E,yBAAyB;AACzB,MAAM,UAAU,yBAAyB,CAAC,IAAY;IACpD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,kBAAkB,CAAC;QACxB,KAAK,kBAAkB;YACrB,OAAO,gHAAgH,CAAC;QAC1H,KAAK,iBAAiB,CAAC;QACvB,KAAK,eAAe;YAClB,OAAO,6aAA6a,CAAC;QACvb,KAAK,aAAa;YAChB,OAAO,2UAA2U,CAAC;QACrV,KAAK,yBAAyB;YAC5B,OAAO,ubAAub,CAAC;QACjc,KAAK,oBAAoB,CAAC;QAC1B,KAAK,gBAAgB,CAAC;QACtB,KAAK,oBAAoB,CAAC;QAC1B,KAAK,uBAAuB;YAC1B,OAAO,6IAA6I,CAAC;QACvJ,KAAK,oBAAoB,CAAC;QAC1B,KAAK,0BAA0B;YAC7B,OAAO,2GAA2G,CAAC;QACrH,KAAK,kBAAkB;YACrB,OAAO,+JAA+J,CAAC;QACzK;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iCAAiC,CAAC,IAAY;IAC5D,MAAM,QAAQ,GAAG,yBAAyB,CAAC,IAAI,CAAC,CAAC;IACjD,OAAO,QAAQ;QACb,CAAC,CAAC,0DAA0D,IAAI,wHAAwH,QAAQ,GAAG;QACnM,CAAC,CAAC,0DAA0D,IAAI,yMAAyM,CAAC;AAC9Q,CAAC","sourcesContent":["// Concrete \"ship a compact first version, then refine incrementally\" guidance\n// keyed by the large-payload action the model was cut off while preparing.\n// A run cut off before the tool starts tends to reassemble the same oversized\n// payload on every continuation; pointing the model at the incremental path is\n// what breaks that loop.\nexport function incrementalActionGuidance(tool: string): string | undefined {\n switch (tool) {\n case \"create-extension\":\n case \"update-extension\":\n return \"create a compact working v1 with `create-extension`, then use focused `update-extension` edits for refinements\";\n case \"generate-design\":\n case \"update-design\":\n return 'if an existing design file or snapshot is already in history, especially after a Design variant pick, stop retrying `generate-design`: call `get-design-snapshot` for the selected file, then call `edit-design` once on that same `fileId` (`mode: \"replace-file\"` for a compact full-file replacement, or search/replace for smaller edits). Use `generate-design` only for a brand-new compact first file when no target file exists yet';\n case \"edit-design\":\n return \"retry with a smaller `edit-design` payload: prefer a handful of exact search/replace edits against the already-snapshotted file, and avoid `replacementContent` for a huge full-file rewrite. If a selected variant needs expansion, upgrade the highest-value visible sections first, save once, and summarize any remaining refinements\";\n case \"present-design-variants\":\n return 'call `present-design-variants` with concise labels, descriptions, accent colors, and feature bullets; omit large `content` HTML when needed so the action can render compact representative screens. After the user picks a direction, delete unchosen screens, snapshot the selected `fileId`, and refine that same file with `edit-design` (`mode: \"replace-file\"` for placeholder expansion). Do not call `generate-design` after the variant pick';\n case \"create-visual-plan\":\n case \"create-ui-plan\":\n case \"create-plan-design\":\n case \"create-prototype-plan\":\n return \"create the plan with its core sections or first screen, then expand it with `update-visual-plan`/`patch-visual-plan-source` follow-up edits\";\n case \"update-visual-plan\":\n case \"patch-visual-plan-source\":\n return \"apply smaller, targeted `patch-visual-plan-source` edits rather than rewriting the whole plan in one call\";\n case \"update-dashboard\":\n return \"save a small dashboard first, then add panels one at a time with `update-dashboard` incremental `ops` edits instead of authoring the whole config in one call\";\n default:\n return undefined;\n }\n}\n\nexport function actionPreparationContinuationNote(tool: string): string {\n const guidance = incrementalActionGuidance(tool);\n return guidance\n ? `\\n\\nThe previous run was cut off while preparing the \\`${tool}\\` action input before the action could finish. Avoid spending another whole run assembling one large tool payload - ${guidance}.`\n : `\\n\\nThe previous run was cut off while preparing the \\`${tool}\\` action input before the action could finish. Avoid re-assembling one large tool payload: produce a compact first result you can finish in a single run, then refine it with smaller follow-up edits.`;\n}\n"]}
|
|
@@ -358,8 +358,10 @@ export type AgentLoopFinalResponseGuardResult = string | {
|
|
|
358
358
|
};
|
|
359
359
|
export type AgentLoopFinalResponseGuard = (context: AgentLoopFinalResponseGuardContext) => AgentLoopFinalResponseGuardResult | null | undefined | Promise<AgentLoopFinalResponseGuardResult | null | undefined>;
|
|
360
360
|
export declare const AGENT_INTERNAL_CONTINUE_PROMPT = "Continue from where you left off and finish the user's original request. Do not repeat completed work, do not mention internal reconnects, time limits, or step limits, and continue as if this is the same uninterrupted run.";
|
|
361
|
-
export type AgentLoopContinuationReason = "run_timeout" | "loop_limit" | "max_tokens" | "stream_ended" | "gateway_timeout" | "network_interrupted";
|
|
362
|
-
export declare function appendAgentLoopContinuation(messages: EngineMessage[], reason: AgentLoopContinuationReason
|
|
361
|
+
export type AgentLoopContinuationReason = "run_timeout" | "loop_limit" | "max_tokens" | "stream_ended" | "gateway_timeout" | "network_interrupted" | "no_progress";
|
|
362
|
+
export declare function appendAgentLoopContinuation(messages: EngineMessage[], reason: AgentLoopContinuationReason, options?: {
|
|
363
|
+
actionPreparationTool?: string;
|
|
364
|
+
}): void;
|
|
363
365
|
/**
|
|
364
366
|
* True when an error thrown by `runAgentLoop` is a recoverable transport- or
|
|
365
367
|
* gateway-level interruption that the agent can resume from rather than a
|
|
@@ -458,6 +460,8 @@ export declare function runAgentLoop(opts: {
|
|
|
458
460
|
*/
|
|
459
461
|
processors?: Processor[];
|
|
460
462
|
}): Promise<AgentLoopUsage>;
|
|
463
|
+
export declare function lastUnfinishedPreparingActionToolFromEvents(events: readonly AgentChatEvent[]): string | undefined;
|
|
464
|
+
export declare function backgroundContinuationReasonForRun(run: ActiveRun): AgentLoopContinuationReason;
|
|
461
465
|
/**
|
|
462
466
|
* Hard cap on server-driven background→background continuation chunks for a
|
|
463
467
|
* single logical turn. A `backgroundFunction` run gets a ~13-min soft timeout,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"production-agent.d.ts","sourceRoot":"","sources":["../../src/agent/production-agent.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,IAAI,cAAc,EAAE,MAAM,IAAI,CAAC;AAkCzD,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AA6BvC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAMhE,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,aAAa,EACb,iBAAiB,EAGlB,MAAM,mBAAmB,CAAC;AAgB3B,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,cAAc,EACd,qBAAqB,EACrB,0BAA0B,EAC1B,MAAM,EACN,QAAQ,EAET,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAKL,SAAS,EACT,kBAAkB,EAGlB,kBAAkB,EAElB,mB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nE;AA+BD,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,sBAAsB,GAC9B,cAAc,CAwwDhB;AAED,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,MAAM,EACN,QAAQ,EACR,cAAc,GACf,CAAC"}
|
|
@@ -16,6 +16,7 @@ import { readBody } from "../server/h3-helpers.js";
|
|
|
16
16
|
import { getRequestRunContext, ensureRequestRunContext, getRequestContext, getRequestOrgId, getRequestUserEmail, runWithRequestContext, } from "../server/request-context.js";
|
|
17
17
|
import { fireInternalDispatch } from "../server/self-dispatch.js";
|
|
18
18
|
import { isReasoningEffort, normalizeReasoningEffortForModel, } from "../shared/reasoning-effort.js";
|
|
19
|
+
import { actionPreparationContinuationNote } from "./action-continuation-guidance.js";
|
|
19
20
|
import { applyContextDirectives } from "./context-xray/apply-directives.js";
|
|
20
21
|
import { loadContextDirectives } from "./context-xray/directives-store.js";
|
|
21
22
|
import { buildManifest, writeContextManifest, } from "./context-xray/manifest.js";
|
|
@@ -558,6 +559,7 @@ function maxRetriesForError(err) {
|
|
|
558
559
|
return MAX_RETRIES;
|
|
559
560
|
}
|
|
560
561
|
const TOOL_INPUT_ACTIVITY_INTERVAL_MS = 1500;
|
|
562
|
+
const ACTION_PREPARATION_NO_PROGRESS_TIMEOUT_MS = 90_000;
|
|
561
563
|
const MAX_TEXT_ATTACHMENT_CHARS = 60_000;
|
|
562
564
|
const MAX_SELECTION_CONTEXT_CHARS = 8_000;
|
|
563
565
|
const MAX_RESOURCE_INVENTORY_ITEMS = 40;
|
|
@@ -1098,7 +1100,7 @@ function collectTextParts(parts) {
|
|
|
1098
1100
|
.join("");
|
|
1099
1101
|
}
|
|
1100
1102
|
export const AGENT_INTERNAL_CONTINUE_PROMPT = "Continue from where you left off and finish the user's original request. Do not repeat completed work, do not mention internal reconnects, time limits, or step limits, and continue as if this is the same uninterrupted run.";
|
|
1101
|
-
export function appendAgentLoopContinuation(messages, reason) {
|
|
1103
|
+
export function appendAgentLoopContinuation(messages, reason, options = {}) {
|
|
1102
1104
|
const note = reason === "loop_limit"
|
|
1103
1105
|
? "The previous run reached an internal step budget."
|
|
1104
1106
|
: reason === "max_tokens"
|
|
@@ -1109,17 +1111,31 @@ export function appendAgentLoopContinuation(messages, reason) {
|
|
|
1109
1111
|
? "The previous LLM call hit an upstream gateway timeout before the response finished streaming."
|
|
1110
1112
|
: reason === "network_interrupted"
|
|
1111
1113
|
? "The previous LLM call was cut off by a transport-level interruption (socket dropped, connection reset, or stream closed unexpectedly)."
|
|
1112
|
-
:
|
|
1114
|
+
: reason === "no_progress"
|
|
1115
|
+
? "The previous run stopped producing progress events while the connection stayed open."
|
|
1116
|
+
: "The previous run reached an internal execution budget.";
|
|
1117
|
+
const actionInputNote = options.actionPreparationTool
|
|
1118
|
+
? actionPreparationContinuationNote(options.actionPreparationTool)
|
|
1119
|
+
: "";
|
|
1113
1120
|
messages.push({
|
|
1114
1121
|
role: "user",
|
|
1115
1122
|
content: [
|
|
1116
1123
|
{
|
|
1117
1124
|
type: "text",
|
|
1118
|
-
text: `${AGENT_INTERNAL_CONTINUE_PROMPT}\n\nInternal note: ${note}`,
|
|
1125
|
+
text: `${AGENT_INTERNAL_CONTINUE_PROMPT}\n\nInternal note: ${note}${actionInputNote}`,
|
|
1119
1126
|
},
|
|
1120
1127
|
],
|
|
1121
1128
|
});
|
|
1122
1129
|
}
|
|
1130
|
+
function isAgentLoopContinuationReason(reason) {
|
|
1131
|
+
return (reason === "run_timeout" ||
|
|
1132
|
+
reason === "loop_limit" ||
|
|
1133
|
+
reason === "max_tokens" ||
|
|
1134
|
+
reason === "stream_ended" ||
|
|
1135
|
+
reason === "gateway_timeout" ||
|
|
1136
|
+
reason === "network_interrupted" ||
|
|
1137
|
+
reason === "no_progress");
|
|
1138
|
+
}
|
|
1123
1139
|
/**
|
|
1124
1140
|
* True when an error thrown by `runAgentLoop` is a recoverable transport- or
|
|
1125
1141
|
* gateway-level interruption that the agent can resume from rather than a
|
|
@@ -1960,6 +1976,8 @@ export async function runAgentLoop(opts) {
|
|
|
1960
1976
|
const toolInputNames = new Map();
|
|
1961
1977
|
const toolInputBytes = new Map();
|
|
1962
1978
|
let lastToolInputActivityAt = 0;
|
|
1979
|
+
const activeToolInputs = new Map();
|
|
1980
|
+
let endedForActionPreparationNoProgress = false;
|
|
1963
1981
|
const sendToolInputActivity = (toolName, toolInputId, progressBytes, force = false) => {
|
|
1964
1982
|
const now = Date.now();
|
|
1965
1983
|
if (!force &&
|
|
@@ -1975,7 +1993,56 @@ export async function runAgentLoop(opts) {
|
|
|
1975
1993
|
...(typeof progressBytes === "number" ? { progressBytes } : {}),
|
|
1976
1994
|
});
|
|
1977
1995
|
};
|
|
1996
|
+
const resetActiveToolInput = (toolName, toolInputId) => {
|
|
1997
|
+
if (toolInputId) {
|
|
1998
|
+
activeToolInputs.delete(toolInputId);
|
|
1999
|
+
return;
|
|
2000
|
+
}
|
|
2001
|
+
if (toolName) {
|
|
2002
|
+
for (const [id, active] of activeToolInputs) {
|
|
2003
|
+
if (active.toolName === toolName) {
|
|
2004
|
+
activeToolInputs.delete(id);
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
};
|
|
2009
|
+
const hasActionPreparationStalled = () => {
|
|
2010
|
+
if (activeToolInputs.size === 0)
|
|
2011
|
+
return false;
|
|
2012
|
+
const now = Date.now();
|
|
2013
|
+
for (const active of activeToolInputs.values()) {
|
|
2014
|
+
if (now - active.lastProgressAt >=
|
|
2015
|
+
ACTION_PREPARATION_NO_PROGRESS_TIMEOUT_MS) {
|
|
2016
|
+
return true;
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
return false;
|
|
2020
|
+
};
|
|
2021
|
+
const trackActiveToolInput = (key, toolName, bytes) => {
|
|
2022
|
+
const now = Date.now();
|
|
2023
|
+
const previous = activeToolInputs.get(key);
|
|
2024
|
+
activeToolInputs.set(key, {
|
|
2025
|
+
id: key,
|
|
2026
|
+
...((toolName ?? previous?.toolName)
|
|
2027
|
+
? { toolName: toolName ?? previous?.toolName }
|
|
2028
|
+
: {}),
|
|
2029
|
+
startedAt: previous?.startedAt ?? now,
|
|
2030
|
+
lastProgressAt: now,
|
|
2031
|
+
bytes,
|
|
2032
|
+
});
|
|
2033
|
+
};
|
|
2034
|
+
const clearActiveToolInputs = () => {
|
|
2035
|
+
activeToolInputs.clear();
|
|
2036
|
+
};
|
|
1978
2037
|
for await (const event of eventStream) {
|
|
2038
|
+
if (hasActionPreparationStalled()) {
|
|
2039
|
+
send({
|
|
2040
|
+
type: "auto_continue",
|
|
2041
|
+
reason: "no_progress",
|
|
2042
|
+
});
|
|
2043
|
+
endedForActionPreparationNoProgress = true;
|
|
2044
|
+
break;
|
|
2045
|
+
}
|
|
1979
2046
|
// In-loop processor seam (stream hook). Each chunk is offered to every
|
|
1980
2047
|
// processor's `processOutputStream` before the loop handles it. A
|
|
1981
2048
|
// processor `abort()` throws a TripWire; catch it locally so it is not
|
|
@@ -2008,6 +2075,7 @@ export async function runAgentLoop(opts) {
|
|
|
2008
2075
|
if (key && event.name) {
|
|
2009
2076
|
toolInputNames.set(key, event.name);
|
|
2010
2077
|
toolInputBytes.set(key, 0);
|
|
2078
|
+
trackActiveToolInput(key, event.name, 0);
|
|
2011
2079
|
}
|
|
2012
2080
|
sendToolInputActivity(event.name, key, undefined, true);
|
|
2013
2081
|
}
|
|
@@ -2022,6 +2090,9 @@ export async function runAgentLoop(opts) {
|
|
|
2022
2090
|
previous +
|
|
2023
2091
|
new TextEncoder().encode(event.text ?? "").byteLength;
|
|
2024
2092
|
toolInputBytes.set(key, progressBytes);
|
|
2093
|
+
if (progressBytes > previous) {
|
|
2094
|
+
trackActiveToolInput(key, toolName, progressBytes);
|
|
2095
|
+
}
|
|
2025
2096
|
}
|
|
2026
2097
|
sendToolInputActivity(toolName, key, progressBytes);
|
|
2027
2098
|
}
|
|
@@ -2030,8 +2101,10 @@ export async function runAgentLoop(opts) {
|
|
|
2030
2101
|
}
|
|
2031
2102
|
else if (event.type === "tool-call") {
|
|
2032
2103
|
// The authoritative tool-call blocks arrive in assistant-content.
|
|
2104
|
+
resetActiveToolInput(event.name, event.id);
|
|
2033
2105
|
}
|
|
2034
2106
|
else if (event.type === "tool-call-error") {
|
|
2107
|
+
resetActiveToolInput(event.name, event.id);
|
|
2035
2108
|
toolCallErrors.set(event.id, {
|
|
2036
2109
|
name: event.name,
|
|
2037
2110
|
input: event.input,
|
|
@@ -2039,6 +2112,7 @@ export async function runAgentLoop(opts) {
|
|
|
2039
2112
|
});
|
|
2040
2113
|
}
|
|
2041
2114
|
else if (event.type === "assistant-content") {
|
|
2115
|
+
clearActiveToolInputs();
|
|
2042
2116
|
assistantContent = event.parts;
|
|
2043
2117
|
}
|
|
2044
2118
|
else if (event.type === "usage") {
|
|
@@ -2058,6 +2132,17 @@ export async function runAgentLoop(opts) {
|
|
|
2058
2132
|
});
|
|
2059
2133
|
}
|
|
2060
2134
|
}
|
|
2135
|
+
if (hasActionPreparationStalled()) {
|
|
2136
|
+
send({
|
|
2137
|
+
type: "auto_continue",
|
|
2138
|
+
reason: "no_progress",
|
|
2139
|
+
});
|
|
2140
|
+
endedForActionPreparationNoProgress = true;
|
|
2141
|
+
break;
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
if (endedForActionPreparationNoProgress) {
|
|
2145
|
+
return usage;
|
|
2061
2146
|
}
|
|
2062
2147
|
break;
|
|
2063
2148
|
}
|
|
@@ -3043,6 +3128,62 @@ function endsAtInternalContinuationBoundary(run) {
|
|
|
3043
3128
|
}
|
|
3044
3129
|
return last.type === "error" && isRecoverableContinuationError(last);
|
|
3045
3130
|
}
|
|
3131
|
+
function isPreparingActionActivityEvent(event) {
|
|
3132
|
+
if (event.type !== "activity")
|
|
3133
|
+
return false;
|
|
3134
|
+
const label = event.label.trim().toLowerCase();
|
|
3135
|
+
return label.startsWith("preparing ") && label.includes(" action");
|
|
3136
|
+
}
|
|
3137
|
+
export function lastUnfinishedPreparingActionToolFromEvents(events) {
|
|
3138
|
+
let active = null;
|
|
3139
|
+
for (const event of events) {
|
|
3140
|
+
if (isPreparingActionActivityEvent(event)) {
|
|
3141
|
+
const tool = event.tool?.trim();
|
|
3142
|
+
if (tool) {
|
|
3143
|
+
active = {
|
|
3144
|
+
tool,
|
|
3145
|
+
...(event.id?.trim() ? { id: event.id.trim() } : {}),
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
3148
|
+
continue;
|
|
3149
|
+
}
|
|
3150
|
+
if (event.type === "tool_start" || event.type === "tool_done") {
|
|
3151
|
+
const tool = event.tool?.trim();
|
|
3152
|
+
const id = event.id?.trim();
|
|
3153
|
+
if (active &&
|
|
3154
|
+
((id && active.id === id) || (!id && tool && active.tool === tool))) {
|
|
3155
|
+
active = null;
|
|
3156
|
+
}
|
|
3157
|
+
continue;
|
|
3158
|
+
}
|
|
3159
|
+
if (event.type === "error" && isRecoverableContinuationError(event)) {
|
|
3160
|
+
continue;
|
|
3161
|
+
}
|
|
3162
|
+
if (event.type === "clear" ||
|
|
3163
|
+
event.type === "done" ||
|
|
3164
|
+
event.type === "error" ||
|
|
3165
|
+
event.type === "missing_api_key") {
|
|
3166
|
+
active = null;
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
return active?.tool;
|
|
3170
|
+
}
|
|
3171
|
+
function lastUnfinishedPreparingActionTool(run) {
|
|
3172
|
+
return lastUnfinishedPreparingActionToolFromEvents(run.events.map(({ event }) => event));
|
|
3173
|
+
}
|
|
3174
|
+
export function backgroundContinuationReasonForRun(run) {
|
|
3175
|
+
const last = run.events.at(-1)?.event;
|
|
3176
|
+
if (last?.type === "loop_limit")
|
|
3177
|
+
return "loop_limit";
|
|
3178
|
+
if (last?.type === "auto_continue" &&
|
|
3179
|
+
isAgentLoopContinuationReason(last.reason)) {
|
|
3180
|
+
return last.reason;
|
|
3181
|
+
}
|
|
3182
|
+
if (last?.type === "error" && isRecoverableContinuationError(last)) {
|
|
3183
|
+
return continuationReasonForResumableError(new EngineError(last.error, { errorCode: last.errorCode }));
|
|
3184
|
+
}
|
|
3185
|
+
return "run_timeout";
|
|
3186
|
+
}
|
|
3046
3187
|
/**
|
|
3047
3188
|
* Hard cap on server-driven background→background continuation chunks for a
|
|
3048
3189
|
* single logical turn. A `backgroundFunction` run gets a ~13-min soft timeout,
|
|
@@ -3809,7 +3950,16 @@ export function createProductionAgentHandler(options) {
|
|
|
3809
3950
|
?.threadData;
|
|
3810
3951
|
const resumed = threadDataToEngineMessages(priorThreadData);
|
|
3811
3952
|
if (resumed.length > 0) {
|
|
3812
|
-
|
|
3953
|
+
const actionPreparationTool = typeof backgroundRunMarker?.actionPreparationTool === "string" &&
|
|
3954
|
+
backgroundRunMarker.actionPreparationTool.trim()
|
|
3955
|
+
? backgroundRunMarker.actionPreparationTool.trim()
|
|
3956
|
+
: undefined;
|
|
3957
|
+
const continuationReason = isAgentLoopContinuationReason(backgroundRunMarker?.continuationReason)
|
|
3958
|
+
? backgroundRunMarker.continuationReason
|
|
3959
|
+
: "run_timeout";
|
|
3960
|
+
appendAgentLoopContinuation(resumed, continuationReason, {
|
|
3961
|
+
...(actionPreparationTool ? { actionPreparationTool } : {}),
|
|
3962
|
+
});
|
|
3813
3963
|
messages.length = 0;
|
|
3814
3964
|
messages.push(...resumed);
|
|
3815
3965
|
}
|
|
@@ -4109,6 +4259,8 @@ export function createProductionAgentHandler(options) {
|
|
|
4109
4259
|
// its seq log starts clean; same turnId folds the assistant
|
|
4110
4260
|
// message across chunks.
|
|
4111
4261
|
const nextRunId = generateRunId();
|
|
4262
|
+
const actionPreparationTool = lastUnfinishedPreparingActionTool(run);
|
|
4263
|
+
const continuationReason = backgroundContinuationReasonForRun(run);
|
|
4112
4264
|
const continuationDispatchPath = resolveAgentChatProcessRunDispatchPath();
|
|
4113
4265
|
const continuationExpectsNetlifyBackgroundFunction = dispatchPathTargetsNetlifyBackgroundFunction(continuationDispatchPath);
|
|
4114
4266
|
try {
|
|
@@ -4129,6 +4281,10 @@ export function createProductionAgentHandler(options) {
|
|
|
4129
4281
|
runId: nextRunId,
|
|
4130
4282
|
turnId: effectiveTurnId,
|
|
4131
4283
|
continuationCount: backgroundContinuationCount + 1,
|
|
4284
|
+
continuationReason,
|
|
4285
|
+
...(actionPreparationTool
|
|
4286
|
+
? { actionPreparationTool }
|
|
4287
|
+
: {}),
|
|
4132
4288
|
backgroundFunctionRuntimeExpected: continuationExpectsNetlifyBackgroundFunction,
|
|
4133
4289
|
},
|
|
4134
4290
|
},
|