@strands-agents/sdk 1.11.1 → 1.12.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 +0 -1
- package/dist/src/agent/agent-as-tool.d.ts +22 -0
- package/dist/src/agent/agent-as-tool.d.ts.map +1 -1
- package/dist/src/agent/agent-as-tool.js +16 -0
- package/dist/src/agent/agent-as-tool.js.map +1 -1
- package/dist/src/agent/agent-delegation.d.ts +85 -0
- package/dist/src/agent/agent-delegation.d.ts.map +1 -0
- package/dist/src/agent/agent-delegation.js +290 -0
- package/dist/src/agent/agent-delegation.js.map +1 -0
- package/dist/src/agent/agent.d.ts +20 -4
- package/dist/src/agent/agent.d.ts.map +1 -1
- package/dist/src/agent/agent.js +32 -6
- package/dist/src/agent/agent.js.map +1 -1
- package/dist/src/context-manager/modes/agentic/agentic-context.d.ts +5 -0
- package/dist/src/context-manager/modes/agentic/agentic-context.d.ts.map +1 -1
- package/dist/src/context-manager/modes/agentic/agentic-context.js +6 -1
- package/dist/src/context-manager/modes/agentic/agentic-context.js.map +1 -1
- package/dist/src/conversation-manager/conversation-manager.d.ts +0 -2
- package/dist/src/conversation-manager/conversation-manager.d.ts.map +1 -1
- package/dist/src/conversation-manager/conversation-manager.js +2 -10
- package/dist/src/conversation-manager/conversation-manager.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/client.d.ts +35 -1
- package/dist/src/mcp/client.d.ts.map +1 -1
- package/dist/src/mcp/client.js +64 -11
- package/dist/src/mcp/client.js.map +1 -1
- package/dist/src/mcp/config.d.ts +15 -0
- package/dist/src/mcp/config.d.ts.map +1 -1
- package/dist/src/mcp/config.js.map +1 -1
- package/dist/src/mcp/config.node.d.ts.map +1 -1
- package/dist/src/mcp/config.node.js +24 -0
- package/dist/src/mcp/config.node.js.map +1 -1
- package/dist/src/mcp/index.d.ts +2 -2
- package/dist/src/mcp/index.d.ts.map +1 -1
- package/dist/src/mcp/index.js.map +1 -1
- package/dist/src/middleware/interrupt.d.ts +4 -1
- package/dist/src/middleware/interrupt.d.ts.map +1 -1
- package/dist/src/middleware/interrupt.js +4 -2
- package/dist/src/middleware/interrupt.js.map +1 -1
- package/dist/src/models/defaults.d.ts +2 -0
- package/dist/src/models/defaults.d.ts.map +1 -1
- package/dist/src/models/defaults.js +16 -0
- package/dist/src/models/defaults.js.map +1 -1
- package/dist/src/models/model.d.ts +10 -0
- package/dist/src/models/model.d.ts.map +1 -1
- package/dist/src/models/model.js +19 -1
- package/dist/src/models/model.js.map +1 -1
- package/dist/src/models/openai/mantle.d.ts +10 -8
- package/dist/src/models/openai/mantle.d.ts.map +1 -1
- package/dist/src/models/openai/mantle.js +22 -17
- package/dist/src/models/openai/mantle.js.map +1 -1
- package/dist/src/multiagent/swarm.d.ts +18 -0
- package/dist/src/multiagent/swarm.d.ts.map +1 -1
- package/dist/src/multiagent/swarm.js +57 -1
- package/dist/src/multiagent/swarm.js.map +1 -1
- package/dist/src/sandbox/docker.js +4 -4
- package/dist/src/sandbox/docker.js.map +1 -1
- package/dist/src/sandbox/ssh.js +4 -4
- package/dist/src/sandbox/ssh.js.map +1 -1
- package/dist/src/session/file-storage.d.ts +1 -1
- package/dist/src/session/file-storage.d.ts.map +1 -1
- package/dist/src/session/file-storage.js +3 -2
- package/dist/src/session/file-storage.js.map +1 -1
- package/dist/src/session/s3-storage.d.ts.map +1 -1
- package/dist/src/session/s3-storage.js +2 -1
- package/dist/src/session/s3-storage.js.map +1 -1
- package/dist/src/session/session-manager.d.ts +6 -2
- package/dist/src/session/session-manager.d.ts.map +1 -1
- package/dist/src/session/session-manager.js +17 -1
- package/dist/src/session/session-manager.js.map +1 -1
- package/dist/src/session/validation.d.ts +10 -0
- package/dist/src/session/validation.d.ts.map +1 -1
- package/dist/src/session/validation.js +14 -0
- package/dist/src/session/validation.js.map +1 -1
- package/dist/src/storage/in-memory-storage.d.ts +4 -3
- package/dist/src/storage/in-memory-storage.d.ts.map +1 -1
- package/dist/src/storage/in-memory-storage.js +4 -3
- package/dist/src/storage/in-memory-storage.js.map +1 -1
- package/dist/src/storage/local-file-storage.d.ts +1 -1
- package/dist/src/storage/local-file-storage.js +1 -1
- package/dist/src/storage/s3-storage.d.ts +1 -1
- package/dist/src/storage/s3-storage.js +1 -1
- package/dist/src/storage/storage.d.ts +21 -8
- package/dist/src/storage/storage.d.ts.map +1 -1
- package/dist/src/storage/storage.js +16 -5
- package/dist/src/storage/storage.js.map +1 -1
- package/dist/src/telemetry/tracer.d.ts.map +1 -1
- package/dist/src/telemetry/tracer.js +11 -0
- package/dist/src/telemetry/tracer.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/types/agent.d.ts +9 -0
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/agent.js.map +1 -1
- package/dist/src/vended-interventions/hitl/classifier.d.ts +33 -0
- package/dist/src/vended-interventions/hitl/classifier.d.ts.map +1 -0
- package/dist/src/vended-interventions/hitl/classifier.js +63 -0
- package/dist/src/vended-interventions/hitl/classifier.js.map +1 -0
- package/dist/src/vended-interventions/hitl/hitl.d.ts +32 -4
- package/dist/src/vended-interventions/hitl/hitl.d.ts.map +1 -1
- package/dist/src/vended-interventions/hitl/hitl.js +62 -12
- package/dist/src/vended-interventions/hitl/hitl.js.map +1 -1
- package/dist/src/vended-interventions/hitl/index.d.ts +1 -0
- package/dist/src/vended-interventions/hitl/index.d.ts.map +1 -1
- package/dist/src/vended-memory-stores/test-memory-store/store.d.ts +4 -2
- package/dist/src/vended-memory-stores/test-memory-store/store.d.ts.map +1 -1
- package/dist/src/vended-memory-stores/test-memory-store/store.js +4 -2
- package/dist/src/vended-memory-stores/test-memory-store/store.js.map +1 -1
- package/dist/src/vended-plugins/context-offloader/plugin.d.ts +7 -3
- package/dist/src/vended-plugins/context-offloader/plugin.d.ts.map +1 -1
- package/dist/src/vended-plugins/context-offloader/plugin.js +27 -11
- package/dist/src/vended-plugins/context-offloader/plugin.js.map +1 -1
- package/dist/src/vended-tools/bash/index.d.ts +8 -4
- package/dist/src/vended-tools/bash/index.d.ts.map +1 -1
- package/dist/src/vended-tools/bash/index.js +7 -3
- package/dist/src/vended-tools/bash/index.js.map +1 -1
- package/dist/src/vended-tools/bash/make-shell.d.ts +36 -0
- package/dist/src/vended-tools/bash/make-shell.d.ts.map +1 -0
- package/dist/src/vended-tools/bash/make-shell.js +51 -0
- package/dist/src/vended-tools/bash/make-shell.js.map +1 -0
- package/dist/src/vended-tools/bash/types.d.ts +23 -1
- package/dist/src/vended-tools/bash/types.d.ts.map +1 -1
- package/dist/src/vended-tools/bash/types.js +30 -2
- package/dist/src/vended-tools/bash/types.js.map +1 -1
- package/package.json +2 -2
- package/dist/src/vended-tools/bash/make-bash.d.ts +0 -22
- package/dist/src/vended-tools/bash/make-bash.d.ts.map +0 -1
- package/dist/src/vended-tools/bash/make-bash.js +0 -40
- package/dist/src/vended-tools/bash/make-bash.js.map +0 -1
package/README.md
CHANGED
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
◆ <a href="https://github.com/strands-agents/samples">Samples</a>
|
|
28
28
|
◆ <a href="https://github.com/strands-agents/harness-sdk/tree/main/strands-py">Python SDK</a>
|
|
29
29
|
◆ <a href="https://github.com/strands-agents/tools">Tools</a>
|
|
30
|
-
◆ <a href="https://github.com/strands-agents/agent-builder">Agent Builder</a>
|
|
31
30
|
◆ <a href="https://github.com/strands-agents/harness-sdk/tree/main/strands-mcp">MCP Server</a>
|
|
32
31
|
</p>
|
|
33
32
|
</div>
|
|
@@ -9,6 +9,11 @@ import type { Agent } from './agent.js';
|
|
|
9
9
|
import { Tool } from '../tools/tool.js';
|
|
10
10
|
import type { ToolContext, ToolStreamGenerator } from '../tools/tool.js';
|
|
11
11
|
import type { ToolSpec } from '../tools/types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Description suffix appended to delegation tools to guide the model.
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare const DELEGATION_DESCRIPTION_SUFFIX = " Calling this tool will return its response directly to the user as the final answer. It should be the only tool called in the turn.";
|
|
12
17
|
/**
|
|
13
18
|
* Options for creating an agent tool via {@link Agent.asTool}.
|
|
14
19
|
*/
|
|
@@ -42,6 +47,16 @@ export interface AgentAsToolOptions {
|
|
|
42
47
|
* @defaultValue false
|
|
43
48
|
*/
|
|
44
49
|
preserveContext?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* When true, the orchestrator treats this tool's result as the final
|
|
52
|
+
* response and exits without an additional model call.
|
|
53
|
+
*
|
|
54
|
+
* A delegation tool's description is automatically suffixed with an instruction
|
|
55
|
+
* telling the model that this tool should be the only tool called in the turn.
|
|
56
|
+
*
|
|
57
|
+
* @defaultValue false
|
|
58
|
+
*/
|
|
59
|
+
delegate?: boolean;
|
|
45
60
|
}
|
|
46
61
|
/**
|
|
47
62
|
* Configuration for creating an AgentAsTool.
|
|
@@ -81,6 +96,13 @@ export declare class AgentAsTool extends Tool {
|
|
|
81
96
|
readonly name: string;
|
|
82
97
|
readonly description: string;
|
|
83
98
|
readonly toolSpec: ToolSpec;
|
|
99
|
+
/**
|
|
100
|
+
* When true, the orchestrator treats this tool's result as the final
|
|
101
|
+
* response and exits without an additional model call.
|
|
102
|
+
*
|
|
103
|
+
* @defaultValue false
|
|
104
|
+
*/
|
|
105
|
+
readonly delegate: boolean;
|
|
84
106
|
private readonly _agent;
|
|
85
107
|
private readonly _preserveContext;
|
|
86
108
|
private readonly _initialSnapshot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-as-tool.d.ts","sourceRoot":"","sources":["../../../src/agent/agent-as-tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAIvC,OAAO,EAAqB,IAAI,EAAmB,MAAM,kBAAkB,CAAA;AAC3E,OAAO,KAAK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;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAE3B;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAE1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAO;IAC9B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAsB;IACvD,OAAO,CAAC,KAAK,CAAQ;gBAET,MAAM,EAAE,eAAe;IA6CnC;;OAEG;IACH,IAAI,KAAK,IAAI,KAAK,CAEjB;IAEM,MAAM,CAAC,WAAW,EAAE,WAAW,GAAG,mBAAmB;CAuD7D"}
|
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { JsonBlock, TextBlock, ToolResultBlock } from '../types/messages.js';
|
|
9
9
|
import { createErrorResult, Tool, ToolStreamEvent } from '../tools/tool.js';
|
|
10
|
+
/**
|
|
11
|
+
* Description suffix appended to delegation tools to guide the model.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export const DELEGATION_DESCRIPTION_SUFFIX = ' Calling this tool will return its response directly to the user as the final answer. It should be the only tool called in the turn.';
|
|
10
15
|
/**
|
|
11
16
|
* @internal Not for external use. Use {@link Agent.asTool} to create instances.
|
|
12
17
|
*
|
|
@@ -39,6 +44,13 @@ export class AgentAsTool extends Tool {
|
|
|
39
44
|
name;
|
|
40
45
|
description;
|
|
41
46
|
toolSpec;
|
|
47
|
+
/**
|
|
48
|
+
* When true, the orchestrator treats this tool's result as the final
|
|
49
|
+
* response and exits without an additional model call.
|
|
50
|
+
*
|
|
51
|
+
* @defaultValue false
|
|
52
|
+
*/
|
|
53
|
+
delegate;
|
|
42
54
|
_agent;
|
|
43
55
|
_preserveContext;
|
|
44
56
|
_initialSnapshot;
|
|
@@ -47,6 +59,7 @@ export class AgentAsTool extends Tool {
|
|
|
47
59
|
super();
|
|
48
60
|
this._agent = config.agent;
|
|
49
61
|
this._preserveContext = config.preserveContext ?? false;
|
|
62
|
+
this.delegate = config.delegate ?? false;
|
|
50
63
|
if (!this._preserveContext && this._agent.sessionManager != null) {
|
|
51
64
|
throw new Error(`Agent '${this._agent.name}' has a SessionManager, which conflicts with preserveContext=false. ` +
|
|
52
65
|
'The SessionManager persists conversation history externally, but preserveContext=false resets ' +
|
|
@@ -60,6 +73,9 @@ export class AgentAsTool extends Tool {
|
|
|
60
73
|
config.description ??
|
|
61
74
|
config.agent.description ??
|
|
62
75
|
`Use the ${this.name} agent by providing a natural language input`;
|
|
76
|
+
if (this.delegate) {
|
|
77
|
+
this.description += DELEGATION_DESCRIPTION_SUFFIX;
|
|
78
|
+
}
|
|
63
79
|
this.toolSpec = {
|
|
64
80
|
name: this.name,
|
|
65
81
|
description: this.description,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-as-tool.js","sourceRoot":"","sources":["../../../src/agent/agent-as-tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC5E,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"agent-as-tool.js","sourceRoot":"","sources":["../../../src/agent/agent-as-tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC5E,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAI3E;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GACxC,sIAAsI,CAAA;AAyDxI;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,WAAY,SAAQ,IAAI;IAC1B,IAAI,CAAQ;IACZ,WAAW,CAAQ;IACnB,Q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;gBACnB,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;gBACjD,CAAC;gBAED,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAA;YACzB,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAA;YAEzB,wBAAwB;YACxB,IAAI,MAAM,CAAC,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBAC1C,OAAO,IAAI,eAAe,CAAC;oBACzB,SAAS;oBACT,MAAM,EAAE,SAAS;oBACjB,OAAO,EAAE,CAAC,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,gBAA6B,EAAE,CAAC,CAAC;iBACzE,CAAC,CAAA;YACJ,CAAC;YAED,OAAO,IAAI,eAAe,CAAC;gBACzB,SAAS;gBACT,MAAM,EAAE,SAAS;gBACjB,OAAO,EAAE,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,kCAAkC;aAChF,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;QAC5C,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QACpB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentDelegation — enforces delegation semantics for tool routing.
|
|
3
|
+
*
|
|
4
|
+
* When a tool is configured with `delegate: true`, this plugin ensures:
|
|
5
|
+
* 1. The delegation tool is the only tool called in the turn (single-call constraint)
|
|
6
|
+
* 2. The agent loop exits immediately after a successful delegation (via endTurn)
|
|
7
|
+
* 3. The AgentResult is transformed with `stopReason: 'endTurn'` and the tool's content
|
|
8
|
+
* 4. Streaming events from the delegate agent are surfaced natively in the parent stream
|
|
9
|
+
*
|
|
10
|
+
* The final delegation message is produced in middleware after the core loop exits.
|
|
11
|
+
* It is written to `agent.messages` and yielded to stream consumers, but does not
|
|
12
|
+
* fire `MessageAddedEvent` hooks via `invokeCallbacks`. `SessionManager` with
|
|
13
|
+
* `saveLatestOn: 'invocation'` (default) is unaffected; `saveLatestOn: 'message'`
|
|
14
|
+
* may persist the endTurn placeholder instead of the delegation content.
|
|
15
|
+
*/
|
|
16
|
+
import type { Plugin } from '../plugins/plugin.js';
|
|
17
|
+
import type { LocalAgent } from '../types/agent.js';
|
|
18
|
+
/**
|
|
19
|
+
* Plugin that enforces delegation semantics for tool routing.
|
|
20
|
+
*
|
|
21
|
+
* Automatically registered on every agent. Acts as a no-op when no delegation tools fire.
|
|
22
|
+
* Implements single-call constraint, early loop exit, and result transformation.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import { Agent } from '@strands-agents/sdk'
|
|
27
|
+
*
|
|
28
|
+
* const specialist = new Agent({ name: 'Specialist' })
|
|
29
|
+
* const orchestrator = new Agent({
|
|
30
|
+
* tools: [specialist.asTool({ delegate: true })],
|
|
31
|
+
* // AgentDelegation is auto-registered — no manual setup needed
|
|
32
|
+
* })
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare class AgentDelegation implements Plugin {
|
|
36
|
+
readonly name = "strands:agent-delegation";
|
|
37
|
+
/** Per-agent delegation state, created in _onBeforeTools and consumed in _handleStream. */
|
|
38
|
+
private readonly _state;
|
|
39
|
+
initAgent(agent: LocalAgent): void;
|
|
40
|
+
/**
|
|
41
|
+
* BeforeToolsEvent hook: enforces single-call constraint against registry names
|
|
42
|
+
* and initializes per-batch delegation state.
|
|
43
|
+
*/
|
|
44
|
+
private _onBeforeTools;
|
|
45
|
+
/**
|
|
46
|
+
* AfterToolCallEvent hook: marks the delegation tool use ID on success.
|
|
47
|
+
*/
|
|
48
|
+
private _onAfterToolCall;
|
|
49
|
+
/**
|
|
50
|
+
* AfterToolsEvent hook: signals the agent loop to stop via endTurn when
|
|
51
|
+
* delegation succeeded.
|
|
52
|
+
*
|
|
53
|
+
* This hook runs at `HookOrder.SDK_LAST` (100). If a hook with a higher
|
|
54
|
+
* numeric order mutates a ToolResultBlock's status from success to error,
|
|
55
|
+
* the endTurn signal has already been committed and the loop will still exit.
|
|
56
|
+
* In practice, no SDK or vended plugin registers AfterToolsEvent hooks above
|
|
57
|
+
* SDK_LAST, and mutating committed ToolResultBlock status in AfterToolsEvent
|
|
58
|
+
* is not a documented or supported pattern.
|
|
59
|
+
*/
|
|
60
|
+
private _onAfterTools;
|
|
61
|
+
/**
|
|
62
|
+
* ExecuteToolStage middleware: enforces single-call constraint and surfaces
|
|
63
|
+
* delegate agent streaming events natively.
|
|
64
|
+
*
|
|
65
|
+
* For delegation tools in a multi-tool batch, returns an error result without
|
|
66
|
+
* executing the tool. For valid single-tool delegation, unwraps inner agent
|
|
67
|
+
* streaming events so they appear as native events in the parent stream.
|
|
68
|
+
*
|
|
69
|
+
* A post-init middleware registered inside this one can still bypass the check
|
|
70
|
+
* by spreading a modified context with a different `tool` to `next()`. This is a
|
|
71
|
+
* framework-level trust boundary, not addressable at the plugin level.
|
|
72
|
+
* The sanctioned path for tool replacement is `BeforeToolCallEvent.selectedTool`.
|
|
73
|
+
*/
|
|
74
|
+
private _handleToolExecution;
|
|
75
|
+
/**
|
|
76
|
+
* AgentStreamStage middleware: transforms the AgentResult on delegation.
|
|
77
|
+
*
|
|
78
|
+
* When the main loop exits via endTurn triggered by delegation (identified by
|
|
79
|
+
* the `endTurnViaDelegation` flag on DelegationState), this middleware replaces
|
|
80
|
+
* the default endTurn result with the proper delegation result: the sub-agent's
|
|
81
|
+
* content from the tool-result message.
|
|
82
|
+
*/
|
|
83
|
+
private _handleStream;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=agent-delegation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-delegation.d.ts","sourceRoot":"","sources":["../../../src/agent/agent-delegation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAElD,OAAO,KAAK,EAAE,UAAU,EAAoB,MAAM,mBAAmB,CAAA;AAwDrE;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,eAAgB,YAAW,MAAM;IAC5C,QAAQ,CAAC,IAAI,8BAA6B;IAE1C,2FAA2F;IAC3F,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6C;IAEpE,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAoDlC;;;OAGG;IACH,OAAO,CAAC,cAAc;IAkBtB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAuBxB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,aAAa;IAmBrB;;;;;;;;;;;;OAYG;YACY,oBAAoB;IAoDnC;;;;;;;OAOG;YACY,aAAa;CAsE7B"}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentDelegation — enforces delegation semantics for tool routing.
|
|
3
|
+
*
|
|
4
|
+
* When a tool is configured with `delegate: true`, this plugin ensures:
|
|
5
|
+
* 1. The delegation tool is the only tool called in the turn (single-call constraint)
|
|
6
|
+
* 2. The agent loop exits immediately after a successful delegation (via endTurn)
|
|
7
|
+
* 3. The AgentResult is transformed with `stopReason: 'endTurn'` and the tool's content
|
|
8
|
+
* 4. Streaming events from the delegate agent are surfaced natively in the parent stream
|
|
9
|
+
*
|
|
10
|
+
* The final delegation message is produced in middleware after the core loop exits.
|
|
11
|
+
* It is written to `agent.messages` and yielded to stream consumers, but does not
|
|
12
|
+
* fire `MessageAddedEvent` hooks via `invokeCallbacks`. `SessionManager` with
|
|
13
|
+
* `saveLatestOn: 'invocation'` (default) is unaffected; `saveLatestOn: 'message'`
|
|
14
|
+
* may persist the endTurn placeholder instead of the delegation content.
|
|
15
|
+
*/
|
|
16
|
+
import { AgentResult } from '../types/agent.js';
|
|
17
|
+
import { AfterToolCallEvent, AfterToolsEvent, BeforeModelCallEvent, BeforeToolsEvent, MessageAddedEvent, StreamEvent, ToolStreamUpdateEvent, } from '../hooks/events.js';
|
|
18
|
+
import { HookOrder } from '../hooks/types.js';
|
|
19
|
+
import { AgentStreamStage, ExecuteToolStage } from '../middleware/index.js';
|
|
20
|
+
import { Message, TextBlock, ToolResultBlock, ToolUseBlock } from '../types/messages.js';
|
|
21
|
+
import { AgentAsTool } from './agent-as-tool.js';
|
|
22
|
+
/**
|
|
23
|
+
* Checks whether a tool registered on the agent is a delegation AgentAsTool.
|
|
24
|
+
*/
|
|
25
|
+
function isDelegationTool(agent, toolName) {
|
|
26
|
+
const tool = agent.toolRegistry.get(toolName);
|
|
27
|
+
return tool instanceof AgentAsTool && tool.delegate;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Converts ToolResultContent blocks into valid ContentBlocks for an assistant message.
|
|
31
|
+
*
|
|
32
|
+
* AgentAsTool only produces TextBlock or JsonBlock results. JsonBlock is not part
|
|
33
|
+
* of the ContentBlock union, so it is serialized to a TextBlock.
|
|
34
|
+
*/
|
|
35
|
+
function toContentBlocks(block) {
|
|
36
|
+
return block.content.map((contentBlock) => {
|
|
37
|
+
if (contentBlock.type === 'jsonBlock') {
|
|
38
|
+
return new TextBlock(JSON.stringify(contentBlock.json));
|
|
39
|
+
}
|
|
40
|
+
return contentBlock;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Plugin that enforces delegation semantics for tool routing.
|
|
45
|
+
*
|
|
46
|
+
* Automatically registered on every agent. Acts as a no-op when no delegation tools fire.
|
|
47
|
+
* Implements single-call constraint, early loop exit, and result transformation.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* import { Agent } from '@strands-agents/sdk'
|
|
52
|
+
*
|
|
53
|
+
* const specialist = new Agent({ name: 'Specialist' })
|
|
54
|
+
* const orchestrator = new Agent({
|
|
55
|
+
* tools: [specialist.asTool({ delegate: true })],
|
|
56
|
+
* // AgentDelegation is auto-registered — no manual setup needed
|
|
57
|
+
* })
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export class AgentDelegation {
|
|
61
|
+
name = 'strands:agent-delegation';
|
|
62
|
+
/** Per-agent delegation state, created in _onBeforeTools and consumed in _handleStream. */
|
|
63
|
+
_state = new WeakMap();
|
|
64
|
+
initAgent(agent) {
|
|
65
|
+
// Fail fast: delegation is incompatible with stateful models.
|
|
66
|
+
// Stateful models manage conversation state server-side. Delegation's early
|
|
67
|
+
// exit would leave an unclosed function call on the server, corrupting the
|
|
68
|
+
// next request.
|
|
69
|
+
if (agent.model.stateful) {
|
|
70
|
+
const hasDelegationTool = agent.toolRegistry.list().some((tool) => tool instanceof AgentAsTool && tool.delegate);
|
|
71
|
+
if (hasDelegationTool) {
|
|
72
|
+
throw new Error('Delegation tools (delegate: true) are not supported with stateful models. ' +
|
|
73
|
+
"Stateful models manage conversation state server-side, and delegation's early loop exit " +
|
|
74
|
+
'would leave unclosed function calls on the server.');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
agent.addHook(BeforeToolsEvent, (event) => this._onBeforeTools(event));
|
|
78
|
+
agent.addHook(AfterToolCallEvent, (event) => this._onAfterToolCall(event));
|
|
79
|
+
agent.addHook(AfterToolsEvent, (event) => this._onAfterTools(event), { order: HookOrder.SDK_LAST });
|
|
80
|
+
// If the loop continues past a delegation batch (e.g. a later hook cleared
|
|
81
|
+
// endTurn), the next model call invalidates the delegation flag.
|
|
82
|
+
agent.addHook(BeforeModelCallEvent, (event) => {
|
|
83
|
+
this._state.delete(event.agent);
|
|
84
|
+
});
|
|
85
|
+
// async function* doesn't bind lexical `this`; capture for the terminal callback.
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
87
|
+
const self = this;
|
|
88
|
+
agent.addMiddleware(AgentStreamStage, async function* (context, next) {
|
|
89
|
+
return yield* self._handleStream(context, next);
|
|
90
|
+
});
|
|
91
|
+
// ExecuteToolStage middleware: unwraps inner agent streaming events for delegation tools
|
|
92
|
+
// so they appear as native events in the parent agent's stream.
|
|
93
|
+
agent.addMiddleware(ExecuteToolStage, async function* (context, next) {
|
|
94
|
+
return yield* self._handleToolExecution(context, next, agent);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* BeforeToolsEvent hook: enforces single-call constraint against registry names
|
|
99
|
+
* and initializes per-batch delegation state.
|
|
100
|
+
*/
|
|
101
|
+
_onBeforeTools(event) {
|
|
102
|
+
if (event.agent.model.stateful)
|
|
103
|
+
return;
|
|
104
|
+
const toolUseBlocks = event.message.content.filter((block) => block.type === 'toolUseBlock');
|
|
105
|
+
// Initialize state for this batch.
|
|
106
|
+
this._state.set(event.agent, { toolUseCount: toolUseBlocks.length });
|
|
107
|
+
// Cancel the batch if a delegation tool is present alongside other tools.
|
|
108
|
+
const hasDelegation = toolUseBlocks.some((block) => isDelegationTool(event.agent, block.name));
|
|
109
|
+
if (hasDelegation && toolUseBlocks.length > 1) {
|
|
110
|
+
event.cancel =
|
|
111
|
+
'This tool call was not executed. A delegation tool must be the only ' +
|
|
112
|
+
'tool called in a turn. Retry with a single delegation tool call or ' +
|
|
113
|
+
'use only non-delegation tools.';
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* AfterToolCallEvent hook: marks the delegation tool use ID on success.
|
|
118
|
+
*/
|
|
119
|
+
_onAfterToolCall(event) {
|
|
120
|
+
if (event.agent.model.stateful || !(event.tool instanceof AgentAsTool) || !event.tool.delegate) {
|
|
121
|
+
// Clear stale delegation mark if a retry swapped to a non-delegation tool
|
|
122
|
+
const state = this._state.get(event.agent);
|
|
123
|
+
if (state?.toolUseId === event.toolUse.toolUseId) {
|
|
124
|
+
delete state.toolUseId;
|
|
125
|
+
}
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const state = this._state.get(event.agent);
|
|
129
|
+
if (!state)
|
|
130
|
+
return;
|
|
131
|
+
// Only mark if the result is successful. If error, clear any prior mark
|
|
132
|
+
// (e.g. from a retried attempt that succeeded previously).
|
|
133
|
+
if (event.result.status === 'error') {
|
|
134
|
+
delete state.toolUseId;
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
state.toolUseId = event.toolUse.toolUseId;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* AfterToolsEvent hook: signals the agent loop to stop via endTurn when
|
|
141
|
+
* delegation succeeded.
|
|
142
|
+
*
|
|
143
|
+
* This hook runs at `HookOrder.SDK_LAST` (100). If a hook with a higher
|
|
144
|
+
* numeric order mutates a ToolResultBlock's status from success to error,
|
|
145
|
+
* the endTurn signal has already been committed and the loop will still exit.
|
|
146
|
+
* In practice, no SDK or vended plugin registers AfterToolsEvent hooks above
|
|
147
|
+
* SDK_LAST, and mutating committed ToolResultBlock status in AfterToolsEvent
|
|
148
|
+
* is not a documented or supported pattern.
|
|
149
|
+
*/
|
|
150
|
+
_onAfterTools(event) {
|
|
151
|
+
if (event.agent.model.stateful)
|
|
152
|
+
return;
|
|
153
|
+
const state = this._state.get(event.agent);
|
|
154
|
+
if (!state?.toolUseId)
|
|
155
|
+
return;
|
|
156
|
+
// Verify the tool result is still successful in the committed message.
|
|
157
|
+
const resultBlock = event.message.content.find((block) => block instanceof ToolResultBlock && block.toolUseId === state.toolUseId);
|
|
158
|
+
if (!resultBlock || resultBlock.status === 'error') {
|
|
159
|
+
delete state.toolUseId;
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
event.endTurn = true;
|
|
163
|
+
state.endTurnViaDelegation = true;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* ExecuteToolStage middleware: enforces single-call constraint and surfaces
|
|
167
|
+
* delegate agent streaming events natively.
|
|
168
|
+
*
|
|
169
|
+
* For delegation tools in a multi-tool batch, returns an error result without
|
|
170
|
+
* executing the tool. For valid single-tool delegation, unwraps inner agent
|
|
171
|
+
* streaming events so they appear as native events in the parent stream.
|
|
172
|
+
*
|
|
173
|
+
* A post-init middleware registered inside this one can still bypass the check
|
|
174
|
+
* by spreading a modified context with a different `tool` to `next()`. This is a
|
|
175
|
+
* framework-level trust boundary, not addressable at the plugin level.
|
|
176
|
+
* The sanctioned path for tool replacement is `BeforeToolCallEvent.selectedTool`.
|
|
177
|
+
*/
|
|
178
|
+
async *_handleToolExecution(context, next, agent) {
|
|
179
|
+
// Non-delegation tools or stateful models pass through unchanged.
|
|
180
|
+
if (!(context.tool instanceof AgentAsTool) || !context.tool.delegate || agent.model.stateful) {
|
|
181
|
+
return yield* next(context);
|
|
182
|
+
}
|
|
183
|
+
// Enforce single-call constraint: delegation tool must be the only tool in the batch.
|
|
184
|
+
const state = this._state.get(agent);
|
|
185
|
+
if (state && state.toolUseCount > 1) {
|
|
186
|
+
return {
|
|
187
|
+
result: new ToolResultBlock({
|
|
188
|
+
toolUseId: context.toolUse.toolUseId,
|
|
189
|
+
status: 'error',
|
|
190
|
+
content: [
|
|
191
|
+
new TextBlock('Delegation failed: a delegation tool must be the only tool called in a turn. ' +
|
|
192
|
+
'Retry with a single delegation tool call or use only non-delegation tools.'),
|
|
193
|
+
],
|
|
194
|
+
}),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
// Iterate the inner pipeline manually so we can transform events
|
|
198
|
+
const gen = next(context);
|
|
199
|
+
let result = await gen.next();
|
|
200
|
+
while (!result.done) {
|
|
201
|
+
const event = result.value;
|
|
202
|
+
// ToolStreamUpdateEvents from a delegation tool may contain wrapped inner agent events.
|
|
203
|
+
// Unwrap them: if the data is a StreamEvent instance, yield it as a native event.
|
|
204
|
+
if (event.type === 'toolStreamUpdateEvent') {
|
|
205
|
+
const innerData = event.event.data;
|
|
206
|
+
if (innerData instanceof StreamEvent) {
|
|
207
|
+
yield innerData;
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
// Regular tool stream events (e.g., from the inner agent's own tools) pass through
|
|
211
|
+
yield event;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
yield event;
|
|
216
|
+
}
|
|
217
|
+
result = await gen.next();
|
|
218
|
+
}
|
|
219
|
+
return result.value;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* AgentStreamStage middleware: transforms the AgentResult on delegation.
|
|
223
|
+
*
|
|
224
|
+
* When the main loop exits via endTurn triggered by delegation (identified by
|
|
225
|
+
* the `endTurnViaDelegation` flag on DelegationState), this middleware replaces
|
|
226
|
+
* the default endTurn result with the proper delegation result: the sub-agent's
|
|
227
|
+
* content from the tool-result message.
|
|
228
|
+
*/
|
|
229
|
+
async *_handleStream(context, next) {
|
|
230
|
+
// Clear any stale state from a prior failed invocation.
|
|
231
|
+
this._state.delete(context.agent);
|
|
232
|
+
let streamResult;
|
|
233
|
+
try {
|
|
234
|
+
streamResult = yield* next(context);
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
this._state.delete(context.agent);
|
|
238
|
+
throw error;
|
|
239
|
+
}
|
|
240
|
+
const state = this._state.get(context.agent);
|
|
241
|
+
this._state.delete(context.agent);
|
|
242
|
+
if (!state?.toolUseId || !state.endTurnViaDelegation)
|
|
243
|
+
return streamResult;
|
|
244
|
+
// Only transform if the result stopped via endTurn.
|
|
245
|
+
// Other stop reasons pass through unchanged.
|
|
246
|
+
if (streamResult.result.stopReason !== 'endTurn')
|
|
247
|
+
return streamResult;
|
|
248
|
+
// Find the delegation tool's result in agent.messages. The tool-result
|
|
249
|
+
// message is the last user message before the endTurn assistant message.
|
|
250
|
+
const messages = context.agent.messages;
|
|
251
|
+
let resultBlock;
|
|
252
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
253
|
+
const msg = messages[i];
|
|
254
|
+
if (msg && msg.role === 'user') {
|
|
255
|
+
resultBlock = msg.content.find((block) => block instanceof ToolResultBlock && block.toolUseId === state.toolUseId);
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (!resultBlock || resultBlock.status === 'error')
|
|
260
|
+
return streamResult;
|
|
261
|
+
const delegationMessage = new Message({
|
|
262
|
+
role: 'assistant',
|
|
263
|
+
content: toContentBlocks(resultBlock),
|
|
264
|
+
});
|
|
265
|
+
// Replace the endTurn message the main loop appended with the delegation content.
|
|
266
|
+
const lastMessage = messages[messages.length - 1];
|
|
267
|
+
if (lastMessage?.role === 'assistant') {
|
|
268
|
+
messages[messages.length - 1] = delegationMessage;
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
messages.push(delegationMessage);
|
|
272
|
+
}
|
|
273
|
+
yield new MessageAddedEvent({
|
|
274
|
+
agent: context.agent,
|
|
275
|
+
message: delegationMessage,
|
|
276
|
+
invocationState: streamResult.result.invocationState,
|
|
277
|
+
});
|
|
278
|
+
// Replace AgentResult with the delegation tool's content
|
|
279
|
+
return {
|
|
280
|
+
result: new AgentResult({
|
|
281
|
+
stopReason: 'endTurn',
|
|
282
|
+
lastMessage: delegationMessage,
|
|
283
|
+
invocationState: streamResult.result.invocationState,
|
|
284
|
+
...(streamResult.result.metrics !== undefined && { metrics: streamResult.result.metrics }),
|
|
285
|
+
...(streamResult.result.traces !== undefined && { traces: streamResult.result.traces }),
|
|
286
|
+
}),
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
//# sourceMappingURL=agent-delegation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-delegation.js","sourceRoot":"","sources":["../../../src/agent/agent-delegation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAG/C,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,WAA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S,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;aACxF,CAAC;SACH,CAAA;IACH,CAAC;CACF"}
|
|
@@ -10,6 +10,7 @@ import { StateStore } from '../state-store.js';
|
|
|
10
10
|
import type { Plugin } from '../plugins/plugin.js';
|
|
11
11
|
import type { InterventionHandler } from '../interventions/handler.js';
|
|
12
12
|
import { ConversationManager } from '../conversation-manager/conversation-manager.js';
|
|
13
|
+
import type { Storage } from '../storage/storage.js';
|
|
13
14
|
import type { MiddlewareStage, MiddlewareHandler, MiddlewareInputHandler, MiddlewareOutputHandler, MiddlewareInputPhase, MiddlewareWrapPhase, MiddlewareOutputPhase } from '../middleware/index.js';
|
|
14
15
|
import type { HookableEventConstructor, HookCallback, HookCallbackOptions, HookCleanup } from '../hooks/types.js';
|
|
15
16
|
import { HookableEvent } from '../hooks/events.js';
|
|
@@ -117,14 +118,15 @@ export type AgentConfig = {
|
|
|
117
118
|
* Context management strategy.
|
|
118
119
|
*
|
|
119
120
|
* - `"auto"`: SummarizingConversationManager with proactive compression + ContextOffloader.
|
|
120
|
-
* - `"agentic"`: Lets the model drive context management via injected tools.
|
|
121
|
+
* - `"agentic"`: (Experimental) Lets the model drive context management via injected tools.
|
|
122
|
+
* This mode may change in future versions.
|
|
121
123
|
*
|
|
122
124
|
* If `conversationManager` is also provided, the user's conversation manager is used instead.
|
|
123
125
|
* Defaults to undefined (SlidingWindowConversationManager, no offloader).
|
|
124
126
|
*
|
|
125
|
-
* @remarks The offloader uses in-memory storage
|
|
126
|
-
*
|
|
127
|
-
* with
|
|
127
|
+
* @remarks The offloader uses in-memory storage by default. When an agent-level
|
|
128
|
+
* `storage` is provided, the offloader uses that instead. Alternatively, provide
|
|
129
|
+
* an explicit `ContextOffloader` with its own storage via the `plugins` parameter.
|
|
128
130
|
*/
|
|
129
131
|
contextManager?: ContextManagerStrategy;
|
|
130
132
|
/**
|
|
@@ -213,6 +215,16 @@ export type AgentConfig = {
|
|
|
213
215
|
* default changes.
|
|
214
216
|
*/
|
|
215
217
|
sandbox?: Sandbox | false;
|
|
218
|
+
/**
|
|
219
|
+
* Default storage backend for agent subsystems.
|
|
220
|
+
*
|
|
221
|
+
* When provided, subsystems that do not have their own explicit storage
|
|
222
|
+
* (e.g., SessionManager, ContextOffloader) resolve from this value. Each
|
|
223
|
+
* subsystem auto-namespaces under its own prefix (`session/`, `offloader/`)
|
|
224
|
+
* to avoid key collisions. Storage specified directly on a subsystem always
|
|
225
|
+
* takes precedence over this agent-level default.
|
|
226
|
+
*/
|
|
227
|
+
storage?: Storage;
|
|
216
228
|
};
|
|
217
229
|
/**
|
|
218
230
|
* Orchestrates the interaction between a model, a set of tools, and MCP clients.
|
|
@@ -266,6 +278,10 @@ export declare class Agent implements LocalAgent, InvokableAgent {
|
|
|
266
278
|
* The memory manager for cross-session memory retrieval and storage, if configured.
|
|
267
279
|
*/
|
|
268
280
|
readonly memoryManager?: MemoryManager | undefined;
|
|
281
|
+
/**
|
|
282
|
+
* Default storage backend for agent subsystems.
|
|
283
|
+
*/
|
|
284
|
+
readonly storage?: Storage | undefined;
|
|
269
285
|
private readonly _sandbox;
|
|
270
286
|
/**
|
|
271
287
|
* Execution environment for running commands, code, and file operations.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/agent/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EAErB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAIL,OAAO,EACP,KAAK,WAAW,EAEhB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAItB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE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