@phuetz/code-buddy 2.0.0 → 2.2.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 +74 -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 +176 -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.d.ts +7 -0
- package/dist/agent/execution/tool-selection-strategy.js +32 -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 +2 -0
- package/dist/codebuddy/fleet-tool-defs.js +55 -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.d.ts +7 -0
- package/dist/codebuddy/providers/provider-openai-compat.js +29 -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 +12 -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.d.ts +13 -0
- package/dist/commands/mcp.js +66 -21
- 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 +103 -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 +197 -0
- package/dist/doctor/integrations.js +241 -0
- package/dist/doctor/triage.d.ts +108 -0
- package/dist/doctor/triage.js +304 -0
- package/dist/errors/crash-handler.js +2 -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.d.ts +11 -0
- package/dist/mcp/client.js +68 -3
- 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/mcp-oauth-constants.d.ts +8 -0
- package/dist/mcp/mcp-oauth-constants.js +9 -0
- package/dist/mcp/mcp-oauth-provider.d.ts +80 -0
- package/dist/mcp/mcp-oauth-provider.js +241 -0
- package/dist/mcp/mcp-oauth.d.ts +60 -1
- package/dist/mcp/mcp-oauth.js +241 -65
- package/dist/mcp/transports.d.ts +14 -5
- package/dist/mcp/transports.js +112 -101
- 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 +16 -6
- package/dist/services/runtime-settings-context.d.ts +81 -0
- package/dist/services/runtime-settings-context.js +79 -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 +30 -28
- package/dist/tools/peer-tool-invoke-tool.d.ts +61 -0
- package/dist/tools/peer-tool-invoke-tool.js +396 -0
- 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 +21 -3
- package/dist/tools/registry/fleet-tools.js +137 -4
- package/dist/tools/registry/index.d.ts +1 -1
- package/dist/tools/registry/index.js +2 -2
- 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/config-validation/schema.d.ts +2 -2
- 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/graceful-shutdown.d.ts +8 -0
- package/dist/utils/graceful-shutdown.js +23 -7
- 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
|
@@ -67,6 +67,12 @@ export const CRONJOB_TOOL = {
|
|
|
67
67
|
type: 'string',
|
|
68
68
|
description: 'Chain target: job id (or unique id prefix) to run on successful completion of this job.',
|
|
69
69
|
},
|
|
70
|
+
continuity: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
description: 'Opt-in per-job memory: {enabled: true, notes: {key: value}}. Bounded notes and the last successful output persist across runs. Default off.',
|
|
73
|
+
properties: { enabled: { type: 'boolean' }, notes: { type: 'object', additionalProperties: { type: 'string' } } },
|
|
74
|
+
additionalProperties: false,
|
|
75
|
+
},
|
|
70
76
|
preCheck: {
|
|
71
77
|
type: 'object',
|
|
72
78
|
description: 'Optional file_changed or command pre-check gate for create.',
|
|
@@ -4,10 +4,15 @@ export const SELF_DESCRIBE_TOOL = {
|
|
|
4
4
|
function: {
|
|
5
5
|
name: 'self_describe',
|
|
6
6
|
description: "Inspect this robot/agent's implementation and evidenced turn metadata: package/revision, relevant code areas, model/provider/surface, registered versus currently exposed tools, configuration-only faculties, and explicit limits. It performs no live hardware, process, service, or network probes; unavailable attestations remain unknown. " +
|
|
7
|
-
'Use it for technical introspection and questions about current capabilities. Its output is a verifiable operational self-model, never evidence of subjective consciousness.',
|
|
7
|
+
'Optional operation=list/read/search explores attested implementation files under src/ or dist/ with paths and line numbers; no arbitrary workspace access. Use it for technical introspection and questions about current settings (theme, model, provider, permissions, turn limits) and capabilities. Its output is a verifiable operational self-model, never evidence of subjective consciousness.',
|
|
8
8
|
parameters: {
|
|
9
9
|
type: 'object',
|
|
10
10
|
properties: {
|
|
11
|
+
operation: { type: 'string', enum: ['list', 'read', 'search'], description: 'Omit for runtime settings and overview. Use list/read/search for deeper code research.' },
|
|
12
|
+
path: { type: 'string', maxLength: 160, description: 'Relative core implementation path. Default src/ in a checkout, dist/ in an installed package.' },
|
|
13
|
+
query: { type: 'string', maxLength: 160, description: 'Literal text for search, never a shell command or regex.' },
|
|
14
|
+
offset: { type: 'integer', description: 'Zero-based list offset. Use returned nextOffset to continue a truncated directory listing.' },
|
|
15
|
+
line: { type: 'integer', description: 'First line to read; returns at most 120 lines.' },
|
|
11
16
|
focus: {
|
|
12
17
|
type: 'string',
|
|
13
18
|
maxLength: 320,
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Grok Tools
|
|
3
|
-
*
|
|
4
|
-
* Main entry point for tool definitions and management.
|
|
5
|
-
* Tools are now organized in modular files under tool-definitions/.
|
|
6
|
-
*/
|
|
7
1
|
import type { CodeBuddyTool, JsonSchemaProperty } from "./client.js";
|
|
8
2
|
import { MCPManager, MCPTool } from "../mcp/client.js";
|
|
9
3
|
import { getToolSelector, ToolSelectionResult, QueryClassification, ToolCategory } from "../tools/tool-selector.js";
|
package/dist/codebuddy/tools.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
import { A2A_CALL_TOOL_DEF } from './a2a-call-tool-defs.js';
|
|
2
|
+
import { RESOURCE_CATALOG_TOOL_DEF } from './resource-catalog-tool-defs.js';
|
|
3
|
+
import { RAGCHAT_TOOL_DEF } from './ragchat-tool-defs.js';
|
|
4
|
+
import { integrationToolHints } from '../tools/integration-tool-hints.js';
|
|
1
5
|
/**
|
|
2
6
|
* Grok Tools
|
|
3
7
|
*
|
|
4
8
|
* Main entry point for tool definitions and management.
|
|
5
9
|
* Tools are now organized in modular files under tool-definitions/.
|
|
6
10
|
*/
|
|
7
|
-
import {
|
|
11
|
+
import { TOOL_METADATA as SEARCH_TOOL_METADATA } from '../tools/metadata.js';
|
|
12
|
+
import { setDeferredMCPSchemas, resolveDeferredSchemas as resolveSelectedSchemas } from "../tools/deferred-schema-state.js";
|
|
8
13
|
import { MCPManager } from "../mcp/client.js";
|
|
9
14
|
import { loadMCPConfig } from "../mcp/config.js";
|
|
10
15
|
import { getToolSelector, selectRelevantTools } from "../tools/tool-selector.js";
|
|
@@ -137,6 +142,7 @@ export function getBuiltinToolNames() {
|
|
|
137
142
|
MERGE_CONFLICT_TOOLS,
|
|
138
143
|
VULN_SCANNER_TOOLS,
|
|
139
144
|
SESSION_TOOLS,
|
|
145
|
+
[RAGCHAT_TOOL_DEF, RESOURCE_CATALOG_TOOL_DEF, A2A_CALL_TOOL_DEF],
|
|
140
146
|
FLEET_TOOLS,
|
|
141
147
|
CODE_EXPLORER_TOOLS,
|
|
142
148
|
WINDOWS_TOOLS,
|
|
@@ -269,6 +275,7 @@ export function initializeToolRegistry() {
|
|
|
269
275
|
registerGroup(SESSION_TOOLS);
|
|
270
276
|
// Fleet tools — peer_delegate, list_peers (Phase (d).17). Always available;
|
|
271
277
|
// peer_delegate returns a clear error when no peers are connected.
|
|
278
|
+
registerGroup([RAGCHAT_TOOL_DEF, RESOURCE_CATALOG_TOOL_DEF, A2A_CALL_TOOL_DEF]);
|
|
272
279
|
registerGroup(FLEET_TOOLS);
|
|
273
280
|
// CodeExplorer tools
|
|
274
281
|
registerGroup(CODE_EXPLORER_TOOLS);
|
|
@@ -593,6 +600,8 @@ export async function getAllCodeBuddyTools() {
|
|
|
593
600
|
initToolSearchIndex(allTools.map((t) => ({
|
|
594
601
|
name: t.function.name,
|
|
595
602
|
description: t.function.description ?? '',
|
|
603
|
+
parameters: t.function.parameters,
|
|
604
|
+
keywords: SEARCH_TOOL_METADATA.find(meta => meta.name === t.function.name)?.keywords,
|
|
596
605
|
})));
|
|
597
606
|
}
|
|
598
607
|
catch {
|
|
@@ -603,6 +612,12 @@ export async function getAllCodeBuddyTools() {
|
|
|
603
612
|
// ============================================================================
|
|
604
613
|
// Tool Selection (RAG-based)
|
|
605
614
|
// ============================================================================
|
|
615
|
+
/** Hydrate only names already exposed by assembly/selection; never add permissions. */
|
|
616
|
+
function hydrateExposedToolSchemas(tools) {
|
|
617
|
+
const resolved = new Map(resolveSelectedSchemas(tools.map(tool => tool.function.name))
|
|
618
|
+
.map(tool => [tool.function.name, tool]));
|
|
619
|
+
return tools.map(tool => resolved.get(tool.function.name) ?? tool);
|
|
620
|
+
}
|
|
606
621
|
/**
|
|
607
622
|
* Get relevant tools for a specific query using RAG-based selection
|
|
608
623
|
*
|
|
@@ -621,7 +636,7 @@ export async function getRelevantTools(query, options = {}) {
|
|
|
621
636
|
// If RAG is disabled, return all tools
|
|
622
637
|
if (!useRAG) {
|
|
623
638
|
return {
|
|
624
|
-
selectedTools: allTools,
|
|
639
|
+
selectedTools: hydrateExposedToolSchemas(allTools),
|
|
625
640
|
scores: new Map(allTools.map(t => [t.function.name, 1])),
|
|
626
641
|
classification: {
|
|
627
642
|
categories: ['file_read', 'file_write', 'system'],
|
|
@@ -633,7 +648,14 @@ export async function getRelevantTools(query, options = {}) {
|
|
|
633
648
|
originalTokens: 0
|
|
634
649
|
};
|
|
635
650
|
}
|
|
636
|
-
|
|
651
|
+
const preferred = integrationToolHints(query, allTools.map(tool => tool.function.name));
|
|
652
|
+
const selection = selectRelevantTools(query, allTools, maxTools, [
|
|
653
|
+
...(options.alwaysInclude ?? ['view_file', 'bash']), ...preferred,
|
|
654
|
+
]);
|
|
655
|
+
// Once selected, a deferred MCP tool must expose its argument schema.
|
|
656
|
+
// Empty stubs otherwise force valid models to emit {} for required inputs.
|
|
657
|
+
selection.selectedTools = hydrateExposedToolSchemas(selection.selectedTools);
|
|
658
|
+
return selection;
|
|
637
659
|
}
|
|
638
660
|
/**
|
|
639
661
|
* Classify a query to understand what types of tools are needed
|
|
@@ -144,16 +144,17 @@ export function registerDaemonCommands(program) {
|
|
|
144
144
|
const { getCronAgentBridge } = await import('../../daemon/cron-agent-bridge.js');
|
|
145
145
|
const { getCronScheduler } = await import('../../scheduler/cron-scheduler.js');
|
|
146
146
|
const { RunStore } = await import('../../observability/run-store.js');
|
|
147
|
+
const scheduler = getCronScheduler();
|
|
147
148
|
const bridge = getCronAgentBridge({
|
|
148
149
|
apiKey,
|
|
149
150
|
baseURL: process.env.GROK_BASE_URL,
|
|
150
151
|
model: process.env.GROK_MODEL || 'grok-3-latest',
|
|
151
152
|
maxToolRounds: 20,
|
|
152
153
|
jobTimeoutMs: 300000,
|
|
154
|
+
notepadDir: scheduler.notepadDir,
|
|
153
155
|
// Scheduled executions become first-class run records + artifacts.
|
|
154
156
|
runStore: RunStore.getInstance(),
|
|
155
157
|
});
|
|
156
|
-
const scheduler = getCronScheduler();
|
|
157
158
|
scheduler.setTaskExecutor(bridge.createTaskExecutor());
|
|
158
159
|
}
|
|
159
160
|
}
|
|
@@ -175,6 +176,7 @@ export function registerDaemonCommands(program) {
|
|
|
175
176
|
model: process.env.GROK_MODEL || 'grok-3-latest',
|
|
176
177
|
maxToolRounds: 20,
|
|
177
178
|
jobTimeoutMs: 600000,
|
|
179
|
+
notepadDir: scheduler.notepadDir,
|
|
178
180
|
runStore: RunStore.getInstance(),
|
|
179
181
|
});
|
|
180
182
|
scheduler.setTaskExecutor(bridge.createTaskExecutor());
|
|
@@ -129,6 +129,20 @@ export function registerEvolveCommands(program) {
|
|
|
129
129
|
process.exitCode = 1;
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
|
+
if (!v.passedAll || v.regressions.length || !/^[a-f0-9]{40,64}$/.test(v.sha)) {
|
|
133
|
+
logger.error('Variant is not eligible: missing verified commit, failed checks, or regressions.');
|
|
134
|
+
process.exitCode = 1;
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
if (git(['rev-parse', '--verify', `${v.branch}^{commit}`]).trim() !== v.sha)
|
|
139
|
+
throw new Error('Variant branch changed since evaluation');
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
logger.error(error instanceof Error ? error.message : String(error));
|
|
143
|
+
process.exitCode = 1;
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
132
146
|
if (!options.confirm) {
|
|
133
147
|
logger.info(`Preview: keep ${v.id} (${v.branch}) → merge into '${current}'.`);
|
|
134
148
|
logger.info(` fitness=${v.score.toFixed(3)} passedAll=${v.passedAll} regressions=[${v.regressions.join(', ')}]`);
|
|
@@ -136,7 +150,7 @@ export function registerEvolveCommands(program) {
|
|
|
136
150
|
return;
|
|
137
151
|
}
|
|
138
152
|
try {
|
|
139
|
-
execFileSync('git', ['merge', '--no-ff', '-m', `evolve: keep ${v.id} (${v.detail ?? ''})`, v.
|
|
153
|
+
execFileSync('git', ['merge', '--no-ff', '-m', `evolve: keep ${v.id} (${v.detail ?? ''})`, v.sha], {
|
|
140
154
|
stdio: 'inherit',
|
|
141
155
|
});
|
|
142
156
|
logger.info(`Merged ${v.branch} into '${current}'. Review the result and run your full validation.`);
|
|
@@ -155,6 +169,7 @@ export function registerEvolveCommands(program) {
|
|
|
155
169
|
.option('--rounds <n>', 'Candidates per goal (fan-out), or max auto-weaknesses', '1')
|
|
156
170
|
.option('--concurrency <n>', 'How many candidates to evaluate at once', '2')
|
|
157
171
|
.option('--baseline <ref>', 'Baseline ref to branch from + rank against', 'main')
|
|
172
|
+
.option('--eval-task <ids...>', 'Opt in to whole-agent LLM eval tasks; default objective is the offline harness benchmark')
|
|
158
173
|
.option('--model <model>', 'Model for the mutator agent + planner')
|
|
159
174
|
.option('--model-bandit', 'Pick the mutator model per-cycle with the cost-aware UCB bandit (opt-in; overrides --model per cycle)')
|
|
160
175
|
.option('--no-plan', 'Skip deliberate planning (use the ad-hoc mutator prompt)')
|
|
@@ -173,11 +188,12 @@ export function registerEvolveCommands(program) {
|
|
|
173
188
|
}
|
|
174
189
|
const { runEvolutionRound, agentMutator, formatEvolveRoundSummary } = await import('../../agent/self-improvement/evolution/evolution-engine.js');
|
|
175
190
|
const { makeLlmVariantPlanner } = await import('../../agent/self-improvement/evolution/variant-planner.js');
|
|
176
|
-
const {
|
|
177
|
-
const
|
|
191
|
+
const { defaultDeterministicComponents, evalTasksComponent, harnessTasksComponent } = await import('../../agent/self-improvement/evolution/variant-fitness.js');
|
|
192
|
+
const { scoreReferenceInWorktree } = await import('../../agent/self-improvement/evolution/worktree-scorer.js');
|
|
193
|
+
const baselineRef = git(['rev-parse', '--verify', `${options.baseline ?? 'main'}^{commit}`]).trim();
|
|
178
194
|
const rounds = Math.max(1, Number(options.rounds ?? '1') || 1);
|
|
179
195
|
const concurrency = Math.max(1, Number(options.concurrency ?? '2') || 2);
|
|
180
|
-
const components = defaultDeterministicComponents();
|
|
196
|
+
const components = [...defaultDeterministicComponents(true), options.evalTask ? evalTasksComponent(options.evalTask) : harnessTasksComponent()];
|
|
181
197
|
const mutate = agentMutator(options.model ? { model: options.model } : {});
|
|
182
198
|
// Deliberate planner (default on). --no-plan → a planner that returns null → mutator's ad-hoc prompt.
|
|
183
199
|
const planner = options.plan === false
|
|
@@ -219,7 +235,7 @@ export function registerEvolveCommands(program) {
|
|
|
219
235
|
logger.info(`Selected ${weaknesses.length} weakness(es): ${weaknesses.map((w) => w.goal.slice(0, 60)).join(' | ')}`);
|
|
220
236
|
}
|
|
221
237
|
logger.info(`Scoring baseline (${baselineRef})…`);
|
|
222
|
-
const baseline = await
|
|
238
|
+
const baseline = (await scoreReferenceInWorktree(baselineRef, { components })).report;
|
|
223
239
|
logger.info(` baseline fitness=${baseline.score.toFixed(3)}`);
|
|
224
240
|
// Compounding: build each candidate on top of the current best elite (guarded by reachability
|
|
225
241
|
// in the engine → falls back to baseline if that elite branch was pruned). Fitness stays vs baseline.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
export function registerFleetCollaborationCommands(fleet) {
|
|
3
|
+
const run = async (options, goal) => {
|
|
4
|
+
const controller = new AbortController();
|
|
5
|
+
const stop = () => controller.abort();
|
|
6
|
+
process.once('SIGINT', stop);
|
|
7
|
+
process.once('SIGTERM', stop);
|
|
8
|
+
try {
|
|
9
|
+
const { parseCollaborationConfig, runCollaboration } = await import('../../fleet/collaboration.js');
|
|
10
|
+
const config = parseCollaborationConfig(JSON.parse(await readFile(options.config, 'utf8')));
|
|
11
|
+
const report = await runCollaboration(config, {
|
|
12
|
+
goal, timeoutMs: Number(options.timeout), signal: controller.signal,
|
|
13
|
+
onProgress: options.json ? undefined : message => { process.stderr.write(`${message}\n`); },
|
|
14
|
+
});
|
|
15
|
+
if (options.json)
|
|
16
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
17
|
+
else {
|
|
18
|
+
process.stdout.write(`Fleet: ${report.status}\n`);
|
|
19
|
+
for (const peer of report.peers) {
|
|
20
|
+
process.stdout.write(`\n${peer.id} — ${peer.status}${peer.model ? ` (${peer.model})` : ''}\n${peer.error ?? peer.text ?? 'Authenticated and ready for peer.chat'}\n`);
|
|
21
|
+
}
|
|
22
|
+
if (report.synthesis)
|
|
23
|
+
process.stdout.write(`\nSynthesis (${report.synthesis.peer})\n${report.synthesis.text}\n`);
|
|
24
|
+
if (report.synthesisError)
|
|
25
|
+
process.stdout.write(`\nSynthesis: ${report.synthesisError}\n`);
|
|
26
|
+
}
|
|
27
|
+
if (report.status !== 'complete')
|
|
28
|
+
process.exitCode = 1;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
// Syntax errors can quote raw configuration, which may contain misplaced secrets.
|
|
32
|
+
const message = error instanceof SyntaxError ? 'Invalid fleet JSON configuration' : error instanceof Error ? error.message : 'Fleet operation failed';
|
|
33
|
+
if (options.json)
|
|
34
|
+
process.stdout.write(`${JSON.stringify({ status: 'failed', error: message })}\n`);
|
|
35
|
+
else
|
|
36
|
+
process.stderr.write(`${message}\n`);
|
|
37
|
+
process.exitCode = 1;
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
process.removeListener('SIGINT', stop);
|
|
41
|
+
process.removeListener('SIGTERM', stop);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
fleet.command('check')
|
|
45
|
+
.description('Verify authenticated peers and chat readiness without calling an LLM')
|
|
46
|
+
.requiredOption('--config <file>', 'Fleet JSON configuration (token environment variable names only)')
|
|
47
|
+
.option('--timeout <ms>', 'Per-request timeout, 1000–300000 ms', '10000')
|
|
48
|
+
.option('--json', 'Structured report')
|
|
49
|
+
.action((options) => run(options));
|
|
50
|
+
fleet.command('collaborate <goal>')
|
|
51
|
+
.description('Collect parallel peer reviews, then synthesize them (no remote file edits)')
|
|
52
|
+
.requiredOption('--config <file>', 'Fleet JSON configuration (2–8 peers)')
|
|
53
|
+
.option('--timeout <ms>', 'Per-request timeout, 1000–300000 ms', '120000')
|
|
54
|
+
.option('--json', 'Structured report')
|
|
55
|
+
.action((goal, options) => run(options, goal));
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=fleet-collaboration-commands.js.map
|
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
* These commands expose the same dispatch profile policy decisions used by
|
|
5
5
|
* Cowork/Fleet so an operator can inspect a route before running it.
|
|
6
6
|
*/
|
|
7
|
+
import { registerFleetMissionCommands } from './fleet-mission-commands.js';
|
|
8
|
+
import { registerFleetCollaborationCommands } from './fleet-collaboration-commands.js';
|
|
9
|
+
import { registerFleetRoomsCommands } from './fleet-rooms-commands.js';
|
|
7
10
|
import { createTokenCommand, registerFleetTokenCommand } from '../token.js';
|
|
8
11
|
import { DEFAULT_DISPATCH_POLICY_PREVIEW_TOOLS, FLEET_DISPATCH_PROFILES, FLEET_DISPATCH_PROFILE_GUIDANCE, buildHermesToolsetDescriptor, getDispatchToolPolicy, normalizeDispatchProfile, previewDispatchToolDecisions, } from '../../fleet/dispatch-profile.js';
|
|
9
12
|
function resolveFleetServerUrl(serverUrl) {
|
|
@@ -68,6 +71,32 @@ export function registerFleetCommands(program) {
|
|
|
68
71
|
const fleet = program
|
|
69
72
|
.command('fleet')
|
|
70
73
|
.description('Inspect Fleet routing, toolsets, and dispatch policy decisions');
|
|
74
|
+
registerFleetMissionCommands(fleet);
|
|
75
|
+
registerFleetRoomsCommands(fleet);
|
|
76
|
+
registerFleetCollaborationCommands(fleet);
|
|
77
|
+
fleet.command('supervise <manifest> <operation>')
|
|
78
|
+
.description('Run a fixed local fleet operation through the Code Buddy harness')
|
|
79
|
+
.option('--json', 'Output the structured harness result')
|
|
80
|
+
.action(async (manifest, operation, options) => {
|
|
81
|
+
const controller = new AbortController();
|
|
82
|
+
const stop = () => controller.abort();
|
|
83
|
+
process.once('SIGINT', stop);
|
|
84
|
+
process.once('SIGTERM', stop);
|
|
85
|
+
try {
|
|
86
|
+
const { runSupervisor } = await import('../../harness/fleet-supervisor.js');
|
|
87
|
+
const result = await runSupervisor(manifest, operation, { signal: controller.signal });
|
|
88
|
+
console.log(options.json ? JSON.stringify({ kind: 'fleet_supervisor_result', operation, ...result }) : result.output ?? result.error ?? '');
|
|
89
|
+
if (!result.success)
|
|
90
|
+
process.exitCode = 1;
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
printFleetServerError(error);
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
process.removeListener('SIGINT', stop);
|
|
97
|
+
process.removeListener('SIGTERM', stop);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
71
100
|
fleet
|
|
72
101
|
.command('status')
|
|
73
102
|
.description('Show Fleet status from the configured Code Buddy server')
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { execFileSync } from 'node:child_process';
|
|
4
|
+
import { MissionStore } from '../../harness/mission-store.js';
|
|
5
|
+
import { runMission } from '../../harness/mission-runner.js';
|
|
6
|
+
import { parseSupervisorManifest } from '../../harness/fleet-supervisor.js';
|
|
7
|
+
/** All paths/manifests are operator input. No provider or server is booted. */
|
|
8
|
+
export function registerFleetMissionCommands(fleet) {
|
|
9
|
+
const group = fleet.command('mission').description('Durable local mission ownership, handoff and results');
|
|
10
|
+
const output = (action) => async (...args) => {
|
|
11
|
+
try {
|
|
12
|
+
console.log(JSON.stringify(await action(...args.filter(a => typeof a === 'string'))));
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
16
|
+
process.exitCode = 1;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
group.command('list <store>')
|
|
20
|
+
.description('List mission metadata, with bounded pages and unreadable-record notices')
|
|
21
|
+
.option('--limit <count>', 'Maximum records examined in this page (1..100)', '25')
|
|
22
|
+
.option('--cursor <hash>', 'Continue after the previous page nextCursor')
|
|
23
|
+
.action((directory, options) => {
|
|
24
|
+
try {
|
|
25
|
+
console.log(JSON.stringify(new MissionStore(directory).list({ limit: Number(options.limit), cursor: options.cursor })));
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
29
|
+
process.exitCode = 1;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
group.command('create <store> <id> <manifest> <operation>').action(output(async (directory, id, manifestPath, name) => {
|
|
33
|
+
const file = path.resolve(manifestPath);
|
|
34
|
+
const manifest = parseSupervisorManifest(JSON.parse(await fs.readFile(file, 'utf8')), path.dirname(file), 43200000);
|
|
35
|
+
const op = manifest.operations.get(name);
|
|
36
|
+
if (!op)
|
|
37
|
+
throw new Error('Unknown manifest operation');
|
|
38
|
+
return new MissionStore(directory).create(id, { command: op.command, args: op.args, timeoutMs: op.timeoutMs, workspace: manifest.workspace });
|
|
39
|
+
}));
|
|
40
|
+
group.command('show <store> <id>').action(output((directory, id) => new MissionStore(directory).get(id)));
|
|
41
|
+
group.command('claim <store> <id> <owner>').action(output((directory, id, owner) => new MissionStore(directory).claim(id, owner)));
|
|
42
|
+
group.command('renew <store> <id> <owner> <generation>').action(output((directory, id, owner, generation) => new MissionStore(directory).renew(id, { owner: owner, generation: generation })));
|
|
43
|
+
group.command('run <store> <id> <owner> <generation>').action(output(async (directory, id, owner, generation) => {
|
|
44
|
+
const controller = new AbortController();
|
|
45
|
+
const stop = () => controller.abort();
|
|
46
|
+
process.once('SIGINT', stop);
|
|
47
|
+
process.once('SIGTERM', stop);
|
|
48
|
+
try {
|
|
49
|
+
const mission = await runMission(new MissionStore(directory), id, { owner: owner, generation: generation }, controller.signal);
|
|
50
|
+
if (!mission.result?.success)
|
|
51
|
+
process.exitCode = 1;
|
|
52
|
+
return mission;
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
process.removeListener('SIGINT', stop);
|
|
56
|
+
process.removeListener('SIGTERM', stop);
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
group.command('handoff <store> <id> <owner> <generation> <capsule>').action(output(async (directory, id, owner, generation, capsule) => new MissionStore(directory).handoff(id, { owner: owner, generation: generation }, JSON.parse(await fs.readFile(capsule, 'utf8')))));
|
|
60
|
+
group.command('reconcile <store> <id> <generation> <resolution> <evidence>').action(output((directory, id, generation, resolution, evidence) => new MissionStore(directory).reconcile(id, generation, resolution, evidence)));
|
|
61
|
+
group.command('ack <store> <id> <consumer>').action(output((directory, id, consumer) => new MissionStore(directory).acknowledge(id, consumer)));
|
|
62
|
+
const head = (workspace) => execFileSync('git', ['rev-parse', '--verify', 'HEAD'], { cwd: workspace, encoding: 'utf8', timeout: 5000 }).trim();
|
|
63
|
+
group.command('submit <store> <id> <owner> <generation>').action(output((directory, id, owner, generation) => {
|
|
64
|
+
const store = new MissionStore(directory);
|
|
65
|
+
return store.submit(id, { owner: owner, generation: generation }, head(store.get(id).operation.workspace));
|
|
66
|
+
}));
|
|
67
|
+
group.command('approve <store> <id> <reviewer> <commit>').action(output((directory, id, reviewer, commit) => {
|
|
68
|
+
const store = new MissionStore(directory);
|
|
69
|
+
return store.approve(id, reviewer, commit);
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=fleet-mission-commands.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `buddy fleet rooms` — persistent signed messages between fleet members.
|
|
3
|
+
*
|
|
4
|
+
* Messages are data: `read` and `tail` print sanitized text and never run
|
|
5
|
+
* anything. Credentials come from the environment by default
|
|
6
|
+
* (`CODEBUDDY_FLEET_ROOMS_URL`, `CODEBUDDY_FLEET_API_KEY` / `CODEBUDDY_FLEET_TOKEN`);
|
|
7
|
+
* the member secret stays in its 0600 identity file and is never printed.
|
|
8
|
+
*/
|
|
9
|
+
import type { Command } from 'commander';
|
|
10
|
+
export declare function registerFleetRoomsCommands(fleet: Command): void;
|