@xoxoai/checkmate 0.6.7 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/checkmate.js +13375 -0
- package/package.json +14 -100
- package/plugin/.claude-plugin/plugin.json +10 -0
- package/plugin/bin/checkmate.ts +3 -0
- package/plugin/contracts/finding.schema.json +78 -0
- package/plugin/contracts/gap.schema.json +56 -0
- package/plugin/contracts/plan-candidate.schema.json +103 -0
- package/plugin/contracts/plan-delta.schema.json +63 -0
- package/plugin/contracts/plan-patch.schema.json +116 -0
- package/plugin/contracts/plan-request.schema.json +108 -0
- package/plugin/contracts/plan.schema.json +313 -0
- package/plugin/contracts/profile.schema.json +154 -0
- package/plugin/contracts/response.schema.json +25 -0
- package/plugin/contracts/result.schema.json +410 -0
- package/plugin/dist/checkmate.js +13012 -0
- package/plugin/package.json +4 -0
- package/plugin/references/browser.md +35 -0
- package/plugin/references/http.md +30 -0
- package/plugin/references/workflow.md +122 -0
- package/plugin/skills/execute/SKILL.md +92 -0
- package/plugin/skills/plan/SKILL.md +94 -0
- package/plugin/skills/report/SKILL.md +28 -0
- package/plugin/skills/revise/SKILL.md +43 -0
- package/plugin/skills/setup/SKILL.md +82 -0
- package/plugin/skills/status/SKILL.md +20 -0
- package/plugin/skills/ui/SKILL.md +26 -0
- package/plugin/src/actor.ts +21 -0
- package/plugin/src/cli.ts +1133 -0
- package/plugin/src/contracts.ts +342 -0
- package/plugin/src/index.ts +52 -0
- package/plugin/src/plans.ts +1028 -0
- package/plugin/src/render.ts +544 -0
- package/plugin/src/runs.ts +868 -0
- package/plugin/src/store.ts +384 -0
- package/plugin/src/targets.ts +205 -0
- package/plugin/src/types.ts +319 -0
- package/plugin/src/ui/assets/client.js +501 -0
- package/plugin/src/ui/assets/favicon.svg +1 -0
- package/plugin/src/ui/assets/fonts/inter-OFL.txt +93 -0
- package/plugin/src/ui/assets/fonts/inter.woff2 +0 -0
- package/plugin/src/ui/assets/fonts/jetbrains-mono-OFL.txt +93 -0
- package/plugin/src/ui/assets/fonts/jetbrains-mono.woff2 +0 -0
- package/plugin/src/ui/assets/fonts/space-grotesk-OFL.txt +93 -0
- package/plugin/src/ui/assets/fonts/space-grotesk.woff2 +0 -0
- package/plugin/src/ui/assets/style.css +1926 -0
- package/plugin/src/ui/edit.ts +305 -0
- package/plugin/src/ui/forms.ts +209 -0
- package/plugin/src/ui/html.ts +130 -0
- package/plugin/src/ui/layout.ts +198 -0
- package/plugin/src/ui/lists.ts +645 -0
- package/plugin/src/ui/plan.ts +577 -0
- package/plugin/src/ui/run.ts +489 -0
- package/plugin/src/ui/server.ts +684 -0
- package/plugin/src/validators.d.ts +13 -0
- package/plugin/src/validators.js +1 -0
- package/plugin/src/views.ts +839 -0
- package/LICENSE +0 -21
- package/README.md +0 -294
- package/bin/checkmate.js +0 -13
- package/dist/ai/client.d.ts +0 -64
- package/dist/ai/client.d.ts.map +0 -1
- package/dist/ai/client.js +0 -313
- package/dist/ai/client.js.map +0 -1
- package/dist/ai/message-handler.d.ts +0 -9
- package/dist/ai/message-handler.d.ts.map +0 -1
- package/dist/ai/message-handler.js +0 -50
- package/dist/ai/message-handler.js.map +0 -1
- package/dist/ai/message-history.d.ts +0 -17
- package/dist/ai/message-history.d.ts.map +0 -1
- package/dist/ai/message-history.js +0 -45
- package/dist/ai/message-history.js.map +0 -1
- package/dist/ai/prompts.d.ts +0 -4
- package/dist/ai/prompts.d.ts.map +0 -1
- package/dist/ai/prompts.js +0 -24
- package/dist/ai/prompts.js.map +0 -1
- package/dist/ai/rate-limit-policy.d.ts +0 -9
- package/dist/ai/rate-limit-policy.d.ts.map +0 -1
- package/dist/ai/rate-limit-policy.js +0 -34
- package/dist/ai/rate-limit-policy.js.map +0 -1
- package/dist/ai/tool-response-handler.d.ts +0 -16
- package/dist/ai/tool-response-handler.d.ts.map +0 -1
- package/dist/ai/tool-response-handler.js +0 -85
- package/dist/ai/tool-response-handler.js.map +0 -1
- package/dist/ai/turn-processor.d.ts +0 -34
- package/dist/ai/turn-processor.d.ts.map +0 -1
- package/dist/ai/turn-processor.js +0 -107
- package/dist/ai/turn-processor.js.map +0 -1
- package/dist/api/allocate-run-identity.d.ts +0 -8
- package/dist/api/allocate-run-identity.d.ts.map +0 -1
- package/dist/api/allocate-run-identity.js +0 -10
- package/dist/api/allocate-run-identity.js.map +0 -1
- package/dist/api/execute-prepared-run.d.ts +0 -22
- package/dist/api/execute-prepared-run.d.ts.map +0 -1
- package/dist/api/execute-prepared-run.js +0 -184
- package/dist/api/execute-prepared-run.js.map +0 -1
- package/dist/api/index.d.ts +0 -25
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js +0 -69
- package/dist/api/index.js.map +0 -1
- package/dist/api/prepare-run.d.ts +0 -44
- package/dist/api/prepare-run.d.ts.map +0 -1
- package/dist/api/prepare-run.js +0 -261
- package/dist/api/prepare-run.js.map +0 -1
- package/dist/cli/diagnostic-relay.d.ts +0 -6
- package/dist/cli/diagnostic-relay.d.ts.map +0 -1
- package/dist/cli/diagnostic-relay.js +0 -6
- package/dist/cli/diagnostic-relay.js.map +0 -1
- package/dist/cli/main.d.ts +0 -21
- package/dist/cli/main.d.ts.map +0 -1
- package/dist/cli/main.js +0 -166
- package/dist/cli/main.js.map +0 -1
- package/dist/cli/protocol.d.ts +0 -57
- package/dist/cli/protocol.d.ts.map +0 -1
- package/dist/cli/protocol.js +0 -116
- package/dist/cli/protocol.js.map +0 -1
- package/dist/cli/reconcile-result.d.ts +0 -13
- package/dist/cli/reconcile-result.d.ts.map +0 -1
- package/dist/cli/reconcile-result.js +0 -300
- package/dist/cli/reconcile-result.js.map +0 -1
- package/dist/cli/run-parent.d.ts +0 -37
- package/dist/cli/run-parent.d.ts.map +0 -1
- package/dist/cli/run-parent.js +0 -491
- package/dist/cli/run-parent.js.map +0 -1
- package/dist/cli/signals.d.ts +0 -36
- package/dist/cli/signals.d.ts.map +0 -1
- package/dist/cli/signals.js +0 -85
- package/dist/cli/signals.js.map +0 -1
- package/dist/cli/static-commands.d.ts +0 -11
- package/dist/cli/static-commands.d.ts.map +0 -1
- package/dist/cli/static-commands.js +0 -83
- package/dist/cli/static-commands.js.map +0 -1
- package/dist/cli/worker-stream-guard.d.ts +0 -20
- package/dist/cli/worker-stream-guard.d.ts.map +0 -1
- package/dist/cli/worker-stream-guard.js +0 -41
- package/dist/cli/worker-stream-guard.js.map +0 -1
- package/dist/cli/worker.d.ts +0 -3
- package/dist/cli/worker.d.ts.map +0 -1
- package/dist/cli/worker.js +0 -111
- package/dist/cli/worker.js.map +0 -1
- package/dist/config/ingestion.d.ts +0 -58
- package/dist/config/ingestion.d.ts.map +0 -1
- package/dist/config/ingestion.js +0 -283
- package/dist/config/ingestion.js.map +0 -1
- package/dist/config/manifest.d.ts +0 -20
- package/dist/config/manifest.d.ts.map +0 -1
- package/dist/config/manifest.js +0 -91
- package/dist/config/manifest.js.map +0 -1
- package/dist/config/model-egress.d.ts +0 -10
- package/dist/config/model-egress.d.ts.map +0 -1
- package/dist/config/model-egress.js +0 -62
- package/dist/config/model-egress.js.map +0 -1
- package/dist/config/package-resolution.d.ts +0 -4
- package/dist/config/package-resolution.d.ts.map +0 -1
- package/dist/config/package-resolution.js +0 -24
- package/dist/config/package-resolution.js.map +0 -1
- package/dist/config/policy.d.ts +0 -44
- package/dist/config/policy.d.ts.map +0 -1
- package/dist/config/policy.js +0 -141
- package/dist/config/policy.js.map +0 -1
- package/dist/config/record.d.ts +0 -4
- package/dist/config/record.d.ts.map +0 -1
- package/dist/config/record.js +0 -10
- package/dist/config/record.js.map +0 -1
- package/dist/config/secrets.d.ts +0 -11
- package/dist/config/secrets.d.ts.map +0 -1
- package/dist/config/secrets.js +0 -42
- package/dist/config/secrets.js.map +0 -1
- package/dist/contracts/diagnostics.d.ts +0 -4
- package/dist/contracts/diagnostics.d.ts.map +0 -1
- package/dist/contracts/diagnostics.js +0 -31
- package/dist/contracts/diagnostics.js.map +0 -1
- package/dist/contracts/serialize.d.ts +0 -2
- package/dist/contracts/serialize.d.ts.map +0 -1
- package/dist/contracts/serialize.js +0 -90
- package/dist/contracts/serialize.js.map +0 -1
- package/dist/contracts/types.d.ts +0 -316
- package/dist/contracts/types.d.ts.map +0 -1
- package/dist/contracts/types.js +0 -74
- package/dist/contracts/types.js.map +0 -1
- package/dist/contracts/validator.d.ts +0 -8
- package/dist/contracts/validator.d.ts.map +0 -1
- package/dist/contracts/validator.js +0 -71
- package/dist/contracts/validator.js.map +0 -1
- package/dist/driver.d.ts +0 -97
- package/dist/driver.d.ts.map +0 -1
- package/dist/driver.js +0 -24
- package/dist/driver.js.map +0 -1
- package/dist/drivers/descriptor.d.ts +0 -15
- package/dist/drivers/descriptor.d.ts.map +0 -1
- package/dist/drivers/descriptor.js +0 -122
- package/dist/drivers/descriptor.js.map +0 -1
- package/dist/drivers/loader.d.ts +0 -18
- package/dist/drivers/loader.d.ts.map +0 -1
- package/dist/drivers/loader.js +0 -97
- package/dist/drivers/loader.js.map +0 -1
- package/dist/drivers/web/checkmate-driver.json +0 -47
- package/dist/drivers/web/index.d.ts +0 -6
- package/dist/drivers/web/index.d.ts.map +0 -1
- package/dist/drivers/web/index.js +0 -27
- package/dist/drivers/web/index.js.map +0 -1
- package/dist/drivers/web/session.d.ts +0 -25
- package/dist/drivers/web/session.d.ts.map +0 -1
- package/dist/drivers/web/session.js +0 -132
- package/dist/drivers/web/session.js.map +0 -1
- package/dist/drivers/web/tools/network-request-recorder.d.ts +0 -46
- package/dist/drivers/web/tools/network-request-recorder.d.ts.map +0 -1
- package/dist/drivers/web/tools/network-request-recorder.js +0 -164
- package/dist/drivers/web/tools/network-request-recorder.js.map +0 -1
- package/dist/drivers/web/tools/screenshot-service.d.ts +0 -10
- package/dist/drivers/web/tools/screenshot-service.d.ts.map +0 -1
- package/dist/drivers/web/tools/screenshot-service.js +0 -23
- package/dist/drivers/web/tools/screenshot-service.js.map +0 -1
- package/dist/drivers/web/tools/snapshot-filter/index.d.ts +0 -4
- package/dist/drivers/web/tools/snapshot-filter/index.d.ts.map +0 -1
- package/dist/drivers/web/tools/snapshot-filter/index.js +0 -4
- package/dist/drivers/web/tools/snapshot-filter/index.js.map +0 -1
- package/dist/drivers/web/tools/snapshot-filter/semantic-scorer.d.ts +0 -15
- package/dist/drivers/web/tools/snapshot-filter/semantic-scorer.d.ts.map +0 -1
- package/dist/drivers/web/tools/snapshot-filter/semantic-scorer.js +0 -99
- package/dist/drivers/web/tools/snapshot-filter/semantic-scorer.js.map +0 -1
- package/dist/drivers/web/tools/snapshot-filter/snapshot-filter.d.ts +0 -5
- package/dist/drivers/web/tools/snapshot-filter/snapshot-filter.d.ts.map +0 -1
- package/dist/drivers/web/tools/snapshot-filter/snapshot-filter.js +0 -56
- package/dist/drivers/web/tools/snapshot-filter/snapshot-filter.js.map +0 -1
- package/dist/drivers/web/tools/snapshot-filter/tree-reconstructor.d.ts +0 -3
- package/dist/drivers/web/tools/snapshot-filter/tree-reconstructor.d.ts.map +0 -1
- package/dist/drivers/web/tools/snapshot-filter/tree-reconstructor.js +0 -85
- package/dist/drivers/web/tools/snapshot-filter/tree-reconstructor.js.map +0 -1
- package/dist/drivers/web/tools/snapshot-service.d.ts +0 -31
- package/dist/drivers/web/tools/snapshot-service.d.ts.map +0 -1
- package/dist/drivers/web/tools/snapshot-service.js +0 -96
- package/dist/drivers/web/tools/snapshot-service.js.map +0 -1
- package/dist/drivers/web/tools/tool.d.ts +0 -76
- package/dist/drivers/web/tools/tool.d.ts.map +0 -1
- package/dist/drivers/web/tools/tool.js +0 -562
- package/dist/drivers/web/tools/tool.js.map +0 -1
- package/dist/drivers/web/tools/transient-state-tracker.d.ts +0 -26
- package/dist/drivers/web/tools/transient-state-tracker.d.ts.map +0 -1
- package/dist/drivers/web/tools/transient-state-tracker.js +0 -301
- package/dist/drivers/web/tools/transient-state-tracker.js.map +0 -1
- package/dist/drivers/web/tools/types.d.ts +0 -11
- package/dist/drivers/web/tools/types.d.ts.map +0 -1
- package/dist/drivers/web/tools/types.js +0 -2
- package/dist/drivers/web/tools/types.js.map +0 -1
- package/dist/evidence/atomic-file.d.ts +0 -23
- package/dist/evidence/atomic-file.d.ts.map +0 -1
- package/dist/evidence/atomic-file.js +0 -104
- package/dist/evidence/atomic-file.js.map +0 -1
- package/dist/evidence/layout.d.ts +0 -30
- package/dist/evidence/layout.d.ts.map +0 -1
- package/dist/evidence/layout.js +0 -152
- package/dist/evidence/layout.js.map +0 -1
- package/dist/evidence/retention.d.ts +0 -5
- package/dist/evidence/retention.d.ts.map +0 -1
- package/dist/evidence/retention.js +0 -10
- package/dist/evidence/retention.js.map +0 -1
- package/dist/evidence/store.d.ts +0 -101
- package/dist/evidence/store.d.ts.map +0 -1
- package/dist/evidence/store.js +0 -375
- package/dist/evidence/store.js.map +0 -1
- package/dist/evidence/terminal-finalizer.d.ts +0 -19
- package/dist/evidence/terminal-finalizer.d.ts.map +0 -1
- package/dist/evidence/terminal-finalizer.js +0 -56
- package/dist/evidence/terminal-finalizer.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -12
- package/dist/index.js.map +0 -1
- package/dist/logging/invocation-logger.d.ts +0 -4
- package/dist/logging/invocation-logger.d.ts.map +0 -1
- package/dist/logging/invocation-logger.js +0 -25
- package/dist/logging/invocation-logger.js.map +0 -1
- package/dist/logging/level-logger.d.ts +0 -11
- package/dist/logging/level-logger.d.ts.map +0 -1
- package/dist/logging/level-logger.js +0 -82
- package/dist/logging/level-logger.js.map +0 -1
- package/dist/logging/types.d.ts +0 -8
- package/dist/logging/types.d.ts.map +0 -1
- package/dist/logging/types.js +0 -7
- package/dist/logging/types.js.map +0 -1
- package/dist/redaction/diagnostic-sanitizer.d.ts +0 -7
- package/dist/redaction/diagnostic-sanitizer.d.ts.map +0 -1
- package/dist/redaction/diagnostic-sanitizer.js +0 -42
- package/dist/redaction/diagnostic-sanitizer.js.map +0 -1
- package/dist/redaction/redactor.d.ts +0 -40
- package/dist/redaction/redactor.d.ts.map +0 -1
- package/dist/redaction/redactor.js +0 -176
- package/dist/redaction/redactor.js.map +0 -1
- package/dist/redaction/scrub.d.ts +0 -29
- package/dist/redaction/scrub.d.ts.map +0 -1
- package/dist/redaction/scrub.js +0 -54
- package/dist/redaction/scrub.js.map +0 -1
- package/dist/runtime/config.d.ts +0 -16
- package/dist/runtime/config.d.ts.map +0 -1
- package/dist/runtime/config.js +0 -2
- package/dist/runtime/config.js.map +0 -1
- package/dist/runtime/driver-boundary.d.ts +0 -16
- package/dist/runtime/driver-boundary.d.ts.map +0 -1
- package/dist/runtime/driver-boundary.js +0 -71
- package/dist/runtime/driver-boundary.js.map +0 -1
- package/dist/runtime/driver-session.d.ts +0 -9
- package/dist/runtime/driver-session.d.ts.map +0 -1
- package/dist/runtime/driver-session.js +0 -64
- package/dist/runtime/driver-session.js.map +0 -1
- package/dist/runtime/internal-step-evidence.d.ts +0 -30
- package/dist/runtime/internal-step-evidence.d.ts.map +0 -1
- package/dist/runtime/internal-step-evidence.js +0 -82
- package/dist/runtime/internal-step-evidence.js.map +0 -1
- package/dist/runtime/result-adapter.d.ts +0 -9
- package/dist/runtime/result-adapter.d.ts.map +0 -1
- package/dist/runtime/result-adapter.js +0 -77
- package/dist/runtime/result-adapter.js.map +0 -1
- package/dist/runtime/runner.d.ts +0 -43
- package/dist/runtime/runner.d.ts.map +0 -1
- package/dist/runtime/runner.js +0 -72
- package/dist/runtime/runner.js.map +0 -1
- package/dist/runtime/scenario-control.d.ts +0 -40
- package/dist/runtime/scenario-control.d.ts.map +0 -1
- package/dist/runtime/scenario-control.js +0 -94
- package/dist/runtime/scenario-control.js.map +0 -1
- package/dist/runtime/scenario-runner.d.ts +0 -41
- package/dist/runtime/scenario-runner.d.ts.map +0 -1
- package/dist/runtime/scenario-runner.js +0 -274
- package/dist/runtime/scenario-runner.js.map +0 -1
- package/dist/runtime/scenario-state.d.ts +0 -55
- package/dist/runtime/scenario-state.d.ts.map +0 -1
- package/dist/runtime/scenario-state.js +0 -128
- package/dist/runtime/scenario-state.js.map +0 -1
- package/dist/runtime/step-execution.d.ts +0 -27
- package/dist/runtime/step-execution.d.ts.map +0 -1
- package/dist/runtime/step-execution.js +0 -143
- package/dist/runtime/step-execution.js.map +0 -1
- package/dist/runtime/text.d.ts +0 -10
- package/dist/runtime/text.d.ts.map +0 -1
- package/dist/runtime/text.js +0 -25
- package/dist/runtime/text.js.map +0 -1
- package/dist/runtime/types.d.ts +0 -53
- package/dist/runtime/types.d.ts.map +0 -1
- package/dist/runtime/types.js +0 -2
- package/dist/runtime/types.js.map +0 -1
- package/dist/runtime/usage-tracker.d.ts +0 -37
- package/dist/runtime/usage-tracker.d.ts.map +0 -1
- package/dist/runtime/usage-tracker.js +0 -110
- package/dist/runtime/usage-tracker.js.map +0 -1
- package/dist/tools/define-agent-tool.d.ts +0 -20
- package/dist/tools/define-agent-tool.d.ts.map +0 -1
- package/dist/tools/define-agent-tool.js +0 -30
- package/dist/tools/define-agent-tool.js.map +0 -1
- package/dist/tools/dispatcher.d.ts +0 -19
- package/dist/tools/dispatcher.d.ts.map +0 -1
- package/dist/tools/dispatcher.js +0 -91
- package/dist/tools/dispatcher.js.map +0 -1
- package/dist/tools/loop-detector.d.ts +0 -27
- package/dist/tools/loop-detector.d.ts.map +0 -1
- package/dist/tools/loop-detector.js +0 -76
- package/dist/tools/loop-detector.js.map +0 -1
- package/dist/tools/registry.d.ts +0 -19
- package/dist/tools/registry.d.ts.map +0 -1
- package/dist/tools/registry.js +0 -54
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/step/result-tool.d.ts +0 -7
- package/dist/tools/step/result-tool.d.ts.map +0 -1
- package/dist/tools/step/result-tool.js +0 -34
- package/dist/tools/step/result-tool.js.map +0 -1
- package/dist/tools/tool-contract.d.ts +0 -3
- package/dist/tools/tool-contract.d.ts.map +0 -1
- package/dist/tools/tool-contract.js +0 -2
- package/dist/tools/tool-contract.js.map +0 -1
- package/dist/tools/types.d.ts +0 -210
- package/dist/tools/types.d.ts.map +0 -1
- package/dist/tools/types.js +0 -4
- package/dist/tools/types.js.map +0 -1
- package/docs/CLI.md +0 -59
- package/docs/CONFIGURATION.md +0 -105
- package/docs/DRIVERS.md +0 -79
- package/docs/EVIDENCE.md +0 -64
- package/schemas/checkmate-config.v1.json +0 -176
- package/schemas/describe-result.v1.json +0 -414
- package/schemas/driver-descriptor.v1.json +0 -66
- package/schemas/run-request.v1.json +0 -67
- package/schemas/run-result.v1.json +0 -333
- package/schemas/validation-result.v1.json +0 -86
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Finding,
|
|
3
|
+
Gap,
|
|
4
|
+
Plan,
|
|
5
|
+
PlanCandidate,
|
|
6
|
+
PlanDelta,
|
|
7
|
+
PlanPatch,
|
|
8
|
+
PlanRequest,
|
|
9
|
+
Profile,
|
|
10
|
+
Response,
|
|
11
|
+
Result,
|
|
12
|
+
} from './types.ts'
|
|
13
|
+
import { canonical } from './store.ts'
|
|
14
|
+
import * as validators from './validators.js'
|
|
15
|
+
|
|
16
|
+
export type Test = Plan['tests'][number]
|
|
17
|
+
export type Assertion = Test['assertions'][number]
|
|
18
|
+
export type ResultTest = Result['tests'][number]
|
|
19
|
+
export type AssertionResult = ResultTest['assertions'][number]['result']
|
|
20
|
+
export type Documents = {
|
|
21
|
+
profile: Profile
|
|
22
|
+
'plan-request': PlanRequest
|
|
23
|
+
'plan-candidate': PlanCandidate
|
|
24
|
+
'plan-delta': PlanDelta
|
|
25
|
+
'plan-patch': PlanPatch
|
|
26
|
+
plan: Plan
|
|
27
|
+
gap: Gap
|
|
28
|
+
finding: Finding
|
|
29
|
+
result: Result
|
|
30
|
+
response: Response
|
|
31
|
+
}
|
|
32
|
+
export type PlanDraft = Omit<Plan, 'coverage' | 'tests'> & { tests: Array<Omit<Test, 'readiness' | 'gapIds'>> }
|
|
33
|
+
|
|
34
|
+
const identifier = /^[A-Za-z0-9][A-Za-z0-9_-]{0,95}$/
|
|
35
|
+
|
|
36
|
+
export function requireCondition(condition: unknown, message: string): asserts condition {
|
|
37
|
+
if (!condition) throw new Error(message)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function same(a: unknown, b: unknown) {
|
|
41
|
+
return canonical(a) === canonical(b)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function validate<K extends keyof Documents>(name: K, value: unknown): Documents[K] {
|
|
45
|
+
const check = validators[name.replace(/-./g, (match) => match[1].toUpperCase()) as keyof typeof validators]
|
|
46
|
+
const errors = () => (check.errors ?? []).map((error) => `${name}${error.instancePath} ${error.message}`).join(', ')
|
|
47
|
+
requireCondition(check(value), `Invalid ${name}: ${errors()}`)
|
|
48
|
+
return value as Documents[K]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function requireIdentifier(value: unknown, name: string): string {
|
|
52
|
+
requireCondition(
|
|
53
|
+
typeof value === 'string' && identifier.test(value),
|
|
54
|
+
`Invalid ${name}: ${String(value)}. Use 1 to 96 letters, digits, _ or -, starting with a letter or digit.`
|
|
55
|
+
)
|
|
56
|
+
return value
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function requireText(value: unknown, name: string): string {
|
|
60
|
+
requireCondition(typeof value === 'string' && value.trim().length > 0, `Missing ${name}`)
|
|
61
|
+
return value
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function requireChoice<T extends string>(value: unknown, choices: readonly T[], name: string): T {
|
|
65
|
+
requireCondition(
|
|
66
|
+
choices.includes(value as T),
|
|
67
|
+
`Invalid ${name}: ${String(value)}. Use one of: ${choices.join(', ')}.`
|
|
68
|
+
)
|
|
69
|
+
return value as T
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function revisionReference(text: string, name: string) {
|
|
73
|
+
const [id, revision, ...rest] = text.split('@')
|
|
74
|
+
requireIdentifier(id, name)
|
|
75
|
+
requireCondition(
|
|
76
|
+
!rest.length && (revision === undefined || /^[1-9][0-9]*$/.test(revision)),
|
|
77
|
+
`Invalid ${name}: ${text}. Use <id> or <id>@<revision>.`
|
|
78
|
+
)
|
|
79
|
+
return { id, revision: revision === undefined ? null : Number(revision) }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function testReference(reference: string) {
|
|
83
|
+
const [planId, testId] = reference.includes(':') ? reference.split(':') : [null, reference]
|
|
84
|
+
return { planId, testId }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function expectDigest(actual: string, expected: string | undefined, subject: string) {
|
|
88
|
+
if (expected === undefined) return
|
|
89
|
+
requireCondition(/^[a-f0-9]{8,64}$/.test(expected), `Invalid --expect-sha: ${expected}. Use 8 to 64 hex digits.`)
|
|
90
|
+
requireCondition(
|
|
91
|
+
actual.startsWith(expected),
|
|
92
|
+
`${subject} has digest ${actual}, not ${expected}. Read it again before you decide.`
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function index<T, K extends keyof T>(items: T[], key: K, name: string): Map<T[K], T> {
|
|
97
|
+
const map = new Map<T[K], T>()
|
|
98
|
+
for (const item of items) {
|
|
99
|
+
requireCondition(!map.has(item[key]), `Duplicate ${name}: ${String(item[key])}`)
|
|
100
|
+
map.set(item[key], item)
|
|
101
|
+
}
|
|
102
|
+
return map
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function references(ids: string[], map: ReadonlyMap<string, unknown>, name: string) {
|
|
106
|
+
for (const id of ids) requireCondition(map.has(id), `Unknown ${name}: ${id}`)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function profileCheck(value: unknown): Profile {
|
|
110
|
+
const profile = validate('profile', value)
|
|
111
|
+
index(profile.tools, 'name', 'tool')
|
|
112
|
+
const url = new URL(profile.baseUrl)
|
|
113
|
+
requireCondition(['http:', 'https:'].includes(url.protocol), 'Target must use HTTP or HTTPS')
|
|
114
|
+
requireCondition(!url.username && !url.password, 'Use credential references, not URL credentials')
|
|
115
|
+
for (const tool of profile.tools)
|
|
116
|
+
requireCondition(
|
|
117
|
+
tool.version === undefined || !/resolve-and-pin|unknown/i.test(tool.version),
|
|
118
|
+
`Record the actual version of ${tool.name}, or leave version out`
|
|
119
|
+
)
|
|
120
|
+
return profile
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function approvalPolicy(profile: Profile) {
|
|
124
|
+
return profile.approvals ?? { plan: 'required', result: 'required' }
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function gapsAffecting(gaps: Gap[], test: Pick<Test, 'id' | 'requirementIds'>) {
|
|
128
|
+
return gaps.filter(
|
|
129
|
+
(gap) =>
|
|
130
|
+
gap.testIds.includes(test.id) ||
|
|
131
|
+
gap.requirementIds.some((id) => test.requirementIds.includes(id)) ||
|
|
132
|
+
(gap.testIds.length === 0 && gap.requirementIds.length === 0)
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function testReadiness(gaps: Gap[], test: Pick<Test, 'id' | 'requirementIds'>): Test['readiness'] {
|
|
137
|
+
const affected = gapsAffecting(gaps, test)
|
|
138
|
+
if (affected.some((gap) => gap.status === 'deferred' && gap.severity === 'blocking')) return 'deferred'
|
|
139
|
+
if (affected.some((gap) => gap.status === 'open' && gap.severity === 'blocking')) return 'blocked'
|
|
140
|
+
return 'ready'
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function planCoverage(plan: Pick<Plan, 'requirements' | 'tests' | 'gaps'>): Plan['coverage'] {
|
|
144
|
+
return plan.requirements.map((requirement) => {
|
|
145
|
+
const tests = plan.tests.filter((test) => test.requirementIds.includes(requirement.id))
|
|
146
|
+
const gaps = plan.gaps.filter(
|
|
147
|
+
(gap) => gap.requirementIds.includes(requirement.id) || (!gap.requirementIds.length && !gap.testIds.length)
|
|
148
|
+
)
|
|
149
|
+
const status =
|
|
150
|
+
gaps.some((gap) => gap.status === 'deferred' && gap.severity === 'blocking') ||
|
|
151
|
+
tests.some((test) => test.readiness === 'deferred')
|
|
152
|
+
? 'deferred'
|
|
153
|
+
: gaps.some((gap) => gap.severity === 'blocking' && gap.status === 'open') ||
|
|
154
|
+
tests.some((test) => test.readiness === 'blocked') ||
|
|
155
|
+
tests.length === 0
|
|
156
|
+
? 'blocked'
|
|
157
|
+
: 'planned'
|
|
158
|
+
return { requirementId: requirement.id, testIds: tests.map((test) => test.id), status }
|
|
159
|
+
})
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function derivePlan(draft: PlanDraft): Plan {
|
|
163
|
+
const tests = draft.tests.map((test) => ({
|
|
164
|
+
...test,
|
|
165
|
+
gapIds: gapsAffecting(draft.gaps, test).map((gap) => gap.id),
|
|
166
|
+
readiness: testReadiness(draft.gaps, test),
|
|
167
|
+
}))
|
|
168
|
+
return { ...draft, tests, coverage: planCoverage({ ...draft, tests }) }
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export function planCheck(value: unknown): Plan {
|
|
172
|
+
const plan = validate('plan', value)
|
|
173
|
+
const requirements = index(plan.requirements, 'id', 'requirement')
|
|
174
|
+
const tests = index(plan.tests, 'id', 'test')
|
|
175
|
+
const gaps = index(plan.gaps, 'id', 'gap')
|
|
176
|
+
const decisions = index(plan.decisions, 'id', 'decision')
|
|
177
|
+
index(plan.coverage, 'requirementId', 'coverage requirement')
|
|
178
|
+
index(plan.assumptions, 'decisionId', 'assumption decision')
|
|
179
|
+
const localReferences = (ids: string[]) =>
|
|
180
|
+
ids.filter((id) => {
|
|
181
|
+
const { planId } = testReference(id)
|
|
182
|
+
requireCondition(planId !== plan.planId, `Use the local test ID, not ${id}`)
|
|
183
|
+
return planId === null
|
|
184
|
+
})
|
|
185
|
+
for (const gap of plan.gaps) {
|
|
186
|
+
references(gap.requirementIds, requirements, `requirement in gap ${gap.id}`)
|
|
187
|
+
references(localReferences(gap.testIds), tests, `test in gap ${gap.id}`)
|
|
188
|
+
if (gap.status === 'open') requireCondition(gap.decisionId === null, `Open gap ${gap.id} has a decision`)
|
|
189
|
+
else {
|
|
190
|
+
const decision = decisions.get(gap.decisionId ?? '')
|
|
191
|
+
requireCondition(decision?.gapId === gap.id, `Gap ${gap.id} needs a matching decision`)
|
|
192
|
+
requireCondition(
|
|
193
|
+
(decision.kind === 'defer') === (gap.status === 'deferred'),
|
|
194
|
+
`Gap ${gap.id} status conflicts with decision ${decision.id}`
|
|
195
|
+
)
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
for (const decision of plan.decisions) {
|
|
199
|
+
requireCondition(
|
|
200
|
+
gaps.get(decision.gapId)?.decisionId === decision.id,
|
|
201
|
+
`Decision ${decision.id} does not resolve its gap`
|
|
202
|
+
)
|
|
203
|
+
if (decision.kind === 'clarify')
|
|
204
|
+
requireCondition(decision.source, `Clarification ${decision.id} needs a source`)
|
|
205
|
+
if (decision.kind === 'accept_assumption')
|
|
206
|
+
requireCondition(
|
|
207
|
+
plan.assumptions.some((a) => a.decisionId === decision.id && a.text === decision.value),
|
|
208
|
+
`Accepted assumption ${decision.id} must stay visible`
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
for (const assumption of plan.assumptions)
|
|
212
|
+
requireCondition(
|
|
213
|
+
decisions.get(assumption.decisionId)?.kind === 'accept_assumption',
|
|
214
|
+
`Assumption ${assumption.decisionId} lacks oracle acceptance`
|
|
215
|
+
)
|
|
216
|
+
for (const test of plan.tests) {
|
|
217
|
+
references(test.requirementIds, requirements, `requirement in test ${test.id}`)
|
|
218
|
+
references(test.gapIds, gaps, `gap in test ${test.id}`)
|
|
219
|
+
references(localReferences(test.dependsOn), tests, `dependency of test ${test.id}`)
|
|
220
|
+
index(test.assertions, 'id', `assertion in test ${test.id}`)
|
|
221
|
+
requireCondition(
|
|
222
|
+
same(
|
|
223
|
+
test.gapIds,
|
|
224
|
+
gapsAffecting(plan.gaps, test).map((gap) => gap.id)
|
|
225
|
+
),
|
|
226
|
+
`Test ${test.id} gapIds conflict with gap scope`
|
|
227
|
+
)
|
|
228
|
+
requireCondition(
|
|
229
|
+
test.readiness === testReadiness(plan.gaps, test),
|
|
230
|
+
`Test ${test.id} readiness conflicts with gaps`
|
|
231
|
+
)
|
|
232
|
+
if (test.readiness === 'ready')
|
|
233
|
+
requireCondition(test.assertions.length > 0, `Ready test ${test.id} needs one or more assertions`)
|
|
234
|
+
}
|
|
235
|
+
for (const requirement of plan.requirements)
|
|
236
|
+
requireCondition(
|
|
237
|
+
plan.tests.some((test) => test.requirementIds.includes(requirement.id)) ||
|
|
238
|
+
plan.gaps.some((gap) => gap.requirementIds.includes(requirement.id)),
|
|
239
|
+
`Requirement ${requirement.id} has no test or gap`
|
|
240
|
+
)
|
|
241
|
+
requireCondition(same(plan.coverage, planCoverage(plan)), 'Plan coverage is inconsistent')
|
|
242
|
+
return plan
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export function planTargetCheck(plan: Plan, profile: Profile) {
|
|
246
|
+
for (const test of plan.tests.filter((test) => test.readiness === 'ready')) {
|
|
247
|
+
requireCondition(
|
|
248
|
+
profile.capabilities.includes(test.capability),
|
|
249
|
+
`Test ${test.id} needs capability ${test.capability}, which the target lacks. Record a planning gap.`
|
|
250
|
+
)
|
|
251
|
+
for (const operation of test.operations)
|
|
252
|
+
requireCondition(
|
|
253
|
+
profile.allowedOperations.includes(operation),
|
|
254
|
+
`Test ${test.id} uses operation ${operation}, which the target does not permit`
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export function dependencyCheck(plan: Plan, latest: ReadonlyMap<string, Plan>) {
|
|
260
|
+
const plans = new Map(latest).set(plan.planId, plan)
|
|
261
|
+
const crossReferences = [...plans.values()]
|
|
262
|
+
.flatMap((other) => [
|
|
263
|
+
...other.tests.flatMap((test) => test.dependsOn),
|
|
264
|
+
...other.gaps.flatMap((gap) => gap.testIds),
|
|
265
|
+
])
|
|
266
|
+
.filter((id) => id.includes(':'))
|
|
267
|
+
for (const reference of crossReferences) {
|
|
268
|
+
const { planId, testId } = testReference(reference)
|
|
269
|
+
const other = plans.get(planId!)
|
|
270
|
+
requireCondition(other, `Unknown plan in ${reference}: ${planId}`)
|
|
271
|
+
requireCondition(
|
|
272
|
+
other.tests.some((test) => test.id === testId),
|
|
273
|
+
`Unknown test in ${reference}: ${testId} is not in ${planId}@${other.revision}`
|
|
274
|
+
)
|
|
275
|
+
}
|
|
276
|
+
const edges = new Map<string, string[]>()
|
|
277
|
+
for (const [planId, other] of plans)
|
|
278
|
+
for (const test of other.tests)
|
|
279
|
+
edges.set(
|
|
280
|
+
`${planId}:${test.id}`,
|
|
281
|
+
test.dependsOn.map((id) => (id.includes(':') ? id : `${planId}:${id}`))
|
|
282
|
+
)
|
|
283
|
+
const visiting: string[] = []
|
|
284
|
+
const visited = new Set<string>()
|
|
285
|
+
function visit(node: string) {
|
|
286
|
+
const start = visiting.indexOf(node)
|
|
287
|
+
requireCondition(start < 0, `Test dependency cycle: ${[...visiting.slice(start), node].join(' -> ')}`)
|
|
288
|
+
if (visited.has(node)) return
|
|
289
|
+
visiting.push(node)
|
|
290
|
+
for (const next of edges.get(node) ?? []) visit(next)
|
|
291
|
+
visiting.pop()
|
|
292
|
+
visited.add(node)
|
|
293
|
+
}
|
|
294
|
+
for (const node of edges.keys()) visit(node)
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export function testOutcome(results: AssertionResult[]): 'passed' | 'failed' | 'error' | 'inconclusive' {
|
|
298
|
+
if (results.includes('failed')) return 'failed'
|
|
299
|
+
if (results.includes('not_checked')) return 'error'
|
|
300
|
+
if (results.includes('inconclusive')) return 'inconclusive'
|
|
301
|
+
return 'passed'
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export function resultCoverage(plan: Plan, tests: ResultTest[], newGaps: Gap[]): Result['coverage'] {
|
|
305
|
+
const outcomes = new Map(tests.map((test) => [test.testId, test.outcome]))
|
|
306
|
+
const conclusive = (test: Plan['tests'][number]) => ['passed', 'failed'].includes(outcomes.get(test.id) ?? '')
|
|
307
|
+
const requirements = plan.requirements.map((requirement) => {
|
|
308
|
+
const planned = plan.tests.filter((test) => test.requirementIds.includes(requirement.id))
|
|
309
|
+
const gaps = [...plan.gaps, ...newGaps].filter(
|
|
310
|
+
(gap) => gap.requirementIds.includes(requirement.id) || (!gap.requirementIds.length && !gap.testIds.length)
|
|
311
|
+
)
|
|
312
|
+
const blocking = gaps.some((gap) => gap.status === 'open' && gap.severity === 'blocking')
|
|
313
|
+
const deferredGap = gaps.some((gap) => gap.status === 'deferred' && gap.severity === 'blocking')
|
|
314
|
+
const tested = planned.length > 0 && !blocking && !deferredGap && planned.every(conclusive)
|
|
315
|
+
const deferred =
|
|
316
|
+
!tested &&
|
|
317
|
+
!blocking &&
|
|
318
|
+
(deferredGap || planned.some((test) => test.readiness === 'deferred')) &&
|
|
319
|
+
planned.every((test) => test.readiness === 'deferred' || conclusive(test))
|
|
320
|
+
return {
|
|
321
|
+
requirementId: requirement.id,
|
|
322
|
+
status: tested ? ('tested' as const) : deferred ? ('deferred' as const) : ('uncovered' as const),
|
|
323
|
+
testIds: planned.map((test) => test.id),
|
|
324
|
+
reason: tested
|
|
325
|
+
? null
|
|
326
|
+
: deferred
|
|
327
|
+
? 'An oracle decision deferred the missing checks.'
|
|
328
|
+
: planned.some((test) => outcomes.get(test.id) === 'inconclusive')
|
|
329
|
+
? 'An assertion is inconclusive.'
|
|
330
|
+
: 'At least one required check or decision is missing.',
|
|
331
|
+
}
|
|
332
|
+
})
|
|
333
|
+
const executed = ['passed', 'failed', 'error', 'inconclusive']
|
|
334
|
+
return {
|
|
335
|
+
status: requirements.every((row) => row.status === 'tested')
|
|
336
|
+
? 'complete'
|
|
337
|
+
: tests.some((test) => executed.includes(test.outcome))
|
|
338
|
+
? 'partial'
|
|
339
|
+
: 'not_executed',
|
|
340
|
+
requirements,
|
|
341
|
+
}
|
|
342
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type { Store, Reply, Status } from './store.ts'
|
|
2
|
+
export { openStore, openReadOnlyStore, closeStore, canonical, digest, ulid } from './store.ts'
|
|
3
|
+
export { validate, profileCheck, planCheck, planCoverage, resultCoverage, testOutcome } from './contracts.ts'
|
|
4
|
+
export { openTarget, saveTarget, showTarget, targetRevision } from './targets.ts'
|
|
5
|
+
export {
|
|
6
|
+
openPlan,
|
|
7
|
+
savePlan,
|
|
8
|
+
editPlan,
|
|
9
|
+
patchPlan,
|
|
10
|
+
adoptGaps,
|
|
11
|
+
planCandidate,
|
|
12
|
+
frozenRevision,
|
|
13
|
+
answerGap,
|
|
14
|
+
revisePlan,
|
|
15
|
+
approvePlan,
|
|
16
|
+
rejectPlan,
|
|
17
|
+
gate,
|
|
18
|
+
planRevision,
|
|
19
|
+
diffPlan,
|
|
20
|
+
jsonPatch,
|
|
21
|
+
planChanges,
|
|
22
|
+
} from './plans.ts'
|
|
23
|
+
export {
|
|
24
|
+
beginRun,
|
|
25
|
+
checkAssertion,
|
|
26
|
+
closeTest,
|
|
27
|
+
recordFinding,
|
|
28
|
+
recordGap,
|
|
29
|
+
finishRun,
|
|
30
|
+
resumeRun,
|
|
31
|
+
acceptResult,
|
|
32
|
+
rejectResult,
|
|
33
|
+
runResult,
|
|
34
|
+
} from './runs.ts'
|
|
35
|
+
export {
|
|
36
|
+
inbox,
|
|
37
|
+
planList,
|
|
38
|
+
planDetail,
|
|
39
|
+
planStatus,
|
|
40
|
+
planHistory,
|
|
41
|
+
runList,
|
|
42
|
+
runDetail,
|
|
43
|
+
operationLog,
|
|
44
|
+
changesAfter,
|
|
45
|
+
evidenceBytes,
|
|
46
|
+
approvalLabel,
|
|
47
|
+
pagedPlans,
|
|
48
|
+
pagedRuns,
|
|
49
|
+
pagedOperations,
|
|
50
|
+
} from './views.ts'
|
|
51
|
+
export { renderPlan, renderRun, runReport, exportPlan, exportRun } from './render.ts'
|
|
52
|
+
export { run, main } from './cli.ts'
|