@phuetz/code-buddy 2.0.0 → 2.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/README.fr.md +56 -0
- package/README.md +73 -16
- package/codebuddy-runtime.json +5 -5
- package/dist/agent/codebuddy-agent.d.ts +18 -0
- package/dist/agent/codebuddy-agent.js +45 -8
- package/dist/agent/execution/agent-executor.d.ts +0 -9
- package/dist/agent/execution/agent-executor.js +165 -12
- package/dist/agent/execution/context-pipeline.d.ts +9 -0
- package/dist/agent/execution/context-pipeline.js +64 -2
- package/dist/agent/execution/tool-loop-guard.d.ts +76 -0
- package/dist/agent/execution/tool-loop-guard.js +165 -0
- package/dist/agent/execution/tool-selection-strategy.js +19 -2
- package/dist/agent/facades/session-facade.d.ts +0 -6
- package/dist/agent/facades/session-facade.js +0 -45
- package/dist/agent/hermes-claw-migrate.d.ts +0 -21
- package/dist/agent/hermes-claw-migrate.js +9 -4
- package/dist/agent/hermes-protocol-gateways.js +8 -1
- package/dist/agent/repo-profiler.js +17 -4
- package/dist/agent/self-improvement/authored-tool-runtime.js +10 -2
- package/dist/agent/self-improvement/evolution/ast-novelty.d.ts +5 -0
- package/dist/agent/self-improvement/evolution/ast-novelty.js +58 -23
- package/dist/agent/self-improvement/evolution/code-variant-store.d.ts +3 -0
- package/dist/agent/self-improvement/evolution/evolution-engine.js +2 -0
- package/dist/agent/self-improvement/evolution/protected-paths.js +6 -0
- package/dist/agent/self-improvement/evolution/variant-fitness.d.ts +13 -2
- package/dist/agent/self-improvement/evolution/variant-fitness.js +184 -58
- package/dist/agent/self-improvement/evolution/worktree-scorer.d.ts +2 -0
- package/dist/agent/self-improvement/evolution/worktree-scorer.js +15 -0
- package/dist/agent/self-improvement/evolutionary-archive.d.ts +2 -1
- package/dist/agent/self-improvement/evolutionary-archive.js +34 -5
- package/dist/agent/self-improvement/proposal-store.d.ts +1 -0
- package/dist/agent/self-improvement/proposal-store.js +79 -17
- package/dist/agent/self-improvement/skill-apply-journal.d.ts +44 -0
- package/dist/agent/self-improvement/skill-apply-journal.js +178 -0
- package/dist/agent/self-improvement/skill-behavior-benchmark.d.ts +3 -0
- package/dist/agent/self-improvement/skill-behavior-benchmark.js +19 -0
- package/dist/agent/self-improvement/skill-behavior-gate.d.ts +34 -0
- package/dist/agent/self-improvement/skill-behavior-gate.js +96 -0
- package/dist/agent/self-improvement/skill-engine.d.ts +22 -0
- package/dist/agent/self-improvement/skill-engine.js +385 -13
- package/dist/agent/self-improvement/skill-gate.d.ts +2 -0
- package/dist/agent/self-improvement/skill-gate.js +17 -2
- package/dist/agent/self-improvement/skill-mutator.d.ts +6 -1
- package/dist/agent/self-improvement/skill-mutator.js +51 -15
- package/dist/agent/self-improvement/skill-types.d.ts +2 -1
- package/dist/agent/self-improvement/types.d.ts +11 -0
- package/dist/agent/tool-handler.d.ts +1 -1
- package/dist/agent/tool-handler.js +28 -9
- package/dist/auth/profile-manager.js +1 -1
- package/dist/channels/companion-channel-turn.d.ts +53 -4
- package/dist/channels/companion-channel-turn.js +218 -16
- package/dist/channels/slash-parity.d.ts +4 -6
- package/dist/channels/slash-parity.js +9 -44
- package/dist/cli/session-commands.d.ts +9 -0
- package/dist/cli/session-commands.js +45 -5
- package/dist/cli/session-picker.d.ts +43 -0
- package/dist/cli/session-picker.js +128 -0
- package/dist/codebuddy/a2a-call-tool-defs.d.ts +26 -0
- package/dist/codebuddy/a2a-call-tool-defs.js +12 -0
- package/dist/codebuddy/fleet-tool-defs.d.ts +1 -0
- package/dist/codebuddy/fleet-tool-defs.js +24 -0
- package/dist/codebuddy/providers/chatgpt-headers.d.ts +18 -0
- package/dist/codebuddy/providers/chatgpt-headers.js +37 -0
- package/dist/codebuddy/providers/provider-chatgpt-responses.d.ts +2 -1
- package/dist/codebuddy/providers/provider-chatgpt-responses.js +10 -23
- package/dist/codebuddy/providers/provider-openai-compat.js +1 -1
- package/dist/codebuddy/ragchat-tool-defs.d.ts +31 -0
- package/dist/codebuddy/ragchat-tool-defs.js +19 -0
- package/dist/codebuddy/resource-catalog-tool-defs.d.ts +28 -0
- package/dist/codebuddy/resource-catalog-tool-defs.js +18 -0
- package/dist/codebuddy/tool-definitions/agent-tools.js +2 -2
- package/dist/codebuddy/tool-definitions/code-exec-tools.js +5 -1
- package/dist/codebuddy/tool-definitions/cron-tools.js +6 -0
- package/dist/codebuddy/tool-definitions/self-describe-tools.js +6 -1
- package/dist/codebuddy/tools.d.ts +0 -6
- package/dist/codebuddy/tools.js +25 -3
- package/dist/commands/cli/daemon-commands.js +3 -1
- package/dist/commands/cli/evolve-command.js +21 -5
- package/dist/commands/cli/fleet-collaboration-commands.d.ts +2 -0
- package/dist/commands/cli/fleet-collaboration-commands.js +57 -0
- package/dist/commands/cli/fleet-commands.js +29 -0
- package/dist/commands/cli/fleet-mission-commands.d.ts +3 -0
- package/dist/commands/cli/fleet-mission-commands.js +72 -0
- package/dist/commands/cli/fleet-rooms-commands.d.ts +10 -0
- package/dist/commands/cli/fleet-rooms-commands.js +289 -0
- package/dist/commands/cli/tools-commands.js +2 -1
- package/dist/commands/cli/triage-command.d.ts +8 -0
- package/dist/commands/cli/triage-command.js +72 -0
- package/dist/commands/cli/utility-commands.js +25 -1
- package/dist/commands/client-dispatcher.d.ts +7 -0
- package/dist/commands/client-dispatcher.js +73 -21
- package/dist/commands/cron-cli/index.d.ts +3 -1
- package/dist/commands/cron-cli/index.js +25 -0
- package/dist/commands/device-auth.d.ts +10 -0
- package/dist/commands/device-auth.js +91 -0
- package/dist/commands/enhanced-command-handler.d.ts +9 -0
- package/dist/commands/enhanced-command-handler.js +28 -6
- package/dist/commands/handlers/agent-handlers.d.ts +1 -1
- package/dist/commands/handlers/agent-handlers.js +4 -4
- package/dist/commands/handlers/channel-handlers.js +53 -2
- package/dist/commands/handlers/export-handlers.d.ts +3 -2
- package/dist/commands/handlers/export-handlers.js +55 -28
- package/dist/commands/handlers/extra-handlers.js +5 -1
- package/dist/commands/handlers/grill-me-handler.js +26 -18
- package/dist/commands/handlers/memory-handlers.d.ts +6 -2
- package/dist/commands/handlers/memory-handlers.js +35 -15
- package/dist/commands/handlers/missing-handlers.d.ts +2 -2
- package/dist/commands/handlers/missing-handlers.js +4 -4
- package/dist/commands/handlers/resources-handler.d.ts +12 -0
- package/dist/commands/handlers/resources-handler.js +52 -0
- package/dist/commands/handlers/starter-handlers.d.ts +1 -1
- package/dist/commands/handlers/starter-handlers.js +32 -2
- package/dist/commands/handlers/switch-handler.d.ts +1 -1
- package/dist/commands/handlers/switch-handler.js +15 -0
- package/dist/commands/handlers/test-handlers.js +4 -86
- package/dist/commands/handlers/ui-handlers.js +11 -5
- package/dist/commands/login-chatgpt.d.ts +8 -0
- package/dist/commands/login-chatgpt.js +17 -0
- package/dist/commands/mcp-import.d.ts +11 -0
- package/dist/commands/mcp-import.js +67 -0
- package/dist/commands/mcp-invoke.d.ts +2 -0
- package/dist/commands/mcp-invoke.js +68 -0
- package/dist/commands/mcp.js +4 -0
- package/dist/commands/pipeline.d.ts +7 -1
- package/dist/commands/pipeline.js +104 -7
- package/dist/commands/resources.d.ts +2 -0
- package/dist/commands/resources.js +64 -0
- package/dist/commands/skills-cli/index.js +35 -12
- package/dist/commands/slash/builtin-commands.js +16 -3
- package/dist/commands/slash/index.d.ts +3 -1
- package/dist/commands/slash/index.js +2 -0
- package/dist/commands/slash/surfaces.d.ts +53 -0
- package/dist/commands/slash/surfaces.js +177 -0
- package/dist/commands/slash/types.d.ts +17 -0
- package/dist/commands/try.d.ts +1 -1
- package/dist/commands/try.js +1 -1
- package/dist/companion/companion-identity.d.ts +43 -0
- package/dist/companion/companion-identity.js +136 -0
- package/dist/companion/companion-toolset.d.ts +66 -0
- package/dist/companion/companion-toolset.js +368 -0
- package/dist/companion/companion-turn.d.ts +10 -2
- package/dist/companion/companion-turn.js +38 -1
- package/dist/config/code-exec-policy.d.ts +25 -0
- package/dist/config/code-exec-policy.js +39 -0
- package/dist/config/model-tools.d.ts +9 -0
- package/dist/config/model-tools.js +4 -0
- package/dist/context/context-manager-v2.js +2 -2
- package/dist/context/lm-resizer-compressor.js +3 -2
- package/dist/context/lm-resizer-diagnostics.d.ts +9 -0
- package/dist/context/lm-resizer-diagnostics.js +30 -0
- package/dist/context/tool-output-masking.js +3 -4
- package/dist/curator/curator.d.ts +6 -0
- package/dist/curator/curator.js +53 -3
- package/dist/daemon/cron-agent-bridge.d.ts +6 -0
- package/dist/daemon/cron-agent-bridge.js +31 -4
- package/dist/doctor/index.d.ts +11 -2
- package/dist/doctor/index.js +84 -21
- package/dist/doctor/integrations.d.ts +179 -0
- package/dist/doctor/integrations.js +227 -0
- package/dist/doctor/triage.d.ts +108 -0
- package/dist/doctor/triage.js +304 -0
- package/dist/fleet/collaboration.d.ts +44 -0
- package/dist/fleet/collaboration.js +170 -0
- package/dist/fleet/fleet-listener.d.ts +1 -0
- package/dist/fleet/fleet-listener.js +87 -46
- package/dist/fleet/fleet-registry.d.ts +2 -0
- package/dist/fleet/resource-catalog.d.ts +245 -0
- package/dist/fleet/resource-catalog.js +211 -0
- package/dist/fleet/rooms/room-access.d.ts +138 -0
- package/dist/fleet/rooms/room-access.js +196 -0
- package/dist/fleet/rooms/room-client.d.ts +158 -0
- package/dist/fleet/rooms/room-client.js +685 -0
- package/dist/fleet/rooms/room-event.d.ts +139 -0
- package/dist/fleet/rooms/room-event.js +330 -0
- package/dist/fleet/rooms/room-filter.d.ts +48 -0
- package/dist/fleet/rooms/room-filter.js +152 -0
- package/dist/fleet/rooms/room-hub.d.ts +154 -0
- package/dist/fleet/rooms/room-hub.js +363 -0
- package/dist/fleet/rooms/room-identity.d.ts +26 -0
- package/dist/fleet/rooms/room-identity.js +82 -0
- package/dist/fleet/rooms/room-lock.d.ts +34 -0
- package/dist/fleet/rooms/room-lock.js +180 -0
- package/dist/fleet/rooms/room-observations.d.ts +7 -0
- package/dist/fleet/rooms/room-observations.js +61 -0
- package/dist/fleet/rooms/room-server.d.ts +28 -0
- package/dist/fleet/rooms/room-server.js +75 -0
- package/dist/fleet/rooms/room-store.d.ts +119 -0
- package/dist/fleet/rooms/room-store.js +448 -0
- package/dist/fleet/rooms/room-ws-bridge.d.ts +27 -0
- package/dist/fleet/rooms/room-ws-bridge.js +137 -0
- package/dist/fleet/sensory-mission-bridge.d.ts +42 -0
- package/dist/fleet/sensory-mission-bridge.js +136 -0
- package/dist/git/worktree-sessions.js +1 -0
- package/dist/harness/contract.d.ts +4 -4
- package/dist/harness/fleet-supervisor.d.ts +16 -0
- package/dist/harness/fleet-supervisor.js +64 -0
- package/dist/harness/index.d.ts +4 -0
- package/dist/harness/index.js +4 -0
- package/dist/harness/mission-runner.d.ts +3 -0
- package/dist/harness/mission-runner.js +53 -0
- package/dist/harness/mission-store.d.ts +93 -0
- package/dist/harness/mission-store.js +297 -0
- package/dist/harness/tool-harness.d.ts +56 -0
- package/dist/harness/tool-harness.js +153 -0
- package/dist/hooks/use-enhanced-input.js +48 -4
- package/dist/hooks/use-input-handler.d.ts +1 -0
- package/dist/hooks/use-input-handler.js +82 -22
- package/dist/hooks/use-input-history.js +1 -0
- package/dist/identity/lisa-introspection.js +5 -2
- package/dist/identity/operational-self-model.d.ts +2 -0
- package/dist/identity/operational-self-model.js +4 -0
- package/dist/index.js +52 -6
- package/dist/mcp/client.js +6 -0
- package/dist/mcp/config.d.ts +20 -0
- package/dist/mcp/config.js +121 -8
- package/dist/mcp/import-normalize.d.ts +12 -0
- package/dist/mcp/import-normalize.js +114 -0
- package/dist/mcp/transports.d.ts +10 -5
- package/dist/mcp/transports.js +61 -99
- package/dist/mcp/types.d.ts +5 -0
- package/dist/media/comfyui-recipe-contract.d.ts +7 -7
- package/dist/memory/facts-memory.d.ts +11 -1
- package/dist/memory/facts-memory.js +47 -8
- package/dist/memory/memory-candidate-queue.d.ts +2 -2
- package/dist/memory/memory-candidate-queue.js +6 -6
- package/dist/memory/persistent-memory.d.ts +13 -8
- package/dist/memory/persistent-memory.js +77 -30
- package/dist/nodes/device-node.js +5 -9
- package/dist/observability/mobile-supervision-gateway-contract.js +20 -7
- package/dist/observability/run-event-writer.d.ts +21 -0
- package/dist/observability/run-event-writer.js +81 -0
- package/dist/observability/run-store.d.ts +5 -0
- package/dist/observability/run-store.js +18 -13
- package/dist/observability/run-trajectory.js +1 -1
- package/dist/optimization/prompt-cache.d.ts +19 -2
- package/dist/optimization/prompt-cache.js +41 -6
- package/dist/orchestration/orchestrator.d.ts +21 -0
- package/dist/orchestration/orchestrator.js +122 -15
- package/dist/persistence/session-content.d.ts +8 -0
- package/dist/persistence/session-content.js +76 -0
- package/dist/persistence/session-handoff.d.ts +64 -0
- package/dist/persistence/session-handoff.js +80 -0
- package/dist/persistence/session-history.d.ts +4 -0
- package/dist/persistence/session-history.js +38 -0
- package/dist/persistence/session-store.d.ts +9 -0
- package/dist/persistence/session-store.js +48 -20
- package/dist/personas/persona-manager.js +17 -1
- package/dist/plugins/code-explorer/CodeExplorerManager.d.ts +10 -4
- package/dist/plugins/code-explorer/CodeExplorerManager.js +69 -16
- package/dist/plugins/plugin-manager.js +10 -1
- package/dist/prompts/prompt-manager.js +11 -4
- package/dist/prompts/system-base.js +6 -2
- package/dist/protocols/a2a/codebuddy-executor.d.ts +11 -2
- package/dist/protocols/a2a/codebuddy-executor.js +9 -8
- package/dist/protocols/a2a/index.d.ts +1 -1
- package/dist/protocols/a2a/jsonrpc-v1.d.ts +41 -0
- package/dist/protocols/a2a/jsonrpc-v1.js +145 -0
- package/dist/protocols/a2a/peer-config.d.ts +20 -0
- package/dist/protocols/a2a/peer-config.js +55 -0
- package/dist/providers/codex-oauth.js +30 -6
- package/dist/providers/model-provider-compat.js +2 -1
- package/dist/sandbox/os-sandbox.d.ts +1 -1
- package/dist/scheduler/cron-scheduler.d.ts +15 -2
- package/dist/scheduler/cron-scheduler.js +35 -4
- package/dist/scheduler/job-notepad.d.ts +69 -0
- package/dist/scheduler/job-notepad.js +339 -0
- package/dist/security/audit-logger.d.ts +1 -1
- package/dist/security/compute-confinement.d.ts +4 -0
- package/dist/security/compute-confinement.js +89 -0
- package/dist/security/session-encryption.d.ts +4 -0
- package/dist/security/session-encryption.js +31 -0
- package/dist/sensory/voice-loop.d.ts +17 -0
- package/dist/sensory/voice-loop.js +72 -15
- package/dist/server/auth/device-session-context.d.ts +9 -0
- package/dist/server/auth/device-session-context.js +13 -0
- package/dist/server/auth/device-store.d.ts +89 -0
- package/dist/server/auth/device-store.js +261 -0
- package/dist/server/auth/device-token.d.ts +3 -0
- package/dist/server/auth/device-token.js +6 -0
- package/dist/server/auth/jwt.js +4 -0
- package/dist/server/index.d.ts +0 -10
- package/dist/server/index.js +28 -0
- package/dist/server/middleware/auth.js +3 -2
- package/dist/server/routes/a2a-jsonrpc.d.ts +9 -0
- package/dist/server/routes/a2a-jsonrpc.js +66 -0
- package/dist/server/routes/a2a-protocol.d.ts +12 -0
- package/dist/server/routes/a2a-protocol.js +1 -1
- package/dist/server/routes/device-auth.d.ts +4 -0
- package/dist/server/routes/device-auth.js +40 -0
- package/dist/server/types.d.ts +4 -0
- package/dist/server/websocket/handler.d.ts +13 -0
- package/dist/server/websocket/handler.js +102 -17
- package/dist/services/prompt-builder.d.ts +2 -0
- package/dist/services/prompt-builder.js +13 -5
- package/dist/services/runtime-settings-context.d.ts +73 -0
- package/dist/services/runtime-settings-context.js +69 -0
- package/dist/skills/executor.js +2 -0
- package/dist/skills/hub.js +16 -14
- package/dist/skills/local-inventory.d.ts +21 -0
- package/dist/skills/local-inventory.js +72 -0
- package/dist/skills/skill-loader.js +2 -2
- package/dist/skills/skill-usage-store.d.ts +49 -0
- package/dist/skills/skill-usage-store.js +121 -0
- package/dist/testing/ai-integration-tests.js +8 -5
- package/dist/themes/theme-manager.d.ts +12 -0
- package/dist/themes/theme-manager.js +29 -0
- package/dist/themes/theme-schema.d.ts +24 -24
- package/dist/tools/a2a-call-tool.d.ts +34 -0
- package/dist/tools/a2a-call-tool.js +75 -0
- package/dist/tools/bash/streaming-executor.d.ts +1 -0
- package/dist/tools/bash/streaming-executor.js +78 -90
- package/dist/tools/code-exec-preflight-runner.d.ts +41 -0
- package/dist/tools/code-exec-preflight-runner.js +254 -0
- package/dist/tools/code-exec-preflight.d.ts +44 -0
- package/dist/tools/code-exec-preflight.js +501 -0
- package/dist/tools/code-exec-tool.d.ts +48 -1
- package/dist/tools/code-exec-tool.js +191 -47
- package/dist/tools/comment-watcher.js +29 -12
- package/dist/tools/core-code-inspection.d.ts +56 -0
- package/dist/tools/core-code-inspection.js +86 -0
- package/dist/tools/create-skill-tool.d.ts +2 -3
- package/dist/tools/create-skill-tool.js +16 -75
- package/dist/tools/cronjob-tool.d.ts +1 -0
- package/dist/tools/cronjob-tool.js +1 -0
- package/dist/tools/env-doctor-tool.d.ts +2 -0
- package/dist/tools/env-doctor-tool.js +4 -3
- package/dist/tools/execute-code-rpc-invoker.d.ts +1 -1
- package/dist/tools/execute-code-rpc-invoker.js +35 -19
- package/dist/tools/execute-code-runner.d.ts +2 -0
- package/dist/tools/execute-code-runner.js +52 -17
- package/dist/tools/fleet-room-tool.d.ts +104 -0
- package/dist/tools/fleet-room-tool.js +124 -0
- package/dist/tools/integration-tool-hints.d.ts +4 -0
- package/dist/tools/integration-tool-hints.js +19 -0
- package/dist/tools/list-peers-tool.d.ts +3 -0
- package/dist/tools/list-peers-tool.js +11 -4
- package/dist/tools/media-generation-tool.d.ts +16 -1
- package/dist/tools/media-generation-tool.js +341 -9
- package/dist/tools/merge-conflict-tool.js +53 -25
- package/dist/tools/metadata.d.ts +1 -5
- package/dist/tools/metadata.js +21 -28
- package/dist/tools/ragchat-tool.d.ts +39 -0
- package/dist/tools/ragchat-tool.js +105 -0
- package/dist/tools/registry/fleet-tools.d.ts +9 -0
- package/dist/tools/registry/fleet-tools.js +22 -1
- package/dist/tools/registry/knowledge-tools.d.ts +2 -2
- package/dist/tools/registry/knowledge-tools.js +2 -2
- package/dist/tools/registry/lessons-tools.d.ts +7 -0
- package/dist/tools/registry/lessons-tools.js +43 -3
- package/dist/tools/registry/memory-tools.d.ts +1 -1
- package/dist/tools/registry/memory-tools.js +8 -8
- package/dist/tools/registry/research-tools.d.ts +1 -0
- package/dist/tools/registry/research-tools.js +4 -13
- package/dist/tools/registry/self-describe-tools.d.ts +1 -1
- package/dist/tools/registry/self-describe-tools.js +43 -30
- package/dist/tools/resource-catalog-tool.d.ts +38 -0
- package/dist/tools/resource-catalog-tool.js +46 -0
- package/dist/tools/skills-inspection-tool.js +30 -1
- package/dist/tools/stream-tool-output.d.ts +3 -0
- package/dist/tools/stream-tool-output.js +33 -0
- package/dist/tools/tool-call-scheduler.d.ts +10 -0
- package/dist/tools/tool-call-scheduler.js +58 -0
- package/dist/tools/tool-effect.d.ts +5 -0
- package/dist/tools/tool-effect.js +26 -0
- package/dist/tools/tool-search.d.ts +12 -11
- package/dist/tools/tool-search.js +67 -26
- package/dist/tools/types.d.ts +6 -0
- package/dist/ui/components/ChatHistory.d.ts +1 -1
- package/dist/ui/components/ChatHistory.js +2 -2
- package/dist/ui/components/ChatInput.d.ts +2 -1
- package/dist/ui/components/ChatInput.js +42 -88
- package/dist/ui/components/ChatInterface.d.ts +4 -2
- package/dist/ui/components/ChatInterface.js +27 -63
- package/dist/ui/components/CommandSuggestions.d.ts +0 -1
- package/dist/ui/components/CommandSuggestions.js +4 -6
- package/dist/ui/components/FileAutocomplete.js +1 -1
- package/dist/ui/components/KeyboardHelp.js +8 -6
- package/dist/ui/components/ModelSelection.js +6 -5
- package/dist/ui/components/StatusBar.d.ts +2 -1
- package/dist/ui/components/StatusBar.js +8 -7
- package/dist/ui/context/theme-context.js +3 -2
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui/utils/markdown-renderer.js +4 -13
- package/dist/utils/atomic-write.d.ts +22 -0
- package/dist/utils/atomic-write.js +29 -0
- package/dist/utils/bounded-output.d.ts +16 -0
- package/dist/utils/bounded-output.js +63 -0
- package/dist/utils/device-store-file.d.ts +4 -0
- package/dist/utils/device-store-file.js +40 -0
- package/dist/utils/export-manager.d.ts +9 -0
- package/dist/utils/export-manager.js +19 -0
- package/dist/utils/first-use-hints.d.ts +25 -0
- package/dist/utils/first-use-hints.js +58 -0
- package/dist/utils/history-manager.js +1 -1
- package/dist/utils/update-notifier.js +16 -18
- package/dist/wizard/environment-detection.d.ts +5 -1
- package/dist/wizard/environment-detection.js +49 -7
- package/dist/wizard/onboarding.d.ts +5 -1
- package/dist/wizard/onboarding.js +90 -30
- package/dist/wizard/provider-onboarding.d.ts +2 -0
- package/dist/wizard/provider-onboarding.js +55 -17
- package/package.json +7 -3
package/README.fr.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Code Buddy 2.1 — mémoire, apprentissage et coopération
|
|
2
|
+
|
|
3
|
+
Code Buddy peut conserver des informations utiles, proposer des leçons, réutiliser des skills et évaluer des variantes de code. Ces mécanismes agissent sur le contexte et les artefacts du système ; ils ne réentraînent pas les poids du modèle.
|
|
4
|
+
|
|
5
|
+
Pour l’installation et les autres usages, consulter le [README principal](README.md). Cette présentation thématique en français, qui n’est pas une traduction intégrale du README principal, accompagne le [guide technique et ses preuves de source](docs/learning-mechanisms.md).
|
|
6
|
+
|
|
7
|
+
## Nouveautés 2.1
|
|
8
|
+
|
|
9
|
+
La version 2.1 ajoute un catalogue explicite de ressources, la recherche RagChat avec citations de pages, l’import de configurations MCP et un pont A2A JSON-RPC limité aux échanges texte documentés. Elle corrige aussi des problèmes de sessions terminal, de mémoire par fournisseur, de diagnostic de configuration et d’interface Cowork. Les [notes de version](docs/RELEASE-NOTES-2.1.0.md) détaillent les limites : pas de reprise automatique des tâches après panne, pas de compatibilité universelle ni de garantie de qualité OCR.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install -g @phuetz/code-buddy@2.1.0
|
|
13
|
+
buddy --version
|
|
14
|
+
buddy doctor --offline
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
La CI impose Linux, macOS et Windows avec Node.js 20 et 22. Cowork reste une installation distincte du paquet npm CLI.
|
|
18
|
+
|
|
19
|
+
## Ce qui reste d’une session à l’autre
|
|
20
|
+
|
|
21
|
+
La mémoire de projet se trouve notamment dans `.codebuddy/CODEBUDDY_MEMORY.md`, la mémoire utilisateur dans `~/.codebuddy/memory.md`. Leur contenu peut rejoindre le prompt dans les limites et selon la portée du contexte actif. Les leçons constituent une autre couche : une session substantielle peut proposer des candidatures, à examiner avant qu’elles deviennent des leçons actives.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
buddy lessons candidate list
|
|
25
|
+
buddy lessons list
|
|
26
|
+
buddy lessons search "profil"
|
|
27
|
+
buddy lessons context
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Exemple d’usage : conserver une convention de tests du dépôt, puis proposer une leçon après un diagnostic utilisant le mauvais profil. Le rapprochement avec [Manus](https://manus.im/blog/Context-Engineering-for-AI-Agents-Lessons-from-Building-Manus) concerne le contexte externalisé et les observations d’erreurs, pas une copie de son système interne.
|
|
31
|
+
|
|
32
|
+
## Des procédures réutilisables et contrôlables
|
|
33
|
+
|
|
34
|
+
Les skills décrivent comment mener une tâche. Le système sait proposer des skills authored et consolider des procédures qui se recouvrent. Il conserve les skills épinglés et refuse les pertes de couverture détectées. Ces contrôles textuels doivent être complétés par une utilisation réelle de la procédure.
|
|
35
|
+
|
|
36
|
+
`buddy improve skills-list` inspecte les procédures authored. `buddy improve skills-consolidate` prévisualise une consolidation et peut appeler un modèle. Son option `--apply` demande explicitement l’installation et l’archivage ; son contrat diffère de celui des commandes génératives voisines.
|
|
37
|
+
|
|
38
|
+
## Améliorer les artefacts, puis évaluer les variantes de code
|
|
39
|
+
|
|
40
|
+
`CODEBUDDY_SELF_IMPROVE=true` conserve le mode proposition. La valeur `auto-apply`, ou l’autorisation explicite prévue par la commande concernée, permet de garder les changements validés. La voie `improve` portant sur la couche apprise et la voie `evolve` portant sur le code doivent être distinguées.
|
|
41
|
+
|
|
42
|
+
`buddy evolve list` et `buddy evolve review IDENTIFIANT` permettent d’examiner des variantes. Le moteur travaille dans des worktrees et ne fusionne pas automatiquement. Sa référence [DGM de Sakana](https://sakana.ai/dgm/) exprime une inspiration de méthode ; les performances publiées par Sakana ne sont pas des résultats de Code Buddy. Un score hors ligne reste limité au benchmark utilisé.
|
|
43
|
+
|
|
44
|
+
## Coopérer et explorer plusieurs pistes
|
|
45
|
+
|
|
46
|
+
Le Council peut répartir des rôles complémentaires, évaluer les réponses et les synthétiser. [Fugu, développé par Sakana AI](https://sakana.ai/fugu-release/) ; son modèle d’orchestration entraîné se distingue du conducteur déterministe actuellement présent dans Code Buddy.
|
|
47
|
+
|
|
48
|
+
Le moteur de raisonnement propose ToT/MCTS avec des budgets de recherche. `/think status` permet d’inspecter le réglage. Une consigne de raisonnement injectée par un middleware ne prouve pas qu’un arbre de recherche a été exécuté. Les références [ToT](https://arxiv.org/abs/2305.10601), [RethinkMCTS](https://arxiv.org/abs/2409.09584) et [MCTSr](https://arxiv.org/abs/2406.07394) sont explicitées dans le guide ; aucune équivalence de benchmark n’est annoncée.
|
|
49
|
+
|
|
50
|
+
Une recette de flotte a déjà relié deux hôtes : revue du Buddy Windows par RPC, correction du Buddy Linux, puis oracle indépendant réussi sur les deux systèmes (5/5 chacun). Le relais était assuré manuellement par le pilote. [Déroulement vérifié](docs/reports/2026-09/fleet-two-hosts-learning-example.md).
|
|
51
|
+
|
|
52
|
+
Le gain se vérifie sur une tâche concrète : référence avant changement, actions capturées, résultat, coût et régressions. La présence du code, son activation et son bénéfice observé sont trois constats différents.
|
|
53
|
+
|
|
54
|
+
## Portée des preuves
|
|
55
|
+
|
|
56
|
+
Le guide d’apprentissage a initialement été relu sur le candidat `01fc0dbd3` le 14 septembre 2026. Ce contrôle historique ne constitue pas la validation de la version 2.1.0 ; consulter les [notes de version](docs/RELEASE-NOTES-2.1.0.md) et les contrôles du commit publié pour identifier cette livraison.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
# Code Buddy 2
|
|
3
|
+
# Code Buddy 2.1
|
|
4
4
|
|
|
5
5
|
**A local-first AI coding agent that can also run as a fleet, a desktop app, and a companion.**
|
|
6
6
|
It reads your repository, writes code, runs commands, and you can watch it work — on your machine,
|
|
@@ -12,7 +12,8 @@ at $0 with [Ollama](https://ollama.com) or a ChatGPT subscription.
|
|
|
12
12
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-BSL_1.1-feca57.svg?style=flat-square" alt="License: Business Source License 1.1"/></a>
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
|
-
[
|
|
15
|
+
[Français](README.fr.md) ·
|
|
16
|
+
[What Code Buddy is](#what-code-buddy-is) ·
|
|
16
17
|
[Install](#install) ·
|
|
17
18
|
[First run](#first-run) ·
|
|
18
19
|
[Opt-in](#opt-in) ·
|
|
@@ -26,16 +27,34 @@ at $0 with [Ollama](https://ollama.com) or a ChatGPT subscription.
|
|
|
26
27
|
<sub>A local model reasons on screen, then uses a tool to create a real file. No cloud API bill.</sub>
|
|
27
28
|
</p>
|
|
28
29
|
|
|
30
|
+
<p>
|
|
31
|
+
<a href="docs/assets/infographic-code-buddy-2.webp"><img src="docs/assets/infographic-code-buddy-2.webp" width="900" alt="Code Buddy 2 architecture: you, multi-channel interfaces (terminal, Cowork, PWA, chat, voice, App Studio), the agentic runtime (council, fleet, memory, shadow workspace, evolve, knowledge graph), 220+ tools, 64 providers, and the autonomous engineering loop"/></a>
|
|
32
|
+
<br/>
|
|
33
|
+
<sub>The big picture: interfaces, the agentic runtime, tools and providers, and the loop that turns an idea into an improvement.</sub>
|
|
34
|
+
</p>
|
|
35
|
+
|
|
29
36
|
</div>
|
|
30
37
|
|
|
31
38
|
---
|
|
32
39
|
|
|
33
|
-
## What
|
|
40
|
+
## What Code Buddy is
|
|
41
|
+
|
|
42
|
+
### One minute with Lisa · French presentation
|
|
43
|
+
|
|
44
|
+
[](https://youtu.be/2XgFHxBeI8Q)
|
|
45
|
+
|
|
46
|
+
[Watch on YouTube](https://youtu.be/2XgFHxBeI8Q) · [MP4 alternative](https://www.agile-up.com/code-buddy/lisa/presentation.mp4) · [French subtitles](assets/site/lisa/presentation.fr.srt)
|
|
34
47
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
48
|
+
Lisa introduces the multi-AI hub, installation and optional perception components. Edited on September 13, 2026 from an existing September 10 master, with a synthetic voice and portrait, illustrative footage and French captions. Illustrations are not execution evidence. Voice and robotics require additional components beyond the npm package.
|
|
49
|
+
|
|
50
|
+
Code Buddy combines a terminal coding agent with cloud, gateway and local model routing,
|
|
51
|
+
query-selected tools, and the following interfaces. Optional services require their documented
|
|
52
|
+
configuration; enabling a feature does not replace its permission checks.
|
|
53
|
+
|
|
54
|
+
**New in 2.1:** explicit resource discovery and selection, RagChat search with page citations,
|
|
55
|
+
MCP configuration import, a bounded A2A JSON-RPC bridge, and fixes for terminal sessions,
|
|
56
|
+
configuration diagnostics and Cowork workflows. Read the [release notes](docs/RELEASE-NOTES-2.1.0.md)
|
|
57
|
+
for setup and the limits of each integration.
|
|
39
58
|
|
|
40
59
|
- **A multi-AI fleet hub.** Peers running `buddy server` observe each other's events and call each
|
|
41
60
|
other's models: one-shot `peer.chat`, multi-turn `peer.chat-session.*`, and `peer.tool.invoke`
|
|
@@ -101,6 +120,24 @@ The **Cowork** desktop app is a separate step needing Node.js ≥ 22: `buddy ins
|
|
|
101
120
|
|
|
102
121
|
---
|
|
103
122
|
|
|
123
|
+
## Use it from Claude Code (plugin, one command)
|
|
124
|
+
|
|
125
|
+
This repository is also a Claude Code plugin marketplace. It installs a skill
|
|
126
|
+
that teaches Claude Code how to drive `buddy` correctly (headless one-shot,
|
|
127
|
+
provider and model pinning, permission modes, the verify loop) and a read-only
|
|
128
|
+
MCP server exposing Code Buddy's tools:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
npm i -g @phuetz/code-buddy
|
|
132
|
+
claude plugin marketplace add phuetz/code-buddy
|
|
133
|
+
claude plugin install code-buddy@code-buddy
|
|
134
|
+
# optional, same marketplace: the context filter
|
|
135
|
+
claude plugin install lm-resizer@code-buddy
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Codex users: `cp -r .codex/skills/code-buddy ~/.codex/skills/`. Remove with
|
|
139
|
+
`claude plugin uninstall code-buddy@code-buddy`.
|
|
140
|
+
|
|
104
141
|
## First run
|
|
105
142
|
|
|
106
143
|
A real task, start to finish. `buddy loop` plans, edits, runs your verification command, and stops
|
|
@@ -136,6 +173,14 @@ names it.
|
|
|
136
173
|
|
|
137
174
|
---
|
|
138
175
|
|
|
176
|
+
## Memory and learning
|
|
177
|
+
|
|
178
|
+
Code Buddy keeps project/user memory, retrieves relevant lessons and can propose review-gated lesson candidates after substantial sessions. Authored skills can be inspected, improved and consolidated; code evolution evaluates variants in isolated worktrees. These change external state and inference-time behavior, not model weights.
|
|
179
|
+
|
|
180
|
+
Start with `buddy lessons candidate list`, `buddy lessons list`, `buddy improve status` and `buddy evolve list`. Council's role-based cooperation and the ToT/MCTS engine are separate mechanisms with their own execution paths and budgets. Inspiration from Manus, Sakana DGM/ShinkaEvolve/Fugu and reasoning papers is not a reproduction claim or a measured productivity gain.
|
|
181
|
+
|
|
182
|
+
Read [activation conditions, source evidence and limitations](docs/learning-mechanisms.md), or the [French overview](README.fr.md). A [two-host fleet recipe](docs/reports/2026-09/fleet-two-hosts-learning-example.md) has combined a Windows RPC review, a Linux code correction and an independent five-case oracle passing on both hosts. The pilot explicitly relayed messages and files; this was not a Council run.
|
|
183
|
+
|
|
139
184
|
## Opt-in
|
|
140
185
|
|
|
141
186
|
Nothing below is needed to chat with a local model. Defaults stay off.
|
|
@@ -144,7 +189,7 @@ Nothing below is needed to chat with a local model. Defaults stay off.
|
|
|
144
189
|
| --- | --- |
|
|
145
190
|
| `CODEBUDDY_PROVIDER=ollama` | Force the local Ollama path (no API key). |
|
|
146
191
|
| `CODEBUDDY_MAX_CONTEXT` | Override the context window for every consumer, including the Ollama server itself. |
|
|
147
|
-
| `CODEBUDDY_SELF_IMPROVE=true` |
|
|
192
|
+
| `CODEBUDDY_SELF_IMPROVE=true` | Enable the learned-layer proposal path. `true` stays propose-only; keeping validated changes needs explicit application authorization. The separate `buddy evolve` path can edit code in isolated worktrees. See [contracts](docs/learning-mechanisms.md). |
|
|
148
193
|
| `CODEBUDDY_SHADOW_WORKSPACE` | Validate proposed writes in a ghost worktree *before* touching your files. |
|
|
149
194
|
| `CODEBUDDY_TIMELINE` | Per-turn timeline; `buddy replay` inspects, restores or forks a session. |
|
|
150
195
|
| `CODEBUDDY_INTENTS` | Falsifiable versioned specs, so "done" stays re-provable later. |
|
|
@@ -172,13 +217,12 @@ their own gates, listed in [`docs/cb2/README.md`](docs/cb2/README.md) and
|
|
|
172
217
|
|
|
173
218
|
Honest limits for a first-time visitor:
|
|
174
219
|
|
|
175
|
-
- **The npm release can lag this tree.**
|
|
176
|
-
|
|
177
|
-
- **
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
affects contributors, not users.
|
|
220
|
+
- **The npm release can lag this tree.** Releases use GitHub Actions trusted publication.
|
|
221
|
+
Check `buddy --version`, the npm dist-tag and the corresponding Git tag when identifying a build.
|
|
222
|
+
- **CI gates all three operating systems.** Linux, macOS and Windows run Node.js 20 and 22
|
|
223
|
+
jobs. A local pass or an earlier platform recipe does not replace the candidate’s CI results.
|
|
224
|
+
- **Node ≥ 20 is the real floor**, for the CLI and for the test toolchain alike (`engines` says
|
|
225
|
+
so since 2.0.0).
|
|
182
226
|
- **Cowork** is a separate install (Node.js ≥ 22, `buddy install-gui`), not part of the three
|
|
183
227
|
commands above.
|
|
184
228
|
- **Film production** needs `ffmpeg`; without a local voice binary, scenes stay silent rather than
|
|
@@ -194,6 +238,18 @@ Honest limits for a first-time visitor:
|
|
|
194
238
|
|
|
195
239
|
---
|
|
196
240
|
|
|
241
|
+
## Test suite
|
|
242
|
+
|
|
243
|
+
38 088 tests in 2 115 files at `788f0ef23` (measured 2026-09-10 with `npm test`; 26 failures on that run were environment-only: a running local server, `dist/` not built, 20 s timeouts under load). `npm test -- tests/path/to/file.test.ts` to run a slice.
|
|
244
|
+
|
|
245
|
+
## Part of a toolchain
|
|
246
|
+
|
|
247
|
+
<p align="center">
|
|
248
|
+
<a href="docs/assets/infographic-ai-engineering-stack.webp"><img src="docs/assets/infographic-ai-engineering-stack.webp" width="900" alt="The AI engineering stack: Code Explorer understands the repository, lm-resizer protects the context budget, Code Buddy 2 acts with AI agents"/></a>
|
|
249
|
+
</p>
|
|
250
|
+
|
|
251
|
+
Code Buddy is the agent. Two sibling tools carry the context work around it: [lm-resizer](https://github.com/phuetz/lm-resizer) filters noisy command output before it reaches the model (Rust, Apache-2.0, `npm i @phuetz/lm-resizer`), and Code Explorer pre-indexes a repository into a queryable knowledge graph served over MCP (available as a service on private codebases — [agile-up.com](https://agile-up.com)). Understand, compress, act.
|
|
252
|
+
|
|
197
253
|
## License
|
|
198
254
|
|
|
199
255
|
Business Source License 1.1 — see [LICENSE](LICENSE). Self-host and personal / non-commercial use
|
|
@@ -205,7 +261,8 @@ to Apache 2.0 on 2030-08-31. Bundled Python skills stay MIT (see their `SKILL.md
|
|
|
205
261
|
## Documentation
|
|
206
262
|
|
|
207
263
|
- **[Getting started](docs/getting-started.md)** — first run, headless mode, sessions.
|
|
208
|
-
- **[Release notes 2.
|
|
264
|
+
- **[Release notes 2.1.0](docs/RELEASE-NOTES-2.1.0.md)** — current changes and integration limits.
|
|
265
|
+
- [Release notes 2.0.0](docs/RELEASE-NOTES-2.0.0.md) — previous major release.
|
|
209
266
|
- [Install](docs/install.md) — published npm, Docker/VPS, the one-command installer.
|
|
210
267
|
- [Commands](docs/commands.md) · [Features](docs/features.md) · [Security](docs/security.md)
|
|
211
268
|
- [Cowork Desktop](docs/cowork.md) · [Fleet](docs/fleet-guide.md) · [Code Buddy 2 features](docs/cb2/README.md)
|
package/codebuddy-runtime.json
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"corePackage": {
|
|
4
4
|
"name": "@phuetz/code-buddy",
|
|
5
|
-
"version": "2.
|
|
6
|
-
"description": "
|
|
5
|
+
"version": "2.1.0",
|
|
6
|
+
"description": "AI coding agent with terminal and HTTP interfaces, optional Cowork desktop integration, multi-provider routing, tools, fleet collaboration and inspectable memory. See release notes for supported integrations and limits."
|
|
7
7
|
},
|
|
8
|
-
"sourceRevision": "
|
|
8
|
+
"sourceRevision": "555f73ed991d2060fae76d4bca157f117c16f87c",
|
|
9
9
|
"sourceDirty": null,
|
|
10
10
|
"sourceRevisionOrigin": "env:GITHUB_SHA",
|
|
11
11
|
"distDigest": {
|
|
12
12
|
"algorithm": "sha256",
|
|
13
13
|
"scope": "dist-tree-code-without-maps-v1",
|
|
14
|
-
"value": "
|
|
15
|
-
"fileCount":
|
|
14
|
+
"value": "cc1eee996ab91732307df6008cd527ee0a350e5f13078cc95a95405d8349349b",
|
|
15
|
+
"fileCount": 5191
|
|
16
16
|
},
|
|
17
17
|
"runtime": {
|
|
18
18
|
"kind": "codebuddy-core",
|
|
@@ -59,6 +59,8 @@ export declare class CodeBuddyAgent extends BaseAgent {
|
|
|
59
59
|
private _budgetAlertListener?;
|
|
60
60
|
/** Nested host gates currently holding assistant text in a private draft state. */
|
|
61
61
|
private transcriptSnapshotSuspensions;
|
|
62
|
+
/** Serializes interactive session writes (one per completed TUI turn). */
|
|
63
|
+
private interactivePersistence;
|
|
62
64
|
/**
|
|
63
65
|
* Create a new CodeBuddyAgent instance
|
|
64
66
|
*
|
|
@@ -84,11 +86,16 @@ export declare class CodeBuddyAgent extends BaseAgent {
|
|
|
84
86
|
* Called by dev workflows to associate tool calls with a RunStore run.
|
|
85
87
|
*/
|
|
86
88
|
setRunId(runId: string | undefined): void;
|
|
89
|
+
private memoryBotId;
|
|
87
90
|
/**
|
|
88
91
|
* Multi-bot channels: scope this agent's per-bot state (persistent memory,
|
|
89
92
|
* lessons) to a bot id. Tool-execution contexts get tagged with it so
|
|
90
93
|
* `remember`/`lessons` write under `~/.codebuddy/bots/<botId>/`.
|
|
91
94
|
*/
|
|
95
|
+
getMemoryScope(): {
|
|
96
|
+
cwd: string;
|
|
97
|
+
botId?: string;
|
|
98
|
+
};
|
|
92
99
|
setChannelBotId(botId: string | undefined): void;
|
|
93
100
|
/** Scope raw tool-result recovery to an embedding host's conversation. */
|
|
94
101
|
setRecoverySessionId(sessionId: string | undefined): void;
|
|
@@ -196,6 +203,17 @@ export declare class CodeBuddyAgent extends BaseAgent {
|
|
|
196
203
|
*/
|
|
197
204
|
getSessionCostExtended(): ExtendedCostInfo;
|
|
198
205
|
saveCurrentSession(): Promise<void> | void;
|
|
206
|
+
/**
|
|
207
|
+
* Persist the interactive (TUI) conversation after a completed turn.
|
|
208
|
+
*
|
|
209
|
+
* The headless path creates its session up front and saves once; the TUI
|
|
210
|
+
* used to do neither, so interactive turns never reached the session file
|
|
211
|
+
* and `--resume` had nothing to continue. The first turn with a user message
|
|
212
|
+
* creates the session (named from that message); every later turn rewrites
|
|
213
|
+
* the session from the agent's chat history, which is idempotent: no turn is
|
|
214
|
+
* appended twice. Calls are serialized; `--ephemeral` stores nothing.
|
|
215
|
+
*/
|
|
216
|
+
persistInteractiveSession(): Promise<void>;
|
|
199
217
|
getCurrentSessionId(): string | null;
|
|
200
218
|
getClient(): CodeBuddyClient;
|
|
201
219
|
setModel(model: string): void;
|
|
@@ -22,9 +22,11 @@ import { MessageQueue } from "./message-queue.js";
|
|
|
22
22
|
import { CostPredictor } from "../analytics/cost-predictor.js";
|
|
23
23
|
import { BudgetAlertManager } from "../analytics/budget-alerts.js";
|
|
24
24
|
import { initializeMemory, getMemoryManager } from "../memory/persistent-memory.js";
|
|
25
|
+
import { restoreSessionHistory } from '../persistence/session-history.js';
|
|
25
26
|
import { getUserHooksManager } from "../hooks/user-hooks.js";
|
|
26
27
|
import { isFeatureEnabled } from "../config/feature-flags.js";
|
|
27
28
|
import { getActiveRunStore } from "../observability/run-store.js";
|
|
29
|
+
import { recordSkillActivity } from "../skills/skill-usage-store.js";
|
|
28
30
|
import { resetIdentityManager } from "../identity/identity-manager.js";
|
|
29
31
|
import { resetHotReloadManager } from "../config/hot-reload/index.js";
|
|
30
32
|
import { resetConfigWatcher } from "../config/hot-reload/watcher.js";
|
|
@@ -85,6 +87,8 @@ export class CodeBuddyAgent extends BaseAgent {
|
|
|
85
87
|
_budgetAlertListener;
|
|
86
88
|
/** Nested host gates currently holding assistant text in a private draft state. */
|
|
87
89
|
transcriptSnapshotSuspensions = 0;
|
|
90
|
+
/** Serializes interactive session writes (one per completed TUI turn). */
|
|
91
|
+
interactivePersistence = Promise.resolve();
|
|
88
92
|
/**
|
|
89
93
|
* Create a new CodeBuddyAgent instance
|
|
90
94
|
*
|
|
@@ -158,7 +162,7 @@ export class CodeBuddyAgent extends BaseAgent {
|
|
|
158
162
|
this.marketplace = this.infrastructure.marketplace;
|
|
159
163
|
this.repairCoordinator = this.infrastructure.repairCoordinator;
|
|
160
164
|
// Initialize Persistent Memory (CLAUDE.md style)
|
|
161
|
-
initializeMemory().catch(err => {
|
|
165
|
+
initializeMemory(undefined, initialWorkingDirectory).catch(err => {
|
|
162
166
|
logger.error('Failed to initialize persistent memory', { error: String(err) });
|
|
163
167
|
});
|
|
164
168
|
// Initialize cost prediction and budget alerts
|
|
@@ -451,7 +455,7 @@ export class CodeBuddyAgent extends BaseAgent {
|
|
|
451
455
|
memoryEnabled: this.memoryEnabled,
|
|
452
456
|
morphEditorEnabled: !!this.toolHandler.morphEditor,
|
|
453
457
|
cwd: initialWorkingDirectory,
|
|
454
|
-
}, this.promptCacheManager, this.memory, this.infrastructure.moltbotHooksManager, getMemoryManager());
|
|
458
|
+
}, this.promptCacheManager, this.memory, this.infrastructure.moltbotHooksManager, getMemoryManager(undefined, undefined, initialWorkingDirectory));
|
|
455
459
|
// Set up executors for the repair coordinator
|
|
456
460
|
this.repairCoordinator.setExecutors({
|
|
457
461
|
commandExecutor: async (cmd) => {
|
|
@@ -596,13 +600,19 @@ Look at the screenshot and find the element matching the user's intent. Output o
|
|
|
596
600
|
setRunId(runId) {
|
|
597
601
|
this.toolHandler.setRunId(runId);
|
|
598
602
|
}
|
|
603
|
+
memoryBotId;
|
|
599
604
|
/**
|
|
600
605
|
* Multi-bot channels: scope this agent's per-bot state (persistent memory,
|
|
601
606
|
* lessons) to a bot id. Tool-execution contexts get tagged with it so
|
|
602
607
|
* `remember`/`lessons` write under `~/.codebuddy/bots/<botId>/`.
|
|
603
608
|
*/
|
|
609
|
+
getMemoryScope() {
|
|
610
|
+
return { cwd: this.toolHandler.getWorkingDirectory(), botId: this.memoryBotId };
|
|
611
|
+
}
|
|
604
612
|
setChannelBotId(botId) {
|
|
613
|
+
this.memoryBotId = botId;
|
|
605
614
|
this.toolHandler.setBotId(botId);
|
|
615
|
+
this.promptBuilder.setPersistentMemory(getMemoryManager(undefined, botId, this.toolHandler.getWorkingDirectory()));
|
|
606
616
|
}
|
|
607
617
|
/** Scope raw tool-result recovery to an embedding host's conversation. */
|
|
608
618
|
setRecoverySessionId(sessionId) {
|
|
@@ -1152,6 +1162,7 @@ Look at the screenshot and find the element matching the user's intent. Output o
|
|
|
1152
1162
|
catch {
|
|
1153
1163
|
// Skill usage telemetry is best-effort and must not block a turn.
|
|
1154
1164
|
}
|
|
1165
|
+
recordSkillActivity(unifiedSkill.name, 'use', { source: 'match' });
|
|
1155
1166
|
}
|
|
1156
1167
|
}
|
|
1157
1168
|
else {
|
|
@@ -1380,6 +1391,7 @@ Look at the screenshot and find the element matching the user's intent. Output o
|
|
|
1380
1391
|
this.contextManager.importConversationState(cloned.contextManagerState);
|
|
1381
1392
|
this.toolHandler.restoreWorkingDirectory(cloned.workingDirectory);
|
|
1382
1393
|
this.promptBuilder.updateConfig({ cwd: cloned.workingDirectory });
|
|
1394
|
+
this.promptBuilder.setPersistentMemory(getMemoryManager(undefined, this.memoryBotId, cloned.workingDirectory));
|
|
1383
1395
|
}
|
|
1384
1396
|
getCurrentDirectory() {
|
|
1385
1397
|
return this.toolHandler.bash.getCurrentDirectory();
|
|
@@ -1394,16 +1406,12 @@ Look at the screenshot and find the element matching the user's intent. Output o
|
|
|
1394
1406
|
setWorkingDirectory(dir) {
|
|
1395
1407
|
this.toolHandler.setWorkingDirectory(dir);
|
|
1396
1408
|
this.promptBuilder.updateConfig({ cwd: dir || process.cwd() });
|
|
1409
|
+
this.promptBuilder.setPersistentMemory(getMemoryManager(undefined, this.memoryBotId, dir));
|
|
1397
1410
|
}
|
|
1398
1411
|
/** Rehydrate chat and LLM history from a persisted session (headless --resume). */
|
|
1399
1412
|
hydratePersistedSession(session) {
|
|
1400
1413
|
const entries = this.sessionStore.convertMessagesToChatEntries(session.messages);
|
|
1401
|
-
const llmMessages =
|
|
1402
|
-
for (const entry of entries) {
|
|
1403
|
-
if (entry.type === 'user' || entry.type === 'assistant') {
|
|
1404
|
-
llmMessages.push({ role: entry.type, content: entry.content });
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1414
|
+
const llmMessages = restoreSessionHistory(entries);
|
|
1407
1415
|
this.historyManager.setChatHistory(entries);
|
|
1408
1416
|
this.historyManager.setMessages(llmMessages);
|
|
1409
1417
|
if (session.workingDirectory) {
|
|
@@ -1508,6 +1516,35 @@ Look at the screenshot and find the element matching the user's intent. Output o
|
|
|
1508
1516
|
turns,
|
|
1509
1517
|
});
|
|
1510
1518
|
}
|
|
1519
|
+
/**
|
|
1520
|
+
* Persist the interactive (TUI) conversation after a completed turn.
|
|
1521
|
+
*
|
|
1522
|
+
* The headless path creates its session up front and saves once; the TUI
|
|
1523
|
+
* used to do neither, so interactive turns never reached the session file
|
|
1524
|
+
* and `--resume` had nothing to continue. The first turn with a user message
|
|
1525
|
+
* creates the session (named from that message); every later turn rewrites
|
|
1526
|
+
* the session from the agent's chat history, which is idempotent: no turn is
|
|
1527
|
+
* appended twice. Calls are serialized; `--ephemeral` stores nothing.
|
|
1528
|
+
*/
|
|
1529
|
+
persistInteractiveSession() {
|
|
1530
|
+
this.interactivePersistence = this.interactivePersistence.then(async () => {
|
|
1531
|
+
const store = this.sessionStore;
|
|
1532
|
+
if (store.isEphemeral())
|
|
1533
|
+
return;
|
|
1534
|
+
const history = this.historyManager.getChatHistory();
|
|
1535
|
+
const firstUser = history.find((entry) => entry.type === 'user');
|
|
1536
|
+
if (!firstUser)
|
|
1537
|
+
return;
|
|
1538
|
+
if (!store.getCurrentSessionId()) {
|
|
1539
|
+
const { generateConversationTitle } = await import('../utils/conversation-title.js');
|
|
1540
|
+
await store.createSession(generateConversationTitle(firstUser.content), this.getCurrentModel());
|
|
1541
|
+
}
|
|
1542
|
+
await this.saveCurrentSession();
|
|
1543
|
+
}).catch((error) => {
|
|
1544
|
+
logger.warn('[session] interactive turn not persisted', { error: error instanceof Error ? error.message : String(error) });
|
|
1545
|
+
});
|
|
1546
|
+
return this.interactivePersistence;
|
|
1547
|
+
}
|
|
1511
1548
|
getCurrentSessionId() {
|
|
1512
1549
|
return this.sessionStore.getCurrentSessionId();
|
|
1513
1550
|
}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Executor Module
|
|
3
|
-
*
|
|
4
|
-
* Implements the core agentic loop for processing user messages,
|
|
5
|
-
* both sequential and streaming. Handles tool execution rounds,
|
|
6
|
-
* token counting, cost tracking, and context management.
|
|
7
|
-
*
|
|
8
|
-
* @module agent/execution
|
|
9
|
-
*/
|
|
10
1
|
import { CodeBuddyClient, CodeBuddyMessage } from "../../codebuddy/client.js";
|
|
11
2
|
import { ChatEntry, StreamingChunk } from "../types.js";
|
|
12
3
|
import { ToolHandler } from "../tool-handler.js";
|