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
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- TUI permission approval system with safety fallbacks
|
|
12
|
+
- Architecture diagrams in CLAUDE.md documentation
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- Tool call display now shows full arguments in expanded view (Alt+T)
|
|
16
|
+
|
|
17
|
+
## [0.1.0] - 2026-01-27
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
- **Core Agent** - ProductionAgent with multi-provider support (Anthropic, OpenRouter, OpenAI)
|
|
21
|
+
- **TUI Mode** - Terminal UI built with Ink/React featuring:
|
|
22
|
+
- Static message rendering for flicker-free display
|
|
23
|
+
- Command palette (Ctrl+P)
|
|
24
|
+
- Tool call visualization with expand/collapse (Alt+T)
|
|
25
|
+
- Approval dialogs for dangerous operations
|
|
26
|
+
- **REPL Mode** - Legacy readline interface for simpler environments
|
|
27
|
+
- **Session Persistence** - SQLite-based storage with JSONL fallback
|
|
28
|
+
- **Context Management**:
|
|
29
|
+
- Auto-compaction at configurable thresholds
|
|
30
|
+
- Reversible compaction with retrieval references
|
|
31
|
+
- Goal recitation for long-running tasks
|
|
32
|
+
- **MCP Integration** - Model Context Protocol for external tools
|
|
33
|
+
- **Tool System**:
|
|
34
|
+
- Built-in tools: file operations, bash, search
|
|
35
|
+
- Permission system with danger levels (safe, moderate, dangerous, critical)
|
|
36
|
+
- Custom permission checkers
|
|
37
|
+
- **Planning & Reflection** - Task decomposition and self-evaluation
|
|
38
|
+
- **Thread Management** - Fork, switch, and merge conversation branches
|
|
39
|
+
- **Checkpoints** - Save and restore agent state
|
|
40
|
+
- **File Change Tracking** - Full undo capability for file modifications
|
|
41
|
+
|
|
42
|
+
### Security
|
|
43
|
+
- Permission-based tool execution with user approval
|
|
44
|
+
- Sandbox execution for bash commands (macOS Seatbelt)
|
|
45
|
+
- Dangerous operation blocking in strict mode
|
|
46
|
+
|
|
47
|
+
[Unreleased]: https://github.com/eren23/attocode/compare/v0.1.0...HEAD
|
|
48
|
+
[0.1.0]: https://github.com/eren23/attocode/releases/tag/v0.1.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 eren23
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Attocode
|
|
2
|
+
|
|
3
|
+
A production-ready AI coding agent for your terminal.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Multi-provider support** - Anthropic, OpenRouter, OpenAI
|
|
8
|
+
- **Memory system** - Remembers context across sessions
|
|
9
|
+
- **Planning & Reflection** - Breaks down complex tasks
|
|
10
|
+
- **File change tracking** - Full undo capability
|
|
11
|
+
- **Context compaction** - Never runs out of context in long sessions
|
|
12
|
+
- **Session persistence** - Resume where you left off
|
|
13
|
+
- **Sandbox execution** - Safe command execution
|
|
14
|
+
- **MCP integration** - Connect external tools
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
### 1. Install globally
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Clone the repo
|
|
22
|
+
git clone https://github.com/eren23/attocode.git
|
|
23
|
+
cd attocode
|
|
24
|
+
|
|
25
|
+
# Install dependencies
|
|
26
|
+
npm install
|
|
27
|
+
|
|
28
|
+
# Build
|
|
29
|
+
npm run build
|
|
30
|
+
|
|
31
|
+
# Install globally
|
|
32
|
+
npm link
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Now `attocode` is available everywhere in your terminal.
|
|
36
|
+
|
|
37
|
+
### 2. Set up your API key
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Option A: Anthropic (recommended)
|
|
41
|
+
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
42
|
+
|
|
43
|
+
# Option B: OpenRouter (100+ models)
|
|
44
|
+
export OPENROUTER_API_KEY="sk-or-..."
|
|
45
|
+
|
|
46
|
+
# Option C: OpenAI
|
|
47
|
+
export OPENAI_API_KEY="sk-..."
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Add to your `~/.bashrc` or `~/.zshrc` to persist.
|
|
51
|
+
|
|
52
|
+
### 3. Run the setup wizard
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
attocode init
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
This creates your config at `~/.config/attocode/config.json`.
|
|
59
|
+
|
|
60
|
+
### 4. Start coding
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
attocode
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Usage
|
|
67
|
+
|
|
68
|
+
### Interactive mode (default)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
attocode
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Single task
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
attocode "List all TypeScript files and explain the project structure"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### With specific model
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
attocode -m anthropic/claude-opus-4 "Review this code for security issues"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Commands
|
|
87
|
+
|
|
88
|
+
Once in the REPL:
|
|
89
|
+
|
|
90
|
+
| Command | Description |
|
|
91
|
+
|---------|-------------|
|
|
92
|
+
| `/help` | Show all commands |
|
|
93
|
+
| `/status` | Show session metrics |
|
|
94
|
+
| `/checkpoint` | Save current state |
|
|
95
|
+
| `/restore` | Restore a checkpoint |
|
|
96
|
+
| `/undo` | Undo last file change |
|
|
97
|
+
| `/history` | Show file change history |
|
|
98
|
+
| `/compact` | Compact context (for long sessions) |
|
|
99
|
+
| `/save` | Save session |
|
|
100
|
+
| `/load` | Load a previous session |
|
|
101
|
+
| `/exit` | Exit attocode |
|
|
102
|
+
|
|
103
|
+
## Configuration
|
|
104
|
+
|
|
105
|
+
Config file: `~/.config/attocode/config.json`
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"providers": {
|
|
110
|
+
"default": "openrouter"
|
|
111
|
+
},
|
|
112
|
+
"model": "anthropic/claude-sonnet-4",
|
|
113
|
+
"maxIterations": 50,
|
|
114
|
+
"timeout": 300000,
|
|
115
|
+
"features": {
|
|
116
|
+
"memory": true,
|
|
117
|
+
"planning": true,
|
|
118
|
+
"sandbox": true
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## File Locations (XDG compliant)
|
|
124
|
+
|
|
125
|
+
| Purpose | Location |
|
|
126
|
+
|---------|----------|
|
|
127
|
+
| Config | `~/.config/attocode/config.json` |
|
|
128
|
+
| Sessions DB | `~/.local/share/attocode/sessions.db` |
|
|
129
|
+
| History | `~/.local/state/attocode/history` |
|
|
130
|
+
| Cache | `~/.cache/attocode/` |
|
|
131
|
+
|
|
132
|
+
## CLI Options
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
attocode [COMMAND] [OPTIONS] [TASK]
|
|
136
|
+
|
|
137
|
+
Commands:
|
|
138
|
+
init Interactive setup wizard
|
|
139
|
+
|
|
140
|
+
Options:
|
|
141
|
+
-h, --help Show help
|
|
142
|
+
-v, --version Show version
|
|
143
|
+
-m, --model MODEL Model to use (e.g., anthropic/claude-sonnet-4)
|
|
144
|
+
-p, --permission MODE Permission mode: strict, interactive, auto-safe, yolo
|
|
145
|
+
-i, --max-iterations N Max agent iterations (default: 50)
|
|
146
|
+
-t, --task TASK Run single task non-interactively
|
|
147
|
+
--tui Force TUI mode
|
|
148
|
+
--legacy Force legacy readline mode
|
|
149
|
+
--trace Enable trace capture to .traces/
|
|
150
|
+
--debug Enable debug logging
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Uninstall
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Remove global link
|
|
157
|
+
npm unlink -g attocode
|
|
158
|
+
|
|
159
|
+
# Remove config (optional)
|
|
160
|
+
rm -rf ~/.config/attocode
|
|
161
|
+
rm -rf ~/.local/share/attocode
|
|
162
|
+
rm -rf ~/.local/state/attocode
|
|
163
|
+
rm -rf ~/.cache/attocode
|
|
164
|
+
```
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapters to bridge different interfaces in the production agent.
|
|
3
|
+
*
|
|
4
|
+
* The production agent has its own type definitions that differ from
|
|
5
|
+
* the earlier lessons. These adapters allow seamless integration.
|
|
6
|
+
*/
|
|
7
|
+
import type { LLMProvider as ProductionLLMProvider, ChatOptions as ProductionChatOptions, ChatResponse as ProductionChatResponse, ToolDefinition as ProductionToolDefinition, Message as ProductionMessage } from './types.js';
|
|
8
|
+
import type { LLMProviderWithTools } from './providers/types.js';
|
|
9
|
+
import type { ToolDescription } from './tools/types.js';
|
|
10
|
+
import type { ToolRegistry } from './tools/registry.js';
|
|
11
|
+
/**
|
|
12
|
+
* Adapts LLMProviderWithTools (lesson 02) to ProductionLLMProvider (lesson 25).
|
|
13
|
+
*
|
|
14
|
+
* Key differences:
|
|
15
|
+
* - Lesson 02: chatWithTools(messages, { tools, tool_choice, model })
|
|
16
|
+
* - Lesson 25: chat(messages, { tools, model }) where tools are ToolDefinition[]
|
|
17
|
+
*/
|
|
18
|
+
export declare class ProviderAdapter implements ProductionLLMProvider {
|
|
19
|
+
private provider;
|
|
20
|
+
private defaultModel?;
|
|
21
|
+
constructor(provider: LLMProviderWithTools, defaultModel?: string | undefined);
|
|
22
|
+
chat(messages: ProductionMessage[], options?: ProductionChatOptions): Promise<ProductionChatResponse>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Converts tools from ToolRegistry (lesson 03) to ProductionToolDefinition[] (lesson 25).
|
|
26
|
+
*/
|
|
27
|
+
export declare function convertToolsFromRegistry(registry: ToolRegistry): ProductionToolDefinition[];
|
|
28
|
+
/**
|
|
29
|
+
* Converts a single ToolDescription to ProductionToolDefinition.
|
|
30
|
+
*/
|
|
31
|
+
export declare function convertTool(desc: ToolDescription, executor: (args: Record<string, unknown>) => Promise<unknown>): ProductionToolDefinition;
|
|
32
|
+
import * as readline from 'node:readline/promises';
|
|
33
|
+
/**
|
|
34
|
+
* Creates an interactive approval handler for the REPL.
|
|
35
|
+
* Unlike the broken auto-approve, this actually asks the user.
|
|
36
|
+
*/
|
|
37
|
+
export declare function createInteractiveApprovalHandler(rl: readline.Interface): (request: {
|
|
38
|
+
id: string;
|
|
39
|
+
action: string;
|
|
40
|
+
tool?: string;
|
|
41
|
+
args?: Record<string, unknown>;
|
|
42
|
+
risk: string;
|
|
43
|
+
context: string;
|
|
44
|
+
}) => Promise<{
|
|
45
|
+
approved: boolean;
|
|
46
|
+
reason?: string;
|
|
47
|
+
}>;
|
|
48
|
+
import type { ApprovalRequest, ApprovalResponse } from './types.js';
|
|
49
|
+
/**
|
|
50
|
+
* TUI Approval Bridge
|
|
51
|
+
*
|
|
52
|
+
* Manages the communication between the agent's approval system and the TUI.
|
|
53
|
+
* The bridge is created before the agent, and then connected to TUI callbacks
|
|
54
|
+
* once the TUI component mounts.
|
|
55
|
+
*/
|
|
56
|
+
export interface TUIApprovalBridge {
|
|
57
|
+
/** The approval handler to pass to the agent config */
|
|
58
|
+
handler: (request: ApprovalRequest) => Promise<ApprovalResponse>;
|
|
59
|
+
/** Connect TUI callbacks after TUI mounts */
|
|
60
|
+
connect: (callbacks: {
|
|
61
|
+
onRequest: (request: ApprovalRequest) => void;
|
|
62
|
+
}) => void;
|
|
63
|
+
/** Resolve the current pending approval */
|
|
64
|
+
resolve: (response: ApprovalResponse) => void;
|
|
65
|
+
/** Check if there's a pending approval */
|
|
66
|
+
hasPending: () => boolean;
|
|
67
|
+
/** Check if TUI is connected and ready to handle approvals */
|
|
68
|
+
isConnected: () => boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Creates a TUI approval bridge that enables communication between
|
|
72
|
+
* the agent's human-in-loop system and the TUI's approval dialog.
|
|
73
|
+
*
|
|
74
|
+
* Usage:
|
|
75
|
+
* 1. Create the bridge before creating the agent
|
|
76
|
+
* 2. Pass bridge.handler to the agent's humanInLoop.approvalHandler
|
|
77
|
+
* 3. Pass bridge to TUIApp props
|
|
78
|
+
* 4. TUIApp calls bridge.connect() with its callbacks on mount
|
|
79
|
+
* 5. When approval is needed, bridge calls onRequest callback
|
|
80
|
+
* 6. TUIApp shows dialog, user responds, TUIApp calls bridge.resolve()
|
|
81
|
+
*/
|
|
82
|
+
export declare function createTUIApprovalBridge(): TUIApprovalBridge;
|
|
83
|
+
//# sourceMappingURL=adapters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../src/adapters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,WAAW,IAAI,qBAAqB,EACpC,WAAW,IAAI,qBAAqB,EACpC,YAAY,IAAI,sBAAsB,EACtC,cAAc,IAAI,wBAAwB,EAC1C,OAAO,IAAI,iBAAiB,EAC7B,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EACV,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQxD;;;;;;GAMG;AACH,qBAAa,eAAgB,YAAW,qBAAqB;IAEzD,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,YAAY,CAAC;gBADb,QAAQ,EAAE,oBAAoB,EAC9B,YAAY,CAAC,EAAE,MAAM,YAAA;IAGzB,IAAI,CACR,QAAQ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CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAE9C,0CAA0C;IAC1C,UAAU,EAAE,MAAM,OAAO,CAAC;IAE1B,8DAA8D;IAC9D,WAAW,EAAE,MAAM,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,IAAI,iBAAiB,CAuC3D"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapters to bridge different interfaces in the production agent.
|
|
3
|
+
*
|
|
4
|
+
* The production agent has its own type definitions that differ from
|
|
5
|
+
* the earlier lessons. These adapters allow seamless integration.
|
|
6
|
+
*/
|
|
7
|
+
import { stableStringify } from './integrations/index.js';
|
|
8
|
+
import { safeParseJson } from './tricks/json-utils.js';
|
|
9
|
+
// =============================================================================
|
|
10
|
+
// PROVIDER ADAPTER
|
|
11
|
+
// =============================================================================
|
|
12
|
+
/**
|
|
13
|
+
* Adapts LLMProviderWithTools (lesson 02) to ProductionLLMProvider (lesson 25).
|
|
14
|
+
*
|
|
15
|
+
* Key differences:
|
|
16
|
+
* - Lesson 02: chatWithTools(messages, { tools, tool_choice, model })
|
|
17
|
+
* - Lesson 25: chat(messages, { tools, model }) where tools are ToolDefinition[]
|
|
18
|
+
*/
|
|
19
|
+
export class ProviderAdapter {
|
|
20
|
+
provider;
|
|
21
|
+
defaultModel;
|
|
22
|
+
constructor(provider, defaultModel) {
|
|
23
|
+
this.provider = provider;
|
|
24
|
+
this.defaultModel = defaultModel;
|
|
25
|
+
}
|
|
26
|
+
async chat(messages, options) {
|
|
27
|
+
// Convert ProductionMessage[] to provider message format
|
|
28
|
+
const providerMessages = messages.map(m => ({
|
|
29
|
+
role: m.role,
|
|
30
|
+
content: m.content,
|
|
31
|
+
tool_calls: m.toolCalls?.map(tc => ({
|
|
32
|
+
id: tc.id,
|
|
33
|
+
type: 'function',
|
|
34
|
+
function: {
|
|
35
|
+
name: tc.name,
|
|
36
|
+
arguments: stableStringify(tc.arguments),
|
|
37
|
+
},
|
|
38
|
+
})),
|
|
39
|
+
tool_call_id: m.toolCallId,
|
|
40
|
+
name: m.toolCallId ? messages.find(msg => msg.toolCalls?.some(tc => tc.id === m.toolCallId))?.toolCalls?.find(tc => tc.id === m.toolCallId)?.name : undefined,
|
|
41
|
+
}));
|
|
42
|
+
// Convert ProductionToolDefinition[] to ToolDefinitionSchema[]
|
|
43
|
+
const toolSchemas = options?.tools?.map(t => ({
|
|
44
|
+
type: 'function',
|
|
45
|
+
function: {
|
|
46
|
+
name: t.name,
|
|
47
|
+
description: t.description,
|
|
48
|
+
parameters: t.parameters,
|
|
49
|
+
},
|
|
50
|
+
}));
|
|
51
|
+
const model = options?.model || this.defaultModel;
|
|
52
|
+
// Call the underlying provider
|
|
53
|
+
const response = await this.provider.chatWithTools(providerMessages, {
|
|
54
|
+
tools: toolSchemas,
|
|
55
|
+
tool_choice: toolSchemas && toolSchemas.length > 0 ? 'auto' : undefined,
|
|
56
|
+
model,
|
|
57
|
+
maxTokens: options?.maxTokens,
|
|
58
|
+
});
|
|
59
|
+
// Convert response to ProductionChatResponse
|
|
60
|
+
return {
|
|
61
|
+
content: response.content,
|
|
62
|
+
toolCalls: response.toolCalls?.map(tc => {
|
|
63
|
+
let args;
|
|
64
|
+
if (typeof tc.function.arguments === 'string') {
|
|
65
|
+
const result = safeParseJson(tc.function.arguments, {
|
|
66
|
+
context: `tool ${tc.function.name}`,
|
|
67
|
+
});
|
|
68
|
+
args = result.success && result.value ? result.value : {};
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
args = tc.function.arguments;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
id: tc.id,
|
|
75
|
+
name: tc.function.name,
|
|
76
|
+
arguments: args,
|
|
77
|
+
};
|
|
78
|
+
}),
|
|
79
|
+
usage: response.usage ? {
|
|
80
|
+
inputTokens: response.usage.inputTokens,
|
|
81
|
+
outputTokens: response.usage.outputTokens,
|
|
82
|
+
totalTokens: (response.usage.inputTokens || 0) + (response.usage.outputTokens || 0),
|
|
83
|
+
} : undefined,
|
|
84
|
+
model: model,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// =============================================================================
|
|
89
|
+
// TOOL CONVERTER
|
|
90
|
+
// =============================================================================
|
|
91
|
+
/**
|
|
92
|
+
* Converts tools from ToolRegistry (lesson 03) to ProductionToolDefinition[] (lesson 25).
|
|
93
|
+
*/
|
|
94
|
+
export function convertToolsFromRegistry(registry) {
|
|
95
|
+
const descriptions = registry.getDescriptions();
|
|
96
|
+
return descriptions.map(desc => ({
|
|
97
|
+
name: desc.name,
|
|
98
|
+
description: desc.description,
|
|
99
|
+
parameters: desc.input_schema,
|
|
100
|
+
execute: async (args) => {
|
|
101
|
+
const result = await registry.execute(desc.name, args);
|
|
102
|
+
if (result.success) {
|
|
103
|
+
return result.output;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
throw new Error(result.output);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
dangerLevel: categorizeToolDanger(desc.name),
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Converts a single ToolDescription to ProductionToolDefinition.
|
|
114
|
+
*/
|
|
115
|
+
export function convertTool(desc, executor) {
|
|
116
|
+
return {
|
|
117
|
+
name: desc.name,
|
|
118
|
+
description: desc.description,
|
|
119
|
+
parameters: desc.input_schema,
|
|
120
|
+
execute: executor,
|
|
121
|
+
dangerLevel: categorizeToolDanger(desc.name),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Categorize tool danger level based on name.
|
|
126
|
+
*/
|
|
127
|
+
function categorizeToolDanger(toolName) {
|
|
128
|
+
const dangerous = ['bash', 'write_file', 'edit_file', 'delete_file'];
|
|
129
|
+
const moderate = ['list_files', 'glob'];
|
|
130
|
+
if (dangerous.includes(toolName))
|
|
131
|
+
return 'dangerous';
|
|
132
|
+
if (moderate.includes(toolName))
|
|
133
|
+
return 'moderate';
|
|
134
|
+
return 'safe';
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Creates an interactive approval handler for the REPL.
|
|
138
|
+
* Unlike the broken auto-approve, this actually asks the user.
|
|
139
|
+
*/
|
|
140
|
+
export function createInteractiveApprovalHandler(rl) {
|
|
141
|
+
return async (request) => {
|
|
142
|
+
const colors = {
|
|
143
|
+
reset: '\x1b[0m',
|
|
144
|
+
yellow: '\x1b[33m',
|
|
145
|
+
cyan: '\x1b[36m',
|
|
146
|
+
dim: '\x1b[2m',
|
|
147
|
+
};
|
|
148
|
+
console.log(`\n${colors.yellow}⚠️ Approval Required${colors.reset}`);
|
|
149
|
+
console.log(`${colors.cyan}Action:${colors.reset} ${request.action}`);
|
|
150
|
+
if (request.tool) {
|
|
151
|
+
console.log(`${colors.cyan}Tool:${colors.reset} ${request.tool}`);
|
|
152
|
+
}
|
|
153
|
+
if (request.args) {
|
|
154
|
+
console.log(`${colors.cyan}Args:${colors.reset} ${JSON.stringify(request.args, null, 2)}`);
|
|
155
|
+
}
|
|
156
|
+
console.log(`${colors.cyan}Risk:${colors.reset} ${request.risk}`);
|
|
157
|
+
console.log(`${colors.dim}${request.context}${colors.reset}`);
|
|
158
|
+
const answer = await rl.question(`\n${colors.yellow}Approve? (y/n/reason): ${colors.reset}`);
|
|
159
|
+
const trimmed = answer.trim().toLowerCase();
|
|
160
|
+
if (trimmed === 'y' || trimmed === 'yes') {
|
|
161
|
+
return { approved: true };
|
|
162
|
+
}
|
|
163
|
+
else if (trimmed === 'n' || trimmed === 'no') {
|
|
164
|
+
return { approved: false, reason: 'User denied' };
|
|
165
|
+
}
|
|
166
|
+
else if (trimmed.startsWith('n ')) {
|
|
167
|
+
return { approved: false, reason: trimmed.slice(2) };
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
// Treat any other input as denial with reason
|
|
171
|
+
return { approved: false, reason: trimmed || 'User denied' };
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Creates a TUI approval bridge that enables communication between
|
|
177
|
+
* the agent's human-in-loop system and the TUI's approval dialog.
|
|
178
|
+
*
|
|
179
|
+
* Usage:
|
|
180
|
+
* 1. Create the bridge before creating the agent
|
|
181
|
+
* 2. Pass bridge.handler to the agent's humanInLoop.approvalHandler
|
|
182
|
+
* 3. Pass bridge to TUIApp props
|
|
183
|
+
* 4. TUIApp calls bridge.connect() with its callbacks on mount
|
|
184
|
+
* 5. When approval is needed, bridge calls onRequest callback
|
|
185
|
+
* 6. TUIApp shows dialog, user responds, TUIApp calls bridge.resolve()
|
|
186
|
+
*/
|
|
187
|
+
export function createTUIApprovalBridge() {
|
|
188
|
+
let pendingResolve = null;
|
|
189
|
+
let onRequestCallback = null;
|
|
190
|
+
let connected = false;
|
|
191
|
+
const handler = async (request) => {
|
|
192
|
+
return new Promise((resolve) => {
|
|
193
|
+
pendingResolve = resolve;
|
|
194
|
+
if (onRequestCallback && connected) {
|
|
195
|
+
// TUI is connected, show dialog
|
|
196
|
+
onRequestCallback(request);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
// TUI not connected yet - BLOCK dangerous operations instead of auto-approving
|
|
200
|
+
// This is a safety fallback to prevent operations when the approval system isn't ready
|
|
201
|
+
console.warn('[TUI Approval] No TUI connected - blocking operation for safety');
|
|
202
|
+
resolve({ approved: false, reason: 'Approval system not ready - TUI not connected' });
|
|
203
|
+
pendingResolve = null;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
const connect = (callbacks) => {
|
|
208
|
+
onRequestCallback = callbacks.onRequest;
|
|
209
|
+
connected = true;
|
|
210
|
+
};
|
|
211
|
+
const resolve = (response) => {
|
|
212
|
+
if (pendingResolve) {
|
|
213
|
+
pendingResolve(response);
|
|
214
|
+
pendingResolve = null;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const hasPending = () => pendingResolve !== null;
|
|
218
|
+
const isConnected = () => connected;
|
|
219
|
+
return { handler, connect, resolve, hasPending, isConnected };
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=adapters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.js","sourceRoot":"","sources":["../../src/adapters.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAK1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;;;;;GAMG;AACH,MAAM,OAAO,eAAe;IAEhB;IACA;IAFV,YACU,QAA8B,EAC9B,YAAqB;QADrB,aAAQ,GAAR,QAAQ,CAAsB;QAC9B,iBAAY,GAAZ,YAAY,CAAS;IAC5B,CAAC;IAEJ,KAAK,CAAC,IAAI,CACR,QAA6B,EAC7B,OAA+B;QAE/B,yDAAyD;QACzD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC1C,IAAI,EAAE,CAAC,CAAC,IAAgD;YACxD,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,UAAU,EAAE,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;gBAClC,EAAE,EAAE,EAAE,CAAC,EAAE;gBACT,IAAI,EAAE,UAAmB;gBACzB,QAAQ,EAAE;oBACR,IAAI,EAAE,EAAE,CAAC,IAAI;oBACb,SAAS,EAAE,eAAe,CAAC,EAAE,CAAC,SAAS,CAAC;iBACzC;aACF,CAAC,CAAC;YACH,YAAY,EAAE,CAAC,CAAC,UAAU;YAC1B,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CACvC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,EA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,CAAC;QACxC,SAAS,GAAG,IAAI,CAAC;IACnB,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,CAAC,QAA0B,EAAE,EAAE;QAC7C,IAAI,cAAc,EAAE,CAAC;YACnB,cAAc,CAAC,QAAQ,CAAC,CAAC;YACzB,cAAc,GAAG,IAAI,CAAC;QACxB,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,cAAc,KAAK,IAAI,CAAC;IAEjD,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC;IAEpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Production Agent Tools
|
|
3
|
+
*
|
|
4
|
+
* Enhanced tools that integrate with production agent features.
|
|
5
|
+
*/
|
|
6
|
+
export { createLSPEditFileTool, createLSPWriteFileTool, createLSPFileTools, isLSPSupportedFile, type LSPFileToolsConfig, } from './lsp-file-tools.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent-tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,kBAAkB,GACxB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Production Agent Tools
|
|
3
|
+
*
|
|
4
|
+
* Enhanced tools that integrate with production agent features.
|
|
5
|
+
*/
|
|
6
|
+
// LSP-aware file tools
|
|
7
|
+
export { createLSPEditFileTool, createLSPWriteFileTool, createLSPFileTools, isLSPSupportedFile, } from './lsp-file-tools.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agent-tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,uBAAuB;AACvB,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,GAEnB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LSP-Aware File Tools
|
|
3
|
+
*
|
|
4
|
+
* Enhanced file editing tools that leverage Language Server Protocol
|
|
5
|
+
* to provide real-time diagnostic feedback after modifications.
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolDefinition } from '../types.js';
|
|
8
|
+
import type { LSPManager } from '../integrations/lsp.js';
|
|
9
|
+
export interface LSPFileToolsConfig {
|
|
10
|
+
/** LSPManager instance for diagnostics */
|
|
11
|
+
lspManager: LSPManager;
|
|
12
|
+
/** Wait time for diagnostics after edit (ms) */
|
|
13
|
+
diagnosticDelay?: number;
|
|
14
|
+
/** Include warnings in output */
|
|
15
|
+
includeWarnings?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create an LSP-aware edit_file tool.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createLSPEditFileTool(config: LSPFileToolsConfig): ToolDefinition;
|
|
21
|
+
/**
|
|
22
|
+
* Create an LSP-aware write_file tool.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createLSPWriteFileTool(config: LSPFileToolsConfig): ToolDefinition;
|
|
25
|
+
/**
|
|
26
|
+
* Create all LSP-aware file tools.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createLSPFileTools(config: LSPFileToolsConfig): ToolDefinition[];
|
|
29
|
+
/**
|
|
30
|
+
* Check if LSP diagnostics are available for a file type.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isLSPSupportedFile(filePath: string): boolean;
|
|
33
|
+
//# sourceMappingURL=lsp-file-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp-file-tools.d.ts","sourceRoot":"","sources":["../../../src/agent-tools/lsp-file-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,wBAAwB,CAAC;AAMxE,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,UAAU,EAAE,UAAU,CAAC;IACvB,gDAAgD;IAChD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iCAAiC;IACjC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AA8ED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CA0DhF;AAWD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAkDjF;AAMD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,EAAE,CAK/E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAU5D"}
|