attocode 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/LICENSE +21 -0
- package/README.md +164 -0
- package/dist/src/adapters.d.ts +83 -0
- package/dist/src/adapters.d.ts.map +1 -0
- package/dist/src/adapters.js +221 -0
- package/dist/src/adapters.js.map +1 -0
- package/dist/src/agent-tools/index.d.ts +7 -0
- package/dist/src/agent-tools/index.d.ts.map +1 -0
- package/dist/src/agent-tools/index.js +8 -0
- package/dist/src/agent-tools/index.js.map +1 -0
- package/dist/src/agent-tools/lsp-file-tools.d.ts +33 -0
- package/dist/src/agent-tools/lsp-file-tools.d.ts.map +1 -0
- package/dist/src/agent-tools/lsp-file-tools.js +200 -0
- package/dist/src/agent-tools/lsp-file-tools.js.map +1 -0
- package/dist/src/agent.d.ts +667 -0
- package/dist/src/agent.d.ts.map +1 -0
- package/dist/src/agent.js +2824 -0
- package/dist/src/agent.js.map +1 -0
- package/dist/src/cli.d.ts +36 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +176 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/commands/handler.d.ts +22 -0
- package/dist/src/commands/handler.d.ts.map +1 -0
- package/dist/src/commands/handler.js +1320 -0
- package/dist/src/commands/handler.js.map +1 -0
- package/dist/src/commands/init.d.ts +7 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +153 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/types.d.ts +70 -0
- package/dist/src/commands/types.d.ts.map +1 -0
- package/dist/src/commands/types.js +8 -0
- package/dist/src/commands/types.js.map +1 -0
- package/dist/src/config.d.ts +22 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +25 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/core/index.d.ts +32 -0
- package/dist/src/core/index.d.ts.map +1 -0
- package/dist/src/core/index.js +35 -0
- package/dist/src/core/index.js.map +1 -0
- package/dist/src/core/process-handlers.d.ts +43 -0
- package/dist/src/core/process-handlers.d.ts.map +1 -0
- package/dist/src/core/process-handlers.js +117 -0
- package/dist/src/core/process-handlers.js.map +1 -0
- package/dist/src/core/protocol/bridge.d.ts +117 -0
- package/dist/src/core/protocol/bridge.d.ts.map +1 -0
- package/dist/src/core/protocol/bridge.js +149 -0
- package/dist/src/core/protocol/bridge.js.map +1 -0
- package/dist/src/core/protocol/index.d.ts +8 -0
- package/dist/src/core/protocol/index.d.ts.map +1 -0
- package/dist/src/core/protocol/index.js +8 -0
- package/dist/src/core/protocol/index.js.map +1 -0
- package/dist/src/core/protocol/types.d.ts +539 -0
- package/dist/src/core/protocol/types.d.ts.map +1 -0
- package/dist/src/core/protocol/types.js +149 -0
- package/dist/src/core/protocol/types.js.map +1 -0
- package/dist/src/core/queues/atomic-counter.d.ts +36 -0
- package/dist/src/core/queues/atomic-counter.d.ts.map +1 -0
- package/dist/src/core/queues/atomic-counter.js +46 -0
- package/dist/src/core/queues/atomic-counter.js.map +1 -0
- package/dist/src/core/queues/event-queue.d.ts +126 -0
- package/dist/src/core/queues/event-queue.d.ts.map +1 -0
- package/dist/src/core/queues/event-queue.js +208 -0
- package/dist/src/core/queues/event-queue.js.map +1 -0
- package/dist/src/core/queues/index.d.ts +12 -0
- package/dist/src/core/queues/index.d.ts.map +1 -0
- package/dist/src/core/queues/index.js +15 -0
- package/dist/src/core/queues/index.js.map +1 -0
- package/dist/src/core/queues/submission-queue.d.ts +116 -0
- package/dist/src/core/queues/submission-queue.d.ts.map +1 -0
- package/dist/src/core/queues/submission-queue.js +236 -0
- package/dist/src/core/queues/submission-queue.js.map +1 -0
- package/dist/src/costs/index.d.ts +22 -0
- package/dist/src/costs/index.d.ts.map +1 -0
- package/dist/src/costs/index.js +22 -0
- package/dist/src/costs/index.js.map +1 -0
- package/dist/src/costs/model-registry.d.ts +80 -0
- package/dist/src/costs/model-registry.d.ts.map +1 -0
- package/dist/src/costs/model-registry.js +237 -0
- package/dist/src/costs/model-registry.js.map +1 -0
- package/dist/src/costs/types.d.ts +50 -0
- package/dist/src/costs/types.d.ts.map +1 -0
- package/dist/src/costs/types.js +2 -0
- package/dist/src/costs/types.js.map +1 -0
- package/dist/src/defaults.d.ts +114 -0
- package/dist/src/defaults.d.ts.map +1 -0
- package/dist/src/defaults.js +457 -0
- package/dist/src/defaults.js.map +1 -0
- package/dist/src/first-run.d.ts +35 -0
- package/dist/src/first-run.d.ts.map +1 -0
- package/dist/src/first-run.js +94 -0
- package/dist/src/first-run.js.map +1 -0
- package/dist/src/hello.d.ts +2 -0
- package/dist/src/hello.d.ts.map +1 -0
- package/dist/src/hello.js +4 -0
- package/dist/src/hello.js.map +1 -0
- package/dist/src/integrations/agent-registry.d.ts +160 -0
- package/dist/src/integrations/agent-registry.d.ts.map +1 -0
- package/dist/src/integrations/agent-registry.js +446 -0
- package/dist/src/integrations/agent-registry.js.map +1 -0
- package/dist/src/integrations/auto-compaction.d.ts +177 -0
- package/dist/src/integrations/auto-compaction.d.ts.map +1 -0
- package/dist/src/integrations/auto-compaction.js +428 -0
- package/dist/src/integrations/auto-compaction.js.map +1 -0
- package/dist/src/integrations/cancellation.d.ts +162 -0
- package/dist/src/integrations/cancellation.d.ts.map +1 -0
- package/dist/src/integrations/cancellation.js +339 -0
- package/dist/src/integrations/cancellation.js.map +1 -0
- package/dist/src/integrations/codebase-context.d.ts +319 -0
- package/dist/src/integrations/codebase-context.d.ts.map +1 -0
- package/dist/src/integrations/codebase-context.js +816 -0
- package/dist/src/integrations/codebase-context.js.map +1 -0
- package/dist/src/integrations/compaction.d.ts +192 -0
- package/dist/src/integrations/compaction.d.ts.map +1 -0
- package/dist/src/integrations/compaction.js +376 -0
- package/dist/src/integrations/compaction.js.map +1 -0
- package/dist/src/integrations/context-engineering.d.ts +246 -0
- package/dist/src/integrations/context-engineering.d.ts.map +1 -0
- package/dist/src/integrations/context-engineering.js +394 -0
- package/dist/src/integrations/context-engineering.js.map +1 -0
- package/dist/src/integrations/diff-utils.d.ts +105 -0
- package/dist/src/integrations/diff-utils.d.ts.map +1 -0
- package/dist/src/integrations/diff-utils.js +497 -0
- package/dist/src/integrations/diff-utils.js.map +1 -0
- package/dist/src/integrations/economics.d.ts +192 -0
- package/dist/src/integrations/economics.d.ts.map +1 -0
- package/dist/src/integrations/economics.js +431 -0
- package/dist/src/integrations/economics.js.map +1 -0
- package/dist/src/integrations/execution-policy.d.ts +189 -0
- package/dist/src/integrations/execution-policy.d.ts.map +1 -0
- package/dist/src/integrations/execution-policy.js +352 -0
- package/dist/src/integrations/execution-policy.js.map +1 -0
- package/dist/src/integrations/file-change-tracker.d.ts +161 -0
- package/dist/src/integrations/file-change-tracker.d.ts.map +1 -0
- package/dist/src/integrations/file-change-tracker.js +520 -0
- package/dist/src/integrations/file-change-tracker.js.map +1 -0
- package/dist/src/integrations/hierarchical-config.d.ts +212 -0
- package/dist/src/integrations/hierarchical-config.d.ts.map +1 -0
- package/dist/src/integrations/hierarchical-config.js +484 -0
- package/dist/src/integrations/hierarchical-config.js.map +1 -0
- package/dist/src/integrations/hooks.d.ts +114 -0
- package/dist/src/integrations/hooks.d.ts.map +1 -0
- package/dist/src/integrations/hooks.js +326 -0
- package/dist/src/integrations/hooks.js.map +1 -0
- package/dist/src/integrations/ignore.d.ts +143 -0
- package/dist/src/integrations/ignore.d.ts.map +1 -0
- package/dist/src/integrations/ignore.js +417 -0
- package/dist/src/integrations/ignore.js.map +1 -0
- package/dist/src/integrations/image-renderer.d.ts +119 -0
- package/dist/src/integrations/image-renderer.d.ts.map +1 -0
- package/dist/src/integrations/image-renderer.js +306 -0
- package/dist/src/integrations/image-renderer.js.map +1 -0
- package/dist/src/integrations/index.d.ts +42 -0
- package/dist/src/integrations/index.d.ts.map +1 -0
- package/dist/src/integrations/index.js +73 -0
- package/dist/src/integrations/index.js.map +1 -0
- package/dist/src/integrations/lsp.d.ts +196 -0
- package/dist/src/integrations/lsp.d.ts.map +1 -0
- package/dist/src/integrations/lsp.js +582 -0
- package/dist/src/integrations/lsp.js.map +1 -0
- package/dist/src/integrations/mcp-client.d.ts +270 -0
- package/dist/src/integrations/mcp-client.d.ts.map +1 -0
- package/dist/src/integrations/mcp-client.js +698 -0
- package/dist/src/integrations/mcp-client.js.map +1 -0
- package/dist/src/integrations/mcp-tool-search.d.ts +77 -0
- package/dist/src/integrations/mcp-tool-search.d.ts.map +1 -0
- package/dist/src/integrations/mcp-tool-search.js +220 -0
- package/dist/src/integrations/mcp-tool-search.js.map +1 -0
- package/dist/src/integrations/memory.d.ts +108 -0
- package/dist/src/integrations/memory.d.ts.map +1 -0
- package/dist/src/integrations/memory.js +288 -0
- package/dist/src/integrations/memory.js.map +1 -0
- package/dist/src/integrations/multi-agent.d.ts +150 -0
- package/dist/src/integrations/multi-agent.d.ts.map +1 -0
- package/dist/src/integrations/multi-agent.js +306 -0
- package/dist/src/integrations/multi-agent.js.map +1 -0
- package/dist/src/integrations/observability.d.ts +162 -0
- package/dist/src/integrations/observability.d.ts.map +1 -0
- package/dist/src/integrations/observability.js +406 -0
- package/dist/src/integrations/observability.js.map +1 -0
- package/dist/src/integrations/openrouter-pricing.d.ts +42 -0
- package/dist/src/integrations/openrouter-pricing.d.ts.map +1 -0
- package/dist/src/integrations/openrouter-pricing.js +124 -0
- package/dist/src/integrations/openrouter-pricing.js.map +1 -0
- package/dist/src/integrations/pending-plan.d.ts +171 -0
- package/dist/src/integrations/pending-plan.d.ts.map +1 -0
- package/dist/src/integrations/pending-plan.js +244 -0
- package/dist/src/integrations/pending-plan.js.map +1 -0
- package/dist/src/integrations/persistence.d.ts +48 -0
- package/dist/src/integrations/persistence.d.ts.map +1 -0
- package/dist/src/integrations/persistence.js +196 -0
- package/dist/src/integrations/persistence.js.map +1 -0
- package/dist/src/integrations/planning.d.ts +96 -0
- package/dist/src/integrations/planning.d.ts.map +1 -0
- package/dist/src/integrations/planning.js +338 -0
- package/dist/src/integrations/planning.js.map +1 -0
- package/dist/src/integrations/pty-shell.d.ts +169 -0
- package/dist/src/integrations/pty-shell.d.ts.map +1 -0
- package/dist/src/integrations/pty-shell.js +367 -0
- package/dist/src/integrations/pty-shell.js.map +1 -0
- package/dist/src/integrations/react.d.ts +139 -0
- package/dist/src/integrations/react.d.ts.map +1 -0
- package/dist/src/integrations/react.js +273 -0
- package/dist/src/integrations/react.js.map +1 -0
- package/dist/src/integrations/resources.d.ts +177 -0
- package/dist/src/integrations/resources.d.ts.map +1 -0
- package/dist/src/integrations/resources.js +311 -0
- package/dist/src/integrations/resources.js.map +1 -0
- package/dist/src/integrations/result-synthesizer.d.ts +389 -0
- package/dist/src/integrations/result-synthesizer.d.ts.map +1 -0
- package/dist/src/integrations/result-synthesizer.js +951 -0
- package/dist/src/integrations/result-synthesizer.js.map +1 -0
- package/dist/src/integrations/routing.d.ts +117 -0
- package/dist/src/integrations/routing.d.ts.map +1 -0
- package/dist/src/integrations/routing.js +347 -0
- package/dist/src/integrations/routing.js.map +1 -0
- package/dist/src/integrations/rules.d.ts +131 -0
- package/dist/src/integrations/rules.d.ts.map +1 -0
- package/dist/src/integrations/rules.js +284 -0
- package/dist/src/integrations/rules.js.map +1 -0
- package/dist/src/integrations/safety.d.ts +142 -0
- package/dist/src/integrations/safety.d.ts.map +1 -0
- package/dist/src/integrations/safety.js +342 -0
- package/dist/src/integrations/safety.js.map +1 -0
- package/dist/src/integrations/sandbox/basic.d.ts +74 -0
- package/dist/src/integrations/sandbox/basic.d.ts.map +1 -0
- package/dist/src/integrations/sandbox/basic.js +310 -0
- package/dist/src/integrations/sandbox/basic.js.map +1 -0
- package/dist/src/integrations/sandbox/docker.d.ts +94 -0
- package/dist/src/integrations/sandbox/docker.d.ts.map +1 -0
- package/dist/src/integrations/sandbox/docker.js +293 -0
- package/dist/src/integrations/sandbox/docker.js.map +1 -0
- package/dist/src/integrations/sandbox/index.d.ts +182 -0
- package/dist/src/integrations/sandbox/index.d.ts.map +1 -0
- package/dist/src/integrations/sandbox/index.js +382 -0
- package/dist/src/integrations/sandbox/index.js.map +1 -0
- package/dist/src/integrations/sandbox/landlock.d.ts +59 -0
- package/dist/src/integrations/sandbox/landlock.d.ts.map +1 -0
- package/dist/src/integrations/sandbox/landlock.js +326 -0
- package/dist/src/integrations/sandbox/landlock.js.map +1 -0
- package/dist/src/integrations/sandbox/seatbelt.d.ts +68 -0
- package/dist/src/integrations/sandbox/seatbelt.d.ts.map +1 -0
- package/dist/src/integrations/sandbox/seatbelt.js +298 -0
- package/dist/src/integrations/sandbox/seatbelt.js.map +1 -0
- package/dist/src/integrations/semantic-cache.d.ts +178 -0
- package/dist/src/integrations/semantic-cache.d.ts.map +1 -0
- package/dist/src/integrations/semantic-cache.js +372 -0
- package/dist/src/integrations/semantic-cache.js.map +1 -0
- package/dist/src/integrations/session-store.d.ts +183 -0
- package/dist/src/integrations/session-store.d.ts.map +1 -0
- package/dist/src/integrations/session-store.js +345 -0
- package/dist/src/integrations/session-store.js.map +1 -0
- package/dist/src/integrations/shared-blackboard.d.ts +403 -0
- package/dist/src/integrations/shared-blackboard.d.ts.map +1 -0
- package/dist/src/integrations/shared-blackboard.js +710 -0
- package/dist/src/integrations/shared-blackboard.js.map +1 -0
- package/dist/src/integrations/skills.d.ts +171 -0
- package/dist/src/integrations/skills.d.ts.map +1 -0
- package/dist/src/integrations/skills.js +403 -0
- package/dist/src/integrations/skills.js.map +1 -0
- package/dist/src/integrations/smart-decomposer.d.ts +322 -0
- package/dist/src/integrations/smart-decomposer.d.ts.map +1 -0
- package/dist/src/integrations/smart-decomposer.js +856 -0
- package/dist/src/integrations/smart-decomposer.js.map +1 -0
- package/dist/src/integrations/sourcegraph.d.ts +169 -0
- package/dist/src/integrations/sourcegraph.d.ts.map +1 -0
- package/dist/src/integrations/sourcegraph.js +379 -0
- package/dist/src/integrations/sourcegraph.js.map +1 -0
- package/dist/src/integrations/sqlite-store.d.ts +518 -0
- package/dist/src/integrations/sqlite-store.d.ts.map +1 -0
- package/dist/src/integrations/sqlite-store.js +1423 -0
- package/dist/src/integrations/sqlite-store.js.map +1 -0
- package/dist/src/integrations/streaming.d.ts +102 -0
- package/dist/src/integrations/streaming.d.ts.map +1 -0
- package/dist/src/integrations/streaming.js +362 -0
- package/dist/src/integrations/streaming.js.map +1 -0
- package/dist/src/integrations/thread-manager.d.ts +199 -0
- package/dist/src/integrations/thread-manager.d.ts.map +1 -0
- package/dist/src/integrations/thread-manager.js +357 -0
- package/dist/src/integrations/thread-manager.js.map +1 -0
- package/dist/src/main.d.ts +26 -0
- package/dist/src/main.d.ts.map +1 -0
- package/dist/src/main.js +170 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/modes/index.d.ts +10 -0
- package/dist/src/modes/index.d.ts.map +1 -0
- package/dist/src/modes/index.js +10 -0
- package/dist/src/modes/index.js.map +1 -0
- package/dist/src/modes/repl.d.ts +19 -0
- package/dist/src/modes/repl.d.ts.map +1 -0
- package/dist/src/modes/repl.js +393 -0
- package/dist/src/modes/repl.js.map +1 -0
- package/dist/src/modes/tui.d.ts +29 -0
- package/dist/src/modes/tui.d.ts.map +1 -0
- package/dist/src/modes/tui.js +272 -0
- package/dist/src/modes/tui.js.map +1 -0
- package/dist/src/modes.d.ts +179 -0
- package/dist/src/modes.d.ts.map +1 -0
- package/dist/src/modes.js +385 -0
- package/dist/src/modes.js.map +1 -0
- package/dist/src/observability/tracer.d.ts +111 -0
- package/dist/src/observability/tracer.d.ts.map +1 -0
- package/dist/src/observability/tracer.js +300 -0
- package/dist/src/observability/tracer.js.map +1 -0
- package/dist/src/observability/types.d.ts +271 -0
- package/dist/src/observability/types.d.ts.map +1 -0
- package/dist/src/observability/types.js +24 -0
- package/dist/src/observability/types.js.map +1 -0
- package/dist/src/paths.d.ts +101 -0
- package/dist/src/paths.d.ts.map +1 -0
- package/dist/src/paths.js +148 -0
- package/dist/src/paths.js.map +1 -0
- package/dist/src/persistence/index.d.ts +38 -0
- package/dist/src/persistence/index.d.ts.map +1 -0
- package/dist/src/persistence/index.js +48 -0
- package/dist/src/persistence/index.js.map +1 -0
- package/dist/src/persistence/migrator.d.ts +135 -0
- package/dist/src/persistence/migrator.d.ts.map +1 -0
- package/dist/src/persistence/migrator.js +303 -0
- package/dist/src/persistence/migrator.js.map +1 -0
- package/dist/src/persistence/schema.d.ts +101 -0
- package/dist/src/persistence/schema.d.ts.map +1 -0
- package/dist/src/persistence/schema.js +395 -0
- package/dist/src/persistence/schema.js.map +1 -0
- package/dist/src/providers/adapters/anthropic.d.ts +20 -0
- package/dist/src/providers/adapters/anthropic.d.ts.map +1 -0
- package/dist/src/providers/adapters/anthropic.js +124 -0
- package/dist/src/providers/adapters/anthropic.js.map +1 -0
- package/dist/src/providers/adapters/mock.d.ts +25 -0
- package/dist/src/providers/adapters/mock.d.ts.map +1 -0
- package/dist/src/providers/adapters/mock.js +133 -0
- package/dist/src/providers/adapters/mock.js.map +1 -0
- package/dist/src/providers/adapters/openai.d.ts +21 -0
- package/dist/src/providers/adapters/openai.d.ts.map +1 -0
- package/dist/src/providers/adapters/openai.js +126 -0
- package/dist/src/providers/adapters/openai.js.map +1 -0
- package/dist/src/providers/adapters/openrouter.d.ts +49 -0
- package/dist/src/providers/adapters/openrouter.d.ts.map +1 -0
- package/dist/src/providers/adapters/openrouter.js +363 -0
- package/dist/src/providers/adapters/openrouter.js.map +1 -0
- package/dist/src/providers/provider.d.ts +54 -0
- package/dist/src/providers/provider.d.ts.map +1 -0
- package/dist/src/providers/provider.js +111 -0
- package/dist/src/providers/provider.js.map +1 -0
- package/dist/src/providers/resilient-fetch.d.ts +99 -0
- package/dist/src/providers/resilient-fetch.d.ts.map +1 -0
- package/dist/src/providers/resilient-fetch.js +208 -0
- package/dist/src/providers/resilient-fetch.js.map +1 -0
- package/dist/src/providers/types.d.ts +227 -0
- package/dist/src/providers/types.d.ts.map +1 -0
- package/dist/src/providers/types.js +24 -0
- package/dist/src/providers/types.js.map +1 -0
- package/dist/src/session-picker.d.ts +28 -0
- package/dist/src/session-picker.d.ts.map +1 -0
- package/dist/src/session-picker.js +256 -0
- package/dist/src/session-picker.js.map +1 -0
- package/dist/src/test-sqlite.d.ts +2 -0
- package/dist/src/test-sqlite.d.ts.map +1 -0
- package/dist/src/test-sqlite.js +114 -0
- package/dist/src/test-sqlite.js.map +1 -0
- package/dist/src/tools/agent.d.ts +44 -0
- package/dist/src/tools/agent.d.ts.map +1 -0
- package/dist/src/tools/agent.js +110 -0
- package/dist/src/tools/agent.js.map +1 -0
- package/dist/src/tools/bash.d.ts +52 -0
- package/dist/src/tools/bash.d.ts.map +1 -0
- package/dist/src/tools/bash.js +141 -0
- package/dist/src/tools/bash.js.map +1 -0
- package/dist/src/tools/file.d.ts +47 -0
- package/dist/src/tools/file.d.ts.map +1 -0
- package/dist/src/tools/file.js +263 -0
- package/dist/src/tools/file.js.map +1 -0
- package/dist/src/tools/permission.d.ts +43 -0
- package/dist/src/tools/permission.d.ts.map +1 -0
- package/dist/src/tools/permission.js +216 -0
- package/dist/src/tools/permission.js.map +1 -0
- package/dist/src/tools/registry.d.ts +63 -0
- package/dist/src/tools/registry.d.ts.map +1 -0
- package/dist/src/tools/registry.js +250 -0
- package/dist/src/tools/registry.js.map +1 -0
- package/dist/src/tools/standard.d.ts +57 -0
- package/dist/src/tools/standard.d.ts.map +1 -0
- package/dist/src/tools/standard.js +113 -0
- package/dist/src/tools/standard.js.map +1 -0
- package/dist/src/tools/types.d.ts +146 -0
- package/dist/src/tools/types.d.ts.map +1 -0
- package/dist/src/tools/types.js +28 -0
- package/dist/src/tools/types.js.map +1 -0
- package/dist/src/tools/undo.d.ts +71 -0
- package/dist/src/tools/undo.d.ts.map +1 -0
- package/dist/src/tools/undo.js +123 -0
- package/dist/src/tools/undo.js.map +1 -0
- package/dist/src/tracing/cache-boundary-tracker.d.ts +189 -0
- package/dist/src/tracing/cache-boundary-tracker.d.ts.map +1 -0
- package/dist/src/tracing/cache-boundary-tracker.js +411 -0
- package/dist/src/tracing/cache-boundary-tracker.js.map +1 -0
- package/dist/src/tracing/trace-collector.d.ts +274 -0
- package/dist/src/tracing/trace-collector.d.ts.map +1 -0
- package/dist/src/tracing/trace-collector.js +727 -0
- package/dist/src/tracing/trace-collector.js.map +1 -0
- package/dist/src/tracing/types.d.ts +657 -0
- package/dist/src/tracing/types.d.ts.map +1 -0
- package/dist/src/tracing/types.js +39 -0
- package/dist/src/tracing/types.js.map +1 -0
- package/dist/src/tricks/failure-evidence.d.ts +268 -0
- package/dist/src/tricks/failure-evidence.d.ts.map +1 -0
- package/dist/src/tricks/failure-evidence.js +544 -0
- package/dist/src/tricks/failure-evidence.js.map +1 -0
- package/dist/src/tricks/json-utils.d.ts +77 -0
- package/dist/src/tricks/json-utils.d.ts.map +1 -0
- package/dist/src/tricks/json-utils.js +247 -0
- package/dist/src/tricks/json-utils.js.map +1 -0
- package/dist/src/tricks/kv-cache-context.d.ts +227 -0
- package/dist/src/tricks/kv-cache-context.d.ts.map +1 -0
- package/dist/src/tricks/kv-cache-context.js +377 -0
- package/dist/src/tricks/kv-cache-context.js.map +1 -0
- package/dist/src/tricks/recitation.d.ts +208 -0
- package/dist/src/tricks/recitation.d.ts.map +1 -0
- package/dist/src/tricks/recitation.js +374 -0
- package/dist/src/tricks/recitation.js.map +1 -0
- package/dist/src/tricks/reversible-compaction.d.ts +251 -0
- package/dist/src/tricks/reversible-compaction.d.ts.map +1 -0
- package/dist/src/tricks/reversible-compaction.js +555 -0
- package/dist/src/tricks/reversible-compaction.js.map +1 -0
- package/dist/src/tricks/serialization-diversity.d.ts +197 -0
- package/dist/src/tricks/serialization-diversity.d.ts.map +1 -0
- package/dist/src/tricks/serialization-diversity.js +460 -0
- package/dist/src/tricks/serialization-diversity.js.map +1 -0
- package/dist/src/tui/app.d.ts +42 -0
- package/dist/src/tui/app.d.ts.map +1 -0
- package/dist/src/tui/app.js +1076 -0
- package/dist/src/tui/app.js.map +1 -0
- package/dist/src/tui/components/ApprovalDialog.d.ts +28 -0
- package/dist/src/tui/components/ApprovalDialog.d.ts.map +1 -0
- package/dist/src/tui/components/ApprovalDialog.js +59 -0
- package/dist/src/tui/components/ApprovalDialog.js.map +1 -0
- package/dist/src/tui/components/InputArea.d.ts +35 -0
- package/dist/src/tui/components/InputArea.d.ts.map +1 -0
- package/dist/src/tui/components/InputArea.js +144 -0
- package/dist/src/tui/components/InputArea.js.map +1 -0
- package/dist/src/tui/components/MessageItem.d.ts +28 -0
- package/dist/src/tui/components/MessageItem.d.ts.map +1 -0
- package/dist/src/tui/components/MessageItem.js +27 -0
- package/dist/src/tui/components/MessageItem.js.map +1 -0
- package/dist/src/tui/components/ScrollableBox.d.ts +41 -0
- package/dist/src/tui/components/ScrollableBox.d.ts.map +1 -0
- package/dist/src/tui/components/ScrollableBox.js +101 -0
- package/dist/src/tui/components/ScrollableBox.js.map +1 -0
- package/dist/src/tui/components/ToolCallItem.d.ts +33 -0
- package/dist/src/tui/components/ToolCallItem.d.ts.map +1 -0
- package/dist/src/tui/components/ToolCallItem.js +91 -0
- package/dist/src/tui/components/ToolCallItem.js.map +1 -0
- package/dist/src/tui/components/index.d.ts +13 -0
- package/dist/src/tui/components/index.d.ts.map +1 -0
- package/dist/src/tui/components/index.js +15 -0
- package/dist/src/tui/components/index.js.map +1 -0
- package/dist/src/tui/event-display.d.ts +19 -0
- package/dist/src/tui/event-display.d.ts.map +1 -0
- package/dist/src/tui/event-display.js +178 -0
- package/dist/src/tui/event-display.js.map +1 -0
- package/dist/src/tui/index.d.ts +105 -0
- package/dist/src/tui/index.d.ts.map +1 -0
- package/dist/src/tui/index.js +214 -0
- package/dist/src/tui/index.js.map +1 -0
- package/dist/src/tui/input/CommandPalette.d.ts +55 -0
- package/dist/src/tui/input/CommandPalette.d.ts.map +1 -0
- package/dist/src/tui/input/CommandPalette.js +135 -0
- package/dist/src/tui/input/CommandPalette.js.map +1 -0
- package/dist/src/tui/input/index.d.ts +7 -0
- package/dist/src/tui/input/index.d.ts.map +1 -0
- package/dist/src/tui/input/index.js +7 -0
- package/dist/src/tui/input/index.js.map +1 -0
- package/dist/src/tui/theme/index.d.ts +45 -0
- package/dist/src/tui/theme/index.d.ts.map +1 -0
- package/dist/src/tui/theme/index.js +215 -0
- package/dist/src/tui/theme/index.js.map +1 -0
- package/dist/src/tui/types.d.ts +214 -0
- package/dist/src/tui/types.d.ts.map +1 -0
- package/dist/src/tui/types.js +27 -0
- package/dist/src/tui/types.js.map +1 -0
- package/dist/src/types.d.ts +905 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +9 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trick S: Failure Evidence Preservation
|
|
3
|
+
*
|
|
4
|
+
* Preserves failed actions, error traces, and unsuccessful attempts in context
|
|
5
|
+
* so the model can learn from mistakes and avoid repeating them.
|
|
6
|
+
*
|
|
7
|
+
* Problem: When errors are silently discarded or minimally logged, the model
|
|
8
|
+
* may repeat the same mistakes. Without evidence of what failed and why,
|
|
9
|
+
* the agent loops endlessly.
|
|
10
|
+
*
|
|
11
|
+
* Solution: Explicitly preserve failure evidence with structured metadata.
|
|
12
|
+
* This includes error messages, stack traces, what was attempted, and why
|
|
13
|
+
* it failed - enabling the model to learn and adapt.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { createFailureTracker, formatFailureContext } from './failure-evidence';
|
|
18
|
+
*
|
|
19
|
+
* const tracker = createFailureTracker({
|
|
20
|
+
* maxFailures: 20,
|
|
21
|
+
* preserveStackTraces: true,
|
|
22
|
+
* categorizeErrors: true,
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Record a failure
|
|
26
|
+
* tracker.recordFailure({
|
|
27
|
+
* action: 'read_file',
|
|
28
|
+
* args: { path: '/etc/passwd' },
|
|
29
|
+
* error: 'Permission denied',
|
|
30
|
+
* category: 'permission',
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Get context for LLM
|
|
34
|
+
* const failureContext = tracker.getFailureContext();
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
// =============================================================================
|
|
38
|
+
// ERROR CATEGORIZATION
|
|
39
|
+
// =============================================================================
|
|
40
|
+
/**
|
|
41
|
+
* Auto-categorize an error based on its message.
|
|
42
|
+
*/
|
|
43
|
+
export function categorizeError(error) {
|
|
44
|
+
const lowerError = error.toLowerCase();
|
|
45
|
+
// Permission errors
|
|
46
|
+
if (lowerError.includes('permission denied') ||
|
|
47
|
+
lowerError.includes('access denied') ||
|
|
48
|
+
lowerError.includes('not permitted') ||
|
|
49
|
+
lowerError.includes('eacces') ||
|
|
50
|
+
lowerError.includes('unauthorized')) {
|
|
51
|
+
return 'permission';
|
|
52
|
+
}
|
|
53
|
+
// Not found errors
|
|
54
|
+
if (lowerError.includes('not found') ||
|
|
55
|
+
lowerError.includes('no such file') ||
|
|
56
|
+
lowerError.includes('enoent') ||
|
|
57
|
+
lowerError.includes('does not exist') ||
|
|
58
|
+
lowerError.includes('404')) {
|
|
59
|
+
return 'not_found';
|
|
60
|
+
}
|
|
61
|
+
// Syntax errors
|
|
62
|
+
if (lowerError.includes('syntax error') ||
|
|
63
|
+
lowerError.includes('unexpected token') ||
|
|
64
|
+
lowerError.includes('parse error') ||
|
|
65
|
+
lowerError.includes('invalid json')) {
|
|
66
|
+
return 'syntax';
|
|
67
|
+
}
|
|
68
|
+
// Type errors
|
|
69
|
+
if (lowerError.includes('type error') ||
|
|
70
|
+
lowerError.includes('typeerror') ||
|
|
71
|
+
lowerError.includes('is not a function') ||
|
|
72
|
+
lowerError.includes('undefined is not') ||
|
|
73
|
+
lowerError.includes('cannot read propert')) {
|
|
74
|
+
return 'type';
|
|
75
|
+
}
|
|
76
|
+
// Network errors
|
|
77
|
+
if (lowerError.includes('network') ||
|
|
78
|
+
lowerError.includes('connection') ||
|
|
79
|
+
lowerError.includes('econnrefused') ||
|
|
80
|
+
lowerError.includes('socket') ||
|
|
81
|
+
lowerError.includes('dns') ||
|
|
82
|
+
lowerError.includes('fetch failed')) {
|
|
83
|
+
return 'network';
|
|
84
|
+
}
|
|
85
|
+
// Timeout errors
|
|
86
|
+
if (lowerError.includes('timeout') ||
|
|
87
|
+
lowerError.includes('timed out') ||
|
|
88
|
+
lowerError.includes('etimedout')) {
|
|
89
|
+
return 'timeout';
|
|
90
|
+
}
|
|
91
|
+
// Validation errors
|
|
92
|
+
if (lowerError.includes('validation') ||
|
|
93
|
+
lowerError.includes('invalid') ||
|
|
94
|
+
lowerError.includes('required') ||
|
|
95
|
+
lowerError.includes('must be')) {
|
|
96
|
+
return 'validation';
|
|
97
|
+
}
|
|
98
|
+
// Resource errors
|
|
99
|
+
if (lowerError.includes('out of memory') ||
|
|
100
|
+
lowerError.includes('disk full') ||
|
|
101
|
+
lowerError.includes('enomem') ||
|
|
102
|
+
lowerError.includes('enospc') ||
|
|
103
|
+
lowerError.includes('quota')) {
|
|
104
|
+
return 'resource';
|
|
105
|
+
}
|
|
106
|
+
// Logic errors
|
|
107
|
+
if (lowerError.includes('assertion') ||
|
|
108
|
+
lowerError.includes('invariant') ||
|
|
109
|
+
lowerError.includes('expect')) {
|
|
110
|
+
return 'logic';
|
|
111
|
+
}
|
|
112
|
+
return 'unknown';
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Generate a suggestion based on failure category.
|
|
116
|
+
*/
|
|
117
|
+
export function generateSuggestion(failure) {
|
|
118
|
+
switch (failure.category) {
|
|
119
|
+
case 'permission':
|
|
120
|
+
return `Check file/directory permissions. The action "${failure.action}" may need elevated privileges or the path may be restricted.`;
|
|
121
|
+
case 'not_found':
|
|
122
|
+
return `Verify the resource exists before accessing. Use list_directory or check for typos in the path.`;
|
|
123
|
+
case 'syntax':
|
|
124
|
+
return `Review the syntax. Check for missing brackets, quotes, or invalid characters. Validate JSON/code before submission.`;
|
|
125
|
+
case 'type':
|
|
126
|
+
return `Check variable types and ensure proper null/undefined handling. The value may be a different type than expected.`;
|
|
127
|
+
case 'network':
|
|
128
|
+
return `Check network connectivity. The service may be down, or there may be firewall/DNS issues.`;
|
|
129
|
+
case 'timeout':
|
|
130
|
+
return `The operation took too long. Consider breaking it into smaller operations or increasing timeout.`;
|
|
131
|
+
case 'validation':
|
|
132
|
+
return `Verify input matches expected format/constraints. Check required fields and value ranges.`;
|
|
133
|
+
case 'resource':
|
|
134
|
+
return `System resources are constrained. Consider cleanup, smaller batch sizes, or freeing memory/disk.`;
|
|
135
|
+
case 'logic':
|
|
136
|
+
return `An assumption was violated. Review the logic and check preconditions.`;
|
|
137
|
+
default:
|
|
138
|
+
return `Analyze the error message for specific guidance.`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// =============================================================================
|
|
142
|
+
// FAILURE TRACKER
|
|
143
|
+
// =============================================================================
|
|
144
|
+
/**
|
|
145
|
+
* Tracks failures with pattern detection.
|
|
146
|
+
*/
|
|
147
|
+
export class FailureTracker {
|
|
148
|
+
config;
|
|
149
|
+
failures = [];
|
|
150
|
+
actionHistory = new Map(); // action -> failure IDs
|
|
151
|
+
listeners = [];
|
|
152
|
+
constructor(config = {}) {
|
|
153
|
+
this.config = {
|
|
154
|
+
maxFailures: config.maxFailures ?? 50,
|
|
155
|
+
preserveStackTraces: config.preserveStackTraces ?? true,
|
|
156
|
+
categorizeErrors: config.categorizeErrors ?? true,
|
|
157
|
+
detectRepeats: config.detectRepeats ?? true,
|
|
158
|
+
repeatWarningThreshold: config.repeatWarningThreshold ?? 3,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Record a failure.
|
|
163
|
+
*/
|
|
164
|
+
recordFailure(input) {
|
|
165
|
+
const errorString = input.error instanceof Error
|
|
166
|
+
? input.error.message
|
|
167
|
+
: input.error;
|
|
168
|
+
const stackTrace = input.error instanceof Error
|
|
169
|
+
? input.error.stack
|
|
170
|
+
: undefined;
|
|
171
|
+
// Auto-categorize if needed
|
|
172
|
+
const category = input.category ??
|
|
173
|
+
(this.config.categorizeErrors ? categorizeError(errorString) : 'unknown');
|
|
174
|
+
// Check for repeats
|
|
175
|
+
let repeatCount = 1;
|
|
176
|
+
if (this.config.detectRepeats) {
|
|
177
|
+
repeatCount = this.countSimilarFailures(input.action, errorString);
|
|
178
|
+
}
|
|
179
|
+
const failure = {
|
|
180
|
+
id: `fail-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
181
|
+
timestamp: new Date().toISOString(),
|
|
182
|
+
action: input.action,
|
|
183
|
+
args: input.args,
|
|
184
|
+
error: errorString,
|
|
185
|
+
stackTrace: this.config.preserveStackTraces ? stackTrace : undefined,
|
|
186
|
+
category,
|
|
187
|
+
iteration: input.iteration,
|
|
188
|
+
intent: input.intent,
|
|
189
|
+
suggestion: '',
|
|
190
|
+
resolved: false,
|
|
191
|
+
repeatCount,
|
|
192
|
+
};
|
|
193
|
+
// Generate suggestion
|
|
194
|
+
failure.suggestion = generateSuggestion(failure);
|
|
195
|
+
// Store
|
|
196
|
+
this.failures.push(failure);
|
|
197
|
+
// Track by action
|
|
198
|
+
const actionFailures = this.actionHistory.get(input.action) || [];
|
|
199
|
+
actionFailures.push(failure.id);
|
|
200
|
+
this.actionHistory.set(input.action, actionFailures);
|
|
201
|
+
// Enforce max failures with eviction warning
|
|
202
|
+
if (this.failures.length > this.config.maxFailures) {
|
|
203
|
+
const evicted = this.failures.shift();
|
|
204
|
+
// Log warning about eviction
|
|
205
|
+
console.warn(`[FailureTracker] Evicted failure due to limit (${this.config.maxFailures}): ${evicted.action} - ${evicted.error.slice(0, 50)}`);
|
|
206
|
+
// Emit eviction event for observability
|
|
207
|
+
this.emit({
|
|
208
|
+
type: 'failure.evicted',
|
|
209
|
+
failure: evicted,
|
|
210
|
+
reason: `Max failures limit (${this.config.maxFailures}) exceeded`,
|
|
211
|
+
});
|
|
212
|
+
// Clean up action history
|
|
213
|
+
for (const [_action, ids] of this.actionHistory) {
|
|
214
|
+
const idx = ids.indexOf(evicted.id);
|
|
215
|
+
if (idx >= 0)
|
|
216
|
+
ids.splice(idx, 1);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// Emit events
|
|
220
|
+
this.emit({ type: 'failure.recorded', failure });
|
|
221
|
+
if (repeatCount >= this.config.repeatWarningThreshold) {
|
|
222
|
+
this.emit({ type: 'failure.repeated', failure, count: repeatCount });
|
|
223
|
+
}
|
|
224
|
+
// Check for patterns
|
|
225
|
+
this.detectPatterns();
|
|
226
|
+
return failure;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Mark a failure as resolved.
|
|
230
|
+
*/
|
|
231
|
+
resolveFailure(failureId) {
|
|
232
|
+
const failure = this.failures.find(f => f.id === failureId);
|
|
233
|
+
if (failure) {
|
|
234
|
+
failure.resolved = true;
|
|
235
|
+
this.emit({ type: 'failure.resolved', failureId });
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Get all unresolved failures.
|
|
242
|
+
*/
|
|
243
|
+
getUnresolvedFailures() {
|
|
244
|
+
return this.failures.filter(f => !f.resolved);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Get failures by category.
|
|
248
|
+
*/
|
|
249
|
+
getFailuresByCategory(category) {
|
|
250
|
+
return this.failures.filter(f => f.category === category);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Get failures by action.
|
|
254
|
+
*/
|
|
255
|
+
getFailuresByAction(action) {
|
|
256
|
+
const ids = this.actionHistory.get(action) || [];
|
|
257
|
+
return this.failures.filter(f => ids.includes(f.id));
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Get recent failures (last N).
|
|
261
|
+
*/
|
|
262
|
+
getRecentFailures(count = 10) {
|
|
263
|
+
return this.failures.slice(-count);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Get failure context formatted for LLM inclusion.
|
|
267
|
+
*/
|
|
268
|
+
getFailureContext(options = {}) {
|
|
269
|
+
const { maxFailures = 10, includeResolved = false, includeStackTraces = false, } = options;
|
|
270
|
+
let failures = includeResolved
|
|
271
|
+
? this.failures
|
|
272
|
+
: this.failures.filter(f => !f.resolved);
|
|
273
|
+
failures = failures.slice(-maxFailures);
|
|
274
|
+
if (failures.length === 0) {
|
|
275
|
+
return '';
|
|
276
|
+
}
|
|
277
|
+
return formatFailureContext(failures, { includeStackTraces });
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Check if an action has failed recently.
|
|
281
|
+
*/
|
|
282
|
+
hasRecentFailure(action, withinMs = 60000) {
|
|
283
|
+
const cutoff = Date.now() - withinMs;
|
|
284
|
+
return this.failures.some(f => f.action === action && new Date(f.timestamp).getTime() > cutoff);
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Get failure statistics.
|
|
288
|
+
*/
|
|
289
|
+
getStats() {
|
|
290
|
+
const byCategory = {
|
|
291
|
+
permission: 0,
|
|
292
|
+
not_found: 0,
|
|
293
|
+
syntax: 0,
|
|
294
|
+
type: 0,
|
|
295
|
+
runtime: 0,
|
|
296
|
+
network: 0,
|
|
297
|
+
timeout: 0,
|
|
298
|
+
validation: 0,
|
|
299
|
+
logic: 0,
|
|
300
|
+
resource: 0,
|
|
301
|
+
unknown: 0,
|
|
302
|
+
};
|
|
303
|
+
for (const f of this.failures) {
|
|
304
|
+
byCategory[f.category]++;
|
|
305
|
+
}
|
|
306
|
+
const actionCounts = new Map();
|
|
307
|
+
for (const f of this.failures) {
|
|
308
|
+
actionCounts.set(f.action, (actionCounts.get(f.action) || 0) + 1);
|
|
309
|
+
}
|
|
310
|
+
const mostFailedActions = Array.from(actionCounts.entries())
|
|
311
|
+
.map(([action, count]) => ({ action, count }))
|
|
312
|
+
.sort((a, b) => b.count - a.count)
|
|
313
|
+
.slice(0, 5);
|
|
314
|
+
return {
|
|
315
|
+
total: this.failures.length,
|
|
316
|
+
unresolved: this.failures.filter(f => !f.resolved).length,
|
|
317
|
+
byCategory,
|
|
318
|
+
mostFailedActions,
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Clear all failures.
|
|
323
|
+
*/
|
|
324
|
+
clear() {
|
|
325
|
+
this.failures = [];
|
|
326
|
+
this.actionHistory.clear();
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Subscribe to events.
|
|
330
|
+
*/
|
|
331
|
+
on(listener) {
|
|
332
|
+
this.listeners.push(listener);
|
|
333
|
+
return () => {
|
|
334
|
+
const idx = this.listeners.indexOf(listener);
|
|
335
|
+
if (idx >= 0)
|
|
336
|
+
this.listeners.splice(idx, 1);
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
// Internal methods
|
|
340
|
+
countSimilarFailures(action, error) {
|
|
341
|
+
const normalizedError = error.toLowerCase().slice(0, 50);
|
|
342
|
+
return this.failures.filter(f => f.action === action && f.error.toLowerCase().startsWith(normalizedError)).length + 1;
|
|
343
|
+
}
|
|
344
|
+
detectPatterns() {
|
|
345
|
+
// Detect repeated action failures
|
|
346
|
+
for (const [action, ids] of this.actionHistory) {
|
|
347
|
+
if (ids.length >= 3) {
|
|
348
|
+
const recent = ids.slice(-3);
|
|
349
|
+
const recentFailures = this.failures.filter(f => recent.includes(f.id));
|
|
350
|
+
if (recentFailures.every(f => !f.resolved)) {
|
|
351
|
+
this.emit({
|
|
352
|
+
type: 'pattern.detected',
|
|
353
|
+
pattern: {
|
|
354
|
+
type: 'repeated_action',
|
|
355
|
+
description: `Action "${action}" has failed ${ids.length} times`,
|
|
356
|
+
failureIds: recent,
|
|
357
|
+
confidence: Math.min(0.9, 0.3 + ids.length * 0.1),
|
|
358
|
+
suggestion: `Consider an alternative approach. "${action}" is consistently failing.`,
|
|
359
|
+
},
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
// Detect category clusters
|
|
365
|
+
const recentFailures = this.failures.slice(-10);
|
|
366
|
+
const categoryCounts = new Map();
|
|
367
|
+
for (const f of recentFailures) {
|
|
368
|
+
categoryCounts.set(f.category, (categoryCounts.get(f.category) || 0) + 1);
|
|
369
|
+
}
|
|
370
|
+
for (const [category, count] of categoryCounts) {
|
|
371
|
+
if (count >= 5) {
|
|
372
|
+
this.emit({
|
|
373
|
+
type: 'pattern.detected',
|
|
374
|
+
pattern: {
|
|
375
|
+
type: 'category_cluster',
|
|
376
|
+
description: `Multiple ${category} errors (${count} of last 10)`,
|
|
377
|
+
failureIds: recentFailures.filter(f => f.category === category).map(f => f.id),
|
|
378
|
+
confidence: count / 10,
|
|
379
|
+
suggestion: `Address the underlying ${category} issue before continuing.`,
|
|
380
|
+
},
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
emit(event) {
|
|
386
|
+
for (const listener of this.listeners) {
|
|
387
|
+
try {
|
|
388
|
+
listener(event);
|
|
389
|
+
}
|
|
390
|
+
catch {
|
|
391
|
+
// Ignore listener errors
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
// =============================================================================
|
|
397
|
+
// FACTORY FUNCTIONS
|
|
398
|
+
// =============================================================================
|
|
399
|
+
/**
|
|
400
|
+
* Create a failure tracker.
|
|
401
|
+
*
|
|
402
|
+
* @example
|
|
403
|
+
* ```typescript
|
|
404
|
+
* const tracker = createFailureTracker({
|
|
405
|
+
* maxFailures: 30,
|
|
406
|
+
* preserveStackTraces: true,
|
|
407
|
+
* detectRepeats: true,
|
|
408
|
+
* });
|
|
409
|
+
*
|
|
410
|
+
* // Record failures during agent loop
|
|
411
|
+
* try {
|
|
412
|
+
* await tool.execute(args);
|
|
413
|
+
* } catch (error) {
|
|
414
|
+
* tracker.recordFailure({
|
|
415
|
+
* action: tool.name,
|
|
416
|
+
* args,
|
|
417
|
+
* error,
|
|
418
|
+
* iteration: currentIteration,
|
|
419
|
+
* });
|
|
420
|
+
* }
|
|
421
|
+
*
|
|
422
|
+
* // Include failure context in prompts
|
|
423
|
+
* const failureContext = tracker.getFailureContext();
|
|
424
|
+
* if (failureContext) {
|
|
425
|
+
* messages.push({
|
|
426
|
+
* role: 'system',
|
|
427
|
+
* content: failureContext,
|
|
428
|
+
* });
|
|
429
|
+
* }
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
export function createFailureTracker(config = {}) {
|
|
433
|
+
return new FailureTracker(config);
|
|
434
|
+
}
|
|
435
|
+
// =============================================================================
|
|
436
|
+
// UTILITIES
|
|
437
|
+
// =============================================================================
|
|
438
|
+
/**
|
|
439
|
+
* Format failures as context for LLM.
|
|
440
|
+
*/
|
|
441
|
+
export function formatFailureContext(failures, options = {}) {
|
|
442
|
+
if (failures.length === 0)
|
|
443
|
+
return '';
|
|
444
|
+
const lines = [
|
|
445
|
+
'[Previous Failures - Learn from these to avoid repeating mistakes]',
|
|
446
|
+
'',
|
|
447
|
+
];
|
|
448
|
+
for (const f of failures) {
|
|
449
|
+
lines.push(`**${f.action}** (${f.category}): ${f.error}`);
|
|
450
|
+
if (f.args && Object.keys(f.args).length > 0) {
|
|
451
|
+
lines.push(` Args: ${JSON.stringify(f.args)}`);
|
|
452
|
+
}
|
|
453
|
+
if (f.suggestion) {
|
|
454
|
+
lines.push(` → ${f.suggestion}`);
|
|
455
|
+
}
|
|
456
|
+
if (options.includeStackTraces && f.stackTrace) {
|
|
457
|
+
const shortStack = f.stackTrace.split('\n').slice(0, 3).join('\n');
|
|
458
|
+
lines.push(` Stack: ${shortStack}`);
|
|
459
|
+
}
|
|
460
|
+
lines.push('');
|
|
461
|
+
}
|
|
462
|
+
return lines.join('\n');
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Create a warning message for repeated failures.
|
|
466
|
+
*/
|
|
467
|
+
export function createRepeatWarning(action, count, suggestion) {
|
|
468
|
+
let warning = `⚠️ Action "${action}" has failed ${count} times.`;
|
|
469
|
+
if (count >= 5) {
|
|
470
|
+
warning += ' Consider a completely different approach.';
|
|
471
|
+
}
|
|
472
|
+
else if (count >= 3) {
|
|
473
|
+
warning += ' Review previous errors before retrying.';
|
|
474
|
+
}
|
|
475
|
+
if (suggestion) {
|
|
476
|
+
warning += `\n💡 Suggestion: ${suggestion}`;
|
|
477
|
+
}
|
|
478
|
+
return warning;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Extract actionable insights from failures.
|
|
482
|
+
*/
|
|
483
|
+
export function extractInsights(failures) {
|
|
484
|
+
const insights = [];
|
|
485
|
+
// Group by category
|
|
486
|
+
const byCategory = new Map();
|
|
487
|
+
for (const f of failures) {
|
|
488
|
+
const group = byCategory.get(f.category) || [];
|
|
489
|
+
group.push(f);
|
|
490
|
+
byCategory.set(f.category, group);
|
|
491
|
+
}
|
|
492
|
+
// Generate insights
|
|
493
|
+
if (byCategory.has('permission') && byCategory.get('permission').length >= 2) {
|
|
494
|
+
insights.push('Multiple permission errors - check if running with sufficient privileges');
|
|
495
|
+
}
|
|
496
|
+
if (byCategory.has('not_found') && byCategory.get('not_found').length >= 2) {
|
|
497
|
+
insights.push('Multiple not-found errors - verify paths and use list_directory first');
|
|
498
|
+
}
|
|
499
|
+
if (byCategory.has('syntax') && byCategory.get('syntax').length >= 2) {
|
|
500
|
+
insights.push('Multiple syntax errors - validate code/JSON before execution');
|
|
501
|
+
}
|
|
502
|
+
if (byCategory.has('network') && byCategory.get('network').length >= 1) {
|
|
503
|
+
insights.push('Network issues detected - check connectivity and service availability');
|
|
504
|
+
}
|
|
505
|
+
if (byCategory.has('timeout') && byCategory.get('timeout').length >= 1) {
|
|
506
|
+
insights.push('Timeout detected - consider breaking operations into smaller chunks');
|
|
507
|
+
}
|
|
508
|
+
// Action-specific insights
|
|
509
|
+
const actionCounts = new Map();
|
|
510
|
+
for (const f of failures) {
|
|
511
|
+
actionCounts.set(f.action, (actionCounts.get(f.action) || 0) + 1);
|
|
512
|
+
}
|
|
513
|
+
for (const [action, count] of actionCounts) {
|
|
514
|
+
if (count >= 3) {
|
|
515
|
+
insights.push(`"${action}" failed ${count} times - try an alternative tool/approach`);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
return insights;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Format failure stats for display.
|
|
522
|
+
*/
|
|
523
|
+
export function formatFailureStats(stats) {
|
|
524
|
+
const lines = [
|
|
525
|
+
`Failure Statistics:`,
|
|
526
|
+
` Total: ${stats.total} (${stats.unresolved} unresolved)`,
|
|
527
|
+
'',
|
|
528
|
+
' By Category:',
|
|
529
|
+
];
|
|
530
|
+
for (const [category, count] of Object.entries(stats.byCategory)) {
|
|
531
|
+
if (count > 0) {
|
|
532
|
+
lines.push(` ${category}: ${count}`);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
if (stats.mostFailedActions.length > 0) {
|
|
536
|
+
lines.push('');
|
|
537
|
+
lines.push(' Most Failed Actions:');
|
|
538
|
+
for (const { action, count } of stats.mostFailedActions) {
|
|
539
|
+
lines.push(` ${action}: ${count}`);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
return lines.join('\n');
|
|
543
|
+
}
|
|
544
|
+
//# sourceMappingURL=failure-evidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure-evidence.js","sourceRoot":"","sources":["../../../src/tricks/failure-evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AA0IH,gFAAgF;AAChF,uBAAuB;AACvB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAEvC,oBAAoB;IACpB,IACE,UAAU,CAAC,QAAQ,CAAC,mBAAmB,CAAC;QACxC,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC;QACp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
|
|
3
|
+
*
|
|
4
|
+
* Robust JSON parsing utilities that handle:
|
|
5
|
+
* - Nested objects (the regex `\{[^}]*\}` problem)
|
|
6
|
+
* - Strings containing braces
|
|
7
|
+
* - Escaped quotes
|
|
8
|
+
* - Malformed JSON with recovery
|
|
9
|
+
* - LLM response extraction (code blocks, tool calls)
|
|
10
|
+
*/
|
|
11
|
+
export interface SafeParseOptions {
|
|
12
|
+
/** Context for error messages (e.g., "tool read_file") */
|
|
13
|
+
context?: string;
|
|
14
|
+
/** Whether to attempt recovery from malformed JSON */
|
|
15
|
+
attemptRecovery?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface SafeParseResult<T = unknown> {
|
|
18
|
+
success: boolean;
|
|
19
|
+
value?: T;
|
|
20
|
+
error?: string;
|
|
21
|
+
/** Whether recovery was applied */
|
|
22
|
+
recovered?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface ToolCall {
|
|
25
|
+
tool: string;
|
|
26
|
+
input: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Extract a complete JSON object from text using brace-depth tracking.
|
|
30
|
+
*
|
|
31
|
+
* Unlike regex `\{[^}]*\}`, this properly handles:
|
|
32
|
+
* - Nested objects: `{"a": {"b": 1}}`
|
|
33
|
+
* - Nested arrays: `{"a": [1, [2, 3]]}`
|
|
34
|
+
* - Strings containing braces: `{"text": "hello { } world"}`
|
|
35
|
+
* - Escaped quotes: `{"text": "he said \"hi\""}`
|
|
36
|
+
*
|
|
37
|
+
* @param text - The text to search for JSON
|
|
38
|
+
* @param startFrom - Optional index to start searching from
|
|
39
|
+
* @returns The extracted JSON string and its end index, or null if not found
|
|
40
|
+
*/
|
|
41
|
+
export declare function extractJsonObject(text: string, startFrom?: number): {
|
|
42
|
+
json: string;
|
|
43
|
+
endIndex: number;
|
|
44
|
+
} | null;
|
|
45
|
+
/**
|
|
46
|
+
* Extract all JSON objects from text.
|
|
47
|
+
*/
|
|
48
|
+
export declare function extractAllJsonObjects(text: string): string[];
|
|
49
|
+
/**
|
|
50
|
+
* Safely parse JSON with multi-level fallback and recovery.
|
|
51
|
+
*
|
|
52
|
+
* Fallback levels:
|
|
53
|
+
* 1. Direct JSON.parse
|
|
54
|
+
* 2. Extract JSON object from surrounding text
|
|
55
|
+
* 3. Attempt malformed JSON recovery (if enabled)
|
|
56
|
+
*
|
|
57
|
+
* @param input - Raw input (may be JSON or text containing JSON)
|
|
58
|
+
* @param options - Parsing options
|
|
59
|
+
*/
|
|
60
|
+
export declare function safeParseJson<T = unknown>(input: string, options?: SafeParseOptions): SafeParseResult<T>;
|
|
61
|
+
/**
|
|
62
|
+
* Extract a tool call from an LLM response.
|
|
63
|
+
*
|
|
64
|
+
* Handles multiple formats:
|
|
65
|
+
* - Code block: ```json\n{"tool": "x", "input": {...}}\n```
|
|
66
|
+
* - Inline JSON: {"tool": "x", "input": {...}}
|
|
67
|
+
* - Nested inputs: {"tool": "x", "input": {"a": {"b": 1}}}
|
|
68
|
+
*
|
|
69
|
+
* @param response - The LLM response text
|
|
70
|
+
* @returns The extracted tool call, or null if not found
|
|
71
|
+
*/
|
|
72
|
+
export declare function extractToolCallJson(response: string): ToolCall | null;
|
|
73
|
+
/**
|
|
74
|
+
* Extract multiple tool calls from a response.
|
|
75
|
+
*/
|
|
76
|
+
export declare function extractAllToolCalls(response: string): ToolCall[];
|
|
77
|
+
//# sourceMappingURL=json-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-utils.d.ts","sourceRoot":"","sources":["../../../src/tricks/json-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,MAAM,WAAW,gBAAgB;IAC/B,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC1C,OAAO,EAAE,OAAO,CA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