@ariaflowagents/core 0.7.1 → 0.9.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 +90 -1
- package/dist/agents/Agent.d.ts +188 -9
- package/dist/agents/Agent.d.ts.map +1 -1
- package/dist/agents/Agent.js +246 -24
- package/dist/agents/Agent.js.map +1 -1
- package/dist/agents/CompositeAgent.d.ts +4 -3
- package/dist/agents/CompositeAgent.d.ts.map +1 -1
- package/dist/agents/CompositeAgent.js +19 -9
- package/dist/agents/CompositeAgent.js.map +1 -1
- package/dist/agents/FlowAgent.d.ts +3 -2
- package/dist/agents/FlowAgent.d.ts.map +1 -1
- package/dist/agents/FlowAgent.js +16 -6
- package/dist/agents/FlowAgent.js.map +1 -1
- package/dist/agents/TriageAgent.d.ts +8 -2
- package/dist/agents/TriageAgent.d.ts.map +1 -1
- package/dist/agents/TriageAgent.js +39 -6
- package/dist/agents/TriageAgent.js.map +1 -1
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +0 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/capabilities/AutoRetrieveCapability.d.ts +30 -0
- package/dist/capabilities/AutoRetrieveCapability.d.ts.map +1 -0
- package/dist/capabilities/AutoRetrieveCapability.js +36 -0
- package/dist/capabilities/AutoRetrieveCapability.js.map +1 -0
- package/dist/capabilities/ExtractionCapability.d.ts +25 -0
- package/dist/capabilities/ExtractionCapability.d.ts.map +1 -0
- package/dist/capabilities/ExtractionCapability.js +74 -0
- package/dist/capabilities/ExtractionCapability.js.map +1 -0
- package/dist/capabilities/FlowCapability.d.ts +81 -0
- package/dist/capabilities/FlowCapability.d.ts.map +1 -0
- package/dist/capabilities/FlowCapability.js +482 -0
- package/dist/capabilities/FlowCapability.js.map +1 -0
- package/dist/capabilities/GuardrailCapability.d.ts +30 -0
- package/dist/capabilities/GuardrailCapability.d.ts.map +1 -0
- package/dist/capabilities/GuardrailCapability.js +38 -0
- package/dist/capabilities/GuardrailCapability.js.map +1 -0
- package/dist/capabilities/HandoffCapability.d.ts +19 -0
- package/dist/capabilities/HandoffCapability.d.ts.map +1 -0
- package/dist/capabilities/HandoffCapability.js +58 -0
- package/dist/capabilities/HandoffCapability.js.map +1 -0
- package/dist/capabilities/LivePromptAssembler.d.ts +108 -0
- package/dist/capabilities/LivePromptAssembler.d.ts.map +1 -0
- package/dist/capabilities/LivePromptAssembler.js +157 -0
- package/dist/capabilities/LivePromptAssembler.js.map +1 -0
- package/dist/capabilities/TriageCapability.d.ts +16 -0
- package/dist/capabilities/TriageCapability.d.ts.map +1 -0
- package/dist/capabilities/TriageCapability.js +61 -0
- package/dist/capabilities/TriageCapability.js.map +1 -0
- package/dist/capabilities/adapters/ai-sdk.d.ts +14 -0
- package/dist/capabilities/adapters/ai-sdk.d.ts.map +1 -0
- package/dist/capabilities/adapters/ai-sdk.js +29 -0
- package/dist/capabilities/adapters/ai-sdk.js.map +1 -0
- package/dist/capabilities/adapters/gemini.d.ts +15 -0
- package/dist/capabilities/adapters/gemini.d.ts.map +1 -0
- package/dist/capabilities/adapters/gemini.js +40 -0
- package/dist/capabilities/adapters/gemini.js.map +1 -0
- package/dist/capabilities/index.d.ts +154 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +128 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/eval/EvalRunner.d.ts +12 -0
- package/dist/eval/EvalRunner.d.ts.map +1 -0
- package/dist/eval/EvalRunner.js +64 -0
- package/dist/eval/EvalRunner.js.map +1 -0
- package/dist/eval/scoring.d.ts +15 -0
- package/dist/eval/scoring.d.ts.map +1 -0
- package/dist/eval/scoring.js +152 -0
- package/dist/eval/scoring.js.map +1 -0
- package/dist/eval/types.d.ts +59 -0
- package/dist/eval/types.d.ts.map +1 -0
- package/dist/eval/types.js +2 -0
- package/dist/eval/types.js.map +1 -0
- package/dist/flows/FlowGraph.d.ts +3 -1
- package/dist/flows/FlowGraph.d.ts.map +1 -1
- package/dist/flows/FlowGraph.js +5 -0
- package/dist/flows/FlowGraph.js.map +1 -1
- package/dist/flows/FlowManager.d.ts +68 -1
- package/dist/flows/FlowManager.d.ts.map +1 -1
- package/dist/flows/FlowManager.js +499 -36
- package/dist/flows/FlowManager.js.map +1 -1
- package/dist/flows/extraction.d.ts +16 -1
- package/dist/flows/extraction.d.ts.map +1 -1
- package/dist/flows/extraction.js +34 -0
- package/dist/flows/extraction.js.map +1 -1
- package/dist/flows/index.d.ts +2 -0
- package/dist/flows/index.d.ts.map +1 -1
- package/dist/flows/index.js +1 -0
- package/dist/flows/index.js.map +1 -1
- package/dist/flows/validation.d.ts +1 -1
- package/dist/flows/validation.d.ts.map +1 -1
- package/dist/flows/validation.js +13 -1
- package/dist/flows/validation.js.map +1 -1
- package/dist/foundation/AgentDefinition.d.ts +18 -0
- package/dist/foundation/AgentDefinition.d.ts.map +1 -0
- package/dist/foundation/AgentDefinition.js +2 -0
- package/dist/foundation/AgentDefinition.js.map +1 -0
- package/dist/foundation/AgentStateController.d.ts +26 -0
- package/dist/foundation/AgentStateController.d.ts.map +1 -0
- package/dist/foundation/AgentStateController.js +2 -0
- package/dist/foundation/AgentStateController.js.map +1 -0
- package/dist/foundation/ConversationEventLog.d.ts +72 -0
- package/dist/foundation/ConversationEventLog.d.ts.map +1 -0
- package/dist/foundation/ConversationEventLog.js +2 -0
- package/dist/foundation/ConversationEventLog.js.map +1 -0
- package/dist/foundation/ConversationState.d.ts +31 -0
- package/dist/foundation/ConversationState.d.ts.map +1 -0
- package/dist/foundation/ConversationState.js +2 -0
- package/dist/foundation/ConversationState.js.map +1 -0
- package/dist/foundation/DefaultAgentStateController.d.ts +24 -0
- package/dist/foundation/DefaultAgentStateController.d.ts.map +1 -0
- package/dist/foundation/DefaultAgentStateController.js +49 -0
- package/dist/foundation/DefaultAgentStateController.js.map +1 -0
- package/dist/foundation/DefaultConversationEventLog.d.ts +28 -0
- package/dist/foundation/DefaultConversationEventLog.d.ts.map +1 -0
- package/dist/foundation/DefaultConversationEventLog.js +195 -0
- package/dist/foundation/DefaultConversationEventLog.js.map +1 -0
- package/dist/foundation/DefaultConversationState.d.ts +34 -0
- package/dist/foundation/DefaultConversationState.d.ts.map +1 -0
- package/dist/foundation/DefaultConversationState.js +100 -0
- package/dist/foundation/DefaultConversationState.js.map +1 -0
- package/dist/foundation/DefaultToolExecutor.d.ts +58 -0
- package/dist/foundation/DefaultToolExecutor.d.ts.map +1 -0
- package/dist/foundation/DefaultToolExecutor.js +128 -0
- package/dist/foundation/DefaultToolExecutor.js.map +1 -0
- package/dist/foundation/ToolExecutor.d.ts +44 -0
- package/dist/foundation/ToolExecutor.d.ts.map +1 -0
- package/dist/foundation/ToolExecutor.js +2 -0
- package/dist/foundation/ToolExecutor.js.map +1 -0
- package/dist/foundation/createFoundation.d.ts +33 -0
- package/dist/foundation/createFoundation.d.ts.map +1 -0
- package/dist/foundation/createFoundation.js +34 -0
- package/dist/foundation/createFoundation.js.map +1 -0
- package/dist/foundation/index.d.ts +15 -0
- package/dist/foundation/index.d.ts.map +1 -0
- package/dist/foundation/index.js +8 -0
- package/dist/foundation/index.js.map +1 -0
- package/dist/hooks/HookRunner.d.ts +5 -1
- package/dist/hooks/HookRunner.d.ts.map +1 -1
- package/dist/hooks/HookRunner.js +7 -0
- package/dist/hooks/HookRunner.js.map +1 -1
- package/dist/hooks/builtin/metrics.d.ts.map +1 -1
- package/dist/hooks/builtin/metrics.js +12 -0
- package/dist/hooks/builtin/metrics.js.map +1 -1
- package/dist/hooks/builtin/observability.d.ts +21 -0
- package/dist/hooks/builtin/observability.d.ts.map +1 -0
- package/dist/hooks/builtin/observability.js +535 -0
- package/dist/hooks/builtin/observability.js.map +1 -0
- package/dist/index.d.ts +24 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/memory/MemoryService.d.ts +40 -0
- package/dist/memory/MemoryService.d.ts.map +1 -0
- package/dist/memory/MemoryService.js +2 -0
- package/dist/memory/MemoryService.js.map +1 -0
- package/dist/memory/index.d.ts +5 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +3 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/preloadMemory.d.ts +17 -0
- package/dist/memory/preloadMemory.d.ts.map +1 -0
- package/dist/memory/preloadMemory.js +62 -0
- package/dist/memory/preloadMemory.js.map +1 -0
- package/dist/memory/stores/InMemoryMemoryService.d.ts +20 -0
- package/dist/memory/stores/InMemoryMemoryService.d.ts.map +1 -0
- package/dist/memory/stores/InMemoryMemoryService.js +92 -0
- package/dist/memory/stores/InMemoryMemoryService.js.map +1 -0
- package/dist/memory/types.d.ts +49 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js +8 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/orchestration/DefaultOrchestrationAuthority.d.ts +91 -0
- package/dist/orchestration/DefaultOrchestrationAuthority.d.ts.map +1 -0
- package/dist/orchestration/DefaultOrchestrationAuthority.js +786 -0
- package/dist/orchestration/DefaultOrchestrationAuthority.js.map +1 -0
- package/dist/orchestration/OrchestrationAuthority.d.ts +119 -0
- package/dist/orchestration/OrchestrationAuthority.d.ts.map +1 -0
- package/dist/orchestration/OrchestrationAuthority.js +2 -0
- package/dist/orchestration/OrchestrationAuthority.js.map +1 -0
- package/dist/orchestration/RealtimeExtractionRunner.d.ts +25 -0
- package/dist/orchestration/RealtimeExtractionRunner.d.ts.map +1 -0
- package/dist/orchestration/RealtimeExtractionRunner.js +62 -0
- package/dist/orchestration/RealtimeExtractionRunner.js.map +1 -0
- package/dist/orchestration/index.d.ts +5 -0
- package/dist/orchestration/index.d.ts.map +1 -0
- package/dist/orchestration/index.js +4 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/types.d.ts +134 -0
- package/dist/orchestration/types.d.ts.map +1 -0
- package/dist/orchestration/types.js +2 -0
- package/dist/orchestration/types.js.map +1 -0
- package/dist/prompts/AgentPrompt.d.ts +110 -0
- package/dist/prompts/AgentPrompt.d.ts.map +1 -0
- package/dist/prompts/AgentPrompt.js +373 -0
- package/dist/prompts/AgentPrompt.js.map +1 -0
- package/dist/prompts/PromptAssembly.d.ts +119 -0
- package/dist/prompts/PromptAssembly.d.ts.map +1 -0
- package/dist/prompts/PromptAssembly.js +150 -0
- package/dist/prompts/PromptAssembly.js.map +1 -0
- package/dist/prompts/PromptBuilder.d.ts +22 -3
- package/dist/prompts/PromptBuilder.d.ts.map +1 -1
- package/dist/prompts/PromptBuilder.js +242 -13
- package/dist/prompts/PromptBuilder.js.map +1 -1
- package/dist/prompts/PromptRenderer.d.ts +43 -0
- package/dist/prompts/PromptRenderer.d.ts.map +1 -0
- package/dist/prompts/PromptRenderer.js +114 -0
- package/dist/prompts/PromptRenderer.js.map +1 -0
- package/dist/prompts/brandVoice.d.ts +10 -0
- package/dist/prompts/brandVoice.d.ts.map +1 -0
- package/dist/prompts/brandVoice.js +87 -0
- package/dist/prompts/brandVoice.js.map +1 -0
- package/dist/prompts/index.d.ts +11 -4
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +7 -2
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/security.d.ts +5 -0
- package/dist/prompts/security.d.ts.map +1 -0
- package/dist/prompts/security.js +52 -0
- package/dist/prompts/security.js.map +1 -0
- package/dist/prompts/types.d.ts +65 -1
- package/dist/prompts/types.d.ts.map +1 -1
- package/dist/prompts/types.js +26 -0
- package/dist/prompts/types.js.map +1 -1
- package/dist/realtime/RealtimeAudioClient.d.ts +105 -0
- package/dist/realtime/RealtimeAudioClient.d.ts.map +1 -0
- package/dist/realtime/RealtimeAudioClient.js +15 -0
- package/dist/realtime/RealtimeAudioClient.js.map +1 -0
- package/dist/realtime/RealtimeRuntime.d.ts +136 -0
- package/dist/realtime/RealtimeRuntime.d.ts.map +1 -0
- package/dist/realtime/RealtimeRuntime.js +270 -0
- package/dist/realtime/RealtimeRuntime.js.map +1 -0
- package/dist/realtime/index.d.ts +4 -0
- package/dist/realtime/index.d.ts.map +1 -0
- package/dist/realtime/index.js +2 -0
- package/dist/realtime/index.js.map +1 -0
- package/dist/runtime/ContextBudget.d.ts +57 -0
- package/dist/runtime/ContextBudget.d.ts.map +1 -0
- package/dist/runtime/ContextBudget.js +103 -0
- package/dist/runtime/ContextBudget.js.map +1 -0
- package/dist/runtime/ContextManager.d.ts +8 -5
- package/dist/runtime/ContextManager.d.ts.map +1 -1
- package/dist/runtime/ContextManager.js +47 -14
- package/dist/runtime/ContextManager.js.map +1 -1
- package/dist/runtime/ExtractionEngine.d.ts +2 -1
- package/dist/runtime/ExtractionEngine.d.ts.map +1 -1
- package/dist/runtime/ExtractionEngine.js +11 -0
- package/dist/runtime/ExtractionEngine.js.map +1 -1
- package/dist/runtime/FlowExecutor.d.ts +22 -15
- package/dist/runtime/FlowExecutor.d.ts.map +1 -1
- package/dist/runtime/FlowExecutor.js +102 -149
- package/dist/runtime/FlowExecutor.js.map +1 -1
- package/dist/runtime/Runtime.d.ts +53 -78
- package/dist/runtime/Runtime.d.ts.map +1 -1
- package/dist/runtime/Runtime.js +272 -1406
- package/dist/runtime/Runtime.js.map +1 -1
- package/dist/runtime/SessionCache.d.ts +16 -0
- package/dist/runtime/SessionCache.d.ts.map +1 -0
- package/dist/runtime/SessionCache.js +49 -0
- package/dist/runtime/SessionCache.js.map +1 -0
- package/dist/runtime/SessionMutex.d.ts +37 -0
- package/dist/runtime/SessionMutex.d.ts.map +1 -0
- package/dist/runtime/SessionMutex.js +59 -0
- package/dist/runtime/SessionMutex.js.map +1 -0
- package/dist/runtime/StreamEmitter.d.ts +34 -0
- package/dist/runtime/StreamEmitter.d.ts.map +1 -0
- package/dist/runtime/StreamEmitter.js +91 -0
- package/dist/runtime/StreamEmitter.js.map +1 -0
- package/dist/runtime/handoffFilters.d.ts +60 -0
- package/dist/runtime/handoffFilters.d.ts.map +1 -0
- package/dist/runtime/handoffFilters.js +95 -0
- package/dist/runtime/handoffFilters.js.map +1 -0
- package/dist/runtime/pipeline/AgentExecuteStage.d.ts +22 -0
- package/dist/runtime/pipeline/AgentExecuteStage.d.ts.map +1 -0
- package/dist/runtime/pipeline/AgentExecuteStage.js +958 -0
- package/dist/runtime/pipeline/AgentExecuteStage.js.map +1 -0
- package/dist/runtime/pipeline/ContextAssembleStage.d.ts +26 -0
- package/dist/runtime/pipeline/ContextAssembleStage.d.ts.map +1 -0
- package/dist/runtime/pipeline/ContextAssembleStage.js +253 -0
- package/dist/runtime/pipeline/ContextAssembleStage.js.map +1 -0
- package/dist/runtime/pipeline/ContextGatherStage.d.ts +21 -0
- package/dist/runtime/pipeline/ContextGatherStage.d.ts.map +1 -0
- package/dist/runtime/pipeline/ContextGatherStage.js +161 -0
- package/dist/runtime/pipeline/ContextGatherStage.js.map +1 -0
- package/dist/runtime/pipeline/IntakeStage.d.ts +25 -0
- package/dist/runtime/pipeline/IntakeStage.d.ts.map +1 -0
- package/dist/runtime/pipeline/IntakeStage.js +126 -0
- package/dist/runtime/pipeline/IntakeStage.js.map +1 -0
- package/dist/runtime/pipeline/PostStreamStage.d.ts +26 -0
- package/dist/runtime/pipeline/PostStreamStage.d.ts.map +1 -0
- package/dist/runtime/pipeline/PostStreamStage.js +129 -0
- package/dist/runtime/pipeline/PostStreamStage.js.map +1 -0
- package/dist/runtime/pipeline/TurnPipeline.d.ts +54 -0
- package/dist/runtime/pipeline/TurnPipeline.d.ts.map +1 -0
- package/dist/runtime/pipeline/TurnPipeline.js +15 -0
- package/dist/runtime/pipeline/TurnPipeline.js.map +1 -0
- package/dist/runtime/pipeline/TurnServices.d.ts +48 -0
- package/dist/runtime/pipeline/TurnServices.d.ts.map +1 -0
- package/dist/runtime/pipeline/TurnServices.js +2 -0
- package/dist/runtime/pipeline/TurnServices.js.map +1 -0
- package/dist/runtime/pipeline/agentTypeGuards.d.ts +4 -0
- package/dist/runtime/pipeline/agentTypeGuards.d.ts.map +1 -0
- package/dist/runtime/pipeline/agentTypeGuards.js +7 -0
- package/dist/runtime/pipeline/agentTypeGuards.js.map +1 -0
- package/dist/runtime/pipeline/index.d.ts +11 -0
- package/dist/runtime/pipeline/index.d.ts.map +1 -0
- package/dist/runtime/pipeline/index.js +13 -0
- package/dist/runtime/pipeline/index.js.map +1 -0
- package/dist/runtime/pipeline/outputProcessing.d.ts +23 -0
- package/dist/runtime/pipeline/outputProcessing.d.ts.map +1 -0
- package/dist/runtime/pipeline/outputProcessing.js +63 -0
- package/dist/runtime/pipeline/outputProcessing.js.map +1 -0
- package/dist/runtime/pipeline/sessionUtils.d.ts +12 -0
- package/dist/runtime/pipeline/sessionUtils.d.ts.map +1 -0
- package/dist/runtime/pipeline/sessionUtils.js +73 -0
- package/dist/runtime/pipeline/sessionUtils.js.map +1 -0
- package/dist/tools/Tool.d.ts +7 -0
- package/dist/tools/Tool.d.ts.map +1 -1
- package/dist/tools/Tool.js +12 -3
- package/dist/tools/Tool.js.map +1 -1
- package/dist/tools/memory.d.ts +26 -0
- package/dist/tools/memory.d.ts.map +1 -0
- package/dist/tools/memory.js +51 -0
- package/dist/tools/memory.js.map +1 -0
- package/dist/types/index.d.ts +238 -9
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/telemetry.d.ts +107 -0
- package/dist/types/telemetry.d.ts.map +1 -1
- package/guides/AGENTS.md +173 -0
- package/guides/README.md +12 -0
- package/guides/TOOLS.md +93 -27
- package/package.json +25 -4
- package/dist/agents/LLMAgent.d.ts +0 -11
- package/dist/agents/LLMAgent.d.ts.map +0 -1
- package/dist/agents/LLMAgent.js +0 -31
- package/dist/agents/LLMAgent.js.map +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { normalizeModelMessage } from '../../utils/messageNormalization.js';
|
|
2
|
+
import { SessionWorkingMemory } from '../WorkingMemory.js';
|
|
3
|
+
export function getFlowState(session, agentId) {
|
|
4
|
+
const stored = session.agentStates?.[agentId]?.state;
|
|
5
|
+
if (!stored)
|
|
6
|
+
return undefined;
|
|
7
|
+
return stored;
|
|
8
|
+
}
|
|
9
|
+
export function setFlowState(session, agentId, state, conversationState) {
|
|
10
|
+
session.agentStates[agentId] = {
|
|
11
|
+
agentId,
|
|
12
|
+
state: state,
|
|
13
|
+
lastActive: new Date(),
|
|
14
|
+
};
|
|
15
|
+
updateFlowStateSnapshot(session, agentId, state);
|
|
16
|
+
conversationState.touchSession(session);
|
|
17
|
+
}
|
|
18
|
+
export function clearFlowState(session, agentId, conversationState) {
|
|
19
|
+
delete session.agentStates[agentId];
|
|
20
|
+
conversationState.touchSession(session);
|
|
21
|
+
}
|
|
22
|
+
export function updateFlowStateSnapshot(session, agentId, state) {
|
|
23
|
+
const existing = session.workingMemory.flowStateByAgent;
|
|
24
|
+
const byAgent = typeof existing === 'object' && existing !== null
|
|
25
|
+
? { ...existing }
|
|
26
|
+
: {};
|
|
27
|
+
byAgent[agentId] = {
|
|
28
|
+
currentNode: state.context.currentNode,
|
|
29
|
+
collectedData: state.context.collectedData,
|
|
30
|
+
nodeHistory: state.context.nodeHistory,
|
|
31
|
+
initialized: state.initialized,
|
|
32
|
+
flowEnded: state.flowEnded,
|
|
33
|
+
updatedAt: new Date().toISOString(),
|
|
34
|
+
};
|
|
35
|
+
session.workingMemory.flowStateByAgent = byAgent;
|
|
36
|
+
}
|
|
37
|
+
function normalizeSessionMessage(message) {
|
|
38
|
+
return normalizeModelMessage(message);
|
|
39
|
+
}
|
|
40
|
+
export function normalizeSessionHistory(messages) {
|
|
41
|
+
const normalized = [];
|
|
42
|
+
for (const message of messages) {
|
|
43
|
+
const next = normalizeSessionMessage(message);
|
|
44
|
+
if (next) {
|
|
45
|
+
normalized.push(next);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return normalized;
|
|
49
|
+
}
|
|
50
|
+
export function appendSessionMessage(session, message, conversationState) {
|
|
51
|
+
const normalized = normalizeSessionMessage(message);
|
|
52
|
+
if (!normalized)
|
|
53
|
+
return;
|
|
54
|
+
session.messages.push(normalized);
|
|
55
|
+
conversationState.touchSession(session);
|
|
56
|
+
}
|
|
57
|
+
export function appendSessionMessages(session, messages, conversationState) {
|
|
58
|
+
for (const message of messages) {
|
|
59
|
+
appendSessionMessage(session, message, conversationState);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export function buildAgentContext(input, context, conversationState, abortSignal) {
|
|
63
|
+
return {
|
|
64
|
+
session: context.session,
|
|
65
|
+
messages: context.session.messages,
|
|
66
|
+
workingMemory: new SessionWorkingMemory(context.session),
|
|
67
|
+
currentAgent: context.agentId,
|
|
68
|
+
turnCount: conversationState.getSessionTurn(context.session),
|
|
69
|
+
metadata: (context.session.metadata ?? {}),
|
|
70
|
+
abortSignal,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=sessionUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionUtils.js","sourceRoot":"","sources":["../../../src/runtime/pipeline/sessionUtils.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,UAAU,YAAY,CAAC,OAAgB,EAAE,OAAe;IAC5D,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC;IACrD,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,OAAO,MAAqC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,OAAgB,EAChB,OAAe,EACf,KAAuB,EACvB,iBAAoC;IAEpC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG;QAC7B,OAAO;QACP,KAAK,EAAE,KAA2C;QAClD,UAAU,EAAE,IAAI,IAAI,EAAE;KACvB,CAAC;IACF,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ime/Runtime.js';
|
|
2
3
|
import type { ZodTypeAny } from 'zod';
|
|
3
4
|
export type Tool<TInput = unknown, TResult = unknown> = AiTool<TInput, TResult>;
|
|
4
5
|
export type ToolSet = AiToolSet;
|
|
@@ -11,6 +12,7 @@ export interface ToolExecutionContext {
|
|
|
11
12
|
toolName?: string;
|
|
12
13
|
toolCallId?: string;
|
|
13
14
|
idempotencyKey?: string;
|
|
15
|
+
runtime?: unknown;
|
|
14
16
|
[key: string]: unknown;
|
|
15
17
|
}
|
|
16
18
|
export interface ToolExecutionOptions {
|
|
@@ -20,6 +22,11 @@ export interface ToolExecutionOptions {
|
|
|
20
22
|
experimental_context?: ToolExecutionContext;
|
|
21
23
|
[key: string]: unknown;
|
|
22
24
|
}
|
|
25
|
+
export type ToolExecutionContextWithRuntime = ToolExecutionContext & {
|
|
26
|
+
runtime: Runtime;
|
|
27
|
+
};
|
|
28
|
+
export declare function isAgentContext(value: unknown): value is ToolExecutionContextWithRuntime;
|
|
29
|
+
export declare function getRuntimeFromContext(context: ToolExecutionContext | undefined): Runtime | undefined;
|
|
23
30
|
export interface ToolDefinition<TInput = unknown, TResult = unknown> {
|
|
24
31
|
description: string;
|
|
25
32
|
inputSchema: ZodTypeAny;
|
package/dist/tools/Tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tool.d.ts","sourceRoot":"","sources":["../../src/tools/Tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,IAAI,MAAM,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEtC,MAAM,MAAM,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAChF,MAAM,MAAM,OAAO,GAAG,SAAS,CAAC;AAEhC,MAAM,WAAW,oBAAoB;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AAM,EAAE,OAAO,CAAC,GAC1C,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAIzD;AAED,wBAAgB,oBAAoB,CAAC,MAAM,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EACtE,UAAU,EAAE,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,GAC1C,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAOzD"}
|
package/dist/tools/Tool.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { tool as aiTool } from 'ai';
|
|
2
|
+
export function isAgentContext(value) {
|
|
3
|
+
return (typeof value === 'object' &&
|
|
4
|
+
value !== null &&
|
|
5
|
+
'runtime' in value);
|
|
6
|
+
}
|
|
7
|
+
export function getRuntimeFromContext(context) {
|
|
8
|
+
return context?.runtime;
|
|
9
|
+
}
|
|
2
10
|
export function createTool(definition) {
|
|
3
11
|
// NOTE: We intentionally return the tool typed as ToolDefinition for a stable,
|
|
4
12
|
// portable public API surface. Internally the returned object is a Vercel AI SDK tool.
|
|
@@ -7,10 +15,11 @@ export function createTool(definition) {
|
|
|
7
15
|
export function createToolWithFiller(definition) {
|
|
8
16
|
const t = aiTool(definition);
|
|
9
17
|
// Preserve non-standard UX hints for AriaFlow (used by Runtime tool-start filler).
|
|
18
|
+
const extended = t;
|
|
10
19
|
if (definition.filler)
|
|
11
|
-
|
|
20
|
+
extended.filler = definition.filler;
|
|
12
21
|
if (definition.estimatedDurationMs)
|
|
13
|
-
|
|
14
|
-
return
|
|
22
|
+
extended.estimatedDurationMs = definition.estimatedDurationMs;
|
|
23
|
+
return extended;
|
|
15
24
|
}
|
|
16
25
|
//# sourceMappingURL=Tool.js.map
|
package/dist/tools/Tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tool.js","sourceRoot":"","sources":["../../src/tools/Tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Tool.js","sourceRoot":"","sources":["../../src/tools/Tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,IAAI,CAAC;AA+BpC,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,SAAS,IAAI,KAAK,CACnB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAyC;IAC7E,OAAO,OAAO,EAAE,OAA8B,CAAC;AACjD,CAAC;AAmBD,MAAM,UAAU,UAAU,CACxB,UAA2C;IAE3C,+EAA+E;IAC/E,uFAAuF;IACvF,OAAO,MAAM,CAAC,UAAqD,CAAuE,CAAC;AAC7I,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,UAA2C;IAE3C,MAAM,CAAC,GAAG,MAAM,CAAC,UAAqD,CAAC,CAAC;IACxE,mFAAmF;IACnF,MAAM,QAAQ,GAAG,CAAuE,CAAC;IACzF,IAAI,UAAU,CAAC,MAAM;QAAE,QAAQ,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC3D,IAAI,UAAU,CAAC,mBAAmB;QAAE,QAAQ,CAAC,mBAAmB,GAAG,UAAU,CAAC,mBAAmB,CAAC;IAClG,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a tool that lets the agent search long-term memory.
|
|
3
|
+
* The LLM decides when to call this based on the conversation.
|
|
4
|
+
*
|
|
5
|
+
* The tool accesses memoryService and session via experimental_context
|
|
6
|
+
* injected by Runtime.wrapToolsWithEnforcement / withToolExecutionMetadata.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* const agent: AgentConfig = {
|
|
10
|
+
* tools: { ...otherTools, loadMemory: createLoadMemoryTool() },
|
|
11
|
+
* };
|
|
12
|
+
*/
|
|
13
|
+
export declare function createLoadMemoryTool(): import("ai").Tool<{
|
|
14
|
+
query: string;
|
|
15
|
+
}, {
|
|
16
|
+
memories: never[];
|
|
17
|
+
note: string;
|
|
18
|
+
} | {
|
|
19
|
+
memories: {
|
|
20
|
+
content: string;
|
|
21
|
+
author: string | undefined;
|
|
22
|
+
date: string;
|
|
23
|
+
}[];
|
|
24
|
+
note?: undefined;
|
|
25
|
+
}>;
|
|
26
|
+
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/tools/memory.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB;;;;;;;;;;;;GAuCnC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { tool } from 'ai';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a tool that lets the agent search long-term memory.
|
|
5
|
+
* The LLM decides when to call this based on the conversation.
|
|
6
|
+
*
|
|
7
|
+
* The tool accesses memoryService and session via experimental_context
|
|
8
|
+
* injected by Runtime.wrapToolsWithEnforcement / withToolExecutionMetadata.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* const agent: AgentConfig = {
|
|
12
|
+
* tools: { ...otherTools, loadMemory: createLoadMemoryTool() },
|
|
13
|
+
* };
|
|
14
|
+
*/
|
|
15
|
+
export function createLoadMemoryTool() {
|
|
16
|
+
return tool({
|
|
17
|
+
description: 'Search long-term memory for relevant information from past conversations with this user. ' +
|
|
18
|
+
'Use this when the user refers to something discussed previously, or when you need context ' +
|
|
19
|
+
'about their preferences, history, or past interactions.',
|
|
20
|
+
inputSchema: z.object({
|
|
21
|
+
query: z
|
|
22
|
+
.string()
|
|
23
|
+
.describe('What to search for in past conversations'),
|
|
24
|
+
}),
|
|
25
|
+
execute: async ({ query }, { experimental_context }) => {
|
|
26
|
+
const ctx = experimental_context;
|
|
27
|
+
const memoryService = ctx?.memoryService;
|
|
28
|
+
const session = ctx?.session;
|
|
29
|
+
const userId = session?.userId;
|
|
30
|
+
if (!memoryService) {
|
|
31
|
+
return { memories: [], note: 'Memory service not configured.' };
|
|
32
|
+
}
|
|
33
|
+
if (!userId) {
|
|
34
|
+
return { memories: [], note: 'No userId on session.' };
|
|
35
|
+
}
|
|
36
|
+
const result = await memoryService.searchMemory({
|
|
37
|
+
userId,
|
|
38
|
+
query,
|
|
39
|
+
limit: 10,
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
memories: result.memories.map((m) => ({
|
|
43
|
+
content: m.content,
|
|
44
|
+
author: m.author,
|
|
45
|
+
date: m.createdAt.toISOString(),
|
|
46
|
+
})),
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/tools/memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,IAAI,CAAC;QACV,WAAW,EACT,2FAA2F;YAC3F,4FAA4F;YAC5F,yDAAyD;QAC3D,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,KAAK,EAAE,CAAC;iBACL,MAAM,EAAE;iBACR,QAAQ,CAAC,0CAA0C,CAAC;SACxD,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,oBAAoB,EAAE,EAAE,EAAE;YACrD,MAAM,GAAG,GAAG,oBAA2D,CAAC;YACxE,MAAM,aAAa,GAAG,GAAG,EAAE,aAA8L,CAAC;YAC1N,MAAM,OAAO,GAAG,GAAG,EAAE,OAA0C,CAAC;YAChE,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;YAE/B,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnB,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,gCAAgC,EAAE,CAAC;YAClE,CAAC;YACD,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC;YACzD,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,YAAY,CAAC;gBAC9C,MAAM;gBACN,KAAK;gBACL,KAAK,EAAE,EAAE;aACV,CAAC,CAAC;YAEH,OAAO;gBACL,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBACpC,OAAO,EAAE,CAAC,CAAC,OAAO;oBAClB,MAAM,EAAE,CAAC,CAAC,MAAM;oBAChB,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE;iBAChC,CAAC,CAAC;aACJ,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import type { LanguageModel, ModelMessage, ToolSet, TelemetrySettings } from 'ai';
|
|
2
|
+
export type { ToolSet } from 'ai';
|
|
2
3
|
import type { ZodTypeAny } from 'zod';
|
|
3
4
|
import type { SessionStore } from '../session/SessionStore.js';
|
|
4
5
|
import type { ContextManager } from '../runtime/ContextManager.js';
|
|
5
|
-
import type {
|
|
6
|
+
import type { MemoryService } from '../memory/MemoryService.js';
|
|
7
|
+
import type { ContextBudgetConfig } from '../runtime/ContextBudget.js';
|
|
8
|
+
import type { AgentDefinition } from '../foundation/AgentDefinition.js';
|
|
9
|
+
import type { AgentPrompt } from '../prompts/AgentPrompt.js';
|
|
10
|
+
import type { SessionEndMetadata } from './telemetry.js';
|
|
6
11
|
export * from './telemetry.js';
|
|
12
|
+
export interface SessionCacheConfig {
|
|
13
|
+
/** Maximum number of sessions to cache. Default: 100. */
|
|
14
|
+
maxEntries?: number;
|
|
15
|
+
/** Cache entry TTL in milliseconds. Default: 30000 (30s). */
|
|
16
|
+
ttlMs?: number;
|
|
17
|
+
}
|
|
7
18
|
export type ProcessorAction = 'allow' | 'modify' | 'block';
|
|
8
19
|
export interface ProcessorContext {
|
|
9
20
|
/** Session + agent info (when available). */
|
|
@@ -60,13 +71,13 @@ export interface ExtractionSnapshot {
|
|
|
60
71
|
updatedAt: string;
|
|
61
72
|
lastInput: string;
|
|
62
73
|
}
|
|
63
|
-
export interface AgentConfig {
|
|
64
|
-
id: string;
|
|
65
|
-
name: string;
|
|
66
|
-
description?: string;
|
|
67
|
-
systemPrompt: string | PromptTemplate;
|
|
74
|
+
export interface AgentConfig extends AgentDefinition {
|
|
68
75
|
model?: LanguageModel;
|
|
69
76
|
tools?: ToolSet;
|
|
77
|
+
/**
|
|
78
|
+
* Agent prompt — a plain string or a structured AgentPrompt.
|
|
79
|
+
*/
|
|
80
|
+
prompt?: string | AgentPrompt;
|
|
70
81
|
/**
|
|
71
82
|
* Optional manual overrides for tool criticality.
|
|
72
83
|
* By default, all tools are considered critical unless specified here.
|
|
@@ -94,6 +105,8 @@ export interface AgentConfig {
|
|
|
94
105
|
promptMemoryAllowlist?: string[];
|
|
95
106
|
type?: string;
|
|
96
107
|
telemetry?: TelemetrySettings;
|
|
108
|
+
/** Optional capability descriptor for agent routing. */
|
|
109
|
+
capability?: AgentCapabilityDescriptor;
|
|
97
110
|
}
|
|
98
111
|
export interface ExtractionConfig {
|
|
99
112
|
/**
|
|
@@ -153,6 +166,8 @@ export interface FlowDetourRules {
|
|
|
153
166
|
emergencyHandoffAgent?: string;
|
|
154
167
|
allowShortAffirmations?: boolean;
|
|
155
168
|
allowDateTime?: boolean;
|
|
169
|
+
/** Regex patterns matching expected on-flow inputs (e.g., phone numbers, emails). Skips LLM routing when matched. */
|
|
170
|
+
expectedInputPatterns?: string[];
|
|
156
171
|
}
|
|
157
172
|
export interface FlowAgentConfig extends AgentConfig {
|
|
158
173
|
type: 'flow';
|
|
@@ -160,17 +175,46 @@ export interface FlowAgentConfig extends AgentConfig {
|
|
|
160
175
|
initialNode: string;
|
|
161
176
|
mode?: FlowAgentMode;
|
|
162
177
|
detourRules?: FlowDetourRules;
|
|
178
|
+
/** Optional smaller/faster model for hybrid mode flow-vs-detour routing. Falls back to agent model. */
|
|
179
|
+
routingModel?: LanguageModel;
|
|
163
180
|
}
|
|
164
181
|
export interface TriageAgentConfig extends AgentConfig {
|
|
165
182
|
type: 'triage';
|
|
166
183
|
routes: AgentRoute[];
|
|
167
184
|
defaultAgent?: string;
|
|
168
185
|
triageMode?: 'llm' | 'structured';
|
|
186
|
+
/** Optional smaller/faster model for triage routing decisions. Falls back to agent model. */
|
|
187
|
+
routingModel?: LanguageModel;
|
|
188
|
+
}
|
|
189
|
+
export interface HandoffInputData {
|
|
190
|
+
/** The full message history at the point of handoff. */
|
|
191
|
+
messages: ModelMessage[];
|
|
192
|
+
/** The workingMemory state at the point of handoff. */
|
|
193
|
+
workingMemory: Record<string, unknown>;
|
|
194
|
+
/** The agent that initiated the handoff. */
|
|
195
|
+
sourceAgentId: string;
|
|
196
|
+
/** The agent that will receive the handoff. */
|
|
197
|
+
targetAgentId: string;
|
|
198
|
+
/** The reason provided by the LLM for the handoff, if any. */
|
|
199
|
+
reason?: string;
|
|
200
|
+
}
|
|
201
|
+
export interface HandoffInputResult {
|
|
202
|
+
/** The filtered message history to pass to the target agent. */
|
|
203
|
+
messages: ModelMessage[];
|
|
204
|
+
/** The filtered workingMemory to pass to the target agent. */
|
|
205
|
+
workingMemory: Record<string, unknown>;
|
|
169
206
|
}
|
|
207
|
+
export type HandoffInputFilter = (data: HandoffInputData) => Promise<HandoffInputResult> | HandoffInputResult;
|
|
170
208
|
export interface AgentRoute {
|
|
171
209
|
agentId: string;
|
|
172
210
|
description: string;
|
|
173
211
|
condition?: RouteCondition;
|
|
212
|
+
/**
|
|
213
|
+
* Optional filter applied to the session context before the target agent
|
|
214
|
+
* receives it. Use this to remove irrelevant tool history, trim messages,
|
|
215
|
+
* or summarize the prior conversation.
|
|
216
|
+
*/
|
|
217
|
+
inputFilter?: HandoffInputFilter;
|
|
174
218
|
}
|
|
175
219
|
export type RouteCondition = (input: string, context: AgentContext) => Promise<boolean>;
|
|
176
220
|
export interface AgentContext {
|
|
@@ -210,6 +254,8 @@ export interface SessionMetadata {
|
|
|
210
254
|
totalTokens: number;
|
|
211
255
|
totalSteps: number;
|
|
212
256
|
handoffHistory: HandoffRecord[];
|
|
257
|
+
/** Whether the previous turn involved at least one tool call. */
|
|
258
|
+
lastTurnHadToolCalls?: boolean;
|
|
213
259
|
}
|
|
214
260
|
export interface AgentState {
|
|
215
261
|
agentId: string;
|
|
@@ -292,7 +338,7 @@ export type AgentStreamPart = {
|
|
|
292
338
|
error: string;
|
|
293
339
|
};
|
|
294
340
|
export interface FlowConfig {
|
|
295
|
-
nodes: FlowNodeConfig[];
|
|
341
|
+
nodes: (FlowNodeConfig | ExtractionNodeConfig)[];
|
|
296
342
|
transitions?: FlowTransitionConfig[];
|
|
297
343
|
defaultRolePrompt?: string;
|
|
298
344
|
contextStrategy?: ContextStrategy;
|
|
@@ -304,8 +350,19 @@ export interface FlowConfig {
|
|
|
304
350
|
summaryTimeoutMs?: number;
|
|
305
351
|
/** Default maxSteps for tool loop / function calling in a node. */
|
|
306
352
|
maxSteps?: number;
|
|
353
|
+
/**
|
|
354
|
+
* Max times the same from->to transition edge can fire within a single user turn
|
|
355
|
+
* before being blocked as oscillation. Prevents infinite ping-pong loops
|
|
356
|
+
* (e.g., triage->services->triage->services).
|
|
357
|
+
*
|
|
358
|
+
* When the limit is hit, the transition is blocked and the flow stays on the
|
|
359
|
+
* current node, allowing the LLM to respond directly instead of routing.
|
|
360
|
+
*
|
|
361
|
+
* Default: 2.
|
|
362
|
+
*/
|
|
363
|
+
maxOscillations?: number;
|
|
307
364
|
}
|
|
308
|
-
export type FlowNodeType = 'start' | 'agent' | 'end' | 'global';
|
|
365
|
+
export type FlowNodeType = 'start' | 'agent' | 'end' | 'global' | 'extraction';
|
|
309
366
|
export interface FlowNodeConfig {
|
|
310
367
|
id: string;
|
|
311
368
|
name?: string;
|
|
@@ -351,7 +408,46 @@ export interface FlowNodeConfig {
|
|
|
351
408
|
* Overrides agent-level extraction while this node is active.
|
|
352
409
|
*/
|
|
353
410
|
extraction?: ExtractionConfig;
|
|
354
|
-
|
|
411
|
+
/** Only include these keys from collectedData in the system prompt. Omit to include all (default). */
|
|
412
|
+
relevantFields?: string[];
|
|
413
|
+
/**
|
|
414
|
+
* Per-tool voice hints for realtime sessions.
|
|
415
|
+
* Appended to tool descriptions to guide the model on when/how to call each tool.
|
|
416
|
+
* Only used by FlowCapability for realtime prompt assembly — no effect on text mode.
|
|
417
|
+
*/
|
|
418
|
+
toolHints?: Record<string, {
|
|
419
|
+
/** When to call this tool (e.g., "Call when the customer asks about products or prices.") */
|
|
420
|
+
invocationCondition?: string;
|
|
421
|
+
/** What to do after receiving the tool result (e.g., "Summarize matching products briefly.") */
|
|
422
|
+
afterResult?: string;
|
|
423
|
+
}>;
|
|
424
|
+
/** Optional Zod schema validating collectedData on node entry. Blocks transition if validation fails. */
|
|
425
|
+
inputSchema?: ZodTypeAny;
|
|
426
|
+
/** Optional Zod schema validating collectedData on node exit. Blocks transition if validation fails. */
|
|
427
|
+
outputSchema?: ZodTypeAny;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* ExtractionNode: a first-class loop primitive that collects structured data
|
|
431
|
+
* across multiple turns until a Zod schema is fully satisfied.
|
|
432
|
+
* The schema IS the node definition -- no manual tool wiring needed.
|
|
433
|
+
*/
|
|
434
|
+
export interface ExtractionNodeConfig extends FlowNodeConfig {
|
|
435
|
+
nodeType: 'extraction';
|
|
436
|
+
/** Zod schema defining the data to collect. The node loops until safeParse() succeeds. */
|
|
437
|
+
extractionSchema: ZodTypeAny;
|
|
438
|
+
/** Subset of schema fields that must be present for completion. Defaults to all top-level keys. */
|
|
439
|
+
extractionRequiredFields?: string[];
|
|
440
|
+
/** Max turns before auto-transitioning with partial data. Default: 10. */
|
|
441
|
+
extractionMaxTurns?: number;
|
|
442
|
+
/** Node ID to auto-transition to when extraction is complete. */
|
|
443
|
+
extractionCompleteTransition?: string;
|
|
444
|
+
/** How to generate follow-up prompts. 'template' = zero LLM cost, 'llm' = natural language. Default: 'llm'. */
|
|
445
|
+
extractionPromptMode?: 'llm' | 'template';
|
|
446
|
+
/** Per-field prompt templates for template mode. Key = field name, value = prompt text. */
|
|
447
|
+
extractionFieldPrompts?: Record<string, string>;
|
|
448
|
+
}
|
|
449
|
+
/** Type guard for extraction nodes. */
|
|
450
|
+
export declare function isExtractionNode(node: FlowNodeConfig): node is ExtractionNodeConfig;
|
|
355
451
|
export interface FlowTransitionConfig {
|
|
356
452
|
from: string;
|
|
357
453
|
to: string;
|
|
@@ -459,6 +555,69 @@ export interface HarnessHooks {
|
|
|
459
555
|
*
|
|
460
556
|
*/
|
|
461
557
|
onStreamPart?: (context: RunContext, part: HarnessStreamPart) => Promise<void>;
|
|
558
|
+
/**
|
|
559
|
+
* Called when deferred persistence fails after all retry attempts.
|
|
560
|
+
*
|
|
561
|
+
* This hook is the safety net for `deferPersistence: true`. When the session
|
|
562
|
+
* store is unreachable (database down, network timeout), the session snapshot
|
|
563
|
+
* is passed to this hook so the caller can implement recovery (e.g., write to
|
|
564
|
+
* a dead-letter queue, log to a file, retry with a different store, alert ops).
|
|
565
|
+
*
|
|
566
|
+
* If this hook is not set, the error is logged to console.error and discarded.
|
|
567
|
+
*
|
|
568
|
+
* @param session - The session snapshot that failed to persist.
|
|
569
|
+
* @param error - The final error after all retries were exhausted.
|
|
570
|
+
*/
|
|
571
|
+
onPersistenceError?: (session: Session, error: Error) => Promise<void>;
|
|
572
|
+
/**
|
|
573
|
+
* Called before a session is ingested into long-term memory.
|
|
574
|
+
* Return false to skip ingestion for this session.
|
|
575
|
+
*/
|
|
576
|
+
onMemoryIngest?: (context: RunContext, session: Session) => Promise<boolean | void>;
|
|
577
|
+
/**
|
|
578
|
+
* Called after memory ingestion completes.
|
|
579
|
+
*/
|
|
580
|
+
onMemoryIngested?: (context: RunContext, session: Session) => Promise<void>;
|
|
581
|
+
/**
|
|
582
|
+
* Called after the system prompt is fully assembled and messages are
|
|
583
|
+
* pruned, but before the LLM call is dispatched. The hook can inspect
|
|
584
|
+
* the complete request payload and optionally modify it.
|
|
585
|
+
*
|
|
586
|
+
* Return an object with systemPrompt and/or messages to override them.
|
|
587
|
+
* Return void or undefined to use the originals unchanged.
|
|
588
|
+
*/
|
|
589
|
+
onBeforeModelCall?: (context: RunContext, data: BeforeModelCallData) => Promise<BeforeModelCallResult | void>;
|
|
590
|
+
/**
|
|
591
|
+
* Fires once after a session ends and has been persisted (e.g. OrchestrationAuthority.closeSession).
|
|
592
|
+
* Not invoked per chat turn for text Runtime — only when the session handle is closed.
|
|
593
|
+
*/
|
|
594
|
+
onSessionEnd?: (session: Session, metadata: SessionEndMetadata) => Promise<void>;
|
|
595
|
+
}
|
|
596
|
+
export interface BeforeModelCallData {
|
|
597
|
+
/** The fully assembled system prompt string. */
|
|
598
|
+
systemPrompt: string;
|
|
599
|
+
/** The post-ContextManager pruned message history. */
|
|
600
|
+
messages: ModelMessage[];
|
|
601
|
+
/** Estimated total token count of systemPrompt + messages. */
|
|
602
|
+
estimatedTokens: number;
|
|
603
|
+
/** The agent that will receive this LLM call. */
|
|
604
|
+
agentId: string;
|
|
605
|
+
/** Breakdown of token usage by section. */
|
|
606
|
+
tokenBreakdown: {
|
|
607
|
+
basePrompt: number;
|
|
608
|
+
autoRetrieve: number;
|
|
609
|
+
workingMemory: number;
|
|
610
|
+
extraction: number;
|
|
611
|
+
longTermMemory: number;
|
|
612
|
+
policyInjections: number;
|
|
613
|
+
messageHistory: number;
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
export interface BeforeModelCallResult {
|
|
617
|
+
/** Modified system prompt. If omitted, the original is used. */
|
|
618
|
+
systemPrompt?: string;
|
|
619
|
+
/** Modified message history. If omitted, the original is used. */
|
|
620
|
+
messages?: ModelMessage[];
|
|
462
621
|
}
|
|
463
622
|
export type InjectionPriority = 'critical' | 'high' | 'medium' | 'low';
|
|
464
623
|
export type InjectionLevel = 'system' | 'message' | 'tool';
|
|
@@ -565,6 +724,12 @@ export interface HarnessConfig {
|
|
|
565
724
|
agents: AgentConfig[];
|
|
566
725
|
defaultAgentId: string;
|
|
567
726
|
defaultModel?: LanguageModel;
|
|
727
|
+
/**
|
|
728
|
+
* Optional dedicated text model used to verify realtime extraction-node data.
|
|
729
|
+
* When omitted, realtime falls back to a conservative guard instead of full
|
|
730
|
+
* extraction-model parity.
|
|
731
|
+
*/
|
|
732
|
+
extractionModel?: LanguageModel;
|
|
568
733
|
maxSteps?: number;
|
|
569
734
|
maxHandoffs?: number;
|
|
570
735
|
/**
|
|
@@ -629,12 +794,69 @@ export interface HarnessConfig {
|
|
|
629
794
|
/** Number of suggestions to generate. Default is 3. */
|
|
630
795
|
suggestionCount?: number;
|
|
631
796
|
telemetry?: TelemetrySettings;
|
|
797
|
+
/**
|
|
798
|
+
* Enable layered prompting with PromptBuilder.
|
|
799
|
+
* When true, system prompts are built using PromptBuilder with automatic layers:
|
|
800
|
+
* - Security Core (immutable)
|
|
801
|
+
* - Identity & Role (from agent)
|
|
802
|
+
* - Tools (auto from agent)
|
|
803
|
+
* - Session Memory (auto)
|
|
804
|
+
* - Security Reminder (immutable)
|
|
805
|
+
* Default: false (backward compatible)
|
|
806
|
+
*/
|
|
807
|
+
layeredPrompting?: boolean;
|
|
808
|
+
/**
|
|
809
|
+
* Optional memory service for cross-session long-term memory.
|
|
810
|
+
* When provided, enables memory tools and session-end ingestion.
|
|
811
|
+
* Requires userId to be passed via stream() for memory to function.
|
|
812
|
+
*/
|
|
813
|
+
memoryService?: MemoryService;
|
|
814
|
+
/**
|
|
815
|
+
* Controls automatic memory ingestion behavior.
|
|
816
|
+
* Only applies when memoryService is configured.
|
|
817
|
+
* - 'onEnd': Ingest session into memory when stream() completes (default)
|
|
818
|
+
* - 'manual': Developer must call memoryService.addSessionToMemory() explicitly
|
|
819
|
+
* - 'hook': Fires onMemoryIngest hook, letting the developer decide
|
|
820
|
+
*/
|
|
821
|
+
memoryIngestion?: 'onEnd' | 'manual' | 'hook';
|
|
822
|
+
/**
|
|
823
|
+
* Whether to automatically preload relevant memories into system prompt.
|
|
824
|
+
* Default: true (when memoryService is provided)
|
|
825
|
+
*/
|
|
826
|
+
preloadMemory?: boolean;
|
|
827
|
+
/**
|
|
828
|
+
* Context budget configuration. Controls how the finite LLM context window
|
|
829
|
+
* is allocated across the multiple content sources that compose the system
|
|
830
|
+
* prompt and message history.
|
|
831
|
+
*/
|
|
832
|
+
contextBudget?: Partial<ContextBudgetConfig>;
|
|
833
|
+
/**
|
|
834
|
+
* Optional LRU session cache. Reduces repeated SessionStore lookups
|
|
835
|
+
* for same-process reads (~10-90ms per warm turn).
|
|
836
|
+
* When provided, sessions are cached in-memory and invalidated by TTL.
|
|
837
|
+
*/
|
|
838
|
+
sessionCache?: SessionCacheConfig;
|
|
839
|
+
/**
|
|
840
|
+
* When true, the 'done' event is emitted before session persistence completes.
|
|
841
|
+
* Persistence runs in the background on a cloned session snapshot with retry
|
|
842
|
+
* (3 attempts, exponential backoff). On final failure, the onPersistenceError
|
|
843
|
+
* hook is called if configured.
|
|
844
|
+
*
|
|
845
|
+
* When false, the 'done' event is blocked until persistence completes. This
|
|
846
|
+
* adds 10-200ms latency per turn but guarantees the session is saved before
|
|
847
|
+
* the client receives the done signal.
|
|
848
|
+
*
|
|
849
|
+
* Default: true.
|
|
850
|
+
*/
|
|
851
|
+
deferPersistence?: boolean;
|
|
632
852
|
}
|
|
633
853
|
export interface StreamOptions {
|
|
634
854
|
input: string;
|
|
635
855
|
sessionId?: string;
|
|
636
856
|
userId?: string;
|
|
637
857
|
abortSignal?: AbortSignal;
|
|
858
|
+
/** Force a specific agent ID, bypassing triage routing */
|
|
859
|
+
agentId?: string;
|
|
638
860
|
}
|
|
639
861
|
export interface AbortOptions {
|
|
640
862
|
reason?: string;
|
|
@@ -649,6 +871,12 @@ export interface InterruptionEvent {
|
|
|
649
871
|
lastStep?: number;
|
|
650
872
|
}
|
|
651
873
|
export type CancellationReason = 'user_interrupt' | 'timeout' | 'shutdown' | 'custom';
|
|
874
|
+
export interface AgentCapabilityDescriptor {
|
|
875
|
+
summary: string;
|
|
876
|
+
keywords: string[];
|
|
877
|
+
handlesIntents?: string[];
|
|
878
|
+
doesNotHandle?: string[];
|
|
879
|
+
}
|
|
652
880
|
export declare function isAbortSignal(signal: unknown): signal is AbortSignal;
|
|
653
881
|
export type HarnessStreamPart = {
|
|
654
882
|
type: 'input';
|
|
@@ -752,5 +980,6 @@ export type HarnessStreamPart = {
|
|
|
752
980
|
} | {
|
|
753
981
|
type: 'done';
|
|
754
982
|
sessionId: string;
|
|
983
|
+
userId?: string;
|
|
755
984
|
};
|
|
756
985
|
//# sourceMappingURL=index.d.ts.map
|