@strands-agents/sdk 1.6.0 → 1.8.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/dist/src/agent/agent.d.ts +1 -1
- package/dist/src/agent/agent.d.ts.map +1 -1
- package/dist/src/agent/agent.js +1 -1
- package/dist/src/agent/agent.js.map +1 -1
- package/dist/src/context-manager/modes/agentic/agentic-context.d.ts +3 -3
- package/dist/src/context-manager/modes/agentic/agentic-context.d.ts.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 +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.node.d.ts.map +1 -1
- package/dist/src/index.node.js +3 -0
- package/dist/src/index.node.js.map +1 -1
- package/dist/src/interventions/actions.d.ts.map +1 -1
- package/dist/src/interventions/actions.js.map +1 -1
- package/dist/src/{mcp.d.ts → mcp/client.d.ts} +13 -4
- package/dist/src/mcp/client.d.ts.map +1 -0
- package/dist/src/{mcp.js → mcp/client.js} +15 -3
- package/dist/src/mcp/client.js.map +1 -0
- package/dist/src/mcp/config.d.ts +52 -0
- package/dist/src/mcp/config.d.ts.map +1 -0
- package/dist/src/mcp/config.js +12 -0
- package/dist/src/mcp/config.js.map +1 -0
- package/dist/src/mcp/config.node.d.ts +16 -0
- package/dist/src/mcp/config.node.d.ts.map +1 -0
- package/dist/src/mcp/config.node.js +145 -0
- package/dist/src/mcp/config.node.js.map +1 -0
- package/dist/src/mcp/index.d.ts +3 -0
- package/dist/src/mcp/index.d.ts.map +1 -0
- package/dist/src/mcp/index.js +2 -0
- package/dist/src/mcp/index.js.map +1 -0
- package/dist/src/memory/extraction/coordinator.d.ts +6 -1
- package/dist/src/memory/extraction/coordinator.d.ts.map +1 -1
- package/dist/src/memory/extraction/coordinator.js +48 -10
- package/dist/src/memory/extraction/coordinator.js.map +1 -1
- package/dist/src/memory/extraction/model-extractor.d.ts.map +1 -1
- package/dist/src/memory/extraction/model-extractor.js +30 -9
- package/dist/src/memory/extraction/model-extractor.js.map +1 -1
- package/dist/src/memory/extraction/types.d.ts +7 -0
- package/dist/src/memory/extraction/types.d.ts.map +1 -1
- package/dist/src/memory/extraction/types.js.map +1 -1
- package/dist/src/memory/memory-manager.d.ts +15 -2
- package/dist/src/memory/memory-manager.d.ts.map +1 -1
- package/dist/src/memory/memory-manager.js +123 -45
- package/dist/src/memory/memory-manager.js.map +1 -1
- package/dist/src/memory/types.d.ts +7 -0
- package/dist/src/memory/types.d.ts.map +1 -1
- package/dist/src/models/google/adapters.d.ts.map +1 -1
- package/dist/src/models/google/adapters.js +21 -3
- package/dist/src/models/google/adapters.js.map +1 -1
- package/dist/src/models/model.d.ts.map +1 -1
- package/dist/src/models/model.js +2 -1
- package/dist/src/models/model.js.map +1 -1
- package/dist/src/models/openai/errors.d.ts.map +1 -1
- package/dist/src/models/openai/errors.js +4 -1
- package/dist/src/models/openai/errors.js.map +1 -1
- package/dist/src/models/openai/responses-adapter.d.ts +1 -0
- package/dist/src/models/openai/responses-adapter.d.ts.map +1 -1
- package/dist/src/models/openai/responses-adapter.js +24 -10
- package/dist/src/models/openai/responses-adapter.js.map +1 -1
- package/dist/src/multiagent/graph.d.ts +7 -0
- package/dist/src/multiagent/graph.d.ts.map +1 -1
- package/dist/src/multiagent/graph.js +26 -2
- package/dist/src/multiagent/graph.js.map +1 -1
- package/dist/src/multiagent/nodes.d.ts +5 -0
- package/dist/src/multiagent/nodes.d.ts.map +1 -1
- package/dist/src/multiagent/nodes.js +15 -0
- package/dist/src/multiagent/nodes.js.map +1 -1
- package/dist/src/multiagent/state.d.ts.map +1 -1
- package/dist/src/multiagent/state.js.map +1 -1
- package/dist/src/telemetry/tracer.d.ts +82 -2
- package/dist/src/telemetry/tracer.d.ts.map +1 -1
- package/dist/src/telemetry/tracer.js +242 -3
- package/dist/src/telemetry/tracer.js.map +1 -1
- package/dist/src/telemetry/types.d.ts +86 -1
- package/dist/src/telemetry/types.d.ts.map +1 -1
- package/dist/src/tools/function-tool.d.ts +1 -1
- package/dist/src/tools/function-tool.d.ts.map +1 -1
- package/dist/src/tools/function-tool.js +4 -12
- package/dist/src/tools/function-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +2 -1
- package/dist/src/tools/mcp-tool.d.ts.map +1 -1
- package/dist/src/tools/mcp-tool.js +1 -0
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/tool-factory.d.ts +1 -1
- package/dist/src/tools/tool-factory.d.ts.map +1 -1
- package/dist/src/tools/types.d.ts +4 -0
- package/dist/src/tools/types.d.ts.map +1 -1
- package/dist/src/tools/zod-tool.d.ts +4 -2
- package/dist/src/tools/zod-tool.d.ts.map +1 -1
- package/dist/src/tools/zod-tool.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/types/json.js +2 -2
- package/dist/src/types/json.js.map +1 -1
- package/dist/src/types/media.d.ts.map +1 -1
- package/dist/src/types/media.js.map +1 -1
- package/dist/src/types/messages.d.ts.map +1 -1
- package/dist/src/types/messages.js.map +1 -1
- package/dist/src/vended-interventions/cedar/cedar.d.ts +12 -0
- package/dist/src/vended-interventions/cedar/cedar.d.ts.map +1 -1
- package/dist/src/vended-interventions/cedar/cedar.js +15 -4
- package/dist/src/vended-interventions/cedar/cedar.js.map +1 -1
- package/dist/src/vended-interventions/cedar/schema-generator.d.ts +1 -1
- package/dist/src/vended-interventions/cedar/schema-generator.d.ts.map +1 -1
- package/dist/src/vended-interventions/cedar/schema-generator.js +8 -3
- package/dist/src/vended-interventions/cedar/schema-generator.js.map +1 -1
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/index.d.ts +1 -1
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/index.d.ts.map +1 -1
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/index.js.map +1 -1
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/store.d.ts +57 -0
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/store.d.ts.map +1 -1
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/store.js +86 -11
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/store.js.map +1 -1
- package/dist/src/vended-memory-stores/local/index.d.ts +2 -0
- package/dist/src/vended-memory-stores/local/index.d.ts.map +1 -0
- package/dist/src/vended-memory-stores/local/index.js +2 -0
- package/dist/src/vended-memory-stores/local/index.js.map +1 -0
- package/dist/src/vended-memory-stores/local/store.d.ts +122 -0
- package/dist/src/vended-memory-stores/local/store.d.ts.map +1 -0
- package/dist/src/vended-memory-stores/local/store.js +281 -0
- package/dist/src/vended-memory-stores/local/store.js.map +1 -0
- package/dist/src/vended-plugins/context-offloader/search.d.ts.map +1 -1
- package/dist/src/vended-plugins/context-offloader/search.js +4 -2
- package/dist/src/vended-plugins/context-offloader/search.js.map +1 -1
- package/dist/src/vended-plugins/context-offloader/storage.d.ts.map +1 -1
- package/dist/src/vended-plugins/context-offloader/storage.js +16 -3
- package/dist/src/vended-plugins/context-offloader/storage.js.map +1 -1
- package/dist/src/vended-plugins/skills/skill.d.ts.map +1 -1
- package/dist/src/vended-plugins/skills/skill.js +4 -2
- package/dist/src/vended-plugins/skills/skill.js.map +1 -1
- package/dist/src/vended-tools/http-request/http-request.js +1 -1
- package/dist/src/vended-tools/http-request/http-request.js.map +1 -1
- package/dist/src/vended-tools/notebook/notebook.d.ts +1 -1
- package/package.json +46 -39
- package/dist/src/__fixtures__/agent-helpers.d.ts +0 -136
- package/dist/src/__fixtures__/agent-helpers.d.ts.map +0 -1
- package/dist/src/__fixtures__/agent-helpers.js +0 -156
- package/dist/src/__fixtures__/agent-helpers.js.map +0 -1
- package/dist/src/__fixtures__/environment.d.ts +0 -12
- package/dist/src/__fixtures__/environment.d.ts.map +0 -1
- package/dist/src/__fixtures__/environment.js +0 -12
- package/dist/src/__fixtures__/environment.js.map +0 -1
- package/dist/src/__fixtures__/metrics-helpers.d.ts +0 -55
- package/dist/src/__fixtures__/metrics-helpers.d.ts.map +0 -1
- package/dist/src/__fixtures__/metrics-helpers.js +0 -57
- package/dist/src/__fixtures__/metrics-helpers.js.map +0 -1
- package/dist/src/__fixtures__/mock-message-model.d.ts +0 -103
- package/dist/src/__fixtures__/mock-message-model.d.ts.map +0 -1
- package/dist/src/__fixtures__/mock-message-model.js +0 -245
- package/dist/src/__fixtures__/mock-message-model.js.map +0 -1
- package/dist/src/__fixtures__/mock-meter.d.ts +0 -32
- package/dist/src/__fixtures__/mock-meter.d.ts.map +0 -1
- package/dist/src/__fixtures__/mock-meter.js +0 -47
- package/dist/src/__fixtures__/mock-meter.js.map +0 -1
- package/dist/src/__fixtures__/mock-plugin.d.ts +0 -13
- package/dist/src/__fixtures__/mock-plugin.d.ts.map +0 -1
- package/dist/src/__fixtures__/mock-plugin.js +0 -35
- package/dist/src/__fixtures__/mock-plugin.js.map +0 -1
- package/dist/src/__fixtures__/mock-span.d.ts +0 -78
- package/dist/src/__fixtures__/mock-span.d.ts.map +0 -1
- package/dist/src/__fixtures__/mock-span.js +0 -93
- package/dist/src/__fixtures__/mock-span.js.map +0 -1
- package/dist/src/__fixtures__/mock-storage-provider.d.ts +0 -42
- package/dist/src/__fixtures__/mock-storage-provider.d.ts.map +0 -1
- package/dist/src/__fixtures__/mock-storage-provider.js +0 -122
- package/dist/src/__fixtures__/mock-storage-provider.js.map +0 -1
- package/dist/src/__fixtures__/model-test-helpers.d.ts +0 -56
- package/dist/src/__fixtures__/model-test-helpers.d.ts.map +0 -1
- package/dist/src/__fixtures__/model-test-helpers.js +0 -85
- package/dist/src/__fixtures__/model-test-helpers.js.map +0 -1
- package/dist/src/__fixtures__/register-node-defaults.d.ts +0 -2
- package/dist/src/__fixtures__/register-node-defaults.d.ts.map +0 -1
- package/dist/src/__fixtures__/register-node-defaults.js +0 -6
- package/dist/src/__fixtures__/register-node-defaults.js.map +0 -1
- package/dist/src/__fixtures__/slim-types.d.ts +0 -51
- package/dist/src/__fixtures__/slim-types.d.ts.map +0 -1
- package/dist/src/__fixtures__/slim-types.js +0 -6
- package/dist/src/__fixtures__/slim-types.js.map +0 -1
- package/dist/src/__fixtures__/test-sandbox.node.d.ts +0 -15
- package/dist/src/__fixtures__/test-sandbox.node.d.ts.map +0 -1
- package/dist/src/__fixtures__/test-sandbox.node.js +0 -23
- package/dist/src/__fixtures__/test-sandbox.node.js.map +0 -1
- package/dist/src/__fixtures__/tool-helpers.d.ts +0 -45
- package/dist/src/__fixtures__/tool-helpers.d.ts.map +0 -1
- package/dist/src/__fixtures__/tool-helpers.js +0 -101
- package/dist/src/__fixtures__/tool-helpers.js.map +0 -1
- package/dist/src/__tests__/default-slot.test.d.ts +0 -2
- package/dist/src/__tests__/default-slot.test.d.ts.map +0 -1
- package/dist/src/__tests__/default-slot.test.js +0 -33
- package/dist/src/__tests__/default-slot.test.js.map +0 -1
- package/dist/src/__tests__/errors.test.d.ts +0 -2
- package/dist/src/__tests__/errors.test.d.ts.map +0 -1
- package/dist/src/__tests__/errors.test.js +0 -170
- package/dist/src/__tests__/errors.test.js.map +0 -1
- package/dist/src/__tests__/index.test.d.ts +0 -2
- package/dist/src/__tests__/index.test.d.ts.map +0 -1
- package/dist/src/__tests__/index.test.js +0 -48
- package/dist/src/__tests__/index.test.js.map +0 -1
- package/dist/src/__tests__/interrupt.test.d.ts +0 -2
- package/dist/src/__tests__/interrupt.test.d.ts.map +0 -1
- package/dist/src/__tests__/interrupt.test.js +0 -264
- package/dist/src/__tests__/interrupt.test.js.map +0 -1
- package/dist/src/__tests__/mcp.test.d.ts +0 -2
- package/dist/src/__tests__/mcp.test.d.ts.map +0 -1
- package/dist/src/__tests__/mcp.test.js +0 -1003
- package/dist/src/__tests__/mcp.test.js.map +0 -1
- package/dist/src/__tests__/mime.test.d.ts +0 -2
- package/dist/src/__tests__/mime.test.d.ts.map +0 -1
- package/dist/src/__tests__/mime.test.js +0 -83
- package/dist/src/__tests__/mime.test.js.map +0 -1
- package/dist/src/__tests__/state-store.test.d.ts +0 -2
- package/dist/src/__tests__/state-store.test.d.ts.map +0 -1
- package/dist/src/__tests__/state-store.test.js +0 -285
- package/dist/src/__tests__/state-store.test.js.map +0 -1
- package/dist/src/a2a/__tests__/a2a-agent.test.d.ts +0 -2
- package/dist/src/a2a/__tests__/a2a-agent.test.d.ts.map +0 -1
- package/dist/src/a2a/__tests__/a2a-agent.test.js +0 -383
- package/dist/src/a2a/__tests__/a2a-agent.test.js.map +0 -1
- package/dist/src/a2a/__tests__/adapters.test.d.ts +0 -2
- package/dist/src/a2a/__tests__/adapters.test.d.ts.map +0 -1
- package/dist/src/a2a/__tests__/adapters.test.js +0 -151
- package/dist/src/a2a/__tests__/adapters.test.js.map +0 -1
- package/dist/src/a2a/__tests__/async-lock.test.d.ts +0 -2
- package/dist/src/a2a/__tests__/async-lock.test.d.ts.map +0 -1
- package/dist/src/a2a/__tests__/async-lock.test.js +0 -137
- package/dist/src/a2a/__tests__/async-lock.test.js.map +0 -1
- package/dist/src/a2a/__tests__/events.test.d.ts +0 -2
- package/dist/src/a2a/__tests__/events.test.d.ts.map +0 -1
- package/dist/src/a2a/__tests__/events.test.js +0 -68
- package/dist/src/a2a/__tests__/events.test.js.map +0 -1
- package/dist/src/a2a/__tests__/executor.test.d.ts +0 -2
- package/dist/src/a2a/__tests__/executor.test.d.ts.map +0 -1
- package/dist/src/a2a/__tests__/executor.test.js +0 -345
- package/dist/src/a2a/__tests__/executor.test.js.map +0 -1
- package/dist/src/a2a/__tests__/server.test.d.ts +0 -2
- package/dist/src/a2a/__tests__/server.test.d.ts.map +0 -1
- package/dist/src/a2a/__tests__/server.test.js +0 -71
- package/dist/src/a2a/__tests__/server.test.js.map +0 -1
- package/dist/src/a2a/__tests__/server.test.node.d.ts +0 -2
- package/dist/src/a2a/__tests__/server.test.node.d.ts.map +0 -1
- package/dist/src/a2a/__tests__/server.test.node.js +0 -110
- package/dist/src/a2a/__tests__/server.test.node.js.map +0 -1
- package/dist/src/agent/__tests__/agent-as-tool.invocation-state.test.d.ts +0 -2
- package/dist/src/agent/__tests__/agent-as-tool.invocation-state.test.d.ts.map +0 -1
- package/dist/src/agent/__tests__/agent-as-tool.invocation-state.test.js +0 -23
- package/dist/src/agent/__tests__/agent-as-tool.invocation-state.test.js.map +0 -1
- package/dist/src/agent/__tests__/agent-as-tool.test.d.ts +0 -2
- package/dist/src/agent/__tests__/agent-as-tool.test.d.ts.map +0 -1
- package/dist/src/agent/__tests__/agent-as-tool.test.js +0 -347
- package/dist/src/agent/__tests__/agent-as-tool.test.js.map +0 -1
- package/dist/src/agent/__tests__/agent.cancel.test.d.ts +0 -2
- package/dist/src/agent/__tests__/agent.cancel.test.d.ts.map +0 -1
- package/dist/src/agent/__tests__/agent.cancel.test.js +0 -337
- package/dist/src/agent/__tests__/agent.cancel.test.js.map +0 -1
- package/dist/src/agent/__tests__/agent.concurrent.test.d.ts +0 -2
- package/dist/src/agent/__tests__/agent.concurrent.test.d.ts.map +0 -1
- package/dist/src/agent/__tests__/agent.concurrent.test.js +0 -488
- package/dist/src/agent/__tests__/agent.concurrent.test.js.map +0 -1
- package/dist/src/agent/__tests__/agent.context-manager.test.d.ts +0 -2
- package/dist/src/agent/__tests__/agent.context-manager.test.d.ts.map +0 -1
- package/dist/src/agent/__tests__/agent.context-manager.test.js +0 -107
- package/dist/src/agent/__tests__/agent.context-manager.test.js.map +0 -1
- package/dist/src/agent/__tests__/agent.hook.test.d.ts +0 -2
- package/dist/src/agent/__tests__/agent.hook.test.d.ts.map +0 -1
- package/dist/src/agent/__tests__/agent.hook.test.js +0 -1332
- package/dist/src/agent/__tests__/agent.hook.test.js.map +0 -1
- package/dist/src/agent/__tests__/agent.interrupt.test.d.ts +0 -2
- package/dist/src/agent/__tests__/agent.interrupt.test.d.ts.map +0 -1
- package/dist/src/agent/__tests__/agent.interrupt.test.js +0 -779
- package/dist/src/agent/__tests__/agent.interrupt.test.js.map +0 -1
- package/dist/src/agent/__tests__/agent.invocation-state.test.d.ts +0 -2
- package/dist/src/agent/__tests__/agent.invocation-state.test.d.ts.map +0 -1
- package/dist/src/agent/__tests__/agent.invocation-state.test.js +0 -219
- package/dist/src/agent/__tests__/agent.invocation-state.test.js.map +0 -1
- package/dist/src/agent/__tests__/agent.model-retry.test.d.ts +0 -2
- package/dist/src/agent/__tests__/agent.model-retry.test.d.ts.map +0 -1
- package/dist/src/agent/__tests__/agent.model-retry.test.js +0 -161
- package/dist/src/agent/__tests__/agent.model-retry.test.js.map +0 -1
- package/dist/src/agent/__tests__/agent.stateful-model.test.d.ts +0 -2
- package/dist/src/agent/__tests__/agent.stateful-model.test.d.ts.map +0 -1
- package/dist/src/agent/__tests__/agent.stateful-model.test.js +0 -169
- package/dist/src/agent/__tests__/agent.stateful-model.test.js.map +0 -1
- package/dist/src/agent/__tests__/agent.test.d.ts +0 -2
- package/dist/src/agent/__tests__/agent.test.d.ts.map +0 -1
- package/dist/src/agent/__tests__/agent.test.js +0 -1624
- package/dist/src/agent/__tests__/agent.test.js.map +0 -1
- package/dist/src/agent/__tests__/agent.tracer.test.node.d.ts +0 -2
- package/dist/src/agent/__tests__/agent.tracer.test.node.d.ts.map +0 -1
- package/dist/src/agent/__tests__/agent.tracer.test.node.js +0 -535
- package/dist/src/agent/__tests__/agent.tracer.test.node.js.map +0 -1
- package/dist/src/agent/__tests__/printer.test.d.ts +0 -2
- package/dist/src/agent/__tests__/printer.test.d.ts.map +0 -1
- package/dist/src/agent/__tests__/printer.test.js +0 -188
- package/dist/src/agent/__tests__/printer.test.js.map +0 -1
- package/dist/src/agent/__tests__/snapshot.test.d.ts +0 -2
- package/dist/src/agent/__tests__/snapshot.test.d.ts.map +0 -1
- package/dist/src/agent/__tests__/snapshot.test.js +0 -442
- package/dist/src/agent/__tests__/snapshot.test.js.map +0 -1
- package/dist/src/agent/__tests__/tool-caller.test.d.ts +0 -2
- package/dist/src/agent/__tests__/tool-caller.test.d.ts.map +0 -1
- package/dist/src/agent/__tests__/tool-caller.test.js +0 -459
- package/dist/src/agent/__tests__/tool-caller.test.js.map +0 -1
- package/dist/src/conversation-manager/__tests__/agentic-context.test.d.ts +0 -2
- package/dist/src/conversation-manager/__tests__/agentic-context.test.d.ts.map +0 -1
- package/dist/src/conversation-manager/__tests__/agentic-context.test.js +0 -332
- package/dist/src/conversation-manager/__tests__/agentic-context.test.js.map +0 -1
- package/dist/src/conversation-manager/__tests__/context-compression.test.d.ts +0 -2
- package/dist/src/conversation-manager/__tests__/context-compression.test.d.ts.map +0 -1
- package/dist/src/conversation-manager/__tests__/context-compression.test.js +0 -176
- package/dist/src/conversation-manager/__tests__/context-compression.test.js.map +0 -1
- package/dist/src/conversation-manager/__tests__/conversation-manager.test.d.ts +0 -2
- package/dist/src/conversation-manager/__tests__/conversation-manager.test.d.ts.map +0 -1
- package/dist/src/conversation-manager/__tests__/conversation-manager.test.js +0 -321
- package/dist/src/conversation-manager/__tests__/conversation-manager.test.js.map +0 -1
- package/dist/src/conversation-manager/__tests__/null-conversation-manager.test.d.ts +0 -2
- package/dist/src/conversation-manager/__tests__/null-conversation-manager.test.d.ts.map +0 -1
- package/dist/src/conversation-manager/__tests__/null-conversation-manager.test.js +0 -64
- package/dist/src/conversation-manager/__tests__/null-conversation-manager.test.js.map +0 -1
- package/dist/src/conversation-manager/__tests__/pin.test.d.ts +0 -2
- package/dist/src/conversation-manager/__tests__/pin.test.d.ts.map +0 -1
- package/dist/src/conversation-manager/__tests__/pin.test.js +0 -119
- package/dist/src/conversation-manager/__tests__/pin.test.js.map +0 -1
- package/dist/src/conversation-manager/__tests__/sliding-window-conversation-manager.test.d.ts +0 -2
- package/dist/src/conversation-manager/__tests__/sliding-window-conversation-manager.test.d.ts.map +0 -1
- package/dist/src/conversation-manager/__tests__/sliding-window-conversation-manager.test.js +0 -1080
- package/dist/src/conversation-manager/__tests__/sliding-window-conversation-manager.test.js.map +0 -1
- package/dist/src/conversation-manager/__tests__/summarizing-conversation-manager.test.d.ts +0 -2
- package/dist/src/conversation-manager/__tests__/summarizing-conversation-manager.test.d.ts.map +0 -1
- package/dist/src/conversation-manager/__tests__/summarizing-conversation-manager.test.js +0 -400
- package/dist/src/conversation-manager/__tests__/summarizing-conversation-manager.test.js.map +0 -1
- package/dist/src/conversation-manager/__tests__/token-usage-middleware.test.d.ts +0 -2
- package/dist/src/conversation-manager/__tests__/token-usage-middleware.test.d.ts.map +0 -1
- package/dist/src/conversation-manager/__tests__/token-usage-middleware.test.js +0 -138
- package/dist/src/conversation-manager/__tests__/token-usage-middleware.test.js.map +0 -1
- package/dist/src/hooks/__tests__/events.test.d.ts +0 -2
- package/dist/src/hooks/__tests__/events.test.d.ts.map +0 -1
- package/dist/src/hooks/__tests__/events.test.js +0 -1060
- package/dist/src/hooks/__tests__/events.test.js.map +0 -1
- package/dist/src/hooks/__tests__/registry.test.d.ts +0 -2
- package/dist/src/hooks/__tests__/registry.test.d.ts.map +0 -1
- package/dist/src/hooks/__tests__/registry.test.js +0 -325
- package/dist/src/hooks/__tests__/registry.test.js.map +0 -1
- package/dist/src/injection/__tests__/message-injection.test.d.ts +0 -2
- package/dist/src/injection/__tests__/message-injection.test.d.ts.map +0 -1
- package/dist/src/injection/__tests__/message-injection.test.js +0 -200
- package/dist/src/injection/__tests__/message-injection.test.js.map +0 -1
- package/dist/src/interventions/__tests__/handler.test.d.ts +0 -2
- package/dist/src/interventions/__tests__/handler.test.d.ts.map +0 -1
- package/dist/src/interventions/__tests__/handler.test.js +0 -35
- package/dist/src/interventions/__tests__/handler.test.js.map +0 -1
- package/dist/src/interventions/__tests__/registry.test.d.ts +0 -2
- package/dist/src/interventions/__tests__/registry.test.d.ts.map +0 -1
- package/dist/src/interventions/__tests__/registry.test.js +0 -692
- package/dist/src/interventions/__tests__/registry.test.js.map +0 -1
- package/dist/src/logging/__tests__/logger.test.d.ts +0 -2
- package/dist/src/logging/__tests__/logger.test.d.ts.map +0 -1
- package/dist/src/logging/__tests__/logger.test.js +0 -70
- package/dist/src/logging/__tests__/logger.test.js.map +0 -1
- package/dist/src/logging/__tests__/warn-once.test.d.ts +0 -2
- package/dist/src/logging/__tests__/warn-once.test.d.ts.map +0 -1
- package/dist/src/logging/__tests__/warn-once.test.js +0 -30
- package/dist/src/logging/__tests__/warn-once.test.js.map +0 -1
- package/dist/src/mcp.d.ts.map +0 -1
- package/dist/src/mcp.js.map +0 -1
- package/dist/src/memory/__tests__/memory-manager.test.d.ts +0 -2
- package/dist/src/memory/__tests__/memory-manager.test.d.ts.map +0 -1
- package/dist/src/memory/__tests__/memory-manager.test.js +0 -679
- package/dist/src/memory/__tests__/memory-manager.test.js.map +0 -1
- package/dist/src/memory/extraction/__tests__/extraction.test.d.ts +0 -2
- package/dist/src/memory/extraction/__tests__/extraction.test.d.ts.map +0 -1
- package/dist/src/memory/extraction/__tests__/extraction.test.js +0 -637
- package/dist/src/memory/extraction/__tests__/extraction.test.js.map +0 -1
- package/dist/src/memory/extraction/__tests__/model-extractor.test.d.ts +0 -2
- package/dist/src/memory/extraction/__tests__/model-extractor.test.d.ts.map +0 -1
- package/dist/src/memory/extraction/__tests__/model-extractor.test.js +0 -68
- package/dist/src/memory/extraction/__tests__/model-extractor.test.js.map +0 -1
- package/dist/src/memory/extraction/__tests__/resolve-extraction-config.test.d.ts +0 -2
- package/dist/src/memory/extraction/__tests__/resolve-extraction-config.test.d.ts.map +0 -1
- package/dist/src/memory/extraction/__tests__/resolve-extraction-config.test.js +0 -81
- package/dist/src/memory/extraction/__tests__/resolve-extraction-config.test.js.map +0 -1
- package/dist/src/middleware/__tests__/agent-middleware.test.d.ts +0 -2
- package/dist/src/middleware/__tests__/agent-middleware.test.d.ts.map +0 -1
- package/dist/src/middleware/__tests__/agent-middleware.test.js +0 -1206
- package/dist/src/middleware/__tests__/agent-middleware.test.js.map +0 -1
- package/dist/src/middleware/__tests__/copy-on-input.test.d.ts +0 -2
- package/dist/src/middleware/__tests__/copy-on-input.test.d.ts.map +0 -1
- package/dist/src/middleware/__tests__/copy-on-input.test.js +0 -379
- package/dist/src/middleware/__tests__/copy-on-input.test.js.map +0 -1
- package/dist/src/middleware/__tests__/custom-stages.test.d.ts +0 -2
- package/dist/src/middleware/__tests__/custom-stages.test.d.ts.map +0 -1
- package/dist/src/middleware/__tests__/custom-stages.test.js +0 -97
- package/dist/src/middleware/__tests__/custom-stages.test.js.map +0 -1
- package/dist/src/middleware/__tests__/middleware-interrupts.test.d.ts +0 -2
- package/dist/src/middleware/__tests__/middleware-interrupts.test.d.ts.map +0 -1
- package/dist/src/middleware/__tests__/middleware-interrupts.test.js +0 -267
- package/dist/src/middleware/__tests__/middleware-interrupts.test.js.map +0 -1
- package/dist/src/middleware/__tests__/registry.test.d.ts +0 -2
- package/dist/src/middleware/__tests__/registry.test.d.ts.map +0 -1
- package/dist/src/middleware/__tests__/registry.test.js +0 -525
- package/dist/src/middleware/__tests__/registry.test.js.map +0 -1
- package/dist/src/models/__tests__/anthropic.test.d.ts +0 -2
- package/dist/src/models/__tests__/anthropic.test.d.ts.map +0 -1
- package/dist/src/models/__tests__/anthropic.test.js +0 -793
- package/dist/src/models/__tests__/anthropic.test.js.map +0 -1
- package/dist/src/models/__tests__/bedrock.test.d.ts +0 -2
- package/dist/src/models/__tests__/bedrock.test.d.ts.map +0 -1
- package/dist/src/models/__tests__/bedrock.test.js +0 -3964
- package/dist/src/models/__tests__/bedrock.test.js.map +0 -1
- package/dist/src/models/__tests__/defaults.test.d.ts +0 -2
- package/dist/src/models/__tests__/defaults.test.d.ts.map +0 -1
- package/dist/src/models/__tests__/defaults.test.js +0 -36
- package/dist/src/models/__tests__/defaults.test.js.map +0 -1
- package/dist/src/models/__tests__/google.test.d.ts +0 -2
- package/dist/src/models/__tests__/google.test.d.ts.map +0 -1
- package/dist/src/models/__tests__/google.test.js +0 -1104
- package/dist/src/models/__tests__/google.test.js.map +0 -1
- package/dist/src/models/__tests__/model.test.d.ts +0 -2
- package/dist/src/models/__tests__/model.test.d.ts.map +0 -1
- package/dist/src/models/__tests__/model.test.js +0 -921
- package/dist/src/models/__tests__/model.test.js.map +0 -1
- package/dist/src/models/__tests__/streaming.test.d.ts +0 -2
- package/dist/src/models/__tests__/streaming.test.d.ts.map +0 -1
- package/dist/src/models/__tests__/streaming.test.js +0 -50
- package/dist/src/models/__tests__/streaming.test.js.map +0 -1
- package/dist/src/models/__tests__/test-utils.d.ts +0 -10
- package/dist/src/models/__tests__/test-utils.d.ts.map +0 -1
- package/dist/src/models/__tests__/test-utils.js +0 -17
- package/dist/src/models/__tests__/test-utils.js.map +0 -1
- package/dist/src/models/__tests__/vercel.test.d.ts +0 -2
- package/dist/src/models/__tests__/vercel.test.d.ts.map +0 -1
- package/dist/src/models/__tests__/vercel.test.js +0 -740
- package/dist/src/models/__tests__/vercel.test.js.map +0 -1
- package/dist/src/models/openai/__tests__/chat.test.d.ts +0 -2
- package/dist/src/models/openai/__tests__/chat.test.d.ts.map +0 -1
- package/dist/src/models/openai/__tests__/chat.test.js +0 -1586
- package/dist/src/models/openai/__tests__/chat.test.js.map +0 -1
- package/dist/src/models/openai/__tests__/errors.test.d.ts +0 -2
- package/dist/src/models/openai/__tests__/errors.test.d.ts.map +0 -1
- package/dist/src/models/openai/__tests__/errors.test.js +0 -30
- package/dist/src/models/openai/__tests__/errors.test.js.map +0 -1
- package/dist/src/models/openai/__tests__/mantle.test.d.ts +0 -2
- package/dist/src/models/openai/__tests__/mantle.test.d.ts.map +0 -1
- package/dist/src/models/openai/__tests__/mantle.test.js +0 -189
- package/dist/src/models/openai/__tests__/mantle.test.js.map +0 -1
- package/dist/src/models/openai/__tests__/responses.test.d.ts +0 -2
- package/dist/src/models/openai/__tests__/responses.test.d.ts.map +0 -1
- package/dist/src/models/openai/__tests__/responses.test.js +0 -662
- package/dist/src/models/openai/__tests__/responses.test.js.map +0 -1
- package/dist/src/multiagent/__tests__/events.test.d.ts +0 -2
- package/dist/src/multiagent/__tests__/events.test.d.ts.map +0 -1
- package/dist/src/multiagent/__tests__/events.test.js +0 -493
- package/dist/src/multiagent/__tests__/events.test.js.map +0 -1
- package/dist/src/multiagent/__tests__/graph.invocation-state.test.d.ts +0 -2
- package/dist/src/multiagent/__tests__/graph.invocation-state.test.d.ts.map +0 -1
- package/dist/src/multiagent/__tests__/graph.invocation-state.test.js +0 -95
- package/dist/src/multiagent/__tests__/graph.invocation-state.test.js.map +0 -1
- package/dist/src/multiagent/__tests__/graph.test.d.ts +0 -2
- package/dist/src/multiagent/__tests__/graph.test.d.ts.map +0 -1
- package/dist/src/multiagent/__tests__/graph.test.js +0 -677
- package/dist/src/multiagent/__tests__/graph.test.js.map +0 -1
- package/dist/src/multiagent/__tests__/graph.tracer.test.d.ts +0 -2
- package/dist/src/multiagent/__tests__/graph.tracer.test.d.ts.map +0 -1
- package/dist/src/multiagent/__tests__/graph.tracer.test.js +0 -218
- package/dist/src/multiagent/__tests__/graph.tracer.test.js.map +0 -1
- package/dist/src/multiagent/__tests__/interrupts.test.d.ts +0 -2
- package/dist/src/multiagent/__tests__/interrupts.test.d.ts.map +0 -1
- package/dist/src/multiagent/__tests__/interrupts.test.js +0 -390
- package/dist/src/multiagent/__tests__/interrupts.test.js.map +0 -1
- package/dist/src/multiagent/__tests__/nodes.test.d.ts +0 -2
- package/dist/src/multiagent/__tests__/nodes.test.d.ts.map +0 -1
- package/dist/src/multiagent/__tests__/nodes.test.js +0 -321
- package/dist/src/multiagent/__tests__/nodes.test.js.map +0 -1
- package/dist/src/multiagent/__tests__/queue.test.d.ts +0 -2
- package/dist/src/multiagent/__tests__/queue.test.d.ts.map +0 -1
- package/dist/src/multiagent/__tests__/queue.test.js +0 -118
- package/dist/src/multiagent/__tests__/queue.test.js.map +0 -1
- package/dist/src/multiagent/__tests__/snapshot.test.d.ts +0 -2
- package/dist/src/multiagent/__tests__/snapshot.test.d.ts.map +0 -1
- package/dist/src/multiagent/__tests__/snapshot.test.js +0 -161
- package/dist/src/multiagent/__tests__/snapshot.test.js.map +0 -1
- package/dist/src/multiagent/__tests__/state.test.d.ts +0 -2
- package/dist/src/multiagent/__tests__/state.test.d.ts.map +0 -1
- package/dist/src/multiagent/__tests__/state.test.js +0 -526
- package/dist/src/multiagent/__tests__/state.test.js.map +0 -1
- package/dist/src/multiagent/__tests__/swarm.invocation-state.test.d.ts +0 -2
- package/dist/src/multiagent/__tests__/swarm.invocation-state.test.d.ts.map +0 -1
- package/dist/src/multiagent/__tests__/swarm.invocation-state.test.js +0 -56
- package/dist/src/multiagent/__tests__/swarm.invocation-state.test.js.map +0 -1
- package/dist/src/multiagent/__tests__/swarm.test.d.ts +0 -2
- package/dist/src/multiagent/__tests__/swarm.test.d.ts.map +0 -1
- package/dist/src/multiagent/__tests__/swarm.test.js +0 -477
- package/dist/src/multiagent/__tests__/swarm.test.js.map +0 -1
- package/dist/src/multiagent/__tests__/swarm.tracer.test.d.ts +0 -2
- package/dist/src/multiagent/__tests__/swarm.tracer.test.d.ts.map +0 -1
- package/dist/src/multiagent/__tests__/swarm.tracer.test.js +0 -235
- package/dist/src/multiagent/__tests__/swarm.tracer.test.js.map +0 -1
- package/dist/src/plugins/__tests__/plugin.test.d.ts +0 -2
- package/dist/src/plugins/__tests__/plugin.test.d.ts.map +0 -1
- package/dist/src/plugins/__tests__/plugin.test.js +0 -114
- package/dist/src/plugins/__tests__/plugin.test.js.map +0 -1
- package/dist/src/plugins/__tests__/registry.test.d.ts +0 -2
- package/dist/src/plugins/__tests__/registry.test.d.ts.map +0 -1
- package/dist/src/plugins/__tests__/registry.test.js +0 -147
- package/dist/src/plugins/__tests__/registry.test.js.map +0 -1
- package/dist/src/registry/__tests__/tool-registry.test.d.ts +0 -2
- package/dist/src/registry/__tests__/tool-registry.test.d.ts.map +0 -1
- package/dist/src/registry/__tests__/tool-registry.test.js +0 -210
- package/dist/src/registry/__tests__/tool-registry.test.js.map +0 -1
- package/dist/src/retry/__tests__/backoff-strategy.test.d.ts +0 -2
- package/dist/src/retry/__tests__/backoff-strategy.test.d.ts.map +0 -1
- package/dist/src/retry/__tests__/backoff-strategy.test.js +0 -116
- package/dist/src/retry/__tests__/backoff-strategy.test.js.map +0 -1
- package/dist/src/retry/__tests__/default-model-retry-strategy.test.d.ts +0 -2
- package/dist/src/retry/__tests__/default-model-retry-strategy.test.d.ts.map +0 -1
- package/dist/src/retry/__tests__/default-model-retry-strategy.test.js +0 -225
- package/dist/src/retry/__tests__/default-model-retry-strategy.test.js.map +0 -1
- package/dist/src/sandbox/__tests__/default.test.browser.d.ts +0 -2
- package/dist/src/sandbox/__tests__/default.test.browser.d.ts.map +0 -1
- package/dist/src/sandbox/__tests__/default.test.browser.js +0 -11
- package/dist/src/sandbox/__tests__/default.test.browser.js.map +0 -1
- package/dist/src/sandbox/__tests__/default.test.node.d.ts +0 -2
- package/dist/src/sandbox/__tests__/default.test.node.d.ts.map +0 -1
- package/dist/src/sandbox/__tests__/default.test.node.js +0 -23
- package/dist/src/sandbox/__tests__/default.test.node.js.map +0 -1
- package/dist/src/sandbox/__tests__/docker.test.node.d.ts +0 -2
- package/dist/src/sandbox/__tests__/docker.test.node.d.ts.map +0 -1
- package/dist/src/sandbox/__tests__/docker.test.node.js +0 -89
- package/dist/src/sandbox/__tests__/docker.test.node.js.map +0 -1
- package/dist/src/sandbox/__tests__/errors.test.node.d.ts +0 -2
- package/dist/src/sandbox/__tests__/errors.test.node.d.ts.map +0 -1
- package/dist/src/sandbox/__tests__/errors.test.node.js +0 -33
- package/dist/src/sandbox/__tests__/errors.test.node.js.map +0 -1
- package/dist/src/sandbox/__tests__/not-a-sandbox-local-environment.test.node.d.ts +0 -2
- package/dist/src/sandbox/__tests__/not-a-sandbox-local-environment.test.node.d.ts.map +0 -1
- package/dist/src/sandbox/__tests__/not-a-sandbox-local-environment.test.node.js +0 -124
- package/dist/src/sandbox/__tests__/not-a-sandbox-local-environment.test.node.js.map +0 -1
- package/dist/src/sandbox/__tests__/posix-shell.test.node.d.ts +0 -2
- package/dist/src/sandbox/__tests__/posix-shell.test.node.d.ts.map +0 -1
- package/dist/src/sandbox/__tests__/posix-shell.test.node.js +0 -298
- package/dist/src/sandbox/__tests__/posix-shell.test.node.js.map +0 -1
- package/dist/src/sandbox/__tests__/ssh.test.node.d.ts +0 -2
- package/dist/src/sandbox/__tests__/ssh.test.node.d.ts.map +0 -1
- package/dist/src/sandbox/__tests__/ssh.test.node.js +0 -262
- package/dist/src/sandbox/__tests__/ssh.test.node.js.map +0 -1
- package/dist/src/session/__tests__/file-storage.test.node.d.ts +0 -2
- package/dist/src/session/__tests__/file-storage.test.node.d.ts.map +0 -1
- package/dist/src/session/__tests__/file-storage.test.node.js +0 -278
- package/dist/src/session/__tests__/file-storage.test.node.js.map +0 -1
- package/dist/src/session/__tests__/s3-storage.test.d.ts +0 -2
- package/dist/src/session/__tests__/s3-storage.test.d.ts.map +0 -1
- package/dist/src/session/__tests__/s3-storage.test.js +0 -461
- package/dist/src/session/__tests__/s3-storage.test.js.map +0 -1
- package/dist/src/session/__tests__/session-manager.test.d.ts +0 -2
- package/dist/src/session/__tests__/session-manager.test.d.ts.map +0 -1
- package/dist/src/session/__tests__/session-manager.test.js +0 -832
- package/dist/src/session/__tests__/session-manager.test.js.map +0 -1
- package/dist/src/session/__tests__/validation.test.d.ts +0 -2
- package/dist/src/session/__tests__/validation.test.d.ts.map +0 -1
- package/dist/src/session/__tests__/validation.test.js +0 -47
- package/dist/src/session/__tests__/validation.test.js.map +0 -1
- package/dist/src/telemetry/__tests__/config.test.d.ts +0 -2
- package/dist/src/telemetry/__tests__/config.test.d.ts.map +0 -1
- package/dist/src/telemetry/__tests__/config.test.js +0 -64
- package/dist/src/telemetry/__tests__/config.test.js.map +0 -1
- package/dist/src/telemetry/__tests__/config.test.node.d.ts +0 -2
- package/dist/src/telemetry/__tests__/config.test.node.d.ts.map +0 -1
- package/dist/src/telemetry/__tests__/config.test.node.js +0 -164
- package/dist/src/telemetry/__tests__/config.test.node.js.map +0 -1
- package/dist/src/telemetry/__tests__/json.test.d.ts +0 -2
- package/dist/src/telemetry/__tests__/json.test.d.ts.map +0 -1
- package/dist/src/telemetry/__tests__/json.test.js +0 -89
- package/dist/src/telemetry/__tests__/json.test.js.map +0 -1
- package/dist/src/telemetry/__tests__/local-trace.test.d.ts +0 -2
- package/dist/src/telemetry/__tests__/local-trace.test.d.ts.map +0 -1
- package/dist/src/telemetry/__tests__/local-trace.test.js +0 -158
- package/dist/src/telemetry/__tests__/local-trace.test.js.map +0 -1
- package/dist/src/telemetry/__tests__/meter.test.d.ts +0 -2
- package/dist/src/telemetry/__tests__/meter.test.d.ts.map +0 -1
- package/dist/src/telemetry/__tests__/meter.test.js +0 -695
- package/dist/src/telemetry/__tests__/meter.test.js.map +0 -1
- package/dist/src/telemetry/__tests__/tracer.test.node.d.ts +0 -2
- package/dist/src/telemetry/__tests__/tracer.test.node.d.ts.map +0 -1
- package/dist/src/telemetry/__tests__/tracer.test.node.js +0 -760
- package/dist/src/telemetry/__tests__/tracer.test.node.js.map +0 -1
- package/dist/src/tools/__tests__/structured-output-tool.test.d.ts +0 -2
- package/dist/src/tools/__tests__/structured-output-tool.test.d.ts.map +0 -1
- package/dist/src/tools/__tests__/structured-output-tool.test.js +0 -84
- package/dist/src/tools/__tests__/structured-output-tool.test.js.map +0 -1
- package/dist/src/tools/__tests__/tool-factory.test.d.ts +0 -2
- package/dist/src/tools/__tests__/tool-factory.test.d.ts.map +0 -1
- package/dist/src/tools/__tests__/tool-factory.test.js +0 -98
- package/dist/src/tools/__tests__/tool-factory.test.js.map +0 -1
- package/dist/src/tools/__tests__/tool.test.d.ts +0 -2
- package/dist/src/tools/__tests__/tool.test.d.ts.map +0 -1
- package/dist/src/tools/__tests__/tool.test.js +0 -1043
- package/dist/src/tools/__tests__/tool.test.js.map +0 -1
- package/dist/src/tools/__tests__/zod-tool.test-d.d.ts +0 -2
- package/dist/src/tools/__tests__/zod-tool.test-d.d.ts.map +0 -1
- package/dist/src/tools/__tests__/zod-tool.test-d.js +0 -227
- package/dist/src/tools/__tests__/zod-tool.test-d.js.map +0 -1
- package/dist/src/tools/__tests__/zod-tool.test.d.ts +0 -2
- package/dist/src/tools/__tests__/zod-tool.test.d.ts.map +0 -1
- package/dist/src/tools/__tests__/zod-tool.test.js +0 -563
- package/dist/src/tools/__tests__/zod-tool.test.js.map +0 -1
- package/dist/src/types/__tests__/agent.test.d.ts +0 -2
- package/dist/src/types/__tests__/agent.test.d.ts.map +0 -1
- package/dist/src/types/__tests__/agent.test.js +0 -476
- package/dist/src/types/__tests__/agent.test.js.map +0 -1
- package/dist/src/types/__tests__/citations.test.d.ts +0 -2
- package/dist/src/types/__tests__/citations.test.d.ts.map +0 -1
- package/dist/src/types/__tests__/citations.test.js +0 -104
- package/dist/src/types/__tests__/citations.test.js.map +0 -1
- package/dist/src/types/__tests__/json.test.d.ts +0 -2
- package/dist/src/types/__tests__/json.test.d.ts.map +0 -1
- package/dist/src/types/__tests__/json.test.js +0 -298
- package/dist/src/types/__tests__/json.test.js.map +0 -1
- package/dist/src/types/__tests__/media.test.d.ts +0 -2
- package/dist/src/types/__tests__/media.test.d.ts.map +0 -1
- package/dist/src/types/__tests__/media.test.js +0 -478
- package/dist/src/types/__tests__/media.test.js.map +0 -1
- package/dist/src/types/__tests__/messages.test.d.ts +0 -2
- package/dist/src/types/__tests__/messages.test.d.ts.map +0 -1
- package/dist/src/types/__tests__/messages.test.js +0 -681
- package/dist/src/types/__tests__/messages.test.js.map +0 -1
- package/dist/src/types/__tests__/validation.test.d.ts +0 -2
- package/dist/src/types/__tests__/validation.test.d.ts.map +0 -1
- package/dist/src/types/__tests__/validation.test.js +0 -30
- package/dist/src/types/__tests__/validation.test.js.map +0 -1
- package/dist/src/vended-interventions/cedar/__tests__/cedar.test.node.d.ts +0 -2
- package/dist/src/vended-interventions/cedar/__tests__/cedar.test.node.d.ts.map +0 -1
- package/dist/src/vended-interventions/cedar/__tests__/cedar.test.node.js +0 -675
- package/dist/src/vended-interventions/cedar/__tests__/cedar.test.node.js.map +0 -1
- package/dist/src/vended-interventions/hitl/__tests__/hitl.test.d.ts +0 -2
- package/dist/src/vended-interventions/hitl/__tests__/hitl.test.d.ts.map +0 -1
- package/dist/src/vended-interventions/hitl/__tests__/hitl.test.js +0 -358
- package/dist/src/vended-interventions/hitl/__tests__/hitl.test.js.map +0 -1
- package/dist/src/vended-interventions/steering/__tests__/handler.test.d.ts +0 -2
- package/dist/src/vended-interventions/steering/__tests__/handler.test.d.ts.map +0 -1
- package/dist/src/vended-interventions/steering/__tests__/handler.test.js +0 -163
- package/dist/src/vended-interventions/steering/__tests__/handler.test.js.map +0 -1
- package/dist/src/vended-interventions/steering/__tests__/llm.test.d.ts +0 -2
- package/dist/src/vended-interventions/steering/__tests__/llm.test.d.ts.map +0 -1
- package/dist/src/vended-interventions/steering/__tests__/llm.test.js +0 -60
- package/dist/src/vended-interventions/steering/__tests__/llm.test.js.map +0 -1
- package/dist/src/vended-interventions/steering/__tests__/tool-ledger.test.d.ts +0 -2
- package/dist/src/vended-interventions/steering/__tests__/tool-ledger.test.d.ts.map +0 -1
- package/dist/src/vended-interventions/steering/__tests__/tool-ledger.test.js +0 -94
- package/dist/src/vended-interventions/steering/__tests__/tool-ledger.test.js.map +0 -1
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/__tests__/bedrock-knowledge-base-store.test.d.ts +0 -2
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/__tests__/bedrock-knowledge-base-store.test.d.ts.map +0 -1
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/__tests__/bedrock-knowledge-base-store.test.js +0 -611
- package/dist/src/vended-memory-stores/bedrock-knowledge-base/__tests__/bedrock-knowledge-base-store.test.js.map +0 -1
- package/dist/src/vended-plugins/context-injector/__tests__/plugin.test.d.ts +0 -2
- package/dist/src/vended-plugins/context-injector/__tests__/plugin.test.d.ts.map +0 -1
- package/dist/src/vended-plugins/context-injector/__tests__/plugin.test.js +0 -96
- package/dist/src/vended-plugins/context-injector/__tests__/plugin.test.js.map +0 -1
- package/dist/src/vended-plugins/context-offloader/__tests__/file-storage-sandbox.test.node.d.ts +0 -2
- package/dist/src/vended-plugins/context-offloader/__tests__/file-storage-sandbox.test.node.d.ts.map +0 -1
- package/dist/src/vended-plugins/context-offloader/__tests__/file-storage-sandbox.test.node.js +0 -68
- package/dist/src/vended-plugins/context-offloader/__tests__/file-storage-sandbox.test.node.js.map +0 -1
- package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.d.ts +0 -2
- package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.d.ts.map +0 -1
- package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.js +0 -539
- package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.js.map +0 -1
- package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.node.d.ts +0 -2
- package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.node.d.ts.map +0 -1
- package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.node.js +0 -93
- package/dist/src/vended-plugins/context-offloader/__tests__/plugin.test.node.js.map +0 -1
- package/dist/src/vended-plugins/context-offloader/__tests__/search.test.d.ts +0 -2
- package/dist/src/vended-plugins/context-offloader/__tests__/search.test.d.ts.map +0 -1
- package/dist/src/vended-plugins/context-offloader/__tests__/search.test.js +0 -149
- package/dist/src/vended-plugins/context-offloader/__tests__/search.test.js.map +0 -1
- package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.d.ts +0 -2
- package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.d.ts.map +0 -1
- package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.js +0 -216
- package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.js.map +0 -1
- package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.node.d.ts +0 -2
- package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.node.d.ts.map +0 -1
- package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.node.js +0 -78
- package/dist/src/vended-plugins/context-offloader/__tests__/storage.test.node.js.map +0 -1
- package/dist/src/vended-plugins/goal/__tests__/plugin.test.d.ts +0 -2
- package/dist/src/vended-plugins/goal/__tests__/plugin.test.d.ts.map +0 -1
- package/dist/src/vended-plugins/goal/__tests__/plugin.test.js +0 -736
- package/dist/src/vended-plugins/goal/__tests__/plugin.test.js.map +0 -1
- package/dist/src/vended-plugins/skills/__tests__/agent-skills.test.node.d.ts +0 -2
- package/dist/src/vended-plugins/skills/__tests__/agent-skills.test.node.d.ts.map +0 -1
- package/dist/src/vended-plugins/skills/__tests__/agent-skills.test.node.js +0 -482
- package/dist/src/vended-plugins/skills/__tests__/agent-skills.test.node.js.map +0 -1
- package/dist/src/vended-plugins/skills/__tests__/skill.test.node.d.ts +0 -2
- package/dist/src/vended-plugins/skills/__tests__/skill.test.node.d.ts.map +0 -1
- package/dist/src/vended-plugins/skills/__tests__/skill.test.node.js +0 -476
- package/dist/src/vended-plugins/skills/__tests__/skill.test.node.js.map +0 -1
- package/dist/src/vended-tools/bash/__tests__/bash.test.node.d.ts +0 -2
- package/dist/src/vended-tools/bash/__tests__/bash.test.node.d.ts.map +0 -1
- package/dist/src/vended-tools/bash/__tests__/bash.test.node.js +0 -390
- package/dist/src/vended-tools/bash/__tests__/bash.test.node.js.map +0 -1
- package/dist/src/vended-tools/file-editor/__tests__/file-editor.test.node.d.ts +0 -2
- package/dist/src/vended-tools/file-editor/__tests__/file-editor.test.node.d.ts.map +0 -1
- package/dist/src/vended-tools/file-editor/__tests__/file-editor.test.node.js +0 -452
- package/dist/src/vended-tools/file-editor/__tests__/file-editor.test.node.js.map +0 -1
- package/dist/src/vended-tools/http-request/__tests__/http-request.test.d.ts +0 -2
- package/dist/src/vended-tools/http-request/__tests__/http-request.test.d.ts.map +0 -1
- package/dist/src/vended-tools/http-request/__tests__/http-request.test.js +0 -189
- package/dist/src/vended-tools/http-request/__tests__/http-request.test.js.map +0 -1
- package/dist/src/vended-tools/notebook/__tests__/notebook.test.d.ts +0 -2
- package/dist/src/vended-tools/notebook/__tests__/notebook.test.d.ts.map +0 -1
- package/dist/src/vended-tools/notebook/__tests__/notebook.test.js +0 -388
- package/dist/src/vended-tools/notebook/__tests__/notebook.test.js.map +0 -1
|
@@ -1,736 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import { GoalLoop } from '../plugin.js';
|
|
3
|
-
import { buildJudgePrompt, JUDGE_OUTCOME_SCHEMA } from '../judge.js';
|
|
4
|
-
import { Agent } from '../../../agent/agent.js';
|
|
5
|
-
import { AfterInvocationEvent } from '../../../hooks/events.js';
|
|
6
|
-
import { MockMessageModel } from '../../../__fixtures__/mock-message-model.js';
|
|
7
|
-
import { JsonBlock, Message, TextBlock, ToolResultBlock, ToolUseBlock } from '../../../types/messages.js';
|
|
8
|
-
import { logger } from '../../../logging/logger.js';
|
|
9
|
-
describe('GoalLoop', () => {
|
|
10
|
-
describe('constructor', () => {
|
|
11
|
-
it('uses default name and unbounded budgets', () => {
|
|
12
|
-
const warnSpy = vi.spyOn(logger, 'warn').mockImplementation(() => { });
|
|
13
|
-
const p = new GoalLoop({ goal: () => true, name: 'unique-defaults-test' });
|
|
14
|
-
expect(p.name).toBe('unique-defaults-test');
|
|
15
|
-
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('execution is unbounded'));
|
|
16
|
-
warnSpy.mockRestore();
|
|
17
|
-
});
|
|
18
|
-
it('accepts custom name', () => {
|
|
19
|
-
const p = new GoalLoop({ goal: () => true, name: 'my:goal' });
|
|
20
|
-
expect(p.name).toBe('my:goal');
|
|
21
|
-
});
|
|
22
|
-
it('throws when goal is not provided', () => {
|
|
23
|
-
expect(() => new GoalLoop({})).toThrow(/`goal` is required/);
|
|
24
|
-
});
|
|
25
|
-
it('throws when maxAttempts < 1', () => {
|
|
26
|
-
expect(() => new GoalLoop({ goal: () => true, maxAttempts: 0 })).toThrow(/maxAttempts/);
|
|
27
|
-
});
|
|
28
|
-
it('throws when timeout < 1', () => {
|
|
29
|
-
expect(() => new GoalLoop({ goal: () => true, timeout: 0 })).toThrow(/timeout/);
|
|
30
|
-
});
|
|
31
|
-
it('does not warn when maxAttempts is set', () => {
|
|
32
|
-
const warnSpy = vi.spyOn(logger, 'warn').mockImplementation(() => { });
|
|
33
|
-
new GoalLoop({ goal: () => true, maxAttempts: 5, name: 'bounded-by-attempts' });
|
|
34
|
-
expect(warnSpy).not.toHaveBeenCalled();
|
|
35
|
-
warnSpy.mockRestore();
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
describe('function validator', () => {
|
|
39
|
-
it('passes on first attempt with no resume', async () => {
|
|
40
|
-
const model = new MockMessageModel().addTurn({ type: 'textBlock', text: 'first' });
|
|
41
|
-
const validator = vi.fn(() => true);
|
|
42
|
-
const plugin = new GoalLoop({ goal: validator, maxAttempts: 5, name: 'fn-pass-first' });
|
|
43
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
44
|
-
const result = await agent.invoke('do it');
|
|
45
|
-
expect(validator).toHaveBeenCalledTimes(1);
|
|
46
|
-
expect(result.lastMessage.content[0]).toEqual({ type: 'textBlock', text: 'first' });
|
|
47
|
-
expect(plugin.lastResult(agent)).toEqual({
|
|
48
|
-
passed: true,
|
|
49
|
-
stopReason: 'satisfied',
|
|
50
|
-
attempts: [{ attempt: 1, passed: true }],
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
it('feeds feedback as user message and re-invokes until passing', async () => {
|
|
54
|
-
const model = new MockMessageModel()
|
|
55
|
-
.addTurn({ type: 'textBlock', text: 'too long' })
|
|
56
|
-
.addTurn({ type: 'textBlock', text: 'still too long' })
|
|
57
|
-
.addTurn({ type: 'textBlock', text: 'ok' });
|
|
58
|
-
let n = 0;
|
|
59
|
-
const plugin = new GoalLoop({
|
|
60
|
-
name: 'fn-feedback-loop',
|
|
61
|
-
goal: () => {
|
|
62
|
-
n++;
|
|
63
|
-
return n === 3 || { passed: false, feedback: `attempt ${n} too long` };
|
|
64
|
-
},
|
|
65
|
-
maxAttempts: 5,
|
|
66
|
-
});
|
|
67
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
68
|
-
await agent.invoke('summarise');
|
|
69
|
-
expect(model.callCount).toBe(3);
|
|
70
|
-
expect(plugin.lastResult(agent)).toEqual({
|
|
71
|
-
passed: true,
|
|
72
|
-
stopReason: 'satisfied',
|
|
73
|
-
attempts: [
|
|
74
|
-
{ attempt: 1, passed: false, feedback: 'attempt 1 too long' },
|
|
75
|
-
{ attempt: 2, passed: false, feedback: 'attempt 2 too long' },
|
|
76
|
-
{ attempt: 3, passed: true },
|
|
77
|
-
],
|
|
78
|
-
});
|
|
79
|
-
const userTexts = agent.messages
|
|
80
|
-
.filter((m) => m.role === 'user')
|
|
81
|
-
.flatMap((m) => m.content)
|
|
82
|
-
.flatMap((b) => (b.type === 'textBlock' ? [b.text] : []));
|
|
83
|
-
expect(userTexts.some((t) => t.includes('attempt 1 too long'))).toBe(true);
|
|
84
|
-
expect(userTexts.some((t) => t.includes('attempt 2 too long'))).toBe(true);
|
|
85
|
-
});
|
|
86
|
-
it('hits maxAttempts and surfaces lastResult without throwing', async () => {
|
|
87
|
-
const model = new MockMessageModel()
|
|
88
|
-
.addTurn({ type: 'textBlock', text: 'a' })
|
|
89
|
-
.addTurn({ type: 'textBlock', text: 'b' })
|
|
90
|
-
.addTurn({ type: 'textBlock', text: 'c' });
|
|
91
|
-
const plugin = new GoalLoop({
|
|
92
|
-
name: 'fn-maxattempts',
|
|
93
|
-
goal: () => ({ passed: false, feedback: 'nope' }),
|
|
94
|
-
maxAttempts: 3,
|
|
95
|
-
});
|
|
96
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
97
|
-
await agent.invoke('go');
|
|
98
|
-
expect(model.callCount).toBe(3);
|
|
99
|
-
expect(plugin.lastResult(agent)).toEqual({
|
|
100
|
-
passed: false,
|
|
101
|
-
stopReason: 'maxAttempts',
|
|
102
|
-
attempts: [
|
|
103
|
-
{ attempt: 1, passed: false, feedback: 'nope' },
|
|
104
|
-
{ attempt: 2, passed: false, feedback: 'nope' },
|
|
105
|
-
{ attempt: 3, passed: false, feedback: 'nope' },
|
|
106
|
-
],
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
it('treats validator throws as a failed attempt and warns to surface buggy validators', async () => {
|
|
110
|
-
const model = new MockMessageModel()
|
|
111
|
-
.addTurn({ type: 'textBlock', text: 'a' })
|
|
112
|
-
.addTurn({ type: 'textBlock', text: 'b' });
|
|
113
|
-
const warnSpy = vi.spyOn(logger, 'warn').mockImplementation(() => { });
|
|
114
|
-
let n = 0;
|
|
115
|
-
const plugin = new GoalLoop({
|
|
116
|
-
name: 'fn-throws',
|
|
117
|
-
goal: () => {
|
|
118
|
-
n++;
|
|
119
|
-
if (n === 1)
|
|
120
|
-
throw new Error('boom');
|
|
121
|
-
return true;
|
|
122
|
-
},
|
|
123
|
-
maxAttempts: 3,
|
|
124
|
-
});
|
|
125
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
126
|
-
await agent.invoke('go');
|
|
127
|
-
expect(plugin.lastResult(agent)).toEqual({
|
|
128
|
-
passed: true,
|
|
129
|
-
stopReason: 'satisfied',
|
|
130
|
-
attempts: [
|
|
131
|
-
{ attempt: 1, passed: false, feedback: 'Validator error: boom' },
|
|
132
|
-
{ attempt: 2, passed: true },
|
|
133
|
-
],
|
|
134
|
-
});
|
|
135
|
-
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('fn-throws: validator threw: boom'));
|
|
136
|
-
warnSpy.mockRestore();
|
|
137
|
-
});
|
|
138
|
-
it('awaits async validator', async () => {
|
|
139
|
-
const model = new MockMessageModel()
|
|
140
|
-
.addTurn({ type: 'textBlock', text: 'a' })
|
|
141
|
-
.addTurn({ type: 'textBlock', text: 'b' });
|
|
142
|
-
let n = 0;
|
|
143
|
-
const plugin = new GoalLoop({
|
|
144
|
-
name: 'fn-async',
|
|
145
|
-
goal: async () => {
|
|
146
|
-
n++;
|
|
147
|
-
const localN = n;
|
|
148
|
-
await new Promise((r) => setTimeout(r, 1));
|
|
149
|
-
return localN === 2;
|
|
150
|
-
},
|
|
151
|
-
maxAttempts: 5,
|
|
152
|
-
});
|
|
153
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
154
|
-
await agent.invoke('go');
|
|
155
|
-
expect(plugin.lastResult(agent)).toEqual({
|
|
156
|
-
passed: true,
|
|
157
|
-
stopReason: 'satisfied',
|
|
158
|
-
attempts: [
|
|
159
|
-
{ attempt: 1, passed: false },
|
|
160
|
-
{ attempt: 2, passed: true },
|
|
161
|
-
],
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
it('exposes the assistant message to the validator', async () => {
|
|
165
|
-
const model = new MockMessageModel().addTurn({ type: 'textBlock', text: 'hello world' });
|
|
166
|
-
const seen = [];
|
|
167
|
-
const plugin = new GoalLoop({
|
|
168
|
-
name: 'fn-receives-message',
|
|
169
|
-
goal: (response) => {
|
|
170
|
-
seen.push(response);
|
|
171
|
-
return true;
|
|
172
|
-
},
|
|
173
|
-
maxAttempts: 3,
|
|
174
|
-
});
|
|
175
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
176
|
-
await agent.invoke('go');
|
|
177
|
-
expect(seen).toHaveLength(1);
|
|
178
|
-
expect(seen[0].role).toBe('assistant');
|
|
179
|
-
expect(seen[0].content[0].text).toBe('hello world');
|
|
180
|
-
});
|
|
181
|
-
it('honours timeout by terminating before next validate', async () => {
|
|
182
|
-
vi.useFakeTimers();
|
|
183
|
-
try {
|
|
184
|
-
const model = new MockMessageModel()
|
|
185
|
-
.addTurn({ type: 'textBlock', text: 'a' })
|
|
186
|
-
.addTurn({ type: 'textBlock', text: 'b' });
|
|
187
|
-
let attemptCount = 0;
|
|
188
|
-
const plugin = new GoalLoop({
|
|
189
|
-
name: 'fn-timeout',
|
|
190
|
-
goal: async () => {
|
|
191
|
-
attemptCount++;
|
|
192
|
-
if (attemptCount === 1) {
|
|
193
|
-
await new Promise((resolve) => setTimeout(resolve, 30));
|
|
194
|
-
return { passed: false, feedback: 'try again' };
|
|
195
|
-
}
|
|
196
|
-
return true;
|
|
197
|
-
},
|
|
198
|
-
timeout: 10,
|
|
199
|
-
maxAttempts: 5,
|
|
200
|
-
});
|
|
201
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
202
|
-
const invokePromise = agent.invoke('go');
|
|
203
|
-
await vi.runAllTimersAsync();
|
|
204
|
-
await invokePromise;
|
|
205
|
-
expect(plugin.lastResult(agent)).toEqual({
|
|
206
|
-
passed: false,
|
|
207
|
-
stopReason: 'timeout',
|
|
208
|
-
attempts: [{ attempt: 1, passed: false, feedback: 'try again' }],
|
|
209
|
-
});
|
|
210
|
-
expect(model.callCount).toBe(2);
|
|
211
|
-
}
|
|
212
|
-
finally {
|
|
213
|
-
vi.useRealTimers();
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
describe('lastResult lifecycle', () => {
|
|
218
|
-
it('is undefined before first invoke', () => {
|
|
219
|
-
const plugin = new GoalLoop({ goal: () => true, maxAttempts: 1, name: 'lr-untouched' });
|
|
220
|
-
const model = new MockMessageModel();
|
|
221
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
222
|
-
expect(plugin.lastResult(agent)).toBeUndefined();
|
|
223
|
-
});
|
|
224
|
-
it('is replaced on each completed run', async () => {
|
|
225
|
-
const plugin = new GoalLoop({
|
|
226
|
-
name: 'lr-replaced',
|
|
227
|
-
goal: () => true,
|
|
228
|
-
maxAttempts: 1,
|
|
229
|
-
});
|
|
230
|
-
const m1 = new MockMessageModel().addTurn({ type: 'textBlock', text: 'one' });
|
|
231
|
-
const a1 = new Agent({ model: m1, plugins: [plugin], printer: false });
|
|
232
|
-
await a1.invoke('first');
|
|
233
|
-
const after1 = plugin.lastResult(a1);
|
|
234
|
-
expect(after1).toEqual({
|
|
235
|
-
passed: true,
|
|
236
|
-
stopReason: 'satisfied',
|
|
237
|
-
attempts: [{ attempt: 1, passed: true }],
|
|
238
|
-
});
|
|
239
|
-
m1.addTurn({ type: 'textBlock', text: 'two' });
|
|
240
|
-
await a1.invoke('second');
|
|
241
|
-
const after2 = plugin.lastResult(a1);
|
|
242
|
-
expect(after2).not.toBe(after1);
|
|
243
|
-
expect(after2).toEqual({
|
|
244
|
-
passed: true,
|
|
245
|
-
stopReason: 'satisfied',
|
|
246
|
-
attempts: [{ attempt: 1, passed: true }],
|
|
247
|
-
});
|
|
248
|
-
});
|
|
249
|
-
it('is undefined after a host throw mid-run', async () => {
|
|
250
|
-
const model = new MockMessageModel().addTurn(new Error('boom'));
|
|
251
|
-
const plugin = new GoalLoop({
|
|
252
|
-
name: 'lr-throw',
|
|
253
|
-
goal: () => true,
|
|
254
|
-
maxAttempts: 3,
|
|
255
|
-
});
|
|
256
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
257
|
-
await expect(agent.invoke('go')).rejects.toThrow('boom');
|
|
258
|
-
expect(plugin.lastResult(agent)).toBeUndefined();
|
|
259
|
-
});
|
|
260
|
-
it('is undefined while a run is mid-flight (read between attempts via hook)', async () => {
|
|
261
|
-
const model = new MockMessageModel()
|
|
262
|
-
.addTurn({ type: 'textBlock', text: 'a' })
|
|
263
|
-
.addTurn({ type: 'textBlock', text: 'b' });
|
|
264
|
-
const observed = [];
|
|
265
|
-
let plugin;
|
|
266
|
-
plugin = new GoalLoop({
|
|
267
|
-
name: 'lr-midflight',
|
|
268
|
-
goal: (response, hostAgent) => {
|
|
269
|
-
observed.push(plugin.lastResult(hostAgent));
|
|
270
|
-
const text = response.content[0].text;
|
|
271
|
-
return text === 'b';
|
|
272
|
-
},
|
|
273
|
-
maxAttempts: 5,
|
|
274
|
-
});
|
|
275
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
276
|
-
await agent.invoke('go');
|
|
277
|
-
expect(observed).toEqual([undefined, undefined]);
|
|
278
|
-
expect(plugin.lastResult(agent)).toEqual({
|
|
279
|
-
passed: true,
|
|
280
|
-
stopReason: 'satisfied',
|
|
281
|
-
attempts: [
|
|
282
|
-
{ attempt: 1, passed: false },
|
|
283
|
-
{ attempt: 2, passed: true },
|
|
284
|
-
],
|
|
285
|
-
});
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
describe('conversation history', () => {
|
|
289
|
-
it('feedback messages accumulate as user-role messages between attempts', async () => {
|
|
290
|
-
const model = new MockMessageModel()
|
|
291
|
-
.addTurn({ type: 'textBlock', text: 'a1' })
|
|
292
|
-
.addTurn({ type: 'textBlock', text: 'a2' })
|
|
293
|
-
.addTurn({ type: 'textBlock', text: 'a3' });
|
|
294
|
-
let n = 0;
|
|
295
|
-
const plugin = new GoalLoop({
|
|
296
|
-
name: 'history-accumulates',
|
|
297
|
-
goal: () => {
|
|
298
|
-
n++;
|
|
299
|
-
return n === 3 ? true : { passed: false, feedback: `fb${n}` };
|
|
300
|
-
},
|
|
301
|
-
maxAttempts: 5,
|
|
302
|
-
});
|
|
303
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
304
|
-
await agent.invoke('initial input');
|
|
305
|
-
const roles = agent.messages.map((m) => m.role);
|
|
306
|
-
expect(roles).toEqual(['user', 'assistant', 'user', 'assistant', 'user', 'assistant']);
|
|
307
|
-
});
|
|
308
|
-
});
|
|
309
|
-
describe('resumePromptTemplate override', () => {
|
|
310
|
-
it('replaces the default canned English with the user-supplied template', async () => {
|
|
311
|
-
const model = new MockMessageModel()
|
|
312
|
-
.addTurn({ type: 'textBlock', text: 'a' })
|
|
313
|
-
.addTurn({ type: 'textBlock', text: 'b' });
|
|
314
|
-
let n = 0;
|
|
315
|
-
const plugin = new GoalLoop({
|
|
316
|
-
name: 'custom-resume-template',
|
|
317
|
-
goal: () => {
|
|
318
|
-
n++;
|
|
319
|
-
return n === 2 || { passed: false, feedback: 'too long' };
|
|
320
|
-
},
|
|
321
|
-
maxAttempts: 3,
|
|
322
|
-
resumePromptTemplate: (fb) => `RETRY_TOKEN feedback=<${fb ?? 'none'}>`,
|
|
323
|
-
});
|
|
324
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
325
|
-
await agent.invoke('go');
|
|
326
|
-
// The template's output must show up verbatim as a user message; the
|
|
327
|
-
// default English must NOT.
|
|
328
|
-
const userTexts = agent.messages
|
|
329
|
-
.filter((m) => m.role === 'user')
|
|
330
|
-
.flatMap((m) => m.content)
|
|
331
|
-
.flatMap((b) => (b.type === 'textBlock' ? [b.text] : []));
|
|
332
|
-
expect(userTexts.some((t) => t.includes('RETRY_TOKEN feedback=<too long>'))).toBe(true);
|
|
333
|
-
expect(userTexts.some((t) => t.includes('Refine your response'))).toBe(false);
|
|
334
|
-
});
|
|
335
|
-
});
|
|
336
|
-
describe('multiple plugin instances', () => {
|
|
337
|
-
it('shares one plugin across multiple agents with independent run state', async () => {
|
|
338
|
-
// Per-agent run state is keyed off the agent (WeakMap), so concurrent or
|
|
339
|
-
// sequential runs on different agents don't conflate results.
|
|
340
|
-
const m1 = new MockMessageModel()
|
|
341
|
-
.addTurn({ type: 'textBlock', text: 'a1-attempt-1' })
|
|
342
|
-
.addTurn({ type: 'textBlock', text: 'a1-attempt-2' });
|
|
343
|
-
const m2 = new MockMessageModel().addTurn({ type: 'textBlock', text: 'a2-only' });
|
|
344
|
-
let n1 = 0;
|
|
345
|
-
const plugin = new GoalLoop({
|
|
346
|
-
name: 'shared',
|
|
347
|
-
goal: (response) => {
|
|
348
|
-
const text = response.content[0].text;
|
|
349
|
-
if (text.startsWith('a2'))
|
|
350
|
-
return true;
|
|
351
|
-
n1++;
|
|
352
|
-
return n1 === 2;
|
|
353
|
-
},
|
|
354
|
-
maxAttempts: 5,
|
|
355
|
-
});
|
|
356
|
-
const a1 = new Agent({ model: m1, plugins: [plugin], printer: false });
|
|
357
|
-
const a2 = new Agent({ model: m2, plugins: [plugin], printer: false });
|
|
358
|
-
await a1.invoke('first');
|
|
359
|
-
await a2.invoke('second');
|
|
360
|
-
expect(plugin.lastResult(a1)).toEqual({
|
|
361
|
-
passed: true,
|
|
362
|
-
stopReason: 'satisfied',
|
|
363
|
-
attempts: [
|
|
364
|
-
{ attempt: 1, passed: false },
|
|
365
|
-
{ attempt: 2, passed: true },
|
|
366
|
-
],
|
|
367
|
-
});
|
|
368
|
-
expect(plugin.lastResult(a2)).toEqual({
|
|
369
|
-
passed: true,
|
|
370
|
-
stopReason: 'satisfied',
|
|
371
|
-
attempts: [{ attempt: 1, passed: true }],
|
|
372
|
-
});
|
|
373
|
-
});
|
|
374
|
-
it('throws when two GoalLoops are attached to the same agent', async () => {
|
|
375
|
-
// Two GoalLoops both write `event.resume` in AfterInvocationEvent — last
|
|
376
|
-
// writer wins, silently dropping one's feedback. Compose constraints in a
|
|
377
|
-
// single validator function instead.
|
|
378
|
-
const model = new MockMessageModel().addTurn({ type: 'textBlock', text: 'x' });
|
|
379
|
-
const a = new GoalLoop({ goal: () => true, maxAttempts: 1, name: 'first' });
|
|
380
|
-
const b = new GoalLoop({ goal: () => true, maxAttempts: 1, name: 'second' });
|
|
381
|
-
const agent = new Agent({ model, plugins: [a, b], printer: false });
|
|
382
|
-
await expect(agent.invoke('go')).rejects.toThrow(/another GoalLoop is already attached/);
|
|
383
|
-
});
|
|
384
|
-
});
|
|
385
|
-
describe('preserveContext: false', () => {
|
|
386
|
-
it('restores the post-input transcript between attempts; agent never sees prior attempts', async () => {
|
|
387
|
-
const model = new MockMessageModel()
|
|
388
|
-
.addTurn({ type: 'textBlock', text: 'attempt-1' })
|
|
389
|
-
.addTurn({ type: 'textBlock', text: 'attempt-2' })
|
|
390
|
-
.addTurn({ type: 'textBlock', text: 'attempt-3' });
|
|
391
|
-
const messageSnapshots = [];
|
|
392
|
-
let n = 0;
|
|
393
|
-
const plugin = new GoalLoop({
|
|
394
|
-
name: 'fresh-context',
|
|
395
|
-
goal: () => {
|
|
396
|
-
n++;
|
|
397
|
-
return n === 3 ? true : { passed: false, feedback: `fb${n}` };
|
|
398
|
-
},
|
|
399
|
-
maxAttempts: 5,
|
|
400
|
-
preserveContext: false,
|
|
401
|
-
});
|
|
402
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
403
|
-
// Spy on stream to capture the messages array sent to the model on each
|
|
404
|
-
// attempt. With fresh-context on, the model should never see prior
|
|
405
|
-
// assistant attempts in the transcript.
|
|
406
|
-
const originalStream = model.stream.bind(model);
|
|
407
|
-
vi.spyOn(model, 'stream').mockImplementation(async function* (messages, options) {
|
|
408
|
-
messageSnapshots.push(messages.map((m) => ({
|
|
409
|
-
role: m.role,
|
|
410
|
-
text: m.content.flatMap((b) => (b.type === 'textBlock' ? [b.text] : [])).join(''),
|
|
411
|
-
})));
|
|
412
|
-
yield* originalStream(messages, options);
|
|
413
|
-
});
|
|
414
|
-
await agent.invoke('do the thing');
|
|
415
|
-
expect(plugin.lastResult(agent)).toEqual({
|
|
416
|
-
passed: true,
|
|
417
|
-
stopReason: 'satisfied',
|
|
418
|
-
attempts: [
|
|
419
|
-
{ attempt: 1, passed: false, feedback: 'fb1' },
|
|
420
|
-
{ attempt: 2, passed: false, feedback: 'fb2' },
|
|
421
|
-
{ attempt: 3, passed: true },
|
|
422
|
-
],
|
|
423
|
-
});
|
|
424
|
-
// Each attempt's transcript: clean input + accumulated feedback only.
|
|
425
|
-
// The model must never see prior `attempt-N` assistant turns.
|
|
426
|
-
expect(messageSnapshots).toEqual([
|
|
427
|
-
[{ role: 'user', text: 'do the thing' }],
|
|
428
|
-
[
|
|
429
|
-
{ role: 'user', text: 'do the thing' },
|
|
430
|
-
{ role: 'user', text: expect.stringContaining('fb1') },
|
|
431
|
-
],
|
|
432
|
-
[
|
|
433
|
-
{ role: 'user', text: 'do the thing' },
|
|
434
|
-
{ role: 'user', text: expect.stringContaining('fb2') },
|
|
435
|
-
],
|
|
436
|
-
]);
|
|
437
|
-
});
|
|
438
|
-
it('does not roll back appState mutations made during attempts', async () => {
|
|
439
|
-
// Locks in the contract: Ralph mode rewinds *only* messages. Other
|
|
440
|
-
// session-scope state (appState, modelState, systemPrompt, interrupts)
|
|
441
|
-
// accumulates across attempts so other plugins are unaffected.
|
|
442
|
-
const model = new MockMessageModel()
|
|
443
|
-
.addTurn({ type: 'textBlock', text: 'attempt-1' })
|
|
444
|
-
.addTurn({ type: 'textBlock', text: 'attempt-2' });
|
|
445
|
-
let n = 0;
|
|
446
|
-
const plugin = new GoalLoop({
|
|
447
|
-
name: 'fresh-context-appstate',
|
|
448
|
-
goal: () => {
|
|
449
|
-
n++;
|
|
450
|
-
return n === 2 || { passed: false, feedback: 'retry' };
|
|
451
|
-
},
|
|
452
|
-
maxAttempts: 3,
|
|
453
|
-
preserveContext: false,
|
|
454
|
-
});
|
|
455
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
456
|
-
// Mutate appState from a hook that runs between attempts to confirm
|
|
457
|
-
// the mutation survives the rewind.
|
|
458
|
-
agent.appState.set('counter', 0);
|
|
459
|
-
agent.addHook(AfterInvocationEvent, () => {
|
|
460
|
-
const current = agent.appState.get('counter') ?? 0;
|
|
461
|
-
agent.appState.set('counter', current + 1);
|
|
462
|
-
});
|
|
463
|
-
await agent.invoke('go');
|
|
464
|
-
// counter incremented once per AfterInvocationEvent call (one per attempt).
|
|
465
|
-
expect(agent.appState.get('counter')).toBe(2);
|
|
466
|
-
});
|
|
467
|
-
it('preserves context by default (agent sees prior assistant attempts)', async () => {
|
|
468
|
-
const model = new MockMessageModel()
|
|
469
|
-
.addTurn({ type: 'textBlock', text: 'attempt-1' })
|
|
470
|
-
.addTurn({ type: 'textBlock', text: 'attempt-2' });
|
|
471
|
-
let n = 0;
|
|
472
|
-
const plugin = new GoalLoop({
|
|
473
|
-
name: 'fresh-context-off',
|
|
474
|
-
goal: () => {
|
|
475
|
-
n++;
|
|
476
|
-
return n === 2 || { passed: false, feedback: 'fb' };
|
|
477
|
-
},
|
|
478
|
-
maxAttempts: 3,
|
|
479
|
-
});
|
|
480
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
481
|
-
await agent.invoke('go');
|
|
482
|
-
// Default behavior: attempt 2's transcript includes attempt-1's assistant turn.
|
|
483
|
-
const roles = agent.messages.map((m) => m.role);
|
|
484
|
-
expect(roles).toEqual(['user', 'assistant', 'user', 'assistant']);
|
|
485
|
-
});
|
|
486
|
-
});
|
|
487
|
-
describe('cross-invocation lastResult lifecycle', () => {
|
|
488
|
-
it('clears stale lastResult after a thrown invoke when a fresh invoke starts', async () => {
|
|
489
|
-
const model = new MockMessageModel().addTurn(new Error('boom')).addTurn({ type: 'textBlock', text: 'ok' });
|
|
490
|
-
const plugin = new GoalLoop({
|
|
491
|
-
name: 'throw-then-clean',
|
|
492
|
-
goal: () => true,
|
|
493
|
-
maxAttempts: 3,
|
|
494
|
-
});
|
|
495
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
496
|
-
await expect(agent.invoke('first')).rejects.toThrow('boom');
|
|
497
|
-
expect(plugin.lastResult(agent)).toBeUndefined();
|
|
498
|
-
await agent.invoke('second');
|
|
499
|
-
expect(plugin.lastResult(agent)).toEqual({
|
|
500
|
-
passed: true,
|
|
501
|
-
stopReason: 'satisfied',
|
|
502
|
-
attempts: [{ attempt: 1, passed: true }],
|
|
503
|
-
});
|
|
504
|
-
});
|
|
505
|
-
});
|
|
506
|
-
});
|
|
507
|
-
describe('judge helpers', () => {
|
|
508
|
-
it('JUDGE_OUTCOME_SCHEMA validates pass/fail outcome shapes', () => {
|
|
509
|
-
expect(JUDGE_OUTCOME_SCHEMA.parse({ passed: true })).toEqual({ passed: true });
|
|
510
|
-
expect(JUDGE_OUTCOME_SCHEMA.parse({ passed: false, feedback: 'x' })).toEqual({
|
|
511
|
-
passed: false,
|
|
512
|
-
feedback: 'x',
|
|
513
|
-
});
|
|
514
|
-
expect(() => JUDGE_OUTCOME_SCHEMA.parse({ passed: 'yes' })).toThrow();
|
|
515
|
-
});
|
|
516
|
-
it('buildJudgePrompt embeds the goal description and a role-tagged transcript', () => {
|
|
517
|
-
const prompt = buildJudgePrompt('be concise', [
|
|
518
|
-
new Message({ role: 'user', content: [new TextBlock('hello?')] }),
|
|
519
|
-
new Message({ role: 'assistant', content: [new TextBlock('hi there')] }),
|
|
520
|
-
]);
|
|
521
|
-
expect(prompt).toContain('Goal:\nbe concise');
|
|
522
|
-
expect(prompt).toContain('[user]\nhello?');
|
|
523
|
-
expect(prompt).toContain('[assistant]\nhi there');
|
|
524
|
-
});
|
|
525
|
-
it('buildJudgePrompt summarises tool calls and results so the judge can grade tool-using agents', () => {
|
|
526
|
-
const prompt = buildJudgePrompt('ran the tests', [
|
|
527
|
-
new Message({ role: 'user', content: [new TextBlock('run the tests')] }),
|
|
528
|
-
new Message({
|
|
529
|
-
role: 'assistant',
|
|
530
|
-
content: [new ToolUseBlock({ name: 'shell', toolUseId: 't1', input: { cmd: 'npm test' } })],
|
|
531
|
-
}),
|
|
532
|
-
new Message({
|
|
533
|
-
role: 'user',
|
|
534
|
-
content: [
|
|
535
|
-
new ToolResultBlock({
|
|
536
|
-
toolUseId: 't1',
|
|
537
|
-
status: 'success',
|
|
538
|
-
content: [new TextBlock('all green')],
|
|
539
|
-
}),
|
|
540
|
-
],
|
|
541
|
-
}),
|
|
542
|
-
new Message({
|
|
543
|
-
role: 'assistant',
|
|
544
|
-
content: [new ToolUseBlock({ name: 'shell', toolUseId: 't2', input: { cmd: 'echo done' } })],
|
|
545
|
-
}),
|
|
546
|
-
new Message({
|
|
547
|
-
role: 'user',
|
|
548
|
-
content: [
|
|
549
|
-
new ToolResultBlock({
|
|
550
|
-
toolUseId: 't2',
|
|
551
|
-
status: 'error',
|
|
552
|
-
content: [new JsonBlock({ json: { code: 1 } })],
|
|
553
|
-
}),
|
|
554
|
-
],
|
|
555
|
-
}),
|
|
556
|
-
]);
|
|
557
|
-
expect(prompt).toContain('[tool-call: shell] input={"cmd":"npm test"}');
|
|
558
|
-
expect(prompt).toContain('[tool-result: success] all green');
|
|
559
|
-
expect(prompt).toContain('[tool-call: shell] input={"cmd":"echo done"}');
|
|
560
|
-
expect(prompt).toContain('[tool-result: error] {"code":1}');
|
|
561
|
-
});
|
|
562
|
-
it('buildJudgePrompt truncates very long tool inputs and outputs', () => {
|
|
563
|
-
const longInput = 'x'.repeat(2000);
|
|
564
|
-
const prompt = buildJudgePrompt('ok', [
|
|
565
|
-
new Message({
|
|
566
|
-
role: 'assistant',
|
|
567
|
-
content: [new ToolUseBlock({ name: 'shell', toolUseId: 't1', input: { data: longInput } })],
|
|
568
|
-
}),
|
|
569
|
-
]);
|
|
570
|
-
expect(prompt).toContain('… [');
|
|
571
|
-
expect(prompt).toContain('more chars]');
|
|
572
|
-
expect(prompt.length).toBeLessThan(longInput.length);
|
|
573
|
-
});
|
|
574
|
-
});
|
|
575
|
-
// String-validator (NL judge) integration tests use the same MockMessageModel
|
|
576
|
-
// pattern: the host agent's model is mocked, and the judge agent — which the
|
|
577
|
-
// plugin builds internally — shares that mock model. Each `judge.invoke` consumes
|
|
578
|
-
// a turn from the model, returning a `strands_structured_output` tool use that the
|
|
579
|
-
// agent loop validates against JUDGE_OUTCOME_SCHEMA.
|
|
580
|
-
describe('GoalLoop natural-language judge', () => {
|
|
581
|
-
let judgeCallCount = 0;
|
|
582
|
-
function buildJudgeTurn(passed, feedback) {
|
|
583
|
-
const input = feedback !== undefined ? { passed, feedback } : { passed };
|
|
584
|
-
return [
|
|
585
|
-
{
|
|
586
|
-
type: 'toolUseBlock',
|
|
587
|
-
name: 'strands_structured_output',
|
|
588
|
-
toolUseId: `judge-${++judgeCallCount}`,
|
|
589
|
-
input,
|
|
590
|
-
},
|
|
591
|
-
];
|
|
592
|
-
}
|
|
593
|
-
it('judges via the host agent model by default; passing on first attempt', async () => {
|
|
594
|
-
const model = new MockMessageModel()
|
|
595
|
-
.addTurn({ type: 'textBlock', text: 'rainbows are pretty' })
|
|
596
|
-
.addTurn(...buildJudgeTurn(true));
|
|
597
|
-
const plugin = new GoalLoop({
|
|
598
|
-
name: 'nl-default-pass',
|
|
599
|
-
goal: 'be concise',
|
|
600
|
-
maxAttempts: 3,
|
|
601
|
-
});
|
|
602
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
603
|
-
await agent.invoke('explain rainbows');
|
|
604
|
-
expect(plugin.lastResult(agent)).toEqual({
|
|
605
|
-
passed: true,
|
|
606
|
-
stopReason: 'satisfied',
|
|
607
|
-
attempts: [{ attempt: 1, passed: true }],
|
|
608
|
-
});
|
|
609
|
-
});
|
|
610
|
-
it('feeds judge feedback back to the host agent', async () => {
|
|
611
|
-
const model = new MockMessageModel()
|
|
612
|
-
.addTurn({ type: 'textBlock', text: 'first try (long)' })
|
|
613
|
-
.addTurn(...buildJudgeTurn(false, 'too long'))
|
|
614
|
-
.addTurn({ type: 'textBlock', text: 'second try (short)' })
|
|
615
|
-
.addTurn(...buildJudgeTurn(true));
|
|
616
|
-
const plugin = new GoalLoop({
|
|
617
|
-
name: 'nl-feedback',
|
|
618
|
-
goal: 'be concise',
|
|
619
|
-
maxAttempts: 3,
|
|
620
|
-
});
|
|
621
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
622
|
-
await agent.invoke('explain something');
|
|
623
|
-
expect(plugin.lastResult(agent)).toEqual({
|
|
624
|
-
passed: true,
|
|
625
|
-
stopReason: 'satisfied',
|
|
626
|
-
attempts: [
|
|
627
|
-
{ attempt: 1, passed: false, feedback: 'too long' },
|
|
628
|
-
{ attempt: 2, passed: true },
|
|
629
|
-
],
|
|
630
|
-
});
|
|
631
|
-
const userTexts = agent.messages
|
|
632
|
-
.filter((m) => m.role === 'user')
|
|
633
|
-
.flatMap((m) => m.content)
|
|
634
|
-
.flatMap((b) => (b.type === 'textBlock' ? [b.text] : []));
|
|
635
|
-
expect(userTexts.some((t) => t.includes('too long'))).toBe(true);
|
|
636
|
-
});
|
|
637
|
-
it('passes when the judge replies with plain text first and the structured-output retry yields a tool call', async () => {
|
|
638
|
-
const model = new MockMessageModel()
|
|
639
|
-
.addTurn({ type: 'textBlock', text: 'response' })
|
|
640
|
-
.addTurn({ type: 'textBlock', text: 'judge says hi (no tool)' })
|
|
641
|
-
.addTurn(...buildJudgeTurn(true));
|
|
642
|
-
const plugin = new GoalLoop({
|
|
643
|
-
name: 'nl-judge-passes-on-retry',
|
|
644
|
-
goal: 'be concise',
|
|
645
|
-
maxAttempts: 3,
|
|
646
|
-
});
|
|
647
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
648
|
-
await agent.invoke('go');
|
|
649
|
-
expect(plugin.lastResult(agent)).toEqual({
|
|
650
|
-
passed: true,
|
|
651
|
-
stopReason: 'satisfied',
|
|
652
|
-
attempts: [{ attempt: 1, passed: true }],
|
|
653
|
-
});
|
|
654
|
-
});
|
|
655
|
-
it('builds a fresh judge agent per validation, not leaking prior prompts', async () => {
|
|
656
|
-
const model = new MockMessageModel()
|
|
657
|
-
.addTurn({ type: 'textBlock', text: 'attempt-1-host' })
|
|
658
|
-
.addTurn(...buildJudgeTurn(false, 'fb-1'))
|
|
659
|
-
.addTurn({ type: 'textBlock', text: 'attempt-2-host' })
|
|
660
|
-
.addTurn(...buildJudgeTurn(true));
|
|
661
|
-
const messageLengths = [];
|
|
662
|
-
const originalStream = model.stream.bind(model);
|
|
663
|
-
vi.spyOn(model, 'stream').mockImplementation(async function* (messages, options) {
|
|
664
|
-
messageLengths.push(messages.length);
|
|
665
|
-
yield* originalStream(messages, options);
|
|
666
|
-
});
|
|
667
|
-
const plugin = new GoalLoop({
|
|
668
|
-
name: 'nl-fresh-judge-per-call',
|
|
669
|
-
goal: 'be concise',
|
|
670
|
-
maxAttempts: 3,
|
|
671
|
-
});
|
|
672
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
673
|
-
await agent.invoke('initial');
|
|
674
|
-
expect(plugin.lastResult(agent)).toEqual({
|
|
675
|
-
passed: true,
|
|
676
|
-
stopReason: 'satisfied',
|
|
677
|
-
attempts: [
|
|
678
|
-
{ attempt: 1, passed: false, feedback: 'fb-1' },
|
|
679
|
-
{ attempt: 2, passed: true },
|
|
680
|
-
],
|
|
681
|
-
});
|
|
682
|
-
// Stream calls in order: host-1 (1 msg), judge-1 (1 msg), host-2 (3 msgs:
|
|
683
|
-
// user+assistant+user-feedback), judge-2 (1 msg). The 1s on the judge calls
|
|
684
|
-
// confirm a fresh Agent — accumulated state would push the second to >1.
|
|
685
|
-
expect(messageLengths).toEqual([1, 1, 3, 1]);
|
|
686
|
-
});
|
|
687
|
-
it('uses judge.model override when provided (different model instance)', async () => {
|
|
688
|
-
const hostModel = new MockMessageModel().addTurn({ type: 'textBlock', text: 'response' });
|
|
689
|
-
const judgeModel = new MockMessageModel().addTurn(...buildJudgeTurn(true));
|
|
690
|
-
const hostSpy = vi.spyOn(hostModel, 'stream');
|
|
691
|
-
const judgeSpy = vi.spyOn(judgeModel, 'stream');
|
|
692
|
-
const plugin = new GoalLoop({
|
|
693
|
-
name: 'nl-override-model',
|
|
694
|
-
goal: 'be concise',
|
|
695
|
-
judge: { model: judgeModel },
|
|
696
|
-
maxAttempts: 1,
|
|
697
|
-
});
|
|
698
|
-
const agent = new Agent({ model: hostModel, plugins: [plugin], printer: false });
|
|
699
|
-
await agent.invoke('go');
|
|
700
|
-
expect(plugin.lastResult(agent)).toEqual({
|
|
701
|
-
passed: true,
|
|
702
|
-
stopReason: 'satisfied',
|
|
703
|
-
attempts: [{ attempt: 1, passed: true }],
|
|
704
|
-
});
|
|
705
|
-
expect(hostSpy).toHaveBeenCalledTimes(1);
|
|
706
|
-
expect(judgeSpy).toHaveBeenCalledTimes(1);
|
|
707
|
-
});
|
|
708
|
-
it('uses judge.systemPrompt override as the judge agent system prompt', async () => {
|
|
709
|
-
const model = new MockMessageModel()
|
|
710
|
-
.addTurn({ type: 'textBlock', text: 'response' })
|
|
711
|
-
.addTurn(...buildJudgeTurn(true));
|
|
712
|
-
// The judge agent is built internally; the only way it reaches the model is
|
|
713
|
-
// via the system prompt threaded into the stream call. Assert the override
|
|
714
|
-
// shows up there.
|
|
715
|
-
const systemPrompts = [];
|
|
716
|
-
const originalStream = model.stream.bind(model);
|
|
717
|
-
vi.spyOn(model, 'stream').mockImplementation(async function* (messages, options) {
|
|
718
|
-
systemPrompts.push(options?.systemPrompt);
|
|
719
|
-
yield* originalStream(messages, options);
|
|
720
|
-
});
|
|
721
|
-
const plugin = new GoalLoop({
|
|
722
|
-
name: 'nl-override-system-prompt',
|
|
723
|
-
goal: 'be concise',
|
|
724
|
-
judge: { systemPrompt: 'CUSTOM_JUDGE_RUBRIC_MARKER' },
|
|
725
|
-
maxAttempts: 1,
|
|
726
|
-
});
|
|
727
|
-
const agent = new Agent({ model, plugins: [plugin], printer: false });
|
|
728
|
-
await agent.invoke('go');
|
|
729
|
-
// Stream call order: host turn (no judge system prompt), then judge turn
|
|
730
|
-
// (carrying the override).
|
|
731
|
-
expect(systemPrompts).toContain('CUSTOM_JUDGE_RUBRIC_MARKER');
|
|
732
|
-
});
|
|
733
|
-
});
|
|
734
|
-
const _typeCheck = { attempt: 1, passed: true };
|
|
735
|
-
void _typeCheck;
|
|
736
|
-
//# sourceMappingURL=plugin.test.js.map
|