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,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UseSteady Skills v1 — audit logging stub (file 7 of 8).
|
|
3
|
+
*
|
|
4
|
+
* Single responsibility: turn SkillInvocationResult objects into SkillAuditRecord
|
|
5
|
+
* objects and provide an interface for writing those records to a persistence layer.
|
|
6
|
+
*
|
|
7
|
+
* What this file owns:
|
|
8
|
+
* - Pure record builders (buildAuditRecord, buildAuditRecords) — synchronous,
|
|
9
|
+
* no I/O, fully deterministic
|
|
10
|
+
* - The AuditSink interface — the hook for later persistence wiring
|
|
11
|
+
* - Two built-in sinks: NULL_AUDIT_SINK (testing) and CONSOLE_AUDIT_SINK (dev)
|
|
12
|
+
*
|
|
13
|
+
* What this file does NOT own:
|
|
14
|
+
* - Deciding which invocations to audit (always all of them)
|
|
15
|
+
* - Filtering, sampling, or dropping records
|
|
16
|
+
* - Writing to disk, database, or network directly (that lives in concrete AuditSink implementations)
|
|
17
|
+
* - Any authority over execution, approval, or policy
|
|
18
|
+
*
|
|
19
|
+
* Persistence compatibility:
|
|
20
|
+
* SkillAuditRecord is fully JSON-serialisable (no functions, no circular refs,
|
|
21
|
+
* no non-primitive types beyond Date). Consumers calling JSON.stringify on a
|
|
22
|
+
* record will get a complete, human-readable snapshot suitable for any store.
|
|
23
|
+
*/
|
|
24
|
+
import type { InvokeSkillsResult, SkillInvocationResult } from './invocation.js';
|
|
25
|
+
import { type SkillAuditRecord, type TriggerReason } from './types.js';
|
|
26
|
+
/**
|
|
27
|
+
* Options for the audit record builders.
|
|
28
|
+
* All fields are optional — sensible defaults are applied when absent.
|
|
29
|
+
*/
|
|
30
|
+
export interface BuildAuditOptions {
|
|
31
|
+
/**
|
|
32
|
+
* The timestamp to stamp on every record built in this call.
|
|
33
|
+
* Callers should pass a fixed value when building multiple records for the
|
|
34
|
+
* same invocation batch so all records share the same `invokedAt`.
|
|
35
|
+
* Defaults to `new Date()` when absent.
|
|
36
|
+
*/
|
|
37
|
+
readonly invokedAt?: Date;
|
|
38
|
+
/**
|
|
39
|
+
* Map from skill name to its absolute SKILL.md source path.
|
|
40
|
+
* When provided, `sourcePath` is populated on each record.
|
|
41
|
+
* When absent, `sourcePath` is omitted entirely from all records.
|
|
42
|
+
* Build this map from the Skill objects in the registry if you have them.
|
|
43
|
+
*/
|
|
44
|
+
readonly sourcePaths?: ReadonlyMap<string, string>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Build one SkillAuditRecord from a SkillInvocationResult and its execution context.
|
|
48
|
+
*
|
|
49
|
+
* The `triggerReason` and `rawInput` come from InvokeSkillsResult; they are
|
|
50
|
+
* passed separately here so this function is also usable outside the batch path.
|
|
51
|
+
*
|
|
52
|
+
* exactOptionalPropertyTypes compliance:
|
|
53
|
+
* `sourcePath` and `rejectionReason` are physically absent (not set to
|
|
54
|
+
* undefined) when they have no value — conditional spread achieves this.
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildAuditRecord(result: SkillInvocationResult, triggerReason: TriggerReason, rawInput: string, options?: BuildAuditOptions): SkillAuditRecord;
|
|
57
|
+
/**
|
|
58
|
+
* Build one SkillAuditRecord for each result in an InvokeSkillsResult.
|
|
59
|
+
*
|
|
60
|
+
* All records in the batch share the same `invokedAt` timestamp so they can
|
|
61
|
+
* be correlated as a single invocation event. A fixed timestamp is captured
|
|
62
|
+
* once before the map to avoid per-record clock skew.
|
|
63
|
+
*
|
|
64
|
+
* Returns records in the same order as `invokeResult.results` (priority order).
|
|
65
|
+
*/
|
|
66
|
+
export declare function buildAuditRecords(invokeResult: InvokeSkillsResult, options?: BuildAuditOptions): readonly SkillAuditRecord[];
|
|
67
|
+
/**
|
|
68
|
+
* The persistence hook. Implementations write SkillAuditRecord objects to
|
|
69
|
+
* whatever store is appropriate (file, DB, structured log, HTTP endpoint).
|
|
70
|
+
*
|
|
71
|
+
* Contract:
|
|
72
|
+
* - Must not mutate the record.
|
|
73
|
+
* - Must not throw synchronously — wrap errors in the returned Promise.
|
|
74
|
+
* - Must not block the calling skill invocation path (fire-and-forget is acceptable).
|
|
75
|
+
* - In v1, third-party sink implementations are not loaded automatically.
|
|
76
|
+
*/
|
|
77
|
+
export interface AuditSink {
|
|
78
|
+
record(audit: SkillAuditRecord): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A no-op AuditSink. Use in tests or when audit persistence is not configured.
|
|
82
|
+
* Records are silently discarded. No I/O, no side effects.
|
|
83
|
+
*/
|
|
84
|
+
export declare const NULL_AUDIT_SINK: AuditSink;
|
|
85
|
+
/**
|
|
86
|
+
* A development AuditSink that writes a compact JSON line to stdout.
|
|
87
|
+
* Not for production use — use a structured logging sink there.
|
|
88
|
+
*
|
|
89
|
+
* Output format (one JSON object per line):
|
|
90
|
+
* {
|
|
91
|
+
* "skill": "<name>@<version>",
|
|
92
|
+
* "outcome": "accepted" | "rejected",
|
|
93
|
+
* "schema": "<output_schema>",
|
|
94
|
+
* "trigger": "<kind>",
|
|
95
|
+
* "input": "<first 80 chars of rawInput>",
|
|
96
|
+
* "at": "<ISO 8601 timestamp>",
|
|
97
|
+
* "reason": "<rejectionReason>" — only present when rejected
|
|
98
|
+
* }
|
|
99
|
+
*/
|
|
100
|
+
export declare const CONSOLE_AUDIT_SINK: AuditSink;
|
|
101
|
+
/**
|
|
102
|
+
* Build a ReadonlyMap<string, string> from skill name to source path.
|
|
103
|
+
* Pass the result as `options.sourcePaths` to populate `sourcePath` in
|
|
104
|
+
* audit records.
|
|
105
|
+
*
|
|
106
|
+
* Usage:
|
|
107
|
+
* const sourcePaths = buildSourcePathMap(registry.all);
|
|
108
|
+
* const records = buildAuditRecords(result, { sourcePaths });
|
|
109
|
+
*
|
|
110
|
+
* Accepts any iterable of objects with `metadata.name` and `sourcePath`.
|
|
111
|
+
*/
|
|
112
|
+
export declare function buildSourcePathMap(skills: Iterable<{
|
|
113
|
+
readonly metadata: {
|
|
114
|
+
readonly name: string;
|
|
115
|
+
};
|
|
116
|
+
readonly sourcePath: string;
|
|
117
|
+
}>): ReadonlyMap<string, string>;
|
|
118
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../src/skills/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACjF,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAMpB;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpD;AAMD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,qBAAqB,EAC7B,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,gBAAgB,CAsBlB;AAMD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,kBAAkB,EAChC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,SAAS,gBAAgB,EAAE,CAmB7B;AAMD;;;;;;;;;GASG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD;AAMD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,SAK7B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAgBhC,CAAC;AAMF;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,QAAQ,CAAC;IAAE,QAAQ,CAAC,QAAQ,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,GAC9F,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAM7B"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UseSteady Skills v1 — audit logging stub (file 7 of 8).
|
|
3
|
+
*
|
|
4
|
+
* Single responsibility: turn SkillInvocationResult objects into SkillAuditRecord
|
|
5
|
+
* objects and provide an interface for writing those records to a persistence layer.
|
|
6
|
+
*
|
|
7
|
+
* What this file owns:
|
|
8
|
+
* - Pure record builders (buildAuditRecord, buildAuditRecords) — synchronous,
|
|
9
|
+
* no I/O, fully deterministic
|
|
10
|
+
* - The AuditSink interface — the hook for later persistence wiring
|
|
11
|
+
* - Two built-in sinks: NULL_AUDIT_SINK (testing) and CONSOLE_AUDIT_SINK (dev)
|
|
12
|
+
*
|
|
13
|
+
* What this file does NOT own:
|
|
14
|
+
* - Deciding which invocations to audit (always all of them)
|
|
15
|
+
* - Filtering, sampling, or dropping records
|
|
16
|
+
* - Writing to disk, database, or network directly (that lives in concrete AuditSink implementations)
|
|
17
|
+
* - Any authority over execution, approval, or policy
|
|
18
|
+
*
|
|
19
|
+
* Persistence compatibility:
|
|
20
|
+
* SkillAuditRecord is fully JSON-serialisable (no functions, no circular refs,
|
|
21
|
+
* no non-primitive types beyond Date). Consumers calling JSON.stringify on a
|
|
22
|
+
* record will get a complete, human-readable snapshot suitable for any store.
|
|
23
|
+
*/
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Single-record builder
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
/**
|
|
28
|
+
* Build one SkillAuditRecord from a SkillInvocationResult and its execution context.
|
|
29
|
+
*
|
|
30
|
+
* The `triggerReason` and `rawInput` come from InvokeSkillsResult; they are
|
|
31
|
+
* passed separately here so this function is also usable outside the batch path.
|
|
32
|
+
*
|
|
33
|
+
* exactOptionalPropertyTypes compliance:
|
|
34
|
+
* `sourcePath` and `rejectionReason` are physically absent (not set to
|
|
35
|
+
* undefined) when they have no value — conditional spread achieves this.
|
|
36
|
+
*/
|
|
37
|
+
export function buildAuditRecord(result, triggerReason, rawInput, options) {
|
|
38
|
+
const invokedAt = options?.invokedAt ?? new Date();
|
|
39
|
+
const sourcePath = options?.sourcePaths?.get(result.skillName);
|
|
40
|
+
// `result.rejectionReason` is `string | undefined` because the field is `?: string`.
|
|
41
|
+
// We check for its presence explicitly rather than comparing to undefined so the
|
|
42
|
+
// conditional spread respects exactOptionalPropertyTypes on the target type.
|
|
43
|
+
const hasRejectionReason = 'rejectionReason' in result;
|
|
44
|
+
return {
|
|
45
|
+
skillName: result.skillName,
|
|
46
|
+
skillVersion: result.skillVersion,
|
|
47
|
+
outputSchema: result.outputSchema,
|
|
48
|
+
rawOutput: result.rawOutput,
|
|
49
|
+
validationOutcome: result.validationOutcome,
|
|
50
|
+
invokedAt,
|
|
51
|
+
triggerReason,
|
|
52
|
+
rawInput,
|
|
53
|
+
// Optional fields — physically absent when not applicable.
|
|
54
|
+
...(sourcePath !== undefined ? { sourcePath } : {}),
|
|
55
|
+
...(hasRejectionReason ? { rejectionReason: result.rejectionReason } : {}),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
// Batch builder
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
/**
|
|
62
|
+
* Build one SkillAuditRecord for each result in an InvokeSkillsResult.
|
|
63
|
+
*
|
|
64
|
+
* All records in the batch share the same `invokedAt` timestamp so they can
|
|
65
|
+
* be correlated as a single invocation event. A fixed timestamp is captured
|
|
66
|
+
* once before the map to avoid per-record clock skew.
|
|
67
|
+
*
|
|
68
|
+
* Returns records in the same order as `invokeResult.results` (priority order).
|
|
69
|
+
*/
|
|
70
|
+
export function buildAuditRecords(invokeResult, options) {
|
|
71
|
+
// Capture a single timestamp for the whole batch.
|
|
72
|
+
const invokedAt = options?.invokedAt ?? new Date();
|
|
73
|
+
const sourcePaths = options?.sourcePaths;
|
|
74
|
+
// Rebuild a concrete options object so buildAuditRecord uses the fixed timestamp.
|
|
75
|
+
const batchOptions = {
|
|
76
|
+
invokedAt,
|
|
77
|
+
...(sourcePaths !== undefined ? { sourcePaths } : {}),
|
|
78
|
+
};
|
|
79
|
+
return invokeResult.results.map((result) => buildAuditRecord(result, invokeResult.triggerReason, invokeResult.rawInput, batchOptions));
|
|
80
|
+
}
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// Built-in sinks
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
/**
|
|
85
|
+
* A no-op AuditSink. Use in tests or when audit persistence is not configured.
|
|
86
|
+
* Records are silently discarded. No I/O, no side effects.
|
|
87
|
+
*/
|
|
88
|
+
export const NULL_AUDIT_SINK = {
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
90
|
+
async record(_audit) {
|
|
91
|
+
// Intentional no-op.
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* A development AuditSink that writes a compact JSON line to stdout.
|
|
96
|
+
* Not for production use — use a structured logging sink there.
|
|
97
|
+
*
|
|
98
|
+
* Output format (one JSON object per line):
|
|
99
|
+
* {
|
|
100
|
+
* "skill": "<name>@<version>",
|
|
101
|
+
* "outcome": "accepted" | "rejected",
|
|
102
|
+
* "schema": "<output_schema>",
|
|
103
|
+
* "trigger": "<kind>",
|
|
104
|
+
* "input": "<first 80 chars of rawInput>",
|
|
105
|
+
* "at": "<ISO 8601 timestamp>",
|
|
106
|
+
* "reason": "<rejectionReason>" — only present when rejected
|
|
107
|
+
* }
|
|
108
|
+
*/
|
|
109
|
+
export const CONSOLE_AUDIT_SINK = {
|
|
110
|
+
async record(audit) {
|
|
111
|
+
// Build a plain object; JSON.stringify omits undefined values automatically,
|
|
112
|
+
// so `reason` is only present in the output when rejectionReason is defined.
|
|
113
|
+
const entry = {
|
|
114
|
+
skill: `${audit.skillName}@${audit.skillVersion}`,
|
|
115
|
+
outcome: audit.validationOutcome,
|
|
116
|
+
schema: audit.outputSchema,
|
|
117
|
+
trigger: audit.triggerReason.kind,
|
|
118
|
+
input: audit.rawInput.slice(0, 80),
|
|
119
|
+
at: audit.invokedAt.toISOString(),
|
|
120
|
+
reason: audit.rejectionReason, // undefined → omitted by JSON.stringify
|
|
121
|
+
source: audit.sourcePath, // undefined → omitted by JSON.stringify
|
|
122
|
+
};
|
|
123
|
+
console.log('[SkillAudit]', JSON.stringify(entry));
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
// Utility — build a source path map from a registry
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
/**
|
|
130
|
+
* Build a ReadonlyMap<string, string> from skill name to source path.
|
|
131
|
+
* Pass the result as `options.sourcePaths` to populate `sourcePath` in
|
|
132
|
+
* audit records.
|
|
133
|
+
*
|
|
134
|
+
* Usage:
|
|
135
|
+
* const sourcePaths = buildSourcePathMap(registry.all);
|
|
136
|
+
* const records = buildAuditRecords(result, { sourcePaths });
|
|
137
|
+
*
|
|
138
|
+
* Accepts any iterable of objects with `metadata.name` and `sourcePath`.
|
|
139
|
+
*/
|
|
140
|
+
export function buildSourcePathMap(skills) {
|
|
141
|
+
const map = new Map();
|
|
142
|
+
for (const skill of skills) {
|
|
143
|
+
map.set(skill.metadata.name, skill.sourcePath);
|
|
144
|
+
}
|
|
145
|
+
return map;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../src/skills/audit.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UseSteady Skills v1 — invocation helper (file 6 of 8).
|
|
3
|
+
*
|
|
4
|
+
* This file is the boundary between the registry and anything that actually
|
|
5
|
+
* produces skill output. It is the most sensitive module in the system.
|
|
6
|
+
*
|
|
7
|
+
* What this file owns:
|
|
8
|
+
* - The SkillModelAdapter interface (the only abstraction over output production)
|
|
9
|
+
* - Per-skill invocation with full error isolation
|
|
10
|
+
* - Output schema validation (adapter output must match the skill's declared schema)
|
|
11
|
+
* - Per-invocation provenance (name, version, schema, raw output, outcome)
|
|
12
|
+
* - The aggregate InvokeSkillsResult shape the caller receives
|
|
13
|
+
*
|
|
14
|
+
* What this file explicitly does NOT own:
|
|
15
|
+
* - Deciding whether the deterministic parser was right (caller's responsibility)
|
|
16
|
+
* - Deciding whether input is "plausibly actionable" (caller's responsibility)
|
|
17
|
+
* - Deciding policy or approval (never, anywhere in the Skills layer)
|
|
18
|
+
* - Merging skill output into canonical execution state (UseSteady core's job)
|
|
19
|
+
* - Auto-fallback across kinds (there is no fallback here)
|
|
20
|
+
* - Choosing a different trigger kind than what the caller provided
|
|
21
|
+
*
|
|
22
|
+
* Deterministic-first boundary:
|
|
23
|
+
* Callers decide to invoke skills — this file does not. A caller invokes
|
|
24
|
+
* this helper only after the deterministic parser has run and its result
|
|
25
|
+
* made a trigger decision. The TriggerReason parameter carries that decision
|
|
26
|
+
* forward so it is preserved in every provenance record.
|
|
27
|
+
*/
|
|
28
|
+
import { type LoadedSkillRegistry, type Skill, type SkillOutput, type SkillOutputSchema, type TriggerReason } from './types.js';
|
|
29
|
+
/**
|
|
30
|
+
* The only abstraction point over output production in the Skills v1 layer.
|
|
31
|
+
*
|
|
32
|
+
* An adapter receives a fully loaded Skill (metadata + body instructions) and
|
|
33
|
+
* the raw user input, then produces the skill's typed output or null.
|
|
34
|
+
*
|
|
35
|
+
* Contract:
|
|
36
|
+
* - Return a SkillOutput whose `schema` field matches skill.metadata.output_schema.
|
|
37
|
+
* - Return null to signal "this skill has nothing to contribute for this input"
|
|
38
|
+
* without constituting a failure (distinct from an empty candidates/steps/suggestions
|
|
39
|
+
* array, which signals "the skill ran and found nothing applicable").
|
|
40
|
+
* - May throw — the invocation helper wraps all adapter errors as rejections.
|
|
41
|
+
* - Must NOT execute filesystem operations, approve anything, or call UseSteady core.
|
|
42
|
+
*
|
|
43
|
+
* In production this wraps an LLM call. In tests it is a controlled stub.
|
|
44
|
+
*/
|
|
45
|
+
export interface SkillModelAdapter {
|
|
46
|
+
invoke(skill: Skill, rawInput: string): Promise<SkillOutput | null>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The result of invoking one Skill via an adapter.
|
|
50
|
+
*
|
|
51
|
+
* Every field except `rejectionReason` is always present.
|
|
52
|
+
* `rejectionReason` is physically absent (not undefined) when the invocation
|
|
53
|
+
* was accepted — required by exactOptionalPropertyTypes: true.
|
|
54
|
+
*
|
|
55
|
+
* This shape carries enough information for the audit logger (file 7) to
|
|
56
|
+
* produce a SkillAuditRecord without re-querying the registry.
|
|
57
|
+
*/
|
|
58
|
+
export interface SkillInvocationResult {
|
|
59
|
+
readonly skillName: string;
|
|
60
|
+
readonly skillVersion: string;
|
|
61
|
+
readonly outputSchema: SkillOutputSchema;
|
|
62
|
+
/**
|
|
63
|
+
* The raw output returned by the adapter, or null if:
|
|
64
|
+
* - the adapter returned null (declined to contribute), or
|
|
65
|
+
* - the adapter threw an error.
|
|
66
|
+
* Even when rejected due to schema mismatch, the raw output is preserved
|
|
67
|
+
* here so the audit log captures what the adapter actually returned.
|
|
68
|
+
*/
|
|
69
|
+
readonly rawOutput: SkillOutput | null;
|
|
70
|
+
readonly validationOutcome: 'accepted' | 'rejected';
|
|
71
|
+
/** Absent when accepted; present (as a string, not undefined) when rejected. */
|
|
72
|
+
readonly rejectionReason?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The result of invoking all triggerable skills for a given trigger context.
|
|
76
|
+
*
|
|
77
|
+
* `results` is the full list including rejections — callers and the audit
|
|
78
|
+
* logger should use this for complete provenance.
|
|
79
|
+
*
|
|
80
|
+
* `accepted` is a convenience slice: only the non-null outputs from skills
|
|
81
|
+
* whose validationOutcome === 'accepted'. Callers presenting output to the
|
|
82
|
+
* user should iterate this list, not `results`.
|
|
83
|
+
*/
|
|
84
|
+
export interface InvokeSkillsResult {
|
|
85
|
+
readonly triggerReason: TriggerReason;
|
|
86
|
+
readonly rawInput: string;
|
|
87
|
+
/** All invocation results in priority order. May include rejections. */
|
|
88
|
+
readonly results: readonly SkillInvocationResult[];
|
|
89
|
+
/** Accepted, non-null outputs in priority order. May be empty. */
|
|
90
|
+
readonly accepted: readonly SkillOutput[];
|
|
91
|
+
}
|
|
92
|
+
export interface InvokeSkillsOptions {
|
|
93
|
+
readonly registry: LoadedSkillRegistry;
|
|
94
|
+
readonly triggerReason: TriggerReason;
|
|
95
|
+
/**
|
|
96
|
+
* The raw user input string, passed unchanged to each adapter invocation.
|
|
97
|
+
* Also stored in InvokeSkillsResult for provenance.
|
|
98
|
+
*/
|
|
99
|
+
readonly rawInput: string;
|
|
100
|
+
readonly adapter: SkillModelAdapter;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Invoke all triggerable skills for a given trigger context and return their
|
|
104
|
+
* results with full provenance.
|
|
105
|
+
*
|
|
106
|
+
* Deterministic-first enforcement:
|
|
107
|
+
* This function does not decide when to consult skills. The caller has
|
|
108
|
+
* already made that decision by constructing a TriggerReason. This function
|
|
109
|
+
* executes the decision — no more, no less.
|
|
110
|
+
*
|
|
111
|
+
* No auto-fallback:
|
|
112
|
+
* If no skills are loaded for the trigger kind, or if all invocations are
|
|
113
|
+
* rejected, the returned `accepted` array is empty. The caller decides what
|
|
114
|
+
* to do with an empty result — this function does not try another kind.
|
|
115
|
+
*
|
|
116
|
+
* Ordering:
|
|
117
|
+
* Skills are already in priority order from the registry (buildRegistry).
|
|
118
|
+
* Results preserve that order. Promise.all runs adapter calls concurrently
|
|
119
|
+
* but preserves input order in the output array.
|
|
120
|
+
*
|
|
121
|
+
* Isolation:
|
|
122
|
+
* Each skill is invoked independently. An adapter error for one skill
|
|
123
|
+
* becomes a rejection for that skill; other skills continue to run.
|
|
124
|
+
*
|
|
125
|
+
* @param options.registry The loaded skill registry.
|
|
126
|
+
* @param options.triggerReason The trigger context — drives which skill kind is consulted.
|
|
127
|
+
* @param options.rawInput The raw user input, passed unchanged to each adapter.
|
|
128
|
+
* @param options.adapter The model adapter that produces skill output.
|
|
129
|
+
*/
|
|
130
|
+
export declare function invokeSkillsForTrigger(options: InvokeSkillsOptions): Promise<InvokeSkillsResult>;
|
|
131
|
+
//# sourceMappingURL=invocation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invocation.d.ts","sourceRoot":"","sources":["../../../src/skills/invocation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAMpB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACrE;AAMD;;;;;;;;;GASG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,iBAAiB,EAAE,UAAU,GAAG,UAAU,CAAC;IACpD,gFAAgF;IAChF,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAMD;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACnD,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;CAC3C;AAMD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;CACrC;AA+GD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,kBAAkB,CAAC,CAwB7B"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UseSteady Skills v1 — invocation helper (file 6 of 8).
|
|
3
|
+
*
|
|
4
|
+
* This file is the boundary between the registry and anything that actually
|
|
5
|
+
* produces skill output. It is the most sensitive module in the system.
|
|
6
|
+
*
|
|
7
|
+
* What this file owns:
|
|
8
|
+
* - The SkillModelAdapter interface (the only abstraction over output production)
|
|
9
|
+
* - Per-skill invocation with full error isolation
|
|
10
|
+
* - Output schema validation (adapter output must match the skill's declared schema)
|
|
11
|
+
* - Per-invocation provenance (name, version, schema, raw output, outcome)
|
|
12
|
+
* - The aggregate InvokeSkillsResult shape the caller receives
|
|
13
|
+
*
|
|
14
|
+
* What this file explicitly does NOT own:
|
|
15
|
+
* - Deciding whether the deterministic parser was right (caller's responsibility)
|
|
16
|
+
* - Deciding whether input is "plausibly actionable" (caller's responsibility)
|
|
17
|
+
* - Deciding policy or approval (never, anywhere in the Skills layer)
|
|
18
|
+
* - Merging skill output into canonical execution state (UseSteady core's job)
|
|
19
|
+
* - Auto-fallback across kinds (there is no fallback here)
|
|
20
|
+
* - Choosing a different trigger kind than what the caller provided
|
|
21
|
+
*
|
|
22
|
+
* Deterministic-first boundary:
|
|
23
|
+
* Callers decide to invoke skills — this file does not. A caller invokes
|
|
24
|
+
* this helper only after the deterministic parser has run and its result
|
|
25
|
+
* made a trigger decision. The TriggerReason parameter carries that decision
|
|
26
|
+
* forward so it is preserved in every provenance record.
|
|
27
|
+
*/
|
|
28
|
+
import { getTriggerableSkills } from './registry.js';
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
// Internal — output schema validation
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
/**
|
|
33
|
+
* Validate that the adapter's output schema matches the skill's declared schema.
|
|
34
|
+
*
|
|
35
|
+
* This is the only structural check the invocation helper performs.
|
|
36
|
+
* Full candidate/step/suggestion validation is the responsibility of the
|
|
37
|
+
* consumer (UseSteady's validation layer), not this boundary helper.
|
|
38
|
+
*
|
|
39
|
+
* The check compares `output.schema` against `skill.metadata.output_schema`.
|
|
40
|
+
* `skill.metadata.output_schema` was verified against KIND_SCHEMA_MAP at
|
|
41
|
+
* load time, so this check transitively enforces the kind→schema mapping.
|
|
42
|
+
*/
|
|
43
|
+
function validateAdapterOutput(skill, output) {
|
|
44
|
+
if (output.schema !== skill.metadata.output_schema) {
|
|
45
|
+
return {
|
|
46
|
+
valid: false,
|
|
47
|
+
reason: `Adapter returned schema "${output.schema}" ` +
|
|
48
|
+
`but skill "${skill.metadata.name}" declared "${skill.metadata.output_schema}". ` +
|
|
49
|
+
`Output is rejected; raw output preserved in provenance record.`,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return { valid: true };
|
|
53
|
+
}
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// Internal — single-skill invocation
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
/**
|
|
58
|
+
* Invoke one Skill via the adapter and return a provenance record.
|
|
59
|
+
*
|
|
60
|
+
* Failure modes and their outcomes:
|
|
61
|
+
* Adapter throws → rejected, rawOutput: null, rejectionReason: error message
|
|
62
|
+
* Adapter returns null → rejected, rawOutput: null, rejectionReason: "declined"
|
|
63
|
+
* Schema mismatch → rejected, rawOutput: <raw> (preserved for audit)
|
|
64
|
+
* Schema matches → accepted, rawOutput: <output>
|
|
65
|
+
*
|
|
66
|
+
* exactOptionalPropertyTypes compliance:
|
|
67
|
+
* `rejectionReason` is included only in rejected branches.
|
|
68
|
+
* Accepted results omit the field entirely (not set to undefined).
|
|
69
|
+
*/
|
|
70
|
+
async function invokeOneSkill(skill, rawInput, adapter) {
|
|
71
|
+
// Provenance fields that are always present, regardless of outcome.
|
|
72
|
+
const provenance = {
|
|
73
|
+
skillName: skill.metadata.name,
|
|
74
|
+
skillVersion: skill.metadata.version,
|
|
75
|
+
outputSchema: skill.metadata.output_schema,
|
|
76
|
+
};
|
|
77
|
+
// ── Adapter call — isolated, any throw becomes a rejection ────────────────
|
|
78
|
+
let output;
|
|
79
|
+
try {
|
|
80
|
+
output = await adapter.invoke(skill, rawInput);
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
return {
|
|
84
|
+
...provenance,
|
|
85
|
+
rawOutput: null,
|
|
86
|
+
validationOutcome: 'rejected',
|
|
87
|
+
rejectionReason: `Adapter threw: ${err instanceof Error ? err.message : String(err)}`,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
// ── null return — skill declined to contribute ────────────────────────────
|
|
91
|
+
if (output === null) {
|
|
92
|
+
return {
|
|
93
|
+
...provenance,
|
|
94
|
+
rawOutput: null,
|
|
95
|
+
validationOutcome: 'rejected',
|
|
96
|
+
rejectionReason: 'Adapter returned null — skill has nothing to contribute for this input.',
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
// ── Schema validation ─────────────────────────────────────────────────────
|
|
100
|
+
const check = validateAdapterOutput(skill, output);
|
|
101
|
+
if (!check.valid) {
|
|
102
|
+
return {
|
|
103
|
+
...provenance,
|
|
104
|
+
// Preserve raw output even on rejection so audit logs capture what
|
|
105
|
+
// the adapter actually returned, not just that it failed.
|
|
106
|
+
rawOutput: output,
|
|
107
|
+
validationOutcome: 'rejected',
|
|
108
|
+
rejectionReason: check.reason,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
// ── Accepted — rejectionReason is absent (not set to undefined) ───────────
|
|
112
|
+
return {
|
|
113
|
+
...provenance,
|
|
114
|
+
rawOutput: output,
|
|
115
|
+
validationOutcome: 'accepted',
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
// ---------------------------------------------------------------------------
|
|
119
|
+
// Public API
|
|
120
|
+
// ---------------------------------------------------------------------------
|
|
121
|
+
/**
|
|
122
|
+
* Invoke all triggerable skills for a given trigger context and return their
|
|
123
|
+
* results with full provenance.
|
|
124
|
+
*
|
|
125
|
+
* Deterministic-first enforcement:
|
|
126
|
+
* This function does not decide when to consult skills. The caller has
|
|
127
|
+
* already made that decision by constructing a TriggerReason. This function
|
|
128
|
+
* executes the decision — no more, no less.
|
|
129
|
+
*
|
|
130
|
+
* No auto-fallback:
|
|
131
|
+
* If no skills are loaded for the trigger kind, or if all invocations are
|
|
132
|
+
* rejected, the returned `accepted` array is empty. The caller decides what
|
|
133
|
+
* to do with an empty result — this function does not try another kind.
|
|
134
|
+
*
|
|
135
|
+
* Ordering:
|
|
136
|
+
* Skills are already in priority order from the registry (buildRegistry).
|
|
137
|
+
* Results preserve that order. Promise.all runs adapter calls concurrently
|
|
138
|
+
* but preserves input order in the output array.
|
|
139
|
+
*
|
|
140
|
+
* Isolation:
|
|
141
|
+
* Each skill is invoked independently. An adapter error for one skill
|
|
142
|
+
* becomes a rejection for that skill; other skills continue to run.
|
|
143
|
+
*
|
|
144
|
+
* @param options.registry The loaded skill registry.
|
|
145
|
+
* @param options.triggerReason The trigger context — drives which skill kind is consulted.
|
|
146
|
+
* @param options.rawInput The raw user input, passed unchanged to each adapter.
|
|
147
|
+
* @param options.adapter The model adapter that produces skill output.
|
|
148
|
+
*/
|
|
149
|
+
export async function invokeSkillsForTrigger(options) {
|
|
150
|
+
const { registry, triggerReason, rawInput, adapter } = options;
|
|
151
|
+
// Retrieve the skills eligible for this trigger context.
|
|
152
|
+
// No cross-kind fallback — if this list is empty, accepted will be empty.
|
|
153
|
+
const skills = getTriggerableSkills(registry, triggerReason);
|
|
154
|
+
// Invoke each skill independently and concurrently.
|
|
155
|
+
// Skills are already in priority order; Promise.all preserves that order.
|
|
156
|
+
const results = await Promise.all(skills.map((skill) => invokeOneSkill(skill, rawInput, adapter)));
|
|
157
|
+
// Extract accepted outputs for caller convenience.
|
|
158
|
+
// The type predicate narrows rawOutput from SkillOutput | null to SkillOutput
|
|
159
|
+
// so the .map below can safely return SkillOutput (not SkillOutput | null).
|
|
160
|
+
const accepted = results
|
|
161
|
+
.filter((r) => r.validationOutcome === 'accepted' && r.rawOutput !== null)
|
|
162
|
+
.map((r) => r.rawOutput);
|
|
163
|
+
return { triggerReason, rawInput, results, accepted };
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=invocation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invocation.js","sourceRoot":"","sources":["../../../src/skills/invocation.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UseSteady Skills v1 — loader/scanner (file 4 of 8).
|
|
3
|
+
*
|
|
4
|
+
* Single responsibility: discover all SKILL.md files under a base directory,
|
|
5
|
+
* pipe each through the parser → validator chain, and return a sorted registry
|
|
6
|
+
* of accepted skills alongside a full list of structured rejections.
|
|
7
|
+
*
|
|
8
|
+
* Design rules:
|
|
9
|
+
* - A broken skill produces a rejection entry and is skipped. It never
|
|
10
|
+
* prevents other skills from loading (partial-failure guarantee).
|
|
11
|
+
* - Accepted skills are sorted deterministically:
|
|
12
|
+
* 1. by kind (interpretation → workflow_generation → recovery)
|
|
13
|
+
* 2. then ascending priority (lower number = evaluated first)
|
|
14
|
+
* 3. then source path as a stable alphabetical tie-break
|
|
15
|
+
* - Each rejection carries its file path, the pipeline stage that failed
|
|
16
|
+
* (parser or validator), and the full structured issue list.
|
|
17
|
+
* - No invocation logic, no audit writes, no side effects beyond I/O.
|
|
18
|
+
*/
|
|
19
|
+
import { type Skill, type SkillValidationIssue, type LoadedSkillRegistry } from './types.js';
|
|
20
|
+
/**
|
|
21
|
+
* A skill file that was found but could not be loaded at either the
|
|
22
|
+
* parser or validator stage.
|
|
23
|
+
*/
|
|
24
|
+
export interface SkillRejection {
|
|
25
|
+
readonly sourcePath: string;
|
|
26
|
+
/** Whether the failure occurred during parsing or validation. */
|
|
27
|
+
readonly stage: 'parser' | 'validator';
|
|
28
|
+
/**
|
|
29
|
+
* All structured issues collected at that stage.
|
|
30
|
+
* Parser issues are syntax errors; validator issues are spec violations.
|
|
31
|
+
* Always non-empty.
|
|
32
|
+
*/
|
|
33
|
+
readonly issues: readonly SkillValidationIssue[];
|
|
34
|
+
}
|
|
35
|
+
/** The complete result of a scan pass. */
|
|
36
|
+
export interface ScanResult {
|
|
37
|
+
readonly registry: LoadedSkillRegistry;
|
|
38
|
+
readonly rejections: readonly SkillRejection[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Build a LoadedSkillRegistry from a list of accepted Skill objects.
|
|
42
|
+
*
|
|
43
|
+
* Skills are sorted once via compareSkills, then distributed into per-kind
|
|
44
|
+
* buckets using an exhaustive switch (no index-signature access, safe under
|
|
45
|
+
* noUncheckedIndexedAccess).
|
|
46
|
+
*
|
|
47
|
+
* The `loadedAt` timestamp is recorded here so that callers can compare
|
|
48
|
+
* registry age against source change timestamps if needed.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildRegistry(accepted: readonly Skill[]): LoadedSkillRegistry;
|
|
51
|
+
/**
|
|
52
|
+
* Scan `baseDir` recursively for SKILL.md files, parse and validate each one,
|
|
53
|
+
* and return a sorted registry of accepted skills alongside a full rejection list.
|
|
54
|
+
*
|
|
55
|
+
* Partial-failure guarantee
|
|
56
|
+
* ─────────────────────────
|
|
57
|
+
* Each file is processed independently inside a try/catch. A parse failure,
|
|
58
|
+
* validation failure, or unexpected error for one file produces a SkillRejection
|
|
59
|
+
* and is skipped. Other files continue to load normally.
|
|
60
|
+
*
|
|
61
|
+
* The one unrecoverable case is if the directory itself cannot be read (ENOENT,
|
|
62
|
+
* EACCES, etc.) — that throws SkillLoadError(SCAN_FAILED) because there is
|
|
63
|
+
* nothing meaningful to return.
|
|
64
|
+
*
|
|
65
|
+
* @param baseDir Absolute path to the skills root directory.
|
|
66
|
+
*
|
|
67
|
+
* @throws SkillLoadError(SCAN_FAILED) if baseDir cannot be read.
|
|
68
|
+
*/
|
|
69
|
+
export declare function scanSkillsDirectory(baseDir: string): Promise<ScanResult>;
|
|
70
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/skills/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,EAGL,KAAK,KAAK,EAEV,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,YAAY,CAAC;AAMpB;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,WAAW,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAC;CAClD;AAED,0CAA0C;AAC1C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,UAAU,EAAE,SAAS,cAAc,EAAE,CAAC;CAChD;AA0ED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,KAAK,EAAE,GAAG,mBAAmB,CA8B7E;AAsCD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAkD9E"}
|