@coool/opencode-adaptive 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +98 -2
- package/dist/adapters/codex-capacity/index.d.ts +5 -0
- package/dist/adapters/codex-capacity/index.d.ts.map +1 -0
- package/dist/adapters/codex-capacity/index.js +5 -0
- package/dist/adapters/codex-capacity/index.js.map +1 -0
- package/dist/adapters/codex-capacity/parse.d.ts +28 -0
- package/dist/adapters/codex-capacity/parse.d.ts.map +1 -0
- package/dist/adapters/codex-capacity/parse.js +130 -0
- package/dist/adapters/codex-capacity/parse.js.map +1 -0
- package/dist/adapters/codex-capacity/reading.d.ts +10 -0
- package/dist/adapters/codex-capacity/reading.d.ts.map +1 -0
- package/dist/adapters/codex-capacity/reading.js +45 -0
- package/dist/adapters/codex-capacity/reading.js.map +1 -0
- package/dist/adapters/codex-capacity/sensor.d.ts +24 -0
- package/dist/adapters/codex-capacity/sensor.d.ts.map +1 -0
- package/dist/adapters/codex-capacity/sensor.js +30 -0
- package/dist/adapters/codex-capacity/sensor.js.map +1 -0
- package/dist/adapters/codex-capacity/types.d.ts +35 -0
- package/dist/adapters/codex-capacity/types.d.ts.map +1 -0
- package/dist/adapters/codex-capacity/types.js +4 -0
- package/dist/adapters/codex-capacity/types.js.map +1 -0
- package/dist/adapters/opencode/escalation-tool.d.ts +52 -0
- package/dist/adapters/opencode/escalation-tool.d.ts.map +1 -0
- package/dist/adapters/opencode/escalation-tool.js +59 -0
- package/dist/adapters/opencode/escalation-tool.js.map +1 -0
- package/dist/adapters/opencode/events.d.ts +24 -0
- package/dist/adapters/opencode/events.d.ts.map +1 -0
- package/dist/adapters/opencode/events.js +68 -0
- package/dist/adapters/opencode/events.js.map +1 -0
- package/dist/adapters/opencode/hooks.d.ts +35 -0
- package/dist/adapters/opencode/hooks.d.ts.map +1 -0
- package/dist/adapters/opencode/hooks.js +12 -0
- package/dist/adapters/opencode/hooks.js.map +1 -0
- package/dist/adapters/opencode/index.d.ts +17 -0
- package/dist/adapters/opencode/index.d.ts.map +1 -0
- package/dist/adapters/opencode/index.js +9 -0
- package/dist/adapters/opencode/index.js.map +1 -0
- package/dist/adapters/opencode/inventory.d.ts +31 -0
- package/dist/adapters/opencode/inventory.d.ts.map +1 -0
- package/dist/adapters/opencode/inventory.js +53 -0
- package/dist/adapters/opencode/inventory.js.map +1 -0
- package/dist/adapters/opencode/report.d.ts +92 -0
- package/dist/adapters/opencode/report.d.ts.map +1 -0
- package/dist/adapters/opencode/report.js +145 -0
- package/dist/adapters/opencode/report.js.map +1 -0
- package/dist/adapters/opencode/session-ops.d.ts +40 -0
- package/dist/adapters/opencode/session-ops.d.ts.map +1 -0
- package/dist/adapters/opencode/session-ops.js +32 -0
- package/dist/adapters/opencode/session-ops.js.map +1 -0
- package/dist/adapters/opencode/storage.d.ts +16 -0
- package/dist/adapters/opencode/storage.d.ts.map +1 -0
- package/dist/adapters/opencode/storage.js +8 -0
- package/dist/adapters/opencode/storage.js.map +1 -0
- package/dist/adapters/opencode/tier-tool.d.ts +38 -0
- package/dist/adapters/opencode/tier-tool.d.ts.map +1 -0
- package/dist/adapters/opencode/tier-tool.js +72 -0
- package/dist/adapters/opencode/tier-tool.js.map +1 -0
- package/dist/adapters/opencode/types.d.ts +102 -0
- package/dist/adapters/opencode/types.d.ts.map +1 -0
- package/dist/adapters/opencode/types.js +2 -0
- package/dist/adapters/opencode/types.js.map +1 -0
- package/dist/core/compatibility/gate.d.ts +10 -0
- package/dist/core/compatibility/gate.d.ts.map +1 -0
- package/dist/core/compatibility/gate.js +55 -0
- package/dist/core/compatibility/gate.js.map +1 -0
- package/dist/core/compatibility/index.d.ts +3 -0
- package/dist/core/compatibility/index.d.ts.map +1 -0
- package/dist/core/compatibility/index.js +3 -0
- package/dist/core/compatibility/index.js.map +1 -0
- package/dist/core/compatibility/types.d.ts +54 -0
- package/dist/core/compatibility/types.d.ts.map +1 -0
- package/dist/core/compatibility/types.js +27 -0
- package/dist/core/compatibility/types.js.map +1 -0
- package/dist/core/scheduler/admit.d.ts +7 -0
- package/dist/core/scheduler/admit.d.ts.map +1 -0
- package/dist/core/scheduler/admit.js +153 -0
- package/dist/core/scheduler/admit.js.map +1 -0
- package/dist/core/scheduler/escalate.d.ts +7 -0
- package/dist/core/scheduler/escalate.d.ts.map +1 -0
- package/dist/core/scheduler/escalate.js +56 -0
- package/dist/core/scheduler/escalate.js.map +1 -0
- package/dist/core/scheduler/index.d.ts +5 -0
- package/dist/core/scheduler/index.d.ts.map +1 -0
- package/dist/core/scheduler/index.js +5 -0
- package/dist/core/scheduler/index.js.map +1 -0
- package/dist/core/scheduler/mode.d.ts +9 -0
- package/dist/core/scheduler/mode.d.ts.map +1 -0
- package/dist/core/scheduler/mode.js +10 -0
- package/dist/core/scheduler/mode.js.map +1 -0
- package/dist/core/scheduler/types.d.ts +143 -0
- package/dist/core/scheduler/types.d.ts.map +1 -0
- package/dist/core/scheduler/types.js +74 -0
- package/dist/core/scheduler/types.js.map +1 -0
- package/dist/core/tier-policy/index.d.ts +4 -0
- package/dist/core/tier-policy/index.d.ts.map +1 -0
- package/dist/core/tier-policy/index.js +4 -0
- package/dist/core/tier-policy/index.js.map +1 -0
- package/dist/core/tier-policy/resolve.d.ts +19 -0
- package/dist/core/tier-policy/resolve.d.ts.map +1 -0
- package/dist/core/tier-policy/resolve.js +52 -0
- package/dist/core/tier-policy/resolve.js.map +1 -0
- package/dist/core/tier-policy/tier-list.d.ts +11 -0
- package/dist/core/tier-policy/tier-list.d.ts.map +1 -0
- package/dist/core/tier-policy/tier-list.js +23 -0
- package/dist/core/tier-policy/tier-list.js.map +1 -0
- package/dist/core/tier-policy/types.d.ts +85 -0
- package/dist/core/tier-policy/types.d.ts.map +1 -0
- package/dist/core/tier-policy/types.js +45 -0
- package/dist/core/tier-policy/types.js.map +1 -0
- package/dist/core/work-unit/index.d.ts +4 -0
- package/dist/core/work-unit/index.d.ts.map +1 -0
- package/dist/core/work-unit/index.js +4 -0
- package/dist/core/work-unit/index.js.map +1 -0
- package/dist/core/work-unit/interruption.d.ts +8 -0
- package/dist/core/work-unit/interruption.d.ts.map +1 -0
- package/dist/core/work-unit/interruption.js +12 -0
- package/dist/core/work-unit/interruption.js.map +1 -0
- package/dist/core/work-unit/tracker.d.ts +46 -0
- package/dist/core/work-unit/tracker.d.ts.map +1 -0
- package/dist/core/work-unit/tracker.js +136 -0
- package/dist/core/work-unit/tracker.js.map +1 -0
- package/dist/core/work-unit/types.d.ts +146 -0
- package/dist/core/work-unit/types.d.ts.map +1 -0
- package/dist/core/work-unit/types.js +23 -0
- package/dist/core/work-unit/types.js.map +1 -0
- package/dist/execution/continuation/execute.d.ts +19 -0
- package/dist/execution/continuation/execute.d.ts.map +1 -0
- package/dist/execution/continuation/execute.js +31 -0
- package/dist/execution/continuation/execute.js.map +1 -0
- package/dist/execution/continuation/index.d.ts +6 -0
- package/dist/execution/continuation/index.d.ts.map +1 -0
- package/dist/execution/continuation/index.js +5 -0
- package/dist/execution/continuation/index.js.map +1 -0
- package/dist/execution/continuation/ledger.d.ts +20 -0
- package/dist/execution/continuation/ledger.d.ts.map +1 -0
- package/dist/execution/continuation/ledger.js +31 -0
- package/dist/execution/continuation/ledger.js.map +1 -0
- package/dist/execution/continuation/plan.d.ts +13 -0
- package/dist/execution/continuation/plan.d.ts.map +1 -0
- package/dist/execution/continuation/plan.js +20 -0
- package/dist/execution/continuation/plan.js.map +1 -0
- package/dist/execution/continuation/prompts.d.ts +8 -0
- package/dist/execution/continuation/prompts.d.ts.map +1 -0
- package/dist/execution/continuation/prompts.js +8 -0
- package/dist/execution/continuation/prompts.js.map +1 -0
- package/dist/execution/continuation/types.d.ts +70 -0
- package/dist/execution/continuation/types.d.ts.map +1 -0
- package/dist/execution/continuation/types.js +15 -0
- package/dist/execution/continuation/types.js.map +1 -0
- package/dist/execution/escalation/index.d.ts +2 -0
- package/dist/execution/escalation/index.d.ts.map +1 -0
- package/dist/execution/escalation/index.js +2 -0
- package/dist/execution/escalation/index.js.map +1 -0
- package/dist/execution/escalation/types.d.ts +31 -0
- package/dist/execution/escalation/types.d.ts.map +1 -0
- package/dist/execution/escalation/types.js +49 -0
- package/dist/execution/escalation/types.js.map +1 -0
- package/dist/execution/index.d.ts +5 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/index.js +5 -0
- package/dist/execution/index.js.map +1 -0
- package/dist/execution/parking/index.d.ts +3 -0
- package/dist/execution/parking/index.d.ts.map +1 -0
- package/dist/execution/parking/index.js +2 -0
- package/dist/execution/parking/index.js.map +1 -0
- package/dist/execution/parking/plan.d.ts +40 -0
- package/dist/execution/parking/plan.d.ts.map +1 -0
- package/dist/execution/parking/plan.js +34 -0
- package/dist/execution/parking/plan.js.map +1 -0
- package/dist/execution/recovery/gate.d.ts +20 -0
- package/dist/execution/recovery/gate.d.ts.map +1 -0
- package/dist/execution/recovery/gate.js +23 -0
- package/dist/execution/recovery/gate.js.map +1 -0
- package/dist/execution/recovery/index.d.ts +3 -0
- package/dist/execution/recovery/index.d.ts.map +1 -0
- package/dist/execution/recovery/index.js +2 -0
- package/dist/execution/recovery/index.js.map +1 -0
- package/dist/execution/retry/decide.d.ts +30 -0
- package/dist/execution/retry/decide.d.ts.map +1 -0
- package/dist/execution/retry/decide.js +76 -0
- package/dist/execution/retry/decide.js.map +1 -0
- package/dist/execution/retry/index.d.ts +3 -0
- package/dist/execution/retry/index.d.ts.map +1 -0
- package/dist/execution/retry/index.js +3 -0
- package/dist/execution/retry/index.js.map +1 -0
- package/dist/execution/retry/types.d.ts +66 -0
- package/dist/execution/retry/types.d.ts.map +1 -0
- package/dist/execution/retry/types.js +9 -0
- package/dist/execution/retry/types.js.map +1 -0
- package/dist/gui-experimental.cjs +1 -0
- package/dist/gui.d.ts +17 -0
- package/dist/gui.d.ts.map +1 -0
- package/dist/gui.js +70 -0
- package/dist/gui.js.map +1 -0
- package/dist/health/capacity/index.d.ts +4 -0
- package/dist/health/capacity/index.d.ts.map +1 -0
- package/dist/health/capacity/index.js +4 -0
- package/dist/health/capacity/index.js.map +1 -0
- package/dist/health/capacity/merge.d.ts +58 -0
- package/dist/health/capacity/merge.d.ts.map +1 -0
- package/dist/health/capacity/merge.js +154 -0
- package/dist/health/capacity/merge.js.map +1 -0
- package/dist/health/capacity/registry.d.ts +41 -0
- package/dist/health/capacity/registry.d.ts.map +1 -0
- package/dist/health/capacity/registry.js +106 -0
- package/dist/health/capacity/registry.js.map +1 -0
- package/dist/health/capacity/types.d.ts +74 -0
- package/dist/health/capacity/types.d.ts.map +1 -0
- package/dist/health/capacity/types.js +6 -0
- package/dist/health/capacity/types.js.map +1 -0
- package/dist/health/circuit-breaker/breaker.d.ts +84 -0
- package/dist/health/circuit-breaker/breaker.d.ts.map +1 -0
- package/dist/health/circuit-breaker/breaker.js +132 -0
- package/dist/health/circuit-breaker/breaker.js.map +1 -0
- package/dist/health/circuit-breaker/index.d.ts +3 -0
- package/dist/health/circuit-breaker/index.d.ts.map +1 -0
- package/dist/health/circuit-breaker/index.js +3 -0
- package/dist/health/circuit-breaker/index.js.map +1 -0
- package/dist/health/circuit-breaker/types.d.ts +53 -0
- package/dist/health/circuit-breaker/types.d.ts.map +1 -0
- package/dist/health/circuit-breaker/types.js +13 -0
- package/dist/health/circuit-breaker/types.js.map +1 -0
- package/dist/health/classifier/classify.d.ts +9 -0
- package/dist/health/classifier/classify.d.ts.map +1 -0
- package/dist/health/classifier/classify.js +245 -0
- package/dist/health/classifier/classify.js.map +1 -0
- package/dist/health/classifier/index.d.ts +3 -0
- package/dist/health/classifier/index.d.ts.map +1 -0
- package/dist/health/classifier/index.js +3 -0
- package/dist/health/classifier/index.js.map +1 -0
- package/dist/health/classifier/types.d.ts +72 -0
- package/dist/health/classifier/types.d.ts.map +1 -0
- package/dist/health/classifier/types.js +27 -0
- package/dist/health/classifier/types.js.map +1 -0
- package/dist/health/index.d.ts +5 -0
- package/dist/health/index.d.ts.map +1 -0
- package/dist/health/index.js +5 -0
- package/dist/health/index.js.map +1 -0
- package/dist/health/resource-health/index.d.ts +5 -0
- package/dist/health/resource-health/index.d.ts.map +1 -0
- package/dist/health/resource-health/index.js +5 -0
- package/dist/health/resource-health/index.js.map +1 -0
- package/dist/health/resource-health/key.d.ts +19 -0
- package/dist/health/resource-health/key.d.ts.map +1 -0
- package/dist/health/resource-health/key.js +54 -0
- package/dist/health/resource-health/key.js.map +1 -0
- package/dist/health/resource-health/registry.d.ts +41 -0
- package/dist/health/resource-health/registry.d.ts.map +1 -0
- package/dist/health/resource-health/registry.js +258 -0
- package/dist/health/resource-health/registry.js.map +1 -0
- package/dist/health/resource-health/transitions.d.ts +11 -0
- package/dist/health/resource-health/transitions.d.ts.map +1 -0
- package/dist/health/resource-health/transitions.js +165 -0
- package/dist/health/resource-health/transitions.js.map +1 -0
- package/dist/health/resource-health/types.d.ts +116 -0
- package/dist/health/resource-health/types.d.ts.map +1 -0
- package/dist/health/resource-health/types.js +43 -0
- package/dist/health/resource-health/types.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +80 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin-id.d.ts +3 -0
- package/dist/plugin-id.d.ts.map +1 -0
- package/dist/plugin-id.js +3 -0
- package/dist/plugin-id.js.map +1 -0
- package/dist/rpc/definition.d.ts +100 -0
- package/dist/rpc/definition.d.ts.map +1 -0
- package/dist/rpc/definition.js +104 -0
- package/dist/rpc/definition.js.map +1 -0
- package/dist/rpc/handlers.d.ts +65 -0
- package/dist/rpc/handlers.d.ts.map +1 -0
- package/dist/rpc/handlers.js +111 -0
- package/dist/rpc/handlers.js.map +1 -0
- package/dist/rpc/status.d.ts +43 -0
- package/dist/rpc/status.d.ts.map +1 -0
- package/dist/rpc/status.js +45 -0
- package/dist/rpc/status.js.map +1 -0
- package/dist/rpc.d.ts +11 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +8 -0
- package/dist/rpc.js.map +1 -0
- package/dist/state/capacity/index.d.ts +4 -0
- package/dist/state/capacity/index.d.ts.map +1 -0
- package/dist/state/capacity/index.js +4 -0
- package/dist/state/capacity/index.js.map +1 -0
- package/dist/state/capacity/parse.d.ts +3 -0
- package/dist/state/capacity/parse.d.ts.map +1 -0
- package/dist/state/capacity/parse.js +110 -0
- package/dist/state/capacity/parse.js.map +1 -0
- package/dist/state/capacity/store.d.ts +19 -0
- package/dist/state/capacity/store.d.ts.map +1 -0
- package/dist/state/capacity/store.js +64 -0
- package/dist/state/capacity/store.js.map +1 -0
- package/dist/state/capacity/types.d.ts +38 -0
- package/dist/state/capacity/types.d.ts.map +1 -0
- package/dist/state/capacity/types.js +11 -0
- package/dist/state/capacity/types.js.map +1 -0
- package/dist/state/health/index.d.ts +5 -0
- package/dist/state/health/index.d.ts.map +1 -0
- package/dist/state/health/index.js +4 -0
- package/dist/state/health/index.js.map +1 -0
- package/dist/state/health/parse.d.ts +3 -0
- package/dist/state/health/parse.d.ts.map +1 -0
- package/dist/state/health/parse.js +121 -0
- package/dist/state/health/parse.js.map +1 -0
- package/dist/state/health/store.d.ts +18 -0
- package/dist/state/health/store.d.ts.map +1 -0
- package/dist/state/health/store.js +55 -0
- package/dist/state/health/store.js.map +1 -0
- package/dist/state/health/types.d.ts +24 -0
- package/dist/state/health/types.d.ts.map +1 -0
- package/dist/state/health/types.js +5 -0
- package/dist/state/health/types.js.map +1 -0
- package/dist/state/parked-work/index.d.ts +5 -0
- package/dist/state/parked-work/index.d.ts.map +1 -0
- package/dist/state/parked-work/index.js +4 -0
- package/dist/state/parked-work/index.js.map +1 -0
- package/dist/state/parked-work/parse.d.ts +7 -0
- package/dist/state/parked-work/parse.d.ts.map +1 -0
- package/dist/state/parked-work/parse.js +83 -0
- package/dist/state/parked-work/parse.js.map +1 -0
- package/dist/state/parked-work/store.d.ts +18 -0
- package/dist/state/parked-work/store.d.ts.map +1 -0
- package/dist/state/parked-work/store.js +81 -0
- package/dist/state/parked-work/store.js.map +1 -0
- package/dist/state/parked-work/types.d.ts +42 -0
- package/dist/state/parked-work/types.d.ts.map +1 -0
- package/dist/state/parked-work/types.js +7 -0
- package/dist/state/parked-work/types.js.map +1 -0
- package/dist/state/receipts/bound.d.ts +15 -0
- package/dist/state/receipts/bound.d.ts.map +1 -0
- package/dist/state/receipts/bound.js +77 -0
- package/dist/state/receipts/bound.js.map +1 -0
- package/dist/state/receipts/index.d.ts +7 -0
- package/dist/state/receipts/index.d.ts.map +1 -0
- package/dist/state/receipts/index.js +5 -0
- package/dist/state/receipts/index.js.map +1 -0
- package/dist/state/receipts/parse.d.ts +7 -0
- package/dist/state/receipts/parse.d.ts.map +1 -0
- package/dist/state/receipts/parse.js +226 -0
- package/dist/state/receipts/parse.js.map +1 -0
- package/dist/state/receipts/store.d.ts +35 -0
- package/dist/state/receipts/store.d.ts.map +1 -0
- package/dist/state/receipts/store.js +128 -0
- package/dist/state/receipts/store.js.map +1 -0
- package/dist/state/receipts/types.d.ts +62 -0
- package/dist/state/receipts/types.d.ts.map +1 -0
- package/dist/state/receipts/types.js +12 -0
- package/dist/state/receipts/types.js.map +1 -0
- package/dist/state/session-modes/index.d.ts +5 -0
- package/dist/state/session-modes/index.d.ts.map +1 -0
- package/dist/state/session-modes/index.js +4 -0
- package/dist/state/session-modes/index.js.map +1 -0
- package/dist/state/session-modes/parse.d.ts +9 -0
- package/dist/state/session-modes/parse.d.ts.map +1 -0
- package/dist/state/session-modes/parse.js +62 -0
- package/dist/state/session-modes/parse.js.map +1 -0
- package/dist/state/session-modes/store.d.ts +21 -0
- package/dist/state/session-modes/store.d.ts.map +1 -0
- package/dist/state/session-modes/store.js +73 -0
- package/dist/state/session-modes/store.js.map +1 -0
- package/dist/state/session-modes/types.d.ts +42 -0
- package/dist/state/session-modes/types.d.ts.map +1 -0
- package/dist/state/session-modes/types.js +7 -0
- package/dist/state/session-modes/types.js.map +1 -0
- package/dist/state/settings/index.d.ts +5 -0
- package/dist/state/settings/index.d.ts.map +1 -0
- package/dist/state/settings/index.js +4 -0
- package/dist/state/settings/index.js.map +1 -0
- package/dist/state/settings/parse.d.ts +34 -0
- package/dist/state/settings/parse.d.ts.map +1 -0
- package/dist/state/settings/parse.js +261 -0
- package/dist/state/settings/parse.js.map +1 -0
- package/dist/state/settings/store.d.ts +22 -0
- package/dist/state/settings/store.d.ts.map +1 -0
- package/dist/state/settings/store.js +57 -0
- package/dist/state/settings/store.js.map +1 -0
- package/dist/state/settings/types.d.ts +63 -0
- package/dist/state/settings/types.d.ts.map +1 -0
- package/dist/state/settings/types.js +12 -0
- package/dist/state/settings/types.js.map +1 -0
- package/dist/supervisor/index.d.ts +5 -0
- package/dist/supervisor/index.d.ts.map +1 -0
- package/dist/supervisor/index.js +4 -0
- package/dist/supervisor/index.js.map +1 -0
- package/dist/supervisor/log.d.ts +11 -0
- package/dist/supervisor/log.d.ts.map +1 -0
- package/dist/supervisor/log.js +14 -0
- package/dist/supervisor/log.js.map +1 -0
- package/dist/supervisor/supervisor.d.ts +69 -0
- package/dist/supervisor/supervisor.d.ts.map +1 -0
- package/dist/supervisor/supervisor.js +1343 -0
- package/dist/supervisor/supervisor.js.map +1 -0
- package/dist/supervisor/types.d.ts +50 -0
- package/dist/supervisor/types.d.ts.map +1 -0
- package/dist/supervisor/types.js +3 -0
- package/dist/supervisor/types.js.map +1 -0
- package/dist/supervisor/view.d.ts +4 -0
- package/dist/supervisor/view.d.ts.map +1 -0
- package/dist/supervisor/view.js +4 -0
- package/dist/supervisor/view.js.map +1 -0
- package/dist/tui.d.ts +16 -0
- package/dist/tui.d.ts.map +1 -0
- package/dist/tui.js +252 -0
- package/dist/tui.js.map +1 -0
- package/dist/ui/gui/api.d.ts +18 -0
- package/dist/ui/gui/api.d.ts.map +1 -0
- package/dist/ui/gui/api.js +21 -0
- package/dist/ui/gui/api.js.map +1 -0
- package/dist/ui/gui/view.d.ts +27 -0
- package/dist/ui/gui/view.d.ts.map +1 -0
- package/dist/ui/gui/view.js +49 -0
- package/dist/ui/gui/view.js.map +1 -0
- package/dist/ui/tui/controller.d.ts +98 -0
- package/dist/ui/tui/controller.d.ts.map +1 -0
- package/dist/ui/tui/controller.js +399 -0
- package/dist/ui/tui/controller.js.map +1 -0
- package/dist/ui/tui/menu.d.ts +56 -0
- package/dist/ui/tui/menu.d.ts.map +1 -0
- package/dist/ui/tui/menu.js +176 -0
- package/dist/ui/tui/menu.js.map +1 -0
- package/dist/ui/tui/options.d.ts +20 -0
- package/dist/ui/tui/options.d.ts.map +1 -0
- package/dist/ui/tui/options.js +17 -0
- package/dist/ui/tui/options.js.map +1 -0
- package/dist/ui/tui/receipts.d.ts +22 -0
- package/dist/ui/tui/receipts.d.ts.map +1 -0
- package/dist/ui/tui/receipts.js +109 -0
- package/dist/ui/tui/receipts.js.map +1 -0
- package/dist/ui/tui/status.d.ts +23 -0
- package/dist/ui/tui/status.d.ts.map +1 -0
- package/dist/ui/tui/status.js +90 -0
- package/dist/ui/tui/status.js.map +1 -0
- package/dist/ui/tui/tiers.d.ts +52 -0
- package/dist/ui/tui/tiers.d.ts.map +1 -0
- package/dist/ui/tui/tiers.js +108 -0
- package/dist/ui/tui/tiers.js.map +1 -0
- package/package.json +85 -4
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const TIERS = ["quick", "standard", "advanced"];
|
|
2
|
+
/**
|
|
3
|
+
* Request kinds the OpenCode `context` hook exposes for the executing
|
|
4
|
+
* request. Auxiliary kinds are trivial host-internal requests (title,
|
|
5
|
+
* compaction, generate) that must not consume an unnecessarily expensive
|
|
6
|
+
* tier — this is structured host evidence, not prompt keyword matching
|
|
7
|
+
* (ADP-004).
|
|
8
|
+
*/
|
|
9
|
+
export const AUXILIARY_KINDS = [
|
|
10
|
+
"compaction",
|
|
11
|
+
"title",
|
|
12
|
+
"generate",
|
|
13
|
+
];
|
|
14
|
+
/** Auxiliary requests route to `quick`. */
|
|
15
|
+
export const AUXILIARY_TIER = "quick";
|
|
16
|
+
/** Unambiguous fallback tier (ADP-002). */
|
|
17
|
+
export const DEFAULT_TIER = "standard";
|
|
18
|
+
/** How an explicit tier request reached the plugin (provenance for receipts). */
|
|
19
|
+
export const TIER_REQUEST_VIAS = [
|
|
20
|
+
"manual-command",
|
|
21
|
+
"session-setting",
|
|
22
|
+
];
|
|
23
|
+
/** Why the ladder produced a tier decision (receipt provenance). */
|
|
24
|
+
export const ROUTING_SOURCES = [
|
|
25
|
+
"pin",
|
|
26
|
+
"tier-request",
|
|
27
|
+
"agent-role",
|
|
28
|
+
"auxiliary-request",
|
|
29
|
+
"ambiguity",
|
|
30
|
+
"default",
|
|
31
|
+
];
|
|
32
|
+
export const DEFER_REASONS = ["tier-not-configured"];
|
|
33
|
+
/** True only for the trivial auxiliary request kinds. */
|
|
34
|
+
export function isAuxiliary(kind) {
|
|
35
|
+
return kind !== "primary";
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Escalation ladder order (GOAL capability escalation): `quick` → `standard`
|
|
39
|
+
* → `advanced`. `advanced` is the last tier — there is no next.
|
|
40
|
+
*/
|
|
41
|
+
export function nextTier(tier) {
|
|
42
|
+
const index = TIERS.indexOf(tier);
|
|
43
|
+
return TIERS[index + 1];
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/tier-policy/types.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAsC,CAAA;AAI3F;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,YAAY;IACZ,OAAO;IACP,UAAU;CAC0B,CAAA;AAMtC,2CAA2C;AAC3C,MAAM,CAAC,MAAM,cAAc,GAAa,OAAO,CAAA;AAE/C,2CAA2C;AAC3C,MAAM,CAAC,MAAM,YAAY,GAAa,UAAU,CAAA;AAEhD,iFAAiF;AACjF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,gBAAgB;IAChB,iBAAiB;CACmB,CAAA;AAiCtC,oEAAoE;AACpE,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,KAAK;IACL,cAAc;IACd,YAAY;IACZ,mBAAmB;IACnB,WAAW;IACX,SAAS;CAC2B,CAAA;AAItC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,qBAAqB,CAAsC,CAAA;AAiBzF,yDAAyD;AACzD,MAAM,UAAU,WAAW,CAAC,IAAiB;IAC3C,OAAO,IAAI,KAAK,SAAS,CAAA;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAc;IACrC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACjC,OAAO,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/work-unit/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/work-unit/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why an OpenCode execution was interrupted. Values mirror the verified
|
|
3
|
+
* `session.execution.interrupted` event payload (`reason`), which OpenCode
|
|
4
|
+
* guarantees to be one of these four.
|
|
5
|
+
*/
|
|
6
|
+
export declare const INTERRUPT_REASONS: readonly ["user", "shutdown", "superseded", "inactivity"];
|
|
7
|
+
export type InterruptReason = (typeof INTERRUPT_REASONS)[number];
|
|
8
|
+
//# sourceMappingURL=interruption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interruption.d.ts","sourceRoot":"","sources":["../../../src/core/work-unit/interruption.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,2DAKQ,CAAA;AAEtC,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why an OpenCode execution was interrupted. Values mirror the verified
|
|
3
|
+
* `session.execution.interrupted` event payload (`reason`), which OpenCode
|
|
4
|
+
* guarantees to be one of these four.
|
|
5
|
+
*/
|
|
6
|
+
export const INTERRUPT_REASONS = [
|
|
7
|
+
"user",
|
|
8
|
+
"shutdown",
|
|
9
|
+
"superseded",
|
|
10
|
+
"inactivity",
|
|
11
|
+
];
|
|
12
|
+
//# sourceMappingURL=interruption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interruption.js","sourceRoot":"","sources":["../../../src/core/work-unit/interruption.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM;IACN,UAAU;IACV,YAAY;IACZ,YAAY;CACwB,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Episode tracker (ADP-001): a deterministic, clock-free state machine over
|
|
3
|
+
* normalized work-unit events, keyed by session. All timestamps come from the
|
|
4
|
+
* events themselves, so behavior is fully reproducible.
|
|
5
|
+
*
|
|
6
|
+
* Self-switch attribution: `session.model.selected` fires for both manual and
|
|
7
|
+
* plugin-made switches. Before performing `session.switchModel` our adapter
|
|
8
|
+
* calls `noteOwnSwitch`; the next `model-selected` event for that session
|
|
9
|
+
* matching the noted reference is attributed `selected-adaptive` and consumes
|
|
10
|
+
* the note. A non-matching selection clears the note, so a stale note can
|
|
11
|
+
* never claim a later user pick — the failure direction is always
|
|
12
|
+
* "our switch looks external" (treated as a manual pick, left alone), never
|
|
13
|
+
* the reverse. At most one note per session is kept: a newer note replaces an
|
|
14
|
+
* unconsumed older one, and the older switch's event (if it ever arrives) is
|
|
15
|
+
* then attributed external — again the safe direction, since the adapter
|
|
16
|
+
* serializes per-session switches.
|
|
17
|
+
*/
|
|
18
|
+
import { type ActiveUnit, type ApplyResult, type ModelRef, type ModelTransition, type OpenedResult, type WorkUnitEvent } from "./types.js";
|
|
19
|
+
export declare class WorkUnitTracker {
|
|
20
|
+
#private;
|
|
21
|
+
/**
|
|
22
|
+
* Arms the pending own-switch note consumed by the next matching
|
|
23
|
+
* `model-selected` event for this session.
|
|
24
|
+
*/
|
|
25
|
+
noteOwnSwitch(sessionID: string, model: ModelRef): void;
|
|
26
|
+
/**
|
|
27
|
+
* Raises each session's episode floor. Used at startup: unit ids are
|
|
28
|
+
* durable keys (`${sessionID}#${episode}`) persisted in receipts and
|
|
29
|
+
* parked work, so after a restart the counters must never re-mint an id
|
|
30
|
+
* a persisted record already carries — a collision would replace parked
|
|
31
|
+
* work and misattribute receipt outcomes.
|
|
32
|
+
*/
|
|
33
|
+
seedEpisodes(seeds: ReadonlyMap<string, number>): void;
|
|
34
|
+
/** Apply an execution-started event; the tracker always opens a unit. */
|
|
35
|
+
apply(event: Extract<WorkUnitEvent, {
|
|
36
|
+
kind: "execution-started";
|
|
37
|
+
}>): OpenedResult;
|
|
38
|
+
apply(event: WorkUnitEvent): ApplyResult;
|
|
39
|
+
/** The open unit for a session, if any. */
|
|
40
|
+
active(sessionID: string): ActiveUnit | undefined;
|
|
41
|
+
/** All currently open units, in insertion order. */
|
|
42
|
+
activeAll(): ActiveUnit[];
|
|
43
|
+
/** Last model known to be in effect for a session, across episodes. */
|
|
44
|
+
lastModel(sessionID: string): ModelTransition | undefined;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=tracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracker.d.ts","sourceRoot":"","sources":["../../../src/core/work-unit/tracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,WAAW,EAEhB,KAAK,QAAQ,EAEb,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAA;AAEnB,qBAAa,eAAe;;IAM1B;;;OAGG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI;IAIvD;;;;;;OAMG;IACH,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAMtD,yEAAyE;IACzE,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE;QAAE,IAAI,EAAE,mBAAmB,CAAA;KAAE,CAAC,GAAG,YAAY;IACjF,KAAK,CAAC,KAAK,EAAE,aAAa,GAAG,WAAW;IA6DxC,2CAA2C;IAC3C,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIjD,oDAAoD;IACpD,SAAS,IAAI,UAAU,EAAE;IAIzB,uEAAuE;IACvE,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;CA4B1D"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Episode tracker (ADP-001): a deterministic, clock-free state machine over
|
|
3
|
+
* normalized work-unit events, keyed by session. All timestamps come from the
|
|
4
|
+
* events themselves, so behavior is fully reproducible.
|
|
5
|
+
*
|
|
6
|
+
* Self-switch attribution: `session.model.selected` fires for both manual and
|
|
7
|
+
* plugin-made switches. Before performing `session.switchModel` our adapter
|
|
8
|
+
* calls `noteOwnSwitch`; the next `model-selected` event for that session
|
|
9
|
+
* matching the noted reference is attributed `selected-adaptive` and consumes
|
|
10
|
+
* the note. A non-matching selection clears the note, so a stale note can
|
|
11
|
+
* never claim a later user pick — the failure direction is always
|
|
12
|
+
* "our switch looks external" (treated as a manual pick, left alone), never
|
|
13
|
+
* the reverse. At most one note per session is kept: a newer note replaces an
|
|
14
|
+
* unconsumed older one, and the older switch's event (if it ever arrives) is
|
|
15
|
+
* then attributed external — again the safe direction, since the adapter
|
|
16
|
+
* serializes per-session switches.
|
|
17
|
+
*/
|
|
18
|
+
import { sameModelRef, } from "./types.js";
|
|
19
|
+
export class WorkUnitTracker {
|
|
20
|
+
#active = new Map();
|
|
21
|
+
#episodes = new Map();
|
|
22
|
+
#lastModel = new Map();
|
|
23
|
+
#pendingOwn = new Map();
|
|
24
|
+
/**
|
|
25
|
+
* Arms the pending own-switch note consumed by the next matching
|
|
26
|
+
* `model-selected` event for this session.
|
|
27
|
+
*/
|
|
28
|
+
noteOwnSwitch(sessionID, model) {
|
|
29
|
+
this.#pendingOwn.set(sessionID, model);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Raises each session's episode floor. Used at startup: unit ids are
|
|
33
|
+
* durable keys (`${sessionID}#${episode}`) persisted in receipts and
|
|
34
|
+
* parked work, so after a restart the counters must never re-mint an id
|
|
35
|
+
* a persisted record already carries — a collision would replace parked
|
|
36
|
+
* work and misattribute receipt outcomes.
|
|
37
|
+
*/
|
|
38
|
+
seedEpisodes(seeds) {
|
|
39
|
+
for (const [sessionID, episode] of seeds) {
|
|
40
|
+
if (episode > (this.#episodes.get(sessionID) ?? 0))
|
|
41
|
+
this.#episodes.set(sessionID, episode);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
apply(event) {
|
|
45
|
+
switch (event.kind) {
|
|
46
|
+
case "execution-started": {
|
|
47
|
+
const previous = this.#active.get(event.sessionID);
|
|
48
|
+
if (previous !== undefined)
|
|
49
|
+
this.#active.delete(event.sessionID);
|
|
50
|
+
// A new execution on a session that still has an active unit means
|
|
51
|
+
// the previous execution was superseded (matches OpenCode's
|
|
52
|
+
// `interrupted{reason:"superseded"}` semantics).
|
|
53
|
+
const superseded = previous && {
|
|
54
|
+
...previous,
|
|
55
|
+
kind: "interrupted",
|
|
56
|
+
closedAt: event.at,
|
|
57
|
+
reason: "superseded",
|
|
58
|
+
};
|
|
59
|
+
const episode = (this.#episodes.get(event.sessionID) ?? 0) + 1;
|
|
60
|
+
this.#episodes.set(event.sessionID, episode);
|
|
61
|
+
const unit = {
|
|
62
|
+
kind: "active",
|
|
63
|
+
id: `${event.sessionID}#${String(episode)}`,
|
|
64
|
+
sessionID: event.sessionID,
|
|
65
|
+
episode,
|
|
66
|
+
startedAt: event.at,
|
|
67
|
+
model: this.#lastModel.get(event.sessionID)?.model,
|
|
68
|
+
transitions: [],
|
|
69
|
+
};
|
|
70
|
+
this.#active.set(event.sessionID, unit);
|
|
71
|
+
return superseded ? { kind: "opened", unit, superseded } : { kind: "opened", unit };
|
|
72
|
+
}
|
|
73
|
+
case "execution-succeeded":
|
|
74
|
+
case "execution-failed":
|
|
75
|
+
case "execution-interrupted": {
|
|
76
|
+
const current = this.#active.get(event.sessionID);
|
|
77
|
+
if (current === undefined)
|
|
78
|
+
return { kind: "ignored", reason: "terminal-without-active-unit" };
|
|
79
|
+
this.#active.delete(event.sessionID);
|
|
80
|
+
const base = { ...current, closedAt: event.at };
|
|
81
|
+
if (event.kind === "execution-succeeded") {
|
|
82
|
+
return { kind: "closed", unit: { ...base, kind: "succeeded" } };
|
|
83
|
+
}
|
|
84
|
+
if (event.kind === "execution-failed") {
|
|
85
|
+
return { kind: "closed", unit: { ...base, kind: "failed", error: event.error } };
|
|
86
|
+
}
|
|
87
|
+
return { kind: "closed", unit: { ...base, kind: "interrupted", reason: event.reason } };
|
|
88
|
+
}
|
|
89
|
+
case "model-selected": {
|
|
90
|
+
const adaptive = this.#consumePendingOwn(event.sessionID, event.model);
|
|
91
|
+
return this.#trackModel(event.sessionID, event.at, event.model, adaptive ? "selected-adaptive" : "selected-external");
|
|
92
|
+
}
|
|
93
|
+
case "model-request":
|
|
94
|
+
// Context-hook observations never consume the pending note: only
|
|
95
|
+
// actual selection events resolve it.
|
|
96
|
+
return this.#trackModel(event.sessionID, event.at, event.model, "request");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/** The open unit for a session, if any. */
|
|
100
|
+
active(sessionID) {
|
|
101
|
+
return this.#active.get(sessionID);
|
|
102
|
+
}
|
|
103
|
+
/** All currently open units, in insertion order. */
|
|
104
|
+
activeAll() {
|
|
105
|
+
return [...this.#active.values()];
|
|
106
|
+
}
|
|
107
|
+
/** Last model known to be in effect for a session, across episodes. */
|
|
108
|
+
lastModel(sessionID) {
|
|
109
|
+
return this.#lastModel.get(sessionID);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Returns whether the pending note matched. The note is consumed on any
|
|
113
|
+
* selection event: matched → `selected-adaptive`; unmatched (or absent) →
|
|
114
|
+
* `selected-external` with the note dropped.
|
|
115
|
+
*/
|
|
116
|
+
#consumePendingOwn(sessionID, model) {
|
|
117
|
+
const pending = this.#pendingOwn.get(sessionID);
|
|
118
|
+
this.#pendingOwn.delete(sessionID);
|
|
119
|
+
return pending !== undefined && sameModelRef(pending, model);
|
|
120
|
+
}
|
|
121
|
+
#trackModel(sessionID, at, model, source) {
|
|
122
|
+
const transition = { at, model, source };
|
|
123
|
+
this.#lastModel.set(sessionID, transition);
|
|
124
|
+
const current = this.#active.get(sessionID);
|
|
125
|
+
if (current === undefined)
|
|
126
|
+
return { kind: "model-noted", transition };
|
|
127
|
+
const unit = {
|
|
128
|
+
...current,
|
|
129
|
+
model,
|
|
130
|
+
transitions: [...current.transitions, transition],
|
|
131
|
+
};
|
|
132
|
+
this.#active.set(sessionID, unit);
|
|
133
|
+
return { kind: "model-tracked", unit, transition };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=tracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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,EAAE,IAAI,EAAE,UAAU,EAAE,CAAA;IACpD,CAAC;CACF"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Work-unit model (ADP-001): one unit is exactly one OpenCode execution
|
|
3
|
+
* episode — `session.execution.started` → `succeeded`/`failed`/`interrupted`.
|
|
4
|
+
* Tool/step/text continuations never open, close, or split a unit (only the
|
|
5
|
+
* execution events do); a subagent runs in its own session and therefore gets
|
|
6
|
+
* its own units; a later continuation on the same session (e.g. a new /goal
|
|
7
|
+
* round) is a new episode of that session.
|
|
8
|
+
*/
|
|
9
|
+
import type { InterruptReason } from "./interruption.js";
|
|
10
|
+
/** OpenCode model reference (`Model.Ref`): provider, model, optional variant. */
|
|
11
|
+
export interface ModelRef {
|
|
12
|
+
readonly providerID: string;
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly variant?: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
/** Full-field equality; a variant change is a different reference. */
|
|
17
|
+
export declare function sameModelRef(a: ModelRef, b: ModelRef): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* How the model in effect became known. `selected-*` comes from the
|
|
20
|
+
* `session.model.selected` event (which fires for both manual and
|
|
21
|
+
* plugin-made switches — the tracker resolves which via pending own-switch
|
|
22
|
+
* notes, see `WorkUnitTracker.noteOwnSwitch`); `request` comes from the
|
|
23
|
+
* `context` hook and reports the model actually executing.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MODEL_SOURCES: readonly ["selected-adaptive", "selected-external", "request"];
|
|
26
|
+
export type ModelSource = (typeof MODEL_SOURCES)[number];
|
|
27
|
+
export interface ModelTransition {
|
|
28
|
+
readonly at: number;
|
|
29
|
+
readonly model: ModelRef;
|
|
30
|
+
readonly source: ModelSource;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Minimal shape of the wire `Session.StructuredError` carried by
|
|
34
|
+
* `session.execution.failed` (`response.body` is deliberately dropped here —
|
|
35
|
+
* the adapter folds it into bounded `ErrorEvidence` for the classifier).
|
|
36
|
+
*/
|
|
37
|
+
export interface ExecutionError {
|
|
38
|
+
readonly type: string;
|
|
39
|
+
readonly message: string;
|
|
40
|
+
readonly status?: number | undefined;
|
|
41
|
+
readonly retryAfterMs?: number | undefined;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The episode lifecycle. `kind` doubles as status: `"active"` while the
|
|
45
|
+
* execution runs, then the terminal kind it closed with.
|
|
46
|
+
*/
|
|
47
|
+
interface UnitBase {
|
|
48
|
+
/** Stable per-episode identifier: `${sessionID}#${episode}`. */
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly sessionID: string;
|
|
51
|
+
/** 1-based count of episodes started for this session (tracker lifetime). */
|
|
52
|
+
readonly episode: number;
|
|
53
|
+
readonly startedAt: number;
|
|
54
|
+
/**
|
|
55
|
+
* Model in effect for the unit: seeded from the last known selection when
|
|
56
|
+
* the unit opens, then updated by transitions.
|
|
57
|
+
*/
|
|
58
|
+
readonly model?: ModelRef | undefined;
|
|
59
|
+
readonly transitions: readonly ModelTransition[];
|
|
60
|
+
}
|
|
61
|
+
export interface ActiveUnit extends UnitBase {
|
|
62
|
+
readonly kind: "active";
|
|
63
|
+
}
|
|
64
|
+
export interface SucceededUnit extends UnitBase {
|
|
65
|
+
readonly kind: "succeeded";
|
|
66
|
+
readonly closedAt: number;
|
|
67
|
+
}
|
|
68
|
+
export interface FailedUnit extends UnitBase {
|
|
69
|
+
readonly kind: "failed";
|
|
70
|
+
readonly closedAt: number;
|
|
71
|
+
readonly error: ExecutionError;
|
|
72
|
+
}
|
|
73
|
+
export interface InterruptedUnit extends UnitBase {
|
|
74
|
+
readonly kind: "interrupted";
|
|
75
|
+
readonly closedAt: number;
|
|
76
|
+
readonly reason: InterruptReason;
|
|
77
|
+
}
|
|
78
|
+
export type ClosedUnit = SucceededUnit | FailedUnit | InterruptedUnit;
|
|
79
|
+
export type WorkUnit = ActiveUnit | ClosedUnit;
|
|
80
|
+
/**
|
|
81
|
+
* Normalized episode events. The OpenCode adapter unwraps host event payloads
|
|
82
|
+
* (`event.data.*`) and forwards them here; `model-request` is fed from the
|
|
83
|
+
* `context` session hook.
|
|
84
|
+
*/
|
|
85
|
+
export type WorkUnitEvent = {
|
|
86
|
+
readonly kind: "execution-started";
|
|
87
|
+
readonly sessionID: string;
|
|
88
|
+
readonly at: number;
|
|
89
|
+
} | {
|
|
90
|
+
readonly kind: "execution-succeeded";
|
|
91
|
+
readonly sessionID: string;
|
|
92
|
+
readonly at: number;
|
|
93
|
+
} | {
|
|
94
|
+
readonly kind: "execution-failed";
|
|
95
|
+
readonly sessionID: string;
|
|
96
|
+
readonly at: number;
|
|
97
|
+
readonly error: ExecutionError;
|
|
98
|
+
} | {
|
|
99
|
+
readonly kind: "execution-interrupted";
|
|
100
|
+
readonly sessionID: string;
|
|
101
|
+
readonly at: number;
|
|
102
|
+
readonly reason: InterruptReason;
|
|
103
|
+
} | {
|
|
104
|
+
readonly kind: "model-selected";
|
|
105
|
+
readonly sessionID: string;
|
|
106
|
+
readonly at: number;
|
|
107
|
+
readonly model: ModelRef;
|
|
108
|
+
} | {
|
|
109
|
+
readonly kind: "model-request";
|
|
110
|
+
readonly sessionID: string;
|
|
111
|
+
readonly at: number;
|
|
112
|
+
readonly model: ModelRef;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Why an event produced no state change. Only terminal events can be ignored
|
|
116
|
+
* — they arrive without an active unit when the terminal was already handled
|
|
117
|
+
* (duplicate delivery) or never preceded by `execution-started`.
|
|
118
|
+
*/
|
|
119
|
+
export declare const IGNORED_REASONS: readonly ["terminal-without-active-unit"];
|
|
120
|
+
export type IgnoredReason = (typeof IGNORED_REASONS)[number];
|
|
121
|
+
/** Result of an execution-started event: the tracker always opens (possibly superseding). */
|
|
122
|
+
export type OpenedResult = Extract<ApplyResult, {
|
|
123
|
+
kind: "opened";
|
|
124
|
+
}>;
|
|
125
|
+
export type ApplyResult = {
|
|
126
|
+
readonly kind: "opened";
|
|
127
|
+
readonly unit: ActiveUnit;
|
|
128
|
+
readonly superseded?: ClosedUnit | undefined;
|
|
129
|
+
} | {
|
|
130
|
+
readonly kind: "closed";
|
|
131
|
+
readonly unit: ClosedUnit;
|
|
132
|
+
} | {
|
|
133
|
+
readonly kind: "model-tracked";
|
|
134
|
+
readonly unit: ActiveUnit;
|
|
135
|
+
readonly transition: ModelTransition;
|
|
136
|
+
}
|
|
137
|
+
/** Model knowledge recorded with no active unit; remembered for the next admission. */
|
|
138
|
+
| {
|
|
139
|
+
readonly kind: "model-noted";
|
|
140
|
+
readonly transition: ModelTransition;
|
|
141
|
+
} | {
|
|
142
|
+
readonly kind: "ignored";
|
|
143
|
+
readonly reason: IgnoredReason;
|
|
144
|
+
};
|
|
145
|
+
export {};
|
|
146
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/work-unit/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,iFAAiF;AACjF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACtC;AAED,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,GAAG,OAAO,CAE9D;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,gEAIY,CAAA;AAEtC,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA;AAExD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,K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QAAQ,CAAA;CACzB,CAAA;AAEL;;;;GAIG;AACH,eAAO,MAAM,eAAe,2CAAwE,CAAA;AAEpG,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAE5D,6FAA6F;AAC7F,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAA;AAEnE,MAAM,MAAM,WAAW,GACnB;IACE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;CAC7C,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GACtD;IACE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;IAC9B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAA;CACrC;AACH,uFAAuF;GACrF;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAA;CAAE,GACtE;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;CAAE,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Full-field equality; a variant change is a different reference. */
|
|
2
|
+
export function sameModelRef(a, b) {
|
|
3
|
+
return a.providerID === b.providerID && a.id === b.id && a.variant === b.variant;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* How the model in effect became known. `selected-*` comes from the
|
|
7
|
+
* `session.model.selected` event (which fires for both manual and
|
|
8
|
+
* plugin-made switches — the tracker resolves which via pending own-switch
|
|
9
|
+
* notes, see `WorkUnitTracker.noteOwnSwitch`); `request` comes from the
|
|
10
|
+
* `context` hook and reports the model actually executing.
|
|
11
|
+
*/
|
|
12
|
+
export const MODEL_SOURCES = [
|
|
13
|
+
"selected-adaptive",
|
|
14
|
+
"selected-external",
|
|
15
|
+
"request",
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Why an event produced no state change. Only terminal events can be ignored
|
|
19
|
+
* — they arrive without an active unit when the terminal was already handled
|
|
20
|
+
* (duplicate delivery) or never preceded by `execution-started`.
|
|
21
|
+
*/
|
|
22
|
+
export const IGNORED_REASONS = ["terminal-without-active-unit"];
|
|
23
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/work-unit/types.ts"],"names":[],"mappings":"AAiBA,sEAAsE;AACtE,MAAM,UAAU,YAAY,CAAC,CAAW,EAAE,CAAW;IACnD,OAAO,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,CAAA;AAClF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,mBAAmB;IACnB,mBAAmB;IACnB,SAAS;CAC2B,CAAA;AAmGtC;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,8BAA8B,CAAsC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ContinuationOutcome } from "./types.js";
|
|
2
|
+
import type { ContinuationExecuteInput } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Executes a planned continuation through the narrow ops seam, enforcing
|
|
5
|
+
* the partial-work invariants in one place (ADP-014/ADP-023):
|
|
6
|
+
*
|
|
7
|
+
* 1. Every owned path settles the session FIRST — Adaptive never switches
|
|
8
|
+
* or prompts while a failed execution is still settling.
|
|
9
|
+
* 2. The delivered prompt is always the fixed continuation prompt over the
|
|
10
|
+
* existing session/workspace state — the original instruction is never
|
|
11
|
+
* re-sent, so the never-replay invariant holds by construction.
|
|
12
|
+
* 3. `allow-native` performs no host operations at all.
|
|
13
|
+
*
|
|
14
|
+
* Ops failures propagate to the caller (the wiring's fail-open wrapper
|
|
15
|
+
* decides degradation); the ordering guarantee holds up to the first
|
|
16
|
+
* failure because each step awaits the previous one.
|
|
17
|
+
*/
|
|
18
|
+
export declare function executeContinuation(input: ContinuationExecuteInput): Promise<ContinuationOutcome>;
|
|
19
|
+
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/execution/continuation/execute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAE1D;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,mBAAmB,CAAC,CAY9B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CONTINUATION_PROMPT } from "./prompts.js";
|
|
2
|
+
/**
|
|
3
|
+
* Executes a planned continuation through the narrow ops seam, enforcing
|
|
4
|
+
* the partial-work invariants in one place (ADP-014/ADP-023):
|
|
5
|
+
*
|
|
6
|
+
* 1. Every owned path settles the session FIRST — Adaptive never switches
|
|
7
|
+
* or prompts while a failed execution is still settling.
|
|
8
|
+
* 2. The delivered prompt is always the fixed continuation prompt over the
|
|
9
|
+
* existing session/workspace state — the original instruction is never
|
|
10
|
+
* re-sent, so the never-replay invariant holds by construction.
|
|
11
|
+
* 3. `allow-native` performs no host operations at all.
|
|
12
|
+
*
|
|
13
|
+
* Ops failures propagate to the caller (the wiring's fail-open wrapper
|
|
14
|
+
* decides degradation); the ordering guarantee holds up to the first
|
|
15
|
+
* failure because each step awaits the previous one.
|
|
16
|
+
*/
|
|
17
|
+
export async function executeContinuation(input) {
|
|
18
|
+
const { action, ops, sessionID } = input;
|
|
19
|
+
if (action.kind === "allow-native")
|
|
20
|
+
return { kind: "left-native" };
|
|
21
|
+
if (action.kind === "in-session") {
|
|
22
|
+
await ops.settle(sessionID);
|
|
23
|
+
await ops.switchModel(sessionID, action.model);
|
|
24
|
+
await ops.prompt(sessionID, CONTINUATION_PROMPT);
|
|
25
|
+
return { kind: "resumed" };
|
|
26
|
+
}
|
|
27
|
+
await ops.settle(sessionID);
|
|
28
|
+
await ops.prompt(sessionID, CONTINUATION_PROMPT);
|
|
29
|
+
return { kind: "continuation-started" };
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=execute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../src/execution/continuation/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAIlD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,KAA+B;IAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,KAAK,CAAA;IACxC,IAAI,MAAM,CAAC,IAAI,KAAK,cAAc;QAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,CAAA;IAClE,IAAI,MAAM,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QACjC,MAAM,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;QAC3B,MAAM,GAAG,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;QAC9C,MAAM,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QAChD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;IAC5B,CAAC;IACD,MAAM,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAC3B,MAAM,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;IAChD,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAA;AACzC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { CONTINUATION_ACTIONS } from "./types.js";
|
|
2
|
+
export type { ContinuationAction, ContinuationActionKind, ContinuationExecuteInput, ContinuationOps, ContinuationOutcome, ContinuationPlanInput, } from "./types.js";
|
|
3
|
+
export { CONTINUATION_PROMPT } from "./prompts.js";
|
|
4
|
+
export { planContinuation } from "./plan.js";
|
|
5
|
+
export { executeContinuation } from "./execute.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/execution/continuation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACjD,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/execution/continuation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AASjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracks which work units have accumulated tool side effects (ADP-014).
|
|
3
|
+
* The adapter marks units as tool events stream through; the continuation
|
|
4
|
+
* planner and executor consult the ledger to pick the prompt strategy and
|
|
5
|
+
* to prove the never-replay invariant. The wiring forgets a unit's entry
|
|
6
|
+
* when the unit closes, so the ledger stays bounded by live units — the
|
|
7
|
+
* same memory model as the work-unit tracker (leaked units are memory-only
|
|
8
|
+
* and bounded by host sessions).
|
|
9
|
+
*/
|
|
10
|
+
export declare class SideEffectLedger {
|
|
11
|
+
#private;
|
|
12
|
+
/** Record that the unit has tool side effects. Idempotent. */
|
|
13
|
+
mark(unitID: string): void;
|
|
14
|
+
had(unitID: string): boolean;
|
|
15
|
+
/** Drop the unit's entry (call when the unit closes and is evaluated). */
|
|
16
|
+
forget(unitID: string): void;
|
|
17
|
+
/** Drop every entry for a session (unit IDs are `${sessionID}#episode`). */
|
|
18
|
+
forgetSession(sessionID: string): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger.d.ts","sourceRoot":"","sources":["../../../src/execution/continuation/ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,qBAAa,gBAAgB;;IAG3B,8DAA8D;IAC9D,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI1B,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAI5B,0EAA0E;IAC1E,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI5B,4EAA4E;IAC5E,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;CAKvC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracks which work units have accumulated tool side effects (ADP-014).
|
|
3
|
+
* The adapter marks units as tool events stream through; the continuation
|
|
4
|
+
* planner and executor consult the ledger to pick the prompt strategy and
|
|
5
|
+
* to prove the never-replay invariant. The wiring forgets a unit's entry
|
|
6
|
+
* when the unit closes, so the ledger stays bounded by live units — the
|
|
7
|
+
* same memory model as the work-unit tracker (leaked units are memory-only
|
|
8
|
+
* and bounded by host sessions).
|
|
9
|
+
*/
|
|
10
|
+
export class SideEffectLedger {
|
|
11
|
+
#marked = new Map();
|
|
12
|
+
/** Record that the unit has tool side effects. Idempotent. */
|
|
13
|
+
mark(unitID) {
|
|
14
|
+
this.#marked.set(unitID, true);
|
|
15
|
+
}
|
|
16
|
+
had(unitID) {
|
|
17
|
+
return this.#marked.has(unitID);
|
|
18
|
+
}
|
|
19
|
+
/** Drop the unit's entry (call when the unit closes and is evaluated). */
|
|
20
|
+
forget(unitID) {
|
|
21
|
+
this.#marked.delete(unitID);
|
|
22
|
+
}
|
|
23
|
+
/** Drop every entry for a session (unit IDs are `${sessionID}#episode`). */
|
|
24
|
+
forgetSession(sessionID) {
|
|
25
|
+
for (const unitID of this.#marked.keys()) {
|
|
26
|
+
if (unitID.startsWith(`${sessionID}#`))
|
|
27
|
+
this.#marked.delete(unitID);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../../src/execution/continuation/ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,OAAO,gBAAgB;IAClB,OAAO,GAAG,IAAI,GAAG,EAAgB,CAAA;IAE1C,8DAA8D;IAC9D,IAAI,CAAC,MAAc;QACjB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAChC,CAAC;IAED,GAAG,CAAC,MAAc;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IACjC,CAAC;IAED,0EAA0E;IAC1E,MAAM,CAAC,MAAc;QACnB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC;IAED,4EAA4E;IAC5E,aAAa,CAAC,SAAiB;QAC7B,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YACzC,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,SAAS,GAAG,CAAC;gBAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACrE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ContinuationAction, ContinuationPlanInput } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Partial-work safety planner (ADP-023). Total, deterministic, pure.
|
|
4
|
+
*
|
|
5
|
+
* - No owned recovery: OpenCode's native retry is the preferred recovery;
|
|
6
|
+
* Adaptive leaves it alone.
|
|
7
|
+
* - Owned recovery and the in-session path is possible: continue the same
|
|
8
|
+
* session on the recovered candidate (settle → switch → resume).
|
|
9
|
+
* - Owned recovery and the in-session path is impossible: start a clean
|
|
10
|
+
* continuation work unit from existing durable session state.
|
|
11
|
+
*/
|
|
12
|
+
export declare function planContinuation(input: ContinuationPlanInput): ContinuationAction;
|
|
13
|
+
//# sourceMappingURL=plan.d.ts.map
|