@caupulican/pi-adaptative 0.85.4 → 0.86.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/dist/bun/cli.d.ts +1 -1
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +1 -0
- package/dist/bun/cli.js.map +1 -1
- package/dist/core/agent-paths.d.ts +3 -3
- package/dist/core/agent-paths.d.ts.map +1 -1
- package/dist/core/agent-paths.js +3 -3
- package/dist/core/agent-paths.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +1 -1
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +11 -5
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +14 -3
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +2 -2
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +2 -2
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/autonomy/bounded-completion.d.ts.map +1 -1
- package/dist/core/autonomy/bounded-completion.js +19 -8
- package/dist/core/autonomy/bounded-completion.js.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.d.ts +11 -5
- package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.js +34 -8
- package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
- package/dist/core/autonomy/subagent-prompt.d.ts +3 -3
- package/dist/core/autonomy/subagent-prompt.js +9 -9
- package/dist/core/autonomy/subagent-prompt.js.map +1 -1
- package/dist/core/background-lane-controller.d.ts +10 -8
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +23 -13
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/bash-execution-controller.d.ts +4 -0
- package/dist/core/bash-execution-controller.d.ts.map +1 -1
- package/dist/core/bash-execution-controller.js +11 -4
- package/dist/core/bash-execution-controller.js.map +1 -1
- package/dist/core/bash-executor.d.ts +2 -0
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +4 -3
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/billing-failover-controller.d.ts +2 -2
- package/dist/core/billing-failover-controller.d.ts.map +1 -1
- package/dist/core/billing-failover-controller.js +1 -1
- package/dist/core/billing-failover-controller.js.map +1 -1
- package/dist/core/capability-contract.d.ts +1 -1
- package/dist/core/capability-contract.d.ts.map +1 -1
- package/dist/core/capability-contract.js +0 -1
- package/dist/core/capability-contract.js.map +1 -1
- package/dist/core/compaction-controller.d.ts +8 -2
- package/dist/core/compaction-controller.d.ts.map +1 -1
- package/dist/core/compaction-controller.js +73 -3
- package/dist/core/compaction-controller.js.map +1 -1
- package/dist/core/compaction-support.d.ts +2 -2
- package/dist/core/compaction-support.d.ts.map +1 -1
- package/dist/core/compaction-support.js +9 -1
- package/dist/core/compaction-support.js.map +1 -1
- package/dist/core/context/artifact-retrieval.d.ts +1 -1
- package/dist/core/context/artifact-retrieval.d.ts.map +1 -1
- package/dist/core/context/artifact-retrieval.js +1 -1
- package/dist/core/context/artifact-retrieval.js.map +1 -1
- package/dist/core/context/context-artifacts.d.ts +6 -6
- package/dist/core/context/context-artifacts.d.ts.map +1 -1
- package/dist/core/context/context-artifacts.js +151 -63
- package/dist/core/context/context-artifacts.js.map +1 -1
- package/dist/core/context/context-composition.js +1 -1
- package/dist/core/context/context-composition.js.map +1 -1
- package/dist/core/context/context-store-retention.d.ts.map +1 -1
- package/dist/core/context/context-store-retention.js +5 -2
- package/dist/core/context/context-store-retention.js.map +1 -1
- package/dist/core/context/file-store-memory-provider.js +1 -1
- package/dist/core/context/file-store-memory-provider.js.map +1 -1
- package/dist/core/context/tool-output-packer.d.ts +1 -1
- package/dist/core/context/tool-output-packer.d.ts.map +1 -1
- package/dist/core/context/tool-output-packer.js +1 -1
- package/dist/core/context/tool-output-packer.js.map +1 -1
- package/dist/core/context-gc.d.ts.map +1 -1
- package/dist/core/context-gc.js +7 -5
- package/dist/core/context-gc.js.map +1 -1
- package/dist/core/context-pipeline.d.ts +2 -2
- package/dist/core/context-pipeline.d.ts.map +1 -1
- package/dist/core/context-pipeline.js +8 -4
- package/dist/core/context-pipeline.js.map +1 -1
- package/dist/core/cost/cost-summary.d.ts +1 -1
- package/dist/core/cost/cost-summary.d.ts.map +1 -1
- package/dist/core/cost/cost-summary.js +1 -1
- package/dist/core/cost/cost-summary.js.map +1 -1
- package/dist/core/cost/daily-usage.d.ts +1 -1
- package/dist/core/cost/daily-usage.d.ts.map +1 -1
- package/dist/core/cost/daily-usage.js +2 -2
- package/dist/core/cost/daily-usage.js.map +1 -1
- package/dist/core/cost/session-usage.d.ts +1 -1
- package/dist/core/cost/session-usage.d.ts.map +1 -1
- package/dist/core/cost/session-usage.js +1 -1
- package/dist/core/cost/session-usage.js.map +1 -1
- package/dist/core/default-tool-surface.d.ts +1 -0
- package/dist/core/default-tool-surface.d.ts.map +1 -1
- package/dist/core/default-tool-surface.js +3 -2
- package/dist/core/default-tool-surface.js.map +1 -1
- package/dist/core/delegation/worker-actions.js +1 -1
- package/dist/core/delegation/worker-actions.js.map +1 -1
- package/dist/core/delegation/worker-agent-control-coordinator.d.ts +27 -8
- package/dist/core/delegation/worker-agent-control-coordinator.d.ts.map +1 -1
- package/dist/core/delegation/worker-agent-control-coordinator.js +191 -33
- package/dist/core/delegation/worker-agent-control-coordinator.js.map +1 -1
- package/dist/core/delegation/worker-agent-control.d.ts +45 -6
- package/dist/core/delegation/worker-agent-control.d.ts.map +1 -1
- package/dist/core/delegation/worker-agent-control.js +110 -13
- package/dist/core/delegation/worker-agent-control.js.map +1 -1
- package/dist/core/delegation/worker-attempt-executor.d.ts +1 -1
- package/dist/core/delegation/worker-attempt-executor.d.ts.map +1 -1
- package/dist/core/delegation/worker-attempt-executor.js +180 -160
- package/dist/core/delegation/worker-attempt-executor.js.map +1 -1
- package/dist/core/delegation/worker-authority-resolver.d.ts +23 -0
- package/dist/core/delegation/worker-authority-resolver.d.ts.map +1 -0
- package/dist/core/delegation/worker-authority-resolver.js +128 -0
- package/dist/core/delegation/worker-authority-resolver.js.map +1 -0
- package/dist/core/delegation/worker-conversation-store.d.ts +2 -1
- package/dist/core/delegation/worker-conversation-store.d.ts.map +1 -1
- package/dist/core/delegation/worker-conversation-store.js +4 -3
- package/dist/core/delegation/worker-conversation-store.js.map +1 -1
- package/dist/core/delegation/worker-delegation-controller.d.ts +7 -1
- package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -1
- package/dist/core/delegation/worker-delegation-controller.js +260 -87
- package/dist/core/delegation/worker-delegation-controller.js.map +1 -1
- package/dist/core/delegation/worker-delegation-request.d.ts +25 -4
- package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -1
- package/dist/core/delegation/worker-delegation-request.js +90 -1
- package/dist/core/delegation/worker-delegation-request.js.map +1 -1
- package/dist/core/delegation/worker-execution-policy.d.ts +2 -0
- package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -1
- package/dist/core/delegation/worker-execution-policy.js +22 -12
- package/dist/core/delegation/worker-execution-policy.js.map +1 -1
- package/dist/core/delegation/worker-lifecycle.d.ts +1 -0
- package/dist/core/delegation/worker-lifecycle.d.ts.map +1 -1
- package/dist/core/delegation/worker-lifecycle.js +4 -2
- package/dist/core/delegation/worker-lifecycle.js.map +1 -1
- package/dist/core/delegation/worker-profile-resolver.d.ts +0 -2
- package/dist/core/delegation/worker-profile-resolver.d.ts.map +1 -1
- package/dist/core/delegation/worker-profile-resolver.js +8 -35
- package/dist/core/delegation/worker-profile-resolver.js.map +1 -1
- package/dist/core/delegation/worker-recovery-coordinator.d.ts.map +1 -1
- package/dist/core/delegation/worker-recovery-coordinator.js +1 -0
- package/dist/core/delegation/worker-recovery-coordinator.js.map +1 -1
- package/dist/core/delegation/worker-runner.d.ts +6 -1
- package/dist/core/delegation/worker-runner.d.ts.map +1 -1
- package/dist/core/delegation/worker-runner.js +20 -6
- package/dist/core/delegation/worker-runner.js.map +1 -1
- package/dist/core/delegation/worker-tree-budget-coordinator.d.ts +47 -0
- package/dist/core/delegation/worker-tree-budget-coordinator.d.ts.map +1 -0
- package/dist/core/delegation/worker-tree-budget-coordinator.js +210 -0
- package/dist/core/delegation/worker-tree-budget-coordinator.js.map +1 -0
- package/dist/core/extensions/builtin.d.ts +2 -2
- package/dist/core/extensions/builtin.d.ts.map +1 -1
- package/dist/core/extensions/builtin.js +2 -2
- package/dist/core/extensions/builtin.js.map +1 -1
- package/dist/core/extensions/bundled-virtual-modules.d.ts +2 -0
- package/dist/core/extensions/bundled-virtual-modules.d.ts.map +1 -0
- package/dist/core/extensions/bundled-virtual-modules.js +129 -0
- package/dist/core/extensions/bundled-virtual-modules.js.map +1 -0
- package/dist/core/extensions/factory-runtime.d.ts +22 -0
- package/dist/core/extensions/factory-runtime.d.ts.map +1 -0
- package/dist/core/extensions/factory-runtime.js +334 -0
- package/dist/core/extensions/factory-runtime.js.map +1 -0
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/lifecycle.d.ts +13 -0
- package/dist/core/extensions/lifecycle.d.ts.map +1 -0
- package/dist/core/extensions/lifecycle.js +52 -0
- package/dist/core/extensions/lifecycle.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +3 -24
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +21 -531
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts +51 -0
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
- package/dist/core/extensions/virtual-modules.js +59 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -0
- package/dist/core/foreground-recovery-controller.d.ts +2 -1
- package/dist/core/foreground-recovery-controller.d.ts.map +1 -1
- package/dist/core/foreground-recovery-controller.js +3 -3
- package/dist/core/foreground-recovery-controller.js.map +1 -1
- package/dist/core/goal-loop-controller.js +1 -1
- package/dist/core/goal-loop-controller.js.map +1 -1
- package/dist/core/goals/compact-goal-context.d.ts +1 -1
- package/dist/core/goals/compact-goal-context.d.ts.map +1 -1
- package/dist/core/goals/compact-goal-context.js +1 -1
- package/dist/core/goals/compact-goal-context.js.map +1 -1
- package/dist/core/goals/goal-auto-continue-controller.js +1 -1
- package/dist/core/goals/goal-auto-continue-controller.js.map +1 -1
- package/dist/core/goals/goal-session-controller.d.ts +1 -1
- package/dist/core/goals/goal-session-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-session-controller.js +1 -1
- package/dist/core/goals/goal-session-controller.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +1 -1
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/memory/providers/file-store.d.ts.map +1 -1
- package/dist/core/memory/providers/file-store.js +1 -1
- package/dist/core/memory/providers/file-store.js.map +1 -1
- package/dist/core/memory/providers/user-memory-archive.js +1 -1
- package/dist/core/memory/providers/user-memory-archive.js.map +1 -1
- package/dist/core/model-registry.d.ts +2 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +4 -1
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-router-controller.js +1 -1
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/model-selection-controller.js +1 -1
- package/dist/core/model-selection-controller.js.map +1 -1
- package/dist/core/model-tool-protocol.d.ts +1 -1
- package/dist/core/model-tool-protocol.d.ts.map +1 -1
- package/dist/core/model-tool-protocol.js +1 -1
- package/dist/core/model-tool-protocol.js.map +1 -1
- package/dist/core/models/llamacpp-runtime.d.ts +7 -0
- package/dist/core/models/llamacpp-runtime.d.ts.map +1 -1
- package/dist/core/models/llamacpp-runtime.js +8 -3
- package/dist/core/models/llamacpp-runtime.js.map +1 -1
- package/dist/core/models/local-runtime.js +1 -1
- package/dist/core/models/local-runtime.js.map +1 -1
- package/dist/core/models/runtime-process.d.ts.map +1 -1
- package/dist/core/models/runtime-process.js +5 -18
- package/dist/core/models/runtime-process.js.map +1 -1
- package/dist/core/orchestration/bounded-string-array.d.ts +11 -0
- package/dist/core/orchestration/bounded-string-array.d.ts.map +1 -0
- package/dist/core/orchestration/bounded-string-array.js +17 -0
- package/dist/core/orchestration/bounded-string-array.js.map +1 -0
- package/dist/core/orchestration/capability-gateway.d.ts +16 -0
- package/dist/core/orchestration/capability-gateway.d.ts.map +1 -1
- package/dist/core/orchestration/capability-gateway.js +38 -0
- package/dist/core/orchestration/capability-gateway.js.map +1 -1
- package/dist/core/orchestration/contracts.d.ts +11 -3
- package/dist/core/orchestration/contracts.d.ts.map +1 -1
- package/dist/core/orchestration/contracts.js +0 -1
- package/dist/core/orchestration/contracts.js.map +1 -1
- package/dist/core/orchestration/delegation-ledger.d.ts +1 -0
- package/dist/core/orchestration/delegation-ledger.d.ts.map +1 -1
- package/dist/core/orchestration/delegation-ledger.js +3 -0
- package/dist/core/orchestration/delegation-ledger.js.map +1 -1
- package/dist/core/orchestration/event-store.d.ts +12 -10
- package/dist/core/orchestration/event-store.d.ts.map +1 -1
- package/dist/core/orchestration/event-store.js +94 -104
- package/dist/core/orchestration/event-store.js.map +1 -1
- package/dist/core/orchestration/lane-tool-manifests.d.ts +2 -2
- package/dist/core/orchestration/lane-tool-manifests.d.ts.map +1 -1
- package/dist/core/orchestration/lane-tool-manifests.js +4 -1
- package/dist/core/orchestration/lane-tool-manifests.js.map +1 -1
- package/dist/core/orchestration/model-binding.d.ts +1 -1
- package/dist/core/orchestration/model-binding.d.ts.map +1 -1
- package/dist/core/orchestration/model-binding.js +1 -1
- package/dist/core/orchestration/model-binding.js.map +1 -1
- package/dist/core/orchestration/policy-compiler.d.ts.map +1 -1
- package/dist/core/orchestration/policy-compiler.js +8 -9
- package/dist/core/orchestration/policy-compiler.js.map +1 -1
- package/dist/core/orchestration/profile-registry.d.ts.map +1 -1
- package/dist/core/orchestration/profile-registry.js +4 -10
- package/dist/core/orchestration/profile-registry.js.map +1 -1
- package/dist/core/orchestration/task-profile-writer.js +1 -1
- package/dist/core/orchestration/task-profile-writer.js.map +1 -1
- package/dist/core/orchestration/task-runtime.d.ts +1 -0
- package/dist/core/orchestration/task-runtime.d.ts.map +1 -1
- package/dist/core/orchestration/task-runtime.js +58 -3
- package/dist/core/orchestration/task-runtime.js.map +1 -1
- package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -1
- package/dist/core/orchestration/worker-execution-contract.js +10 -17
- package/dist/core/orchestration/worker-execution-contract.js.map +1 -1
- package/dist/core/process-matrix/runtime.d.ts +15 -1
- package/dist/core/process-matrix/runtime.d.ts.map +1 -1
- package/dist/core/process-matrix/runtime.js +55 -34
- package/dist/core/process-matrix/runtime.js.map +1 -1
- package/dist/core/reflection-controller.d.ts +4 -3
- package/dist/core/reflection-controller.d.ts.map +1 -1
- package/dist/core/reflection-controller.js +2 -2
- package/dist/core/reflection-controller.js.map +1 -1
- package/dist/core/research/model-fitness-controller.js +1 -1
- package/dist/core/research/model-fitness-controller.js.map +1 -1
- package/dist/core/research/research-lane-controller.d.ts +2 -2
- package/dist/core/research/research-lane-controller.d.ts.map +1 -1
- package/dist/core/research/research-lane-controller.js +1 -1
- package/dist/core/research/research-lane-controller.js.map +1 -1
- package/dist/core/resource-loader.d.ts +10 -19
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +8 -70
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/risk-classifier.js +3 -3
- package/dist/core/risk-classifier.js.map +1 -1
- package/dist/core/runtime-builder.d.ts +4 -1
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +47 -18
- package/dist/core/runtime-builder.js.map +1 -1
- package/dist/core/scout-controller.d.ts +1 -1
- package/dist/core/scout-controller.d.ts.map +1 -1
- package/dist/core/scout-controller.js +1 -1
- package/dist/core/scout-controller.js.map +1 -1
- package/dist/core/sdk.d.ts +2 -2
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -3
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/secrets/bitwarden-credential-storage.d.ts +51 -0
- package/dist/core/secrets/bitwarden-credential-storage.d.ts.map +1 -0
- package/dist/core/secrets/bitwarden-credential-storage.js +345 -0
- package/dist/core/secrets/bitwarden-credential-storage.js.map +1 -0
- package/dist/core/secrets/credential-exposure-guard.d.ts +8 -4
- package/dist/core/secrets/credential-exposure-guard.d.ts.map +1 -1
- package/dist/core/secrets/credential-exposure-guard.js +31 -29
- package/dist/core/secrets/credential-exposure-guard.js.map +1 -1
- package/dist/core/secrets/credential-manager.d.ts +109 -0
- package/dist/core/secrets/credential-manager.d.ts.map +1 -0
- package/dist/core/secrets/credential-manager.js +384 -0
- package/dist/core/secrets/credential-manager.js.map +1 -0
- package/dist/core/secrets/credential-project.d.ts +4 -0
- package/dist/core/secrets/credential-project.d.ts.map +1 -0
- package/dist/core/secrets/credential-project.js +145 -0
- package/dist/core/secrets/credential-project.js.map +1 -0
- package/dist/core/secrets/secret-dotenv.d.ts +1 -1
- package/dist/core/secrets/secret-dotenv.js +1 -1
- package/dist/core/secrets/secret-dotenv.js.map +1 -1
- package/dist/core/security/context-threat-scanner.d.ts +14 -0
- package/dist/core/security/context-threat-scanner.d.ts.map +1 -0
- package/dist/core/security/context-threat-scanner.js +71 -0
- package/dist/core/security/context-threat-scanner.js.map +1 -0
- package/dist/core/session-supervision-runtime.d.ts +4 -1
- package/dist/core/session-supervision-runtime.d.ts.map +1 -1
- package/dist/core/session-supervision-runtime.js +49 -11
- package/dist/core/session-supervision-runtime.js.map +1 -1
- package/dist/core/settings-manager.d.ts +4 -2
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +10 -6
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.js +1 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tool-capability-policy.js +2 -2
- package/dist/core/tool-capability-policy.js.map +1 -1
- package/dist/core/tool-recovery-logger.js +1 -1
- package/dist/core/tool-recovery-logger.js.map +1 -1
- package/dist/core/tools/artifact-retrieve.js +1 -1
- package/dist/core/tools/artifact-retrieve.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -2
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +16 -4
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/delegate.d.ts +29 -1
- package/dist/core/tools/delegate.d.ts.map +1 -1
- package/dist/core/tools/delegate.js +179 -28
- package/dist/core/tools/delegate.js.map +1 -1
- package/dist/core/tools/extensionify-runtime.d.ts +44 -0
- package/dist/core/tools/extensionify-runtime.d.ts.map +1 -0
- package/dist/core/tools/extensionify-runtime.js +115 -0
- package/dist/core/tools/extensionify-runtime.js.map +1 -0
- package/dist/core/tools/extensionify.d.ts +9 -30
- package/dist/core/tools/extensionify.d.ts.map +1 -1
- package/dist/core/tools/extensionify.js +10 -140
- package/dist/core/tools/extensionify.js.map +1 -1
- package/dist/core/tools/find.d.ts +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +1 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/git-filter.d.ts +1 -0
- package/dist/core/tools/git-filter.d.ts.map +1 -1
- package/dist/core/tools/git-filter.js +1 -1
- package/dist/core/tools/git-filter.js.map +1 -1
- package/dist/core/tools/index.d.ts +2 -4
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +7 -43
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +1 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +1 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/profile-writer.js +3 -3
- package/dist/core/tools/profile-writer.js.map +1 -1
- package/dist/core/tools/python.d.ts +2 -0
- package/dist/core/tools/python.d.ts.map +1 -1
- package/dist/core/tools/python.js +17 -12
- package/dist/core/tools/python.js.map +1 -1
- package/dist/core/tools/render-utils.js +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/run-process.d.ts +2 -0
- package/dist/core/tools/run-process.d.ts.map +1 -1
- package/dist/core/tools/run-process.js +7 -3
- package/dist/core/tools/run-process.js.map +1 -1
- package/dist/core/tools/search-command-guard.d.ts +8 -0
- package/dist/core/tools/search-command-guard.d.ts.map +1 -1
- package/dist/core/tools/search-command-guard.js +54 -0
- package/dist/core/tools/search-command-guard.js.map +1 -1
- package/dist/core/tools/secret-store.d.ts +8 -18
- package/dist/core/tools/secret-store.d.ts.map +1 -1
- package/dist/core/tools/secret-store.js +83 -348
- package/dist/core/tools/secret-store.js.map +1 -1
- package/dist/core/tools/shell-contract-router.d.ts.map +1 -1
- package/dist/core/tools/shell-contract-router.js +9 -4
- package/dist/core/tools/shell-contract-router.js.map +1 -1
- package/dist/core/tools/shell-session.d.ts.map +1 -1
- package/dist/core/tools/shell-session.js +6 -4
- package/dist/core/tools/shell-session.js.map +1 -1
- package/dist/core/tools/tool-definition-factory.d.ts +32 -0
- package/dist/core/tools/tool-definition-factory.d.ts.map +1 -0
- package/dist/core/tools/tool-definition-factory.js +55 -0
- package/dist/core/tools/tool-definition-factory.js.map +1 -0
- package/dist/core/util/atomic-file.d.ts.map +1 -1
- package/dist/core/util/atomic-file.js +79 -32
- package/dist/core/util/atomic-file.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +24 -18
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/auto-learn-controller.js +1 -1
- package/dist/modes/interactive/auto-learn-controller.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +35 -14
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +1 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-event-controller.js +1 -1
- package/dist/modes/interactive/interactive-event-controller.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +27 -4
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/secret-menu-controller.d.ts +21 -0
- package/dist/modes/interactive/secret-menu-controller.d.ts.map +1 -0
- package/dist/modes/interactive/secret-menu-controller.js +276 -0
- package/dist/modes/interactive/secret-menu-controller.js.map +1 -0
- package/dist/utils/child-process.js +1 -1
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +2 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +43 -48
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/zip-extractor.d.ts +8 -0
- package/dist/utils/zip-extractor.d.ts.map +1 -0
- package/dist/utils/zip-extractor.js +275 -0
- package/dist/utils/zip-extractor.js.map +1 -0
- package/docs/harness-architecture.md +34 -22
- package/docs/index.md +1 -1
- package/docs/resources.md +1 -1
- package/docs/settings.md +39 -103
- package/docs/usage.md +7 -5
- package/docs/worker-profiles.md +9 -7
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +7 -5
- package/dist/core/secrets/secret-vault-format.d.ts +0 -112
- package/dist/core/secrets/secret-vault-format.d.ts.map +0 -1
- package/dist/core/secrets/secret-vault-format.js +0 -396
- package/dist/core/secrets/secret-vault-format.js.map +0 -1
- package/dist/core/secrets/secret-vault.d.ts +0 -72
- package/dist/core/secrets/secret-vault.d.ts.map +0 -1
- package/dist/core/secrets/secret-vault.js +0 -663
- package/dist/core/secrets/secret-vault.js.map +0 -1
|
@@ -1,38 +1,28 @@
|
|
|
1
1
|
import { type Static, Type } from "typebox";
|
|
2
|
-
import { type
|
|
2
|
+
import { type CredentialManager, type CredentialProfileSummary } from "../secrets/credential-manager.ts";
|
|
3
3
|
declare const secretStoreSchema: Type.TObject<{
|
|
4
|
-
action: Type.TUnion<[Type.TLiteral<"
|
|
4
|
+
action: Type.TUnion<[Type.TLiteral<"status">, Type.TLiteral<"list">, Type.TLiteral<"activate">]>;
|
|
5
5
|
profile: Type.TOptional<Type.TString>;
|
|
6
|
-
description: Type.TOptional<Type.TString>;
|
|
7
|
-
envFile: Type.TOptional<Type.TString>;
|
|
8
|
-
variableNames: Type.TOptional<Type.TArray<Type.TString>>;
|
|
9
|
-
scope: Type.TOptional<Type.TUnion<[Type.TLiteral<"managed">, Type.TLiteral<"workspace">]>>;
|
|
10
6
|
}>;
|
|
11
7
|
export type SecretStoreToolInput = Static<typeof secretStoreSchema>;
|
|
12
|
-
export type SecretStoreStatus = "
|
|
8
|
+
export type SecretStoreStatus = "activated" | "available" | "cancelled" | "error" | "listed" | "unavailable";
|
|
13
9
|
export interface SecretStoreToolDetails {
|
|
14
10
|
action: SecretStoreToolInput["action"];
|
|
15
11
|
status: SecretStoreStatus;
|
|
16
12
|
profile?: string;
|
|
17
13
|
variableNames?: string[];
|
|
18
|
-
profiles?:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
materialized?: boolean;
|
|
14
|
+
profiles?: CredentialProfileSummary[];
|
|
15
|
+
project?: string;
|
|
16
|
+
connected?: boolean;
|
|
22
17
|
code?: string;
|
|
23
18
|
message?: string;
|
|
24
19
|
}
|
|
25
20
|
export interface SecretStoreToolOptions {
|
|
26
|
-
|
|
27
|
-
vault?: SecretVault;
|
|
21
|
+
manager: CredentialManager;
|
|
28
22
|
}
|
|
29
23
|
export declare function createSecretStoreToolDefinition(options: SecretStoreToolOptions): import("../extensions/types.ts").ToolDefinition<Type.TObject<{
|
|
30
|
-
action: Type.TUnion<[Type.TLiteral<"
|
|
24
|
+
action: Type.TUnion<[Type.TLiteral<"status">, Type.TLiteral<"list">, Type.TLiteral<"activate">]>;
|
|
31
25
|
profile: Type.TOptional<Type.TString>;
|
|
32
|
-
description: Type.TOptional<Type.TString>;
|
|
33
|
-
envFile: Type.TOptional<Type.TString>;
|
|
34
|
-
variableNames: Type.TOptional<Type.TArray<Type.TString>>;
|
|
35
|
-
scope: Type.TOptional<Type.TUnion<[Type.TLiteral<"managed">, Type.TLiteral<"workspace">]>>;
|
|
36
26
|
}>, SecretStoreToolDetails, any> & import("../extensions/types.ts").ToolDefinition<any, any, any>;
|
|
37
27
|
export {};
|
|
38
28
|
//# sourceMappingURL=secret-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret-store.d.ts","sourceRoot":"","sources":["../../../src/core/tools/secret-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"secret-store.d.ts","sourceRoot":"","sources":["../../../src/core/tools/secret-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EACN,KAAK,iBAAiB,EAEtB,KAAK,wBAAwB,EAE7B,MAAM,kCAAkC,CAAC;AAO1C,QAAA,MAAM,iBAAiB;;;EAetB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE7G,MAAM,WAAW,sBAAsB;IACtC,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACtC,OAAO,EAAE,iBAAiB,CAAC;CAC3B;AA4ED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,sBAAsB;;;kGAsF9E"}
|
|
@@ -1,355 +1,90 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
|
-
import { ExtensionEditorComponent } from "../../modes/interactive/components/extension-editor.js";
|
|
3
2
|
import { defineTool } from "../extensions/types.js";
|
|
4
|
-
import {
|
|
5
|
-
import { MAX_VARIABLES_PER_PROFILE, SECRET_DESCRIPTION_MAX_CHARS, SECRET_PRINTABLE_METADATA_PATTERN, SECRET_PROFILE_ID_MAX_CHARS, SECRET_PROFILE_ID_PATTERN, SECRET_VARIABLE_NAME_MAX_CHARS, SECRET_VARIABLE_NAME_PATTERN, SecretVault, SecretVaultError, } from "../secrets/secret-vault.js";
|
|
3
|
+
import { CredentialManagerError, CredentialStorageError, } from "../secrets/credential-manager.js";
|
|
6
4
|
import { emptyOrchestrationCall, OrchestrationPanelComponent, } from "./orchestration-panel.js";
|
|
7
5
|
const secretStoreSchema = Type.Object({
|
|
8
|
-
action: Type.Union([
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Type.Literal("materialize"),
|
|
12
|
-
Type.Literal("remove"),
|
|
13
|
-
Type.Literal("lock"),
|
|
14
|
-
], { description: "Credential-management action." }),
|
|
6
|
+
action: Type.Union([Type.Literal("status"), Type.Literal("list"), Type.Literal("activate")], {
|
|
7
|
+
description: "Credential-use action. Credential mutation is owner-only through /secrets.",
|
|
8
|
+
}),
|
|
15
9
|
profile: Type.Optional(Type.String({
|
|
16
10
|
minLength: 1,
|
|
17
|
-
maxLength:
|
|
18
|
-
pattern:
|
|
19
|
-
description: "
|
|
20
|
-
})),
|
|
21
|
-
description: Type.Optional(Type.String({
|
|
22
|
-
minLength: 1,
|
|
23
|
-
maxLength: SECRET_DESCRIPTION_MAX_CHARS,
|
|
24
|
-
pattern: SECRET_PRINTABLE_METADATA_PATTERN,
|
|
25
|
-
description: "Non-secret profile description.",
|
|
26
|
-
})),
|
|
27
|
-
envFile: Type.Optional(Type.String({
|
|
28
|
-
minLength: 1,
|
|
29
|
-
maxLength: 512,
|
|
30
|
-
description: "Relative dotenv location inside the current workspace, such as .env, .env.local, or config/dev.env. Valid only for set.",
|
|
31
|
-
})),
|
|
32
|
-
variableNames: Type.Optional(Type.Array(Type.String({
|
|
33
|
-
minLength: 1,
|
|
34
|
-
maxLength: SECRET_VARIABLE_NAME_MAX_CHARS,
|
|
35
|
-
pattern: SECRET_VARIABLE_NAME_PATTERN,
|
|
36
|
-
}), {
|
|
37
|
-
minItems: 1,
|
|
38
|
-
maxItems: MAX_VARIABLES_PER_PROFILE,
|
|
39
|
-
description: "Specific variable names to remove. Omit to remove the whole profile.",
|
|
40
|
-
})),
|
|
41
|
-
scope: Type.Optional(Type.Union([Type.Literal("managed"), Type.Literal("workspace")], {
|
|
42
|
-
description: "Materialization target. workspace resolves the durable current-project binding; managed writes private Pi state.",
|
|
11
|
+
maxLength: 96,
|
|
12
|
+
pattern: "^[A-Za-z0-9][A-Za-z0-9._-]*$",
|
|
13
|
+
description: "Bound profile to activate. Omit when the project has exactly one bound profile.",
|
|
43
14
|
})),
|
|
44
15
|
}, { additionalProperties: false });
|
|
45
16
|
function result(details, text) {
|
|
46
17
|
return { content: [{ type: "text", text }], details };
|
|
47
18
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
19
|
+
function invalid(input) {
|
|
20
|
+
if (input.action !== "activate" && input.profile !== undefined) {
|
|
21
|
+
return result({
|
|
22
|
+
action: input.action,
|
|
23
|
+
status: "error",
|
|
24
|
+
code: "unexpected_profile",
|
|
25
|
+
message: `Action ${input.action} does not accept a profile.`,
|
|
26
|
+
}, `Secret store request is invalid: action ${input.action} does not accept a profile.`);
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
55
29
|
}
|
|
56
|
-
function
|
|
57
|
-
|
|
30
|
+
function failed(input, error) {
|
|
31
|
+
const known = error instanceof CredentialManagerError || error instanceof CredentialStorageError;
|
|
32
|
+
const code = known ? error.code : "safe_failure";
|
|
33
|
+
const message = known ? error.message : "Credential activation failed safely without exposing values.";
|
|
34
|
+
const status = ["owner_setup_required", "not_connected", "provider_unavailable"].includes(code)
|
|
35
|
+
? "unavailable"
|
|
36
|
+
: "error";
|
|
37
|
+
return result({
|
|
38
|
+
action: input.action,
|
|
39
|
+
status,
|
|
40
|
+
...(input.profile ? { profile: input.profile } : {}),
|
|
41
|
+
code,
|
|
42
|
+
message,
|
|
43
|
+
}, `Credential action failed: ${message}`);
|
|
58
44
|
}
|
|
59
45
|
function panelModel(details, expanded) {
|
|
60
46
|
if (!details)
|
|
61
|
-
return { label: "secrets", status: "error", emptyText: "No
|
|
62
|
-
const success = ["
|
|
63
|
-
const rows = expanded
|
|
64
|
-
? (details.profiles ?? []).map((profile) => ({
|
|
65
|
-
status: "info",
|
|
66
|
-
label: profile.profile,
|
|
67
|
-
meta: [
|
|
68
|
-
`${profile.variableNames.length} variable${profile.variableNames.length === 1 ? "" : "s"}`,
|
|
69
|
-
`${profile.bindings.length} binding${profile.bindings.length === 1 ? "" : "s"}`,
|
|
70
|
-
],
|
|
71
|
-
details: [
|
|
72
|
-
...(profile.description ? [profile.description] : []),
|
|
73
|
-
...profile.bindings.map((binding) => `${binding.envFile} · ${binding.workspace}`),
|
|
74
|
-
],
|
|
75
|
-
}))
|
|
76
|
-
: undefined;
|
|
47
|
+
return { label: "secrets", status: "error", emptyText: "No credential result was retained." };
|
|
48
|
+
const success = ["activated", "available", "listed"].includes(details.status);
|
|
77
49
|
return {
|
|
78
50
|
label: "secrets",
|
|
79
51
|
action: details.status,
|
|
80
52
|
status: success ? "success" : details.status === "cancelled" ? "warning" : "error",
|
|
81
53
|
summary: [
|
|
82
54
|
details.profile,
|
|
83
|
-
details.
|
|
84
|
-
details.scope,
|
|
55
|
+
details.project,
|
|
85
56
|
details.variableNames
|
|
86
57
|
? `${details.variableNames.length} variable${details.variableNames.length === 1 ? "" : "s"}`
|
|
87
58
|
: undefined,
|
|
88
59
|
details.profiles ? `${details.profiles.length} profile${details.profiles.length === 1 ? "" : "s"}` : undefined,
|
|
89
60
|
].filter((value) => value !== undefined),
|
|
90
|
-
rows
|
|
61
|
+
rows: expanded
|
|
62
|
+
? details.profiles?.map((profile) => ({
|
|
63
|
+
status: profile.boundToCurrentProject ? "succeeded" : "info",
|
|
64
|
+
label: profile.profile,
|
|
65
|
+
meta: [
|
|
66
|
+
`${profile.variableNames.length} variable${profile.variableNames.length === 1 ? "" : "s"}`,
|
|
67
|
+
profile.boundToCurrentProject ? "bound here" : "not bound here",
|
|
68
|
+
],
|
|
69
|
+
details: profile.description ? [profile.description] : undefined,
|
|
70
|
+
}))
|
|
71
|
+
: undefined,
|
|
91
72
|
notices: expanded && details.message ? [{ status: success ? "info" : "error", text: details.message }] : undefined,
|
|
92
73
|
};
|
|
93
74
|
}
|
|
94
|
-
async function ensureUnlocked(vault, action, ctx, signal, profile) {
|
|
95
|
-
if (vault.isUnlocked)
|
|
96
|
-
return undefined;
|
|
97
|
-
if (await vault.exists()) {
|
|
98
|
-
while (!signal?.aborted) {
|
|
99
|
-
let passphrase = await ctx.ui.input("Unlock secret vault", "Master passphrase", {
|
|
100
|
-
signal,
|
|
101
|
-
sensitive: true,
|
|
102
|
-
});
|
|
103
|
-
if (passphrase === undefined || signal?.aborted)
|
|
104
|
-
return cancelled(action, profile);
|
|
105
|
-
try {
|
|
106
|
-
await vault.unlock(passphrase);
|
|
107
|
-
return undefined;
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
if (error instanceof SecretVaultError && ["invalid_passphrase", "unlock_failed"].includes(error.code)) {
|
|
111
|
-
ctx.ui.notify(error.message, "error");
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
return failed(action, error, profile);
|
|
115
|
-
}
|
|
116
|
-
finally {
|
|
117
|
-
passphrase = "";
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return cancelled(action, profile);
|
|
121
|
-
}
|
|
122
|
-
while (!signal?.aborted) {
|
|
123
|
-
let passphrase = await ctx.ui.input("Create secret vault", "New master passphrase", { signal, sensitive: true });
|
|
124
|
-
if (passphrase === undefined || signal?.aborted)
|
|
125
|
-
return cancelled(action, profile);
|
|
126
|
-
let confirmation = await ctx.ui.input("Confirm secret vault", "Repeat master passphrase", {
|
|
127
|
-
signal,
|
|
128
|
-
sensitive: true,
|
|
129
|
-
});
|
|
130
|
-
if (confirmation === undefined || signal?.aborted) {
|
|
131
|
-
passphrase = "";
|
|
132
|
-
return cancelled(action, profile);
|
|
133
|
-
}
|
|
134
|
-
try {
|
|
135
|
-
if (passphrase !== confirmation) {
|
|
136
|
-
ctx.ui.notify("The two master passphrases do not match.", "error");
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
await vault.initialize(passphrase);
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
catch (error) {
|
|
143
|
-
if (error instanceof SecretVaultError && error.code === "invalid_passphrase") {
|
|
144
|
-
ctx.ui.notify(error.message, "error");
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
return failed(action, error, profile);
|
|
148
|
-
}
|
|
149
|
-
finally {
|
|
150
|
-
passphrase = "";
|
|
151
|
-
confirmation = "";
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return cancelled(action, profile);
|
|
155
|
-
}
|
|
156
|
-
function validateInput(input) {
|
|
157
|
-
if (input.action === "lock" || input.action === "list") {
|
|
158
|
-
if (input.profile !== undefined ||
|
|
159
|
-
input.description !== undefined ||
|
|
160
|
-
input.envFile !== undefined ||
|
|
161
|
-
input.variableNames !== undefined ||
|
|
162
|
-
input.scope !== undefined) {
|
|
163
|
-
return invalid(input.action, "unexpected_fields", `Action ${input.action} does not accept profile fields.`);
|
|
164
|
-
}
|
|
165
|
-
return undefined;
|
|
166
|
-
}
|
|
167
|
-
if (input.action === "set" && !input.profile) {
|
|
168
|
-
return invalid(input.action, "profile_required", "Action set requires a profile.");
|
|
169
|
-
}
|
|
170
|
-
if (input.action === "remove" && !input.profile) {
|
|
171
|
-
return invalid(input.action, "profile_required", "Action remove requires a profile.");
|
|
172
|
-
}
|
|
173
|
-
if (input.action !== "set" && (input.description !== undefined || input.envFile !== undefined)) {
|
|
174
|
-
return invalid(input.action, "unexpected_profile_fields", "description and envFile are valid only for set.", input.profile);
|
|
175
|
-
}
|
|
176
|
-
if (input.action !== "remove" && input.variableNames !== undefined) {
|
|
177
|
-
return invalid(input.action, "unexpected_variable_names", "variableNames is valid only for remove.", input.profile);
|
|
178
|
-
}
|
|
179
|
-
if (input.action !== "materialize" && input.scope !== undefined) {
|
|
180
|
-
return invalid(input.action, "unexpected_scope", "scope is valid only for materialize.", input.profile);
|
|
181
|
-
}
|
|
182
|
-
if (input.variableNames && new Set(input.variableNames).size !== input.variableNames.length) {
|
|
183
|
-
return invalid(input.action, "duplicate_variables", "Variable names must be unique.", input.profile);
|
|
184
|
-
}
|
|
185
|
-
return undefined;
|
|
186
|
-
}
|
|
187
|
-
async function openPrivateDotenvEditor(ctx, title, prefill, signal) {
|
|
188
|
-
if (signal?.aborted)
|
|
189
|
-
return undefined;
|
|
190
|
-
try {
|
|
191
|
-
return await ctx.ui.custom((tui, _theme, keybindings, done) => new ExtensionEditorComponent(tui, keybindings, title, prefill, (value) => done(value), () => done(undefined), {
|
|
192
|
-
privateContent: true,
|
|
193
|
-
allowExternalEditor: false,
|
|
194
|
-
signal,
|
|
195
|
-
notice: "Private plaintext editor · content stays local and never enters model context",
|
|
196
|
-
}));
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
if (signal?.aborted)
|
|
200
|
-
return undefined;
|
|
201
|
-
throw error;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
async function captureValidDotenv(ctx, title, prefill, signal) {
|
|
205
|
-
let draft = prefill;
|
|
206
|
-
while (!signal?.aborted) {
|
|
207
|
-
const edited = await openPrivateDotenvEditor(ctx, title, draft, signal);
|
|
208
|
-
if (edited === undefined || signal?.aborted)
|
|
209
|
-
return undefined;
|
|
210
|
-
try {
|
|
211
|
-
const parsed = parseDotenvDocument(edited);
|
|
212
|
-
const variableNames = parsed.variables.map((variable) => variable.name);
|
|
213
|
-
for (const variable of parsed.variables)
|
|
214
|
-
variable.value = "";
|
|
215
|
-
draft = "";
|
|
216
|
-
return { document: parsed.document, variableNames };
|
|
217
|
-
}
|
|
218
|
-
catch (error) {
|
|
219
|
-
ctx.ui.notify(error instanceof SecretDotenvError ? error.message : "The dotenv document is invalid.", "error");
|
|
220
|
-
draft = edited;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
return undefined;
|
|
224
|
-
}
|
|
225
|
-
async function executeSet(vault, input, ctx, signal) {
|
|
226
|
-
let document = "";
|
|
227
|
-
let originalUnmanagedContent;
|
|
228
|
-
try {
|
|
229
|
-
const target = vault.resolveBindingTarget(ctx.cwd, input.envFile ?? ".env");
|
|
230
|
-
const destinationState = await vault.inspectEnvDestination(target.destination, input.profile);
|
|
231
|
-
if (destinationState === "managed-other") {
|
|
232
|
-
return invalid(input.action, "destination_conflict", "The selected dotenv location is already managed by another profile.", input.profile);
|
|
233
|
-
}
|
|
234
|
-
const storedDocument = await vault.getProfileDocument(input.profile);
|
|
235
|
-
let prefill = storedDocument ?? "";
|
|
236
|
-
if (destinationState === "unmanaged") {
|
|
237
|
-
originalUnmanagedContent = await vault.readOwnerDotenv(target.destination);
|
|
238
|
-
prefill = originalUnmanagedContent;
|
|
239
|
-
}
|
|
240
|
-
if (destinationState === "managed-profile" && storedDocument === undefined) {
|
|
241
|
-
return invalid(input.action, "profile_missing", "The dotenv target claims this profile, but the encrypted profile is missing.", input.profile);
|
|
242
|
-
}
|
|
243
|
-
const captured = await captureValidDotenv(ctx, `Secrets · ${input.profile} → ${target.destination}`, prefill, signal);
|
|
244
|
-
prefill = "";
|
|
245
|
-
if (!captured)
|
|
246
|
-
return cancelled(input.action, input.profile);
|
|
247
|
-
document = captured.document;
|
|
248
|
-
await vault.replaceProfileDocument(input.profile, input.description, document, {
|
|
249
|
-
workspace: target.workspace,
|
|
250
|
-
envFile: target.envFile,
|
|
251
|
-
});
|
|
252
|
-
try {
|
|
253
|
-
await vault.materializeEnv(input.profile, target.destination, {
|
|
254
|
-
allowReplaceUnmanaged: destinationState === "unmanaged",
|
|
255
|
-
expectedUnmanagedContent: originalUnmanagedContent,
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
catch (error) {
|
|
259
|
-
const message = error instanceof SecretVaultError ? error.message : "Dotenv materialization failed safely.";
|
|
260
|
-
ctx.ui.notify(`Profile stored, but ${target.destination} was not refreshed: ${message}`, "warning");
|
|
261
|
-
return result({
|
|
262
|
-
action: input.action,
|
|
263
|
-
status: "stored",
|
|
264
|
-
profile: input.profile,
|
|
265
|
-
envFile: target.envFile,
|
|
266
|
-
variableNames: captured.variableNames,
|
|
267
|
-
materialized: false,
|
|
268
|
-
code: "materialization_failed",
|
|
269
|
-
message,
|
|
270
|
-
}, `Stored profile ${input.profile}, but its bound dotenv could not be refreshed. Retry secret_store materialize; no values were exposed.`);
|
|
271
|
-
}
|
|
272
|
-
ctx.ui.notify(`Credential profile ${input.profile} stored and activated at ${target.destination}`, "info");
|
|
273
|
-
return result({
|
|
274
|
-
action: input.action,
|
|
275
|
-
status: "stored",
|
|
276
|
-
profile: input.profile,
|
|
277
|
-
envFile: target.envFile,
|
|
278
|
-
variableNames: captured.variableNames,
|
|
279
|
-
materialized: true,
|
|
280
|
-
}, `Stored and activated ${captured.variableNames.length} variables for profile ${input.profile} at its bound workspace dotenv location. Values never entered model context.`);
|
|
281
|
-
}
|
|
282
|
-
catch (error) {
|
|
283
|
-
return failed(input.action, error, input.profile);
|
|
284
|
-
}
|
|
285
|
-
finally {
|
|
286
|
-
document = "";
|
|
287
|
-
originalUnmanagedContent = undefined;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
async function executeMaterialize(vault, input, ctx) {
|
|
291
|
-
try {
|
|
292
|
-
const scope = input.scope ?? "workspace";
|
|
293
|
-
const binding = await vault.resolveBindingForWorkspace(ctx.cwd, input.profile);
|
|
294
|
-
const destination = scope === "managed" ? vault.getManagedEnvPath(binding.profile) : binding.destination;
|
|
295
|
-
const destinationState = await vault.inspectEnvDestination(destination, binding.profile);
|
|
296
|
-
if (destinationState === "unmanaged" || destinationState === "managed-other") {
|
|
297
|
-
return invalid(input.action, "destination_conflict", "The bound dotenv location is no longer safely managed. Use set to review it in the private editor.", binding.profile);
|
|
298
|
-
}
|
|
299
|
-
const materialized = await vault.materializeEnv(binding.profile, destination, {
|
|
300
|
-
activationWorkspace: ctx.cwd,
|
|
301
|
-
managed: scope === "managed",
|
|
302
|
-
});
|
|
303
|
-
ctx.ui.notify(`Credential profile ${binding.profile} activated at ${destination}`, "info");
|
|
304
|
-
return result({
|
|
305
|
-
action: input.action,
|
|
306
|
-
status: "materialized",
|
|
307
|
-
profile: binding.profile,
|
|
308
|
-
variableNames: materialized.variableNames,
|
|
309
|
-
scope,
|
|
310
|
-
envFile: scope === "workspace" ? binding.envFile : undefined,
|
|
311
|
-
materialized: true,
|
|
312
|
-
}, `Activated profile ${binding.profile} for the current workspace. Its dotenv and process environment are available without exposing values to the model.`);
|
|
313
|
-
}
|
|
314
|
-
catch (error) {
|
|
315
|
-
return failed(input.action, error, input.profile);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
async function executeRemove(vault, input, ctx, signal) {
|
|
319
|
-
const target = input.variableNames?.length
|
|
320
|
-
? `${input.variableNames.join(", ")} from profile ${input.profile}`
|
|
321
|
-
: `the entire profile ${input.profile}`;
|
|
322
|
-
const approved = await ctx.ui.confirm("Remove stored secrets", `Remove ${target}? Pi-managed workspace and private dotenv copies are invalidated.`, { signal });
|
|
323
|
-
if (!approved || signal?.aborted)
|
|
324
|
-
return cancelled(input.action, input.profile);
|
|
325
|
-
try {
|
|
326
|
-
const removal = await vault.removeProfile(input.profile, input.variableNames);
|
|
327
|
-
return result({
|
|
328
|
-
action: input.action,
|
|
329
|
-
status: "removed",
|
|
330
|
-
profile: input.profile,
|
|
331
|
-
variableNames: removal.removedVariableNames,
|
|
332
|
-
}, `Removed ${removal.removedVariableNames.length} secret variable${removal.removedVariableNames.length === 1 ? "" : "s"} from profile ${input.profile}.`);
|
|
333
|
-
}
|
|
334
|
-
catch (error) {
|
|
335
|
-
return failed(input.action, error, input.profile);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
75
|
export function createSecretStoreToolDefinition(options) {
|
|
339
|
-
const
|
|
340
|
-
if (!vault)
|
|
341
|
-
throw new Error("secret_store requires an agentDir or SecretVault");
|
|
76
|
+
const { manager } = options;
|
|
342
77
|
return defineTool({
|
|
343
78
|
name: "secret_store",
|
|
344
79
|
label: "Secret Store",
|
|
345
|
-
description: "
|
|
346
|
-
promptSnippet: "
|
|
80
|
+
description: "Discover and activate owner-authorized Bitwarden credential profiles for the current project without exposing values.",
|
|
81
|
+
promptSnippet: "Activate project credentials with secret_store before credential-dependent commands. Credential setup and mutation are owner-only through /secrets.",
|
|
347
82
|
promptGuidelines: [
|
|
348
|
-
"Use secret_store
|
|
349
|
-
"
|
|
350
|
-
"
|
|
351
|
-
"After activation, run the consuming
|
|
352
|
-
"
|
|
83
|
+
"Use secret_store activate before credential-dependent work. It works in TUI, print, and RPC modes and returns metadata only.",
|
|
84
|
+
"Omit profile when the project has one binding. Use list to select among multiple authorized profiles.",
|
|
85
|
+
"Never ask the owner to paste a credential into chat or pass a value through tool arguments.",
|
|
86
|
+
"After activation, run the consuming command normally. Never print, inspect, grep, or echo credential environment values.",
|
|
87
|
+
"If owner_setup_required is returned, tell the owner to run /secrets in a TUI session. Do not repeatedly retry.",
|
|
353
88
|
],
|
|
354
89
|
parameters: secretStoreSchema,
|
|
355
90
|
executionMode: "sequential",
|
|
@@ -361,50 +96,50 @@ export function createSecretStoreToolDefinition(options) {
|
|
|
361
96
|
if (isPartial) {
|
|
362
97
|
return new OrchestrationPanelComponent(theme, {
|
|
363
98
|
label: "secrets",
|
|
364
|
-
action: "
|
|
99
|
+
action: "activating",
|
|
365
100
|
status: "running",
|
|
366
101
|
});
|
|
367
102
|
}
|
|
368
103
|
return new OrchestrationPanelComponent(theme, panelModel(toolResult.details, expanded), expanded);
|
|
369
104
|
},
|
|
370
105
|
async execute(_toolCallId, input, signal, _onUpdate, ctx) {
|
|
371
|
-
if (
|
|
372
|
-
return result({
|
|
373
|
-
action: input.action,
|
|
374
|
-
status: "unavailable",
|
|
375
|
-
...(input.profile ? { profile: input.profile } : {}),
|
|
376
|
-
code: "user_tui_required",
|
|
377
|
-
message: "Secret values can be captured only in a user-visible TUI session.",
|
|
378
|
-
}, "secret_store requires a user-visible TUI session.");
|
|
106
|
+
if (signal?.aborted) {
|
|
107
|
+
return result({ action: input.action, status: "cancelled", code: "cancelled" }, "Credential action cancelled.");
|
|
379
108
|
}
|
|
380
|
-
|
|
381
|
-
return cancelled(input.action, input.profile);
|
|
382
|
-
const validation = validateInput(input);
|
|
109
|
+
const validation = invalid(input);
|
|
383
110
|
if (validation)
|
|
384
111
|
return validation;
|
|
385
|
-
if (input.action === "lock") {
|
|
386
|
-
vault.lock();
|
|
387
|
-
return result({ action: input.action, status: "locked" }, "Secret vault locked; cached key, credential environment, and exact-value redaction cache were cleared.");
|
|
388
|
-
}
|
|
389
112
|
try {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
113
|
+
if (input.action === "status") {
|
|
114
|
+
const status = manager.status;
|
|
115
|
+
if (!status.sessionAvailable) {
|
|
116
|
+
return result({
|
|
117
|
+
action: input.action,
|
|
118
|
+
status: "unavailable",
|
|
119
|
+
connected: false,
|
|
120
|
+
code: "owner_setup_required",
|
|
121
|
+
message: "The owner must connect Bitwarden with /secrets.",
|
|
122
|
+
}, "Bitwarden owner setup is required. Run /secrets in a TUI session.");
|
|
123
|
+
}
|
|
124
|
+
return result({ action: input.action, status: "available", connected: status.connected }, status.connected
|
|
125
|
+
? "Bitwarden is connected for this Pi session."
|
|
126
|
+
: "A Bitwarden session key is available and will be validated on activation.");
|
|
396
127
|
}
|
|
397
|
-
if (input.action === "
|
|
398
|
-
|
|
128
|
+
if (input.action === "list") {
|
|
129
|
+
const profiles = await manager.listForProject(ctx.cwd, signal);
|
|
130
|
+
return result({ action: input.action, status: "listed", profiles }, `Found ${profiles.length} credential profile${profiles.length === 1 ? "" : "s"}; only metadata was returned.`);
|
|
399
131
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
132
|
+
const activated = await manager.activateForProject(ctx.cwd, input.profile, signal);
|
|
133
|
+
return result({
|
|
134
|
+
action: input.action,
|
|
135
|
+
status: "activated",
|
|
136
|
+
profile: activated.profile,
|
|
137
|
+
variableNames: activated.variableNames,
|
|
138
|
+
project: activated.project,
|
|
139
|
+
}, `Activated ${activated.profile} for ${activated.project}. Credential values remain hidden.`);
|
|
405
140
|
}
|
|
406
141
|
catch (error) {
|
|
407
|
-
return failed(input
|
|
142
|
+
return failed(input, error);
|
|
408
143
|
}
|
|
409
144
|
},
|
|
410
145
|
});
|