@anvia/core 1.10.0 → 1.11.1
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/README.md +1 -1
- package/dist/agent/agent.js +9 -8
- package/dist/agent/index.d.ts +5 -5
- package/dist/agent/index.js +12 -11
- package/dist/agent/resolve-options.js +2 -2
- package/dist/agent/resolved-agent.js +10 -9
- package/dist/agent/team/agent-team.js +12 -11
- package/dist/agent/team/index.js +12 -11
- package/dist/{agent-BOoZ3jbr.d.ts → agent-BuX5AXsO.d.ts} +5 -3
- package/dist/{chunk-MA3TYOKF.js → chunk-3F6ZY63S.js} +26 -2
- package/dist/chunk-3F6ZY63S.js.map +1 -0
- package/dist/{chunk-5I2NVRHC.js → chunk-5ZM5DB3O.js} +14 -2
- package/dist/chunk-5ZM5DB3O.js.map +1 -0
- package/dist/{chunk-5CKB7RQY.js → chunk-6Q5VOKBO.js} +4 -4
- package/dist/chunk-6Q5VOKBO.js.map +1 -0
- package/dist/{chunk-V5NIO3J3.js → chunk-7XDM7A3W.js} +3 -3
- package/dist/{chunk-7AV3PEYW.js → chunk-GSMLYI4Z.js} +3 -3
- package/dist/{chunk-PILUQCGV.js → chunk-MNWULFRX.js} +2 -2
- package/dist/{chunk-7NWFT422.js → chunk-PLJQ4274.js} +3 -3
- package/dist/{chunk-M32FTMYD.js → chunk-SHSSCEGO.js} +2 -2
- package/dist/chunk-SHSSCEGO.js.map +1 -0
- package/dist/{chunk-WLUWRBQ4.js → chunk-SVFEG2TI.js} +4 -1
- package/dist/chunk-SVFEG2TI.js.map +1 -0
- package/dist/{chunk-EWTZ3IAH.js → chunk-TXWNIEZU.js} +4 -4
- package/dist/{chunk-AO2QL2VD.js → chunk-WU4ODZKR.js} +48 -13
- package/dist/chunk-WU4ODZKR.js.map +1 -0
- package/dist/chunk-ZWYMXBGB.js +143 -0
- package/dist/chunk-ZWYMXBGB.js.map +1 -0
- package/dist/evals/index.d.ts +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +18 -17
- package/dist/internal/agent-runtime/agent-run.js +7 -5
- package/dist/internal/agent-runtime/continuation-state.js +1 -1
- package/dist/internal/agent-runtime/execution.js +1 -1
- package/dist/internal/agent-runtime/loop-context.js +33 -0
- package/dist/internal/agent-runtime/loop-context.js.map +1 -0
- package/dist/internal/agent-runtime/memory.js +4 -2
- package/dist/internal/agent.d.ts +46 -6
- package/dist/internal/agent.js +20 -10
- package/dist/internal/team-runtime/run.js +11 -10
- package/dist/memory/compaction.js +1 -1
- package/dist/memory/index.d.ts +2 -2
- package/dist/memory/index.js +2 -2
- package/dist/memory/options.js +1 -1
- package/dist/{middleware-BNxyEpUX.d.ts → middleware-D_kNSjzW.d.ts} +1 -1
- package/dist/observability/index.d.ts +2 -2
- package/dist/pipeline/index.d.ts +3 -3
- package/dist/redaction/index.js +19 -0
- package/dist/redaction/index.js.map +1 -1
- package/dist/skills/index.js +1 -1
- package/dist/speech-generation/index.js +1 -1
- package/dist/tool/index.d.ts +2 -2
- package/dist/{types-B8KBVXuH.d.ts → types-CWh9AQrq.d.ts} +6 -2
- package/package.json +1 -1
- package/dist/chunk-5CKB7RQY.js.map +0 -1
- package/dist/chunk-5I2NVRHC.js.map +0 -1
- package/dist/chunk-AO2QL2VD.js.map +0 -1
- package/dist/chunk-M32FTMYD.js.map +0 -1
- package/dist/chunk-MA3TYOKF.js.map +0 -1
- package/dist/chunk-WLUWRBQ4.js.map +0 -1
- /package/dist/{chunk-V5NIO3J3.js.map → chunk-7XDM7A3W.js.map} +0 -0
- /package/dist/{chunk-7AV3PEYW.js.map → chunk-GSMLYI4Z.js.map} +0 -0
- /package/dist/{chunk-PILUQCGV.js.map → chunk-MNWULFRX.js.map} +0 -0
- /package/dist/{chunk-7NWFT422.js.map → chunk-PLJQ4274.js.map} +0 -0
- /package/dist/{chunk-EWTZ3IAH.js.map → chunk-TXWNIEZU.js.map} +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createMemoryCompactionSummary,
|
|
3
|
+
cumulativeCompactedMessageCount
|
|
4
|
+
} from "./chunk-6Q5VOKBO.js";
|
|
5
|
+
import {
|
|
6
|
+
MemoryCompactionError
|
|
7
|
+
} from "./chunk-LQJ4KHMY.js";
|
|
8
|
+
import {
|
|
9
|
+
estimateMemoryTokens
|
|
10
|
+
} from "./chunk-SVFEG2TI.js";
|
|
11
|
+
import {
|
|
12
|
+
Usage
|
|
13
|
+
} from "./chunk-HJ6KTQTZ.js";
|
|
14
|
+
import {
|
|
15
|
+
throwIfAborted
|
|
16
|
+
} from "./chunk-USRKPEQN.js";
|
|
17
|
+
|
|
18
|
+
// src/internal/agent-runtime/loop-context.ts
|
|
19
|
+
async function countContextTokens(counter, messages, signal) {
|
|
20
|
+
throwIfAborted(signal);
|
|
21
|
+
const value = await counter(structuredClone(messages));
|
|
22
|
+
throwIfAborted(signal);
|
|
23
|
+
if (!Number.isSafeInteger(value) || value < 0)
|
|
24
|
+
throw new TypeError("Compaction token counter must return a nonnegative safe integer.");
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
function projectLoopContext(messages, checkpoint) {
|
|
28
|
+
if (checkpoint === void 0) return [...messages];
|
|
29
|
+
return [
|
|
30
|
+
createMemoryCompactionSummary(checkpoint.summary, checkpoint.compactedMessageCount),
|
|
31
|
+
...retainedLoopMessages(messages, checkpoint.coveredMessages)
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
function retainedLoopMessages(messages, coveredMessages) {
|
|
35
|
+
const tail = messages.slice(coveredMessages);
|
|
36
|
+
let latestUser = messages.length - 1;
|
|
37
|
+
while (latestUser >= 0 && messages[latestUser].role !== "user") latestUser -= 1;
|
|
38
|
+
return latestUser >= 0 && latestUser < coveredMessages ? [messages[latestUser], ...tail] : tail;
|
|
39
|
+
}
|
|
40
|
+
async function planLoopContext(messages, checkpoint, options, signal) {
|
|
41
|
+
const counter = options.tokenCounter ?? estimateMemoryTokens;
|
|
42
|
+
const projected = projectLoopContext(messages, checkpoint);
|
|
43
|
+
const originalTokenCount = await countContextTokens(counter, projected, signal);
|
|
44
|
+
if (originalTokenCount <= options.afterTokens) return void 0;
|
|
45
|
+
const boundaries = [];
|
|
46
|
+
const pending = /* @__PURE__ */ new Set();
|
|
47
|
+
for (const [index, message] of messages.entries()) {
|
|
48
|
+
if (message.role === "assistant" && Array.isArray(message.content)) {
|
|
49
|
+
for (const part of message.content)
|
|
50
|
+
if (part.type === "tool-call") pending.add(part.toolCallId);
|
|
51
|
+
}
|
|
52
|
+
if (message.role === "tool" && pending.size > 0) {
|
|
53
|
+
for (const part of message.content)
|
|
54
|
+
if (part.type === "tool-result") pending.delete(part.toolCallId);
|
|
55
|
+
if (pending.size === 0) boundaries.push(index + 1);
|
|
56
|
+
} else if (message.role === "assistant" && pending.size === 0 && boundaries.at(-1) === index) {
|
|
57
|
+
boundaries[boundaries.length - 1] = index + 1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const end = boundaries[boundaries.length - 1 - (options.recentToolTurns ?? 1)] ?? 0;
|
|
61
|
+
if (end <= (checkpoint?.coveredMessages ?? 0)) return void 0;
|
|
62
|
+
const prefix = checkpoint === void 0 ? messages.slice(0, end) : [
|
|
63
|
+
createMemoryCompactionSummary(checkpoint.summary, checkpoint.compactedMessageCount),
|
|
64
|
+
...messages.slice(checkpoint.coveredMessages, end)
|
|
65
|
+
];
|
|
66
|
+
const retained = retainedLoopMessages(messages, end);
|
|
67
|
+
return {
|
|
68
|
+
messages: retained,
|
|
69
|
+
prefix,
|
|
70
|
+
coveredMessages: end,
|
|
71
|
+
compactedMessageCount: cumulativeCompactedMessageCount(messages.slice(0, end)),
|
|
72
|
+
originalMessageCount: projected.length,
|
|
73
|
+
originalTokenCount,
|
|
74
|
+
compactedTokenCount: await countContextTokens(counter, prefix, signal),
|
|
75
|
+
retainedTokenCount: await countContextTokens(counter, retained, signal)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
async function summarizeLoopContext(plan, compactor, scope, signal) {
|
|
79
|
+
throwIfAborted(signal);
|
|
80
|
+
const result = await compactor({
|
|
81
|
+
scope,
|
|
82
|
+
messages: structuredClone(plan.prefix),
|
|
83
|
+
abortSignal: signal
|
|
84
|
+
});
|
|
85
|
+
throwIfAborted(signal);
|
|
86
|
+
const usage = result?.usage ?? Usage.empty();
|
|
87
|
+
if (typeof result?.summary !== "string" || result.summary.trim().length === 0)
|
|
88
|
+
throw new MemoryCompactionError("Memory compactor returned an empty summary.", { usage });
|
|
89
|
+
for (const value of [
|
|
90
|
+
usage.inputTokens,
|
|
91
|
+
usage.outputTokens,
|
|
92
|
+
usage.totalTokens,
|
|
93
|
+
usage.cachedInputTokens,
|
|
94
|
+
usage.cacheCreationInputTokens
|
|
95
|
+
])
|
|
96
|
+
if (!Number.isSafeInteger(value) || value < 0) throw new TypeError("Invalid compaction usage.");
|
|
97
|
+
if (usage.details !== void 0 && Object.values(usage.details).some((value) => !Number.isFinite(value)))
|
|
98
|
+
throw new TypeError("Invalid compaction usage details.");
|
|
99
|
+
return { summary: result.summary.trim(), usage };
|
|
100
|
+
}
|
|
101
|
+
async function finishLoopContext(plan, result, counter = estimateMemoryTokens, signal, attempts = 1) {
|
|
102
|
+
const checkpoint = {
|
|
103
|
+
summary: result.summary,
|
|
104
|
+
coveredMessages: plan.coveredMessages,
|
|
105
|
+
compactedMessageCount: plan.compactedMessageCount
|
|
106
|
+
};
|
|
107
|
+
const messages = [
|
|
108
|
+
createMemoryCompactionSummary(result.summary, plan.compactedMessageCount),
|
|
109
|
+
...plan.messages
|
|
110
|
+
];
|
|
111
|
+
let resultTokenCount;
|
|
112
|
+
try {
|
|
113
|
+
resultTokenCount = await countContextTokens(counter, messages, signal);
|
|
114
|
+
} catch (error) {
|
|
115
|
+
throw new MemoryCompactionError("Memory token counter failed after summarization.", {
|
|
116
|
+
cause: error,
|
|
117
|
+
usage: result.usage
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
messages,
|
|
122
|
+
checkpoint,
|
|
123
|
+
compaction: {
|
|
124
|
+
originalMessageCount: plan.originalMessageCount,
|
|
125
|
+
compactedMessageCount: plan.prefix.length,
|
|
126
|
+
retainedMessageCount: plan.messages.length,
|
|
127
|
+
originalTokenCount: plan.originalTokenCount,
|
|
128
|
+
compactedTokenCount: plan.compactedTokenCount,
|
|
129
|
+
retainedTokenCount: plan.retainedTokenCount,
|
|
130
|
+
resultTokenCount,
|
|
131
|
+
attempts,
|
|
132
|
+
usage: result.usage
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export {
|
|
138
|
+
projectLoopContext,
|
|
139
|
+
planLoopContext,
|
|
140
|
+
summarizeLoopContext,
|
|
141
|
+
finishLoopContext
|
|
142
|
+
};
|
|
143
|
+
//# sourceMappingURL=chunk-ZWYMXBGB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/internal/agent-runtime/loop-context.ts"],"sourcesContent":["import { Usage, type Message } from \"../../completion\";\nimport {\n createMemoryCompactionSummary,\n cumulativeCompactedMessageCount,\n} from \"../../memory/compaction\";\nimport { MemoryCompactionError } from \"../../memory/errors\";\nimport { estimateMemoryTokens } from \"../../memory/options\";\nimport type {\n MemoryCompactionInfo,\n MemoryCompactor,\n MemoryScope,\n MemoryTokenCounter,\n} from \"../../memory/types\";\nimport { throwIfAborted } from \"../abort\";\n\n/** Indexes refer to the unchanged input transcript of this execution segment. */\nexport type LoopContextCheckpoint = {\n summary: string;\n coveredMessages: number;\n compactedMessageCount: number;\n};\nexport type PreparedLoopContext = {\n messages: Message[];\n checkpoint?: LoopContextCheckpoint | undefined;\n compaction?: MemoryCompactionInfo | undefined;\n};\nexport type LoopContextPlan = {\n messages: Message[];\n prefix: Message[];\n coveredMessages: number;\n compactedMessageCount: number;\n originalMessageCount: number;\n originalTokenCount: number;\n compactedTokenCount: number;\n retainedTokenCount: number;\n};\n\nasync function countContextTokens(\n counter: MemoryTokenCounter,\n messages: readonly Message[],\n signal?: AbortSignal,\n): Promise<number> {\n throwIfAborted(signal);\n const value = await counter(structuredClone(messages));\n throwIfAborted(signal);\n if (!Number.isSafeInteger(value) || value < 0)\n throw new TypeError(\"Compaction token counter must return a nonnegative safe integer.\");\n return value;\n}\n\nexport function projectLoopContext(\n messages: readonly Message[],\n checkpoint?: LoopContextCheckpoint,\n): Message[] {\n if (checkpoint === undefined) return [...messages];\n return [\n createMemoryCompactionSummary(checkpoint.summary, checkpoint.compactedMessageCount),\n ...retainedLoopMessages(messages, checkpoint.coveredMessages),\n ];\n}\n\nfunction retainedLoopMessages(messages: readonly Message[], coveredMessages: number): Message[] {\n const tail = messages.slice(coveredMessages);\n // Keep the active user request verbatim even when all completed tool rounds are summarized.\n let latestUser = messages.length - 1;\n while (latestUser >= 0 && messages[latestUser]!.role !== \"user\") latestUser -= 1;\n return latestUser >= 0 && latestUser < coveredMessages ? [messages[latestUser]!, ...tail] : tail;\n}\n\n/** Select only complete exchanges; parallel tool calls must all have results before a cut. */\nexport async function planLoopContext(\n messages: readonly Message[],\n checkpoint: LoopContextCheckpoint | undefined,\n options: {\n afterTokens: number;\n recentToolTurns?: number | undefined;\n tokenCounter?: MemoryTokenCounter | undefined;\n },\n signal?: AbortSignal,\n): Promise<LoopContextPlan | undefined> {\n const counter = options.tokenCounter ?? estimateMemoryTokens;\n const projected = projectLoopContext(messages, checkpoint);\n const originalTokenCount = await countContextTokens(counter, projected, signal);\n if (originalTokenCount <= options.afterTokens) return undefined;\n const boundaries: number[] = [];\n const pending = new Set<string>();\n for (const [index, message] of messages.entries()) {\n if (message.role === \"assistant\" && Array.isArray(message.content)) {\n for (const part of message.content)\n if (part.type === \"tool-call\") pending.add(part.toolCallId);\n }\n if (message.role === \"tool\" && pending.size > 0) {\n for (const part of message.content)\n if (part.type === \"tool-result\") pending.delete(part.toolCallId);\n if (pending.size === 0) boundaries.push(index + 1);\n } else if (message.role === \"assistant\" && pending.size === 0 && boundaries.at(-1) === index) {\n // A final answer belongs to the preceding completed round, not another retained tool round.\n boundaries[boundaries.length - 1] = index + 1;\n }\n }\n const end = boundaries[boundaries.length - 1 - (options.recentToolTurns ?? 1)] ?? 0;\n if (end <= (checkpoint?.coveredMessages ?? 0)) return undefined;\n const prefix =\n checkpoint === undefined\n ? messages.slice(0, end)\n : [\n createMemoryCompactionSummary(checkpoint.summary, checkpoint.compactedMessageCount),\n ...messages.slice(checkpoint.coveredMessages, end),\n ];\n const retained = retainedLoopMessages(messages, end);\n return {\n messages: retained,\n prefix,\n coveredMessages: end,\n compactedMessageCount: cumulativeCompactedMessageCount(messages.slice(0, end)),\n originalMessageCount: projected.length,\n originalTokenCount,\n compactedTokenCount: await countContextTokens(counter, prefix, signal),\n retainedTokenCount: await countContextTokens(counter, retained, signal),\n };\n}\n\n/** Validation is inside the summarizer boundary so durable retry budgets cover invalid results. */\nexport async function summarizeLoopContext(\n plan: LoopContextPlan,\n compactor: MemoryCompactor,\n scope: MemoryScope,\n signal?: AbortSignal,\n): Promise<{ summary: string; usage: Usage }> {\n throwIfAborted(signal);\n const result = await compactor({\n scope,\n messages: structuredClone(plan.prefix),\n abortSignal: signal,\n });\n throwIfAborted(signal);\n const usage = result?.usage ?? Usage.empty();\n if (typeof result?.summary !== \"string\" || result.summary.trim().length === 0)\n throw new MemoryCompactionError(\"Memory compactor returned an empty summary.\", { usage });\n for (const value of [\n usage.inputTokens,\n usage.outputTokens,\n usage.totalTokens,\n usage.cachedInputTokens,\n usage.cacheCreationInputTokens,\n ])\n if (!Number.isSafeInteger(value) || value < 0) throw new TypeError(\"Invalid compaction usage.\");\n if (\n usage.details !== undefined &&\n Object.values(usage.details).some((value) => !Number.isFinite(value))\n )\n throw new TypeError(\"Invalid compaction usage details.\");\n return { summary: result.summary.trim(), usage };\n}\n\nexport async function finishLoopContext(\n plan: LoopContextPlan,\n result: { summary: string; usage: Usage },\n counter: MemoryTokenCounter = estimateMemoryTokens,\n signal?: AbortSignal,\n attempts = 1,\n): Promise<PreparedLoopContext> {\n const checkpoint = {\n summary: result.summary,\n coveredMessages: plan.coveredMessages,\n compactedMessageCount: plan.compactedMessageCount,\n };\n const messages = [\n createMemoryCompactionSummary(result.summary, plan.compactedMessageCount),\n ...plan.messages,\n ];\n let resultTokenCount: number;\n try {\n resultTokenCount = await countContextTokens(counter, messages, signal);\n } catch (error) {\n throw new MemoryCompactionError(\"Memory token counter failed after summarization.\", {\n cause: error,\n usage: result.usage,\n });\n }\n return {\n messages,\n checkpoint,\n compaction: {\n originalMessageCount: plan.originalMessageCount,\n compactedMessageCount: plan.prefix.length,\n retainedMessageCount: plan.messages.length,\n originalTokenCount: plan.originalTokenCount,\n compactedTokenCount: plan.compactedTokenCount,\n retainedTokenCount: plan.retainedTokenCount,\n resultTokenCount,\n attempts,\n usage: result.usage,\n },\n };\n}\n"],"mappings":"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","names":[]}
|
package/dist/evals/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { U as Usage, J as JsonObject, d as CompletionModel, M as Message } from '../types-DYqZKDA8.js';
|
|
2
2
|
import { Z as ZodSchema } from '../zod-schema-C7F4clpm.js';
|
|
3
|
-
import { Z as AgentRunPromptRef, g as AgentInteractionOutcome, n as AgentResponse, o as AgentRunOptions, l as AgentOutcome } from '../middleware-
|
|
3
|
+
import { Z as AgentRunPromptRef, g as AgentInteractionOutcome, n as AgentResponse, o as AgentRunOptions, l as AgentOutcome } from '../middleware-D_kNSjzW.js';
|
|
4
4
|
import { AgentInteractionRequest, AgentInteractionResponse } from '../agent/interactions/index.js';
|
|
5
5
|
import { E as EmbeddingModel } from '../types-Cr4uiYo5.js';
|
|
6
6
|
import '../model-call-options-CZkSw_xN.js';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import '../types-CqiX-4_C.js';
|
|
9
9
|
import '../retry-CjvSlKGW.js';
|
|
10
|
-
import '../types-
|
|
10
|
+
import '../types-CWh9AQrq.js';
|
|
11
11
|
import '../tool-W1cAPuRF.js';
|
|
12
12
|
|
|
13
13
|
type EvalOutcomeOptions = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as Agent, a as AgentContextInput, b as AgentMemory, c as AgentMemoryOptions, d as AgentOptions, e as AgentToolInput, f as AgentToolOptions, C as CreateHybridVectorContextOptions, g as CreateVectorContextOptions, V as VectorContext, h as VectorContextBaseOptions, i as createVectorContext, j as isVectorContext } from './agent-
|
|
1
|
+
export { A as Agent, a as AgentContextInput, b as AgentMemory, c as AgentMemoryOptions, d as AgentOptions, e as AgentToolInput, f as AgentToolOptions, C as CreateHybridVectorContextOptions, g as CreateVectorContextOptions, V as VectorContext, h as VectorContextBaseOptions, i as createVectorContext, j as isVectorContext } from './agent-BuX5AXsO.js';
|
|
2
2
|
export { AgentRunBlockedError, AgentRunCancelledError, AgentStreamClosedError, AgentStructuredOutputError, AgentStructuredOutputFormat, AgentStructuredOutputPhase, AgentTeam, AgentTeamEvent, AgentTeamInteraction, AgentTeamInteractionError, AgentTeamLimitError, AgentTeamLimits, AgentTeamMember, AgentTeamMemberStatus, AgentTeamMemberSummary, AgentTeamMessage, AgentTeamOptions, AgentTeamOutcome, AgentTeamRunOptions, AgentTeamSpawnRule, AgentTeamStream, AgentToolSuspensionError, MaxTurnsError } from './agent/index.js';
|
|
3
|
-
export { A as AgentBlockedOutcome, a as AgentChildStreamEvent, b as AgentDeltaEvent, c as AgentErrorEvent, d as AgentErrorStreamEvent, e as AgentFinishEvent, f as AgentInput, g as AgentInteractionOutcome, h as AgentLifecycle, i as AgentMemoryCompactionEvent, j as AgentMemoryCompactionOptions, k as AgentMiddleware, l as AgentOutcome, m as AgentPrompt, n as AgentResponse, o as AgentRunOptions, p as AgentRunSettings, q as AgentStartEvent, r as AgentSteerInput, s as AgentSteerReceipt, t as AgentStepFinishEvent, u as AgentStream, v as AgentStreamEvent, w as AgentToolCallDeltaEvent, x as AgentToolFinishEvent, y as AgentToolStartEvent, C as CompletionRequestMiddlewareArgs, z as CompletionRequestMiddlewareResult, B as CompletionResponseMiddlewareArgs, D as CompletionResponseMiddlewareResult, T as ToolInputMiddlewareArgs, E as ToolInputMiddlewareResult, F as ToolOutputMiddlewareArgs, G as ToolOutputMiddlewareResult, H as ToolResultMiddlewareArgs, I as createMiddleware } from './middleware-
|
|
3
|
+
export { A as AgentBlockedOutcome, a as AgentChildStreamEvent, b as AgentDeltaEvent, c as AgentErrorEvent, d as AgentErrorStreamEvent, e as AgentFinishEvent, f as AgentInput, g as AgentInteractionOutcome, h as AgentLifecycle, i as AgentMemoryCompactionEvent, j as AgentMemoryCompactionOptions, k as AgentMiddleware, l as AgentOutcome, m as AgentPrompt, n as AgentResponse, o as AgentRunOptions, p as AgentRunSettings, q as AgentStartEvent, r as AgentSteerInput, s as AgentSteerReceipt, t as AgentStepFinishEvent, u as AgentStream, v as AgentStreamEvent, w as AgentToolCallDeltaEvent, x as AgentToolFinishEvent, y as AgentToolStartEvent, C as CompletionRequestMiddlewareArgs, z as CompletionRequestMiddlewareResult, B as CompletionResponseMiddlewareArgs, D as CompletionResponseMiddlewareResult, T as ToolInputMiddlewareArgs, E as ToolInputMiddlewareResult, F as ToolOutputMiddlewareArgs, G as ToolOutputMiddlewareResult, H as ToolResultMiddlewareArgs, I as createMiddleware } from './middleware-D_kNSjzW.js';
|
|
4
4
|
export { M as ModelCallOptions } from './model-call-options-CZkSw_xN.js';
|
|
5
5
|
export { R as RetryContext, a as RetryOptions, b as RetrySetting } from './retry-CjvSlKGW.js';
|
|
6
6
|
export { C as COMPLETION_PROVIDER_OUTPUT_ERROR_CODE, a as CompletionBaseOptions, b as CompletionInput, c as CompletionProviderOutputError, d as CompletionProviderOutputErrorKind, e as CompletionProviderOutputErrorOptions, f as CompletionStructuredOutputError, g as CompletionStructuredOutputPhase, G as GenerateCompletionOptions, h as GenerateStructuredCompletionOptions, M as MessageMetadataSchema, R as REASONING_EFFORT_CONTROL_ID, i as ReasoningEffortControls, S as StandardJSONSchemaV1, j as StandardSchemaV1, k as StreamCompletionOptions, l as StreamStructuredCompletionOptions, m as createMessageSchema, n as defineCompletionModelControls, o as generateCompletion, p as isJsonValue, q as isMessage, r as isStandardSchema, s as messageSchema, t as messagesSchema, u as parseMessage, v as parseMessages, w as streamCompletion } from './provider-output-error-CQD0MWey.js';
|
|
@@ -9,7 +9,7 @@ export { a as allow, b as block, d as defineGuardrailPolicy, c as defineInputGua
|
|
|
9
9
|
export { G as GuardrailBoundary, a as GuardrailDecisionRecord, b as GuardrailMode, c as GuardrailPolicy, d as GuardrailPolicyInput, e as GuardrailPolicyOptions, I as InputGuardrail, f as InputGuardrailActions, g as InputGuardrailContext, O as OutputGuardrail, h as OutputGuardrailActions, i as OutputGuardrailContext } from './types-CqiX-4_C.js';
|
|
10
10
|
export { GenerateImageOptions, GeneratedImage, ImageGenerationModel, ImageGenerationRequest, ImageGenerationResult, generateImage } from './image-generation/index.js';
|
|
11
11
|
export { MemoryCompactionConflictError, MemoryCompactionError, createMemoryScopeKey, createSummaryMemoryCompactor, estimateMemoryTokens, isMemoryCompactionMessage } from './memory/index.js';
|
|
12
|
-
export { C as CreateMemoryScopeKeyOptions, a as CreateSummaryMemoryCompactorOptions, M as MemoryAppendOptions, b as MemoryClearOptions, c as MemoryCompactionCapability, d as MemoryCompactionConflictRetryOptions, e as MemoryCompactionInfo, f as MemoryCompactionMessage, g as MemoryCompactionMetadata, h as MemoryCompactionOptions, i as MemoryCompactionReplacePrefixOptions, j as MemoryCompactionReplacePrefixResult, k as MemoryCompactionResult, l as MemoryCompactionRetention, m as MemoryCompactionSnapshot, n as MemoryCompactionSnapshotOptions, o as MemoryCompactor, p as MemoryCompactorInput, q as MemoryCompactorResult, r as MemoryConversation, s as MemoryConversationGetOptions, t as MemoryConversationListOptions, u as MemoryConversationMessage, v as MemoryConversationSummary, w as MemoryErrorOptions, x as MemoryInspector, y as MemoryLoadOptions, z as MemoryOptions, A as MemorySavePolicy, B as MemoryScope, D as MemoryScopeKeyOptions, E as MemoryScopeKeyResolver, F as MemoryStore, G as MemoryTokenCounter } from './types-
|
|
12
|
+
export { C as CreateMemoryScopeKeyOptions, a as CreateSummaryMemoryCompactorOptions, M as MemoryAppendOptions, b as MemoryClearOptions, c as MemoryCompactionCapability, d as MemoryCompactionConflictRetryOptions, e as MemoryCompactionInfo, f as MemoryCompactionMessage, g as MemoryCompactionMetadata, h as MemoryCompactionOptions, i as MemoryCompactionReplacePrefixOptions, j as MemoryCompactionReplacePrefixResult, k as MemoryCompactionResult, l as MemoryCompactionRetention, m as MemoryCompactionSnapshot, n as MemoryCompactionSnapshotOptions, o as MemoryCompactor, p as MemoryCompactorInput, q as MemoryCompactorResult, r as MemoryConversation, s as MemoryConversationGetOptions, t as MemoryConversationListOptions, u as MemoryConversationMessage, v as MemoryConversationSummary, w as MemoryErrorOptions, x as MemoryInspector, y as MemoryLoadOptions, z as MemoryOptions, A as MemorySavePolicy, B as MemoryScope, D as MemoryScopeKeyOptions, E as MemoryScopeKeyResolver, F as MemoryStore, G as MemoryTokenCounter } from './types-CWh9AQrq.js';
|
|
13
13
|
export { Z as ZodSchema } from './zod-schema-C7F4clpm.js';
|
|
14
14
|
export { loadSkills, skill } from './skills/index.js';
|
|
15
15
|
export { S as SkillValidationError } from './types-CIG2loIE.js';
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,11 @@ import {
|
|
|
3
3
|
transcribe
|
|
4
4
|
} from "./chunk-HTI7DZJM.js";
|
|
5
5
|
import "./chunk-SC4SUIEY.js";
|
|
6
|
+
import "./chunk-5M6GTA3T.js";
|
|
7
|
+
import {
|
|
8
|
+
generateSpeech
|
|
9
|
+
} from "./chunk-SYULMZGL.js";
|
|
10
|
+
import "./chunk-WXR5CWSC.js";
|
|
6
11
|
import "./chunk-HTI343NP.js";
|
|
7
12
|
import {
|
|
8
13
|
loadSkills
|
|
@@ -11,15 +16,10 @@ import "./chunk-JBQNCUXA.js";
|
|
|
11
16
|
import {
|
|
12
17
|
skill
|
|
13
18
|
} from "./chunk-ZUFS6R7L.js";
|
|
14
|
-
import "./chunk-5G4NMOTJ.js";
|
|
15
19
|
import {
|
|
16
20
|
SkillValidationError
|
|
17
21
|
} from "./chunk-B5JQDR33.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-WXR5CWSC.js";
|
|
20
|
-
import {
|
|
21
|
-
generateSpeech
|
|
22
|
-
} from "./chunk-SYULMZGL.js";
|
|
22
|
+
import "./chunk-5G4NMOTJ.js";
|
|
23
23
|
import "./chunk-NMPDZTBM.js";
|
|
24
24
|
import "./chunk-4ITAV7YA.js";
|
|
25
25
|
import {
|
|
@@ -54,9 +54,9 @@ import {
|
|
|
54
54
|
import "./chunk-53TPAXYR.js";
|
|
55
55
|
import {
|
|
56
56
|
AgentTeam
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-GSMLYI4Z.js";
|
|
58
58
|
import "./chunk-X6WS3XWL.js";
|
|
59
|
-
import "./chunk-
|
|
59
|
+
import "./chunk-PLJQ4274.js";
|
|
60
60
|
import "./chunk-PIMD4DYG.js";
|
|
61
61
|
import "./chunk-FSBDE6RF.js";
|
|
62
62
|
import "./chunk-3TAQXJBC.js";
|
|
@@ -65,20 +65,21 @@ import {
|
|
|
65
65
|
AgentTeamInteractionError,
|
|
66
66
|
AgentTeamLimitError
|
|
67
67
|
} from "./chunk-ENZ2XX27.js";
|
|
68
|
-
import "./chunk-
|
|
68
|
+
import "./chunk-7XDM7A3W.js";
|
|
69
69
|
import {
|
|
70
70
|
Agent
|
|
71
|
-
} from "./chunk-
|
|
72
|
-
import "./chunk-
|
|
71
|
+
} from "./chunk-TXWNIEZU.js";
|
|
72
|
+
import "./chunk-WU4ODZKR.js";
|
|
73
|
+
import "./chunk-SXE4J43E.js";
|
|
73
74
|
import "./chunk-DRSKZVC6.js";
|
|
74
75
|
import "./chunk-LAIATEUB.js";
|
|
75
|
-
import "./chunk-
|
|
76
|
+
import "./chunk-3F6ZY63S.js";
|
|
77
|
+
import "./chunk-ZWYMXBGB.js";
|
|
76
78
|
import "./chunk-PFJN5OIQ.js";
|
|
77
79
|
import "./chunk-7FBSGD6E.js";
|
|
78
80
|
import "./chunk-NPJ2T3L5.js";
|
|
79
81
|
import "./chunk-YWRXOPHC.js";
|
|
80
|
-
import "./chunk-
|
|
81
|
-
import "./chunk-5I2NVRHC.js";
|
|
82
|
+
import "./chunk-5ZM5DB3O.js";
|
|
82
83
|
import "./chunk-5IURMWFN.js";
|
|
83
84
|
import "./chunk-2NLINXRF.js";
|
|
84
85
|
import "./chunk-JMJFK3A4.js";
|
|
@@ -96,7 +97,7 @@ import "./chunk-H3H74RWJ.js";
|
|
|
96
97
|
import {
|
|
97
98
|
createSummaryMemoryCompactor,
|
|
98
99
|
isMemoryCompactionMessage
|
|
99
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-6Q5VOKBO.js";
|
|
100
101
|
import {
|
|
101
102
|
MemoryCompactionConflictError,
|
|
102
103
|
MemoryCompactionError
|
|
@@ -117,10 +118,10 @@ import "./chunk-NF6WBPFG.js";
|
|
|
117
118
|
import "./chunk-LBYJPMHC.js";
|
|
118
119
|
import "./chunk-KFAVEL5F.js";
|
|
119
120
|
import "./chunk-GLMYZ6OA.js";
|
|
120
|
-
import "./chunk-
|
|
121
|
+
import "./chunk-MNWULFRX.js";
|
|
121
122
|
import {
|
|
122
123
|
estimateMemoryTokens
|
|
123
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-SVFEG2TI.js";
|
|
124
125
|
import "./chunk-ZPJFXRQZ.js";
|
|
125
126
|
import "./chunk-MEN4AFDZ.js";
|
|
126
127
|
import "./chunk-VZ5ZZBNX.js";
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentRun
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-WU4ODZKR.js";
|
|
4
|
+
import "../../chunk-SXE4J43E.js";
|
|
4
5
|
import "../../chunk-DRSKZVC6.js";
|
|
5
6
|
import "../../chunk-LAIATEUB.js";
|
|
6
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-3F6ZY63S.js";
|
|
8
|
+
import "../../chunk-ZWYMXBGB.js";
|
|
7
9
|
import "../../chunk-PFJN5OIQ.js";
|
|
8
10
|
import "../../chunk-7FBSGD6E.js";
|
|
9
11
|
import "../../chunk-NPJ2T3L5.js";
|
|
10
12
|
import "../../chunk-YWRXOPHC.js";
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-5I2NVRHC.js";
|
|
13
|
+
import "../../chunk-5ZM5DB3O.js";
|
|
13
14
|
import "../../chunk-5IURMWFN.js";
|
|
14
15
|
import "../../chunk-2NLINXRF.js";
|
|
15
16
|
import "../../chunk-JMJFK3A4.js";
|
|
@@ -18,7 +19,7 @@ import "../../chunk-CASF2TDK.js";
|
|
|
18
19
|
import "../../chunk-4AW2633B.js";
|
|
19
20
|
import "../../chunk-YNA3UR42.js";
|
|
20
21
|
import "../../chunk-H3H74RWJ.js";
|
|
21
|
-
import "../../chunk-
|
|
22
|
+
import "../../chunk-6Q5VOKBO.js";
|
|
22
23
|
import "../../chunk-LQJ4KHMY.js";
|
|
23
24
|
import "../../chunk-EZR5AV3J.js";
|
|
24
25
|
import "../../chunk-MJCMKZFP.js";
|
|
@@ -32,6 +33,7 @@ import "../../chunk-NF6WBPFG.js";
|
|
|
32
33
|
import "../../chunk-LBYJPMHC.js";
|
|
33
34
|
import "../../chunk-KFAVEL5F.js";
|
|
34
35
|
import "../../chunk-GLMYZ6OA.js";
|
|
36
|
+
import "../../chunk-SVFEG2TI.js";
|
|
35
37
|
import "../../chunk-ZPJFXRQZ.js";
|
|
36
38
|
import "../../chunk-MEN4AFDZ.js";
|
|
37
39
|
import "../../chunk-VZ5ZZBNX.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
finishLoopContext,
|
|
3
|
+
planLoopContext,
|
|
4
|
+
projectLoopContext,
|
|
5
|
+
summarizeLoopContext
|
|
6
|
+
} from "../../chunk-ZWYMXBGB.js";
|
|
7
|
+
import "../../chunk-6Q5VOKBO.js";
|
|
8
|
+
import "../../chunk-LQJ4KHMY.js";
|
|
9
|
+
import "../../chunk-TP3MCUXS.js";
|
|
10
|
+
import "../../chunk-6RQYWZI3.js";
|
|
11
|
+
import "../../chunk-NF6WBPFG.js";
|
|
12
|
+
import "../../chunk-SVFEG2TI.js";
|
|
13
|
+
import "../../chunk-ZPJFXRQZ.js";
|
|
14
|
+
import "../../chunk-LGPXCJJO.js";
|
|
15
|
+
import "../../chunk-57AUTEQ6.js";
|
|
16
|
+
import "../../chunk-6OO5C5GW.js";
|
|
17
|
+
import "../../chunk-GSVOMQEE.js";
|
|
18
|
+
import "../../chunk-4ONUNWGC.js";
|
|
19
|
+
import "../../chunk-MIPBH5S7.js";
|
|
20
|
+
import "../../chunk-XQV3XNVT.js";
|
|
21
|
+
import "../../chunk-HJ6KTQTZ.js";
|
|
22
|
+
import "../../chunk-BONQTXRQ.js";
|
|
23
|
+
import "../../chunk-4C7AXYOM.js";
|
|
24
|
+
import "../../chunk-SQAAVYJG.js";
|
|
25
|
+
import "../../chunk-POXHJF3H.js";
|
|
26
|
+
import "../../chunk-USRKPEQN.js";
|
|
27
|
+
export {
|
|
28
|
+
finishLoopContext,
|
|
29
|
+
planLoopContext,
|
|
30
|
+
projectLoopContext,
|
|
31
|
+
summarizeLoopContext
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=loop-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AgentRunMemory
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-3F6ZY63S.js";
|
|
4
|
+
import "../../chunk-ZWYMXBGB.js";
|
|
5
|
+
import "../../chunk-6Q5VOKBO.js";
|
|
5
6
|
import "../../chunk-LQJ4KHMY.js";
|
|
6
7
|
import "../../chunk-TP3MCUXS.js";
|
|
7
8
|
import "../../chunk-6RQYWZI3.js";
|
|
8
9
|
import "../../chunk-NF6WBPFG.js";
|
|
10
|
+
import "../../chunk-SVFEG2TI.js";
|
|
9
11
|
import "../../chunk-ZPJFXRQZ.js";
|
|
10
12
|
import "../../chunk-LGPXCJJO.js";
|
|
11
13
|
import "../../chunk-57AUTEQ6.js";
|
package/dist/internal/agent.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { R as ResolvedAgentOptions, A as Agent } from '../agent-
|
|
2
|
-
import { d as CompletionModel, P as ProviderTool,
|
|
1
|
+
import { R as ResolvedAgentOptions, A as Agent } from '../agent-BuX5AXsO.js';
|
|
2
|
+
import { d as CompletionModel, P as ProviderTool, M as Message, U as Usage, k as CompletionResponse, j as CompletionRequest, y as ToolCallPart, G as ToolResultContentPart } from '../types-DYqZKDA8.js';
|
|
3
3
|
import { T as ToolIndex } from '../dynamic-tools-B3OjYyhC.js';
|
|
4
4
|
import { A as AnyTool, c as ToolCallContext, N as NormalizedToolOutput } from '../tool-W1cAPuRF.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { e as MemoryCompactionInfo, G as MemoryTokenCounter, o as MemoryCompactor, B as MemoryScope } from '../types-CWh9AQrq.js';
|
|
6
|
+
import { v as AgentStreamEvent } from '../middleware-D_kNSjzW.js';
|
|
7
7
|
import '../retry-CjvSlKGW.js';
|
|
8
8
|
import '../types-CqiX-4_C.js';
|
|
9
9
|
import '../types-94Q2mPRa.js';
|
|
@@ -26,8 +26,46 @@ type AgentToolState = {
|
|
|
26
26
|
};
|
|
27
27
|
declare function getAgentToolState(agent: object): AgentToolState;
|
|
28
28
|
|
|
29
|
+
/** Indexes refer to the unchanged input transcript of this execution segment. */
|
|
30
|
+
type LoopContextCheckpoint = {
|
|
31
|
+
summary: string;
|
|
32
|
+
coveredMessages: number;
|
|
33
|
+
compactedMessageCount: number;
|
|
34
|
+
};
|
|
35
|
+
type PreparedLoopContext = {
|
|
36
|
+
messages: Message[];
|
|
37
|
+
checkpoint?: LoopContextCheckpoint | undefined;
|
|
38
|
+
compaction?: MemoryCompactionInfo | undefined;
|
|
39
|
+
};
|
|
40
|
+
type LoopContextPlan = {
|
|
41
|
+
messages: Message[];
|
|
42
|
+
prefix: Message[];
|
|
43
|
+
coveredMessages: number;
|
|
44
|
+
compactedMessageCount: number;
|
|
45
|
+
originalMessageCount: number;
|
|
46
|
+
originalTokenCount: number;
|
|
47
|
+
compactedTokenCount: number;
|
|
48
|
+
retainedTokenCount: number;
|
|
49
|
+
};
|
|
50
|
+
declare function projectLoopContext(messages: readonly Message[], checkpoint?: LoopContextCheckpoint): Message[];
|
|
51
|
+
/** Select only complete exchanges; parallel tool calls must all have results before a cut. */
|
|
52
|
+
declare function planLoopContext(messages: readonly Message[], checkpoint: LoopContextCheckpoint | undefined, options: {
|
|
53
|
+
afterTokens: number;
|
|
54
|
+
recentToolTurns?: number | undefined;
|
|
55
|
+
tokenCounter?: MemoryTokenCounter | undefined;
|
|
56
|
+
}, signal?: AbortSignal): Promise<LoopContextPlan | undefined>;
|
|
57
|
+
/** Validation is inside the summarizer boundary so durable retry budgets cover invalid results. */
|
|
58
|
+
declare function summarizeLoopContext(plan: LoopContextPlan, compactor: MemoryCompactor, scope: MemoryScope, signal?: AbortSignal): Promise<{
|
|
59
|
+
summary: string;
|
|
60
|
+
usage: Usage;
|
|
61
|
+
}>;
|
|
62
|
+
declare function finishLoopContext(plan: LoopContextPlan, result: {
|
|
63
|
+
summary: string;
|
|
64
|
+
usage: Usage;
|
|
65
|
+
}, counter?: MemoryTokenCounter, signal?: AbortSignal, attempts?: number): Promise<PreparedLoopContext>;
|
|
66
|
+
|
|
29
67
|
/** Runtime capability marker: older core versions must fail before accepting durable work. */
|
|
30
|
-
declare const AGENT_RUN_EXECUTION_VERSION =
|
|
68
|
+
declare const AGENT_RUN_EXECUTION_VERSION = 3;
|
|
31
69
|
/** Normalized generation progress; never includes raw provider responses. */
|
|
32
70
|
type AgentCompletionStreamEvent = Extract<AgentStreamEvent<unknown, unknown>, {
|
|
33
71
|
type: "text_delta" | "reasoning_delta" | "tool_call_delta" | "tool_call" | "source" | "provider_tool_call";
|
|
@@ -43,6 +81,8 @@ type AgentToolExecutionResult = {
|
|
|
43
81
|
};
|
|
44
82
|
/** Internal persistence boundary used by execution runtimes. Callbacks own external effects. */
|
|
45
83
|
interface AgentRunExecution {
|
|
84
|
+
/** Persist the context selected before each model call, including skipped compaction decisions. */
|
|
85
|
+
prepareMessages?(turn: number, messages: readonly Message[], checkpoint?: LoopContextCheckpoint): Promise<PreparedLoopContext>;
|
|
46
86
|
completion(turn: number, request: CompletionRequest, execute: () => Promise<CompletionResponse>): Promise<CompletionResponse>;
|
|
47
87
|
streamCompletion?(turn: number, request: CompletionRequest, execute: () => AgentCompletionStream): AgentCompletionStream;
|
|
48
88
|
tool(call: {
|
|
@@ -214,4 +254,4 @@ type InternalAgentRunOptions = {
|
|
|
214
254
|
};
|
|
215
255
|
declare function withInternalAgentRunOptions<T extends object>(options: T, internal: InternalAgentRunOptions): T;
|
|
216
256
|
|
|
217
|
-
export { AGENT_RUN_EXECUTION_VERSION, Agent, type AgentCompletionStream, type AgentCompletionStreamEvent, type AgentHook, type AgentRunExecution, type AgentToolExecutionResult, type InternalAgentRunOptions, ResolvedAgentOptions, createHook, createResolvedAgent, getAgentToolState, getResolvedAgentOptions, withInternalAgentRunOptions };
|
|
257
|
+
export { AGENT_RUN_EXECUTION_VERSION, Agent, type AgentCompletionStream, type AgentCompletionStreamEvent, type AgentHook, type AgentRunExecution, type AgentToolExecutionResult, type InternalAgentRunOptions, type LoopContextCheckpoint, type PreparedLoopContext, ResolvedAgentOptions, createHook, createResolvedAgent, finishLoopContext, getAgentToolState, getResolvedAgentOptions, planLoopContext, projectLoopContext, summarizeLoopContext, withInternalAgentRunOptions };
|
package/dist/internal/agent.js
CHANGED
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AGENT_RUN_EXECUTION_VERSION
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-SHSSCEGO.js";
|
|
4
4
|
import {
|
|
5
5
|
createResolvedAgent,
|
|
6
6
|
getResolvedAgentOptions
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-7XDM7A3W.js";
|
|
8
8
|
import {
|
|
9
9
|
Agent
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
} from "../chunk-TXWNIEZU.js";
|
|
11
|
+
import "../chunk-WU4ODZKR.js";
|
|
12
|
+
import "../chunk-SXE4J43E.js";
|
|
12
13
|
import "../chunk-DRSKZVC6.js";
|
|
13
14
|
import "../chunk-LAIATEUB.js";
|
|
14
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-3F6ZY63S.js";
|
|
16
|
+
import {
|
|
17
|
+
finishLoopContext,
|
|
18
|
+
planLoopContext,
|
|
19
|
+
projectLoopContext,
|
|
20
|
+
summarizeLoopContext
|
|
21
|
+
} from "../chunk-ZWYMXBGB.js";
|
|
15
22
|
import "../chunk-PFJN5OIQ.js";
|
|
16
23
|
import {
|
|
17
24
|
withInternalAgentRunOptions
|
|
18
25
|
} from "../chunk-7FBSGD6E.js";
|
|
19
26
|
import "../chunk-NPJ2T3L5.js";
|
|
20
27
|
import "../chunk-YWRXOPHC.js";
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-5I2NVRHC.js";
|
|
28
|
+
import "../chunk-5ZM5DB3O.js";
|
|
23
29
|
import "../chunk-5IURMWFN.js";
|
|
24
30
|
import "../chunk-2NLINXRF.js";
|
|
25
31
|
import "../chunk-JMJFK3A4.js";
|
|
@@ -28,7 +34,7 @@ import "../chunk-CASF2TDK.js";
|
|
|
28
34
|
import "../chunk-4AW2633B.js";
|
|
29
35
|
import "../chunk-YNA3UR42.js";
|
|
30
36
|
import "../chunk-H3H74RWJ.js";
|
|
31
|
-
import "../chunk-
|
|
37
|
+
import "../chunk-6Q5VOKBO.js";
|
|
32
38
|
import "../chunk-LQJ4KHMY.js";
|
|
33
39
|
import "../chunk-EZR5AV3J.js";
|
|
34
40
|
import "../chunk-MJCMKZFP.js";
|
|
@@ -47,8 +53,8 @@ import "../chunk-NF6WBPFG.js";
|
|
|
47
53
|
import "../chunk-LBYJPMHC.js";
|
|
48
54
|
import "../chunk-KFAVEL5F.js";
|
|
49
55
|
import "../chunk-GLMYZ6OA.js";
|
|
50
|
-
import "../chunk-
|
|
51
|
-
import "../chunk-
|
|
56
|
+
import "../chunk-MNWULFRX.js";
|
|
57
|
+
import "../chunk-SVFEG2TI.js";
|
|
52
58
|
import "../chunk-ZPJFXRQZ.js";
|
|
53
59
|
import "../chunk-MEN4AFDZ.js";
|
|
54
60
|
import "../chunk-VZ5ZZBNX.js";
|
|
@@ -103,8 +109,12 @@ export {
|
|
|
103
109
|
Agent,
|
|
104
110
|
createHook,
|
|
105
111
|
createResolvedAgent,
|
|
112
|
+
finishLoopContext,
|
|
106
113
|
getAgentToolState,
|
|
107
114
|
getResolvedAgentOptions,
|
|
115
|
+
planLoopContext,
|
|
116
|
+
projectLoopContext,
|
|
117
|
+
summarizeLoopContext,
|
|
108
118
|
withInternalAgentRunOptions
|
|
109
119
|
};
|
|
110
120
|
//# sourceMappingURL=agent.js.map
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TeamRun
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-PLJQ4274.js";
|
|
4
4
|
import "../../chunk-PIMD4DYG.js";
|
|
5
5
|
import "../../chunk-FSBDE6RF.js";
|
|
6
6
|
import "../../chunk-X35O3AQG.js";
|
|
7
7
|
import "../../chunk-ENZ2XX27.js";
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-7XDM7A3W.js";
|
|
9
|
+
import "../../chunk-TXWNIEZU.js";
|
|
10
|
+
import "../../chunk-WU4ODZKR.js";
|
|
11
|
+
import "../../chunk-SXE4J43E.js";
|
|
11
12
|
import "../../chunk-DRSKZVC6.js";
|
|
12
13
|
import "../../chunk-LAIATEUB.js";
|
|
13
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-3F6ZY63S.js";
|
|
15
|
+
import "../../chunk-ZWYMXBGB.js";
|
|
14
16
|
import "../../chunk-PFJN5OIQ.js";
|
|
15
17
|
import "../../chunk-7FBSGD6E.js";
|
|
16
18
|
import "../../chunk-NPJ2T3L5.js";
|
|
17
19
|
import "../../chunk-YWRXOPHC.js";
|
|
18
|
-
import "../../chunk-
|
|
19
|
-
import "../../chunk-5I2NVRHC.js";
|
|
20
|
+
import "../../chunk-5ZM5DB3O.js";
|
|
20
21
|
import "../../chunk-5IURMWFN.js";
|
|
21
22
|
import "../../chunk-2NLINXRF.js";
|
|
22
23
|
import "../../chunk-JMJFK3A4.js";
|
|
@@ -25,7 +26,7 @@ import "../../chunk-CASF2TDK.js";
|
|
|
25
26
|
import "../../chunk-4AW2633B.js";
|
|
26
27
|
import "../../chunk-YNA3UR42.js";
|
|
27
28
|
import "../../chunk-H3H74RWJ.js";
|
|
28
|
-
import "../../chunk-
|
|
29
|
+
import "../../chunk-6Q5VOKBO.js";
|
|
29
30
|
import "../../chunk-LQJ4KHMY.js";
|
|
30
31
|
import "../../chunk-EZR5AV3J.js";
|
|
31
32
|
import "../../chunk-MJCMKZFP.js";
|
|
@@ -40,8 +41,8 @@ import "../../chunk-NF6WBPFG.js";
|
|
|
40
41
|
import "../../chunk-LBYJPMHC.js";
|
|
41
42
|
import "../../chunk-KFAVEL5F.js";
|
|
42
43
|
import "../../chunk-GLMYZ6OA.js";
|
|
43
|
-
import "../../chunk-
|
|
44
|
-
import "../../chunk-
|
|
44
|
+
import "../../chunk-MNWULFRX.js";
|
|
45
|
+
import "../../chunk-SVFEG2TI.js";
|
|
45
46
|
import "../../chunk-ZPJFXRQZ.js";
|
|
46
47
|
import "../../chunk-MEN4AFDZ.js";
|
|
47
48
|
import "../../chunk-VZ5ZZBNX.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createSummaryMemoryCompactor,
|
|
4
4
|
cumulativeCompactedMessageCount,
|
|
5
5
|
isMemoryCompactionMessage
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-6Q5VOKBO.js";
|
|
7
7
|
import "../chunk-LQJ4KHMY.js";
|
|
8
8
|
import "../chunk-ZPJFXRQZ.js";
|
|
9
9
|
import "../chunk-LGPXCJJO.js";
|
package/dist/memory/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { M as Message, U as Usage } from '../types-DYqZKDA8.js';
|
|
2
|
-
import { a as CreateSummaryMemoryCompactorOptions, o as MemoryCompactor, f as MemoryCompactionMessage, C as CreateMemoryScopeKeyOptions } from '../types-
|
|
3
|
-
export { M as MemoryAppendOptions, b as MemoryClearOptions, c as MemoryCompactionCapability, d as MemoryCompactionConflictRetryOptions, e as MemoryCompactionInfo, g as MemoryCompactionMetadata, h as MemoryCompactionOptions, i as MemoryCompactionReplacePrefixOptions, j as MemoryCompactionReplacePrefixResult, k as MemoryCompactionResult, l as MemoryCompactionRetention, m as MemoryCompactionSnapshot, n as MemoryCompactionSnapshotOptions, p as MemoryCompactorInput, q as MemoryCompactorResult, r as MemoryConversation, s as MemoryConversationGetOptions, t as MemoryConversationListOptions, u as MemoryConversationMessage, v as MemoryConversationSummary, w as MemoryErrorOptions, x as MemoryInspector, y as MemoryLoadOptions, z as MemoryOptions, A as MemorySavePolicy, B as MemoryScope, D as MemoryScopeKeyOptions, E as MemoryScopeKeyResolver, F as MemoryStore, G as MemoryTokenCounter } from '../types-
|
|
2
|
+
import { a as CreateSummaryMemoryCompactorOptions, o as MemoryCompactor, f as MemoryCompactionMessage, C as CreateMemoryScopeKeyOptions } from '../types-CWh9AQrq.js';
|
|
3
|
+
export { M as MemoryAppendOptions, b as MemoryClearOptions, c as MemoryCompactionCapability, d as MemoryCompactionConflictRetryOptions, e as MemoryCompactionInfo, g as MemoryCompactionMetadata, h as MemoryCompactionOptions, i as MemoryCompactionReplacePrefixOptions, j as MemoryCompactionReplacePrefixResult, k as MemoryCompactionResult, l as MemoryCompactionRetention, m as MemoryCompactionSnapshot, n as MemoryCompactionSnapshotOptions, p as MemoryCompactorInput, q as MemoryCompactorResult, r as MemoryConversation, s as MemoryConversationGetOptions, t as MemoryConversationListOptions, u as MemoryConversationMessage, v as MemoryConversationSummary, w as MemoryErrorOptions, x as MemoryInspector, y as MemoryLoadOptions, z as MemoryOptions, A as MemorySavePolicy, B as MemoryScope, D as MemoryScopeKeyOptions, E as MemoryScopeKeyResolver, F as MemoryStore, G as MemoryTokenCounter } from '../types-CWh9AQrq.js';
|
|
4
4
|
import '../model-call-options-CZkSw_xN.js';
|
|
5
5
|
import '../retry-CjvSlKGW.js';
|
|
6
6
|
|