@kuralle-agents/core 0.6.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -4
- package/dist/capabilities/index.d.ts +0 -3
- package/dist/capabilities/index.js +0 -2
- package/dist/flow/classifyControl.js +4 -0
- package/dist/flow/collectDigression.js +0 -1
- package/dist/flow/controlEvaluator.js +3 -0
- package/dist/flow/flowControlTools.js +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/runtime/Runtime.d.ts +3 -1
- package/dist/runtime/Runtime.js +29 -57
- package/dist/runtime/agentReply.d.ts +2 -1
- package/dist/runtime/agentReply.js +14 -3
- package/dist/runtime/buildAgentToolSurface.d.ts +20 -0
- package/dist/runtime/buildAgentToolSurface.js +56 -0
- package/dist/runtime/channels/TextDriver.d.ts +1 -0
- package/dist/runtime/channels/TextDriver.js +36 -19
- package/dist/runtime/channels/VoiceDriver.d.ts +1 -0
- package/dist/runtime/channels/VoiceDriver.js +10 -2
- package/dist/runtime/channels/streaming/hostControlSpeak.d.ts +30 -0
- package/dist/runtime/channels/streaming/hostControlSpeak.js +80 -0
- package/dist/runtime/deriveAgent.d.ts +10 -1
- package/dist/runtime/deriveAgent.js +63 -13
- package/dist/runtime/dispatchMode.d.ts +5 -0
- package/dist/runtime/dispatchMode.js +18 -0
- package/dist/runtime/grounding/index.d.ts +1 -1
- package/dist/runtime/grounding/index.js +1 -1
- package/dist/runtime/grounding/knowledge.d.ts +2 -0
- package/dist/runtime/grounding/knowledge.js +37 -0
- package/dist/runtime/hostClassifyAdapter.d.ts +2 -0
- package/dist/runtime/hostClassifyAdapter.js +21 -0
- package/dist/runtime/hostControlGuard.d.ts +23 -0
- package/dist/runtime/hostControlGuard.js +67 -0
- package/dist/runtime/hostControlTools.d.ts +12 -0
- package/dist/runtime/hostControlTools.js +89 -0
- package/dist/runtime/hostLoop.d.ts +4 -1
- package/dist/runtime/hostLoop.js +122 -34
- package/dist/runtime/select.d.ts +17 -4
- package/dist/runtime/select.js +107 -76
- package/dist/tools/enterFlow.d.ts +14 -0
- package/dist/tools/enterFlow.js +31 -0
- package/dist/types/channel.d.ts +12 -0
- package/dist/types/grounding.d.ts +9 -0
- package/dist/types/route.d.ts +3 -3
- package/guides/AGENTS.md +7 -10
- package/guides/FLOWS.md +0 -4
- package/guides/RUNTIME.md +2 -2
- package/package.json +2 -2
- package/dist/capabilities/HandoffCapability.d.ts +0 -18
- package/dist/capabilities/HandoffCapability.js +0 -69
- package/dist/capabilities/TriageCapability.d.ts +0 -15
- package/dist/capabilities/TriageCapability.js +0 -60
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { isHandoffResult } from '../tools/handoff.js';
|
|
3
|
-
// ─── TriageCapability ────────────────────────────────────────────────────────
|
|
4
|
-
/**
|
|
5
|
-
* Exposes triage routing as tools: one `route_to_<agentId>` tool per route.
|
|
6
|
-
* The LLM selects the appropriate route; processToolResult converts the
|
|
7
|
-
* tool result to a `handoff` action for the host.
|
|
8
|
-
*/
|
|
9
|
-
export class TriageCapability {
|
|
10
|
-
routes;
|
|
11
|
-
defaultAgent;
|
|
12
|
-
constructor(routes, defaultAgent) {
|
|
13
|
-
this.routes = routes;
|
|
14
|
-
this.defaultAgent = defaultAgent;
|
|
15
|
-
}
|
|
16
|
-
getTools() {
|
|
17
|
-
return this.routes.map(route => ({
|
|
18
|
-
name: `route_to_${route.agentId}`,
|
|
19
|
-
description: route.description,
|
|
20
|
-
parameters: z.object({
|
|
21
|
-
reason: z.string().describe('Why this route was chosen — include relevant context from the conversation'),
|
|
22
|
-
}),
|
|
23
|
-
execute: async (args) => ({
|
|
24
|
-
__handoff: true,
|
|
25
|
-
targetAgentId: route.agentId,
|
|
26
|
-
targetAgent: route.agentId,
|
|
27
|
-
reason: args.reason,
|
|
28
|
-
}),
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
getPromptSections() {
|
|
32
|
-
if (this.routes.length === 0)
|
|
33
|
-
return [];
|
|
34
|
-
const routeList = this.routes
|
|
35
|
-
.map(r => `- route_to_${r.agentId}: ${r.description}`)
|
|
36
|
-
.join('\n');
|
|
37
|
-
const defaultNote = this.defaultAgent
|
|
38
|
-
? `\nIf no route clearly matches, route to ${this.defaultAgent}.`
|
|
39
|
-
: '';
|
|
40
|
-
return [
|
|
41
|
-
{
|
|
42
|
-
role: 'routing',
|
|
43
|
-
content: `Route the user to the most appropriate agent using the routing tools below.\n` +
|
|
44
|
-
`Do NOT mention routing or agent transfers to the user.\n\n` +
|
|
45
|
-
`Available routes:\n${routeList}${defaultNote}`,
|
|
46
|
-
},
|
|
47
|
-
];
|
|
48
|
-
}
|
|
49
|
-
processToolResult(toolName, args, result) {
|
|
50
|
-
if (!toolName.startsWith('route_to_'))
|
|
51
|
-
return null;
|
|
52
|
-
if (!isHandoffResult(result))
|
|
53
|
-
return null;
|
|
54
|
-
return {
|
|
55
|
-
type: 'handoff',
|
|
56
|
-
targetAgent: result.targetAgentId,
|
|
57
|
-
reason: result.reason,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|