@phuetz/code-buddy 1.1.0 → 1.3.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.md +211 -163
- package/dist/agent/autonomous/agentic-coding-contract.d.ts +12 -12
- package/dist/agent/base-agent.d.ts +4 -0
- package/dist/agent/base-agent.js +6 -0
- package/dist/agent/codebuddy-agent.d.ts +1 -1
- package/dist/agent/codebuddy-agent.js +69 -14
- package/dist/agent/execution/agent-executor.js +122 -12
- package/dist/agent/execution/tool-dependency-graph.js +7 -0
- package/dist/agent/execution/tool-hooks.d.ts +6 -0
- package/dist/agent/execution/tool-hooks.js +13 -5
- package/dist/agent/execution/tool-selection-strategy.d.ts +11 -2
- package/dist/agent/execution/tool-selection-strategy.js +67 -10
- package/dist/agent/extended-thinking.d.ts +8 -0
- package/dist/agent/extended-thinking.js +27 -0
- package/dist/agent/facades/infrastructure-facade.d.ts +9 -2
- package/dist/agent/facades/infrastructure-facade.js +15 -6
- package/dist/agent/hermes-browser-backends.js +151 -11
- package/dist/agent/hermes-claw-migrate.d.ts +59 -0
- package/dist/agent/hermes-claw-migrate.js +427 -26
- package/dist/agent/hermes-parity-manifest.js +78 -71
- package/dist/agent/hermes-runtime-lifecycle.d.ts +67 -0
- package/dist/agent/hermes-runtime-lifecycle.js +468 -0
- package/dist/agent/middleware/index.d.ts +1 -0
- package/dist/agent/middleware/index.js +1 -0
- package/dist/agent/middleware/visual-validation-middleware.d.ts +17 -0
- package/dist/agent/middleware/visual-validation-middleware.js +67 -0
- package/dist/agent/model-benchmark.d.ts +77 -0
- package/dist/agent/model-benchmark.js +309 -0
- package/dist/agent/model-tier.d.ts +14 -0
- package/dist/agent/model-tier.js +71 -0
- package/dist/agent/multi-agent/agents/orchestrator-agent.js +17 -6
- package/dist/agent/multi-agent/multi-agent-system.js +3 -1
- package/dist/agent/multi-agent/session-fleet-bridge.d.ts +2 -0
- package/dist/agent/multi-agent/session-fleet-bridge.js +9 -1
- package/dist/agent/multi-agent/session-tools.js +22 -5
- package/dist/agent/reasoning/mcts.js +20 -6
- package/dist/agent/self-improvement/authored-artifact-gate.d.ts +18 -0
- package/dist/agent/self-improvement/authored-artifact-gate.js +42 -0
- package/dist/agent/self-improvement/authored-tool-runtime.d.ts +27 -0
- package/dist/agent/self-improvement/authored-tool-runtime.js +57 -0
- package/dist/agent/self-improvement/authored-tool-store.d.ts +24 -0
- package/dist/agent/self-improvement/authored-tool-store.js +57 -0
- package/dist/agent/self-improvement/llm-tool-proposer.d.ts +41 -0
- package/dist/agent/self-improvement/llm-tool-proposer.js +136 -0
- package/dist/agent/self-improvement/sandbox-scorer.d.ts +17 -0
- package/dist/agent/self-improvement/sandbox-scorer.js +43 -0
- package/dist/agent/self-improvement/self-knowledge.d.ts +8 -0
- package/dist/agent/self-improvement/self-knowledge.js +24 -0
- package/dist/agent/self-improvement/skill-benchmark.d.ts +9 -0
- package/dist/agent/self-improvement/skill-benchmark.js +22 -0
- package/dist/agent/self-improvement/skill-consolidator.d.ts +71 -0
- package/dist/agent/self-improvement/skill-consolidator.js +137 -0
- package/dist/agent/self-improvement/skill-engine.d.ts +42 -0
- package/dist/agent/self-improvement/skill-engine.js +87 -0
- package/dist/agent/self-improvement/skill-gate.d.ts +19 -0
- package/dist/agent/self-improvement/skill-gate.js +62 -0
- package/dist/agent/self-improvement/skill-mutator.d.ts +74 -0
- package/dist/agent/self-improvement/skill-mutator.js +223 -0
- package/dist/agent/self-improvement/skill-proposer.d.ts +40 -0
- package/dist/agent/self-improvement/skill-proposer.js +82 -0
- package/dist/agent/self-improvement/skill-types.d.ts +41 -0
- package/dist/agent/self-improvement/skill-types.js +13 -0
- package/dist/agent/self-improvement/tool-benchmark.d.ts +10 -0
- package/dist/agent/self-improvement/tool-benchmark.js +37 -0
- package/dist/agent/self-improvement/tool-engine.d.ts +54 -0
- package/dist/agent/self-improvement/tool-engine.js +101 -0
- package/dist/agent/self-improvement/tool-gate.d.ts +20 -0
- package/dist/agent/self-improvement/tool-gate.js +78 -0
- package/dist/agent/self-improvement/tool-proposer.d.ts +31 -0
- package/dist/agent/self-improvement/tool-proposer.js +34 -0
- package/dist/agent/self-improvement/tool-skill-mutator.d.ts +40 -0
- package/dist/agent/self-improvement/tool-skill-mutator.js +79 -0
- package/dist/agent/self-improvement/tool-types.d.ts +48 -0
- package/dist/agent/self-improvement/tool-types.js +9 -0
- package/dist/agent/self-improvement/types.d.ts +3 -1
- package/dist/agent/session-end-flush.d.ts +6 -1
- package/dist/agent/session-end-flush.js +20 -4
- package/dist/agent/streaming/streaming-handler.d.ts +7 -0
- package/dist/agent/streaming/streaming-handler.js +8 -1
- package/dist/agent/tool-executor.js +1 -0
- package/dist/agent/tool-handler.d.ts +5 -0
- package/dist/agent/tool-handler.js +133 -4
- package/dist/browser-automation/browser-operator-executor.js +15 -0
- package/dist/browser-automation/browser-use-runner.d.ts +96 -0
- package/dist/browser-automation/browser-use-runner.js +492 -0
- package/dist/browser-automation/camofox-runner.d.ts +107 -0
- package/dist/browser-automation/camofox-runner.js +287 -0
- package/dist/channels/dingtalk/index.js +3 -0
- package/dist/channels/discord/client.d.ts +9 -0
- package/dist/channels/discord/client.js +12 -0
- package/dist/channels/feishu/index.d.ts +167 -1
- package/dist/channels/feishu/index.js +432 -7
- package/dist/channels/gateway-lifecycle.d.ts +132 -0
- package/dist/channels/gateway-lifecycle.js +219 -0
- package/dist/channels/google-chat/index.d.ts +5 -1
- package/dist/channels/google-chat/index.js +5 -1
- package/dist/channels/imessage/index.d.ts +14 -0
- package/dist/channels/imessage/index.js +64 -17
- package/dist/channels/index.d.ts +4 -0
- package/dist/channels/index.js +4 -0
- package/dist/channels/irc/index.d.ts +73 -3
- package/dist/channels/irc/index.js +446 -11
- package/dist/channels/line/index.js +3 -0
- package/dist/channels/mattermost/index.d.ts +51 -4
- package/dist/channels/mattermost/index.js +303 -20
- package/dist/channels/nextcloud-talk/index.d.ts +89 -8
- package/dist/channels/nextcloud-talk/index.js +367 -16
- package/dist/channels/nostr/index.d.ts +121 -1
- package/dist/channels/nostr/index.js +396 -8
- package/dist/channels/ntfy/index.js +3 -0
- package/dist/channels/qq/index.js +3 -0
- package/dist/channels/slash-parity.d.ts +117 -0
- package/dist/channels/slash-parity.js +185 -0
- package/dist/channels/synology-chat/index.js +3 -0
- package/dist/channels/teams/index.d.ts +3 -0
- package/dist/channels/teams/index.js +3 -0
- package/dist/channels/telegram/client.d.ts +9 -0
- package/dist/channels/telegram/client.js +12 -0
- package/dist/channels/twilio-voice/index.js +3 -0
- package/dist/channels/webchat/index.d.ts +7 -1
- package/dist/channels/webchat/index.js +7 -1
- package/dist/channels/wecom/index.js +3 -0
- package/dist/channels/weixin/index.js +3 -0
- package/dist/channels/zalo/index.js +3 -0
- package/dist/cli/config-loader.js +1 -1
- package/dist/codebuddy/client.d.ts +30 -1
- package/dist/codebuddy/client.js +167 -20
- package/dist/codebuddy/providers/provider-chatgpt-responses.d.ts +5 -0
- package/dist/codebuddy/providers/provider-chatgpt-responses.js +7 -1
- package/dist/codebuddy/providers/provider-gemini-native.js +1 -1
- package/dist/codebuddy/providers/provider-openai-compat.d.ts +5 -0
- package/dist/codebuddy/providers/provider-openai-compat.js +82 -2
- package/dist/codebuddy/tool-definitions/computer-control-tools.js +32 -2
- package/dist/codebuddy/tool-definitions/core-tools.js +3 -3
- package/dist/codebuddy/tool-definitions/index.d.ts +2 -1
- package/dist/codebuddy/tool-definitions/index.js +2 -1
- package/dist/codebuddy/tool-definitions/multimodal-tools.d.ts +1 -0
- package/dist/codebuddy/tool-definitions/multimodal-tools.js +44 -1
- package/dist/codebuddy/tool-definitions/windows-tools.d.ts +2 -0
- package/dist/codebuddy/tool-definitions/windows-tools.js +34 -0
- package/dist/codebuddy/tools.d.ts +8 -1
- package/dist/codebuddy/tools.js +67 -24
- package/dist/commands/cli/hermes-commands.js +108 -0
- package/dist/commands/cli/improve-command.js +123 -0
- package/dist/commands/cli/native-engine-commands.js +102 -3
- package/dist/commands/cli/utility-commands.js +45 -0
- package/dist/commands/enhanced-command-handler.js +2 -2
- package/dist/commands/goal-cli.d.ts +30 -0
- package/dist/commands/goal-cli.js +210 -27
- package/dist/commands/handlers/goal-handler.d.ts +9 -2
- package/dist/commands/handlers/goal-handler.js +36 -9
- package/dist/commands/handlers/infra-handlers.js +36 -0
- package/dist/commands/handlers/memory-handlers.js +96 -1
- package/dist/commands/handlers/missing-handlers.d.ts +1 -1
- package/dist/commands/handlers/missing-handlers.js +26 -3
- package/dist/commands/headless-slash.d.ts +2 -0
- package/dist/commands/headless-slash.js +12 -0
- package/dist/commands/llm-provider-resolution.d.ts +5 -3
- package/dist/commands/llm-provider-resolution.js +87 -33
- package/dist/commands/ollama.d.ts +25 -0
- package/dist/commands/ollama.js +100 -0
- package/dist/commands/provider.d.ts +5 -0
- package/dist/commands/provider.js +106 -55
- package/dist/commands/skills-cli/index.js +123 -0
- package/dist/commands/slash/builtin-commands.js +1 -1
- package/dist/commands/spec-next.js +2 -1
- package/dist/commands/spec-plan.js +5 -16
- package/dist/commands/tunnel.d.ts +2 -0
- package/dist/commands/tunnel.js +48 -0
- package/dist/companion/percepts.js +11 -1
- package/dist/config/config-resolver.d.ts +2 -1
- package/dist/config/config-resolver.js +54 -41
- package/dist/config/constants.d.ts +28 -0
- package/dist/config/constants.js +7 -0
- package/dist/config/env-schema.js +756 -0
- package/dist/config/model-tools.js +4 -4
- package/dist/config/toml-config.d.ts +16 -0
- package/dist/config/toml-config.js +3 -0
- package/dist/context/bootstrap-loader.js +6 -23
- package/dist/context/context-manager-v2.js +1 -0
- package/dist/context/import-directive-parser.d.ts +4 -0
- package/dist/context/import-directive-parser.js +51 -6
- package/dist/context/instruction-excludes.d.ts +30 -1
- package/dist/context/instruction-excludes.js +71 -1
- package/dist/context/jit-context.d.ts +8 -10
- package/dist/context/jit-context.js +28 -106
- package/dist/context/project-context.d.ts +90 -0
- package/dist/context/project-context.js +295 -0
- package/dist/daemon/autonomous-daemon.d.ts +1 -1
- package/dist/daemon/autonomous-daemon.js +3 -3
- package/dist/daemon/autonomous-loop.d.ts +31 -1
- package/dist/daemon/autonomous-loop.js +91 -4
- package/dist/daemon/colab-goal.js +9 -1
- package/dist/daemon/cron-agent-bridge.d.ts +12 -3
- package/dist/daemon/cron-agent-bridge.js +25 -9
- package/dist/desktop/codebuddy-engine-adapter.d.ts +32 -0
- package/dist/desktop/codebuddy-engine-adapter.js +257 -80
- package/dist/desktop/engine-adapter.d.ts +14 -0
- package/dist/desktop-automation/automation-manager.js +16 -0
- package/dist/desktop-automation/omniparser-runner.d.ts +63 -0
- package/dist/desktop-automation/omniparser-runner.js +115 -0
- package/dist/desktop-automation/smart-snapshot.d.ts +11 -0
- package/dist/desktop-automation/smart-snapshot.js +72 -5
- package/dist/doctor/index.js +40 -23
- package/dist/events/types.d.ts +11 -0
- package/dist/fleet/colab-store.js +14 -2
- package/dist/fleet/peer-session-bridge.js +50 -12
- package/dist/fleet/peer-tool-bridge.js +14 -0
- package/dist/goals/goal-decomposer.d.ts +27 -0
- package/dist/goals/goal-decomposer.js +293 -0
- package/dist/goals/goal-judge-client.d.ts +15 -0
- package/dist/goals/goal-judge-client.js +45 -0
- package/dist/goals/goal-judge.d.ts +2 -0
- package/dist/goals/goal-judge.js +35 -6
- package/dist/goals/goal-loop.d.ts +14 -0
- package/dist/goals/goal-loop.js +47 -2
- package/dist/goals/goal-manager.d.ts +6 -0
- package/dist/goals/goal-manager.js +67 -14
- package/dist/goals/goal-state.d.ts +13 -0
- package/dist/goals/goal-state.js +83 -13
- package/dist/goals/goal-store.d.ts +3 -0
- package/dist/goals/goal-store.js +31 -15
- package/dist/harness/contract.d.ts +28 -28
- package/dist/hooks/user-hooks.js +17 -3
- package/dist/identity/identity-manager.js +3 -2
- package/dist/index.js +481 -26
- package/dist/input/text-to-speech.d.ts +2 -6
- package/dist/input/text-to-speech.js +2 -27
- package/dist/integrations/screenpipe/screenpipe-client.d.ts +10 -0
- package/dist/integrations/screenpipe/screenpipe-client.js +12 -2
- package/dist/integrations/tailscale.d.ts +13 -0
- package/dist/integrations/tailscale.js +87 -34
- package/dist/knowledge/workspace-indexer.js +53 -9
- package/dist/mcp/client.js +1 -0
- package/dist/mcp/mcp-desktop-tools.d.ts +23 -0
- package/dist/mcp/mcp-desktop-tools.js +158 -0
- package/dist/mcp/mcp-resources.js +2 -3
- package/dist/mcp/mcp-server.js +2 -0
- package/dist/memory/enhanced-memory.d.ts +10 -0
- package/dist/memory/enhanced-memory.js +33 -2
- package/dist/memory/index.d.ts +3 -1
- package/dist/memory/index.js +4 -1
- package/dist/memory/memory-auto-proposer.d.ts +23 -0
- package/dist/memory/memory-auto-proposer.js +308 -0
- package/dist/memory/memory-candidate-queue.d.ts +92 -0
- package/dist/memory/memory-candidate-queue.js +261 -0
- package/dist/memory/persistent-memory.d.ts +45 -2
- package/dist/memory/persistent-memory.js +236 -40
- package/dist/ml/bayesian-qualifier.d.ts +1 -1
- package/dist/ml/bayesian-qualifier.js +35 -2
- package/dist/openclaw/gateway-bridge.js +5 -0
- package/dist/plugins/marketplace.d.ts +1 -0
- package/dist/plugins/marketplace.js +7 -0
- package/dist/prompts/execution-discipline.d.ts +14 -0
- package/dist/prompts/execution-discipline.js +29 -0
- package/dist/prompts/variation-injector.js +9 -2
- package/dist/protocols/acp/acp-agentic-runner.d.ts +7 -6
- package/dist/protocols/acp/acp-agentic-runner.js +115 -18
- package/dist/protocols/acp/acp-session-store.d.ts +23 -0
- package/dist/protocols/acp/acp-session-store.js +77 -0
- package/dist/protocols/acp/acp-stdio-server.d.ts +7 -0
- package/dist/protocols/acp/acp-stdio-server.js +71 -16
- package/dist/providers/active-llm-registry.d.ts +37 -0
- package/dist/providers/active-llm-registry.js +186 -0
- package/dist/providers/auxiliary-provider.d.ts +25 -0
- package/dist/providers/auxiliary-provider.js +192 -0
- package/dist/providers/codex-oauth.d.ts +1 -1
- package/dist/providers/codex-oauth.js +27 -4
- package/dist/providers/index.d.ts +3 -0
- package/dist/providers/index.js +4 -0
- package/dist/providers/provider-catalog.d.ts +70 -0
- package/dist/providers/provider-catalog.js +738 -0
- package/dist/providers/provider-fallback.d.ts +35 -0
- package/dist/providers/provider-fallback.js +171 -0
- package/dist/providers/xai-oauth.d.ts +128 -0
- package/dist/providers/xai-oauth.js +735 -0
- package/dist/scheduler/cron-scheduler.d.ts +15 -3
- package/dist/scheduler/cron-scheduler.js +53 -7
- package/dist/scheduler/script-runner.d.ts +2 -0
- package/dist/scheduler/script-runner.js +19 -4
- package/dist/scheduler/watchdog-handlers.js +7 -20
- package/dist/search/usearch-index.js +7 -2
- package/dist/security/tool-policy/tool-groups.js +2 -0
- package/dist/sensory/dreaming.d.ts +45 -0
- package/dist/sensory/dreaming.js +114 -0
- package/dist/sensory/heartbeat-scheduler.d.ts +38 -0
- package/dist/sensory/heartbeat-scheduler.js +72 -0
- package/dist/sensory/reactions.d.ts +24 -0
- package/dist/sensory/reactions.js +31 -0
- package/dist/sensory/screen-reaction.d.ts +23 -0
- package/dist/sensory/screen-reaction.js +59 -0
- package/dist/sensory/sensory-bridge.d.ts +23 -0
- package/dist/sensory/sensory-bridge.js +85 -0
- package/dist/sensory/sensory-memory.d.ts +20 -0
- package/dist/sensory/sensory-memory.js +39 -0
- package/dist/sensory/speech-reaction.d.ts +21 -0
- package/dist/sensory/speech-reaction.js +83 -0
- package/dist/sensory/vision-reaction.d.ts +31 -0
- package/dist/sensory/vision-reaction.js +74 -0
- package/dist/server/index.js +106 -2
- package/dist/server/routes/mobile.d.ts +12 -4
- package/dist/server/routes/mobile.js +116 -1
- package/dist/server/tls-config.d.ts +35 -0
- package/dist/server/tls-config.js +142 -0
- package/dist/server/tunnel-manager.d.ts +20 -0
- package/dist/server/tunnel-manager.js +58 -0
- package/dist/server/websocket/fleet-bridge.js +5 -0
- package/dist/services/prompt-builder.d.ts +11 -0
- package/dist/services/prompt-builder.js +124 -17
- package/dist/shared/engine-types.d.ts +15 -1
- package/dist/sidecar/sidecar-bridge.d.ts +1 -0
- package/dist/sidecar/sidecar-bridge.js +21 -10
- package/dist/skills/parser.js +3 -0
- package/dist/skills/skill-importer.d.ts +58 -0
- package/dist/skills/skill-importer.js +261 -0
- package/dist/skills/skill-sources.d.ts +20 -0
- package/dist/skills/skill-sources.js +102 -0
- package/dist/skills/types.d.ts +6 -0
- package/dist/spec/spec-store.js +8 -1
- package/dist/talk-mode/providers/audioreader-tts.d.ts +1 -1
- package/dist/talk-mode/providers/audioreader-tts.js +8 -8
- package/dist/templates/project-scaffolding.js +3 -2
- package/dist/themes/theme-schema.d.ts +10 -10
- package/dist/tools/application-profiles.js +38 -0
- package/dist/tools/bash/bash-tool.d.ts +1 -0
- package/dist/tools/bash/bash-tool.js +16 -2
- package/dist/tools/bash/command-validator.js +3 -0
- package/dist/tools/bash/rtk-rewrite.d.ts +16 -0
- package/dist/tools/bash/rtk-rewrite.js +100 -0
- package/dist/tools/bash/streaming-executor.js +14 -1
- package/dist/tools/computer-control-tool.d.ts +16 -1
- package/dist/tools/computer-control-tool.js +317 -5
- package/dist/tools/document-generator.d.ts +14 -0
- package/dist/tools/document-generator.js +79 -0
- package/dist/tools/execute-code-rpc-invoker.d.ts +26 -2
- package/dist/tools/execute-code-rpc-invoker.js +46 -5
- package/dist/tools/metadata.js +28 -0
- package/dist/tools/office-macro-tool.d.ts +10 -0
- package/dist/tools/office-macro-tool.js +93 -0
- package/dist/tools/register-tool-handler.d.ts +25 -0
- package/dist/tools/register-tool-handler.js +100 -0
- package/dist/tools/registry/index.d.ts +2 -1
- package/dist/tools/registry/index.js +2 -1
- package/dist/tools/registry/memory-tools.d.ts +20 -0
- package/dist/tools/registry/memory-tools.js +225 -3
- package/dist/tools/registry/multimodal-tools.js +2 -2
- package/dist/tools/registry/vision-tools.d.ts +33 -0
- package/dist/tools/registry/vision-tools.js +308 -6
- package/dist/tools/registry/windows-tools.d.ts +2 -0
- package/dist/tools/registry/windows-tools.js +47 -0
- package/dist/tools/registry.d.ts +6 -0
- package/dist/tools/registry.js +8 -0
- package/dist/tools/route-peer-tool.js +14 -0
- package/dist/tools/screenshot-tool.js +14 -2
- package/dist/tools/text-to-speech-tool.d.ts +1 -1
- package/dist/tools/text-to-speech-tool.js +2 -12
- package/dist/tools/tool-selector.js +3 -59
- package/dist/utils/config-validation/schema.d.ts +40 -7
- package/dist/utils/config-validation/schema.js +130 -1
- package/dist/utils/cost-tracker.js +21 -1
- package/dist/utils/disk-guard.d.ts +180 -0
- package/dist/utils/disk-guard.js +404 -0
- package/dist/utils/init-project.d.ts +7 -0
- package/dist/utils/init-project.js +37 -0
- package/dist/utils/interactive-setup.js +35 -2
- package/dist/utils/model-utils.js +11 -2
- package/dist/utils/output-sanitizer.js +11 -0
- package/dist/utils/provider-detector.d.ts +8 -7
- package/dist/utils/provider-detector.js +19 -77
- package/dist/utils/settings-manager.d.ts +19 -0
- package/dist/utils/token-display.d.ts +3 -3
- package/dist/utils/token-display.js +22 -4
- package/dist/wizard/onboarding.d.ts +39 -0
- package/dist/wizard/onboarding.js +433 -21
- package/dist/wizard/provider-onboarding.d.ts +8 -23
- package/dist/wizard/provider-onboarding.js +39 -158
- package/package.json +4 -2
- package/dist/plugins/provider-onboarding.d.ts +0 -23
- package/dist/plugins/provider-onboarding.js +0 -116
- package/dist/utils/kokoro-tts.d.ts +0 -8
- package/dist/utils/kokoro-tts.js +0 -67
|
@@ -13,6 +13,7 @@ import { logger } from "../utils/logger.js";
|
|
|
13
13
|
import { getErrorMessage } from "../errors/index.js";
|
|
14
14
|
import { getSystemPromptForMode, getPromptManager, autoSelectPromptId, getChatOnlySystemPrompt, } from "../prompts/index.js";
|
|
15
15
|
import { getModelToolConfig } from "../config/model-tools.js";
|
|
16
|
+
import { resolveProjectContext, createContextRegistry, setActiveContextRegistry } from "../context/project-context.js";
|
|
16
17
|
import { classifyQuery } from "../agent/execution/query-classifier.js";
|
|
17
18
|
import { filterToolNames, getToolFilter, isToolNameAllowed, } from "../utils/tool-filter.js";
|
|
18
19
|
const ALL_BLOCKS = {
|
|
@@ -30,6 +31,7 @@ const ALL_BLOCKS = {
|
|
|
30
31
|
includeWritingRules: true,
|
|
31
32
|
includeCodingStyle: true,
|
|
32
33
|
includeWorkflowRules: true,
|
|
34
|
+
includeExecutionDiscipline: true,
|
|
33
35
|
includeVariation: true,
|
|
34
36
|
};
|
|
35
37
|
const EXTERNAL_PROMPT_MANAGER_TOOLS = [
|
|
@@ -64,6 +66,13 @@ export class PromptBuilder {
|
|
|
64
66
|
memory;
|
|
65
67
|
moltbotHooksManager;
|
|
66
68
|
persistentMemory;
|
|
69
|
+
/**
|
|
70
|
+
* Dedup registry for project-instruction files, recreated fresh at the start
|
|
71
|
+
* of each system-prompt build. The JIT context pass reads it (via
|
|
72
|
+
* `getContextRegistry()`) so files already injected at startup are not
|
|
73
|
+
* re-injected when a tool later touches a file in the same tree.
|
|
74
|
+
*/
|
|
75
|
+
contextRegistry = null;
|
|
67
76
|
constructor(config, promptCacheManager, memory, moltbotHooksManager, persistentMemory) {
|
|
68
77
|
this.config = config;
|
|
69
78
|
this.promptCacheManager = promptCacheManager;
|
|
@@ -71,6 +80,10 @@ export class PromptBuilder {
|
|
|
71
80
|
this.moltbotHooksManager = moltbotHooksManager;
|
|
72
81
|
this.persistentMemory = persistentMemory;
|
|
73
82
|
}
|
|
83
|
+
/** The registry from the most recent system-prompt build (for the JIT pass). */
|
|
84
|
+
getContextRegistry() {
|
|
85
|
+
return this.contextRegistry;
|
|
86
|
+
}
|
|
74
87
|
/**
|
|
75
88
|
* Build the system prompt for the agent. The optional `options`
|
|
76
89
|
* parameter gates per-block injection. All gates default to `true`
|
|
@@ -83,13 +96,17 @@ export class PromptBuilder {
|
|
|
83
96
|
// confuse the LLM into hallucinating JSON tool calls. Force-off here.
|
|
84
97
|
const toolCfg = getModelToolConfig(modelName);
|
|
85
98
|
const activeToolFilter = getToolFilter();
|
|
86
|
-
|
|
99
|
+
const forceTools = process.env.GROK_FORCE_TOOLS === 'true';
|
|
100
|
+
if (toolCfg.supportsToolCalls === false && !forceTools) {
|
|
87
101
|
gates.includeMemoryDirective = false;
|
|
88
102
|
gates.includeLessonsDirective = false;
|
|
89
103
|
gates.includeUserModelDirective = false;
|
|
90
104
|
gates.includeWorkflowRules = false;
|
|
105
|
+
gates.includeExecutionDiscipline = false;
|
|
91
106
|
}
|
|
92
|
-
|
|
107
|
+
const rememberToolAllowed = isToolNameAllowed('remember', activeToolFilter);
|
|
108
|
+
const memoryProposeToolAllowed = isToolNameAllowed('memory_propose', activeToolFilter);
|
|
109
|
+
if (!rememberToolAllowed && !memoryProposeToolAllowed) {
|
|
93
110
|
gates.includeMemoryDirective = false;
|
|
94
111
|
}
|
|
95
112
|
if (!['lessons_add', 'lessons_search', 'lessons_graph'].every(toolName => isToolNameAllowed(toolName, activeToolFilter))) {
|
|
@@ -188,7 +205,7 @@ export class PromptBuilder {
|
|
|
188
205
|
});
|
|
189
206
|
logger.debug(`Auto-selected prompt: ${autoId} (based on ${modelName})`);
|
|
190
207
|
}
|
|
191
|
-
else if (toolCfg.supportsToolCalls === false) {
|
|
208
|
+
else if (toolCfg.supportsToolCalls === false && !forceTools) {
|
|
192
209
|
// Chat-only base prompt for models that can't dispatch tool calls.
|
|
193
210
|
// The default body lists `bash`, `view_file`, `str_replace_editor`,
|
|
194
211
|
// etc. by name — small Ollama models read those mentions and try to
|
|
@@ -223,18 +240,56 @@ export class PromptBuilder {
|
|
|
223
240
|
systemPrompt = `# Role & Instructions (from intro_hook.txt)\n\n${introHookContent}\n\n---\n\n${systemPrompt}`;
|
|
224
241
|
logger.debug("Prepended intro hook content to system prompt");
|
|
225
242
|
}
|
|
226
|
-
// Inject
|
|
243
|
+
// Inject execution-discipline guidance (tool-use enforcement, anti-stub
|
|
244
|
+
// completion, mandatory-tool, pre-finalize self-check). Borrowed from the
|
|
245
|
+
// Hermes Agent prompt audit — its highest-leverage agentic-reliability
|
|
246
|
+
// block. Placed HERE in the STABLE PREFIX (not near the footer) on
|
|
247
|
+
// purpose: the footer reminder section is shuffled by the variation
|
|
248
|
+
// injector (varySystemPrompt → extractBlocks splits on bullet lines), so
|
|
249
|
+
// a late placement fragmented this block — foreign bullets got interleaved
|
|
250
|
+
// between its lines. Up here it stays contiguous, cache-stable, and
|
|
251
|
+
// survives head-truncation. Gated off for trivial/lite + tool-callless
|
|
252
|
+
// models (see gating above).
|
|
253
|
+
if (gates.includeExecutionDiscipline) {
|
|
254
|
+
try {
|
|
255
|
+
const { getExecutionDisciplineBlock } = await import('../prompts/execution-discipline.js');
|
|
256
|
+
systemPrompt += '\n\n' + getExecutionDisciplineBlock();
|
|
257
|
+
logger.debug('Injected execution-discipline guidance into system prompt');
|
|
258
|
+
}
|
|
259
|
+
catch (err) {
|
|
260
|
+
logger.warn('Failed to inject execution-discipline block', { error: getErrorMessage(err) });
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
// Inject project-instruction context (AGENTS.md / CODEBUDDY.md / CLAUDE.md
|
|
264
|
+
// / GEMINI.md / CONTEXT.md / INSTRUCTIONS.md) via the unified hierarchical
|
|
265
|
+
// loader, then soul/bootstrap files. A fresh dedup registry is created per
|
|
266
|
+
// build and reused by the JIT pass (`getContextRegistry`).
|
|
227
267
|
if (gates.includeBootstrap) {
|
|
268
|
+
this.contextRegistry = createContextRegistry();
|
|
269
|
+
// Publish for the JIT pass so it skips files injected here at startup.
|
|
270
|
+
setActiveContextRegistry(this.contextRegistry);
|
|
271
|
+
try {
|
|
272
|
+
const ctx = resolveProjectContext({ cwd: this.config.cwd, registry: this.contextRegistry });
|
|
273
|
+
if (ctx.text) {
|
|
274
|
+
systemPrompt += '\n\n# Workspace Context\n\n' + ctx.text;
|
|
275
|
+
logger.debug(`Loaded project context from ${ctx.sources.length} file(s)`, {
|
|
276
|
+
sources: ctx.sources.map((s) => s.relPath),
|
|
277
|
+
chars: ctx.bytes,
|
|
278
|
+
truncated: ctx.truncated,
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
catch (err) {
|
|
283
|
+
logger.warn("Failed to load project context", { error: getErrorMessage(err) });
|
|
284
|
+
}
|
|
285
|
+
// Soul/identity bootstrap files (SOUL.md, USER.md, …) + PROJECT_KNOWLEDGE.md.
|
|
286
|
+
// Instruction files are handled above by the unified loader, not here.
|
|
228
287
|
try {
|
|
229
288
|
const { BootstrapLoader } = await import('../context/bootstrap-loader.js');
|
|
230
289
|
const bootstrap = await new BootstrapLoader().load(this.config.cwd);
|
|
231
290
|
if (bootstrap.content) {
|
|
232
|
-
systemPrompt += '\n\n
|
|
233
|
-
logger.debug(`Loaded bootstrap context from ${bootstrap.sources.length} file(s)
|
|
234
|
-
sources: bootstrap.sources,
|
|
235
|
-
chars: bootstrap.tokenCount,
|
|
236
|
-
truncated: bootstrap.truncated,
|
|
237
|
-
});
|
|
291
|
+
systemPrompt += '\n\n' + bootstrap.content;
|
|
292
|
+
logger.debug(`Loaded bootstrap/soul context from ${bootstrap.sources.length} file(s)`);
|
|
238
293
|
}
|
|
239
294
|
}
|
|
240
295
|
catch (err) {
|
|
@@ -300,6 +355,31 @@ export class PromptBuilder {
|
|
|
300
355
|
}
|
|
301
356
|
catch { /* rules module optional */ }
|
|
302
357
|
}
|
|
358
|
+
// Steer toward Code Explorer (gitnexus) when it is connected. Conditional:
|
|
359
|
+
// when Code Explorer is absent this injects nothing, so the built-in
|
|
360
|
+
// code_graph/codebase_map behaviour is unchanged. Presence is session-
|
|
361
|
+
// stable, so this stays in the cache-stable prefix.
|
|
362
|
+
try {
|
|
363
|
+
const { isCodeExplorerAvailable } = await import('../codebuddy/tools.js');
|
|
364
|
+
if (isCodeExplorerAvailable()) {
|
|
365
|
+
systemPrompt +=
|
|
366
|
+
`\n\n<code_explorer_priority>\n` +
|
|
367
|
+
`Code Explorer (gitnexus) is connected. For ANY question about code relationships — ` +
|
|
368
|
+
`callers/callees, blast radius / impact ("what breaks if I change X"), dead code, cycles, ` +
|
|
369
|
+
`coupling, complexity — PREFER its MCP tools (\`mcp__gitnexus__impact\`, ` +
|
|
370
|
+
`\`mcp__gitnexus__context\`, \`mcp__gitnexus__query\`, \`mcp__gitnexus__find_cycles\`, …) ` +
|
|
371
|
+
`over the built-in \`code_graph\` / \`codebase_map\`: the gitnexus graph is broader and more ` +
|
|
372
|
+
`complete (whole-repo, 14 languages).\n` +
|
|
373
|
+
`Usage: first call \`mcp__gitnexus__list_repos\` once to get the repo \`path\`/\`id\`, then call ` +
|
|
374
|
+
`\`mcp__gitnexus__impact\` with the REQUIRED \`target\` = the symbol name (e.g. \`target: "executePlan"\`, ` +
|
|
375
|
+
`optionally \`direction: "both"\`) and \`repo\` = that path; or \`mcp__gitnexus__context\` with \`name\` = ` +
|
|
376
|
+
`the symbol. Always include \`target\`/\`name\` — never call these tools with empty arguments. ` +
|
|
377
|
+
`Use the built-in \`code_graph\`/\`codebase_map\` only as a fallback if a gitnexus tool errors.\n` +
|
|
378
|
+
`</code_explorer_priority>`;
|
|
379
|
+
logger.debug('Injected Code Explorer priority directive');
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
catch { /* tools module optional */ }
|
|
303
383
|
// Inject active skill prompt enhancement
|
|
304
384
|
if (gates.includeSkills) {
|
|
305
385
|
try {
|
|
@@ -313,10 +393,11 @@ export class PromptBuilder {
|
|
|
313
393
|
}
|
|
314
394
|
catch { /* skills module optional */ }
|
|
315
395
|
}
|
|
316
|
-
// Inject identity (SOUL.md, USER.md,
|
|
396
|
+
// Inject identity (SOUL.md, USER.md, …) — skip if already present to avoid duplication.
|
|
397
|
+
// AGENTS.md/INSTRUCTIONS.md are owned by the unified loader, not identity.
|
|
317
398
|
if (gates.includeIdentity) {
|
|
318
399
|
try {
|
|
319
|
-
if (!systemPrompt.includes('## SOUL.md')
|
|
400
|
+
if (!systemPrompt.includes('## SOUL.md')) {
|
|
320
401
|
const { getIdentityManager } = await import('../identity/identity-manager.js');
|
|
321
402
|
const identityMgr = getIdentityManager();
|
|
322
403
|
await identityMgr.load(this.config.cwd);
|
|
@@ -361,17 +442,32 @@ export class PromptBuilder {
|
|
|
361
442
|
}
|
|
362
443
|
catch { /* fleet registry optional — module not loaded yet */ }
|
|
363
444
|
}
|
|
364
|
-
// Inject auto-memory directive — tells the LLM WHEN to call
|
|
365
|
-
// `
|
|
445
|
+
// Inject auto-memory directive — tells the LLM WHEN to call `remember`
|
|
446
|
+
// or the review-gated `memory_propose` tool for non-obvious facts from
|
|
366
447
|
// .codebuddy/CODEBUDDY_MEMORY.md (project) or ~/.codebuddy/memory.md
|
|
367
448
|
// (user). Without this directive, the tool is registered but the LLM
|
|
368
449
|
// has no instruction on when to use it, so the file stays empty.
|
|
369
|
-
// Paired with `alwaysInclude: ['remember']` in
|
|
450
|
+
// Paired with `alwaysInclude: ['remember', 'memory_propose']` in
|
|
451
|
+
// tool-selection-strategy.
|
|
370
452
|
if (this.config.memoryEnabled && this.persistentMemory && gates.includeMemoryDirective) {
|
|
453
|
+
const memoryWriteInstruction = memoryProposeToolAllowed
|
|
454
|
+
? 'Use `remember` only for explicit, high-confidence durable facts. Use `memory_propose` for inferred, ambiguous, or model-derived facts so the user can review them before they become prompt-injected memory.'
|
|
455
|
+
: 'Use `remember` only for explicit, high-confidence durable facts. Do not store inferred or ambiguous facts silently.';
|
|
456
|
+
const inferredFactInstruction = memoryProposeToolAllowed
|
|
457
|
+
? 'When to call `memory_propose`:'
|
|
458
|
+
: 'When to consider durable memory, but skip if it is only inferred or ambiguous:';
|
|
459
|
+
const closingMemoryInstruction = memoryProposeToolAllowed
|
|
460
|
+
? 'Prefer `memory_propose` over `remember` when the fact came from your interpretation rather than an explicit user instruction.'
|
|
461
|
+
: 'Only call `remember` when the fact came from an explicit user instruction or correction.';
|
|
371
462
|
systemPrompt += `\n\n<auto_memory_directive>
|
|
372
|
-
You have a persistent memory system at .codebuddy/CODEBUDDY_MEMORY.md (project-scoped) and ~/.codebuddy/memory.md (user-scoped, all projects).
|
|
463
|
+
You have a persistent memory system at .codebuddy/CODEBUDDY_MEMORY.md (project-scoped) and ~/.codebuddy/memory.md (user-scoped, all projects).
|
|
464
|
+
${memoryWriteInstruction}
|
|
373
465
|
|
|
374
466
|
When to call \`remember\`:
|
|
467
|
+
- The user explicitly says to remember/store a fact or preference
|
|
468
|
+
- The user directly corrects an existing stable fact
|
|
469
|
+
|
|
470
|
+
${inferredFactInstruction}
|
|
375
471
|
- User preferences ("user prefers single quotes", "always use Vitest, not Jest")
|
|
376
472
|
- Architectural decisions ("API uses JWT in HttpOnly cookies, not localStorage")
|
|
377
473
|
- Non-obvious gotchas ("vi.hoisted() needed for mock factories in this repo")
|
|
@@ -388,7 +484,7 @@ Format:
|
|
|
388
484
|
- \`scope\`: \`project\` (default — fact is specific to THIS repo) or \`user\` (preference across all projects)
|
|
389
485
|
- \`category\`: \`preferences\`, \`decisions\`, \`patterns\`, \`project\`, or \`custom\`
|
|
390
486
|
|
|
391
|
-
|
|
487
|
+
${closingMemoryInstruction}
|
|
392
488
|
</auto_memory_directive>`;
|
|
393
489
|
logger.debug('Injected auto-memory directive into system prompt');
|
|
394
490
|
}
|
|
@@ -435,6 +531,16 @@ Lessons complement \`remember\`: \`remember\` stores facts (preferences, decisio
|
|
|
435
531
|
</lessons_directive>`;
|
|
436
532
|
logger.debug('Injected lessons directive into system prompt');
|
|
437
533
|
}
|
|
534
|
+
// Self-knowledge — only when self-improvement is explicitly opted in. Makes
|
|
535
|
+
// the agent aware it can author its own tools/skills (and the hard `src/` limit).
|
|
536
|
+
if (process.env.CODEBUDDY_SELF_IMPROVE === 'true') {
|
|
537
|
+
try {
|
|
538
|
+
const { buildSelfKnowledgeBlock } = await import('../agent/self-improvement/self-knowledge.js');
|
|
539
|
+
systemPrompt += `\n\n<self_knowledge>\n${buildSelfKnowledgeBlock()}\n</self_knowledge>`;
|
|
540
|
+
logger.debug('Injected self-knowledge block into system prompt');
|
|
541
|
+
}
|
|
542
|
+
catch { /* self-improvement module optional */ }
|
|
543
|
+
}
|
|
438
544
|
if (this.config.memoryEnabled && gates.includeUserModelDirective) {
|
|
439
545
|
systemPrompt += `\n\n<user_model_directive>
|
|
440
546
|
You have a persistent user model that builds a deepening profile of who you are, your traits, preferences, expertise, and working style.
|
|
@@ -642,6 +748,7 @@ export function gatesForComplexity(complexity) {
|
|
|
642
748
|
includeWritingRules: true,
|
|
643
749
|
includeCodingStyle: false,
|
|
644
750
|
includeWorkflowRules: false,
|
|
751
|
+
includeExecutionDiscipline: false,
|
|
645
752
|
includeVariation: false,
|
|
646
753
|
};
|
|
647
754
|
case 'simple':
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module shared/engine-types
|
|
9
9
|
*/
|
|
10
|
-
export type EngineStreamEventType = 'content' | 'thinking' | 'tool_start' | 'tool_end' | 'tool_stream' | 'token_count' | 'cost' | 'done' | 'error' | 'ask_user' | 'plan_progress' | 'diff_preview';
|
|
10
|
+
export type EngineStreamEventType = 'content' | 'thinking' | 'tool_start' | 'tool_end' | 'tool_stream' | 'token_count' | 'cost' | 'done' | 'error' | 'ask_user' | 'plan_progress' | 'steer' | 'diff_preview' | 'goal_status';
|
|
11
11
|
export interface EngineStreamEvent {
|
|
12
12
|
type: EngineStreamEventType;
|
|
13
13
|
/** Incremental text delta */
|
|
@@ -47,6 +47,11 @@ export interface EngineStreamEvent {
|
|
|
47
47
|
completed: number;
|
|
48
48
|
message?: string;
|
|
49
49
|
};
|
|
50
|
+
/** User guidance delivered to an active run. */
|
|
51
|
+
steer?: {
|
|
52
|
+
content: string;
|
|
53
|
+
source: string;
|
|
54
|
+
};
|
|
50
55
|
/** Diff preview */
|
|
51
56
|
diffPreview?: {
|
|
52
57
|
turnId: number;
|
|
@@ -59,6 +64,15 @@ export interface EngineStreamEvent {
|
|
|
59
64
|
}>;
|
|
60
65
|
plan?: string;
|
|
61
66
|
};
|
|
67
|
+
/** Autonomous goal-loop progress (for host UIs like the Cowork goal banner). */
|
|
68
|
+
goalStatus?: {
|
|
69
|
+
goal: string;
|
|
70
|
+
status: 'active' | 'paused' | 'done' | 'cleared';
|
|
71
|
+
turnsUsed: number;
|
|
72
|
+
maxTurns: number;
|
|
73
|
+
lastVerdict?: 'done' | 'continue' | 'skipped';
|
|
74
|
+
lastReason?: string;
|
|
75
|
+
};
|
|
62
76
|
}
|
|
63
77
|
export interface EngineMessage {
|
|
64
78
|
role: 'user' | 'assistant' | 'system';
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { spawn } from 'child_process';
|
|
12
12
|
import { createInterface } from 'readline';
|
|
13
13
|
import { join } from 'path';
|
|
14
|
-
import { existsSync } from 'fs';
|
|
14
|
+
import { accessSync, constants, existsSync } from 'fs';
|
|
15
15
|
import { logger } from '../utils/logger.js';
|
|
16
16
|
// ============================================================================
|
|
17
17
|
// Sidecar Bridge
|
|
@@ -27,23 +27,34 @@ export class SidecarBridge {
|
|
|
27
27
|
* Find the sidecar binary
|
|
28
28
|
*/
|
|
29
29
|
findBinary() {
|
|
30
|
+
const localBinary = process.platform === 'win32' ? 'codebuddy-sidecar.exe' : 'codebuddy-sidecar';
|
|
30
31
|
const candidates = [
|
|
31
32
|
// Development: built via `cargo build`
|
|
32
|
-
join(process.cwd(), 'src-sidecar', 'target', 'release',
|
|
33
|
-
join(process.cwd(), 'src-sidecar', 'target', '
|
|
34
|
-
join(process.cwd(), 'src-sidecar', 'target', 'debug', 'codebuddy-sidecar.exe'),
|
|
35
|
-
join(process.cwd(), 'src-sidecar', 'target', 'debug', 'codebuddy-sidecar'),
|
|
33
|
+
join(process.cwd(), 'src-sidecar', 'target', 'release', localBinary),
|
|
34
|
+
join(process.cwd(), 'src-sidecar', 'target', 'debug', localBinary),
|
|
36
35
|
// Installed globally
|
|
37
|
-
join(process.env.HOME || process.env.USERPROFILE || '', '.cargo', 'bin',
|
|
38
|
-
join(process.env.HOME || process.env.USERPROFILE || '', '.cargo', 'bin', 'codebuddy-sidecar'),
|
|
36
|
+
join(process.env.HOME || process.env.USERPROFILE || '', '.cargo', 'bin', localBinary),
|
|
39
37
|
];
|
|
40
|
-
for (const
|
|
41
|
-
if (
|
|
42
|
-
return
|
|
38
|
+
for (const candidate of candidates) {
|
|
39
|
+
if (this.isExecutableCandidate(candidate)) {
|
|
40
|
+
return candidate;
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
43
|
return null;
|
|
46
44
|
}
|
|
45
|
+
isExecutableCandidate(filePath) {
|
|
46
|
+
if (!existsSync(filePath))
|
|
47
|
+
return false;
|
|
48
|
+
if (process.platform === 'win32')
|
|
49
|
+
return true;
|
|
50
|
+
try {
|
|
51
|
+
accessSync(filePath, constants.X_OK);
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
47
58
|
/**
|
|
48
59
|
* Check if sidecar is available
|
|
49
60
|
*/
|
package/dist/skills/parser.js
CHANGED
|
@@ -92,6 +92,9 @@ function parseMetadata(yamlContent, sourcePath) {
|
|
|
92
92
|
// CC11: context fork and disable-model-invocation
|
|
93
93
|
contextFork: parsed.context === 'fork' || parsed.contextFork === true,
|
|
94
94
|
disableModelInvocation: parsed['disable-model-invocation'] === true || parsed.disableModelInvocation === true,
|
|
95
|
+
pinned: parsed.pinned === true,
|
|
96
|
+
imported: parsed.imported === true,
|
|
97
|
+
source: parsed.source,
|
|
95
98
|
};
|
|
96
99
|
}
|
|
97
100
|
catch (error) {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill importer — bring EXTERNAL skills (a Hermes repo, any skills directory)
|
|
3
|
+
* into Code Buddy, safely. External skills are untrusted and get injected into the
|
|
4
|
+
* agent's context, so the firewall gates every one (SKILL.md + its scripts) before
|
|
5
|
+
* install. Hermes nests 1–3 levels but our registry walks 1 level → flatten; Hermes
|
|
6
|
+
* tags live under `metadata.hermes.tags` but our discovery scores top-level `tags` +
|
|
7
|
+
* `nativeEngine.triggers` → remap, else an imported skill is invisible to matching.
|
|
8
|
+
*
|
|
9
|
+
* Imported skills are namespaced `imported-*` (distinct provenance; never touched by
|
|
10
|
+
* the self-improvement engine) and installed flat (1 level) under a tier root.
|
|
11
|
+
*
|
|
12
|
+
* @module skills/skill-importer
|
|
13
|
+
*/
|
|
14
|
+
export declare const IMPORTED_PREFIX = "imported-";
|
|
15
|
+
export interface ImportOptions {
|
|
16
|
+
/** Tier dir to install under. Default ~/.codebuddy/skills/managed. */
|
|
17
|
+
destRoot?: string;
|
|
18
|
+
/** Provenance label written to frontmatter (e.g. "hermes"). */
|
|
19
|
+
source?: string;
|
|
20
|
+
/** When true, scan + report but write nothing. */
|
|
21
|
+
dryRun?: boolean;
|
|
22
|
+
/** Import skills the firewall flags as 'review' (default: skip them). */
|
|
23
|
+
includeReview?: boolean;
|
|
24
|
+
/** Overwrite an existing imported-<name> (default: skip). */
|
|
25
|
+
overwrite?: boolean;
|
|
26
|
+
/** Only import skills whose source path contains this substring. */
|
|
27
|
+
category?: string;
|
|
28
|
+
/** Pin imported skills so curation leaves them alone (default true). */
|
|
29
|
+
pinByDefault?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface ImportedSkill {
|
|
32
|
+
name: string;
|
|
33
|
+
sourcePath: string;
|
|
34
|
+
verdict: string;
|
|
35
|
+
}
|
|
36
|
+
export interface SkippedSkill {
|
|
37
|
+
sourcePath: string;
|
|
38
|
+
reason: string;
|
|
39
|
+
verdict?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ImportReport {
|
|
42
|
+
imported: ImportedSkill[];
|
|
43
|
+
quarantined: SkippedSkill[];
|
|
44
|
+
review: SkippedSkill[];
|
|
45
|
+
skipped: SkippedSkill[];
|
|
46
|
+
total: number;
|
|
47
|
+
dryRun: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** Recursively find skill directories (those containing a SKILL.md). Skips operational dirs. */
|
|
50
|
+
export declare function findSkillDirs(root: string): string[];
|
|
51
|
+
/** Build a Code-Buddy-shaped SKILL.md from a raw (e.g. Hermes) frontmatter object + body. */
|
|
52
|
+
export declare function remapSkill(rawFm: Record<string, unknown>, body: string, opts: {
|
|
53
|
+
slug: string;
|
|
54
|
+
source: string;
|
|
55
|
+
pinned: boolean;
|
|
56
|
+
}): string;
|
|
57
|
+
/** Import skills from a directory. Pure-ish: writes nothing when dryRun. */
|
|
58
|
+
export declare function importSkills(sourceDir: string, options?: ImportOptions): ImportReport;
|