agentx-sdk 0.1.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/README.md +561 -0
- package/dist/agent.d.ts +105 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +690 -0
- package/dist/agent.js.map +1 -0
- package/dist/config/config.d.ts +346 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +93 -0
- package/dist/config/config.js.map +1 -0
- package/dist/contracts/entities/agent-event.d.ts +97 -0
- package/dist/contracts/entities/agent-event.d.ts.map +1 -0
- package/dist/contracts/entities/agent-event.js +2 -0
- package/dist/contracts/entities/agent-event.js.map +1 -0
- package/dist/contracts/entities/agent-skill.d.ts +59 -0
- package/dist/contracts/entities/agent-skill.d.ts.map +1 -0
- package/dist/contracts/entities/agent-skill.js +2 -0
- package/dist/contracts/entities/agent-skill.js.map +1 -0
- package/dist/contracts/entities/agent-tool.d.ts +42 -0
- package/dist/contracts/entities/agent-tool.d.ts.map +1 -0
- package/dist/contracts/entities/agent-tool.js +2 -0
- package/dist/contracts/entities/agent-tool.js.map +1 -0
- package/dist/contracts/entities/chat-message.d.ts +13 -0
- package/dist/contracts/entities/chat-message.d.ts.map +1 -0
- package/dist/contracts/entities/chat-message.js +2 -0
- package/dist/contracts/entities/chat-message.js.map +1 -0
- package/dist/contracts/entities/content-part.d.ts +16 -0
- package/dist/contracts/entities/content-part.d.ts.map +1 -0
- package/dist/contracts/entities/content-part.js +2 -0
- package/dist/contracts/entities/content-part.js.map +1 -0
- package/dist/contracts/entities/execution-context.d.ts +9 -0
- package/dist/contracts/entities/execution-context.d.ts.map +1 -0
- package/dist/contracts/entities/execution-context.js +2 -0
- package/dist/contracts/entities/execution-context.js.map +1 -0
- package/dist/contracts/entities/index.d.ts +11 -0
- package/dist/contracts/entities/index.d.ts.map +1 -0
- package/dist/contracts/entities/index.js +2 -0
- package/dist/contracts/entities/index.js.map +1 -0
- package/dist/contracts/entities/knowledge.d.ts +21 -0
- package/dist/contracts/entities/knowledge.d.ts.map +1 -0
- package/dist/contracts/entities/knowledge.js +2 -0
- package/dist/contracts/entities/knowledge.js.map +1 -0
- package/dist/contracts/entities/stores.d.ts +18 -0
- package/dist/contracts/entities/stores.d.ts.map +1 -0
- package/dist/contracts/entities/stores.js +2 -0
- package/dist/contracts/entities/stores.js.map +1 -0
- package/dist/contracts/entities/token-usage.d.ts +7 -0
- package/dist/contracts/entities/token-usage.d.ts.map +1 -0
- package/dist/contracts/entities/token-usage.js +2 -0
- package/dist/contracts/entities/token-usage.js.map +1 -0
- package/dist/contracts/entities/tool-call.d.ts +16 -0
- package/dist/contracts/entities/tool-call.d.ts.map +1 -0
- package/dist/contracts/entities/tool-call.js +2 -0
- package/dist/contracts/entities/tool-call.js.map +1 -0
- package/dist/contracts/enums/index.d.ts +21 -0
- package/dist/contracts/enums/index.d.ts.map +1 -0
- package/dist/contracts/enums/index.js +8 -0
- package/dist/contracts/enums/index.js.map +1 -0
- package/dist/contracts/index.d.ts +3 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +3 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/core/compaction/autocompact.d.ts +18 -0
- package/dist/core/compaction/autocompact.d.ts.map +1 -0
- package/dist/core/compaction/autocompact.js +68 -0
- package/dist/core/compaction/autocompact.js.map +1 -0
- package/dist/core/compaction/microcompact.d.ts +20 -0
- package/dist/core/compaction/microcompact.d.ts.map +1 -0
- package/dist/core/compaction/microcompact.js +38 -0
- package/dist/core/compaction/microcompact.js.map +1 -0
- package/dist/core/compaction/snip-compact.d.ts +22 -0
- package/dist/core/compaction/snip-compact.d.ts.map +1 -0
- package/dist/core/compaction/snip-compact.js +61 -0
- package/dist/core/compaction/snip-compact.js.map +1 -0
- package/dist/core/compaction/tool-result-budget.d.ts +24 -0
- package/dist/core/compaction/tool-result-budget.d.ts.map +1 -0
- package/dist/core/compaction/tool-result-budget.js +67 -0
- package/dist/core/compaction/tool-result-budget.js.map +1 -0
- package/dist/core/context-analysis.d.ts +24 -0
- package/dist/core/context-analysis.d.ts.map +1 -0
- package/dist/core/context-analysis.js +37 -0
- package/dist/core/context-analysis.js.map +1 -0
- package/dist/core/context-builder.d.ts +25 -0
- package/dist/core/context-builder.d.ts.map +1 -0
- package/dist/core/context-builder.js +108 -0
- package/dist/core/context-builder.js.map +1 -0
- package/dist/core/conversation-manager.d.ts +19 -0
- package/dist/core/conversation-manager.d.ts.map +1 -0
- package/dist/core/conversation-manager.js +62 -0
- package/dist/core/conversation-manager.js.map +1 -0
- package/dist/core/execution-context.d.ts +6 -0
- package/dist/core/execution-context.d.ts.map +1 -0
- package/dist/core/execution-context.js +14 -0
- package/dist/core/execution-context.js.map +1 -0
- package/dist/core/loop-deps.d.ts +15 -0
- package/dist/core/loop-deps.d.ts.map +1 -0
- package/dist/core/loop-deps.js +8 -0
- package/dist/core/loop-deps.js.map +1 -0
- package/dist/core/loop-types.d.ts +34 -0
- package/dist/core/loop-types.d.ts.map +1 -0
- package/dist/core/loop-types.js +15 -0
- package/dist/core/loop-types.js.map +1 -0
- package/dist/core/message-normalize.d.ts +18 -0
- package/dist/core/message-normalize.d.ts.map +1 -0
- package/dist/core/message-normalize.js +69 -0
- package/dist/core/message-normalize.js.map +1 -0
- package/dist/core/prompt-builders.d.ts +36 -0
- package/dist/core/prompt-builders.d.ts.map +1 -0
- package/dist/core/prompt-builders.js +89 -0
- package/dist/core/prompt-builders.js.map +1 -0
- package/dist/core/prompt-cache.d.ts +25 -0
- package/dist/core/prompt-cache.d.ts.map +1 -0
- package/dist/core/prompt-cache.js +34 -0
- package/dist/core/prompt-cache.js.map +1 -0
- package/dist/core/react-loop.d.ts +43 -0
- package/dist/core/react-loop.d.ts.map +1 -0
- package/dist/core/react-loop.js +403 -0
- package/dist/core/react-loop.js.map +1 -0
- package/dist/core/stop-hooks.d.ts +18 -0
- package/dist/core/stop-hooks.d.ts.map +1 -0
- package/dist/core/stop-hooks.js +18 -0
- package/dist/core/stop-hooks.js.map +1 -0
- package/dist/core/stream-emitter.d.ts +24 -0
- package/dist/core/stream-emitter.d.ts.map +1 -0
- package/dist/core/stream-emitter.js +65 -0
- package/dist/core/stream-emitter.js.map +1 -0
- package/dist/core/streaming-tool-executor.d.ts +54 -0
- package/dist/core/streaming-tool-executor.d.ts.map +1 -0
- package/dist/core/streaming-tool-executor.js +164 -0
- package/dist/core/streaming-tool-executor.js.map +1 -0
- package/dist/core/turn-end-hooks.d.ts +39 -0
- package/dist/core/turn-end-hooks.d.ts.map +1 -0
- package/dist/core/turn-end-hooks.js +36 -0
- package/dist/core/turn-end-hooks.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/knowledge/chunking.d.ts +9 -0
- package/dist/knowledge/chunking.d.ts.map +1 -0
- package/dist/knowledge/chunking.js +49 -0
- package/dist/knowledge/chunking.js.map +1 -0
- package/dist/knowledge/embedding-service.d.ts +16 -0
- package/dist/knowledge/embedding-service.d.ts.map +1 -0
- package/dist/knowledge/embedding-service.js +43 -0
- package/dist/knowledge/embedding-service.js.map +1 -0
- package/dist/knowledge/knowledge-manager.d.ts +33 -0
- package/dist/knowledge/knowledge-manager.d.ts.map +1 -0
- package/dist/knowledge/knowledge-manager.js +62 -0
- package/dist/knowledge/knowledge-manager.js.map +1 -0
- package/dist/knowledge/sqlite-vector-store.d.ts +16 -0
- package/dist/knowledge/sqlite-vector-store.d.ts.map +1 -0
- package/dist/knowledge/sqlite-vector-store.js +56 -0
- package/dist/knowledge/sqlite-vector-store.js.map +1 -0
- package/dist/knowledge/vector-store.d.ts +2 -0
- package/dist/knowledge/vector-store.d.ts.map +1 -0
- package/dist/knowledge/vector-store.js +2 -0
- package/dist/knowledge/vector-store.js.map +1 -0
- package/dist/llm/errors.d.ts +15 -0
- package/dist/llm/errors.d.ts.map +1 -0
- package/dist/llm/errors.js +39 -0
- package/dist/llm/errors.js.map +1 -0
- package/dist/llm/message-types.d.ts +80 -0
- package/dist/llm/message-types.d.ts.map +1 -0
- package/dist/llm/message-types.js +2 -0
- package/dist/llm/message-types.js.map +1 -0
- package/dist/llm/openrouter-client.d.ts +18 -0
- package/dist/llm/openrouter-client.d.ts.map +1 -0
- package/dist/llm/openrouter-client.js +215 -0
- package/dist/llm/openrouter-client.js.map +1 -0
- package/dist/llm/reasoning.d.ts +10 -0
- package/dist/llm/reasoning.d.ts.map +1 -0
- package/dist/llm/reasoning.js +18 -0
- package/dist/llm/reasoning.js.map +1 -0
- package/dist/memory/file-memory-system.d.ts +98 -0
- package/dist/memory/file-memory-system.d.ts.map +1 -0
- package/dist/memory/file-memory-system.js +310 -0
- package/dist/memory/file-memory-system.js.map +1 -0
- package/dist/memory/memory-age.d.ts +22 -0
- package/dist/memory/memory-age.d.ts.map +1 -0
- package/dist/memory/memory-age.js +44 -0
- package/dist/memory/memory-age.js.map +1 -0
- package/dist/memory/memory-extractor.d.ts +56 -0
- package/dist/memory/memory-extractor.d.ts.map +1 -0
- package/dist/memory/memory-extractor.js +91 -0
- package/dist/memory/memory-extractor.js.map +1 -0
- package/dist/memory/memory-paths.d.ts +45 -0
- package/dist/memory/memory-paths.d.ts.map +1 -0
- package/dist/memory/memory-paths.js +121 -0
- package/dist/memory/memory-paths.js.map +1 -0
- package/dist/memory/memory-prompts.d.ts +41 -0
- package/dist/memory/memory-prompts.d.ts.map +1 -0
- package/dist/memory/memory-prompts.js +279 -0
- package/dist/memory/memory-prompts.js.map +1 -0
- package/dist/memory/memory-relevance.d.ts +16 -0
- package/dist/memory/memory-relevance.d.ts.map +1 -0
- package/dist/memory/memory-relevance.js +46 -0
- package/dist/memory/memory-relevance.js.map +1 -0
- package/dist/memory/memory-scanner.d.ts +22 -0
- package/dist/memory/memory-scanner.d.ts.map +1 -0
- package/dist/memory/memory-scanner.js +99 -0
- package/dist/memory/memory-scanner.js.map +1 -0
- package/dist/memory/memory-tools.d.ts +16 -0
- package/dist/memory/memory-tools.d.ts.map +1 -0
- package/dist/memory/memory-tools.js +196 -0
- package/dist/memory/memory-tools.js.map +1 -0
- package/dist/memory/memory-types.d.ts +47 -0
- package/dist/memory/memory-types.d.ts.map +1 -0
- package/dist/memory/memory-types.js +24 -0
- package/dist/memory/memory-types.js.map +1 -0
- package/dist/skills/skill-args.d.ts +23 -0
- package/dist/skills/skill-args.d.ts.map +1 -0
- package/dist/skills/skill-args.js +77 -0
- package/dist/skills/skill-args.js.map +1 -0
- package/dist/skills/skill-glob.d.ts +24 -0
- package/dist/skills/skill-glob.d.ts.map +1 -0
- package/dist/skills/skill-glob.js +60 -0
- package/dist/skills/skill-glob.js.map +1 -0
- package/dist/skills/skill-loader.d.ts +49 -0
- package/dist/skills/skill-loader.d.ts.map +1 -0
- package/dist/skills/skill-loader.js +197 -0
- package/dist/skills/skill-loader.js.map +1 -0
- package/dist/skills/skill-manager.d.ts +83 -0
- package/dist/skills/skill-manager.d.ts.map +1 -0
- package/dist/skills/skill-manager.js +338 -0
- package/dist/skills/skill-manager.js.map +1 -0
- package/dist/storage/sqlite-conversation-store.d.ts +15 -0
- package/dist/storage/sqlite-conversation-store.d.ts.map +1 -0
- package/dist/storage/sqlite-conversation-store.js +45 -0
- package/dist/storage/sqlite-conversation-store.js.map +1 -0
- package/dist/storage/sqlite-database.d.ts +14 -0
- package/dist/storage/sqlite-database.d.ts.map +1 -0
- package/dist/storage/sqlite-database.js +95 -0
- package/dist/storage/sqlite-database.js.map +1 -0
- package/dist/tools/builtin/ask-user.d.ts +7 -0
- package/dist/tools/builtin/ask-user.d.ts.map +1 -0
- package/dist/tools/builtin/ask-user.js +23 -0
- package/dist/tools/builtin/ask-user.js.map +1 -0
- package/dist/tools/builtin/bash.d.ts +3 -0
- package/dist/tools/builtin/bash.d.ts.map +1 -0
- package/dist/tools/builtin/bash.js +54 -0
- package/dist/tools/builtin/bash.js.map +1 -0
- package/dist/tools/builtin/file-edit.d.ts +3 -0
- package/dist/tools/builtin/file-edit.d.ts.map +1 -0
- package/dist/tools/builtin/file-edit.js +50 -0
- package/dist/tools/builtin/file-edit.js.map +1 -0
- package/dist/tools/builtin/file-read.d.ts +3 -0
- package/dist/tools/builtin/file-read.d.ts.map +1 -0
- package/dist/tools/builtin/file-read.js +47 -0
- package/dist/tools/builtin/file-read.js.map +1 -0
- package/dist/tools/builtin/file-write.d.ts +3 -0
- package/dist/tools/builtin/file-write.d.ts.map +1 -0
- package/dist/tools/builtin/file-write.js +29 -0
- package/dist/tools/builtin/file-write.js.map +1 -0
- package/dist/tools/builtin/glob.d.ts +3 -0
- package/dist/tools/builtin/glob.d.ts.map +1 -0
- package/dist/tools/builtin/glob.js +67 -0
- package/dist/tools/builtin/glob.js.map +1 -0
- package/dist/tools/builtin/grep.d.ts +3 -0
- package/dist/tools/builtin/grep.d.ts.map +1 -0
- package/dist/tools/builtin/grep.js +94 -0
- package/dist/tools/builtin/grep.js.map +1 -0
- package/dist/tools/builtin/index.d.ts +49 -0
- package/dist/tools/builtin/index.d.ts.map +1 -0
- package/dist/tools/builtin/index.js +65 -0
- package/dist/tools/builtin/index.js.map +1 -0
- package/dist/tools/builtin/web-fetch.d.ts +3 -0
- package/dist/tools/builtin/web-fetch.d.ts.map +1 -0
- package/dist/tools/builtin/web-fetch.js +56 -0
- package/dist/tools/builtin/web-fetch.js.map +1 -0
- package/dist/tools/json-schema-to-zod.d.ts +30 -0
- package/dist/tools/json-schema-to-zod.d.ts.map +1 -0
- package/dist/tools/json-schema-to-zod.js +123 -0
- package/dist/tools/json-schema-to-zod.js.map +1 -0
- package/dist/tools/mcp-adapter.d.ts +80 -0
- package/dist/tools/mcp-adapter.d.ts.map +1 -0
- package/dist/tools/mcp-adapter.js +326 -0
- package/dist/tools/mcp-adapter.js.map +1 -0
- package/dist/tools/skill-tool.d.ts +41 -0
- package/dist/tools/skill-tool.d.ts.map +1 -0
- package/dist/tools/skill-tool.js +149 -0
- package/dist/tools/skill-tool.js.map +1 -0
- package/dist/tools/sql/index.d.ts +4 -0
- package/dist/tools/sql/index.d.ts.map +1 -0
- package/dist/tools/sql/index.js +2 -0
- package/dist/tools/sql/index.js.map +1 -0
- package/dist/tools/sql/sql-query-def.d.ts +22 -0
- package/dist/tools/sql/sql-query-def.d.ts.map +1 -0
- package/dist/tools/sql/sql-query-def.js +2 -0
- package/dist/tools/sql/sql-query-def.js.map +1 -0
- package/dist/tools/sql/sql-tool-factory.d.ts +28 -0
- package/dist/tools/sql/sql-tool-factory.d.ts.map +1 -0
- package/dist/tools/sql/sql-tool-factory.js +136 -0
- package/dist/tools/sql/sql-tool-factory.js.map +1 -0
- package/dist/tools/tool-executor.d.ts +67 -0
- package/dist/tools/tool-executor.d.ts.map +1 -0
- package/dist/tools/tool-executor.js +232 -0
- package/dist/tools/tool-executor.js.map +1 -0
- package/dist/utils/cache.d.ts +22 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +61 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/logger.d.ts +15 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +46 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/model-context.d.ts +14 -0
- package/dist/utils/model-context.d.ts.map +1 -0
- package/dist/utils/model-context.js +52 -0
- package/dist/utils/model-context.js.map +1 -0
- package/dist/utils/retry.d.ts +13 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +41 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/token-counter.d.ts +6 -0
- package/dist/utils/token-counter.d.ts.map +1 -0
- package/dist/utils/token-counter.js +19 -0
- package/dist/utils/token-counter.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import { createInitialState } from './loop-types.js';
|
|
2
|
+
import { StreamingToolExecutor } from './streaming-tool-executor.js';
|
|
3
|
+
import { microcompact } from './compaction/microcompact.js';
|
|
4
|
+
import { applyToolResultBudget } from './compaction/tool-result-budget.js';
|
|
5
|
+
import { snipCompact } from './compaction/snip-compact.js';
|
|
6
|
+
import { autocompact } from './compaction/autocompact.js';
|
|
7
|
+
import { runStopHooks } from './stop-hooks.js';
|
|
8
|
+
import { PromptTooLongError, OverloadedError, InsufficientCreditsError, classifyAPIError } from '../llm/errors.js';
|
|
9
|
+
import { SKILL_TOOL_NAME } from '../tools/skill-tool.js';
|
|
10
|
+
import { normalizeMessagesForAPI } from './message-normalize.js';
|
|
11
|
+
const MAX_OUTPUT_TOKENS_RECOVERY_LIMIT = 3;
|
|
12
|
+
const MAX_BUDGET_CONTINUATIONS = 4;
|
|
13
|
+
const MIN_DELTA_TOKENS = 50;
|
|
14
|
+
const DEFAULT_MAX_TOOL_RESULT_CHARS = 10_000;
|
|
15
|
+
const DEFAULT_COMPACTION_THRESHOLD = 0.8;
|
|
16
|
+
const DEFAULT_TAIL_PROTECTION = 4;
|
|
17
|
+
/**
|
|
18
|
+
* ReAct loop as AsyncGenerator.
|
|
19
|
+
* Yields AgentEvent, returns Terminal.
|
|
20
|
+
* State is immutable — replaced atomically at each continue site.
|
|
21
|
+
*/
|
|
22
|
+
export async function* executeReactLoop(initialMessages, config) {
|
|
23
|
+
const { client, toolExecutor, maxIterations, maxConsecutiveErrors, onToolError, costPolicy, signal, maxContextTokens, compactionThreshold, fallbackModel, maxOutputTokens, escalatedMaxOutputTokens, stopHooks, deps, tokenBudget, } = config;
|
|
24
|
+
let currentModel = config.model;
|
|
25
|
+
const usage = { inputTokens: 0, outputTokens: 0, totalTokens: 0 };
|
|
26
|
+
const toolDefs = toolExecutor.listTools().length > 0 ? toolExecutor.getToolDefinitions() : undefined;
|
|
27
|
+
// DI: use injected callModel or default to client.streamChat
|
|
28
|
+
const callModel = deps?.callModel ?? ((params) => client.streamChat(params));
|
|
29
|
+
// Token budget continuation tracking
|
|
30
|
+
let budgetContinuationCount = 0;
|
|
31
|
+
let cumulativeOutputTokens = 0;
|
|
32
|
+
let state = createInitialState([...initialMessages]);
|
|
33
|
+
while (true) {
|
|
34
|
+
const { messages, turnCount, consecutiveErrors } = state;
|
|
35
|
+
// --- Check abort ---
|
|
36
|
+
if (signal?.aborted) {
|
|
37
|
+
return { reason: 'abort', usage };
|
|
38
|
+
}
|
|
39
|
+
// --- Check cost policy ---
|
|
40
|
+
if (costPolicy?.maxTokensPerExecution && usage.totalTokens >= costPolicy.maxTokensPerExecution) {
|
|
41
|
+
if (costPolicy.onLimitReached === 'stop') {
|
|
42
|
+
return { reason: 'cost_limit', usage };
|
|
43
|
+
}
|
|
44
|
+
yield { type: 'warning', message: 'Token limit approaching', code: 'cost_warning' };
|
|
45
|
+
}
|
|
46
|
+
// --- Check max iterations ---
|
|
47
|
+
if (turnCount > maxIterations) {
|
|
48
|
+
yield { type: 'warning', message: 'Max iterations reached', code: 'max_iterations' };
|
|
49
|
+
return { reason: 'max_iterations', usage };
|
|
50
|
+
}
|
|
51
|
+
// --- Compaction pipeline (before LLM call) ---
|
|
52
|
+
let compactedMessages = [...messages];
|
|
53
|
+
// 0. Tool result budget — aggregate truncation (largest first)
|
|
54
|
+
if (maxContextTokens) {
|
|
55
|
+
const budgetChars = Math.floor(maxContextTokens * 4 * 0.5); // 50% of context in chars
|
|
56
|
+
const budgetResult = applyToolResultBudget(compactedMessages, { maxTotalToolResultChars: budgetChars });
|
|
57
|
+
if (budgetResult.truncatedCount > 0) {
|
|
58
|
+
compactedMessages = budgetResult.messages;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// 0.5. Snip compact — remove orphaned early tool results
|
|
62
|
+
const snipResult = snipCompact(compactedMessages, { tailProtection: DEFAULT_TAIL_PROTECTION });
|
|
63
|
+
if (snipResult.snippedCount > 0) {
|
|
64
|
+
compactedMessages = snipResult.messages;
|
|
65
|
+
}
|
|
66
|
+
// 1. Microcompact — truncate large tool results (with per-tool overrides)
|
|
67
|
+
const perToolMaxChars = new Map();
|
|
68
|
+
for (const tool of toolExecutor.listTools()) {
|
|
69
|
+
if (tool.maxResultChars !== undefined) {
|
|
70
|
+
perToolMaxChars.set(tool.name, tool.maxResultChars);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Build tool_call_id → tool_name map from assistant messages in history
|
|
74
|
+
const toolCallIdToName = new Map();
|
|
75
|
+
for (const msg of compactedMessages) {
|
|
76
|
+
if (msg.role === 'assistant' && msg.tool_calls) {
|
|
77
|
+
for (const tc of msg.tool_calls) {
|
|
78
|
+
toolCallIdToName.set(tc.id, tc.function.name);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const microResult = microcompact(compactedMessages, {
|
|
83
|
+
maxToolResultChars: DEFAULT_MAX_TOOL_RESULT_CHARS,
|
|
84
|
+
perToolMaxChars: perToolMaxChars.size > 0 ? perToolMaxChars : undefined,
|
|
85
|
+
toolCallIdToName: toolCallIdToName.size > 0 ? toolCallIdToName : undefined,
|
|
86
|
+
});
|
|
87
|
+
if (microResult.truncatedCount > 0) {
|
|
88
|
+
compactedMessages = microResult.messages;
|
|
89
|
+
yield { type: 'compaction', strategy: 'microcompact', tokensFreed: 0 };
|
|
90
|
+
}
|
|
91
|
+
// 2. Autocompact — summarize if threshold exceeded
|
|
92
|
+
if (maxContextTokens) {
|
|
93
|
+
const autoResult = await autocompact(compactedMessages, client, {
|
|
94
|
+
maxContextTokens,
|
|
95
|
+
compactionThreshold: compactionThreshold ?? DEFAULT_COMPACTION_THRESHOLD,
|
|
96
|
+
tailProtection: DEFAULT_TAIL_PROTECTION,
|
|
97
|
+
});
|
|
98
|
+
if (autoResult) {
|
|
99
|
+
compactedMessages = autoResult.messages;
|
|
100
|
+
yield { type: 'compaction', strategy: 'autocompact', tokensFreed: autoResult.tokensFreed };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// --- Turn start ---
|
|
104
|
+
yield { type: 'turn_start', iteration: turnCount - 1 };
|
|
105
|
+
let fullText = '';
|
|
106
|
+
let finishReason = '';
|
|
107
|
+
let turnOutputTokens = 0;
|
|
108
|
+
const toolCalls = [];
|
|
109
|
+
const earlyToolResults = []; // Tool results completed during streaming
|
|
110
|
+
// --- Stream from LLM ---
|
|
111
|
+
const streamingExecutor = new StreamingToolExecutor(toolExecutor, signal);
|
|
112
|
+
const effectiveMaxTokens = state.maxOutputTokensOverride ?? maxOutputTokens;
|
|
113
|
+
try {
|
|
114
|
+
// Normalize messages before API call (remove orphaned tool results/calls, empty messages)
|
|
115
|
+
const normalizedMessages = normalizeMessagesForAPI(compactedMessages);
|
|
116
|
+
for await (const chunk of callModel({
|
|
117
|
+
messages: normalizedMessages,
|
|
118
|
+
tools: toolDefs,
|
|
119
|
+
model: currentModel,
|
|
120
|
+
signal,
|
|
121
|
+
maxTokens: effectiveMaxTokens,
|
|
122
|
+
})) {
|
|
123
|
+
switch (chunk.type) {
|
|
124
|
+
case 'content':
|
|
125
|
+
fullText += chunk.data;
|
|
126
|
+
yield { type: 'text_delta', content: chunk.data };
|
|
127
|
+
break;
|
|
128
|
+
case 'tool_call':
|
|
129
|
+
toolCalls.push({ id: chunk.id, name: chunk.name, arguments: chunk.arguments });
|
|
130
|
+
yield {
|
|
131
|
+
type: 'tool_call_start',
|
|
132
|
+
toolCall: { id: chunk.id, type: 'function', function: { name: chunk.name, arguments: chunk.arguments } },
|
|
133
|
+
};
|
|
134
|
+
streamingExecutor.addTool(chunk.id, chunk.name, chunk.arguments);
|
|
135
|
+
break;
|
|
136
|
+
case 'done':
|
|
137
|
+
finishReason = chunk.finishReason;
|
|
138
|
+
if (chunk.usage) {
|
|
139
|
+
usage.inputTokens += chunk.usage.inputTokens;
|
|
140
|
+
usage.outputTokens += chunk.usage.outputTokens;
|
|
141
|
+
usage.totalTokens += chunk.usage.totalTokens;
|
|
142
|
+
turnOutputTokens = chunk.usage.outputTokens;
|
|
143
|
+
}
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
// Yield progress events from tools executing during streaming
|
|
147
|
+
for (const progress of streamingExecutor.getProgressEvents()) {
|
|
148
|
+
yield { type: 'tool_progress', toolCallId: progress.toolCallId, toolName: progress.toolName, data: progress.data };
|
|
149
|
+
}
|
|
150
|
+
// Yield completed tool results during streaming and collect for message history
|
|
151
|
+
for (const completed of streamingExecutor.getCompletedResults()) {
|
|
152
|
+
yield { type: 'tool_call_end', toolCallId: completed.id, result: completed.result, duration: completed.duration };
|
|
153
|
+
earlyToolResults.push({ role: 'tool', content: completed.result.content, tool_call_id: completed.id });
|
|
154
|
+
if (completed.result.isError && onToolError === 'stop') {
|
|
155
|
+
yield { type: 'turn_end', iteration: turnCount - 1, hasToolCalls: true };
|
|
156
|
+
return { reason: 'error', usage };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// --- Build assistant message ---
|
|
161
|
+
const assistantMessage = { role: 'assistant', content: fullText };
|
|
162
|
+
if (toolCalls.length > 0) {
|
|
163
|
+
assistantMessage.tool_calls = toolCalls.map(tc => ({
|
|
164
|
+
id: tc.id,
|
|
165
|
+
type: 'function',
|
|
166
|
+
function: { name: tc.name, arguments: tc.arguments },
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
169
|
+
// --- Max Output Tokens Recovery (two steps: escalate first, then resume) ---
|
|
170
|
+
if (finishReason === 'length' && toolCalls.length === 0) {
|
|
171
|
+
// Step 1: Escalate maxTokens (retry same request with higher limit)
|
|
172
|
+
if (escalatedMaxOutputTokens &&
|
|
173
|
+
state.maxOutputTokensOverride === undefined) {
|
|
174
|
+
yield { type: 'recovery', reason: 'max_output_tokens_escalate', attempt: 1 };
|
|
175
|
+
state = {
|
|
176
|
+
...state,
|
|
177
|
+
maxOutputTokensOverride: escalatedMaxOutputTokens,
|
|
178
|
+
transition: { reason: 'max_output_tokens_escalate' },
|
|
179
|
+
};
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
// Step 2: Multi-turn recovery (inject resume message)
|
|
183
|
+
const recoveryCount = state.maxOutputTokensRecoveryCount + 1;
|
|
184
|
+
if (recoveryCount > MAX_OUTPUT_TOKENS_RECOVERY_LIMIT) {
|
|
185
|
+
if (fullText)
|
|
186
|
+
yield { type: 'text_done', content: fullText };
|
|
187
|
+
yield { type: 'turn_end', iteration: turnCount - 1, hasToolCalls: false };
|
|
188
|
+
return { reason: 'max_output_tokens', usage };
|
|
189
|
+
}
|
|
190
|
+
yield { type: 'recovery', reason: 'max_output_tokens_recovery', attempt: recoveryCount };
|
|
191
|
+
const resumeMessage = {
|
|
192
|
+
role: 'user',
|
|
193
|
+
content: '[System: Your response was truncated. Resume directly from where you stopped — no recap, no repetition.]',
|
|
194
|
+
};
|
|
195
|
+
state = {
|
|
196
|
+
...state,
|
|
197
|
+
messages: [...messages, assistantMessage, resumeMessage],
|
|
198
|
+
maxOutputTokensRecoveryCount: recoveryCount,
|
|
199
|
+
transition: { reason: 'max_output_tokens_recovery' },
|
|
200
|
+
};
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
// --- No tool calls → check stop hooks + budget continuation ---
|
|
204
|
+
if (toolCalls.length === 0) {
|
|
205
|
+
// Run stop hooks (if any)
|
|
206
|
+
if (stopHooks && stopHooks.length > 0) {
|
|
207
|
+
const hookResult = await runStopHooks(stopHooks, {
|
|
208
|
+
messages,
|
|
209
|
+
assistantText: fullText,
|
|
210
|
+
turnCount,
|
|
211
|
+
});
|
|
212
|
+
if (hookResult.preventContinuation) {
|
|
213
|
+
if (fullText)
|
|
214
|
+
yield { type: 'text_done', content: fullText };
|
|
215
|
+
yield { type: 'turn_end', iteration: turnCount - 1, hasToolCalls: false };
|
|
216
|
+
return { reason: 'stop_hook', usage };
|
|
217
|
+
}
|
|
218
|
+
if (hookResult.blockingErrors.length > 0) {
|
|
219
|
+
yield { type: 'recovery', reason: 'stop_hook_blocking', attempt: 1 };
|
|
220
|
+
const errorMessages = hookResult.blockingErrors.map(err => ({
|
|
221
|
+
role: 'user',
|
|
222
|
+
content: `[Stop hook error: ${err}]`,
|
|
223
|
+
}));
|
|
224
|
+
state = {
|
|
225
|
+
...state,
|
|
226
|
+
messages: [...messages, assistantMessage, ...errorMessages],
|
|
227
|
+
turnCount: turnCount + 1,
|
|
228
|
+
transition: { reason: 'stop_hook_blocking' },
|
|
229
|
+
};
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// Token budget continuation
|
|
234
|
+
if (tokenBudget) {
|
|
235
|
+
cumulativeOutputTokens += turnOutputTokens;
|
|
236
|
+
const outputThreshold = tokenBudget.total * tokenBudget.outputThreshold;
|
|
237
|
+
const belowThreshold = cumulativeOutputTokens < outputThreshold;
|
|
238
|
+
const notExhausted = budgetContinuationCount < MAX_BUDGET_CONTINUATIONS;
|
|
239
|
+
const notDiminishing = turnOutputTokens >= MIN_DELTA_TOKENS || budgetContinuationCount === 0;
|
|
240
|
+
if (belowThreshold && notExhausted && notDiminishing) {
|
|
241
|
+
budgetContinuationCount++;
|
|
242
|
+
yield { type: 'recovery', reason: 'token_budget_continuation', attempt: budgetContinuationCount };
|
|
243
|
+
const nudgeMessage = {
|
|
244
|
+
role: 'user',
|
|
245
|
+
content: '[System: Continue working. You still have budget remaining.]',
|
|
246
|
+
};
|
|
247
|
+
state = {
|
|
248
|
+
...state,
|
|
249
|
+
messages: [...messages, assistantMessage, nudgeMessage],
|
|
250
|
+
turnCount: turnCount + 1,
|
|
251
|
+
transition: { reason: 'token_budget_continuation' },
|
|
252
|
+
};
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
// Normal completion
|
|
257
|
+
if (fullText)
|
|
258
|
+
yield { type: 'text_done', content: fullText };
|
|
259
|
+
yield { type: 'turn_end', iteration: turnCount - 1, hasToolCalls: false };
|
|
260
|
+
return { reason: 'stop', usage };
|
|
261
|
+
}
|
|
262
|
+
// --- Collect remaining tool results (include early results from streaming phase) ---
|
|
263
|
+
const toolResultMessages = [...earlyToolResults];
|
|
264
|
+
let hasToolError = false;
|
|
265
|
+
const touchedFilePaths = [];
|
|
266
|
+
// Drain remaining progress events
|
|
267
|
+
for (const progress of streamingExecutor.getProgressEvents()) {
|
|
268
|
+
yield { type: 'tool_progress', toolCallId: progress.toolCallId, toolName: progress.toolName, data: progress.data };
|
|
269
|
+
}
|
|
270
|
+
for await (const completed of streamingExecutor.getRemainingResults()) {
|
|
271
|
+
yield { type: 'tool_call_end', toolCallId: completed.id, result: completed.result, duration: completed.duration };
|
|
272
|
+
if (completed.result.isError && onToolError === 'stop') {
|
|
273
|
+
toolResultMessages.push({ role: 'tool', content: completed.result.content, tool_call_id: completed.id });
|
|
274
|
+
yield { type: 'turn_end', iteration: turnCount - 1, hasToolCalls: true };
|
|
275
|
+
return { reason: 'error', usage };
|
|
276
|
+
}
|
|
277
|
+
if (completed.result.isError)
|
|
278
|
+
hasToolError = true;
|
|
279
|
+
// Pin skill tool results so they survive compaction
|
|
280
|
+
const toolResultMsg = { role: 'tool', content: completed.result.content, tool_call_id: completed.id };
|
|
281
|
+
if (completed.name === SKILL_TOOL_NAME) {
|
|
282
|
+
toolResultMsg._pinned = true;
|
|
283
|
+
}
|
|
284
|
+
toolResultMessages.push(toolResultMsg);
|
|
285
|
+
// Extract file paths for conditional skill activation
|
|
286
|
+
if (config.onFilePathsTouched) {
|
|
287
|
+
const toolDef = toolExecutor.listTools().find(t => t.name === completed.name);
|
|
288
|
+
if (toolDef?.getFilePath) {
|
|
289
|
+
const tc = toolCalls.find(c => c.id === completed.id);
|
|
290
|
+
if (tc) {
|
|
291
|
+
try {
|
|
292
|
+
const parsed = JSON.parse(tc.arguments);
|
|
293
|
+
const paths = toolDef.getFilePath(parsed);
|
|
294
|
+
if (paths) {
|
|
295
|
+
const arr = Array.isArray(paths) ? paths : [paths];
|
|
296
|
+
touchedFilePaths.push(...arr);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
catch { /* parse error — skip */ }
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
// Also check metadata.filePaths
|
|
303
|
+
const metaPaths = completed.result.metadata?.filePaths;
|
|
304
|
+
if (Array.isArray(metaPaths)) {
|
|
305
|
+
touchedFilePaths.push(...metaPaths.filter((p) => typeof p === 'string'));
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
// --- Conditional skill activation from file operations ---
|
|
310
|
+
if (config.onFilePathsTouched && touchedFilePaths.length > 0) {
|
|
311
|
+
const activated = config.onFilePathsTouched(touchedFilePaths);
|
|
312
|
+
for (const skillName of activated) {
|
|
313
|
+
yield { type: 'skill_activated', skillName };
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// --- onToolError: 'retry' — re-run LLM turn so model can correct its args ---
|
|
317
|
+
if (hasToolError && onToolError === 'retry' && state.toolRetryCount < 1) {
|
|
318
|
+
yield { type: 'recovery', reason: 'tool_retry', attempt: state.toolRetryCount + 1 };
|
|
319
|
+
state = {
|
|
320
|
+
...state,
|
|
321
|
+
messages: [...messages, assistantMessage, ...toolResultMessages],
|
|
322
|
+
turnCount: turnCount + 1,
|
|
323
|
+
consecutiveErrors: 0,
|
|
324
|
+
toolRetryCount: state.toolRetryCount + 1,
|
|
325
|
+
transition: { reason: 'next_turn' },
|
|
326
|
+
};
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
yield { type: 'turn_end', iteration: turnCount - 1, hasToolCalls: true };
|
|
330
|
+
// --- Continue site: next_turn ---
|
|
331
|
+
state = {
|
|
332
|
+
...state,
|
|
333
|
+
messages: [...messages, assistantMessage, ...toolResultMessages],
|
|
334
|
+
turnCount: turnCount + 1,
|
|
335
|
+
consecutiveErrors: 0,
|
|
336
|
+
transition: { reason: 'next_turn' },
|
|
337
|
+
};
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
catch (error) {
|
|
341
|
+
const classified = classifyAPIError(error);
|
|
342
|
+
// --- PTL Recovery (413) ---
|
|
343
|
+
if (classified instanceof PromptTooLongError && !state.hasAttemptedCompaction) {
|
|
344
|
+
if (maxContextTokens) {
|
|
345
|
+
// Use original messages from state (not compactedMessages which may already be compacted)
|
|
346
|
+
const compactResult = await autocompact([...messages], client, {
|
|
347
|
+
maxContextTokens,
|
|
348
|
+
compactionThreshold: 0.1, // Force compaction
|
|
349
|
+
tailProtection: DEFAULT_TAIL_PROTECTION,
|
|
350
|
+
});
|
|
351
|
+
if (compactResult) {
|
|
352
|
+
yield { type: 'recovery', reason: 'reactive_compact_retry', attempt: 1 };
|
|
353
|
+
yield { type: 'compaction', strategy: 'autocompact', tokensFreed: compactResult.tokensFreed };
|
|
354
|
+
state = {
|
|
355
|
+
...state,
|
|
356
|
+
messages: compactResult.messages,
|
|
357
|
+
hasAttemptedCompaction: true,
|
|
358
|
+
transition: { reason: 'reactive_compact_retry' },
|
|
359
|
+
};
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return { reason: 'prompt_too_long', usage };
|
|
364
|
+
}
|
|
365
|
+
if (classified instanceof PromptTooLongError) {
|
|
366
|
+
return { reason: 'prompt_too_long', usage };
|
|
367
|
+
}
|
|
368
|
+
// --- Insufficient Credits (402) — non-recoverable ---
|
|
369
|
+
if (classified instanceof InsufficientCreditsError) {
|
|
370
|
+
yield { type: 'error', error: classified, recoverable: false };
|
|
371
|
+
return { reason: 'error', usage, error: classified };
|
|
372
|
+
}
|
|
373
|
+
// --- Model Fallback (529/503) ---
|
|
374
|
+
if (classified instanceof OverloadedError && fallbackModel && currentModel !== fallbackModel) {
|
|
375
|
+
yield { type: 'model_fallback', from: currentModel, to: fallbackModel };
|
|
376
|
+
currentModel = fallbackModel;
|
|
377
|
+
state = {
|
|
378
|
+
...state,
|
|
379
|
+
transition: { reason: 'model_fallback' },
|
|
380
|
+
};
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
// --- Generic error recovery ---
|
|
384
|
+
const newConsecutiveErrors = consecutiveErrors + 1;
|
|
385
|
+
const actualError = classified instanceof Error ? classified : new Error(String(classified));
|
|
386
|
+
yield {
|
|
387
|
+
type: 'error',
|
|
388
|
+
error: actualError,
|
|
389
|
+
recoverable: newConsecutiveErrors < maxConsecutiveErrors,
|
|
390
|
+
};
|
|
391
|
+
if (newConsecutiveErrors >= maxConsecutiveErrors) {
|
|
392
|
+
return { reason: 'error', usage, error: actualError };
|
|
393
|
+
}
|
|
394
|
+
state = {
|
|
395
|
+
...state,
|
|
396
|
+
consecutiveErrors: newConsecutiveErrors,
|
|
397
|
+
transition: undefined,
|
|
398
|
+
};
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
//# sourceMappingURL=react-loop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-loop.js","sourceRoot":"","sources":["../../src/core/react-loop.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACnH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAC3C,MAAM,wBAAwB,GAAG,CAAC,CAAC;AACnC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,6BAA6B,GAAG,MAAM,CAAC;AAC7C,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tB,CAAC;YACF,SAAS;QACX,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { OpenRouterMessage } from '../llm/message-types.js';
|
|
2
|
+
export interface StopHookContext {
|
|
3
|
+
messages: readonly OpenRouterMessage[];
|
|
4
|
+
assistantText: string;
|
|
5
|
+
turnCount: number;
|
|
6
|
+
}
|
|
7
|
+
export interface StopHookResult {
|
|
8
|
+
blockingErrors: string[];
|
|
9
|
+
preventContinuation: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** A hook that runs when the model produces a final response (no tool calls) */
|
|
12
|
+
export interface StopHook {
|
|
13
|
+
name: string;
|
|
14
|
+
execute(context: StopHookContext): Promise<StopHookResult>;
|
|
15
|
+
}
|
|
16
|
+
/** Run all stop hooks, merge results */
|
|
17
|
+
export declare function runStopHooks(hooks: StopHook[], context: StopHookContext): Promise<StopHookResult>;
|
|
18
|
+
//# sourceMappingURL=stop-hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stop-hooks.d.ts","sourceRoot":"","sources":["../../src/core/stop-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED,gFAAgF;AAChF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC5D;AAED,wCAAwC;AACxC,wBAAsB,YAAY,CAChC,KAAK,EAAE,QAAQ,EAAE,EACjB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,CAezB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Run all stop hooks, merge results */
|
|
2
|
+
export async function runStopHooks(hooks, context) {
|
|
3
|
+
const allErrors = [];
|
|
4
|
+
let preventContinuation = false;
|
|
5
|
+
for (const hook of hooks) {
|
|
6
|
+
try {
|
|
7
|
+
const result = await hook.execute(context);
|
|
8
|
+
allErrors.push(...result.blockingErrors);
|
|
9
|
+
if (result.preventContinuation)
|
|
10
|
+
preventContinuation = true;
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
// Stop hooks should not break the loop
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return { blockingErrors: allErrors, preventContinuation };
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=stop-hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stop-hooks.js","sourceRoot":"","sources":["../../src/core/stop-hooks.ts"],"names":[],"mappings":"AAmBA,wCAAwC;AACxC,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,KAAiB,EACjB,OAAwB;IAExB,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,IAAI,mBAAmB,GAAG,KAAK,CAAC;IAEhC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC3C,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;YACzC,IAAI,MAAM,CAAC,mBAAmB;gBAAE,mBAAmB,GAAG,IAAI,CAAC;QAC7D,CAAC;QAAC,MAAM,CAAC;YACP,uCAAuC;QACzC,CAAC;IACH,CAAC;IAED,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AgentEvent } from '../contracts/entities/agent-event.js';
|
|
2
|
+
/**
|
|
3
|
+
* Async push/pull channel with bounded queue and backpressure for AgentEvents.
|
|
4
|
+
*/
|
|
5
|
+
export declare class StreamEmitter {
|
|
6
|
+
private readonly queue;
|
|
7
|
+
private readonly maxQueueSize;
|
|
8
|
+
private resolve;
|
|
9
|
+
private done;
|
|
10
|
+
constructor(maxQueueSize?: number);
|
|
11
|
+
/**
|
|
12
|
+
* Push an event into the channel.
|
|
13
|
+
*/
|
|
14
|
+
emit(event: AgentEvent): void;
|
|
15
|
+
/**
|
|
16
|
+
* Close the channel — no more events will be emitted.
|
|
17
|
+
*/
|
|
18
|
+
close(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Returns an AsyncIterableIterator for consuming events.
|
|
21
|
+
*/
|
|
22
|
+
iterator(): AsyncIterableIterator<AgentEvent>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=stream-emitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-emitter.d.ts","sourceRoot":"","sources":["../../src/core/stream-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAEvE;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAC1C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,OAAO,CAA8D;IAC7E,OAAO,CAAC,IAAI,CAAS;gBAET,YAAY,SAAO;IAI/B;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAc7B;;OAEG;IACH,KAAK,IAAI,IAAI;IASb;;OAEG;IACH,QAAQ,IAAI,qBAAqB,CAAC,UAAU,CAAC;CAuB9C"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Async push/pull channel with bounded queue and backpressure for AgentEvents.
|
|
3
|
+
*/
|
|
4
|
+
export class StreamEmitter {
|
|
5
|
+
queue = [];
|
|
6
|
+
maxQueueSize;
|
|
7
|
+
resolve = null;
|
|
8
|
+
done = false;
|
|
9
|
+
constructor(maxQueueSize = 1000) {
|
|
10
|
+
this.maxQueueSize = maxQueueSize;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Push an event into the channel.
|
|
14
|
+
*/
|
|
15
|
+
emit(event) {
|
|
16
|
+
if (this.done)
|
|
17
|
+
return;
|
|
18
|
+
if (this.resolve) {
|
|
19
|
+
// Consumer is waiting — deliver directly
|
|
20
|
+
const r = this.resolve;
|
|
21
|
+
this.resolve = null;
|
|
22
|
+
r({ value: event, done: false });
|
|
23
|
+
}
|
|
24
|
+
else if (this.queue.length < this.maxQueueSize) {
|
|
25
|
+
this.queue.push(event);
|
|
26
|
+
}
|
|
27
|
+
// If queue is full, drop event (backpressure)
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Close the channel — no more events will be emitted.
|
|
31
|
+
*/
|
|
32
|
+
close() {
|
|
33
|
+
this.done = true;
|
|
34
|
+
if (this.resolve) {
|
|
35
|
+
const r = this.resolve;
|
|
36
|
+
this.resolve = null;
|
|
37
|
+
r({ value: undefined, done: true });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns an AsyncIterableIterator for consuming events.
|
|
42
|
+
*/
|
|
43
|
+
iterator() {
|
|
44
|
+
const self = this;
|
|
45
|
+
return {
|
|
46
|
+
next() {
|
|
47
|
+
// Drain queue first
|
|
48
|
+
if (self.queue.length > 0) {
|
|
49
|
+
return Promise.resolve({ value: self.queue.shift(), done: false });
|
|
50
|
+
}
|
|
51
|
+
if (self.done) {
|
|
52
|
+
return Promise.resolve({ value: undefined, done: true });
|
|
53
|
+
}
|
|
54
|
+
// Wait for next emit
|
|
55
|
+
return new Promise(resolve => {
|
|
56
|
+
self.resolve = resolve;
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
[Symbol.asyncIterator]() {
|
|
60
|
+
return this;
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=stream-emitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-emitter.js","sourceRoot":"","sources":["../../src/core/stream-emitter.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,aAAa;IACP,KAAK,GAAiB,EAAE,CAAC;IACzB,YAAY,CAAS;IAC9B,OAAO,GAAyD,IAAI,CAAC;IACrE,IAAI,GAAG,KAAK,CAAC;IAErB,YAAY,YAAY,GAAG,IAAI;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,KAAiB;QACpB,IAAI,IAAI,CAAC,IAAI;YAAE,OAAO;QAEtB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,yCAAyC;YACzC,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;YACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACnC,CAAC;aAAM,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;YACjD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QACD,8CAA8C;IAChD,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;YACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,CAAC,CAAC,EAAE,KAAK,EAAE,SAAkC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,MAAM,IAAI,GAAG,IAAI,CAAC;QAClB,OAAO;YACL,IAAI;gBACF,oBAAoB;gBACpB,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC1B,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;gBACtE,CAAC;gBAED,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;oBACd,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAkC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;gBACpF,CAAC;gBAED,qBAAqB;gBACrB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;oBAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;gBACzB,CAAC,CAAC,CAAC;YACL,CAAC;YACD,CAAC,MAAM,CAAC,aAAa,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ToolExecutor } from '../tools/tool-executor.js';
|
|
2
|
+
import type { AgentToolResult } from '../contracts/entities/tool-call.js';
|
|
3
|
+
export interface ToolExecutionResult {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
result: AgentToolResult;
|
|
7
|
+
duration: number;
|
|
8
|
+
}
|
|
9
|
+
export interface ToolProgressInfo {
|
|
10
|
+
toolCallId: string;
|
|
11
|
+
toolName: string;
|
|
12
|
+
data: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Executes tools while the LLM is still streaming.
|
|
16
|
+
* Respects concurrency safety: safe tools run in parallel, unsafe tools run alone.
|
|
17
|
+
* Results are always yielded in submission order.
|
|
18
|
+
* Supports progress callbacks — tools can report incremental updates.
|
|
19
|
+
*/
|
|
20
|
+
export declare class StreamingToolExecutor {
|
|
21
|
+
private readonly tools;
|
|
22
|
+
private readonly executor;
|
|
23
|
+
private readonly signal?;
|
|
24
|
+
private processing;
|
|
25
|
+
/** Accumulated progress events from all tools (drained by getProgressEvents) */
|
|
26
|
+
private pendingProgress;
|
|
27
|
+
constructor(executor: ToolExecutor, signal?: AbortSignal);
|
|
28
|
+
/** Called during LLM streaming when a tool_call chunk arrives */
|
|
29
|
+
addTool(id: string, name: string, args: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Non-blocking: yields completed results in submission order.
|
|
32
|
+
* Call during streaming to drain finished tools without waiting.
|
|
33
|
+
*/
|
|
34
|
+
getCompletedResults(): Generator<ToolExecutionResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Non-blocking: drains accumulated progress events from all tools.
|
|
37
|
+
* Call during streaming alongside getCompletedResults().
|
|
38
|
+
*/
|
|
39
|
+
getProgressEvents(): Generator<ToolProgressInfo>;
|
|
40
|
+
/**
|
|
41
|
+
* Blocking: waits for all remaining tools to complete, yielding in order.
|
|
42
|
+
* Call after streaming ends.
|
|
43
|
+
*/
|
|
44
|
+
getRemainingResults(): AsyncGenerator<ToolExecutionResult>;
|
|
45
|
+
/**
|
|
46
|
+
* Process the queue respecting concurrency rules:
|
|
47
|
+
* - Multiple consecutive safe tools can execute in parallel
|
|
48
|
+
* - An unsafe tool must execute alone (waits for all prior to finish)
|
|
49
|
+
*/
|
|
50
|
+
private processQueue;
|
|
51
|
+
private startTool;
|
|
52
|
+
private executeTool;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=streaming-tool-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streaming-tool-executor.d.ts","sourceRoot":"","sources":["../../src/core/streaming-tool-executor.ts"],"names":[],"mappings":"AAAA,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