@caupulican/pi-adaptative 0.81.39 → 0.81.41
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 +77 -0
- package/README.md +2 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts +2 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js +3 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/dispatch-grant.ts +4 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts +9 -0
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.d.ts.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js +290 -107
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.js.map +1 -1
- package/dist/bundled-resources/extensions/tmux-agent-manager/index.ts +357 -122
- package/dist/bundled-resources/skills/tool-call-repair/references/repair-catalogue.md +2 -2
- package/dist/cli/args.d.ts +4 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +31 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-directory-layout.d.ts +15 -0
- package/dist/core/agent-directory-layout.d.ts.map +1 -0
- package/dist/core/agent-directory-layout.js +72 -0
- package/dist/core/agent-directory-layout.js.map +1 -0
- package/dist/core/agent-paths.d.ts +25 -2
- package/dist/core/agent-paths.d.ts.map +1 -1
- package/dist/core/agent-paths.js +79 -4
- package/dist/core/agent-paths.js.map +1 -1
- package/dist/core/agent-session-contracts.d.ts +293 -0
- package/dist/core/agent-session-contracts.d.ts.map +1 -0
- package/dist/core/agent-session-contracts.js +26 -0
- package/dist/core/agent-session-contracts.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +52 -8
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +400 -79
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +74 -518
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +370 -1432
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +3 -1
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/autonomy/approval-gate.d.ts +3 -2
- package/dist/core/autonomy/approval-gate.d.ts.map +1 -1
- package/dist/core/autonomy/approval-gate.js +6 -28
- package/dist/core/autonomy/approval-gate.js.map +1 -1
- package/dist/core/autonomy/bounded-completion.d.ts +1 -1
- package/dist/core/autonomy/bounded-completion.d.ts.map +1 -1
- package/dist/core/autonomy/bounded-completion.js +1 -1
- package/dist/core/autonomy/bounded-completion.js.map +1 -1
- package/dist/core/autonomy/contracts.d.ts +20 -12
- package/dist/core/autonomy/contracts.d.ts.map +1 -1
- package/dist/core/autonomy/contracts.js.map +1 -1
- package/dist/core/autonomy/foreground-envelope.d.ts +8 -2
- package/dist/core/autonomy/foreground-envelope.d.ts.map +1 -1
- package/dist/core/autonomy/foreground-envelope.js +8 -25
- package/dist/core/autonomy/foreground-envelope.js.map +1 -1
- package/dist/core/autonomy/gates.d.ts.map +1 -1
- package/dist/core/autonomy/gates.js +8 -10
- package/dist/core/autonomy/gates.js.map +1 -1
- package/dist/core/autonomy/lane-private-paths.d.ts +2 -0
- package/dist/core/autonomy/lane-private-paths.d.ts.map +1 -0
- package/dist/core/autonomy/lane-private-paths.js +16 -0
- package/dist/core/autonomy/lane-private-paths.js.map +1 -0
- package/dist/core/autonomy/lane-tool-surface.d.ts +10 -0
- package/dist/core/autonomy/lane-tool-surface.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tool-surface.js +48 -9
- package/dist/core/autonomy/lane-tool-surface.js.map +1 -1
- package/dist/core/autonomy/lane-tracker.d.ts +14 -0
- package/dist/core/autonomy/lane-tracker.d.ts.map +1 -1
- package/dist/core/autonomy/lane-tracker.js +38 -0
- package/dist/core/autonomy/lane-tracker.js.map +1 -1
- package/dist/core/autonomy/risk-assessment.d.ts +1 -2
- package/dist/core/autonomy/risk-assessment.d.ts.map +1 -1
- package/dist/core/autonomy/risk-assessment.js +1 -123
- package/dist/core/autonomy/risk-assessment.js.map +1 -1
- package/dist/core/autonomy/session-lane-record.d.ts +4 -4
- package/dist/core/autonomy/session-lane-record.d.ts.map +1 -1
- package/dist/core/autonomy/session-lane-record.js +16 -29
- package/dist/core/autonomy/session-lane-record.js.map +1 -1
- package/dist/core/autonomy/telemetry-events.d.ts +1 -1
- package/dist/core/autonomy/telemetry-events.d.ts.map +1 -1
- package/dist/core/autonomy/telemetry-events.js +1 -1
- package/dist/core/autonomy/telemetry-events.js.map +1 -1
- package/dist/core/autonomy-telemetry.d.ts +7 -7
- package/dist/core/autonomy-telemetry.d.ts.map +1 -1
- package/dist/core/autonomy-telemetry.js +9 -9
- package/dist/core/autonomy-telemetry.js.map +1 -1
- package/dist/core/background-lane-controller.d.ts +56 -236
- package/dist/core/background-lane-controller.d.ts.map +1 -1
- package/dist/core/background-lane-controller.js +141 -1273
- package/dist/core/background-lane-controller.js.map +1 -1
- package/dist/core/bedrock-sso-login.d.ts +16 -0
- package/dist/core/bedrock-sso-login.d.ts.map +1 -0
- package/dist/core/bedrock-sso-login.js +98 -0
- package/dist/core/bedrock-sso-login.js.map +1 -0
- package/dist/core/capability-contract.d.ts +4 -0
- package/dist/core/capability-contract.d.ts.map +1 -0
- package/dist/core/capability-contract.js +28 -0
- package/dist/core/capability-contract.js.map +1 -0
- package/dist/core/compaction-controller.d.ts +90 -0
- package/dist/core/compaction-controller.d.ts.map +1 -0
- package/dist/core/compaction-controller.js +452 -0
- package/dist/core/compaction-controller.js.map +1 -0
- package/dist/core/compaction-support.d.ts +13 -17
- package/dist/core/compaction-support.d.ts.map +1 -1
- package/dist/core/compaction-support.js +3 -3
- package/dist/core/compaction-support.js.map +1 -1
- package/dist/core/context/context-artifacts.d.ts +6 -2
- package/dist/core/context/context-artifacts.d.ts.map +1 -1
- package/dist/core/context/context-artifacts.js +34 -2
- package/dist/core/context/context-artifacts.js.map +1 -1
- package/dist/core/context/context-store-retention.d.ts +8 -2
- package/dist/core/context/context-store-retention.d.ts.map +1 -1
- package/dist/core/context/context-store-retention.js +158 -35
- package/dist/core/context/context-store-retention.js.map +1 -1
- package/dist/core/context/okf-memory.d.ts.map +1 -1
- package/dist/core/context/okf-memory.js +9 -11
- package/dist/core/context/okf-memory.js.map +1 -1
- package/dist/core/context/sqlite-runtime-index.d.ts.map +1 -1
- package/dist/core/context/sqlite-runtime-index.js +6 -8
- package/dist/core/context/sqlite-runtime-index.js.map +1 -1
- package/dist/core/context-gc.d.ts +3 -0
- package/dist/core/context-gc.d.ts.map +1 -1
- package/dist/core/context-gc.js +10 -5
- package/dist/core/context-gc.js.map +1 -1
- package/dist/core/context-pipeline.d.ts +1 -1
- package/dist/core/context-pipeline.d.ts.map +1 -1
- package/dist/core/context-pipeline.js +16 -37
- package/dist/core/context-pipeline.js.map +1 -1
- package/dist/core/cost/cost-summary.d.ts.map +1 -1
- package/dist/core/cost/cost-summary.js +5 -3
- package/dist/core/cost/cost-summary.js.map +1 -1
- package/dist/core/cost/daily-usage.d.ts.map +1 -1
- package/dist/core/cost/daily-usage.js +4 -5
- package/dist/core/cost/daily-usage.js.map +1 -1
- package/dist/core/default-tool-surface.d.ts.map +1 -1
- package/dist/core/default-tool-surface.js +2 -0
- package/dist/core/default-tool-surface.js.map +1 -1
- package/dist/core/delegation/managed-lane-controller.d.ts +34 -0
- package/dist/core/delegation/managed-lane-controller.d.ts.map +1 -0
- package/dist/core/delegation/managed-lane-controller.js +217 -0
- package/dist/core/delegation/managed-lane-controller.js.map +1 -0
- package/dist/core/delegation/session-worker-claim.d.ts +44 -0
- package/dist/core/delegation/session-worker-claim.d.ts.map +1 -0
- package/dist/core/delegation/session-worker-claim.js +98 -0
- package/dist/core/delegation/session-worker-claim.js.map +1 -0
- package/dist/core/delegation/worker-actions.d.ts +7 -5
- package/dist/core/delegation/worker-actions.d.ts.map +1 -1
- package/dist/core/delegation/worker-actions.js +20 -4
- package/dist/core/delegation/worker-actions.js.map +1 -1
- package/dist/core/delegation/{worker-result.d.ts → worker-claim.d.ts} +13 -13
- package/dist/core/delegation/worker-claim.d.ts.map +1 -0
- package/dist/core/delegation/{worker-result.js → worker-claim.js} +61 -51
- package/dist/core/delegation/worker-claim.js.map +1 -0
- package/dist/core/delegation/worker-delegation-controller.d.ts +110 -0
- package/dist/core/delegation/worker-delegation-controller.d.ts.map +1 -0
- package/dist/core/delegation/worker-delegation-controller.js +861 -0
- package/dist/core/delegation/worker-delegation-controller.js.map +1 -0
- package/dist/core/delegation/worker-delegation-request.d.ts +11 -0
- package/dist/core/delegation/worker-delegation-request.d.ts.map +1 -0
- package/dist/core/delegation/worker-delegation-request.js +2 -0
- package/dist/core/delegation/worker-delegation-request.js.map +1 -0
- package/dist/core/delegation/worker-dispatch-scheduler.d.ts +40 -0
- package/dist/core/delegation/worker-dispatch-scheduler.d.ts.map +1 -0
- package/dist/core/delegation/worker-dispatch-scheduler.js +93 -0
- package/dist/core/delegation/worker-dispatch-scheduler.js.map +1 -0
- package/dist/core/delegation/worker-execution-policy.d.ts +62 -0
- package/dist/core/delegation/worker-execution-policy.d.ts.map +1 -0
- package/dist/core/delegation/worker-execution-policy.js +160 -0
- package/dist/core/delegation/worker-execution-policy.js.map +1 -0
- package/dist/core/delegation/worker-lane-projection.d.ts +14 -0
- package/dist/core/delegation/worker-lane-projection.d.ts.map +1 -0
- package/dist/core/delegation/worker-lane-projection.js +100 -0
- package/dist/core/delegation/worker-lane-projection.js.map +1 -0
- package/dist/core/delegation/worker-lifecycle.d.ts +97 -0
- package/dist/core/delegation/worker-lifecycle.d.ts.map +1 -0
- package/dist/core/delegation/worker-lifecycle.js +339 -0
- package/dist/core/delegation/worker-lifecycle.js.map +1 -0
- package/dist/core/delegation/worker-notification-coordinator.d.ts +36 -0
- package/dist/core/delegation/worker-notification-coordinator.d.ts.map +1 -0
- package/dist/core/delegation/worker-notification-coordinator.js +90 -0
- package/dist/core/delegation/worker-notification-coordinator.js.map +1 -0
- package/dist/core/delegation/worker-profile-resolver.d.ts +55 -0
- package/dist/core/delegation/worker-profile-resolver.d.ts.map +1 -0
- package/dist/core/delegation/worker-profile-resolver.js +113 -0
- package/dist/core/delegation/worker-profile-resolver.js.map +1 -0
- package/dist/core/delegation/worker-runner.d.ts +25 -14
- package/dist/core/delegation/worker-runner.d.ts.map +1 -1
- package/dist/core/delegation/worker-runner.js +122 -53
- package/dist/core/delegation/worker-runner.js.map +1 -1
- package/dist/core/delegation/worker-task-label.d.ts +3 -0
- package/dist/core/delegation/worker-task-label.d.ts.map +1 -0
- package/dist/core/delegation/worker-task-label.js +11 -0
- package/dist/core/delegation/worker-task-label.js.map +1 -0
- package/dist/core/doctor.d.ts +8 -0
- package/dist/core/doctor.d.ts.map +1 -1
- package/dist/core/doctor.js +32 -1
- package/dist/core/doctor.js.map +1 -1
- package/dist/core/extension-import-authority.d.ts +6 -0
- package/dist/core/extension-import-authority.d.ts.map +1 -0
- package/dist/core/extension-import-authority.js +10 -0
- package/dist/core/extension-import-authority.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.map +1 -1
- package/dist/core/extensions/loader.d.ts +5 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +52 -18
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +3 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +20 -5
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/stale-context.d.ts +2 -0
- package/dist/core/extensions/stale-context.d.ts.map +1 -0
- package/dist/core/extensions/stale-context.js +2 -0
- package/dist/core/extensions/stale-context.js.map +1 -0
- package/dist/core/extensions/storage.d.ts +8 -0
- package/dist/core/extensions/storage.d.ts.map +1 -0
- package/dist/core/extensions/storage.js +28 -0
- package/dist/core/extensions/storage.js.map +1 -0
- package/dist/core/extensions/types.d.ts +78 -21
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/failure-corpus.d.ts +1 -15
- package/dist/core/failure-corpus.d.ts.map +1 -1
- package/dist/core/failure-corpus.js +9 -37
- package/dist/core/failure-corpus.js.map +1 -1
- package/dist/core/foreground-recovery-controller.d.ts +53 -0
- package/dist/core/foreground-recovery-controller.d.ts.map +1 -0
- package/dist/core/foreground-recovery-controller.js +111 -0
- package/dist/core/foreground-recovery-controller.js.map +1 -0
- package/dist/core/gateways/channel-provider.d.ts +3 -0
- package/dist/core/gateways/channel-provider.d.ts.map +1 -1
- package/dist/core/gateways/channel-provider.js +31 -6
- package/dist/core/gateways/channel-provider.js.map +1 -1
- package/dist/core/goal-loop-controller.d.ts +14 -9
- package/dist/core/goal-loop-controller.d.ts.map +1 -1
- package/dist/core/goal-loop-controller.js +47 -75
- package/dist/core/goal-loop-controller.js.map +1 -1
- package/dist/core/goals/compact-goal-context.d.ts +11 -0
- package/dist/core/goals/compact-goal-context.d.ts.map +1 -0
- package/dist/core/goals/compact-goal-context.js +59 -0
- package/dist/core/goals/compact-goal-context.js.map +1 -0
- package/dist/core/goals/goal-acceptance.d.ts +11 -0
- package/dist/core/goals/goal-acceptance.d.ts.map +1 -0
- package/dist/core/goals/goal-acceptance.js +27 -0
- package/dist/core/goals/goal-acceptance.js.map +1 -0
- package/dist/core/goals/goal-auto-continue-controller.d.ts +28 -0
- package/dist/core/goals/goal-auto-continue-controller.d.ts.map +1 -0
- package/dist/core/goals/goal-auto-continue-controller.js +90 -0
- package/dist/core/goals/goal-auto-continue-controller.js.map +1 -0
- package/dist/core/goals/goal-continuation-controller.d.ts +2 -2
- package/dist/core/goals/goal-continuation-controller.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-controller.js +52 -11
- package/dist/core/goals/goal-continuation-controller.js.map +1 -1
- package/dist/core/goals/goal-continuation-defaults.d.ts +4 -29
- package/dist/core/goals/goal-continuation-defaults.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-defaults.js +4 -32
- package/dist/core/goals/goal-continuation-defaults.js.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.d.ts +8 -18
- package/dist/core/goals/goal-continuation-prompt.d.ts.map +1 -1
- package/dist/core/goals/goal-continuation-prompt.js +9 -179
- package/dist/core/goals/goal-continuation-prompt.js.map +1 -1
- package/dist/core/goals/goal-lifecycle.d.ts +43 -0
- package/dist/core/goals/goal-lifecycle.d.ts.map +1 -0
- package/dist/core/goals/goal-lifecycle.js +102 -0
- package/dist/core/goals/goal-lifecycle.js.map +1 -0
- package/dist/core/goals/goal-record.d.ts +17 -0
- package/dist/core/goals/goal-record.d.ts.map +1 -0
- package/dist/core/goals/goal-record.js +31 -0
- package/dist/core/goals/goal-record.js.map +1 -0
- package/dist/core/goals/goal-runtime-snapshot.d.ts +11 -9
- package/dist/core/goals/goal-runtime-snapshot.d.ts.map +1 -1
- package/dist/core/goals/goal-runtime-snapshot.js +10 -8
- package/dist/core/goals/goal-runtime-snapshot.js.map +1 -1
- package/dist/core/goals/goal-session-controller.d.ts +42 -0
- package/dist/core/goals/goal-session-controller.d.ts.map +1 -0
- package/dist/core/goals/goal-session-controller.js +128 -0
- package/dist/core/goals/goal-session-controller.js.map +1 -0
- package/dist/core/goals/goal-state.d.ts +46 -25
- package/dist/core/goals/goal-state.d.ts.map +1 -1
- package/dist/core/goals/goal-state.js +91 -24
- package/dist/core/goals/goal-state.js.map +1 -1
- package/dist/core/goals/goal-tool-core.d.ts +9 -10
- package/dist/core/goals/goal-tool-core.d.ts.map +1 -1
- package/dist/core/goals/goal-tool-core.js +60 -75
- package/dist/core/goals/goal-tool-core.js.map +1 -1
- package/dist/core/goals/session-goal-state.d.ts +20 -12
- package/dist/core/goals/session-goal-state.d.ts.map +1 -1
- package/dist/core/goals/session-goal-state.js +133 -33
- package/dist/core/goals/session-goal-state.js.map +1 -1
- package/dist/core/human-input-controller.d.ts +47 -0
- package/dist/core/human-input-controller.d.ts.map +1 -0
- package/dist/core/human-input-controller.js +181 -0
- package/dist/core/human-input-controller.js.map +1 -0
- package/dist/core/human-input.d.ts +100 -0
- package/dist/core/human-input.d.ts.map +1 -0
- package/dist/core/human-input.js +362 -0
- package/dist/core/human-input.js.map +1 -0
- package/dist/core/index.d.ts +9 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +9 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/{telemetry.d.ts → install-telemetry.d.ts} +1 -1
- package/dist/core/install-telemetry.d.ts.map +1 -0
- package/dist/core/{telemetry.js → install-telemetry.js} +1 -1
- package/dist/core/install-telemetry.js.map +1 -0
- package/dist/core/keybindings.d.ts +17 -1
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +24 -6
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/learning/learning-audit.d.ts +2 -4
- package/dist/core/learning/learning-audit.d.ts.map +1 -1
- package/dist/core/learning/learning-audit.js +9 -29
- package/dist/core/learning/learning-audit.js.map +1 -1
- package/dist/core/learning/learning-gate.d.ts.map +1 -1
- package/dist/core/learning/learning-gate.js +1 -6
- package/dist/core/learning/learning-gate.js.map +1 -1
- package/dist/core/learning/session-learning-decision.d.ts +2 -4
- package/dist/core/learning/session-learning-decision.d.ts.map +1 -1
- package/dist/core/learning/session-learning-decision.js +9 -29
- package/dist/core/learning/session-learning-decision.js.map +1 -1
- package/dist/core/local-runtime-controller.d.ts +1 -1
- package/dist/core/local-runtime-controller.d.ts.map +1 -1
- package/dist/core/local-runtime-controller.js.map +1 -1
- package/dist/core/memory-controller.d.ts.map +1 -1
- package/dist/core/memory-controller.js +4 -4
- package/dist/core/memory-controller.js.map +1 -1
- package/dist/core/model-capability.d.ts +0 -19
- package/dist/core/model-capability.d.ts.map +1 -1
- package/dist/core/model-capability.js +1 -19
- package/dist/core/model-capability.js.map +1 -1
- package/dist/core/model-registry.d.ts +6 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +13 -5
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +17 -2
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +38 -25
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-router/intent-classifier.d.ts +1 -4
- package/dist/core/model-router/intent-classifier.d.ts.map +1 -1
- package/dist/core/model-router/intent-classifier.js +1 -156
- package/dist/core/model-router/intent-classifier.js.map +1 -1
- package/dist/core/model-router-controller.d.ts +1 -1
- package/dist/core/model-router-controller.d.ts.map +1 -1
- package/dist/core/model-router-controller.js +2 -2
- package/dist/core/model-router-controller.js.map +1 -1
- package/dist/core/model-selection-controller.d.ts +5 -5
- package/dist/core/model-selection-controller.d.ts.map +1 -1
- package/dist/core/model-selection-controller.js.map +1 -1
- package/dist/core/model-tool-protocol.d.ts +23 -0
- package/dist/core/model-tool-protocol.d.ts.map +1 -0
- package/dist/core/model-tool-protocol.js +43 -0
- package/dist/core/model-tool-protocol.js.map +1 -0
- package/dist/core/models/adaptation-store.d.ts +4 -6
- package/dist/core/models/adaptation-store.d.ts.map +1 -1
- package/dist/core/models/adaptation-store.js +95 -83
- package/dist/core/models/adaptation-store.js.map +1 -1
- package/dist/core/models/fitness-store.d.ts +2 -12
- package/dist/core/models/fitness-store.d.ts.map +1 -1
- package/dist/core/models/fitness-store.js +84 -57
- package/dist/core/models/fitness-store.js.map +1 -1
- package/dist/core/models/host-state-store.d.ts +34 -0
- package/dist/core/models/host-state-store.d.ts.map +1 -0
- package/dist/core/models/host-state-store.js +86 -0
- package/dist/core/models/host-state-store.js.map +1 -0
- package/dist/core/orchestration/agent-resume.d.ts +24 -0
- package/dist/core/orchestration/agent-resume.d.ts.map +1 -0
- package/dist/core/orchestration/agent-resume.js +90 -0
- package/dist/core/orchestration/agent-resume.js.map +1 -0
- package/dist/core/orchestration/capability-gateway.d.ts +61 -0
- package/dist/core/orchestration/capability-gateway.d.ts.map +1 -0
- package/dist/core/orchestration/capability-gateway.js +152 -0
- package/dist/core/orchestration/capability-gateway.js.map +1 -0
- package/dist/core/orchestration/contracts.d.ts +343 -0
- package/dist/core/orchestration/contracts.d.ts.map +1 -0
- package/dist/core/orchestration/contracts.js +135 -0
- package/dist/core/orchestration/contracts.js.map +1 -0
- package/dist/core/orchestration/delegation-ledger.d.ts +56 -0
- package/dist/core/orchestration/delegation-ledger.d.ts.map +1 -0
- package/dist/core/orchestration/delegation-ledger.js +200 -0
- package/dist/core/orchestration/delegation-ledger.js.map +1 -0
- package/dist/core/orchestration/event-store.d.ts +83 -0
- package/dist/core/orchestration/event-store.d.ts.map +1 -0
- package/dist/core/orchestration/event-store.js +560 -0
- package/dist/core/orchestration/event-store.js.map +1 -0
- package/dist/core/orchestration/lane-tool-manifests.d.ts +9 -0
- package/dist/core/orchestration/lane-tool-manifests.d.ts.map +1 -0
- package/dist/core/orchestration/lane-tool-manifests.js +37 -0
- package/dist/core/orchestration/lane-tool-manifests.js.map +1 -0
- package/dist/core/orchestration/model-binding.d.ts +15 -0
- package/dist/core/orchestration/model-binding.d.ts.map +1 -0
- package/dist/core/orchestration/model-binding.js +29 -0
- package/dist/core/orchestration/model-binding.js.map +1 -0
- package/dist/core/orchestration/policy-compiler.d.ts +49 -0
- package/dist/core/orchestration/policy-compiler.d.ts.map +1 -0
- package/dist/core/orchestration/policy-compiler.js +191 -0
- package/dist/core/orchestration/policy-compiler.js.map +1 -0
- package/dist/core/orchestration/policy-gate.d.ts +18 -0
- package/dist/core/orchestration/policy-gate.d.ts.map +1 -0
- package/dist/core/orchestration/policy-gate.js +24 -0
- package/dist/core/orchestration/policy-gate.js.map +1 -0
- package/dist/core/orchestration/profile-registry.d.ts +51 -0
- package/dist/core/orchestration/profile-registry.d.ts.map +1 -0
- package/dist/core/orchestration/profile-registry.js +393 -0
- package/dist/core/orchestration/profile-registry.js.map +1 -0
- package/dist/core/orchestration/profile-store.d.ts +31 -0
- package/dist/core/orchestration/profile-store.d.ts.map +1 -0
- package/dist/core/orchestration/profile-store.js +136 -0
- package/dist/core/orchestration/profile-store.js.map +1 -0
- package/dist/core/orchestration/risk-budget.d.ts +9 -0
- package/dist/core/orchestration/risk-budget.d.ts.map +1 -0
- package/dist/core/orchestration/risk-budget.js +48 -0
- package/dist/core/orchestration/risk-budget.js.map +1 -0
- package/dist/core/orchestration/task-runtime.d.ts +168 -0
- package/dist/core/orchestration/task-runtime.d.ts.map +1 -0
- package/dist/core/orchestration/task-runtime.js +1600 -0
- package/dist/core/orchestration/task-runtime.js.map +1 -0
- package/dist/core/orchestration/work-state-projection.d.ts +32 -0
- package/dist/core/orchestration/work-state-projection.d.ts.map +1 -0
- package/dist/core/orchestration/work-state-projection.js +116 -0
- package/dist/core/orchestration/work-state-projection.js.map +1 -0
- package/dist/core/orchestration/worker-execution-contract.d.ts +21 -0
- package/dist/core/orchestration/worker-execution-contract.d.ts.map +1 -0
- package/dist/core/orchestration/worker-execution-contract.js +179 -0
- package/dist/core/orchestration/worker-execution-contract.js.map +1 -0
- package/dist/core/orchestration/worker-result-adapter.d.ts +21 -0
- package/dist/core/orchestration/worker-result-adapter.d.ts.map +1 -0
- package/dist/core/orchestration/worker-result-adapter.js +109 -0
- package/dist/core/orchestration/worker-result-adapter.js.map +1 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +20 -3
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/process-identity.d.ts +11 -0
- package/dist/core/process-identity.d.ts.map +1 -0
- package/dist/core/process-identity.js +26 -0
- package/dist/core/process-identity.js.map +1 -0
- package/dist/core/process-matrix/codes.d.ts +14 -3
- package/dist/core/process-matrix/codes.d.ts.map +1 -1
- package/dist/core/process-matrix/codes.js.map +1 -1
- package/dist/core/process-matrix/resume-launcher.d.ts +26 -0
- package/dist/core/process-matrix/resume-launcher.d.ts.map +1 -0
- package/dist/core/process-matrix/resume-launcher.js +62 -0
- package/dist/core/process-matrix/resume-launcher.js.map +1 -0
- package/dist/core/process-matrix/runtime.d.ts +37 -22
- package/dist/core/process-matrix/runtime.d.ts.map +1 -1
- package/dist/core/process-matrix/runtime.js +399 -76
- package/dist/core/process-matrix/runtime.js.map +1 -1
- package/dist/core/process-matrix/store.d.ts +5 -2
- package/dist/core/process-matrix/store.d.ts.map +1 -1
- package/dist/core/process-matrix/store.js +123 -14
- package/dist/core/process-matrix/store.js.map +1 -1
- package/dist/core/process-matrix/supervisor.d.ts +10 -7
- package/dist/core/process-matrix/supervisor.d.ts.map +1 -1
- package/dist/core/process-matrix/supervisor.js +45 -14
- package/dist/core/process-matrix/supervisor.js.map +1 -1
- package/dist/core/profile-filter-controller.d.ts +8 -1
- package/dist/core/profile-filter-controller.d.ts.map +1 -1
- package/dist/core/profile-filter-controller.js +23 -5
- package/dist/core/profile-filter-controller.js.map +1 -1
- package/dist/core/profile-registry.d.ts.map +1 -1
- package/dist/core/profile-registry.js +6 -8
- package/dist/core/profile-registry.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +1 -0
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +18 -29
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/reflection-controller.d.ts +5 -5
- package/dist/core/reflection-controller.d.ts.map +1 -1
- package/dist/core/reflection-controller.js +5 -2
- package/dist/core/reflection-controller.js.map +1 -1
- package/dist/core/reload-blockers.d.ts.map +1 -1
- package/dist/core/reload-blockers.js +6 -8
- package/dist/core/reload-blockers.js.map +1 -1
- package/dist/core/request-auth.d.ts +7 -0
- package/dist/core/request-auth.d.ts.map +1 -0
- package/dist/core/request-auth.js +8 -0
- package/dist/core/request-auth.js.map +1 -0
- package/dist/core/research/evidence-bundle.d.ts.map +1 -1
- package/dist/core/research/evidence-bundle.js +1 -6
- package/dist/core/research/evidence-bundle.js.map +1 -1
- package/dist/core/research/lane-model-resolver.d.ts +33 -0
- package/dist/core/research/lane-model-resolver.d.ts.map +1 -0
- package/dist/core/research/lane-model-resolver.js +65 -0
- package/dist/core/research/lane-model-resolver.js.map +1 -0
- package/dist/core/research/model-fitness-controller.d.ts +38 -0
- package/dist/core/research/model-fitness-controller.d.ts.map +1 -0
- package/dist/core/research/model-fitness-controller.js +106 -0
- package/dist/core/research/model-fitness-controller.js.map +1 -0
- package/dist/core/research/model-fitness.d.ts +1 -1
- package/dist/core/research/model-fitness.d.ts.map +1 -1
- package/dist/core/research/model-fitness.js +4 -4
- package/dist/core/research/model-fitness.js.map +1 -1
- package/dist/core/research/research-gate.d.ts.map +1 -1
- package/dist/core/research/research-gate.js +7 -7
- package/dist/core/research/research-gate.js.map +1 -1
- package/dist/core/research/research-lane-controller.d.ts +62 -0
- package/dist/core/research/research-lane-controller.d.ts.map +1 -0
- package/dist/core/research/research-lane-controller.js +292 -0
- package/dist/core/research/research-lane-controller.js.map +1 -0
- package/dist/core/research/session-evidence-bundle.d.ts +2 -4
- package/dist/core/research/session-evidence-bundle.d.ts.map +1 -1
- package/dist/core/research/session-evidence-bundle.js +10 -46
- package/dist/core/research/session-evidence-bundle.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +23 -8
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/risk-classifier.d.ts +6 -0
- package/dist/core/risk-classifier.d.ts.map +1 -0
- package/dist/core/risk-classifier.js +233 -0
- package/dist/core/risk-classifier.js.map +1 -0
- package/dist/core/runtime-builder.d.ts +41 -23
- package/dist/core/runtime-builder.d.ts.map +1 -1
- package/dist/core/runtime-builder.js +365 -253
- package/dist/core/runtime-builder.js.map +1 -1
- package/dist/core/sdk.d.ts +6 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +68 -25
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/secrets/credential-exposure-guard.d.ts +9 -0
- package/dist/core/secrets/credential-exposure-guard.d.ts.map +1 -0
- package/dist/core/secrets/credential-exposure-guard.js +241 -0
- package/dist/core/secrets/credential-exposure-guard.js.map +1 -0
- package/dist/core/secrets/secret-dotenv.d.ts +27 -0
- package/dist/core/secrets/secret-dotenv.d.ts.map +1 -0
- package/dist/core/secrets/secret-dotenv.js +183 -0
- package/dist/core/secrets/secret-dotenv.js.map +1 -0
- package/dist/core/secrets/secret-vault-format.d.ts +112 -0
- package/dist/core/secrets/secret-vault-format.d.ts.map +1 -0
- package/dist/core/secrets/secret-vault-format.js +397 -0
- package/dist/core/secrets/secret-vault-format.js.map +1 -0
- package/dist/core/secrets/secret-vault.d.ts +72 -0
- package/dist/core/secrets/secret-vault.d.ts.map +1 -0
- package/dist/core/secrets/secret-vault.js +671 -0
- package/dist/core/secrets/secret-vault.js.map +1 -0
- package/dist/core/session-analytics.d.ts +4 -23
- package/dist/core/session-analytics.d.ts.map +1 -1
- package/dist/core/session-analytics.js +67 -70
- package/dist/core/session-analytics.js.map +1 -1
- package/dist/core/session-image-store.d.ts +33 -0
- package/dist/core/session-image-store.d.ts.map +1 -0
- package/dist/core/session-image-store.js +283 -0
- package/dist/core/session-image-store.js.map +1 -0
- package/dist/core/session-role.d.ts +11 -4
- package/dist/core/session-role.d.ts.map +1 -1
- package/dist/core/session-role.js +24 -5
- package/dist/core/session-role.js.map +1 -1
- package/dist/core/session-snapshot.d.ts +34 -0
- package/dist/core/session-snapshot.d.ts.map +1 -0
- package/dist/core/session-snapshot.js +68 -0
- package/dist/core/session-snapshot.js.map +1 -0
- package/dist/core/session-supervision-runtime.d.ts +31 -0
- package/dist/core/session-supervision-runtime.d.ts.map +1 -0
- package/dist/core/session-supervision-runtime.js +97 -0
- package/dist/core/session-supervision-runtime.js.map +1 -0
- package/dist/core/session-tree-navigator.d.ts +4 -6
- package/dist/core/session-tree-navigator.d.ts.map +1 -1
- package/dist/core/session-tree-navigator.js +4 -1
- package/dist/core/session-tree-navigator.js.map +1 -1
- package/dist/core/settings-manager.d.ts +10 -5
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +81 -29
- 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 +2 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tasks/session-task-state.d.ts +2 -4
- package/dist/core/tasks/session-task-state.d.ts.map +1 -1
- package/dist/core/tasks/session-task-state.js +10 -28
- package/dist/core/tasks/session-task-state.js.map +1 -1
- package/dist/core/tasks/task-projection.d.ts +20 -0
- package/dist/core/tasks/task-projection.d.ts.map +1 -0
- package/dist/core/tasks/task-projection.js +47 -0
- package/dist/core/tasks/task-projection.js.map +1 -0
- package/dist/core/tasks/task-state.d.ts +4 -0
- package/dist/core/tasks/task-state.d.ts.map +1 -1
- package/dist/core/tasks/task-state.js +28 -11
- package/dist/core/tasks/task-state.js.map +1 -1
- package/dist/core/tool-capability-policy.d.ts +13 -0
- package/dist/core/tool-capability-policy.d.ts.map +1 -0
- package/dist/core/tool-capability-policy.js +86 -0
- package/dist/core/tool-capability-policy.js.map +1 -0
- package/dist/core/tool-gate-controller.d.ts.map +1 -1
- package/dist/core/tool-gate-controller.js +8 -2
- package/dist/core/tool-gate-controller.js.map +1 -1
- package/dist/core/tool-protocol-controller.d.ts +89 -0
- package/dist/core/tool-protocol-controller.d.ts.map +1 -0
- package/dist/core/tool-protocol-controller.js +512 -0
- package/dist/core/tool-protocol-controller.js.map +1 -0
- package/dist/core/tool-recovery-log-records.d.ts +2 -3
- package/dist/core/tool-recovery-log-records.d.ts.map +1 -1
- package/dist/core/tool-recovery-log-records.js +9 -35
- package/dist/core/tool-recovery-log-records.js.map +1 -1
- package/dist/core/tool-recovery-stats.d.ts +21 -1
- package/dist/core/tool-recovery-stats.d.ts.map +1 -1
- package/dist/core/tool-recovery-stats.js.map +1 -1
- package/dist/core/tool-selection/tool-performance-store.d.ts +3 -7
- package/dist/core/tool-selection/tool-performance-store.d.ts.map +1 -1
- package/dist/core/tool-selection/tool-performance-store.js +97 -138
- package/dist/core/tool-selection/tool-performance-store.js.map +1 -1
- package/dist/core/tools/ask-question.d.ts +124 -0
- package/dist/core/tools/ask-question.d.ts.map +1 -0
- package/dist/core/tools/ask-question.js +693 -0
- package/dist/core/tools/ask-question.js.map +1 -0
- package/dist/core/tools/bash.d.ts +5 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +59 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/delegate-status.d.ts +31 -3
- package/dist/core/tools/delegate-status.d.ts.map +1 -1
- package/dist/core/tools/delegate-status.js +148 -29
- package/dist/core/tools/delegate-status.js.map +1 -1
- package/dist/core/tools/delegate.d.ts +15 -13
- package/dist/core/tools/delegate.d.ts.map +1 -1
- package/dist/core/tools/delegate.js +106 -23
- package/dist/core/tools/delegate.js.map +1 -1
- package/dist/core/tools/extensionify.d.ts.map +1 -1
- package/dist/core/tools/extensionify.js +1 -0
- package/dist/core/tools/extensionify.js.map +1 -1
- package/dist/core/tools/git-filter.d.ts +1 -8
- package/dist/core/tools/git-filter.d.ts.map +1 -1
- package/dist/core/tools/git-filter.js +2 -63
- package/dist/core/tools/git-filter.js.map +1 -1
- package/dist/core/tools/goal.d.ts +10 -8
- package/dist/core/tools/goal.d.ts.map +1 -1
- package/dist/core/tools/goal.js +106 -28
- package/dist/core/tools/goal.js.map +1 -1
- package/dist/core/tools/index.d.ts +1 -0
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +1 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/model-fitness.d.ts.map +1 -1
- package/dist/core/tools/model-fitness.js +2 -2
- package/dist/core/tools/model-fitness.js.map +1 -1
- package/dist/core/tools/orchestration-panel.d.ts +40 -0
- package/dist/core/tools/orchestration-panel.d.ts.map +1 -0
- package/dist/core/tools/orchestration-panel.js +124 -0
- package/dist/core/tools/orchestration-panel.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +11 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +36 -3
- package/dist/core/tools/output-accumulator.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 +3 -1
- package/dist/core/tools/python.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/run-process.d.ts +26 -0
- package/dist/core/tools/run-process.d.ts.map +1 -0
- package/dist/core/tools/run-process.js +138 -0
- package/dist/core/tools/run-process.js.map +1 -0
- package/dist/core/tools/search-command-guard.d.ts +14 -0
- package/dist/core/tools/search-command-guard.d.ts.map +1 -0
- package/dist/core/tools/search-command-guard.js +333 -0
- package/dist/core/tools/search-command-guard.js.map +1 -0
- package/dist/core/tools/secret-store.d.ts +38 -0
- package/dist/core/tools/secret-store.d.ts.map +1 -0
- package/dist/core/tools/secret-store.js +412 -0
- package/dist/core/tools/secret-store.js.map +1 -0
- package/dist/core/tools/shell-command-parser.d.ts +16 -0
- package/dist/core/tools/shell-command-parser.d.ts.map +1 -0
- package/dist/core/tools/shell-command-parser.js +113 -0
- package/dist/core/tools/shell-command-parser.js.map +1 -0
- package/dist/core/tools/task-steps.d.ts +2 -0
- package/dist/core/tools/task-steps.d.ts.map +1 -1
- package/dist/core/tools/task-steps.js +99 -0
- package/dist/core/tools/task-steps.js.map +1 -1
- package/dist/core/tools/tmux-dispatch.d.ts +3 -5
- package/dist/core/tools/tmux-dispatch.d.ts.map +1 -1
- package/dist/core/tools/tmux-dispatch.js +4 -4
- package/dist/core/tools/tmux-dispatch.js.map +1 -1
- package/dist/core/tools/windows-shell-engine.d.ts.map +1 -1
- package/dist/core/tools/windows-shell-engine.js +4 -6
- package/dist/core/tools/windows-shell-engine.js.map +1 -1
- package/dist/core/util/atomic-file.d.ts +6 -2
- package/dist/core/util/atomic-file.d.ts.map +1 -1
- package/dist/core/util/atomic-file.js +4 -4
- package/dist/core/util/atomic-file.js.map +1 -1
- package/dist/core/util/bounded-jsonl.d.ts +10 -0
- package/dist/core/util/bounded-jsonl.d.ts.map +1 -0
- package/dist/core/util/bounded-jsonl.js +75 -0
- package/dist/core/util/bounded-jsonl.js.map +1 -0
- package/dist/core/util/value-guards.d.ts +5 -0
- package/dist/core/util/value-guards.d.ts.map +1 -0
- package/dist/core/util/value-guards.js +12 -0
- package/dist/core/util/value-guards.js.map +1 -0
- package/dist/core/worktree-sync/store.d.ts +3 -3
- package/dist/core/worktree-sync/store.d.ts.map +1 -1
- package/dist/core/worktree-sync/store.js +10 -5
- package/dist/core/worktree-sync/store.js.map +1 -1
- package/dist/index.d.ts +15 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +149 -51
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +4 -6
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +186 -28
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/auth-dialogs-controller.d.ts +4 -0
- package/dist/modes/interactive/auth-dialogs-controller.d.ts.map +1 -1
- package/dist/modes/interactive/auth-dialogs-controller.js +60 -1
- package/dist/modes/interactive/auth-dialogs-controller.js.map +1 -1
- package/dist/modes/interactive/clipboard-input.d.ts +7 -1
- package/dist/modes/interactive/clipboard-input.d.ts.map +1 -1
- package/dist/modes/interactive/clipboard-input.js +44 -6
- package/dist/modes/interactive/clipboard-input.js.map +1 -1
- package/dist/modes/interactive/components/activity-lane.d.ts +55 -0
- package/dist/modes/interactive/components/activity-lane.d.ts.map +1 -0
- package/dist/modes/interactive/components/activity-lane.js +304 -0
- package/dist/modes/interactive/components/activity-lane.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +19 -10
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/expandable-text.d.ts +12 -0
- package/dist/modes/interactive/components/expandable-text.d.ts.map +1 -0
- package/dist/modes/interactive/components/expandable-text.js +17 -0
- package/dist/modes/interactive/components/expandable-text.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +15 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +30 -21
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts +1 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +6 -1
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +2 -2
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +23 -14
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +6 -6
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +19 -11
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +53 -20
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-group.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-group.js +3 -0
- package/dist/modes/interactive/components/tool-group.js.map +1 -1
- package/dist/modes/interactive/components/usage-action-selector.d.ts +16 -0
- package/dist/modes/interactive/components/usage-action-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/usage-action-selector.js +46 -0
- package/dist/modes/interactive/components/usage-action-selector.js.map +1 -0
- package/dist/modes/interactive/config-backup.d.ts.map +1 -1
- package/dist/modes/interactive/config-backup.js +5 -4
- package/dist/modes/interactive/config-backup.js.map +1 -1
- package/dist/modes/interactive/extension-ui-host.d.ts +14 -0
- package/dist/modes/interactive/extension-ui-host.d.ts.map +1 -1
- package/dist/modes/interactive/extension-ui-host.js +77 -15
- package/dist/modes/interactive/extension-ui-host.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts +15 -0
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +27 -19
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/history-reload-math.d.ts +6 -2
- package/dist/modes/interactive/history-reload-math.d.ts.map +1 -1
- package/dist/modes/interactive/history-reload-math.js +10 -5
- package/dist/modes/interactive/history-reload-math.js.map +1 -1
- package/dist/modes/interactive/interactive-event-controller.d.ts +74 -0
- package/dist/modes/interactive/interactive-event-controller.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-event-controller.js +328 -0
- package/dist/modes/interactive/interactive-event-controller.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +22 -24
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +245 -595
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/key-handlers.d.ts.map +1 -1
- package/dist/modes/interactive/key-handlers.js +1 -1
- package/dist/modes/interactive/key-handlers.js.map +1 -1
- package/dist/modes/interactive/loaded-resources-view.d.ts +20 -0
- package/dist/modes/interactive/loaded-resources-view.d.ts.map +1 -0
- package/dist/modes/interactive/loaded-resources-view.js +147 -0
- package/dist/modes/interactive/loaded-resources-view.js.map +1 -0
- package/dist/modes/interactive/profile-menu-controller.d.ts.map +1 -1
- package/dist/modes/interactive/profile-menu-controller.js +7 -7
- package/dist/modes/interactive/profile-menu-controller.js.map +1 -1
- package/dist/modes/interactive/report-commands.d.ts.map +1 -1
- package/dist/modes/interactive/report-commands.js +21 -0
- package/dist/modes/interactive/report-commands.js.map +1 -1
- package/dist/modes/interactive/resource-display.d.ts.map +1 -1
- package/dist/modes/interactive/resource-display.js +8 -2
- package/dist/modes/interactive/resource-display.js.map +1 -1
- package/dist/modes/interactive/resource-shell-commands.d.ts +1 -5
- package/dist/modes/interactive/resource-shell-commands.d.ts.map +1 -1
- package/dist/modes/interactive/resource-shell-commands.js +0 -5
- package/dist/modes/interactive/resource-shell-commands.js.map +1 -1
- package/dist/modes/interactive/session-flow-commands.d.ts +27 -8
- package/dist/modes/interactive/session-flow-commands.d.ts.map +1 -1
- package/dist/modes/interactive/session-flow-commands.js +150 -64
- package/dist/modes/interactive/session-flow-commands.js.map +1 -1
- package/dist/modes/interactive/session-io-commands.d.ts.map +1 -1
- package/dist/modes/interactive/session-io-commands.js +16 -6
- package/dist/modes/interactive/session-io-commands.js.map +1 -1
- package/dist/modes/interactive/session-replacement-errors.d.ts +7 -0
- package/dist/modes/interactive/session-replacement-errors.d.ts.map +1 -0
- package/dist/modes/interactive/session-replacement-errors.js +15 -0
- package/dist/modes/interactive/session-replacement-errors.js.map +1 -0
- package/dist/modes/interactive/startup-checks.d.ts.map +1 -1
- package/dist/modes/interactive/startup-checks.js +1 -1
- package/dist/modes/interactive/startup-checks.js.map +1 -1
- package/dist/modes/interactive/usage-commands.d.ts +34 -0
- package/dist/modes/interactive/usage-commands.d.ts.map +1 -0
- package/dist/modes/interactive/usage-commands.js +225 -0
- package/dist/modes/interactive/usage-commands.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +82 -23
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +15 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +138 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +2 -13
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard-native.d.ts +1 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -1
- package/dist/utils/clipboard-native.js.map +1 -1
- package/dist/utils/clipboard.d.ts +1 -0
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +52 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/platform.d.ts +3 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +8 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +5 -3
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +3 -1
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/work-directory.d.ts +11 -0
- package/dist/utils/work-directory.d.ts.map +1 -1
- package/dist/utils/work-directory.js +30 -9
- package/dist/utils/work-directory.js.map +1 -1
- package/docs/UI_POLISH_ORCHESTRATION.md +38 -0
- package/docs/UI_QUALITY_ORCHESTRATION.md +28 -0
- package/docs/docs.json +4 -0
- package/docs/extensions.md +62 -2
- package/docs/harness-architecture.md +156 -0
- package/docs/keybindings.md +11 -1
- package/docs/process-matrix.md +59 -26
- package/docs/providers.md +9 -1
- package/docs/rpc.md +45 -2
- package/docs/sessions.md +15 -0
- package/docs/settings.md +125 -11
- package/docs/task-steps.md +8 -0
- package/docs/telemetry.md +19 -0
- package/docs/tmux-agent-manager.md +10 -3
- package/docs/ui-reference/README.md +9 -0
- package/docs/ui-reference/orchestration-after.txt +14 -0
- package/docs/ui-reference/orchestration-before.txt +13 -0
- package/docs/ui-reference/orchestration-reference.txt +16 -0
- package/docs/usage.md +22 -2
- package/docs/work-directory.md +19 -8
- 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/question.ts +34 -245
- package/examples/extensions/questionnaire.ts +41 -407
- 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 +13 -13
- package/package.json +4 -4
- package/dist/core/delegation/session-worker-result.d.ts +0 -46
- package/dist/core/delegation/session-worker-result.d.ts.map +0 -1
- package/dist/core/delegation/session-worker-result.js +0 -113
- package/dist/core/delegation/session-worker-result.js.map +0 -1
- package/dist/core/delegation/worker-result.d.ts.map +0 -1
- package/dist/core/delegation/worker-result.js.map +0 -1
- package/dist/core/telemetry.d.ts.map +0 -1
- package/dist/core/telemetry.js.map +0 -1
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { constants, promises as fs } from "node:fs";
|
|
3
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
|
+
import { managedSecretEnvDir, secretsDir, secretVaultFile } from "../agent-paths.js";
|
|
5
|
+
import { redactKnownSecrets } from "../security/secret-text.js";
|
|
6
|
+
import { withFileLock, writeFileAtomic } from "../util/atomic-file.js";
|
|
7
|
+
import { MAX_DOTENV_DOCUMENT_BYTES, parseDotenvDocument } from "./secret-dotenv.js";
|
|
8
|
+
import { assertPassphrase, createVaultKdf, DEFAULT_SCRYPT_N, decryptPayload, deriveKey, MANAGED_ENV_HEADER_PREFIX, MAX_BINDINGS_PER_PROFILE, MAX_PROFILES, MAX_VARIABLES_PER_PROFILE, MAX_VAULT_FILE_BYTES, parseEnvelope, profileSummary, SecretVaultError, sameKdf, scrubPayload, serializeEnvelope, serializeVariableValues, VAULT_MARKER, validateBindingEnvFile, validateBindingWorkspace, validateDescription, validateDotenvProfileDocument, validateProfileId, validateScryptN, validateSecretValue, validateVariableName, } from "./secret-vault-format.js";
|
|
9
|
+
export { MAX_BINDINGS_PER_PROFILE, 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, SecretVaultError, } from "./secret-vault-format.js";
|
|
10
|
+
function nodeErrorCode(error) {
|
|
11
|
+
return typeof error === "object" && error !== null && "code" in error && typeof error.code === "string"
|
|
12
|
+
? error.code
|
|
13
|
+
: undefined;
|
|
14
|
+
}
|
|
15
|
+
async function lstatIfExists(path) {
|
|
16
|
+
try {
|
|
17
|
+
return await fs.lstat(path);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
if (nodeErrorCode(error) === "ENOENT")
|
|
21
|
+
return undefined;
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async function readBoundedRegularFile(filePath, maxBytes, label) {
|
|
26
|
+
const before = await fs.lstat(filePath);
|
|
27
|
+
if (before.isSymbolicLink())
|
|
28
|
+
throw new SecretVaultError("symlink_refused", `${label} symlinks are refused.`);
|
|
29
|
+
if (!before.isFile()) {
|
|
30
|
+
throw new SecretVaultError(label === "Secret vault" ? "vault_corrupt" : "destination_invalid", `${label} path is not a regular file.`);
|
|
31
|
+
}
|
|
32
|
+
if (before.size > maxBytes) {
|
|
33
|
+
throw new SecretVaultError(label === "Secret vault" ? "vault_too_large" : "invalid_dotenv", `${label} exceeds its ${label === "Secret vault" ? "4 MiB" : "512 KiB"} limit.`);
|
|
34
|
+
}
|
|
35
|
+
const handle = await fs.open(filePath, constants.O_RDONLY);
|
|
36
|
+
try {
|
|
37
|
+
const opened = await handle.stat();
|
|
38
|
+
if ((before.dev !== opened.dev || before.ino !== opened.ino) && before.ino !== 0 && opened.ino !== 0) {
|
|
39
|
+
throw new SecretVaultError("symlink_refused", "Secret vault changed while it was being opened.");
|
|
40
|
+
}
|
|
41
|
+
const output = Buffer.alloc(Math.min(maxBytes + 1, before.size + 1));
|
|
42
|
+
let offset = 0;
|
|
43
|
+
while (offset < output.byteLength) {
|
|
44
|
+
const { bytesRead } = await handle.read(output, offset, output.byteLength - offset, null);
|
|
45
|
+
if (bytesRead === 0)
|
|
46
|
+
break;
|
|
47
|
+
offset += bytesRead;
|
|
48
|
+
}
|
|
49
|
+
if (offset > before.size || offset > maxBytes) {
|
|
50
|
+
output.fill(0);
|
|
51
|
+
throw new SecretVaultError(label === "Secret vault" ? "vault_too_large" : "invalid_dotenv", `${label} grew beyond its limit while being read.`);
|
|
52
|
+
}
|
|
53
|
+
const text = output.toString("utf8", 0, offset);
|
|
54
|
+
output.fill(0);
|
|
55
|
+
return text;
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
await handle.close();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function readBoundedFile(filePath) {
|
|
62
|
+
return readBoundedRegularFile(filePath, MAX_VAULT_FILE_BYTES, "Secret vault");
|
|
63
|
+
}
|
|
64
|
+
async function readFilePrefix(filePath, maxBytes) {
|
|
65
|
+
const handle = await fs.open(filePath, constants.O_RDONLY);
|
|
66
|
+
try {
|
|
67
|
+
const output = Buffer.alloc(maxBytes);
|
|
68
|
+
const { bytesRead } = await handle.read(output, 0, output.byteLength, 0);
|
|
69
|
+
const text = output.toString("utf8", 0, bytesRead);
|
|
70
|
+
output.fill(0);
|
|
71
|
+
return text;
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
await handle.close();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function ensurePrivateDirectory(path) {
|
|
78
|
+
const existing = await lstatIfExists(path);
|
|
79
|
+
if (existing?.isSymbolicLink()) {
|
|
80
|
+
throw new SecretVaultError("symlink_refused", "Secret storage directory symlinks are refused.");
|
|
81
|
+
}
|
|
82
|
+
if (existing && !existing.isDirectory()) {
|
|
83
|
+
throw new SecretVaultError("destination_invalid", "Secret storage path is not a directory.");
|
|
84
|
+
}
|
|
85
|
+
await fs.mkdir(path, { recursive: true, mode: 0o700 });
|
|
86
|
+
if (process.platform !== "win32")
|
|
87
|
+
await fs.chmod(path, 0o700);
|
|
88
|
+
}
|
|
89
|
+
async function enforcePrivateFileMode(path) {
|
|
90
|
+
if (process.platform !== "win32")
|
|
91
|
+
await fs.chmod(path, 0o600);
|
|
92
|
+
}
|
|
93
|
+
function isPathInside(root, target) {
|
|
94
|
+
const fromRoot = relative(root, target);
|
|
95
|
+
return fromRoot === "" || (!fromRoot.startsWith(`..${sep}`) && fromRoot !== ".." && !isAbsolute(fromRoot));
|
|
96
|
+
}
|
|
97
|
+
function escapeRegExp(value) {
|
|
98
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Encrypted generic credential vault. Only the derived key is retained in memory, until this
|
|
102
|
+
* process explicitly locks the vault or exits. The native model-facing tool receives summaries,
|
|
103
|
+
* never decrypted values or materialization paths.
|
|
104
|
+
*/
|
|
105
|
+
export class SecretVault {
|
|
106
|
+
vaultPath;
|
|
107
|
+
materializedDir;
|
|
108
|
+
rootDir;
|
|
109
|
+
scryptN;
|
|
110
|
+
now;
|
|
111
|
+
onEnvironmentChanged;
|
|
112
|
+
cachedKey;
|
|
113
|
+
cachedKdf;
|
|
114
|
+
cachedProfiles = [];
|
|
115
|
+
activeProfilesByWorkspace = new Map();
|
|
116
|
+
constructor(options) {
|
|
117
|
+
this.rootDir = secretsDir(options.agentDir);
|
|
118
|
+
this.vaultPath = secretVaultFile(options.agentDir);
|
|
119
|
+
this.materializedDir = managedSecretEnvDir(options.agentDir);
|
|
120
|
+
this.scryptN = validateScryptN(options.scryptN ?? DEFAULT_SCRYPT_N);
|
|
121
|
+
this.now = options.now ?? (() => new Date());
|
|
122
|
+
this.onEnvironmentChanged = options.onEnvironmentChanged;
|
|
123
|
+
}
|
|
124
|
+
static forAgentDir(agentDir) {
|
|
125
|
+
return new SecretVault({ agentDir });
|
|
126
|
+
}
|
|
127
|
+
get isUnlocked() {
|
|
128
|
+
return this.cachedKey !== undefined;
|
|
129
|
+
}
|
|
130
|
+
async exists() {
|
|
131
|
+
const existing = await lstatIfExists(this.vaultPath);
|
|
132
|
+
if (existing?.isSymbolicLink()) {
|
|
133
|
+
throw new SecretVaultError("symlink_refused", "Secret vault symlinks are refused.");
|
|
134
|
+
}
|
|
135
|
+
return existing !== undefined;
|
|
136
|
+
}
|
|
137
|
+
lock() {
|
|
138
|
+
this.cachedKey?.fill(0);
|
|
139
|
+
this.cachedKey = undefined;
|
|
140
|
+
this.cachedKdf = undefined;
|
|
141
|
+
this.clearSecretCache();
|
|
142
|
+
this.activeProfilesByWorkspace.clear();
|
|
143
|
+
this.notifyEnvironmentChanged();
|
|
144
|
+
}
|
|
145
|
+
/** Environment for the nearest explicitly activated profile covering cwd. */
|
|
146
|
+
getEnvironmentForCwd(cwd) {
|
|
147
|
+
const match = this.resolveCachedProfile(cwd);
|
|
148
|
+
if (!match)
|
|
149
|
+
return {};
|
|
150
|
+
return Object.fromEntries(match.profile.variables.map((variable) => [variable.name, variable.value]));
|
|
151
|
+
}
|
|
152
|
+
hasEnvironmentForCwd(cwd) {
|
|
153
|
+
return this.resolveCachedProfile(cwd) !== undefined;
|
|
154
|
+
}
|
|
155
|
+
/** Remove exact unlocked vault values and high-confidence credential shapes from model-facing text. */
|
|
156
|
+
redactSensitiveText(text) {
|
|
157
|
+
let redacted = redactKnownSecrets(text);
|
|
158
|
+
const values = [
|
|
159
|
+
...new Set(this.cachedProfiles
|
|
160
|
+
.flatMap((profile) => profile.variables.map((variable) => variable.value))
|
|
161
|
+
.filter(Boolean)),
|
|
162
|
+
].sort((left, right) => right.length - left.length);
|
|
163
|
+
for (const value of values) {
|
|
164
|
+
if (value.length >= 4) {
|
|
165
|
+
redacted = redacted.split(value).join("[REDACTED]");
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
const bounded = new RegExp(`(^|[\\s=:;,])${escapeRegExp(value)}(?=$|[\\s,;])`, "g");
|
|
169
|
+
redacted = redacted.replace(bounded, (_match, prefix) => `${prefix}[REDACTED]`);
|
|
170
|
+
}
|
|
171
|
+
return redacted;
|
|
172
|
+
}
|
|
173
|
+
async initialize(passphrase) {
|
|
174
|
+
assertPassphrase(passphrase, true);
|
|
175
|
+
await ensurePrivateDirectory(this.rootDir);
|
|
176
|
+
await withFileLock(this.vaultPath, async () => {
|
|
177
|
+
if (await lstatIfExists(this.vaultPath)) {
|
|
178
|
+
throw new SecretVaultError("already_initialized", "Secret vault is already initialized.");
|
|
179
|
+
}
|
|
180
|
+
const kdf = createVaultKdf(this.scryptN);
|
|
181
|
+
const key = await deriveKey(passphrase, kdf);
|
|
182
|
+
const payload = { marker: VAULT_MARKER, profiles: [] };
|
|
183
|
+
try {
|
|
184
|
+
await this.writeEnvelope(kdf, payload, key);
|
|
185
|
+
this.replaceCachedKey(key, kdf);
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
key.fill(0);
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
async unlock(passphrase) {
|
|
194
|
+
assertPassphrase(passphrase, false);
|
|
195
|
+
if (!(await this.exists()))
|
|
196
|
+
throw new SecretVaultError("not_initialized", "Secret vault is not initialized.");
|
|
197
|
+
const envelope = parseEnvelope(await readBoundedFile(this.vaultPath));
|
|
198
|
+
const key = await deriveKey(passphrase, envelope.kdf);
|
|
199
|
+
let payload;
|
|
200
|
+
try {
|
|
201
|
+
const environmentBefore = this.activeEnvironmentFingerprint();
|
|
202
|
+
payload = decryptPayload(envelope.payload, key);
|
|
203
|
+
this.replaceCachedKey(key, envelope.kdf);
|
|
204
|
+
this.refreshSecretCache(payload);
|
|
205
|
+
if (environmentBefore !== this.activeEnvironmentFingerprint())
|
|
206
|
+
this.notifyEnvironmentChanged();
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
key.fill(0);
|
|
210
|
+
throw error;
|
|
211
|
+
}
|
|
212
|
+
finally {
|
|
213
|
+
if (payload)
|
|
214
|
+
scrubPayload(payload);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
async listProfiles() {
|
|
218
|
+
return this.withPayload((payload) => payload.profiles.map(profileSummary), false);
|
|
219
|
+
}
|
|
220
|
+
async upsertProfile(profile, description, values) {
|
|
221
|
+
if (values.length === 0) {
|
|
222
|
+
throw new SecretVaultError("invalid_variable", "At least one environment variable is required.");
|
|
223
|
+
}
|
|
224
|
+
const seenNames = new Set();
|
|
225
|
+
const normalizedValues = values.map((entry) => {
|
|
226
|
+
const name = validateVariableName(entry.name);
|
|
227
|
+
if (seenNames.has(name)) {
|
|
228
|
+
throw new SecretVaultError("invalid_variable", `Environment variable ${name} is duplicated.`);
|
|
229
|
+
}
|
|
230
|
+
seenNames.add(name);
|
|
231
|
+
return { name, value: validateSecretValue(entry.value) };
|
|
232
|
+
});
|
|
233
|
+
return this.storeProfileDocument(profile, description, serializeVariableValues(normalizedValues), undefined, true);
|
|
234
|
+
}
|
|
235
|
+
async replaceProfileDocument(profile, description, document, binding) {
|
|
236
|
+
return this.storeProfileDocument(profile, description, document, binding, false);
|
|
237
|
+
}
|
|
238
|
+
async getProfileDocument(profile) {
|
|
239
|
+
const normalizedProfile = validateProfileId(profile);
|
|
240
|
+
return this.withPayload((payload) => payload.profiles.find((candidate) => candidate.profile === normalizedProfile)?.dotenv, false);
|
|
241
|
+
}
|
|
242
|
+
async readOwnerDotenv(destination) {
|
|
243
|
+
this.assertDestination(destination);
|
|
244
|
+
return readBoundedRegularFile(destination, MAX_DOTENV_DOCUMENT_BYTES, "Dotenv file");
|
|
245
|
+
}
|
|
246
|
+
async removeProfile(profile, variableNames) {
|
|
247
|
+
const normalizedProfile = validateProfileId(profile);
|
|
248
|
+
const normalizedNames = variableNames?.map(validateVariableName);
|
|
249
|
+
if (normalizedNames && new Set(normalizedNames).size !== normalizedNames.length) {
|
|
250
|
+
throw new SecretVaultError("invalid_variable", "Environment variable removals are duplicated.");
|
|
251
|
+
}
|
|
252
|
+
let managedMaterializationRemoved = false;
|
|
253
|
+
let boundMaterializationsRemoved = 0;
|
|
254
|
+
const result = await this.withPayload(async (payload) => {
|
|
255
|
+
const index = payload.profiles.findIndex((candidate) => candidate.profile === normalizedProfile);
|
|
256
|
+
const record = payload.profiles[index];
|
|
257
|
+
if (!record)
|
|
258
|
+
throw new SecretVaultError("profile_missing", "Secret profile does not exist.");
|
|
259
|
+
const variables = validateDotenvProfileDocument(record.dotenv).variables;
|
|
260
|
+
let removedProfile;
|
|
261
|
+
let removedVariableNames;
|
|
262
|
+
let remaining = [];
|
|
263
|
+
if (normalizedNames === undefined) {
|
|
264
|
+
removedProfile = true;
|
|
265
|
+
removedVariableNames = variables.map((variable) => variable.name);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
if (normalizedNames.length === 0) {
|
|
269
|
+
throw new SecretVaultError("invalid_variable", "Select at least one environment variable to remove.");
|
|
270
|
+
}
|
|
271
|
+
const requested = new Set(normalizedNames);
|
|
272
|
+
removedVariableNames = variables
|
|
273
|
+
.filter((variable) => requested.has(variable.name))
|
|
274
|
+
.map((variable) => variable.name);
|
|
275
|
+
if (removedVariableNames.length !== requested.size) {
|
|
276
|
+
throw new SecretVaultError("invalid_variable", "One or more requested environment variables do not exist.");
|
|
277
|
+
}
|
|
278
|
+
remaining = variables.filter((variable) => !requested.has(variable.name));
|
|
279
|
+
removedProfile = remaining.length === 0;
|
|
280
|
+
}
|
|
281
|
+
// Validate the complete mutation before removing any recoverable materialization.
|
|
282
|
+
managedMaterializationRemoved = await this.removeManagedMaterialization(normalizedProfile);
|
|
283
|
+
boundMaterializationsRemoved = await this.removeBoundMaterializations(record);
|
|
284
|
+
if (removedProfile)
|
|
285
|
+
payload.profiles.splice(index, 1);
|
|
286
|
+
else {
|
|
287
|
+
record.dotenv = serializeVariableValues(remaining);
|
|
288
|
+
record.updatedAt = this.now().toISOString();
|
|
289
|
+
}
|
|
290
|
+
return { removedProfile, removedVariableNames };
|
|
291
|
+
}, true);
|
|
292
|
+
this.deactivateProfile(normalizedProfile);
|
|
293
|
+
return {
|
|
294
|
+
profile: normalizedProfile,
|
|
295
|
+
...result,
|
|
296
|
+
managedMaterializationRemoved,
|
|
297
|
+
boundMaterializationsRemoved,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
getManagedEnvPath(profile) {
|
|
301
|
+
return join(this.materializedDir, `${validateProfileId(profile)}.env`);
|
|
302
|
+
}
|
|
303
|
+
resolveBindingTarget(workspace, envFile) {
|
|
304
|
+
const normalizedWorkspace = validateBindingWorkspace(resolve(workspace));
|
|
305
|
+
const normalizedEnvFile = validateBindingEnvFile(envFile);
|
|
306
|
+
const destination = resolve(normalizedWorkspace, normalizedEnvFile);
|
|
307
|
+
if (!isPathInside(normalizedWorkspace, destination)) {
|
|
308
|
+
throw new SecretVaultError("destination_invalid", "Credential target must stay inside its workspace.");
|
|
309
|
+
}
|
|
310
|
+
return { workspace: normalizedWorkspace, envFile: normalizedEnvFile, destination };
|
|
311
|
+
}
|
|
312
|
+
async resolveBindingForWorkspace(cwd, profile) {
|
|
313
|
+
const normalizedCwd = resolve(cwd);
|
|
314
|
+
const normalizedProfile = profile === undefined ? undefined : validateProfileId(profile);
|
|
315
|
+
return this.withPayload((payload) => {
|
|
316
|
+
const matches = payload.profiles.flatMap((candidate) => {
|
|
317
|
+
if (normalizedProfile !== undefined && candidate.profile !== normalizedProfile)
|
|
318
|
+
return [];
|
|
319
|
+
const binding = candidate.bindings
|
|
320
|
+
.filter((entry) => isPathInside(entry.workspace, normalizedCwd))
|
|
321
|
+
.sort((left, right) => right.workspace.length - left.workspace.length)[0];
|
|
322
|
+
if (!binding)
|
|
323
|
+
return [];
|
|
324
|
+
return [{ candidate, binding }];
|
|
325
|
+
});
|
|
326
|
+
if (matches.length === 0) {
|
|
327
|
+
throw new SecretVaultError("binding_missing", normalizedProfile
|
|
328
|
+
? `Secret profile ${normalizedProfile} is not bound to this workspace.`
|
|
329
|
+
: "No secret profile is bound to this workspace.");
|
|
330
|
+
}
|
|
331
|
+
const longestRoot = Math.max(...matches.map((match) => match.binding.workspace.length));
|
|
332
|
+
const nearest = matches.filter((match) => match.binding.workspace.length === longestRoot);
|
|
333
|
+
let selected = nearest[0];
|
|
334
|
+
if (nearest.length > 1) {
|
|
335
|
+
const active = nearest.find((match) => this.activeProfilesByWorkspace.get(match.binding.workspace) === match.candidate.profile);
|
|
336
|
+
if (!active) {
|
|
337
|
+
throw new SecretVaultError("ambiguous_binding", "Multiple secret profiles apply to this workspace; select one by profile name.");
|
|
338
|
+
}
|
|
339
|
+
selected = active;
|
|
340
|
+
}
|
|
341
|
+
const parsed = validateDotenvProfileDocument(selected.candidate.dotenv);
|
|
342
|
+
return {
|
|
343
|
+
profile: selected.candidate.profile,
|
|
344
|
+
...selected.binding,
|
|
345
|
+
destination: resolve(selected.binding.workspace, selected.binding.envFile),
|
|
346
|
+
variableNames: parsed.variables.map((variable) => variable.name),
|
|
347
|
+
};
|
|
348
|
+
}, false);
|
|
349
|
+
}
|
|
350
|
+
async inspectEnvDestination(destination, profile) {
|
|
351
|
+
validateProfileId(profile);
|
|
352
|
+
this.assertDestination(destination);
|
|
353
|
+
const existing = await lstatIfExists(destination);
|
|
354
|
+
if (!existing)
|
|
355
|
+
return "missing";
|
|
356
|
+
if (existing.isSymbolicLink()) {
|
|
357
|
+
throw new SecretVaultError("symlink_refused", "Secret dotenv destination symlinks are refused.");
|
|
358
|
+
}
|
|
359
|
+
if (!existing.isFile()) {
|
|
360
|
+
throw new SecretVaultError("destination_invalid", "Secret dotenv destination is not a regular file.");
|
|
361
|
+
}
|
|
362
|
+
const firstLine = (await readFilePrefix(destination, 512)).split(/\r?\n/, 1)[0] ?? "";
|
|
363
|
+
if (firstLine === `${MANAGED_ENV_HEADER_PREFIX}${profile}`)
|
|
364
|
+
return "managed-profile";
|
|
365
|
+
if (firstLine.startsWith(MANAGED_ENV_HEADER_PREFIX))
|
|
366
|
+
return "managed-other";
|
|
367
|
+
return "unmanaged";
|
|
368
|
+
}
|
|
369
|
+
async materializeEnv(profile, destination, options = {}) {
|
|
370
|
+
const normalizedProfile = validateProfileId(profile);
|
|
371
|
+
this.assertDestination(destination);
|
|
372
|
+
const previousState = await this.inspectEnvDestination(destination, normalizedProfile);
|
|
373
|
+
await this.assertReplaceableDestination(destination, previousState, options);
|
|
374
|
+
if (options.managed) {
|
|
375
|
+
if (resolve(destination) !== resolve(this.getManagedEnvPath(normalizedProfile))) {
|
|
376
|
+
throw new SecretVaultError("destination_invalid", "Managed dotenv destination is not canonical.");
|
|
377
|
+
}
|
|
378
|
+
await ensurePrivateDirectory(this.materializedDir);
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
const parent = await lstatIfExists(dirname(destination));
|
|
382
|
+
if (!parent?.isDirectory()) {
|
|
383
|
+
throw new SecretVaultError("destination_invalid", "Dotenv destination directory does not exist.");
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return this.withPayload(async (payload) => {
|
|
387
|
+
const record = payload.profiles.find((candidate) => candidate.profile === normalizedProfile);
|
|
388
|
+
if (!record)
|
|
389
|
+
throw new SecretVaultError("profile_missing", "Secret profile does not exist.");
|
|
390
|
+
const binding = record.bindings.find((candidate) => resolve(candidate.workspace, candidate.envFile) === resolve(destination));
|
|
391
|
+
const activationCwd = options.activationWorkspace ? resolve(options.activationWorkspace) : undefined;
|
|
392
|
+
const activationBinding = activationCwd
|
|
393
|
+
? record.bindings
|
|
394
|
+
.filter((candidate) => isPathInside(candidate.workspace, activationCwd))
|
|
395
|
+
.sort((left, right) => right.workspace.length - left.workspace.length)[0]
|
|
396
|
+
: binding;
|
|
397
|
+
if (activationCwd && !activationBinding) {
|
|
398
|
+
throw new SecretVaultError("binding_missing", `Secret profile ${normalizedProfile} is not bound to this workspace.`);
|
|
399
|
+
}
|
|
400
|
+
if (binding && !options.managed)
|
|
401
|
+
await this.assertBoundDestinationParent(binding, destination);
|
|
402
|
+
const currentState = await this.inspectEnvDestination(destination, normalizedProfile);
|
|
403
|
+
await this.assertReplaceableDestination(destination, currentState, options);
|
|
404
|
+
const variableNames = validateDotenvProfileDocument(record.dotenv).variables.map((variable) => variable.name);
|
|
405
|
+
const body = record.dotenv.endsWith("\n") ? record.dotenv : `${record.dotenv}\n`;
|
|
406
|
+
let dotenv = `${MANAGED_ENV_HEADER_PREFIX}${normalizedProfile}\n# Generated by Pi. Do not edit, inspect, source as shell code, or commit.\n${body}`;
|
|
407
|
+
try {
|
|
408
|
+
await writeFileAtomic(destination, dotenv, { mode: 0o600 });
|
|
409
|
+
await enforcePrivateFileMode(destination);
|
|
410
|
+
if (activationBinding) {
|
|
411
|
+
this.activeProfilesByWorkspace.set(activationBinding.workspace, normalizedProfile);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
finally {
|
|
415
|
+
dotenv = "";
|
|
416
|
+
}
|
|
417
|
+
return { profile: normalizedProfile, variableNames, previousState: currentState };
|
|
418
|
+
}, false);
|
|
419
|
+
}
|
|
420
|
+
async storeProfileDocument(profile, description, document, binding, merge) {
|
|
421
|
+
const normalizedProfile = validateProfileId(profile);
|
|
422
|
+
const normalizedDescription = validateDescription(description);
|
|
423
|
+
const parsedDocument = validateDotenvProfileDocument(document);
|
|
424
|
+
const target = binding ? this.resolveBindingTarget(binding.workspace, binding.envFile) : undefined;
|
|
425
|
+
const normalizedBinding = target ? { workspace: target.workspace, envFile: target.envFile } : undefined;
|
|
426
|
+
const summary = await this.withPayload(async (payload) => {
|
|
427
|
+
let record = payload.profiles.find((candidate) => candidate.profile === normalizedProfile);
|
|
428
|
+
const timestamp = this.now().toISOString();
|
|
429
|
+
if (!record && payload.profiles.length >= MAX_PROFILES) {
|
|
430
|
+
throw new SecretVaultError("profile_limit", `Secret vault supports at most ${MAX_PROFILES} profiles.`);
|
|
431
|
+
}
|
|
432
|
+
const nextBindings = record?.bindings.map((entry) => ({ ...entry })) ?? [];
|
|
433
|
+
if (normalizedBinding) {
|
|
434
|
+
const next = { ...normalizedBinding, updatedAt: timestamp };
|
|
435
|
+
const existingIndex = nextBindings.findIndex((entry) => entry.workspace === normalizedBinding.workspace);
|
|
436
|
+
if (existingIndex === -1)
|
|
437
|
+
nextBindings.push(next);
|
|
438
|
+
else
|
|
439
|
+
nextBindings[existingIndex] = next;
|
|
440
|
+
if (nextBindings.length > MAX_BINDINGS_PER_PROFILE) {
|
|
441
|
+
throw new SecretVaultError("profile_limit", `A secret profile supports at most ${MAX_BINDINGS_PER_PROFILE} workspace bindings.`);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
let nextDocument = parsedDocument.document;
|
|
445
|
+
if (merge && record) {
|
|
446
|
+
const merged = new Map(validateDotenvProfileDocument(record.dotenv).variables.map((variable) => [
|
|
447
|
+
variable.name,
|
|
448
|
+
variable.value,
|
|
449
|
+
]));
|
|
450
|
+
for (const variable of parsedDocument.variables)
|
|
451
|
+
merged.set(variable.name, variable.value);
|
|
452
|
+
if (merged.size > MAX_VARIABLES_PER_PROFILE) {
|
|
453
|
+
throw new SecretVaultError("variable_limit", `A secret profile supports at most ${MAX_VARIABLES_PER_PROFILE} variables.`);
|
|
454
|
+
}
|
|
455
|
+
nextDocument = serializeVariableValues([...merged].map(([name, value]) => ({ name, value })));
|
|
456
|
+
}
|
|
457
|
+
if (record) {
|
|
458
|
+
await this.removeManagedMaterialization(normalizedProfile);
|
|
459
|
+
await this.removeBoundMaterializations(record);
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
record = {
|
|
463
|
+
profile: normalizedProfile,
|
|
464
|
+
createdAt: timestamp,
|
|
465
|
+
updatedAt: timestamp,
|
|
466
|
+
dotenv: nextDocument,
|
|
467
|
+
bindings: [],
|
|
468
|
+
};
|
|
469
|
+
payload.profiles.push(record);
|
|
470
|
+
}
|
|
471
|
+
if (normalizedDescription !== undefined)
|
|
472
|
+
record.description = normalizedDescription;
|
|
473
|
+
record.dotenv = nextDocument;
|
|
474
|
+
record.bindings = nextBindings.sort((left, right) => left.workspace.localeCompare(right.workspace) || left.envFile.localeCompare(right.envFile));
|
|
475
|
+
record.updatedAt = timestamp;
|
|
476
|
+
payload.profiles.sort((left, right) => left.profile.localeCompare(right.profile));
|
|
477
|
+
return profileSummary(record);
|
|
478
|
+
}, true);
|
|
479
|
+
this.deactivateProfile(normalizedProfile);
|
|
480
|
+
return summary;
|
|
481
|
+
}
|
|
482
|
+
async assertReplaceableDestination(destination, state, options) {
|
|
483
|
+
if (state === "managed-other") {
|
|
484
|
+
throw new SecretVaultError("destination_conflict", "Destination already contains a file managed for another secret profile.");
|
|
485
|
+
}
|
|
486
|
+
if (state !== "unmanaged")
|
|
487
|
+
return;
|
|
488
|
+
if (!options.allowReplaceUnmanaged || options.expectedUnmanagedContent === undefined) {
|
|
489
|
+
throw new SecretVaultError("destination_conflict", "Destination already contains an unmanaged file that was not reviewed for replacement.");
|
|
490
|
+
}
|
|
491
|
+
if ((await this.readOwnerDotenv(destination)) !== options.expectedUnmanagedContent) {
|
|
492
|
+
throw new SecretVaultError("destination_conflict", "The reviewed dotenv file changed before replacement and was preserved.");
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
async assertBoundDestinationParent(binding, destination) {
|
|
496
|
+
try {
|
|
497
|
+
const [workspace, parent] = await Promise.all([
|
|
498
|
+
fs.realpath(binding.workspace),
|
|
499
|
+
fs.realpath(dirname(destination)),
|
|
500
|
+
]);
|
|
501
|
+
if (isPathInside(workspace, parent))
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
catch {
|
|
505
|
+
// Collapse filesystem detail so a model-facing failure cannot disclose unrelated paths.
|
|
506
|
+
}
|
|
507
|
+
throw new SecretVaultError("destination_invalid", "Credential destination resolves outside its bound workspace or cannot be verified.");
|
|
508
|
+
}
|
|
509
|
+
assertDestination(destination) {
|
|
510
|
+
if (!isAbsolute(destination) || resolve(destination) === resolve(this.vaultPath)) {
|
|
511
|
+
throw new SecretVaultError("destination_invalid", "Secret dotenv destination must be an absolute non-vault path.");
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
replaceCachedKey(key, kdf) {
|
|
515
|
+
this.cachedKey?.fill(0);
|
|
516
|
+
this.cachedKey = key;
|
|
517
|
+
this.cachedKdf = { ...kdf };
|
|
518
|
+
}
|
|
519
|
+
clearSecretCache() {
|
|
520
|
+
for (const profile of this.cachedProfiles) {
|
|
521
|
+
for (const variable of profile.variables)
|
|
522
|
+
variable.value = "";
|
|
523
|
+
}
|
|
524
|
+
this.cachedProfiles = [];
|
|
525
|
+
}
|
|
526
|
+
deactivateProfile(profile) {
|
|
527
|
+
let changed = false;
|
|
528
|
+
for (const [workspace, activeProfile] of this.activeProfilesByWorkspace) {
|
|
529
|
+
if (activeProfile !== profile)
|
|
530
|
+
continue;
|
|
531
|
+
this.activeProfilesByWorkspace.delete(workspace);
|
|
532
|
+
changed = true;
|
|
533
|
+
}
|
|
534
|
+
const cached = this.cachedProfiles.find((candidate) => candidate.profile === profile);
|
|
535
|
+
if (cached) {
|
|
536
|
+
for (const variable of cached.variables)
|
|
537
|
+
variable.value = "";
|
|
538
|
+
cached.variables = [];
|
|
539
|
+
}
|
|
540
|
+
if (changed)
|
|
541
|
+
this.notifyEnvironmentChanged();
|
|
542
|
+
}
|
|
543
|
+
notifyEnvironmentChanged() {
|
|
544
|
+
try {
|
|
545
|
+
this.onEnvironmentChanged?.();
|
|
546
|
+
}
|
|
547
|
+
catch {
|
|
548
|
+
// Credential state changes remain authoritative even if host cleanup is best-effort.
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
activeEnvironmentFingerprint() {
|
|
552
|
+
const hash = createHash("sha256");
|
|
553
|
+
for (const profile of this.cachedProfiles) {
|
|
554
|
+
const activeBindings = profile.bindings
|
|
555
|
+
.filter((binding) => this.activeProfilesByWorkspace.get(binding.workspace) === profile.profile)
|
|
556
|
+
.sort((left, right) => left.workspace.localeCompare(right.workspace));
|
|
557
|
+
if (activeBindings.length === 0)
|
|
558
|
+
continue;
|
|
559
|
+
hash.update(`${profile.profile.length}:${profile.profile}`);
|
|
560
|
+
for (const binding of activeBindings)
|
|
561
|
+
hash.update(`${binding.workspace.length}:${binding.workspace}`);
|
|
562
|
+
for (const variable of profile.variables) {
|
|
563
|
+
hash.update(`${variable.name.length}:${variable.name}${variable.value.length}:${variable.value}`);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
return hash.digest("hex");
|
|
567
|
+
}
|
|
568
|
+
refreshSecretCache(payload) {
|
|
569
|
+
this.clearSecretCache();
|
|
570
|
+
this.cachedProfiles = payload.profiles.map((profile) => ({
|
|
571
|
+
profile: profile.profile,
|
|
572
|
+
bindings: profile.bindings.map((binding) => ({ ...binding })),
|
|
573
|
+
variables: profile.bindings.some((binding) => this.activeProfilesByWorkspace.get(binding.workspace) === profile.profile)
|
|
574
|
+
? parseDotenvDocument(profile.dotenv).variables.map((variable) => ({ ...variable }))
|
|
575
|
+
: [],
|
|
576
|
+
}));
|
|
577
|
+
for (const [workspace, profile] of this.activeProfilesByWorkspace) {
|
|
578
|
+
const stillBound = this.cachedProfiles.some((candidate) => candidate.profile === profile && candidate.bindings.some((binding) => binding.workspace === workspace));
|
|
579
|
+
if (!stillBound)
|
|
580
|
+
this.activeProfilesByWorkspace.delete(workspace);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
resolveCachedProfile(cwd) {
|
|
584
|
+
const resolvedCwd = resolve(cwd);
|
|
585
|
+
return this.cachedProfiles
|
|
586
|
+
.flatMap((profile) => {
|
|
587
|
+
const binding = profile.bindings
|
|
588
|
+
.filter((candidate) => isPathInside(candidate.workspace, resolvedCwd))
|
|
589
|
+
.sort((left, right) => right.workspace.length - left.workspace.length)[0];
|
|
590
|
+
return binding ? [{ profile, binding }] : [];
|
|
591
|
+
})
|
|
592
|
+
.filter((match) => this.activeProfilesByWorkspace.get(match.binding.workspace) === match.profile.profile)
|
|
593
|
+
.sort((left, right) => right.binding.workspace.length - left.binding.workspace.length)[0];
|
|
594
|
+
}
|
|
595
|
+
requireUnlocked() {
|
|
596
|
+
if (!this.cachedKey || !this.cachedKdf) {
|
|
597
|
+
throw new SecretVaultError("not_unlocked", "Secret vault is locked.");
|
|
598
|
+
}
|
|
599
|
+
return { key: this.cachedKey, kdf: this.cachedKdf };
|
|
600
|
+
}
|
|
601
|
+
async withPayload(operation, write) {
|
|
602
|
+
return withFileLock(this.vaultPath, async () => {
|
|
603
|
+
const environmentBefore = this.activeEnvironmentFingerprint();
|
|
604
|
+
const { key, kdf } = this.requireUnlocked();
|
|
605
|
+
if (!(await lstatIfExists(this.vaultPath))) {
|
|
606
|
+
throw new SecretVaultError("not_initialized", "Secret vault is not initialized.");
|
|
607
|
+
}
|
|
608
|
+
const envelope = parseEnvelope(await readBoundedFile(this.vaultPath));
|
|
609
|
+
if (!sameKdf(kdf, envelope.kdf)) {
|
|
610
|
+
this.lock();
|
|
611
|
+
throw new SecretVaultError("unlock_failed", "Secret vault changed and must be unlocked again.");
|
|
612
|
+
}
|
|
613
|
+
const payload = decryptPayload(envelope.payload, key);
|
|
614
|
+
try {
|
|
615
|
+
const result = await operation(payload);
|
|
616
|
+
if (write)
|
|
617
|
+
await this.writeEnvelope(kdf, payload, key);
|
|
618
|
+
this.refreshSecretCache(payload);
|
|
619
|
+
if (environmentBefore !== this.activeEnvironmentFingerprint())
|
|
620
|
+
this.notifyEnvironmentChanged();
|
|
621
|
+
return result;
|
|
622
|
+
}
|
|
623
|
+
finally {
|
|
624
|
+
scrubPayload(payload);
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
async writeEnvelope(kdf, payload, key) {
|
|
629
|
+
let serialized = serializeEnvelope(kdf, payload, key);
|
|
630
|
+
try {
|
|
631
|
+
await writeFileAtomic(this.vaultPath, serialized, { mode: 0o600 });
|
|
632
|
+
await enforcePrivateFileMode(this.vaultPath);
|
|
633
|
+
}
|
|
634
|
+
finally {
|
|
635
|
+
serialized = "";
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
async removeBoundMaterializations(record) {
|
|
639
|
+
let removed = 0;
|
|
640
|
+
for (const binding of record.bindings) {
|
|
641
|
+
const destination = resolve(binding.workspace, binding.envFile);
|
|
642
|
+
const existing = await lstatIfExists(destination);
|
|
643
|
+
if (!existing)
|
|
644
|
+
continue;
|
|
645
|
+
const state = await this.inspectEnvDestination(destination, record.profile);
|
|
646
|
+
if (state !== "managed-profile")
|
|
647
|
+
continue;
|
|
648
|
+
await fs.unlink(destination);
|
|
649
|
+
removed++;
|
|
650
|
+
}
|
|
651
|
+
return removed;
|
|
652
|
+
}
|
|
653
|
+
async removeManagedMaterialization(profile) {
|
|
654
|
+
const path = this.getManagedEnvPath(profile);
|
|
655
|
+
const existing = await lstatIfExists(path);
|
|
656
|
+
if (!existing)
|
|
657
|
+
return false;
|
|
658
|
+
if (existing.isSymbolicLink()) {
|
|
659
|
+
throw new SecretVaultError("symlink_refused", "Managed dotenv symlinks are refused.");
|
|
660
|
+
}
|
|
661
|
+
if (!existing.isFile()) {
|
|
662
|
+
throw new SecretVaultError("destination_invalid", "Managed dotenv path is not a regular file.");
|
|
663
|
+
}
|
|
664
|
+
const state = await this.inspectEnvDestination(path, profile);
|
|
665
|
+
if (state !== "managed-profile")
|
|
666
|
+
return false;
|
|
667
|
+
await fs.unlink(path);
|
|
668
|
+
return true;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
//# sourceMappingURL=secret-vault.js.map
|