usesteady 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +186 -0
- package/README.md +724 -0
- package/bin/use-steady.js +13 -0
- package/dist/server-store.d.ts +68 -0
- package/dist/server-store.d.ts.map +1 -0
- package/dist/server-store.js +133 -0
- package/dist/server-store.js.map +1 -0
- package/dist/server.d.ts +35 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +569 -0
- package/dist/server.js.map +1 -0
- package/dist/src/claude/adapters/api-adapter.d.ts +99 -0
- package/dist/src/claude/adapters/api-adapter.d.ts.map +1 -0
- package/dist/src/claude/adapters/api-adapter.js +415 -0
- package/dist/src/claude/adapters/api-adapter.js.map +1 -0
- package/dist/src/claude/adapters/stub-adapter.d.ts +73 -0
- package/dist/src/claude/adapters/stub-adapter.d.ts.map +1 -0
- package/dist/src/claude/adapters/stub-adapter.js +114 -0
- package/dist/src/claude/adapters/stub-adapter.js.map +1 -0
- package/dist/src/claude/artifact-mapper.d.ts +85 -0
- package/dist/src/claude/artifact-mapper.d.ts.map +1 -0
- package/dist/src/claude/artifact-mapper.js +187 -0
- package/dist/src/claude/artifact-mapper.js.map +1 -0
- package/dist/src/claude/delivery-gate.d.ts +136 -0
- package/dist/src/claude/delivery-gate.d.ts.map +1 -0
- package/dist/src/claude/delivery-gate.js +231 -0
- package/dist/src/claude/delivery-gate.js.map +1 -0
- package/dist/src/claude/index.d.ts +24 -0
- package/dist/src/claude/index.d.ts.map +1 -0
- package/dist/src/claude/index.js +23 -0
- package/dist/src/claude/index.js.map +1 -0
- package/dist/src/claude/types.d.ts +223 -0
- package/dist/src/claude/types.d.ts.map +1 -0
- package/dist/src/claude/types.js +64 -0
- package/dist/src/claude/types.js.map +1 -0
- package/dist/src/control/compiler.d.ts +125 -0
- package/dist/src/control/compiler.d.ts.map +1 -0
- package/dist/src/control/compiler.js +179 -0
- package/dist/src/control/compiler.js.map +1 -0
- package/dist/src/control/constraints.d.ts +42 -0
- package/dist/src/control/constraints.d.ts.map +1 -0
- package/dist/src/control/constraints.js +116 -0
- package/dist/src/control/constraints.js.map +1 -0
- package/dist/src/control/drift-detector.d.ts +49 -0
- package/dist/src/control/drift-detector.d.ts.map +1 -0
- package/dist/src/control/drift-detector.js +115 -0
- package/dist/src/control/drift-detector.js.map +1 -0
- package/dist/src/control/index.d.ts +44 -0
- package/dist/src/control/index.d.ts.map +1 -0
- package/dist/src/control/index.js +40 -0
- package/dist/src/control/index.js.map +1 -0
- package/dist/src/control/types.d.ts +144 -0
- package/dist/src/control/types.d.ts.map +1 -0
- package/dist/src/control/types.js +57 -0
- package/dist/src/control/types.js.map +1 -0
- package/dist/src/cursor/adapters/inprocess-adapter.d.ts +78 -0
- package/dist/src/cursor/adapters/inprocess-adapter.d.ts.map +1 -0
- package/dist/src/cursor/adapters/inprocess-adapter.js +308 -0
- package/dist/src/cursor/adapters/inprocess-adapter.js.map +1 -0
- package/dist/src/cursor/adapters/stub-adapter.d.ts +75 -0
- package/dist/src/cursor/adapters/stub-adapter.d.ts.map +1 -0
- package/dist/src/cursor/adapters/stub-adapter.js +120 -0
- package/dist/src/cursor/adapters/stub-adapter.js.map +1 -0
- package/dist/src/cursor/artifact-mapper.d.ts +81 -0
- package/dist/src/cursor/artifact-mapper.d.ts.map +1 -0
- package/dist/src/cursor/artifact-mapper.js +203 -0
- package/dist/src/cursor/artifact-mapper.js.map +1 -0
- package/dist/src/cursor/delivery-gate.d.ts +144 -0
- package/dist/src/cursor/delivery-gate.d.ts.map +1 -0
- package/dist/src/cursor/delivery-gate.js +208 -0
- package/dist/src/cursor/delivery-gate.js.map +1 -0
- package/dist/src/cursor/glob-matcher.d.ts +30 -0
- package/dist/src/cursor/glob-matcher.d.ts.map +1 -0
- package/dist/src/cursor/glob-matcher.js +68 -0
- package/dist/src/cursor/glob-matcher.js.map +1 -0
- package/dist/src/cursor/index.d.ts +43 -0
- package/dist/src/cursor/index.d.ts.map +1 -0
- package/dist/src/cursor/index.js +44 -0
- package/dist/src/cursor/index.js.map +1 -0
- package/dist/src/cursor/ocd-evaluator.d.ts +89 -0
- package/dist/src/cursor/ocd-evaluator.d.ts.map +1 -0
- package/dist/src/cursor/ocd-evaluator.js +142 -0
- package/dist/src/cursor/ocd-evaluator.js.map +1 -0
- package/dist/src/cursor/types.d.ts +309 -0
- package/dist/src/cursor/types.d.ts.map +1 -0
- package/dist/src/cursor/types.js +48 -0
- package/dist/src/cursor/types.js.map +1 -0
- package/dist/src/execution/claude/claude-execution-coordinator.d.ts +164 -0
- package/dist/src/execution/claude/claude-execution-coordinator.d.ts.map +1 -0
- package/dist/src/execution/claude/claude-execution-coordinator.js +198 -0
- package/dist/src/execution/claude/claude-execution-coordinator.js.map +1 -0
- package/dist/src/execution/claude/index.d.ts +13 -0
- package/dist/src/execution/claude/index.d.ts.map +1 -0
- package/dist/src/execution/claude/index.js +12 -0
- package/dist/src/execution/claude/index.js.map +1 -0
- package/dist/src/execution/cursor/cursor-execution-coordinator.d.ts +216 -0
- package/dist/src/execution/cursor/cursor-execution-coordinator.d.ts.map +1 -0
- package/dist/src/execution/cursor/cursor-execution-coordinator.js +233 -0
- package/dist/src/execution/cursor/cursor-execution-coordinator.js.map +1 -0
- package/dist/src/execution/cursor/index.d.ts +20 -0
- package/dist/src/execution/cursor/index.d.ts.map +1 -0
- package/dist/src/execution/cursor/index.js +18 -0
- package/dist/src/execution/cursor/index.js.map +1 -0
- package/dist/src/execution/reminders/index.d.ts +11 -0
- package/dist/src/execution/reminders/index.d.ts.map +1 -0
- package/dist/src/execution/reminders/index.js +9 -0
- package/dist/src/execution/reminders/index.js.map +1 -0
- package/dist/src/execution/reminders/reminder-execution-coordinator.d.ts +125 -0
- package/dist/src/execution/reminders/reminder-execution-coordinator.d.ts.map +1 -0
- package/dist/src/execution/reminders/reminder-execution-coordinator.js +129 -0
- package/dist/src/execution/reminders/reminder-execution-coordinator.js.map +1 -0
- package/dist/src/execution/reminders/reminder-execution-types.d.ts +161 -0
- package/dist/src/execution/reminders/reminder-execution-types.d.ts.map +1 -0
- package/dist/src/execution/reminders/reminder-execution-types.js +39 -0
- package/dist/src/execution/reminders/reminder-execution-types.js.map +1 -0
- package/dist/src/execution/reminders/reminder-execution-validator.d.ts +45 -0
- package/dist/src/execution/reminders/reminder-execution-validator.d.ts.map +1 -0
- package/dist/src/execution/reminders/reminder-execution-validator.js +92 -0
- package/dist/src/execution/reminders/reminder-execution-validator.js.map +1 -0
- package/dist/src/execution/reminders/reminder-executor.d.ts +62 -0
- package/dist/src/execution/reminders/reminder-executor.d.ts.map +1 -0
- package/dist/src/execution/reminders/reminder-executor.js +113 -0
- package/dist/src/execution/reminders/reminder-executor.js.map +1 -0
- package/dist/src/execution/reminders/reminder-time-parser.d.ts +41 -0
- package/dist/src/execution/reminders/reminder-time-parser.d.ts.map +1 -0
- package/dist/src/execution/reminders/reminder-time-parser.js +113 -0
- package/dist/src/execution/reminders/reminder-time-parser.js.map +1 -0
- package/dist/src/friction/auto-capture.d.ts +38 -0
- package/dist/src/friction/auto-capture.d.ts.map +1 -0
- package/dist/src/friction/auto-capture.js +133 -0
- package/dist/src/friction/auto-capture.js.map +1 -0
- package/dist/src/friction/client.d.ts +39 -0
- package/dist/src/friction/client.d.ts.map +1 -0
- package/dist/src/friction/client.js +165 -0
- package/dist/src/friction/client.js.map +1 -0
- package/dist/src/friction/config.d.ts +16 -0
- package/dist/src/friction/config.d.ts.map +1 -0
- package/dist/src/friction/config.js +56 -0
- package/dist/src/friction/config.js.map +1 -0
- package/dist/src/friction/github-auth.d.ts +41 -0
- package/dist/src/friction/github-auth.d.ts.map +1 -0
- package/dist/src/friction/github-auth.js +155 -0
- package/dist/src/friction/github-auth.js.map +1 -0
- package/dist/src/friction/github-issues.d.ts +51 -0
- package/dist/src/friction/github-issues.d.ts.map +1 -0
- package/dist/src/friction/github-issues.js +118 -0
- package/dist/src/friction/github-issues.js.map +1 -0
- package/dist/src/friction/payout-ledger.d.ts +45 -0
- package/dist/src/friction/payout-ledger.d.ts.map +1 -0
- package/dist/src/friction/payout-ledger.js +111 -0
- package/dist/src/friction/payout-ledger.js.map +1 -0
- package/dist/src/friction/queue.d.ts +42 -0
- package/dist/src/friction/queue.d.ts.map +1 -0
- package/dist/src/friction/queue.js +179 -0
- package/dist/src/friction/queue.js.map +1 -0
- package/dist/src/friction/reviewer.d.ts +42 -0
- package/dist/src/friction/reviewer.d.ts.map +1 -0
- package/dist/src/friction/reviewer.js +269 -0
- package/dist/src/friction/reviewer.js.map +1 -0
- package/dist/src/friction/types.d.ts +63 -0
- package/dist/src/friction/types.d.ts.map +1 -0
- package/dist/src/friction/types.js +18 -0
- package/dist/src/friction/types.js.map +1 -0
- package/dist/src/history/index.d.ts +39 -0
- package/dist/src/history/index.d.ts.map +1 -0
- package/dist/src/history/index.js +41 -0
- package/dist/src/history/index.js.map +1 -0
- package/dist/src/history/session-chain.d.ts +36 -0
- package/dist/src/history/session-chain.d.ts.map +1 -0
- package/dist/src/history/session-chain.js +91 -0
- package/dist/src/history/session-chain.js.map +1 -0
- package/dist/src/history/types.d.ts +130 -0
- package/dist/src/history/types.d.ts.map +1 -0
- package/dist/src/history/types.js +32 -0
- package/dist/src/history/types.js.map +1 -0
- package/dist/src/history/workflow-history.d.ts +48 -0
- package/dist/src/history/workflow-history.d.ts.map +1 -0
- package/dist/src/history/workflow-history.js +116 -0
- package/dist/src/history/workflow-history.js.map +1 -0
- package/dist/src/index.d.ts +88 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +58 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/intake/classify-intent-state.d.ts +20 -0
- package/dist/src/intake/classify-intent-state.d.ts.map +1 -0
- package/dist/src/intake/classify-intent-state.js +29 -0
- package/dist/src/intake/classify-intent-state.js.map +1 -0
- package/dist/src/intake/intake-service.d.ts +105 -0
- package/dist/src/intake/intake-service.d.ts.map +1 -0
- package/dist/src/intake/intake-service.js +407 -0
- package/dist/src/intake/intake-service.js.map +1 -0
- package/dist/src/intake/response-planner.d.ts +25 -0
- package/dist/src/intake/response-planner.d.ts.map +1 -0
- package/dist/src/intake/response-planner.js +52 -0
- package/dist/src/intake/response-planner.js.map +1 -0
- package/dist/src/intake/signal-extractor.d.ts +25 -0
- package/dist/src/intake/signal-extractor.d.ts.map +1 -0
- package/dist/src/intake/signal-extractor.js +42 -0
- package/dist/src/intake/signal-extractor.js.map +1 -0
- package/dist/src/intake/trace.d.ts +157 -0
- package/dist/src/intake/trace.d.ts.map +1 -0
- package/dist/src/intake/trace.js +38 -0
- package/dist/src/intake/trace.js.map +1 -0
- package/dist/src/intake/types.d.ts +70 -0
- package/dist/src/intake/types.d.ts.map +1 -0
- package/dist/src/intake/types.js +30 -0
- package/dist/src/intake/types.js.map +1 -0
- package/dist/src/interaction/defaults.d.ts +12 -0
- package/dist/src/interaction/defaults.d.ts.map +1 -0
- package/dist/src/interaction/defaults.js +26 -0
- package/dist/src/interaction/defaults.js.map +1 -0
- package/dist/src/interaction/guidance-order.d.ts +53 -0
- package/dist/src/interaction/guidance-order.d.ts.map +1 -0
- package/dist/src/interaction/guidance-order.js +131 -0
- package/dist/src/interaction/guidance-order.js.map +1 -0
- package/dist/src/interaction/observe.d.ts +57 -0
- package/dist/src/interaction/observe.d.ts.map +1 -0
- package/dist/src/interaction/observe.js +77 -0
- package/dist/src/interaction/observe.js.map +1 -0
- package/dist/src/interaction/selectors.d.ts +16 -0
- package/dist/src/interaction/selectors.d.ts.map +1 -0
- package/dist/src/interaction/selectors.js +23 -0
- package/dist/src/interaction/selectors.js.map +1 -0
- package/dist/src/interaction/types.d.ts +105 -0
- package/dist/src/interaction/types.d.ts.map +1 -0
- package/dist/src/interaction/types.js +48 -0
- package/dist/src/interaction/types.js.map +1 -0
- package/dist/src/interaction/updater.d.ts +22 -0
- package/dist/src/interaction/updater.d.ts.map +1 -0
- package/dist/src/interaction/updater.js +87 -0
- package/dist/src/interaction/updater.js.map +1 -0
- package/dist/src/present/boundary-explanation/boundary-explanation-detector.d.ts +48 -0
- package/dist/src/present/boundary-explanation/boundary-explanation-detector.d.ts.map +1 -0
- package/dist/src/present/boundary-explanation/boundary-explanation-detector.js +107 -0
- package/dist/src/present/boundary-explanation/boundary-explanation-detector.js.map +1 -0
- package/dist/src/present/boundary-explanation/boundary-explanation-types.d.ts +43 -0
- package/dist/src/present/boundary-explanation/boundary-explanation-types.d.ts.map +1 -0
- package/dist/src/present/boundary-explanation/boundary-explanation-types.js +20 -0
- package/dist/src/present/boundary-explanation/boundary-explanation-types.js.map +1 -0
- package/dist/src/present/boundary-explanation/index.d.ts +10 -0
- package/dist/src/present/boundary-explanation/index.d.ts.map +1 -0
- package/dist/src/present/boundary-explanation/index.js +2 -0
- package/dist/src/present/boundary-explanation/index.js.map +1 -0
- package/dist/src/present/control-visibility/control-visibility-assertions.d.ts +70 -0
- package/dist/src/present/control-visibility/control-visibility-assertions.d.ts.map +1 -0
- package/dist/src/present/control-visibility/control-visibility-assertions.js +138 -0
- package/dist/src/present/control-visibility/control-visibility-assertions.js.map +1 -0
- package/dist/src/present/control-visibility/control-visibility-evaluator.d.ts +67 -0
- package/dist/src/present/control-visibility/control-visibility-evaluator.d.ts.map +1 -0
- package/dist/src/present/control-visibility/control-visibility-evaluator.js +146 -0
- package/dist/src/present/control-visibility/control-visibility-evaluator.js.map +1 -0
- package/dist/src/present/control-visibility/control-visibility-types.d.ts +113 -0
- package/dist/src/present/control-visibility/control-visibility-types.d.ts.map +1 -0
- package/dist/src/present/control-visibility/control-visibility-types.js +24 -0
- package/dist/src/present/control-visibility/control-visibility-types.js.map +1 -0
- package/dist/src/present/control-visibility/index.d.ts +16 -0
- package/dist/src/present/control-visibility/index.d.ts.map +1 -0
- package/dist/src/present/control-visibility/index.js +15 -0
- package/dist/src/present/control-visibility/index.js.map +1 -0
- package/dist/src/present/format.d.ts +57 -0
- package/dist/src/present/format.d.ts.map +1 -0
- package/dist/src/present/format.js +150 -0
- package/dist/src/present/format.js.map +1 -0
- package/dist/src/present/present-coordinator.d.ts +153 -0
- package/dist/src/present/present-coordinator.d.ts.map +1 -0
- package/dist/src/present/present-coordinator.js +213 -0
- package/dist/src/present/present-coordinator.js.map +1 -0
- package/dist/src/present/reminders/index.d.ts +22 -0
- package/dist/src/present/reminders/index.d.ts.map +1 -0
- package/dist/src/present/reminders/index.js +22 -0
- package/dist/src/present/reminders/index.js.map +1 -0
- package/dist/src/present/reminders/reminder-presenter.d.ts +76 -0
- package/dist/src/present/reminders/reminder-presenter.d.ts.map +1 -0
- package/dist/src/present/reminders/reminder-presenter.js +359 -0
- package/dist/src/present/reminders/reminder-presenter.js.map +1 -0
- package/dist/src/present/reminders/reminder-renderer.d.ts +82 -0
- package/dist/src/present/reminders/reminder-renderer.d.ts.map +1 -0
- package/dist/src/present/reminders/reminder-renderer.js +136 -0
- package/dist/src/present/reminders/reminder-renderer.js.map +1 -0
- package/dist/src/present/reminders/reminder-types.d.ts +131 -0
- package/dist/src/present/reminders/reminder-types.d.ts.map +1 -0
- package/dist/src/present/reminders/reminder-types.js +29 -0
- package/dist/src/present/reminders/reminder-types.js.map +1 -0
- package/dist/src/present/types.d.ts +114 -0
- package/dist/src/present/types.d.ts.map +1 -0
- package/dist/src/present/types.js +18 -0
- package/dist/src/present/types.js.map +1 -0
- package/dist/src/product/claude-product-session.d.ts +146 -0
- package/dist/src/product/claude-product-session.d.ts.map +1 -0
- package/dist/src/product/claude-product-session.js +362 -0
- package/dist/src/product/claude-product-session.js.map +1 -0
- package/dist/src/product/cursor-product-session.d.ts +211 -0
- package/dist/src/product/cursor-product-session.d.ts.map +1 -0
- package/dist/src/product/cursor-product-session.js +390 -0
- package/dist/src/product/cursor-product-session.js.map +1 -0
- package/dist/src/product/index.d.ts +28 -0
- package/dist/src/product/index.d.ts.map +1 -0
- package/dist/src/product/index.js +22 -0
- package/dist/src/product/index.js.map +1 -0
- package/dist/src/product/session-resilience/index.d.ts +17 -0
- package/dist/src/product/session-resilience/index.d.ts.map +1 -0
- package/dist/src/product/session-resilience/index.js +15 -0
- package/dist/src/product/session-resilience/index.js.map +1 -0
- package/dist/src/product/session-resilience/session-serializer.d.ts +43 -0
- package/dist/src/product/session-resilience/session-serializer.d.ts.map +1 -0
- package/dist/src/product/session-resilience/session-serializer.js +84 -0
- package/dist/src/product/session-resilience/session-serializer.js.map +1 -0
- package/dist/src/product/session-resilience/session-snapshot-types.d.ts +35 -0
- package/dist/src/product/session-resilience/session-snapshot-types.d.ts.map +1 -0
- package/dist/src/product/session-resilience/session-snapshot-types.js +21 -0
- package/dist/src/product/session-resilience/session-snapshot-types.js.map +1 -0
- package/dist/src/product/session-resilience/session-staleness.d.ts +54 -0
- package/dist/src/product/session-resilience/session-staleness.d.ts.map +1 -0
- package/dist/src/product/session-resilience/session-staleness.js +62 -0
- package/dist/src/product/session-resilience/session-staleness.js.map +1 -0
- package/dist/src/product/session-resilience/session-summary.d.ts +40 -0
- package/dist/src/product/session-resilience/session-summary.d.ts.map +1 -0
- package/dist/src/product/session-resilience/session-summary.js +72 -0
- package/dist/src/product/session-resilience/session-summary.js.map +1 -0
- package/dist/src/prv/patterns.d.ts +32 -0
- package/dist/src/prv/patterns.d.ts.map +1 -0
- package/dist/src/prv/patterns.js +40 -0
- package/dist/src/prv/patterns.js.map +1 -0
- package/dist/src/prv/prv.d.ts +13 -0
- package/dist/src/prv/prv.d.ts.map +1 -0
- package/dist/src/prv/prv.js +22 -0
- package/dist/src/prv/prv.js.map +1 -0
- package/dist/src/prv/types.d.ts +26 -0
- package/dist/src/prv/types.d.ts.map +1 -0
- package/dist/src/prv/types.js +15 -0
- package/dist/src/prv/types.js.map +1 -0
- package/dist/src/safety/detectors/arbitrary-exec.detector.d.ts +3 -0
- package/dist/src/safety/detectors/arbitrary-exec.detector.d.ts.map +1 -0
- package/dist/src/safety/detectors/arbitrary-exec.detector.js +31 -0
- package/dist/src/safety/detectors/arbitrary-exec.detector.js.map +1 -0
- package/dist/src/safety/detectors/bulk-data-exfil.detector.d.ts +21 -0
- package/dist/src/safety/detectors/bulk-data-exfil.detector.d.ts.map +1 -0
- package/dist/src/safety/detectors/bulk-data-exfil.detector.js +90 -0
- package/dist/src/safety/detectors/bulk-data-exfil.detector.js.map +1 -0
- package/dist/src/safety/detectors/destructive.detector.d.ts +3 -0
- package/dist/src/safety/detectors/destructive.detector.d.ts.map +1 -0
- package/dist/src/safety/detectors/destructive.detector.js +28 -0
- package/dist/src/safety/detectors/destructive.detector.js.map +1 -0
- package/dist/src/safety/detectors/evasion.detector.d.ts +3 -0
- package/dist/src/safety/detectors/evasion.detector.d.ts.map +1 -0
- package/dist/src/safety/detectors/evasion.detector.js +28 -0
- package/dist/src/safety/detectors/evasion.detector.js.map +1 -0
- package/dist/src/safety/detectors/secret-access.detector.d.ts +31 -0
- package/dist/src/safety/detectors/secret-access.detector.d.ts.map +1 -0
- package/dist/src/safety/detectors/secret-access.detector.js +78 -0
- package/dist/src/safety/detectors/secret-access.detector.js.map +1 -0
- package/dist/src/safety/registry.d.ts +9 -0
- package/dist/src/safety/registry.d.ts.map +1 -0
- package/dist/src/safety/registry.js +22 -0
- package/dist/src/safety/registry.js.map +1 -0
- package/dist/src/safety/safety-gate.d.ts +16 -0
- package/dist/src/safety/safety-gate.d.ts.map +1 -0
- package/dist/src/safety/safety-gate.js +26 -0
- package/dist/src/safety/safety-gate.js.map +1 -0
- package/dist/src/safety/types.d.ts +35 -0
- package/dist/src/safety/types.d.ts.map +1 -0
- package/dist/src/safety/types.js +14 -0
- package/dist/src/safety/types.js.map +1 -0
- package/dist/src/shell/claude-shell.d.ts +63 -0
- package/dist/src/shell/claude-shell.d.ts.map +1 -0
- package/dist/src/shell/claude-shell.js +81 -0
- package/dist/src/shell/claude-shell.js.map +1 -0
- package/dist/src/shell/cli/friction-admin.d.ts +14 -0
- package/dist/src/shell/cli/friction-admin.d.ts.map +1 -0
- package/dist/src/shell/cli/friction-admin.js +276 -0
- package/dist/src/shell/cli/friction-admin.js.map +1 -0
- package/dist/src/shell/cli/friction-report.d.ts +16 -0
- package/dist/src/shell/cli/friction-report.d.ts.map +1 -0
- package/dist/src/shell/cli/friction-report.js +156 -0
- package/dist/src/shell/cli/friction-report.js.map +1 -0
- package/dist/src/shell/cli/main.d.ts +68 -0
- package/dist/src/shell/cli/main.d.ts.map +1 -0
- package/dist/src/shell/cli/main.js +488 -0
- package/dist/src/shell/cli/main.js.map +1 -0
- package/dist/src/shell/cli/use-steady.d.ts +26 -0
- package/dist/src/shell/cli/use-steady.d.ts.map +1 -0
- package/dist/src/shell/cli/use-steady.js +117 -0
- package/dist/src/shell/cli/use-steady.js.map +1 -0
- package/dist/src/shell/cursor-shell.d.ts +63 -0
- package/dist/src/shell/cursor-shell.d.ts.map +1 -0
- package/dist/src/shell/cursor-shell.js +88 -0
- package/dist/src/shell/cursor-shell.js.map +1 -0
- package/dist/src/shell/defaults.d.ts +51 -0
- package/dist/src/shell/defaults.d.ts.map +1 -0
- package/dist/src/shell/defaults.js +78 -0
- package/dist/src/shell/defaults.js.map +1 -0
- package/dist/src/shell/history-render.d.ts +56 -0
- package/dist/src/shell/history-render.d.ts.map +1 -0
- package/dist/src/shell/history-render.js +166 -0
- package/dist/src/shell/history-render.js.map +1 -0
- package/dist/src/shell/index.d.ts +43 -0
- package/dist/src/shell/index.d.ts.map +1 -0
- package/dist/src/shell/index.js +45 -0
- package/dist/src/shell/index.js.map +1 -0
- package/dist/src/shell/render.d.ts +42 -0
- package/dist/src/shell/render.d.ts.map +1 -0
- package/dist/src/shell/render.js +122 -0
- package/dist/src/shell/render.js.map +1 -0
- package/dist/src/shell/types.d.ts +46 -0
- package/dist/src/shell/types.d.ts.map +1 -0
- package/dist/src/shell/types.js +19 -0
- package/dist/src/shell/types.js.map +1 -0
- package/dist/src/shell/workflow-defaults.d.ts +23 -0
- package/dist/src/shell/workflow-defaults.d.ts.map +1 -0
- package/dist/src/shell/workflow-defaults.js +27 -0
- package/dist/src/shell/workflow-defaults.js.map +1 -0
- package/dist/src/shell/workflow-render.d.ts +54 -0
- package/dist/src/shell/workflow-render.d.ts.map +1 -0
- package/dist/src/shell/workflow-render.js +319 -0
- package/dist/src/shell/workflow-render.js.map +1 -0
- package/dist/src/shell/workflow-shell.d.ts +110 -0
- package/dist/src/shell/workflow-shell.d.ts.map +1 -0
- package/dist/src/shell/workflow-shell.js +180 -0
- package/dist/src/shell/workflow-shell.js.map +1 -0
- package/dist/src/skills/audit.d.ts +118 -0
- package/dist/src/skills/audit.d.ts.map +1 -0
- package/dist/src/skills/audit.js +147 -0
- package/dist/src/skills/audit.js.map +1 -0
- package/dist/src/skills/invocation.d.ts +131 -0
- package/dist/src/skills/invocation.d.ts.map +1 -0
- package/dist/src/skills/invocation.js +165 -0
- package/dist/src/skills/invocation.js.map +1 -0
- package/dist/src/skills/loader.d.ts +70 -0
- package/dist/src/skills/loader.d.ts.map +1 -0
- package/dist/src/skills/loader.js +220 -0
- package/dist/src/skills/loader.js.map +1 -0
- package/dist/src/skills/local-recovery-adapter.d.ts +49 -0
- package/dist/src/skills/local-recovery-adapter.d.ts.map +1 -0
- package/dist/src/skills/local-recovery-adapter.js +184 -0
- package/dist/src/skills/local-recovery-adapter.js.map +1 -0
- package/dist/src/skills/parser.d.ts +53 -0
- package/dist/src/skills/parser.d.ts.map +1 -0
- package/dist/src/skills/parser.js +336 -0
- package/dist/src/skills/parser.js.map +1 -0
- package/dist/src/skills/registry.d.ts +123 -0
- package/dist/src/skills/registry.d.ts.map +1 -0
- package/dist/src/skills/registry.js +144 -0
- package/dist/src/skills/registry.js.map +1 -0
- package/dist/src/skills/types.d.ts +242 -0
- package/dist/src/skills/types.d.ts.map +1 -0
- package/dist/src/skills/types.js +50 -0
- package/dist/src/skills/types.js.map +1 -0
- package/dist/src/skills/validator.d.ts +31 -0
- package/dist/src/skills/validator.d.ts.map +1 -0
- package/dist/src/skills/validator.js +366 -0
- package/dist/src/skills/validator.js.map +1 -0
- package/dist/src/ucp/envelope.d.ts +165 -0
- package/dist/src/ucp/envelope.d.ts.map +1 -0
- package/dist/src/ucp/envelope.js +241 -0
- package/dist/src/ucp/envelope.js.map +1 -0
- package/dist/src/ucp/hashes.d.ts +36 -0
- package/dist/src/ucp/hashes.d.ts.map +1 -0
- package/dist/src/ucp/hashes.js +59 -0
- package/dist/src/ucp/hashes.js.map +1 -0
- package/dist/src/ucp/mappers/map-artifact.d.ts +58 -0
- package/dist/src/ucp/mappers/map-artifact.d.ts.map +1 -0
- package/dist/src/ucp/mappers/map-artifact.js +51 -0
- package/dist/src/ucp/mappers/map-artifact.js.map +1 -0
- package/dist/src/ucp/mappers/map-change-interpretation.d.ts +12 -0
- package/dist/src/ucp/mappers/map-change-interpretation.d.ts.map +1 -0
- package/dist/src/ucp/mappers/map-change-interpretation.js +18 -0
- package/dist/src/ucp/mappers/map-change-interpretation.js.map +1 -0
- package/dist/src/ucp/mappers/map-completion.d.ts +10 -0
- package/dist/src/ucp/mappers/map-completion.d.ts.map +1 -0
- package/dist/src/ucp/mappers/map-completion.js +24 -0
- package/dist/src/ucp/mappers/map-completion.js.map +1 -0
- package/dist/src/ucp/mappers/map-context.d.ts +9 -0
- package/dist/src/ucp/mappers/map-context.d.ts.map +1 -0
- package/dist/src/ucp/mappers/map-context.js +13 -0
- package/dist/src/ucp/mappers/map-context.js.map +1 -0
- package/dist/src/ucp/mappers/map-debug-trace.d.ts +10 -0
- package/dist/src/ucp/mappers/map-debug-trace.d.ts.map +1 -0
- package/dist/src/ucp/mappers/map-debug-trace.js +18 -0
- package/dist/src/ucp/mappers/map-debug-trace.js.map +1 -0
- package/dist/src/ucp/mappers/map-disambiguation.d.ts +10 -0
- package/dist/src/ucp/mappers/map-disambiguation.d.ts.map +1 -0
- package/dist/src/ucp/mappers/map-disambiguation.js +21 -0
- package/dist/src/ucp/mappers/map-disambiguation.js.map +1 -0
- package/dist/src/ucp/mappers/map-execution-trace.d.ts +64 -0
- package/dist/src/ucp/mappers/map-execution-trace.d.ts.map +1 -0
- package/dist/src/ucp/mappers/map-execution-trace.js +57 -0
- package/dist/src/ucp/mappers/map-execution-trace.js.map +1 -0
- package/dist/src/ucp/mappers/map-intent-interpretation.d.ts +11 -0
- package/dist/src/ucp/mappers/map-intent-interpretation.d.ts.map +1 -0
- package/dist/src/ucp/mappers/map-intent-interpretation.js +17 -0
- package/dist/src/ucp/mappers/map-intent-interpretation.js.map +1 -0
- package/dist/src/ucp/mappers/map-intent.d.ts +9 -0
- package/dist/src/ucp/mappers/map-intent.d.ts.map +1 -0
- package/dist/src/ucp/mappers/map-intent.js +11 -0
- package/dist/src/ucp/mappers/map-intent.js.map +1 -0
- package/dist/src/ucp/mappers/map-prv.d.ts +10 -0
- package/dist/src/ucp/mappers/map-prv.d.ts.map +1 -0
- package/dist/src/ucp/mappers/map-prv.js +14 -0
- package/dist/src/ucp/mappers/map-prv.js.map +1 -0
- package/dist/src/ucp/mappers/map-reminder-execution.d.ts +57 -0
- package/dist/src/ucp/mappers/map-reminder-execution.d.ts.map +1 -0
- package/dist/src/ucp/mappers/map-reminder-execution.js +69 -0
- package/dist/src/ucp/mappers/map-reminder-execution.js.map +1 -0
- package/dist/src/ucp/mappers/map-replay-report.d.ts +81 -0
- package/dist/src/ucp/mappers/map-replay-report.d.ts.map +1 -0
- package/dist/src/ucp/mappers/map-replay-report.js +76 -0
- package/dist/src/ucp/mappers/map-replay-report.js.map +1 -0
- package/dist/src/ucp/mappers/map-response.d.ts +13 -0
- package/dist/src/ucp/mappers/map-response.d.ts.map +1 -0
- package/dist/src/ucp/mappers/map-response.js +25 -0
- package/dist/src/ucp/mappers/map-response.js.map +1 -0
- package/dist/src/ucp/mappers/map-safety.d.ts +14 -0
- package/dist/src/ucp/mappers/map-safety.d.ts.map +1 -0
- package/dist/src/ucp/mappers/map-safety.js +22 -0
- package/dist/src/ucp/mappers/map-safety.js.map +1 -0
- package/dist/src/ucp/persistence/index.d.ts +24 -0
- package/dist/src/ucp/persistence/index.d.ts.map +1 -0
- package/dist/src/ucp/persistence/index.js +22 -0
- package/dist/src/ucp/persistence/index.js.map +1 -0
- package/dist/src/ucp/persistence/query.d.ts +164 -0
- package/dist/src/ucp/persistence/query.d.ts.map +1 -0
- package/dist/src/ucp/persistence/query.js +240 -0
- package/dist/src/ucp/persistence/query.js.map +1 -0
- package/dist/src/ucp/persistence/reader.d.ts +43 -0
- package/dist/src/ucp/persistence/reader.d.ts.map +1 -0
- package/dist/src/ucp/persistence/reader.js +104 -0
- package/dist/src/ucp/persistence/reader.js.map +1 -0
- package/dist/src/ucp/persistence/store.d.ts +77 -0
- package/dist/src/ucp/persistence/store.d.ts.map +1 -0
- package/dist/src/ucp/persistence/store.js +177 -0
- package/dist/src/ucp/persistence/store.js.map +1 -0
- package/dist/src/ucp/persistence/write.d.ts +48 -0
- package/dist/src/ucp/persistence/write.d.ts.map +1 -0
- package/dist/src/ucp/persistence/write.js +59 -0
- package/dist/src/ucp/persistence/write.js.map +1 -0
- package/dist/src/ucp/projection.d.ts +146 -0
- package/dist/src/ucp/projection.d.ts.map +1 -0
- package/dist/src/ucp/projection.js +139 -0
- package/dist/src/ucp/projection.js.map +1 -0
- package/dist/src/ucp/types.d.ts +585 -0
- package/dist/src/ucp/types.d.ts.map +1 -0
- package/dist/src/ucp/types.js +57 -0
- package/dist/src/ucp/types.js.map +1 -0
- package/dist/src/understand/completion/completion.d.ts +26 -0
- package/dist/src/understand/completion/completion.d.ts.map +1 -0
- package/dist/src/understand/completion/completion.js +45 -0
- package/dist/src/understand/completion/completion.js.map +1 -0
- package/dist/src/understand/completion/rules.d.ts +61 -0
- package/dist/src/understand/completion/rules.d.ts.map +1 -0
- package/dist/src/understand/completion/rules.js +268 -0
- package/dist/src/understand/completion/rules.js.map +1 -0
- package/dist/src/understand/completion/types.d.ts +68 -0
- package/dist/src/understand/completion/types.d.ts.map +1 -0
- package/dist/src/understand/completion/types.js +34 -0
- package/dist/src/understand/completion/types.js.map +1 -0
- package/dist/src/understand/context/context-alignment.d.ts +18 -0
- package/dist/src/understand/context/context-alignment.d.ts.map +1 -0
- package/dist/src/understand/context/context-alignment.js +61 -0
- package/dist/src/understand/context/context-alignment.js.map +1 -0
- package/dist/src/understand/context/types.d.ts +20 -0
- package/dist/src/understand/context/types.d.ts.map +1 -0
- package/dist/src/understand/context/types.js +13 -0
- package/dist/src/understand/context/types.js.map +1 -0
- package/dist/src/understand/disambiguation/detectors/missing-context.detector.d.ts +12 -0
- package/dist/src/understand/disambiguation/detectors/missing-context.detector.d.ts.map +1 -0
- package/dist/src/understand/disambiguation/detectors/missing-context.detector.js +60 -0
- package/dist/src/understand/disambiguation/detectors/missing-context.detector.js.map +1 -0
- package/dist/src/understand/disambiguation/detectors/overloaded-term.detector.d.ts +13 -0
- package/dist/src/understand/disambiguation/detectors/overloaded-term.detector.d.ts.map +1 -0
- package/dist/src/understand/disambiguation/detectors/overloaded-term.detector.js +57 -0
- package/dist/src/understand/disambiguation/detectors/overloaded-term.detector.js.map +1 -0
- package/dist/src/understand/disambiguation/detectors/typo-adjacent.detector.d.ts +16 -0
- package/dist/src/understand/disambiguation/detectors/typo-adjacent.detector.d.ts.map +1 -0
- package/dist/src/understand/disambiguation/detectors/typo-adjacent.detector.js +56 -0
- package/dist/src/understand/disambiguation/detectors/typo-adjacent.detector.js.map +1 -0
- package/dist/src/understand/disambiguation/registry.d.ts +14 -0
- package/dist/src/understand/disambiguation/registry.d.ts.map +1 -0
- package/dist/src/understand/disambiguation/registry.js +27 -0
- package/dist/src/understand/disambiguation/registry.js.map +1 -0
- package/dist/src/understand/disambiguation/types.d.ts +34 -0
- package/dist/src/understand/disambiguation/types.d.ts.map +1 -0
- package/dist/src/understand/disambiguation/types.js +15 -0
- package/dist/src/understand/disambiguation/types.js.map +1 -0
- package/dist/src/understand/intent-interpretation/intent-interpretation.d.ts +86 -0
- package/dist/src/understand/intent-interpretation/intent-interpretation.d.ts.map +1 -0
- package/dist/src/understand/intent-interpretation/intent-interpretation.js +141 -0
- package/dist/src/understand/intent-interpretation/intent-interpretation.js.map +1 -0
- package/dist/src/understand/intent-interpretation/interpreters/color-intent.interpreter.d.ts +33 -0
- package/dist/src/understand/intent-interpretation/interpreters/color-intent.interpreter.d.ts.map +1 -0
- package/dist/src/understand/intent-interpretation/interpreters/color-intent.interpreter.js +66 -0
- package/dist/src/understand/intent-interpretation/interpreters/color-intent.interpreter.js.map +1 -0
- package/dist/src/understand/intent-interpretation/interpreters/config-intent.interpreter.d.ts +20 -0
- package/dist/src/understand/intent-interpretation/interpreters/config-intent.interpreter.d.ts.map +1 -0
- package/dist/src/understand/intent-interpretation/interpreters/config-intent.interpreter.js +80 -0
- package/dist/src/understand/intent-interpretation/interpreters/config-intent.interpreter.js.map +1 -0
- package/dist/src/understand/intent-interpretation/interpreters/text-intent.interpreter.d.ts +25 -0
- package/dist/src/understand/intent-interpretation/interpreters/text-intent.interpreter.d.ts.map +1 -0
- package/dist/src/understand/intent-interpretation/interpreters/text-intent.interpreter.js +47 -0
- package/dist/src/understand/intent-interpretation/interpreters/text-intent.interpreter.js.map +1 -0
- package/dist/src/understand/intent-interpretation/interpreters/workflow-intent.interpreter.d.ts +35 -0
- package/dist/src/understand/intent-interpretation/interpreters/workflow-intent.interpreter.d.ts.map +1 -0
- package/dist/src/understand/intent-interpretation/interpreters/workflow-intent.interpreter.js +89 -0
- package/dist/src/understand/intent-interpretation/interpreters/workflow-intent.interpreter.js.map +1 -0
- package/dist/src/understand/intent-interpretation/registry.d.ts +18 -0
- package/dist/src/understand/intent-interpretation/registry.d.ts.map +1 -0
- package/dist/src/understand/intent-interpretation/registry.js +26 -0
- package/dist/src/understand/intent-interpretation/registry.js.map +1 -0
- package/dist/src/understand/intent-interpretation/types.d.ts +83 -0
- package/dist/src/understand/intent-interpretation/types.d.ts.map +1 -0
- package/dist/src/understand/intent-interpretation/types.js +40 -0
- package/dist/src/understand/intent-interpretation/types.js.map +1 -0
- package/dist/src/understand/interpretation/intent.d.ts +72 -0
- package/dist/src/understand/interpretation/intent.d.ts.map +1 -0
- package/dist/src/understand/interpretation/intent.js +414 -0
- package/dist/src/understand/interpretation/intent.js.map +1 -0
- package/dist/src/understand/interpretation/interpretation.d.ts +26 -0
- package/dist/src/understand/interpretation/interpretation.d.ts.map +1 -0
- package/dist/src/understand/interpretation/interpretation.js +43 -0
- package/dist/src/understand/interpretation/interpretation.js.map +1 -0
- package/dist/src/understand/interpretation/parser.d.ts +20 -0
- package/dist/src/understand/interpretation/parser.d.ts.map +1 -0
- package/dist/src/understand/interpretation/parser.js +88 -0
- package/dist/src/understand/interpretation/parser.js.map +1 -0
- package/dist/src/understand/interpretation/rules.d.ts +19 -0
- package/dist/src/understand/interpretation/rules.d.ts.map +1 -0
- package/dist/src/understand/interpretation/rules.js +222 -0
- package/dist/src/understand/interpretation/rules.js.map +1 -0
- package/dist/src/understand/interpretation/types.d.ts +90 -0
- package/dist/src/understand/interpretation/types.d.ts.map +1 -0
- package/dist/src/understand/interpretation/types.js +29 -0
- package/dist/src/understand/interpretation/types.js.map +1 -0
- package/dist/src/understand/shared/types.d.ts +13 -0
- package/dist/src/understand/shared/types.d.ts.map +1 -0
- package/dist/src/understand/shared/types.js +9 -0
- package/dist/src/understand/shared/types.js.map +1 -0
- package/dist/src/understand/silent-guidance/index.d.ts +4 -0
- package/dist/src/understand/silent-guidance/index.d.ts.map +1 -0
- package/dist/src/understand/silent-guidance/index.js +3 -0
- package/dist/src/understand/silent-guidance/index.js.map +1 -0
- package/dist/src/understand/silent-guidance/selector.d.ts +44 -0
- package/dist/src/understand/silent-guidance/selector.d.ts.map +1 -0
- package/dist/src/understand/silent-guidance/selector.js +158 -0
- package/dist/src/understand/silent-guidance/selector.js.map +1 -0
- package/dist/src/understand/silent-guidance/templates.d.ts +31 -0
- package/dist/src/understand/silent-guidance/templates.d.ts.map +1 -0
- package/dist/src/understand/silent-guidance/templates.js +109 -0
- package/dist/src/understand/silent-guidance/templates.js.map +1 -0
- package/dist/src/understand/silent-guidance/types.d.ts +36 -0
- package/dist/src/understand/silent-guidance/types.d.ts.map +1 -0
- package/dist/src/understand/silent-guidance/types.js +2 -0
- package/dist/src/understand/silent-guidance/types.js.map +1 -0
- package/dist/src/workflow/coordinator.d.ts +197 -0
- package/dist/src/workflow/coordinator.d.ts.map +1 -0
- package/dist/src/workflow/coordinator.js +682 -0
- package/dist/src/workflow/coordinator.js.map +1 -0
- package/dist/src/workflow/index.d.ts +30 -0
- package/dist/src/workflow/index.d.ts.map +1 -0
- package/dist/src/workflow/index.js +30 -0
- package/dist/src/workflow/index.js.map +1 -0
- package/dist/src/workflow/types.d.ts +213 -0
- package/dist/src/workflow/types.d.ts.map +1 -0
- package/dist/src/workflow/types.js +27 -0
- package/dist/src/workflow/types.js.map +1 -0
- package/package.json +54 -0
- package/ui/README.md +73 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor In-Process Adapter — first real CursorEditorPlugin implementation.
|
|
3
|
+
*
|
|
4
|
+
* ── What this is ───────────────────────────────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* This is the mechanism-agnostic contract made concrete.
|
|
7
|
+
* No IPC, no external process, no network — pure filesystem reads and writes.
|
|
8
|
+
*
|
|
9
|
+
* It applies parsedChange (oldValue -> newValue in filePath) directly using
|
|
10
|
+
* Node.js fs. It is the simplest valid real adapter and proves the contract
|
|
11
|
+
* works outside of a stub.
|
|
12
|
+
*
|
|
13
|
+
* ── Three paths this adapter exercises ────────────────────────────────────────
|
|
14
|
+
*
|
|
15
|
+
* Path A (accepted):
|
|
16
|
+
* - parsedChange is present
|
|
17
|
+
* - target file is readable and within allowedFiles (if non-empty)
|
|
18
|
+
* - oldValue appears exactly once in the file
|
|
19
|
+
* - file is rewritten with newValue and CursorAccepted is returned
|
|
20
|
+
*
|
|
21
|
+
* Path B (refused_due_to_scope):
|
|
22
|
+
* - allowedFiles is empty AND parsedChange has no filePath
|
|
23
|
+
* - allowedFiles has multiple entries and oldValue appears in more than one
|
|
24
|
+
* - parsedChange is absent and no single target file can be determined
|
|
25
|
+
* Returns a structured CursorScopeQuestion for H to resolve.
|
|
26
|
+
*
|
|
27
|
+
* Path C (refused_due_to_execution_error):
|
|
28
|
+
* - file_not_found: target file does not exist on disk
|
|
29
|
+
* - old_value_not_found: oldValue is not present in the file
|
|
30
|
+
* - ambiguous_match: oldValue appears more than once in the file
|
|
31
|
+
* (cannot guarantee a safe, targeted replacement)
|
|
32
|
+
* - parse_error: parsedChange is absent (no edit directive)
|
|
33
|
+
*
|
|
34
|
+
* ── What this adapter does NOT do ─────────────────────────────────────────────
|
|
35
|
+
*
|
|
36
|
+
* - It does not re-derive intent. changeSpec is the sole edit directive.
|
|
37
|
+
* - It does not write outside allowedFiles (when non-empty).
|
|
38
|
+
* - It does not persist UCP envelopes (the gate owns all persistence).
|
|
39
|
+
* - It does not validate workspace constraints (already done by the gate).
|
|
40
|
+
* - It does not call back into the intake pipeline.
|
|
41
|
+
*
|
|
42
|
+
* ── Replacement strategy ──────────────────────────────────────────────────────
|
|
43
|
+
*
|
|
44
|
+
* Uses exact string matching (indexOf), not regex.
|
|
45
|
+
* This is intentional: parsedChange.oldValue is a verbatim extracted string
|
|
46
|
+
* from interpretation output. Regex matching would introduce ambiguity.
|
|
47
|
+
*
|
|
48
|
+
* If oldValue appears more than once, the adapter refuses (ambiguous_match)
|
|
49
|
+
* rather than replacing all occurrences silently. The caller must clarify.
|
|
50
|
+
*
|
|
51
|
+
* See: docs/cursor-delivery-contract.md — delivery paths
|
|
52
|
+
* docs/cursor-allowedfiles-policy.md — allowedFiles semantics
|
|
53
|
+
* src/cursor/adapters/stub-adapter.ts — the stub this replaces
|
|
54
|
+
*/
|
|
55
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, renameSync, unlinkSync, } from "node:fs";
|
|
56
|
+
import { join, isAbsolute, dirname } from "node:path";
|
|
57
|
+
import { matchesGlob } from "../glob-matcher.js";
|
|
58
|
+
// ─── Adapter ──────────────────────────────────────────────────────────────────
|
|
59
|
+
export class CursorInProcessAdapter {
|
|
60
|
+
workspaceRoot;
|
|
61
|
+
/**
|
|
62
|
+
* @param workspaceRoot Absolute path to the workspace root.
|
|
63
|
+
* Relative paths in allowedFiles and parsedChange.filePath
|
|
64
|
+
* are resolved against this root.
|
|
65
|
+
*/
|
|
66
|
+
constructor(workspaceRoot) {
|
|
67
|
+
this.workspaceRoot = workspaceRoot;
|
|
68
|
+
}
|
|
69
|
+
async receive(request) {
|
|
70
|
+
const { deliveryId, artifact } = request;
|
|
71
|
+
const { changeSpec, scopeConstraint } = artifact;
|
|
72
|
+
const parsedChange = changeSpec.parsedChange;
|
|
73
|
+
// ── Step 1: Resolve target file ──────────────────────────────────────────
|
|
74
|
+
// If no parsedChange, we have no edit directive — cannot proceed.
|
|
75
|
+
if (!parsedChange) {
|
|
76
|
+
return {
|
|
77
|
+
kind: "refused_due_to_execution_error",
|
|
78
|
+
deliveryId,
|
|
79
|
+
artifactId: artifact.id,
|
|
80
|
+
receivedAt: Date.now(),
|
|
81
|
+
errorCode: "parse_error",
|
|
82
|
+
detail: "No parsedChange present in changeSpec. Cannot determine an edit directive.",
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
// Determine the target file:
|
|
86
|
+
// 1. parsedChange.filePath (authoritative — proposed by artifact mapper)
|
|
87
|
+
// 2. single allowedFiles entry (unambiguous — H narrowed to one file)
|
|
88
|
+
// 3. search all allowedFiles for oldValue (scope clarification if > 1 match)
|
|
89
|
+
// 4. if allowedFiles is empty, we have no search space → scope question
|
|
90
|
+
let targetFile;
|
|
91
|
+
if (parsedChange.filePath) {
|
|
92
|
+
targetFile = parsedChange.filePath;
|
|
93
|
+
}
|
|
94
|
+
else if (scopeConstraint.allowedFiles.length === 1) {
|
|
95
|
+
targetFile = scopeConstraint.allowedFiles[0];
|
|
96
|
+
}
|
|
97
|
+
else if (scopeConstraint.allowedFiles.length > 1) {
|
|
98
|
+
// Search all allowedFiles for oldValue — clarify if > 1 match
|
|
99
|
+
const result = this.searchForOldValue(parsedChange.oldValue, scopeConstraint.allowedFiles);
|
|
100
|
+
if (result.kind === "not_found") {
|
|
101
|
+
return {
|
|
102
|
+
kind: "refused_due_to_execution_error",
|
|
103
|
+
deliveryId,
|
|
104
|
+
artifactId: artifact.id,
|
|
105
|
+
receivedAt: Date.now(),
|
|
106
|
+
errorCode: "old_value_not_found",
|
|
107
|
+
detail: `"${parsedChange.oldValue}" was not found in any of the allowed files: ${scopeConstraint.allowedFiles.join(", ")}`,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
if (result.kind === "multiple_matches") {
|
|
111
|
+
return {
|
|
112
|
+
kind: "refused_due_to_scope",
|
|
113
|
+
deliveryId,
|
|
114
|
+
artifactId: artifact.id,
|
|
115
|
+
receivedAt: Date.now(),
|
|
116
|
+
scopeQuestion: {
|
|
117
|
+
questionKind: "need_file_path",
|
|
118
|
+
candidates: result.files,
|
|
119
|
+
searchedFor: parsedChange.oldValue,
|
|
120
|
+
explanation: `Found "${parsedChange.oldValue}" in ${result.files.length} files. Select the target.`,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
// result.kind === "single_match" — TypeScript narrowed above via early returns
|
|
125
|
+
targetFile = result.file;
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
// allowedFiles is empty and parsedChange has no filePath — open search
|
|
129
|
+
return {
|
|
130
|
+
kind: "refused_due_to_scope",
|
|
131
|
+
deliveryId,
|
|
132
|
+
artifactId: artifact.id,
|
|
133
|
+
receivedAt: Date.now(),
|
|
134
|
+
scopeQuestion: {
|
|
135
|
+
questionKind: "need_file_path",
|
|
136
|
+
candidates: [],
|
|
137
|
+
searchedFor: parsedChange.oldValue,
|
|
138
|
+
explanation: "No file path specified and allowedFiles is empty. Provide a target file path.",
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
// TypeScript cannot prove targetFile is defined through the branching above,
|
|
143
|
+
// but all code paths either return early or assign it. Assert non-null here.
|
|
144
|
+
const resolvedFile = targetFile;
|
|
145
|
+
// ── Step 2: Scope boundary enforcement ───────────────────────────────────
|
|
146
|
+
// If allowedFiles is non-empty, resolvedFile must be in it.
|
|
147
|
+
if (scopeConstraint.allowedFiles.length > 0 && !scopeConstraint.allowedFiles.includes(resolvedFile)) {
|
|
148
|
+
return {
|
|
149
|
+
kind: "refused_due_to_execution_error",
|
|
150
|
+
deliveryId,
|
|
151
|
+
artifactId: artifact.id,
|
|
152
|
+
receivedAt: Date.now(),
|
|
153
|
+
errorCode: "scope_outside_allowed",
|
|
154
|
+
detail: `Target file "${resolvedFile}" is not in allowedFiles.`,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
// If any prohibitedPattern matches resolvedFile, refuse.
|
|
158
|
+
const normalized = resolvedFile.replace(/\\/g, "/");
|
|
159
|
+
for (const pattern of scopeConstraint.prohibitedPatterns) {
|
|
160
|
+
if (matchesGlob(normalized, pattern)) {
|
|
161
|
+
return {
|
|
162
|
+
kind: "refused_due_to_execution_error",
|
|
163
|
+
deliveryId,
|
|
164
|
+
artifactId: artifact.id,
|
|
165
|
+
receivedAt: Date.now(),
|
|
166
|
+
errorCode: "prohibited_pattern_match",
|
|
167
|
+
detail: `Target file "${resolvedFile}" matches prohibited pattern "${pattern}".`,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// ── Step 3: Resolve absolute path ────────────────────────────────────────
|
|
172
|
+
const absolutePath = isAbsolute(resolvedFile)
|
|
173
|
+
? resolvedFile
|
|
174
|
+
: join(this.workspaceRoot, resolvedFile);
|
|
175
|
+
// ── Step 4: Read and apply the change ─────────────────────────────────────
|
|
176
|
+
if (!existsSync(absolutePath)) {
|
|
177
|
+
return {
|
|
178
|
+
kind: "refused_due_to_execution_error",
|
|
179
|
+
deliveryId,
|
|
180
|
+
artifactId: artifact.id,
|
|
181
|
+
receivedAt: Date.now(),
|
|
182
|
+
errorCode: "file_not_found",
|
|
183
|
+
detail: `File not found: ${absolutePath}`,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
let content;
|
|
187
|
+
try {
|
|
188
|
+
content = readFileSync(absolutePath, { encoding: "utf8" });
|
|
189
|
+
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
return {
|
|
192
|
+
kind: "refused_due_to_execution_error",
|
|
193
|
+
deliveryId,
|
|
194
|
+
artifactId: artifact.id,
|
|
195
|
+
receivedAt: Date.now(),
|
|
196
|
+
errorCode: "file_not_found",
|
|
197
|
+
detail: `Failed to read file "${absolutePath}": ${String(err)}`,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
const { oldValue, newValue } = parsedChange;
|
|
201
|
+
const firstIndex = content.indexOf(oldValue);
|
|
202
|
+
if (firstIndex === -1) {
|
|
203
|
+
return {
|
|
204
|
+
kind: "refused_due_to_execution_error",
|
|
205
|
+
deliveryId,
|
|
206
|
+
artifactId: artifact.id,
|
|
207
|
+
receivedAt: Date.now(),
|
|
208
|
+
errorCode: "old_value_not_found",
|
|
209
|
+
detail: `"${oldValue}" was not found in "${resolvedFile}".`,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
const lastIndex = content.lastIndexOf(oldValue);
|
|
213
|
+
if (lastIndex !== firstIndex) {
|
|
214
|
+
return {
|
|
215
|
+
kind: "refused_due_to_execution_error",
|
|
216
|
+
deliveryId,
|
|
217
|
+
artifactId: artifact.id,
|
|
218
|
+
receivedAt: Date.now(),
|
|
219
|
+
errorCode: "ambiguous_match",
|
|
220
|
+
detail: `"${oldValue}" appears more than once in "${resolvedFile}". Cannot safely apply a targeted replacement.`,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
// Apply the replacement — exact, single occurrence.
|
|
224
|
+
const updated = content.slice(0, firstIndex) + newValue + content.slice(firstIndex + oldValue.length);
|
|
225
|
+
try {
|
|
226
|
+
writeFileSync(absolutePath, updated, "utf8");
|
|
227
|
+
}
|
|
228
|
+
catch (err) {
|
|
229
|
+
return {
|
|
230
|
+
kind: "refused_due_to_execution_error",
|
|
231
|
+
deliveryId,
|
|
232
|
+
artifactId: artifact.id,
|
|
233
|
+
receivedAt: Date.now(),
|
|
234
|
+
errorCode: "merge_conflict",
|
|
235
|
+
detail: `Failed to write file "${absolutePath}": ${String(err)}`,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
// ── Step 5: Return accepted ───────────────────────────────────────────────
|
|
239
|
+
return {
|
|
240
|
+
kind: "accepted",
|
|
241
|
+
deliveryId,
|
|
242
|
+
artifactId: artifact.id,
|
|
243
|
+
receivedAt: Date.now(),
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
// ── FsPlugin: filesystem primitives ─────────────────────────────────────────
|
|
247
|
+
async executeFsOp(op) {
|
|
248
|
+
try {
|
|
249
|
+
switch (op.operationType) {
|
|
250
|
+
case "create_dir": {
|
|
251
|
+
const abs = isAbsolute(op.dirPath) ? op.dirPath : join(this.workspaceRoot, op.dirPath);
|
|
252
|
+
mkdirSync(abs, { recursive: true });
|
|
253
|
+
return { kind: "accepted" };
|
|
254
|
+
}
|
|
255
|
+
case "write_file": {
|
|
256
|
+
const abs = isAbsolute(op.filePath) ? op.filePath : join(this.workspaceRoot, op.filePath);
|
|
257
|
+
mkdirSync(dirname(abs), { recursive: true });
|
|
258
|
+
writeFileSync(abs, op.content, "utf8");
|
|
259
|
+
return { kind: "accepted" };
|
|
260
|
+
}
|
|
261
|
+
case "rename": {
|
|
262
|
+
const absOld = isAbsolute(op.filePath) ? op.filePath : join(this.workspaceRoot, op.filePath);
|
|
263
|
+
const absNew = isAbsolute(op.newPath) ? op.newPath : join(this.workspaceRoot, op.newPath);
|
|
264
|
+
renameSync(absOld, absNew);
|
|
265
|
+
return { kind: "accepted" };
|
|
266
|
+
}
|
|
267
|
+
case "delete_file": {
|
|
268
|
+
const abs = isAbsolute(op.filePath) ? op.filePath : join(this.workspaceRoot, op.filePath);
|
|
269
|
+
unlinkSync(abs);
|
|
270
|
+
return { kind: "accepted" };
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
catch (err) {
|
|
275
|
+
return { kind: "failed", detail: String(err) };
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
// ── Internal helpers ────────────────────────────────────────────────────────
|
|
279
|
+
/**
|
|
280
|
+
* Search for oldValue in a list of candidate files.
|
|
281
|
+
* Returns single_match, multiple_matches, or not_found.
|
|
282
|
+
* Reads each file from disk; skips files that cannot be read.
|
|
283
|
+
*/
|
|
284
|
+
searchForOldValue(oldValue, allowedFiles) {
|
|
285
|
+
const matches = [];
|
|
286
|
+
for (const file of allowedFiles) {
|
|
287
|
+
const absPath = isAbsolute(file) ? file : join(this.workspaceRoot, file);
|
|
288
|
+
if (!existsSync(absPath))
|
|
289
|
+
continue;
|
|
290
|
+
let content;
|
|
291
|
+
try {
|
|
292
|
+
content = readFileSync(absPath, "utf8");
|
|
293
|
+
}
|
|
294
|
+
catch {
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
if (content.includes(oldValue)) {
|
|
298
|
+
matches.push(file);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (matches.length === 0)
|
|
302
|
+
return { kind: "not_found" };
|
|
303
|
+
if (matches.length === 1)
|
|
304
|
+
return { kind: "single_match", file: matches[0] };
|
|
305
|
+
return { kind: "multiple_matches", files: matches };
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
//# sourceMappingURL=inprocess-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inprocess-adapter.js","sourceRoot":"","sources":["../../../../src/cursor/adapters/inprocess-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,EACL,YAAY,EAAE,aAAa,EAAE,UAAU,EACvC,SAAS,EAAE,UAAU,EAAE,UAAU,GAClC,MAAM,SAAS,C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E,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Stub Adapter — in-process transport adapter for testing and development.
|
|
3
|
+
*
|
|
4
|
+
* ── Role ───────────────────────────────────────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* The stub adapter is the first concrete implementation of CursorEditorPlugin.
|
|
7
|
+
* It is also the proof that the mechanism-agnostic contract works — the same
|
|
8
|
+
* delivery gate operates identically whether the plugin returns a response
|
|
9
|
+
* immediately (stub) or asynchronously (real Cursor IPC/plugin).
|
|
10
|
+
*
|
|
11
|
+
* ── Transport proof ────────────────────────────────────────────────────────────
|
|
12
|
+
*
|
|
13
|
+
* CursorStubAdapter proves all three delivery paths:
|
|
14
|
+
* - accepted: stub returns CursorAccepted
|
|
15
|
+
* - refused_due_to_scope: stub returns CursorRefusedDueToScope
|
|
16
|
+
* - refused_due_to_execution_error: stub returns CursorRefusedDueToExecutionError
|
|
17
|
+
*
|
|
18
|
+
* The gate does not change behavior based on which adapter is used.
|
|
19
|
+
* The stub is the simplest valid adapter — a configured response, returned immediately.
|
|
20
|
+
*
|
|
21
|
+
* ── Usage ──────────────────────────────────────────────────────────────────────
|
|
22
|
+
*
|
|
23
|
+
* In tests:
|
|
24
|
+
* const plugin = CursorStubAdapter.accepted();
|
|
25
|
+
* const gate = new CursorDeliveryGate(plugin, storeDir);
|
|
26
|
+
* const result = await gate.deliver(approvedArtifact);
|
|
27
|
+
* expect(result.outcome).toBe("accepted");
|
|
28
|
+
*
|
|
29
|
+
* For a configurable sequence of responses (e.g., scope refusal then accept):
|
|
30
|
+
* const plugin = CursorStubAdapter.sequence([
|
|
31
|
+
* CursorStubAdapter.scopeRefusal({ questionKind: "need_file_path", ... }),
|
|
32
|
+
* CursorStubAdapter.acceptedResponse(),
|
|
33
|
+
* ]);
|
|
34
|
+
*
|
|
35
|
+
* ── What this is NOT ──────────────────────────────────────────────────────────
|
|
36
|
+
*
|
|
37
|
+
* This is not a fake Cursor. It does not apply edits, read files, or produce
|
|
38
|
+
* real diffs. It is purely for proving that the delivery gate contract is
|
|
39
|
+
* exercised correctly.
|
|
40
|
+
*
|
|
41
|
+
* For a real Cursor adapter, implement CursorEditorPlugin with your transport
|
|
42
|
+
* of choice (function call, IPC, file drop). The delivery gate does not change.
|
|
43
|
+
*
|
|
44
|
+
* See: docs/cursor-delivery-contract.md — mechanism selection rationale
|
|
45
|
+
* src/cursor/delivery-gate.ts — CursorEditorPlugin interface
|
|
46
|
+
*/
|
|
47
|
+
import type { CursorEditorPlugin } from "../delivery-gate.js";
|
|
48
|
+
import type { CursorDeliveryRequest } from "../types.js";
|
|
49
|
+
import type { CursorResponse, CursorAccepted, CursorRefusedDueToScope, CursorRefusedDueToExecutionError, CursorScopeQuestion, CursorExecutionErrorCode } from "../types.js";
|
|
50
|
+
/**
|
|
51
|
+
* A configurable in-process CursorEditorPlugin.
|
|
52
|
+
*
|
|
53
|
+
* Configured at construction with a fixed response or a sequence of responses.
|
|
54
|
+
* Returns responses immediately (no async delay).
|
|
55
|
+
*/
|
|
56
|
+
export declare class CursorStubAdapter implements CursorEditorPlugin {
|
|
57
|
+
private readonly responses;
|
|
58
|
+
private callIndex;
|
|
59
|
+
constructor(responses: CursorResponse[]);
|
|
60
|
+
receive(request: CursorDeliveryRequest): Promise<CursorResponse>;
|
|
61
|
+
/** How many times receive() has been called. */
|
|
62
|
+
get callCount(): number;
|
|
63
|
+
/** Adapter that always returns "accepted". */
|
|
64
|
+
static accepted(overrides?: Partial<CursorAccepted>): CursorStubAdapter;
|
|
65
|
+
/** Adapter that returns a scope refusal with the given question. */
|
|
66
|
+
static refusedScope(question: CursorScopeQuestion, overrides?: Partial<CursorRefusedDueToScope>): CursorStubAdapter;
|
|
67
|
+
/** Adapter that returns an execution error with the given code. */
|
|
68
|
+
static refusedError(errorCode: CursorExecutionErrorCode, detail?: string): CursorStubAdapter;
|
|
69
|
+
/** Adapter that returns responses in sequence. Throws if exhausted. */
|
|
70
|
+
static sequence(responses: CursorResponse[]): CursorStubAdapter;
|
|
71
|
+
static acceptedResponse(overrides?: Partial<CursorAccepted>): CursorAccepted;
|
|
72
|
+
static scopeRefusalResponse(question: CursorScopeQuestion, overrides?: Partial<CursorRefusedDueToScope>): CursorRefusedDueToScope;
|
|
73
|
+
static executionErrorResponse(errorCode: CursorExecutionErrorCode, detail?: string): CursorRefusedDueToExecutionError;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=stub-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stub-adapter.d.ts","sourceRoot":"","sources":["../../../../src/cursor/adapters/stub-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,uBAAuB,EACvB,gCAAgC,EAChC,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,aAAa,CAAC;AAIrB;;;;;GAKG;AACH,qBAAa,iBAAkB,YAAW,kBAAkB;IAC1D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;IAC7C,OAAO,CAAC,SAAS,CAAK;gBAEV,SAAS,EAAE,cAAc,EAAE;IAKjC,OAAO,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,cAAc,CAAC;IAWtE,gDAAgD;IAChD,IAAI,SAAS,IAAI,MAAM,CAA2B;IAIlD,8CAA8C;IAC9C,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,iBAAiB;IAIvE,oEAAoE;IACpE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,mBAAmB,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,GAAG,iBAAiB;IAInH,mEAAmE;IACnE,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,wBAAwB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,iBAAiB;IAI5F,uEAAuE;IACvE,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,cAAc,EAAE,GAAG,iBAAiB;IAM/D,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc;IAU5E,MAAM,CAAC,oBAAoB,CACzB,QAAQ,EAAG,mBAAmB,EAC9B,SAAS,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,GAC3C,uBAAuB;IAW1B,MAAM,CAAC,sBAAsB,CAC3B,SAAS,EAAE,wBAAwB,EACnC,MAAM,SAA6B,GAClC,gCAAgC;CAUpC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Stub Adapter — in-process transport adapter for testing and development.
|
|
3
|
+
*
|
|
4
|
+
* ── Role ───────────────────────────────────────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* The stub adapter is the first concrete implementation of CursorEditorPlugin.
|
|
7
|
+
* It is also the proof that the mechanism-agnostic contract works — the same
|
|
8
|
+
* delivery gate operates identically whether the plugin returns a response
|
|
9
|
+
* immediately (stub) or asynchronously (real Cursor IPC/plugin).
|
|
10
|
+
*
|
|
11
|
+
* ── Transport proof ────────────────────────────────────────────────────────────
|
|
12
|
+
*
|
|
13
|
+
* CursorStubAdapter proves all three delivery paths:
|
|
14
|
+
* - accepted: stub returns CursorAccepted
|
|
15
|
+
* - refused_due_to_scope: stub returns CursorRefusedDueToScope
|
|
16
|
+
* - refused_due_to_execution_error: stub returns CursorRefusedDueToExecutionError
|
|
17
|
+
*
|
|
18
|
+
* The gate does not change behavior based on which adapter is used.
|
|
19
|
+
* The stub is the simplest valid adapter — a configured response, returned immediately.
|
|
20
|
+
*
|
|
21
|
+
* ── Usage ──────────────────────────────────────────────────────────────────────
|
|
22
|
+
*
|
|
23
|
+
* In tests:
|
|
24
|
+
* const plugin = CursorStubAdapter.accepted();
|
|
25
|
+
* const gate = new CursorDeliveryGate(plugin, storeDir);
|
|
26
|
+
* const result = await gate.deliver(approvedArtifact);
|
|
27
|
+
* expect(result.outcome).toBe("accepted");
|
|
28
|
+
*
|
|
29
|
+
* For a configurable sequence of responses (e.g., scope refusal then accept):
|
|
30
|
+
* const plugin = CursorStubAdapter.sequence([
|
|
31
|
+
* CursorStubAdapter.scopeRefusal({ questionKind: "need_file_path", ... }),
|
|
32
|
+
* CursorStubAdapter.acceptedResponse(),
|
|
33
|
+
* ]);
|
|
34
|
+
*
|
|
35
|
+
* ── What this is NOT ──────────────────────────────────────────────────────────
|
|
36
|
+
*
|
|
37
|
+
* This is not a fake Cursor. It does not apply edits, read files, or produce
|
|
38
|
+
* real diffs. It is purely for proving that the delivery gate contract is
|
|
39
|
+
* exercised correctly.
|
|
40
|
+
*
|
|
41
|
+
* For a real Cursor adapter, implement CursorEditorPlugin with your transport
|
|
42
|
+
* of choice (function call, IPC, file drop). The delivery gate does not change.
|
|
43
|
+
*
|
|
44
|
+
* See: docs/cursor-delivery-contract.md — mechanism selection rationale
|
|
45
|
+
* src/cursor/delivery-gate.ts — CursorEditorPlugin interface
|
|
46
|
+
*/
|
|
47
|
+
// ─── Stub adapter ────────────────────────────────────────────────────────────
|
|
48
|
+
/**
|
|
49
|
+
* A configurable in-process CursorEditorPlugin.
|
|
50
|
+
*
|
|
51
|
+
* Configured at construction with a fixed response or a sequence of responses.
|
|
52
|
+
* Returns responses immediately (no async delay).
|
|
53
|
+
*/
|
|
54
|
+
export class CursorStubAdapter {
|
|
55
|
+
responses;
|
|
56
|
+
callIndex = 0;
|
|
57
|
+
constructor(responses) {
|
|
58
|
+
if (responses.length === 0)
|
|
59
|
+
throw new Error("CursorStubAdapter: responses must not be empty");
|
|
60
|
+
this.responses = responses;
|
|
61
|
+
}
|
|
62
|
+
async receive(request) {
|
|
63
|
+
const response = this.responses[this.callIndex];
|
|
64
|
+
if (response === undefined) {
|
|
65
|
+
throw new Error(`CursorStubAdapter: no response configured for call index ${this.callIndex} (deliveryId=${request.deliveryId})`);
|
|
66
|
+
}
|
|
67
|
+
this.callIndex++;
|
|
68
|
+
return response;
|
|
69
|
+
}
|
|
70
|
+
/** How many times receive() has been called. */
|
|
71
|
+
get callCount() { return this.callIndex; }
|
|
72
|
+
// ── Factory methods ────────────────────────────────────────────────────────
|
|
73
|
+
/** Adapter that always returns "accepted". */
|
|
74
|
+
static accepted(overrides) {
|
|
75
|
+
return new CursorStubAdapter([CursorStubAdapter.acceptedResponse(overrides)]);
|
|
76
|
+
}
|
|
77
|
+
/** Adapter that returns a scope refusal with the given question. */
|
|
78
|
+
static refusedScope(question, overrides) {
|
|
79
|
+
return new CursorStubAdapter([CursorStubAdapter.scopeRefusalResponse(question, overrides)]);
|
|
80
|
+
}
|
|
81
|
+
/** Adapter that returns an execution error with the given code. */
|
|
82
|
+
static refusedError(errorCode, detail) {
|
|
83
|
+
return new CursorStubAdapter([CursorStubAdapter.executionErrorResponse(errorCode, detail)]);
|
|
84
|
+
}
|
|
85
|
+
/** Adapter that returns responses in sequence. Throws if exhausted. */
|
|
86
|
+
static sequence(responses) {
|
|
87
|
+
return new CursorStubAdapter(responses);
|
|
88
|
+
}
|
|
89
|
+
// ── Response builders ─────────────────────────────────────────────────────
|
|
90
|
+
static acceptedResponse(overrides) {
|
|
91
|
+
return {
|
|
92
|
+
kind: "accepted",
|
|
93
|
+
deliveryId: "stub-delivery-id",
|
|
94
|
+
artifactId: "stub-artifact-id",
|
|
95
|
+
receivedAt: Date.now(),
|
|
96
|
+
...overrides,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
static scopeRefusalResponse(question, overrides) {
|
|
100
|
+
return {
|
|
101
|
+
kind: "refused_due_to_scope",
|
|
102
|
+
deliveryId: "stub-delivery-id",
|
|
103
|
+
artifactId: "stub-artifact-id",
|
|
104
|
+
receivedAt: Date.now(),
|
|
105
|
+
scopeQuestion: question,
|
|
106
|
+
...overrides,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
static executionErrorResponse(errorCode, detail = "Stub execution error.") {
|
|
110
|
+
return {
|
|
111
|
+
kind: "refused_due_to_execution_error",
|
|
112
|
+
deliveryId: "stub-delivery-id",
|
|
113
|
+
artifactId: "stub-artifact-id",
|
|
114
|
+
receivedAt: Date.now(),
|
|
115
|
+
errorCode,
|
|
116
|
+
detail,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=stub-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stub-adapter.js","sourceRoot":"","sources":["../../../../src/cursor/adapters/stub-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAaH,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IACX,SAAS,CAAmB;IACrC,SAAS,GAAG,CAAC,CAAC;IAEtB,YAAY,SAA2B;QACrC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAC9F,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAA8B;QAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CACb,4DAA4D,IAAI,CAAC,SAAS,gBAAgB,OAAO,CAAC,UAAU,GAAG,CAChH,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,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M,CAAC,sBAAsB,CAC3B,SAAmC,EACnC,MAAM,GAAM,uBAAuB;QAEnC,OAAO;YACL,IAAI,EAAQ,gCAAgC;YAC5C,UAAU,EAAE,kBAAkB;YAC9B,UAAU,EAAE,kBAAkB;YAC9B,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;YACtB,SAAS;YACT,MAAM;SACP,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor artifact mapper — builds the initial CursorHandoffArtifact.
|
|
3
|
+
*
|
|
4
|
+
* ── Role ───────────────────────────────────────────────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* Translates an IntakeResult (mode === "execute") into a CursorHandoffArtifact
|
|
7
|
+
* with eligibility: "pending_confirmation" and an initial scopeConstraint.
|
|
8
|
+
*
|
|
9
|
+
* This is the ONLY place that proposes allowedFiles. Specifically, it reads
|
|
10
|
+
* parsedChange.filePath when present. When absent, allowedFiles starts empty.
|
|
11
|
+
*
|
|
12
|
+
* ── What this mapper does ──────────────────────────────────────────────────────
|
|
13
|
+
*
|
|
14
|
+
* 1. Extracts changeSpec from InterpretationResult (execute + structured) or
|
|
15
|
+
* IntentInterpretation (execute + vague).
|
|
16
|
+
* 2. Sets initial allowedFiles = [parsedChange.filePath] or [].
|
|
17
|
+
* 3. Sets initial prohibitedPatterns from OCD policy (defensive defaults).
|
|
18
|
+
* 4. Sets eligibility = "pending_confirmation".
|
|
19
|
+
* 5. Sets ocdClearance = { status: "cleared", rulesFired: [], conflictsDetected: [] }
|
|
20
|
+
* (OCD evaluator updates this separately — see ocd-evaluator.ts).
|
|
21
|
+
*
|
|
22
|
+
* ── What this mapper does NOT do ──────────────────────────────────────────────
|
|
23
|
+
*
|
|
24
|
+
* - Does not read the filesystem (no path resolution)
|
|
25
|
+
* - Does not call OCD (that is a separate step)
|
|
26
|
+
* - Does not set eligibility to "approved_for_cursor" (only H does that)
|
|
27
|
+
* - Does not validate H-provided paths (that is the delivery gate's job)
|
|
28
|
+
* - Does not invent file paths from intent category
|
|
29
|
+
*
|
|
30
|
+
* ── CONSTRUCTION RULE: undefined-free payloads ────────────────────────────────
|
|
31
|
+
*
|
|
32
|
+
* All payload objects must be undefined-free per UCP protocol invariant.
|
|
33
|
+
* Optional fields are omitted entirely when absent. Never assigned undefined.
|
|
34
|
+
*
|
|
35
|
+
* See: docs/cursor-allowedfiles-policy.md — population source hierarchy
|
|
36
|
+
* docs/cursor-integration-architecture.md — authority model
|
|
37
|
+
*/
|
|
38
|
+
import type { IntakeResult } from "../intake/types.js";
|
|
39
|
+
import type { ReplaceChange } from "../understand/interpretation/types.js";
|
|
40
|
+
type ParsedChange = ReplaceChange;
|
|
41
|
+
import type { CursorHandoffArtifact, CursorOCDPolicy } from "./types.js";
|
|
42
|
+
/**
|
|
43
|
+
* Build the initial CursorHandoffArtifact from an IntakeResult.
|
|
44
|
+
*
|
|
45
|
+
* PRECONDITION: intake.mode === "execute". Callers must verify this before calling.
|
|
46
|
+
* Passing a non-execute IntakeResult is a caller contract violation.
|
|
47
|
+
*
|
|
48
|
+
* @param intake The completed intake result (mode must be "execute").
|
|
49
|
+
* @param intentId The ucp.intent.v1 envelope id — links back to the root intent.
|
|
50
|
+
* @param responseId The ucp.response.v1 envelope id — links back to the mode decision.
|
|
51
|
+
* @param policy The OCD policy config (for defensive prohibitedPatterns).
|
|
52
|
+
* @returns A CursorHandoffArtifact with eligibility: "pending_confirmation".
|
|
53
|
+
*/
|
|
54
|
+
export declare function buildCursorHandoffArtifact(intake: IntakeResult, intentId: string, responseId: string, policy: CursorOCDPolicy, parsedChange?: ParsedChange): CursorHandoffArtifact;
|
|
55
|
+
/**
|
|
56
|
+
* Rebuild a CursorHandoffArtifact with a narrowed scopeConstraint.
|
|
57
|
+
*
|
|
58
|
+
* Called when H narrows the scope at ready_for_confirmation, or when a scope
|
|
59
|
+
* clarification answer updates allowedFiles. Produces a new artifact with a
|
|
60
|
+
* new content address (different scopeConstraint → different id).
|
|
61
|
+
*
|
|
62
|
+
* The new artifact retains the same intentId, responseId, and changeSpec.
|
|
63
|
+
* eligibility is reset to "pending_confirmation" — H must re-confirm.
|
|
64
|
+
*
|
|
65
|
+
* PRECONDITION: newAllowedFiles ⊆ current artifact.scopeConstraint.allowedFiles
|
|
66
|
+
* OR current artifact.scopeConstraint.allowedFiles is empty (H setting from empty).
|
|
67
|
+
* Callers must enforce the non-widening rule before calling.
|
|
68
|
+
*/
|
|
69
|
+
export declare function narrowArtifactScope(artifact: CursorHandoffArtifact, newAllowedFiles: readonly string[], newAllowedScopes?: readonly string[]): CursorHandoffArtifact;
|
|
70
|
+
/**
|
|
71
|
+
* Approve a CursorHandoffArtifact — set eligibility to "approved_for_cursor".
|
|
72
|
+
*
|
|
73
|
+
* This is the ONLY place that sets eligibility to "approved_for_cursor".
|
|
74
|
+
* Callers must verify that H has explicitly confirmed before calling.
|
|
75
|
+
*
|
|
76
|
+
* Returns a new artifact reference. The id does NOT change (eligibility and
|
|
77
|
+
* approvedAt are not part of the content-addressed id input).
|
|
78
|
+
*/
|
|
79
|
+
export declare function approveArtifact(artifact: CursorHandoffArtifact, confirmedAt: number): CursorHandoffArtifact;
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=artifact-mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-mapper.d.ts","sourceRoot":"","sources":["../../../src/cursor/artifact-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAA2B,oBAAoB,CAAC;AAC5E,OAAO,KAAK,EAAwB,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAEjG,KAAK,YAAY,GAAG,aAAa,CAAC;AAGlC,OAAO,KAAK,EACV,qBAAqB,EAIrB,eAAe,EAChB,MAAM,YAAY,CAAC;AAIpB;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAQ,YAAY,EAC1B,QAAQ,EAAM,MAAM,EACpB,UAAU,EAAI,MAAM,EACpB,MAAM,EAAQ,eAAe,EAC7B,YAAY,CAAC,EAAE,YAAY,GAC1B,qBAAqB,CA4BvB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAS,qBAAqB,EACtC,eAAe,EAAE,SAAS,MAAM,EAAE,EAClC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,GACnC,qBAAqB,CA0BvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAK,qBAAqB,EAClC,WAAW,EAAE,MAAM,GAClB,qBAAqB,CAMvB"}
|