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,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Engineering Integration
|
|
3
|
+
*
|
|
4
|
+
* Integrates the Manus-inspired context engineering tricks (P, Q, R, S, T)
|
|
5
|
+
* into the production agent for improved performance and reliability.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - P: KV-Cache Aware Context - ~10x cost reduction on cached tokens
|
|
9
|
+
* - Q: Recitation / Goal Reinforcement - Combat "lost in middle" attention
|
|
10
|
+
* - R: Reversible Compaction - Preserve retrieval keys during summarization
|
|
11
|
+
* - S: Failure Evidence Preservation - Learn from mistakes, avoid loops
|
|
12
|
+
* - T: Serialization Diversity - Prevent few-shot pattern collapse
|
|
13
|
+
*/
|
|
14
|
+
import { stableStringify, type CacheStats } from '../tricks/kv-cache-context.js';
|
|
15
|
+
import { calculateOptimalFrequency, type RecitationState } from '../tricks/recitation.js';
|
|
16
|
+
import { createReconstructionPrompt, type Reference } from '../tricks/reversible-compaction.js';
|
|
17
|
+
import { extractInsights, type Failure, type FailurePattern } from '../tricks/failure-evidence.js';
|
|
18
|
+
import { type DiversityStats } from '../tricks/serialization-diversity.js';
|
|
19
|
+
/**
|
|
20
|
+
* Configuration for context engineering.
|
|
21
|
+
*/
|
|
22
|
+
export interface ContextEngineeringConfig {
|
|
23
|
+
/** Enable KV-cache optimization */
|
|
24
|
+
enableCacheOptimization?: boolean;
|
|
25
|
+
/** Enable periodic goal recitation */
|
|
26
|
+
enableRecitation?: boolean;
|
|
27
|
+
/** Enable reversible compaction */
|
|
28
|
+
enableReversibleCompaction?: boolean;
|
|
29
|
+
/** Enable failure tracking */
|
|
30
|
+
enableFailureTracking?: boolean;
|
|
31
|
+
/** Enable serialization diversity */
|
|
32
|
+
enableDiversity?: boolean;
|
|
33
|
+
/** Static prefix for system prompt (for cache optimization) */
|
|
34
|
+
staticPrefix?: string;
|
|
35
|
+
/** Recitation frequency (iterations) */
|
|
36
|
+
recitationFrequency?: number;
|
|
37
|
+
/** Diversity level (0-1) */
|
|
38
|
+
diversityLevel?: number;
|
|
39
|
+
/** Maximum failures to track */
|
|
40
|
+
maxFailures?: number;
|
|
41
|
+
/** Maximum references to preserve during compaction */
|
|
42
|
+
maxReferences?: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Message format for context engineering.
|
|
46
|
+
*/
|
|
47
|
+
export interface ContextMessage {
|
|
48
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
49
|
+
content: string;
|
|
50
|
+
name?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Context engineering statistics.
|
|
54
|
+
*/
|
|
55
|
+
export interface ContextEngineeringStats {
|
|
56
|
+
/** KV-cache statistics */
|
|
57
|
+
cache?: CacheStats;
|
|
58
|
+
/** Recitation injection count */
|
|
59
|
+
recitationInjections: number;
|
|
60
|
+
/** Preserved references from compaction */
|
|
61
|
+
preservedReferences: number;
|
|
62
|
+
/** Tracked failures */
|
|
63
|
+
trackedFailures: number;
|
|
64
|
+
/** Unresolved failures */
|
|
65
|
+
unresolvedFailures: number;
|
|
66
|
+
/** Failure patterns detected */
|
|
67
|
+
patternsDetected: number;
|
|
68
|
+
/** Serialization diversity stats */
|
|
69
|
+
diversity?: DiversityStats;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Events emitted by context engineering manager.
|
|
73
|
+
*/
|
|
74
|
+
export type ContextEngineeringEvent = {
|
|
75
|
+
type: 'recitation.injected';
|
|
76
|
+
iteration: number;
|
|
77
|
+
} | {
|
|
78
|
+
type: 'failure.recorded';
|
|
79
|
+
failure: Failure;
|
|
80
|
+
} | {
|
|
81
|
+
type: 'failure.pattern';
|
|
82
|
+
pattern: FailurePattern;
|
|
83
|
+
} | {
|
|
84
|
+
type: 'compaction.completed';
|
|
85
|
+
references: number;
|
|
86
|
+
} | {
|
|
87
|
+
type: 'cache.warning';
|
|
88
|
+
warning: string;
|
|
89
|
+
};
|
|
90
|
+
export type ContextEngineeringEventListener = (event: ContextEngineeringEvent) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Unified manager for all context engineering features.
|
|
93
|
+
*/
|
|
94
|
+
export declare class ContextEngineeringManager {
|
|
95
|
+
private config;
|
|
96
|
+
private cacheContext?;
|
|
97
|
+
private recitation?;
|
|
98
|
+
private compactor?;
|
|
99
|
+
private failureTracker?;
|
|
100
|
+
private serializer?;
|
|
101
|
+
private iteration;
|
|
102
|
+
private recitationInjections;
|
|
103
|
+
private patternsDetected;
|
|
104
|
+
private listeners;
|
|
105
|
+
constructor(config?: ContextEngineeringConfig);
|
|
106
|
+
/**
|
|
107
|
+
* Initialize sub-managers based on config.
|
|
108
|
+
*/
|
|
109
|
+
private initializeSubManagers;
|
|
110
|
+
/**
|
|
111
|
+
* Build a cache-optimized system prompt.
|
|
112
|
+
*/
|
|
113
|
+
buildSystemPrompt(options: {
|
|
114
|
+
rules?: string;
|
|
115
|
+
tools?: string;
|
|
116
|
+
memory?: string;
|
|
117
|
+
dynamic?: Record<string, string>;
|
|
118
|
+
}): string;
|
|
119
|
+
/**
|
|
120
|
+
* Serialize data with optional diversity.
|
|
121
|
+
*/
|
|
122
|
+
serialize(data: unknown): string;
|
|
123
|
+
/**
|
|
124
|
+
* Inject recitation if needed.
|
|
125
|
+
*/
|
|
126
|
+
injectRecitation(messages: ContextMessage[], state: Omit<RecitationState, 'iteration'>): ContextMessage[];
|
|
127
|
+
/**
|
|
128
|
+
* Update recitation frequency based on context size.
|
|
129
|
+
*/
|
|
130
|
+
updateRecitationFrequency(contextTokens: number): void;
|
|
131
|
+
/**
|
|
132
|
+
* Compact messages with reference preservation.
|
|
133
|
+
*/
|
|
134
|
+
compact(messages: ContextMessage[], summarize: (msgs: ContextMessage[]) => Promise<string>): Promise<{
|
|
135
|
+
summary: string;
|
|
136
|
+
references: Reference[];
|
|
137
|
+
reconstructionPrompt: string;
|
|
138
|
+
}>;
|
|
139
|
+
/**
|
|
140
|
+
* Search preserved references.
|
|
141
|
+
*/
|
|
142
|
+
searchReferences(query: string): Reference[];
|
|
143
|
+
/**
|
|
144
|
+
* Get preserved references by type.
|
|
145
|
+
*/
|
|
146
|
+
getReferencesByType(type: string): Reference[];
|
|
147
|
+
/**
|
|
148
|
+
* Record a failure.
|
|
149
|
+
*/
|
|
150
|
+
recordFailure(input: {
|
|
151
|
+
action: string;
|
|
152
|
+
args?: Record<string, unknown>;
|
|
153
|
+
error: string | Error;
|
|
154
|
+
intent?: string;
|
|
155
|
+
}): Failure | null;
|
|
156
|
+
/**
|
|
157
|
+
* Get failure context for LLM inclusion.
|
|
158
|
+
*/
|
|
159
|
+
getFailureContext(maxFailures?: number): string;
|
|
160
|
+
/**
|
|
161
|
+
* Check if an action has failed recently.
|
|
162
|
+
*/
|
|
163
|
+
hasRecentFailure(action: string): boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Get actionable insights from failures.
|
|
166
|
+
*/
|
|
167
|
+
getFailureInsights(): string[];
|
|
168
|
+
/**
|
|
169
|
+
* Mark a failure as resolved.
|
|
170
|
+
*/
|
|
171
|
+
resolveFailure(failureId: string): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Get current statistics.
|
|
174
|
+
*/
|
|
175
|
+
getStats(): ContextEngineeringStats;
|
|
176
|
+
/**
|
|
177
|
+
* Get current iteration.
|
|
178
|
+
*/
|
|
179
|
+
getIteration(): number;
|
|
180
|
+
/**
|
|
181
|
+
* Reset iteration counter (e.g., for new session).
|
|
182
|
+
*/
|
|
183
|
+
resetIteration(): void;
|
|
184
|
+
/**
|
|
185
|
+
* Clear all tracked state.
|
|
186
|
+
*/
|
|
187
|
+
clear(): void;
|
|
188
|
+
/**
|
|
189
|
+
* Subscribe to events.
|
|
190
|
+
*/
|
|
191
|
+
on(listener: ContextEngineeringEventListener): () => void;
|
|
192
|
+
private emit;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Create a context engineering manager.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* const contextEng = createContextEngineering({
|
|
200
|
+
* enableCacheOptimization: true,
|
|
201
|
+
* enableRecitation: true,
|
|
202
|
+
* enableFailureTracking: true,
|
|
203
|
+
* staticPrefix: 'You are a coding assistant.',
|
|
204
|
+
* recitationFrequency: 5,
|
|
205
|
+
* });
|
|
206
|
+
*
|
|
207
|
+
* // Build cache-optimized system prompt
|
|
208
|
+
* const systemPrompt = contextEng.buildSystemPrompt({
|
|
209
|
+
* rules: rulesContent,
|
|
210
|
+
* tools: toolDescriptions,
|
|
211
|
+
* dynamic: { sessionId: 'abc123' },
|
|
212
|
+
* });
|
|
213
|
+
*
|
|
214
|
+
* // Inject recitation during agent loop
|
|
215
|
+
* const messages = contextEng.injectRecitation(currentMessages, {
|
|
216
|
+
* goal: 'Implement user auth',
|
|
217
|
+
* plan: currentPlan,
|
|
218
|
+
* todos: currentTodos,
|
|
219
|
+
* });
|
|
220
|
+
*
|
|
221
|
+
* // Record failures
|
|
222
|
+
* try {
|
|
223
|
+
* await tool.execute(args);
|
|
224
|
+
* } catch (error) {
|
|
225
|
+
* contextEng.recordFailure({
|
|
226
|
+
* action: tool.name,
|
|
227
|
+
* args,
|
|
228
|
+
* error,
|
|
229
|
+
* });
|
|
230
|
+
* }
|
|
231
|
+
*
|
|
232
|
+
* // Include failure context in prompts
|
|
233
|
+
* const failureContext = contextEng.getFailureContext();
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
export declare function createContextEngineering(config?: ContextEngineeringConfig): ContextEngineeringManager;
|
|
237
|
+
/**
|
|
238
|
+
* Create a minimal context engineering manager for testing.
|
|
239
|
+
*/
|
|
240
|
+
export declare function createMinimalContextEngineering(): ContextEngineeringManager;
|
|
241
|
+
/**
|
|
242
|
+
* Create a full-featured context engineering manager.
|
|
243
|
+
*/
|
|
244
|
+
export declare function createFullContextEngineering(staticPrefix: string): ContextEngineeringManager;
|
|
245
|
+
export { stableStringify, calculateOptimalFrequency, createReconstructionPrompt, extractInsights, };
|
|
246
|
+
//# sourceMappingURL=context-engineering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-engineering.d.ts","sourceRoot":"","sources":["../../../src/integrations/context-engineering.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAGL,eAAe,EAEf,KAAK,UAAU,EAChB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAGL,yBAAyB,EACzB,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAGL,0BAA0B,EAC1B,KAAK,SAAS,EAEf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAGL,eAAe,EACf,KAAK,OAAO,EACZ,KAAK,cAAc,EACpB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,sCAAsC,CAAC;AAM9C;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,mCAAmC;IACnC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC,sCAAsC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,mCAAmC;IACnC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IAErC,8BAA8B;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC,qCAAqC;IACrC,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B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f,yBAAyB,EACzB,0BAA0B,EAC1B,eAAe,GAChB,CAAC"}
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Engineering Integration
|
|
3
|
+
*
|
|
4
|
+
* Integrates the Manus-inspired context engineering tricks (P, Q, R, S, T)
|
|
5
|
+
* into the production agent for improved performance and reliability.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - P: KV-Cache Aware Context - ~10x cost reduction on cached tokens
|
|
9
|
+
* - Q: Recitation / Goal Reinforcement - Combat "lost in middle" attention
|
|
10
|
+
* - R: Reversible Compaction - Preserve retrieval keys during summarization
|
|
11
|
+
* - S: Failure Evidence Preservation - Learn from mistakes, avoid loops
|
|
12
|
+
* - T: Serialization Diversity - Prevent few-shot pattern collapse
|
|
13
|
+
*/
|
|
14
|
+
import { createCacheAwareContext, stableStringify, analyzeCacheEfficiency, } from '../tricks/kv-cache-context.js';
|
|
15
|
+
import { createRecitationManager, calculateOptimalFrequency, } from '../tricks/recitation.js';
|
|
16
|
+
import { createReversibleCompactor, createReconstructionPrompt, } from '../tricks/reversible-compaction.js';
|
|
17
|
+
import { createFailureTracker, extractInsights, } from '../tricks/failure-evidence.js';
|
|
18
|
+
import { createDiverseSerializer, } from '../tricks/serialization-diversity.js';
|
|
19
|
+
// =============================================================================
|
|
20
|
+
// CONTEXT ENGINEERING MANAGER
|
|
21
|
+
// =============================================================================
|
|
22
|
+
/**
|
|
23
|
+
* Unified manager for all context engineering features.
|
|
24
|
+
*/
|
|
25
|
+
export class ContextEngineeringManager {
|
|
26
|
+
config;
|
|
27
|
+
// Sub-managers
|
|
28
|
+
cacheContext;
|
|
29
|
+
recitation;
|
|
30
|
+
compactor;
|
|
31
|
+
failureTracker;
|
|
32
|
+
serializer;
|
|
33
|
+
// State
|
|
34
|
+
iteration = 0;
|
|
35
|
+
recitationInjections = 0;
|
|
36
|
+
patternsDetected = 0;
|
|
37
|
+
listeners = [];
|
|
38
|
+
constructor(config = {}) {
|
|
39
|
+
this.config = {
|
|
40
|
+
enableCacheOptimization: config.enableCacheOptimization ?? true,
|
|
41
|
+
enableRecitation: config.enableRecitation ?? true,
|
|
42
|
+
enableReversibleCompaction: config.enableReversibleCompaction ?? true,
|
|
43
|
+
enableFailureTracking: config.enableFailureTracking ?? true,
|
|
44
|
+
enableDiversity: config.enableDiversity ?? false, // Off by default
|
|
45
|
+
staticPrefix: config.staticPrefix ?? 'You are a helpful AI assistant.',
|
|
46
|
+
recitationFrequency: config.recitationFrequency ?? 5,
|
|
47
|
+
diversityLevel: config.diversityLevel ?? 0.2,
|
|
48
|
+
maxFailures: config.maxFailures ?? 30,
|
|
49
|
+
maxReferences: config.maxReferences ?? 50,
|
|
50
|
+
};
|
|
51
|
+
this.initializeSubManagers();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Initialize sub-managers based on config.
|
|
55
|
+
*/
|
|
56
|
+
initializeSubManagers() {
|
|
57
|
+
if (this.config.enableCacheOptimization) {
|
|
58
|
+
this.cacheContext = createCacheAwareContext({
|
|
59
|
+
staticPrefix: this.config.staticPrefix,
|
|
60
|
+
cacheBreakpoints: ['system_end', 'tools_end', 'rules_end'],
|
|
61
|
+
deterministicJson: true,
|
|
62
|
+
enforceAppendOnly: true,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (this.config.enableRecitation) {
|
|
66
|
+
this.recitation = createRecitationManager({
|
|
67
|
+
frequency: this.config.recitationFrequency,
|
|
68
|
+
sources: ['goal', 'plan', 'todo'],
|
|
69
|
+
maxTokens: 500,
|
|
70
|
+
trackHistory: true,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (this.config.enableReversibleCompaction) {
|
|
74
|
+
this.compactor = createReversibleCompactor({
|
|
75
|
+
preserveTypes: ['file', 'url', 'function', 'error', 'command'],
|
|
76
|
+
maxReferences: this.config.maxReferences,
|
|
77
|
+
deduplicate: true,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (this.config.enableFailureTracking) {
|
|
81
|
+
this.failureTracker = createFailureTracker({
|
|
82
|
+
maxFailures: this.config.maxFailures,
|
|
83
|
+
preserveStackTraces: true,
|
|
84
|
+
detectRepeats: true,
|
|
85
|
+
repeatWarningThreshold: 3,
|
|
86
|
+
});
|
|
87
|
+
// Listen for patterns
|
|
88
|
+
this.failureTracker.on((event) => {
|
|
89
|
+
if (event.type === 'pattern.detected') {
|
|
90
|
+
this.patternsDetected++;
|
|
91
|
+
this.emit({ type: 'failure.pattern', pattern: event.pattern });
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if (this.config.enableDiversity) {
|
|
96
|
+
this.serializer = createDiverseSerializer({
|
|
97
|
+
variationLevel: this.config.diversityLevel,
|
|
98
|
+
preserveSemantics: true,
|
|
99
|
+
varyKeyOrder: true,
|
|
100
|
+
varyIndentation: true,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Build a cache-optimized system prompt.
|
|
106
|
+
*/
|
|
107
|
+
buildSystemPrompt(options) {
|
|
108
|
+
if (!this.cacheContext) {
|
|
109
|
+
// Fallback: simple concatenation
|
|
110
|
+
const parts = [this.config.staticPrefix];
|
|
111
|
+
if (options.rules)
|
|
112
|
+
parts.push('\n\n## Rules\n' + options.rules);
|
|
113
|
+
if (options.tools)
|
|
114
|
+
parts.push('\n\n## Tools\n' + options.tools);
|
|
115
|
+
if (options.memory)
|
|
116
|
+
parts.push('\n\n## Context\n' + options.memory);
|
|
117
|
+
if (options.dynamic) {
|
|
118
|
+
const dynamicParts = Object.entries(options.dynamic)
|
|
119
|
+
.map(([k, v]) => `${k}: ${v}`)
|
|
120
|
+
.join(' | ');
|
|
121
|
+
parts.push('\n\n---\n' + dynamicParts);
|
|
122
|
+
}
|
|
123
|
+
return parts.join('');
|
|
124
|
+
}
|
|
125
|
+
// Analyze for warnings
|
|
126
|
+
const systemPrompt = this.cacheContext.buildSystemPrompt(options);
|
|
127
|
+
const analysis = analyzeCacheEfficiency(systemPrompt);
|
|
128
|
+
for (const warning of analysis.warnings) {
|
|
129
|
+
this.emit({ type: 'cache.warning', warning });
|
|
130
|
+
}
|
|
131
|
+
return systemPrompt;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Serialize data with optional diversity.
|
|
135
|
+
*/
|
|
136
|
+
serialize(data) {
|
|
137
|
+
if (this.serializer) {
|
|
138
|
+
return this.serializer.serialize(data);
|
|
139
|
+
}
|
|
140
|
+
// Use stable stringify for cache efficiency
|
|
141
|
+
return stableStringify(data);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Inject recitation if needed.
|
|
145
|
+
*/
|
|
146
|
+
injectRecitation(messages, state) {
|
|
147
|
+
this.iteration++;
|
|
148
|
+
if (!this.recitation) {
|
|
149
|
+
return messages;
|
|
150
|
+
}
|
|
151
|
+
// Cast to compatible type - tool messages are preserved but not used in recitation
|
|
152
|
+
const result = this.recitation.injectIfNeeded(messages, {
|
|
153
|
+
...state,
|
|
154
|
+
iteration: this.iteration,
|
|
155
|
+
});
|
|
156
|
+
if (result.length > messages.length) {
|
|
157
|
+
this.recitationInjections++;
|
|
158
|
+
this.emit({ type: 'recitation.injected', iteration: this.iteration });
|
|
159
|
+
}
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Update recitation frequency based on context size.
|
|
164
|
+
*/
|
|
165
|
+
updateRecitationFrequency(contextTokens) {
|
|
166
|
+
if (this.recitation) {
|
|
167
|
+
const frequency = calculateOptimalFrequency(contextTokens);
|
|
168
|
+
this.recitation.updateConfig({ frequency });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Compact messages with reference preservation.
|
|
173
|
+
*/
|
|
174
|
+
async compact(messages, summarize) {
|
|
175
|
+
if (!this.compactor) {
|
|
176
|
+
// Fallback: simple summarization
|
|
177
|
+
const summary = await summarize(messages);
|
|
178
|
+
return {
|
|
179
|
+
summary,
|
|
180
|
+
references: [],
|
|
181
|
+
reconstructionPrompt: '',
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
const result = await this.compactor.compact(messages, { summarize });
|
|
185
|
+
this.emit({
|
|
186
|
+
type: 'compaction.completed',
|
|
187
|
+
references: result.references.length,
|
|
188
|
+
});
|
|
189
|
+
return {
|
|
190
|
+
summary: result.summary,
|
|
191
|
+
references: result.references,
|
|
192
|
+
reconstructionPrompt: createReconstructionPrompt(result.references),
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Search preserved references.
|
|
197
|
+
*/
|
|
198
|
+
searchReferences(query) {
|
|
199
|
+
return this.compactor?.searchReferences(query) || [];
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get preserved references by type.
|
|
203
|
+
*/
|
|
204
|
+
getReferencesByType(type) {
|
|
205
|
+
return this.compactor?.getReferencesByType(type) || [];
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Record a failure.
|
|
209
|
+
*/
|
|
210
|
+
recordFailure(input) {
|
|
211
|
+
if (!this.failureTracker) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
const failure = this.failureTracker.recordFailure({
|
|
215
|
+
...input,
|
|
216
|
+
iteration: this.iteration,
|
|
217
|
+
});
|
|
218
|
+
this.emit({ type: 'failure.recorded', failure });
|
|
219
|
+
return failure;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Get failure context for LLM inclusion.
|
|
223
|
+
*/
|
|
224
|
+
getFailureContext(maxFailures = 10) {
|
|
225
|
+
return this.failureTracker?.getFailureContext({ maxFailures }) || '';
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Check if an action has failed recently.
|
|
229
|
+
*/
|
|
230
|
+
hasRecentFailure(action) {
|
|
231
|
+
return this.failureTracker?.hasRecentFailure(action, 120000) || false;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Get actionable insights from failures.
|
|
235
|
+
*/
|
|
236
|
+
getFailureInsights() {
|
|
237
|
+
if (!this.failureTracker)
|
|
238
|
+
return [];
|
|
239
|
+
return extractInsights(this.failureTracker.getUnresolvedFailures());
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Mark a failure as resolved.
|
|
243
|
+
*/
|
|
244
|
+
resolveFailure(failureId) {
|
|
245
|
+
return this.failureTracker?.resolveFailure(failureId) || false;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get current statistics.
|
|
249
|
+
*/
|
|
250
|
+
getStats() {
|
|
251
|
+
const stats = {
|
|
252
|
+
recitationInjections: this.recitationInjections,
|
|
253
|
+
preservedReferences: this.compactor?.getPreservedReferences().length || 0,
|
|
254
|
+
trackedFailures: this.failureTracker?.getStats().total || 0,
|
|
255
|
+
unresolvedFailures: this.failureTracker?.getStats().unresolved || 0,
|
|
256
|
+
patternsDetected: this.patternsDetected,
|
|
257
|
+
};
|
|
258
|
+
if (this.serializer) {
|
|
259
|
+
stats.diversity = this.serializer.getStats();
|
|
260
|
+
}
|
|
261
|
+
return stats;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Get current iteration.
|
|
265
|
+
*/
|
|
266
|
+
getIteration() {
|
|
267
|
+
return this.iteration;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Reset iteration counter (e.g., for new session).
|
|
271
|
+
*/
|
|
272
|
+
resetIteration() {
|
|
273
|
+
this.iteration = 0;
|
|
274
|
+
this.recitationInjections = 0;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Clear all tracked state.
|
|
278
|
+
*/
|
|
279
|
+
clear() {
|
|
280
|
+
this.iteration = 0;
|
|
281
|
+
this.recitationInjections = 0;
|
|
282
|
+
this.patternsDetected = 0;
|
|
283
|
+
this.cacheContext?.reset();
|
|
284
|
+
this.recitation?.clearHistory();
|
|
285
|
+
this.compactor?.clear();
|
|
286
|
+
this.failureTracker?.clear();
|
|
287
|
+
this.serializer?.resetStats();
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Subscribe to events.
|
|
291
|
+
*/
|
|
292
|
+
on(listener) {
|
|
293
|
+
this.listeners.push(listener);
|
|
294
|
+
return () => {
|
|
295
|
+
const idx = this.listeners.indexOf(listener);
|
|
296
|
+
if (idx >= 0)
|
|
297
|
+
this.listeners.splice(idx, 1);
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
emit(event) {
|
|
301
|
+
for (const listener of this.listeners) {
|
|
302
|
+
try {
|
|
303
|
+
listener(event);
|
|
304
|
+
}
|
|
305
|
+
catch {
|
|
306
|
+
// Ignore listener errors
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
// =============================================================================
|
|
312
|
+
// FACTORY FUNCTIONS
|
|
313
|
+
// =============================================================================
|
|
314
|
+
/**
|
|
315
|
+
* Create a context engineering manager.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```typescript
|
|
319
|
+
* const contextEng = createContextEngineering({
|
|
320
|
+
* enableCacheOptimization: true,
|
|
321
|
+
* enableRecitation: true,
|
|
322
|
+
* enableFailureTracking: true,
|
|
323
|
+
* staticPrefix: 'You are a coding assistant.',
|
|
324
|
+
* recitationFrequency: 5,
|
|
325
|
+
* });
|
|
326
|
+
*
|
|
327
|
+
* // Build cache-optimized system prompt
|
|
328
|
+
* const systemPrompt = contextEng.buildSystemPrompt({
|
|
329
|
+
* rules: rulesContent,
|
|
330
|
+
* tools: toolDescriptions,
|
|
331
|
+
* dynamic: { sessionId: 'abc123' },
|
|
332
|
+
* });
|
|
333
|
+
*
|
|
334
|
+
* // Inject recitation during agent loop
|
|
335
|
+
* const messages = contextEng.injectRecitation(currentMessages, {
|
|
336
|
+
* goal: 'Implement user auth',
|
|
337
|
+
* plan: currentPlan,
|
|
338
|
+
* todos: currentTodos,
|
|
339
|
+
* });
|
|
340
|
+
*
|
|
341
|
+
* // Record failures
|
|
342
|
+
* try {
|
|
343
|
+
* await tool.execute(args);
|
|
344
|
+
* } catch (error) {
|
|
345
|
+
* contextEng.recordFailure({
|
|
346
|
+
* action: tool.name,
|
|
347
|
+
* args,
|
|
348
|
+
* error,
|
|
349
|
+
* });
|
|
350
|
+
* }
|
|
351
|
+
*
|
|
352
|
+
* // Include failure context in prompts
|
|
353
|
+
* const failureContext = contextEng.getFailureContext();
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
export function createContextEngineering(config = {}) {
|
|
357
|
+
return new ContextEngineeringManager(config);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Create a minimal context engineering manager for testing.
|
|
361
|
+
*/
|
|
362
|
+
export function createMinimalContextEngineering() {
|
|
363
|
+
return new ContextEngineeringManager({
|
|
364
|
+
enableCacheOptimization: false,
|
|
365
|
+
enableRecitation: false,
|
|
366
|
+
enableReversibleCompaction: false,
|
|
367
|
+
enableFailureTracking: true, // Keep failure tracking
|
|
368
|
+
enableDiversity: false,
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Create a full-featured context engineering manager.
|
|
373
|
+
*/
|
|
374
|
+
export function createFullContextEngineering(staticPrefix) {
|
|
375
|
+
return new ContextEngineeringManager({
|
|
376
|
+
enableCacheOptimization: true,
|
|
377
|
+
enableRecitation: true,
|
|
378
|
+
enableReversibleCompaction: true,
|
|
379
|
+
enableFailureTracking: true,
|
|
380
|
+
enableDiversity: true,
|
|
381
|
+
staticPrefix,
|
|
382
|
+
diversityLevel: 0.2,
|
|
383
|
+
recitationFrequency: 5,
|
|
384
|
+
maxFailures: 50,
|
|
385
|
+
maxReferences: 100,
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
// =============================================================================
|
|
389
|
+
// EXPORTS
|
|
390
|
+
// =============================================================================
|
|
391
|
+
export {
|
|
392
|
+
// Re-export from tricks for convenience
|
|
393
|
+
stableStringify, calculateOptimalFrequency, createReconstructionPrompt, extractInsights, };
|
|
394
|
+
//# sourceMappingURL=context-engineering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-engineering.js","sourceRoot":"","sources":["../../../src/integrations/context-engineering.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAEL,uBAAuB,EACvB,eAAe,EACf,sBAAsB,GAEvB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAEL,uBAAuB,EACvB,yBAAyB,GAE1B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAEL,yBAAyB,EACzB,0BAA0B,GAG3B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAEL,oBAAoB,EACpB,eAAe,GAGhB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAEL,uBAAuB,GAExB,MAAM,sCAAsC,CAAC;AAwF9C,gFAAgF;AAChF,8BAA8B;AAC9B,gFAAgF;AAEhF;;GAEG;AACH,MAAM,OAAO,yBAAyB;IAC5B,MAAM,CAAqC;IAEnD,eAAe;IACP,YAAY,CAAqB;IACjC,UAAU,CAAqB;IAC/B,SAAS,CAAuB;IAChC,cAAc,CAAkB;IAChC,UAAU,CAAqB;IAEvC,QAAQ;IACA,SAAS,GAAG,CAAC,CAAC;IACd,oBAAoB,GAAG,CAAC,CAAC;IACzB,gBAAgB,GAAG,CAAC,CAAC;IACrB,SAAS,GAAsC,EAAE,CAAC;IAE1D,YAAY,SAAmC,EAAE;QAC/C,IAAI,CAAC,MAAM,GAAG;YACZ,uBAAuB,EAAE,MAAM,CAAC,uBAAuB,IAAI,IAAI;YAC/D,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,IAAI,IAAI;YACjD,0BAA0B,EAAE,MAAM,CAAC,0BAA0B,IAAI,IAAI;YACrE,qBAAqB,EAAE,MAAM,CAAC,qBAAqB,IAAI,IAAI;YAC3D,eAAe,EAAE,MAAM,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