@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
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `buddy doctor` — Integrations section (comparatif plan P3).
|
|
3
|
+
*
|
|
4
|
+
* Aggregates EXISTING diagnostics without any network probe:
|
|
5
|
+
* - LM Resizer protocol (`diagnoseLmResizer`: bounded local `--help` runs only);
|
|
6
|
+
* - Code Explorer index freshness vs git HEAD (`getFreshness`, autoIndex off);
|
|
7
|
+
* - MCP configuration structure (`loadMCPConfig`, no server is started);
|
|
8
|
+
* - resource catalog observations (`ResourceCatalog.list`, never `probe`);
|
|
9
|
+
* - Skills Hub integrity (`listWithIntegrity`, same data as `buddy skills doctor`).
|
|
10
|
+
*
|
|
11
|
+
* Every probe is fail-soft: a broken source becomes a `warn` check, never a crash.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
import type { DoctorCheck, DoctorSummary } from './index.js';
|
|
15
|
+
export type IntegrationCheck = DoctorCheck & {
|
|
16
|
+
id: string;
|
|
17
|
+
section: 'integrations';
|
|
18
|
+
};
|
|
19
|
+
export interface IntegrationDeps {
|
|
20
|
+
lmResizer?: () => Promise<{
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
available: boolean;
|
|
23
|
+
toolOutputSupported: boolean;
|
|
24
|
+
binary: string;
|
|
25
|
+
version: string;
|
|
26
|
+
warning: string;
|
|
27
|
+
}>;
|
|
28
|
+
codeExplorerFreshness?: (cwd: string) => Promise<{
|
|
29
|
+
indexed: boolean;
|
|
30
|
+
stale: boolean;
|
|
31
|
+
unverified?: boolean;
|
|
32
|
+
commitsBehind?: number;
|
|
33
|
+
lastCommit?: string;
|
|
34
|
+
}>;
|
|
35
|
+
mcpServers?: (cwd: string) => Promise<Array<{
|
|
36
|
+
name: string;
|
|
37
|
+
enabled?: boolean;
|
|
38
|
+
transport?: {
|
|
39
|
+
type?: unknown;
|
|
40
|
+
};
|
|
41
|
+
command?: unknown;
|
|
42
|
+
}>>;
|
|
43
|
+
resources?: () => Promise<Array<{
|
|
44
|
+
resource: {
|
|
45
|
+
id: string;
|
|
46
|
+
kind: string;
|
|
47
|
+
};
|
|
48
|
+
state: string;
|
|
49
|
+
reason: string;
|
|
50
|
+
}>>;
|
|
51
|
+
skillsIntegrity?: () => Promise<Array<{
|
|
52
|
+
name: string;
|
|
53
|
+
exists: boolean;
|
|
54
|
+
integrityOk: boolean;
|
|
55
|
+
}>>;
|
|
56
|
+
/** Model whose code_exec policy is reported (default: saved settings model, then GROK_MODEL). */
|
|
57
|
+
configuredModel?: () => Promise<string | undefined>;
|
|
58
|
+
/** Never start a child process (the LM Resizer binary is located, not executed). */
|
|
59
|
+
noSubprocess?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export declare function runIntegrationChecks(cwd: string, deps?: IntegrationDeps): Promise<IntegrationCheck[]>;
|
|
62
|
+
export declare const doctorJsonReportSchema: z.ZodObject<{
|
|
63
|
+
version: z.ZodLiteral<1>;
|
|
64
|
+
generatedAt: z.ZodString;
|
|
65
|
+
offline: z.ZodBoolean;
|
|
66
|
+
summary: z.ZodObject<{
|
|
67
|
+
passed: z.ZodNumber;
|
|
68
|
+
warnings: z.ZodNumber;
|
|
69
|
+
errors: z.ZodNumber;
|
|
70
|
+
optionalNotInstalled: z.ZodNumber;
|
|
71
|
+
}, "strict", z.ZodTypeAny, {
|
|
72
|
+
errors: number;
|
|
73
|
+
warnings: number;
|
|
74
|
+
passed: number;
|
|
75
|
+
optionalNotInstalled: number;
|
|
76
|
+
}, {
|
|
77
|
+
errors: number;
|
|
78
|
+
warnings: number;
|
|
79
|
+
passed: number;
|
|
80
|
+
optionalNotInstalled: number;
|
|
81
|
+
}>;
|
|
82
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
section: z.ZodEnum<["core", "integrations"]>;
|
|
85
|
+
name: z.ZodString;
|
|
86
|
+
status: z.ZodEnum<["ok", "warn", "error"]>;
|
|
87
|
+
message: z.ZodString;
|
|
88
|
+
fixable: z.ZodBoolean;
|
|
89
|
+
optional: z.ZodBoolean;
|
|
90
|
+
}, "strict", z.ZodTypeAny, {
|
|
91
|
+
name: string;
|
|
92
|
+
message: string;
|
|
93
|
+
status: "warn" | "error" | "ok";
|
|
94
|
+
id: string;
|
|
95
|
+
section: "integrations" | "core";
|
|
96
|
+
optional: boolean;
|
|
97
|
+
fixable: boolean;
|
|
98
|
+
}, {
|
|
99
|
+
name: string;
|
|
100
|
+
message: string;
|
|
101
|
+
status: "warn" | "error" | "ok";
|
|
102
|
+
id: string;
|
|
103
|
+
section: "integrations" | "core";
|
|
104
|
+
optional: boolean;
|
|
105
|
+
fixable: boolean;
|
|
106
|
+
}>, "many">;
|
|
107
|
+
fixes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
108
|
+
success: z.ZodBoolean;
|
|
109
|
+
message: z.ZodString;
|
|
110
|
+
action: z.ZodString;
|
|
111
|
+
}, "strict", z.ZodTypeAny, {
|
|
112
|
+
message: string;
|
|
113
|
+
success: boolean;
|
|
114
|
+
action: string;
|
|
115
|
+
}, {
|
|
116
|
+
message: string;
|
|
117
|
+
success: boolean;
|
|
118
|
+
action: string;
|
|
119
|
+
}>, "many">>;
|
|
120
|
+
theme: z.ZodObject<{
|
|
121
|
+
id: z.ZodString;
|
|
122
|
+
name: z.ZodString;
|
|
123
|
+
}, "strict", z.ZodTypeAny, {
|
|
124
|
+
name: string;
|
|
125
|
+
id: string;
|
|
126
|
+
}, {
|
|
127
|
+
name: string;
|
|
128
|
+
id: string;
|
|
129
|
+
}>;
|
|
130
|
+
}, "strict", z.ZodTypeAny, {
|
|
131
|
+
version: 1;
|
|
132
|
+
summary: {
|
|
133
|
+
errors: number;
|
|
134
|
+
warnings: number;
|
|
135
|
+
passed: number;
|
|
136
|
+
optionalNotInstalled: number;
|
|
137
|
+
};
|
|
138
|
+
offline: boolean;
|
|
139
|
+
theme: {
|
|
140
|
+
name: string;
|
|
141
|
+
id: string;
|
|
142
|
+
};
|
|
143
|
+
checks: {
|
|
144
|
+
name: string;
|
|
145
|
+
message: string;
|
|
146
|
+
status: "warn" | "error" | "ok";
|
|
147
|
+
id: string;
|
|
148
|
+
section: "integrations" | "core";
|
|
149
|
+
optional: boolean;
|
|
150
|
+
fixable: boolean;
|
|
151
|
+
}[];
|
|
152
|
+
generatedAt: string;
|
|
153
|
+
fixes?: {
|
|
154
|
+
message: string;
|
|
155
|
+
success: boolean;
|
|
156
|
+
action: string;
|
|
157
|
+
}[] | undefined;
|
|
158
|
+
}, {
|
|
159
|
+
version: 1;
|
|
160
|
+
summary: {
|
|
161
|
+
errors: number;
|
|
162
|
+
warnings: number;
|
|
163
|
+
passed: number;
|
|
164
|
+
optionalNotInstalled: number;
|
|
165
|
+
};
|
|
166
|
+
offline: boolean;
|
|
167
|
+
theme: {
|
|
168
|
+
name: string;
|
|
169
|
+
id: string;
|
|
170
|
+
};
|
|
171
|
+
checks: {
|
|
172
|
+
name: string;
|
|
173
|
+
message: string;
|
|
174
|
+
status: "warn" | "error" | "ok";
|
|
175
|
+
id: string;
|
|
176
|
+
section: "integrations" | "core";
|
|
177
|
+
optional: boolean;
|
|
178
|
+
fixable: boolean;
|
|
179
|
+
}[];
|
|
180
|
+
generatedAt: string;
|
|
181
|
+
fixes?: {
|
|
182
|
+
message: string;
|
|
183
|
+
success: boolean;
|
|
184
|
+
action: string;
|
|
185
|
+
}[] | undefined;
|
|
186
|
+
}>;
|
|
187
|
+
export type DoctorJsonReport = z.infer<typeof doctorJsonReportSchema>;
|
|
188
|
+
export declare function slugifyCheckName(name: string): string;
|
|
189
|
+
export declare function buildDoctorJsonReport(checks: DoctorCheck[], summary: DoctorSummary, options: {
|
|
190
|
+
offline: boolean;
|
|
191
|
+
now?: Date;
|
|
192
|
+
fixes?: Array<{
|
|
193
|
+
success: boolean;
|
|
194
|
+
message: string;
|
|
195
|
+
action: string;
|
|
196
|
+
}>;
|
|
197
|
+
}): DoctorJsonReport;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `buddy doctor` — Integrations section (comparatif plan P3).
|
|
3
|
+
*
|
|
4
|
+
* Aggregates EXISTING diagnostics without any network probe:
|
|
5
|
+
* - LM Resizer protocol (`diagnoseLmResizer`: bounded local `--help` runs only);
|
|
6
|
+
* - Code Explorer index freshness vs git HEAD (`getFreshness`, autoIndex off);
|
|
7
|
+
* - MCP configuration structure (`loadMCPConfig`, no server is started);
|
|
8
|
+
* - resource catalog observations (`ResourceCatalog.list`, never `probe`);
|
|
9
|
+
* - Skills Hub integrity (`listWithIntegrity`, same data as `buddy skills doctor`).
|
|
10
|
+
*
|
|
11
|
+
* Every probe is fail-soft: a broken source becomes a `warn` check, never a crash.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
import { getThemeManager } from '../themes/theme-manager.js';
|
|
15
|
+
const KNOWN_MCP_TRANSPORTS = new Set(['stdio', 'http', 'sse', 'streamable_http']);
|
|
16
|
+
function check(id, name, status, message, optional) {
|
|
17
|
+
return { id, section: 'integrations', name, status, message, ...(optional ? { optional } : {}) };
|
|
18
|
+
}
|
|
19
|
+
function errorText(error) {
|
|
20
|
+
return error instanceof Error ? error.message : String(error);
|
|
21
|
+
}
|
|
22
|
+
async function lmResizerCheck(deps) {
|
|
23
|
+
try {
|
|
24
|
+
if (deps.noSubprocess && !deps.lmResizer) {
|
|
25
|
+
const { isLmResizerEnabled, resolveLmResizerBin } = await import('../context/lm-resizer-compressor.js');
|
|
26
|
+
if (!isLmResizerEnabled()) {
|
|
27
|
+
return check('lm-resizer', 'LM Resizer', 'ok', 'disabled (CODEBUDDY_LM_RESIZER unset): tool observations stay raw', true);
|
|
28
|
+
}
|
|
29
|
+
const { commandExistsOnPath } = await import('./index.js');
|
|
30
|
+
const binary = resolveLmResizerBin();
|
|
31
|
+
return commandExistsOnPath(binary)
|
|
32
|
+
? check('lm-resizer', 'LM Resizer', 'ok', `enabled, ${binary} found; protocol not probed (no child process in this mode — run buddy doctor --integrations)`, true)
|
|
33
|
+
: check('lm-resizer', 'LM Resizer', 'warn', `enabled but binary unavailable (${binary}); observations stay raw`);
|
|
34
|
+
}
|
|
35
|
+
const diagnose = deps.lmResizer ?? (async () => (await import('../context/lm-resizer-diagnostics.js')).diagnoseLmResizer());
|
|
36
|
+
const d = await diagnose();
|
|
37
|
+
if (!d.enabled) {
|
|
38
|
+
return check('lm-resizer', 'LM Resizer', 'ok', 'disabled (CODEBUDDY_LM_RESIZER unset): tool observations stay raw', true);
|
|
39
|
+
}
|
|
40
|
+
if (!d.available) {
|
|
41
|
+
return check('lm-resizer', 'LM Resizer', 'warn', `enabled but binary unavailable (${d.binary}); observations stay raw`);
|
|
42
|
+
}
|
|
43
|
+
if (!d.toolOutputSupported) {
|
|
44
|
+
return check('lm-resizer', 'LM Resizer', 'warn', `enabled but ${d.binary} (${d.version}) lacks the tool-output protocol; compression is inactive — install a compatible release`);
|
|
45
|
+
}
|
|
46
|
+
return check('lm-resizer', 'LM Resizer', 'ok', `tool-output protocol supported (${d.version})`);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
return check('lm-resizer', 'LM Resizer', 'warn', `diagnostic failed: ${errorText(error)}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function codeExplorerCheck(cwd, deps) {
|
|
53
|
+
try {
|
|
54
|
+
const freshness = deps.codeExplorerFreshness ?? (async (dir) => {
|
|
55
|
+
const { CodeExplorerManager } = await import('../plugins/code-explorer/CodeExplorerManager.js');
|
|
56
|
+
return new CodeExplorerManager(dir).getFreshness(undefined, { autoIndex: false });
|
|
57
|
+
});
|
|
58
|
+
const f = await freshness(cwd);
|
|
59
|
+
if (!f.indexed)
|
|
60
|
+
return check('code-explorer', 'Code Explorer index', 'ok', 'repository not indexed (optional)', true);
|
|
61
|
+
if (f.unverified)
|
|
62
|
+
return check('code-explorer', 'Code Explorer index', 'warn', 'index present but freshness could not be verified against git HEAD');
|
|
63
|
+
if (f.stale) {
|
|
64
|
+
const behind = typeof f.commitsBehind === 'number' ? `${f.commitsBehind} commit(s) behind HEAD` : 'does not match HEAD';
|
|
65
|
+
return check('code-explorer', 'Code Explorer index', 'warn', `stale: ${behind} — re-run the Code Explorer analyze step`);
|
|
66
|
+
}
|
|
67
|
+
return check('code-explorer', 'Code Explorer index', 'ok', 'index matches git HEAD');
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
return check('code-explorer', 'Code Explorer index', 'warn', `freshness check failed: ${errorText(error)}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function mcpCheck(cwd, deps) {
|
|
74
|
+
try {
|
|
75
|
+
// Explicit project directory: never process.chdir() (global state shared across awaits).
|
|
76
|
+
// Diagnostics use the strictly read-only loader: no restore/rename/chmod/create of
|
|
77
|
+
// config or backups/temporaries, and corrupt sources surface as honest warnings.
|
|
78
|
+
let servers;
|
|
79
|
+
let warnings = [];
|
|
80
|
+
if (deps.mcpServers) {
|
|
81
|
+
servers = await deps.mcpServers(cwd);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
const { loadMCPConfigReadOnly } = await import('../mcp/config.js');
|
|
85
|
+
const result = loadMCPConfigReadOnly({ includeDisabled: true, cwd });
|
|
86
|
+
servers = result.servers;
|
|
87
|
+
warnings = result.warnings;
|
|
88
|
+
}
|
|
89
|
+
const disabled = servers.filter((s) => s.enabled === false).length;
|
|
90
|
+
const unusable = servers.filter((s) => {
|
|
91
|
+
if (s.enabled === false)
|
|
92
|
+
return false;
|
|
93
|
+
const type = s.transport && typeof s.transport === 'object' ? s.transport.type : undefined;
|
|
94
|
+
if (typeof type === 'string')
|
|
95
|
+
return !KNOWN_MCP_TRANSPORTS.has(type);
|
|
96
|
+
return typeof s.command !== 'string' || s.command.trim() === '';
|
|
97
|
+
}).map((s) => s.name);
|
|
98
|
+
const base = servers.length === 0
|
|
99
|
+
? 'no MCP server configured'
|
|
100
|
+
: `${servers.length} configured (${disabled} disabled); no server started`;
|
|
101
|
+
const parts = [base];
|
|
102
|
+
if (warnings.length > 0)
|
|
103
|
+
parts.push(`configuration warnings: ${warnings.join('; ')}`);
|
|
104
|
+
if (unusable.length > 0)
|
|
105
|
+
parts.push(`unusable transport configuration: ${unusable.join(', ')}`);
|
|
106
|
+
const message = parts.join('; ');
|
|
107
|
+
if (warnings.length > 0 || unusable.length > 0) {
|
|
108
|
+
return check('mcp', 'MCP servers', 'warn', message);
|
|
109
|
+
}
|
|
110
|
+
if (servers.length === 0)
|
|
111
|
+
return check('mcp', 'MCP servers', 'ok', message, true);
|
|
112
|
+
return check('mcp', 'MCP servers', 'ok', message);
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
return check('mcp', 'MCP servers', 'warn', `configuration unreadable: ${errorText(error)}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async function resourcesCheck(deps) {
|
|
119
|
+
try {
|
|
120
|
+
const list = deps.resources ?? (async () => new (await import('../fleet/resource-catalog.js')).ResourceCatalog().list());
|
|
121
|
+
const entries = await list();
|
|
122
|
+
if (entries.length === 0)
|
|
123
|
+
return check('resources', 'Resource catalog', 'ok', 'no resource declared (buddy resources add)', true);
|
|
124
|
+
const count = (state) => entries.filter((e) => e.state === state).length;
|
|
125
|
+
const summary = `${entries.length} declared: ${count('online')} online, ${count('stale')} stale, ${count('offline')} offline, ${count('unknown')} unknown (read-only, no probe)`;
|
|
126
|
+
const attention = entries.filter((e) => e.state === 'stale' || e.state === 'offline').map((e) => `${e.resource.id}=${e.state}`);
|
|
127
|
+
return attention.length > 0
|
|
128
|
+
? check('resources', 'Resource catalog', 'warn', `${summary}; refresh explicitly with buddy resources probe <id>: ${attention.join(', ')}`)
|
|
129
|
+
: check('resources', 'Resource catalog', 'ok', summary);
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
return check('resources', 'Resource catalog', 'warn', `catalog unreadable: ${errorText(error)}`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async function skillsCheck(deps) {
|
|
136
|
+
try {
|
|
137
|
+
const list = deps.skillsIntegrity ?? (async () => (await import('../skills/hub.js')).getSkillsHub().listWithIntegrity());
|
|
138
|
+
const skills = await list();
|
|
139
|
+
const missing = skills.filter((s) => !s.exists).length;
|
|
140
|
+
const modified = skills.filter((s) => s.exists && !s.integrityOk).length;
|
|
141
|
+
if (missing + modified > 0) {
|
|
142
|
+
return check('skills', 'Skills Hub integrity', 'warn', `${skills.length} installed: ${missing} missing SKILL.md, ${modified} modified — run buddy skills doctor`);
|
|
143
|
+
}
|
|
144
|
+
return check('skills', 'Skills Hub integrity', 'ok', `${skills.length} installed, all intact`, skills.length === 0);
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
return check('skills', 'Skills Hub integrity', 'warn', `lockfile unreadable: ${errorText(error)}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
async function codeExecPolicyCheck(deps) {
|
|
151
|
+
try {
|
|
152
|
+
const model = deps.configuredModel
|
|
153
|
+
? await deps.configuredModel()
|
|
154
|
+
: await (async () => {
|
|
155
|
+
const { getSettingsManager } = await import('../utils/settings-manager.js');
|
|
156
|
+
const settings = getSettingsManager().readUserSettingsIfPresent();
|
|
157
|
+
return settings?.defaultModel ?? settings?.model ?? process.env.GROK_MODEL;
|
|
158
|
+
})();
|
|
159
|
+
const { resolveCodeExecPolicy } = await import('../config/code-exec-policy.js');
|
|
160
|
+
const resolved = resolveCodeExecPolicy(model);
|
|
161
|
+
const evidence = resolved.evidence ? `, evidence ${resolved.evidence}` : '';
|
|
162
|
+
return check('code-exec-policy', 'Programmatic tool calling', 'ok', `code_exec policy ${resolved.policy} for ${model ?? 'unknown model'} (source ${resolved.source}${evidence})`, true);
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
return check('code-exec-policy', 'Programmatic tool calling', 'warn', `policy unreadable: ${errorText(error)}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
export async function runIntegrationChecks(cwd, deps = {}) {
|
|
169
|
+
return Promise.all([
|
|
170
|
+
lmResizerCheck(deps),
|
|
171
|
+
codeExplorerCheck(cwd, deps),
|
|
172
|
+
mcpCheck(cwd, deps),
|
|
173
|
+
resourcesCheck(deps),
|
|
174
|
+
skillsCheck(deps),
|
|
175
|
+
codeExecPolicyCheck(deps),
|
|
176
|
+
]);
|
|
177
|
+
}
|
|
178
|
+
// ── JSON report ─────────────────────────────────────────────────────────────
|
|
179
|
+
export const doctorJsonReportSchema = z.object({
|
|
180
|
+
version: z.literal(1),
|
|
181
|
+
generatedAt: z.string(),
|
|
182
|
+
offline: z.boolean(),
|
|
183
|
+
summary: z.object({
|
|
184
|
+
passed: z.number().int().nonnegative(),
|
|
185
|
+
warnings: z.number().int().nonnegative(),
|
|
186
|
+
errors: z.number().int().nonnegative(),
|
|
187
|
+
optionalNotInstalled: z.number().int().nonnegative(),
|
|
188
|
+
}).strict(),
|
|
189
|
+
checks: z.array(z.object({
|
|
190
|
+
id: z.string().regex(/^[a-z0-9][a-z0-9-]*$/),
|
|
191
|
+
section: z.enum(['core', 'integrations']),
|
|
192
|
+
name: z.string(),
|
|
193
|
+
status: z.enum(['ok', 'warn', 'error']),
|
|
194
|
+
message: z.string(),
|
|
195
|
+
fixable: z.boolean(),
|
|
196
|
+
optional: z.boolean(),
|
|
197
|
+
}).strict()),
|
|
198
|
+
fixes: z.array(z.object({ success: z.boolean(), message: z.string(), action: z.string() }).strict()).optional(),
|
|
199
|
+
theme: z.object({
|
|
200
|
+
id: z.string(),
|
|
201
|
+
name: z.string(),
|
|
202
|
+
}).strict(),
|
|
203
|
+
}).strict();
|
|
204
|
+
export function slugifyCheckName(name) {
|
|
205
|
+
return name.toLowerCase().normalize('NFKD').replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'check';
|
|
206
|
+
}
|
|
207
|
+
export function buildDoctorJsonReport(checks, summary, options) {
|
|
208
|
+
const seen = new Map();
|
|
209
|
+
let theme = { id: 'unknown', name: 'unknown' };
|
|
210
|
+
try {
|
|
211
|
+
const current = getThemeManager().getCurrentTheme();
|
|
212
|
+
theme = { id: current.id, name: current.name };
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
// Theme manager is optional for doctor JSON consumers.
|
|
216
|
+
}
|
|
217
|
+
const report = {
|
|
218
|
+
version: 1,
|
|
219
|
+
generatedAt: (options.now ?? new Date()).toISOString(),
|
|
220
|
+
offline: options.offline,
|
|
221
|
+
summary,
|
|
222
|
+
checks: checks.map((c) => {
|
|
223
|
+
const baseId = c.id ?? slugifyCheckName(c.name);
|
|
224
|
+
const n = (seen.get(baseId) ?? 0) + 1;
|
|
225
|
+
seen.set(baseId, n);
|
|
226
|
+
return {
|
|
227
|
+
id: n === 1 ? baseId : `${baseId}-${n}`,
|
|
228
|
+
section: c.section ?? 'core',
|
|
229
|
+
name: c.name,
|
|
230
|
+
status: c.status,
|
|
231
|
+
message: c.message,
|
|
232
|
+
fixable: c.fixable === true,
|
|
233
|
+
optional: c.optional === true,
|
|
234
|
+
};
|
|
235
|
+
}),
|
|
236
|
+
...(options.fixes ? { fixes: options.fixes } : {}),
|
|
237
|
+
theme,
|
|
238
|
+
};
|
|
239
|
+
return doctorJsonReportSchema.parse(report);
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=integrations.js.map
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `buddy triage` — local, redacted support bundle (P7).
|
|
3
|
+
*
|
|
4
|
+
* Collects the offline doctor report, versions, recent failed runs, a bounded
|
|
5
|
+
* log tail and configuration KEY NAMES, then writes `triage.json` and a
|
|
6
|
+
* prompt (≤ 8 KiB) into a fresh 0700 directory. Nothing is sent anywhere and
|
|
7
|
+
* no agent is launched: the suggested command is printed for the user.
|
|
8
|
+
*
|
|
9
|
+
* Fail closed: every string goes through literal masking of known secret
|
|
10
|
+
* values, then the redaction engine; the serialized bundle and prompt are
|
|
11
|
+
* scanned again and any section still flagged is withheld. If the scan itself
|
|
12
|
+
* fails, nothing is written.
|
|
13
|
+
*/
|
|
14
|
+
import type { DoctorCheck } from './index.js';
|
|
15
|
+
import type { DoctorJsonReport } from './integrations.js';
|
|
16
|
+
export declare const TRIAGE_PROMPT_MAX_BYTES = 8192;
|
|
17
|
+
export interface TriageFailedRun {
|
|
18
|
+
runId: string;
|
|
19
|
+
status: string;
|
|
20
|
+
startedAt: string;
|
|
21
|
+
eventCount: number;
|
|
22
|
+
objective: string;
|
|
23
|
+
}
|
|
24
|
+
export interface TriageBundle {
|
|
25
|
+
version: 1;
|
|
26
|
+
generatedAt: string;
|
|
27
|
+
networkUsed: false;
|
|
28
|
+
versions: {
|
|
29
|
+
node: string;
|
|
30
|
+
buddy: string;
|
|
31
|
+
os: string;
|
|
32
|
+
};
|
|
33
|
+
doctor: DoctorJsonReport | {
|
|
34
|
+
withheld: true;
|
|
35
|
+
reason: string;
|
|
36
|
+
};
|
|
37
|
+
failedRuns: TriageFailedRun[] | {
|
|
38
|
+
withheld: true;
|
|
39
|
+
reason: string;
|
|
40
|
+
};
|
|
41
|
+
logs: {
|
|
42
|
+
file: string | null;
|
|
43
|
+
lines: string[];
|
|
44
|
+
} | {
|
|
45
|
+
withheld: true;
|
|
46
|
+
reason: string;
|
|
47
|
+
};
|
|
48
|
+
config: {
|
|
49
|
+
files: Array<{
|
|
50
|
+
file: string;
|
|
51
|
+
keys: string[];
|
|
52
|
+
}>;
|
|
53
|
+
} | {
|
|
54
|
+
withheld: true;
|
|
55
|
+
reason: string;
|
|
56
|
+
};
|
|
57
|
+
redactions: number;
|
|
58
|
+
withheld: string[];
|
|
59
|
+
}
|
|
60
|
+
export interface TriageDeps {
|
|
61
|
+
runDoctor?: () => Promise<{
|
|
62
|
+
checks: DoctorCheck[];
|
|
63
|
+
report: DoctorJsonReport;
|
|
64
|
+
}>;
|
|
65
|
+
listRuns?: (limit: number) => Array<{
|
|
66
|
+
runId: string;
|
|
67
|
+
status: string;
|
|
68
|
+
startedAt: number;
|
|
69
|
+
eventCount: number;
|
|
70
|
+
objective: string;
|
|
71
|
+
}>;
|
|
72
|
+
redact?: (text: string) => {
|
|
73
|
+
redacted: string;
|
|
74
|
+
count: number;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export interface TriageOptions {
|
|
78
|
+
cwd: string;
|
|
79
|
+
homeDir?: string;
|
|
80
|
+
outParent?: string;
|
|
81
|
+
logFile?: string | null;
|
|
82
|
+
logLines?: number;
|
|
83
|
+
env?: NodeJS.ProcessEnv;
|
|
84
|
+
now?: Date;
|
|
85
|
+
buddyVersion?: string;
|
|
86
|
+
deps?: TriageDeps;
|
|
87
|
+
}
|
|
88
|
+
export interface TriageResult {
|
|
89
|
+
dir: string;
|
|
90
|
+
jsonPath: string;
|
|
91
|
+
promptPath: string;
|
|
92
|
+
promptBytes: number;
|
|
93
|
+
redactions: number;
|
|
94
|
+
withheld: string[];
|
|
95
|
+
suggestedCommand: string;
|
|
96
|
+
bundle: TriageBundle;
|
|
97
|
+
}
|
|
98
|
+
/** Literal values that must never leave the machine, longest first. */
|
|
99
|
+
export declare function collectSecretValues(cwd: string, home: string, env: NodeJS.ProcessEnv): string[];
|
|
100
|
+
export declare function createMasker(secretValues: string[], redact: NonNullable<TriageDeps['redact']>, home?: string): {
|
|
101
|
+
mask: (input: string) => string;
|
|
102
|
+
leaks: (text: string) => boolean;
|
|
103
|
+
count: () => number;
|
|
104
|
+
};
|
|
105
|
+
/** Last `maxLines` lines of a file, reading at most 256 KiB from its end. */
|
|
106
|
+
export declare function tailFile(file: string, maxLines: number): string[];
|
|
107
|
+
export declare function buildTriagePrompt(bundle: TriageBundle, maxBytes?: number): string;
|
|
108
|
+
export declare function writeTriageBundle(options: TriageOptions): Promise<TriageResult>;
|