@b00dea/cockpit 0.0.0-stage → 0.1.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/CHANGELOG.md +474 -0
- package/LICENSE +21 -0
- package/README.md +25 -2
- package/bin/cockpit.mjs +33 -0
- package/cockpit.schema.json +2644 -0
- package/dist/autonomy.d.ts +45 -0
- package/dist/autonomy.js +173 -0
- package/dist/bounded-read.d.ts +14 -0
- package/dist/bounded-read.js +42 -0
- package/dist/browser/commands.d.ts +117 -0
- package/dist/browser/commands.js +453 -0
- package/dist/browser/package-paths.d.ts +1 -0
- package/dist/browser/package-paths.js +6 -0
- package/dist/browser/proxy.d.ts +22 -0
- package/dist/browser/proxy.js +37 -0
- package/dist/browser/runtime.d.ts +118 -0
- package/dist/browser/runtime.js +186 -0
- package/dist/browser/surfaces.d.ts +141 -0
- package/dist/browser/surfaces.js +561 -0
- package/dist/browser/ui-gate.d.ts +15 -0
- package/dist/browser/ui-gate.js +18 -0
- package/dist/canonical-json.d.ts +2 -0
- package/dist/canonical-json.js +5 -0
- package/dist/cli-guard.d.ts +5 -0
- package/dist/cli-guard.js +71 -0
- package/dist/cli-main.d.ts +176 -0
- package/dist/cli-main.js +1584 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +16 -0
- package/dist/command-table.d.ts +121 -0
- package/dist/command-table.js +664 -0
- package/dist/config/load.d.ts +183 -0
- package/dist/config/load.js +367 -0
- package/dist/config/sibling-toml.d.ts +48 -0
- package/dist/config/sibling-toml.js +160 -0
- package/dist/config/surface-tools-toml.d.ts +9 -0
- package/dist/config/surface-tools-toml.js +37 -0
- package/dist/config/unconfirmed-toml.d.ts +9 -0
- package/dist/config/unconfirmed-toml.js +29 -0
- package/dist/config/verified-write.d.ts +43 -0
- package/dist/config/verified-write.js +89 -0
- package/dist/diagnostics.d.ts +26 -0
- package/dist/diagnostics.js +344 -0
- package/dist/docs/check.d.ts +16 -0
- package/dist/docs/check.js +197 -0
- package/dist/docs/decision-record.d.ts +34 -0
- package/dist/docs/decision-record.js +135 -0
- package/dist/docs/decisions.d.ts +16 -0
- package/dist/docs/decisions.js +103 -0
- package/dist/docs/markdown.d.ts +36 -0
- package/dist/docs/markdown.js +88 -0
- package/dist/docs/references.d.ts +32 -0
- package/dist/docs/references.js +148 -0
- package/dist/emit.d.ts +22 -0
- package/dist/emit.js +43 -0
- package/dist/entrypoint-kinds.d.ts +3 -0
- package/dist/entrypoint-kinds.js +11 -0
- package/dist/environment/application/confirm.d.ts +35 -0
- package/dist/environment/application/confirm.js +122 -0
- package/dist/environment/application/destructive.d.ts +6 -0
- package/dist/environment/application/destructive.js +429 -0
- package/dist/environment/application/doctor.d.ts +94 -0
- package/dist/environment/application/doctor.js +247 -0
- package/dist/environment/application/guard.d.ts +49 -0
- package/dist/environment/application/guard.js +677 -0
- package/dist/environment/application/health.d.ts +143 -0
- package/dist/environment/application/health.js +385 -0
- package/dist/environment/application/lifecycle-context.d.ts +235 -0
- package/dist/environment/application/lifecycle-context.js +154 -0
- package/dist/environment/application/lifecycle-state.d.ts +25 -0
- package/dist/environment/application/lifecycle-state.js +202 -0
- package/dist/environment/application/lifecycle.d.ts +18 -0
- package/dist/environment/application/lifecycle.js +737 -0
- package/dist/environment/application/logs.d.ts +45 -0
- package/dist/environment/application/logs.js +127 -0
- package/dist/environment/application/services.d.ts +60 -0
- package/dist/environment/application/services.js +89 -0
- package/dist/environment/application/setup.d.ts +129 -0
- package/dist/environment/application/setup.js +741 -0
- package/dist/environment/application/shared.d.ts +11 -0
- package/dist/environment/application/shared.js +61 -0
- package/dist/environment/application/siblings.d.ts +43 -0
- package/dist/environment/application/siblings.js +269 -0
- package/dist/environment/claims.d.ts +389 -0
- package/dist/environment/claims.js +1701 -0
- package/dist/environment/codex-hook-trust.d.ts +11 -0
- package/dist/environment/codex-hook-trust.js +185 -0
- package/dist/environment/compose-environment.d.ts +1 -0
- package/dist/environment/compose-environment.js +6 -0
- package/dist/environment/compose-ownership.d.ts +21 -0
- package/dist/environment/compose-ownership.js +117 -0
- package/dist/environment/compose-topology.d.ts +125 -0
- package/dist/environment/compose-topology.js +490 -0
- package/dist/environment/contract.d.ts +522 -0
- package/dist/environment/contract.js +794 -0
- package/dist/environment/declaration.d.ts +14 -0
- package/dist/environment/declaration.js +39 -0
- package/dist/environment/destructive-composition.d.ts +29 -0
- package/dist/environment/destructive-composition.js +333 -0
- package/dist/environment/docker-daemon.d.ts +30 -0
- package/dist/environment/docker-daemon.js +78 -0
- package/dist/environment/docker-endpoint.d.ts +10 -0
- package/dist/environment/docker-endpoint.js +19 -0
- package/dist/environment/env-schema-observation.d.ts +46 -0
- package/dist/environment/env-schema-observation.js +241 -0
- package/dist/environment/evidence.d.ts +136 -0
- package/dist/environment/evidence.js +437 -0
- package/dist/environment/executable.d.ts +38 -0
- package/dist/environment/executable.js +190 -0
- package/dist/environment/generated-application/authorities.d.ts +5 -0
- package/dist/environment/generated-application/authorities.js +61 -0
- package/dist/environment/generated-application/bootstrap-skill.d.ts +16 -0
- package/dist/environment/generated-application/bootstrap-skill.js +328 -0
- package/dist/environment/generated-application/check.d.ts +13 -0
- package/dist/environment/generated-application/check.js +191 -0
- package/dist/environment/generated-application/custom-surface.d.ts +26 -0
- package/dist/environment/generated-application/custom-surface.js +289 -0
- package/dist/environment/generated-application/prepare.d.ts +29 -0
- package/dist/environment/generated-application/prepare.js +278 -0
- package/dist/environment/generated-application/publication.d.ts +33 -0
- package/dist/environment/generated-application/publication.js +547 -0
- package/dist/environment/generated-application/shared.d.ts +492 -0
- package/dist/environment/generated-application/shared.js +354 -0
- package/dist/environment/generated-application/surface-observation.d.ts +4 -0
- package/dist/environment/generated-application/surface-observation.js +69 -0
- package/dist/environment/generated-application/surface-outputs.d.ts +71 -0
- package/dist/environment/generated-application/surface-outputs.js +400 -0
- package/dist/environment/generated-application/surfaces.d.ts +3 -0
- package/dist/environment/generated-application/surfaces.js +704 -0
- package/dist/environment/generated-application/sync.d.ts +6 -0
- package/dist/environment/generated-application/sync.js +124 -0
- package/dist/environment/git-observation.d.ts +202 -0
- package/dist/environment/git-observation.js +553 -0
- package/dist/environment/health-composition.d.ts +12 -0
- package/dist/environment/health-composition.js +645 -0
- package/dist/environment/host-observation.d.ts +56 -0
- package/dist/environment/host-observation.js +52 -0
- package/dist/environment/identity.d.ts +48 -0
- package/dist/environment/identity.js +85 -0
- package/dist/environment/init-application.d.ts +333 -0
- package/dist/environment/init-application.js +726 -0
- package/dist/environment/install-policy-observation.d.ts +71 -0
- package/dist/environment/install-policy-observation.js +284 -0
- package/dist/environment/install-policy.d.ts +48 -0
- package/dist/environment/install-policy.js +96 -0
- package/dist/environment/instance.d.ts +33 -0
- package/dist/environment/instance.js +122 -0
- package/dist/environment/instruction-pointer.d.ts +19 -0
- package/dist/environment/instruction-pointer.js +144 -0
- package/dist/environment/lifecycle-composition.d.ts +31 -0
- package/dist/environment/lifecycle-composition.js +742 -0
- package/dist/environment/lifecycle-stage.d.ts +120 -0
- package/dist/environment/lifecycle-stage.js +408 -0
- package/dist/environment/lifecycle.d.ts +75 -0
- package/dist/environment/lifecycle.js +354 -0
- package/dist/environment/logs.d.ts +132 -0
- package/dist/environment/logs.js +519 -0
- package/dist/environment/map-limit.d.ts +2 -0
- package/dist/environment/map-limit.js +13 -0
- package/dist/environment/mcp-observation.d.ts +9 -0
- package/dist/environment/mcp-observation.js +46 -0
- package/dist/environment/observations.d.ts +46 -0
- package/dist/environment/observations.js +346 -0
- package/dist/environment/operator-application.d.ts +79 -0
- package/dist/environment/operator-application.js +197 -0
- package/dist/environment/ports.d.ts +182 -0
- package/dist/environment/ports.js +1205 -0
- package/dist/environment/posture-observation.d.ts +68 -0
- package/dist/environment/posture-observation.js +253 -0
- package/dist/environment/presence.d.ts +4 -0
- package/dist/environment/presence.js +26 -0
- package/dist/environment/read-composition.d.ts +32 -0
- package/dist/environment/read-composition.js +397 -0
- package/dist/environment/readiness-composition.d.ts +57 -0
- package/dist/environment/readiness-composition.js +151 -0
- package/dist/environment/reclaim.d.ts +370 -0
- package/dist/environment/reclaim.js +1940 -0
- package/dist/environment/repository-identity.d.ts +13 -0
- package/dist/environment/repository-identity.js +108 -0
- package/dist/environment/runtime-measurement-record.d.ts +38 -0
- package/dist/environment/runtime-measurement-record.js +111 -0
- package/dist/environment/runtime-measurement.d.ts +27 -0
- package/dist/environment/runtime-measurement.js +224 -0
- package/dist/environment/runtime-probe-residue.d.ts +43 -0
- package/dist/environment/runtime-probe-residue.js +148 -0
- package/dist/environment/runtime-probe.d.ts +72 -0
- package/dist/environment/runtime-probe.js +725 -0
- package/dist/environment/runtime.d.ts +551 -0
- package/dist/environment/runtime.js +2405 -0
- package/dist/environment/seed.d.ts +16 -0
- package/dist/environment/seed.js +43 -0
- package/dist/environment/selftest-application.d.ts +86 -0
- package/dist/environment/selftest-application.js +713 -0
- package/dist/environment/sensitive.d.ts +3 -0
- package/dist/environment/sensitive.js +48 -0
- package/dist/environment/served-checkout-grants.d.ts +53 -0
- package/dist/environment/served-checkout-grants.js +182 -0
- package/dist/environment/setup-observation.d.ts +62 -0
- package/dist/environment/setup-observation.js +1473 -0
- package/dist/environment/setup.d.ts +43 -0
- package/dist/environment/setup.js +176 -0
- package/dist/environment/sibling-checkouts.d.ts +119 -0
- package/dist/environment/sibling-checkouts.js +254 -0
- package/dist/environment/sibling-instructions.d.ts +33 -0
- package/dist/environment/sibling-instructions.js +224 -0
- package/dist/environment/sibling-observation.d.ts +27 -0
- package/dist/environment/sibling-observation.js +45 -0
- package/dist/environment/sibling-pull.d.ts +23 -0
- package/dist/environment/sibling-pull.js +95 -0
- package/dist/environment/sibling-registration.d.ts +45 -0
- package/dist/environment/sibling-registration.js +538 -0
- package/dist/environment/stack-inputs.d.ts +18 -0
- package/dist/environment/stack-inputs.js +210 -0
- package/dist/environment/stack-inventory-prune.d.ts +31 -0
- package/dist/environment/stack-inventory-prune.js +129 -0
- package/dist/environment/stack-inventory-report.d.ts +44 -0
- package/dist/environment/stack-inventory-report.js +78 -0
- package/dist/environment/stack-inventory.d.ts +94 -0
- package/dist/environment/stack-inventory.js +418 -0
- package/dist/environment/state.d.ts +410 -0
- package/dist/environment/state.js +2153 -0
- package/dist/environment/templates.d.ts +140 -0
- package/dist/environment/templates.js +685 -0
- package/dist/environment/tool-registration.d.ts +9 -0
- package/dist/environment/tool-registration.js +92 -0
- package/dist/environment/upgrade-application.d.ts +19 -0
- package/dist/environment/upgrade-application.js +175 -0
- package/dist/environment-exec/execute.d.ts +105 -0
- package/dist/environment-exec/execute.js +1179 -0
- package/dist/environment-exec/libexec-program.d.ts +6 -0
- package/dist/environment-exec/libexec-program.js +22 -0
- package/dist/environment-exec/verified-digest.d.ts +4 -0
- package/dist/environment-exec/verified-digest.js +16 -0
- package/dist/exact-keys.d.ts +7 -0
- package/dist/exact-keys.js +15 -0
- package/dist/fix-catalogue.d.ts +32 -0
- package/dist/fix-catalogue.js +60 -0
- package/dist/freshness.d.ts +29 -0
- package/dist/freshness.js +75 -0
- package/dist/generated-environment/adopt.d.ts +16 -0
- package/dist/generated-environment/adopt.js +271 -0
- package/dist/generated-environment/command.d.ts +47 -0
- package/dist/generated-environment/command.js +75 -0
- package/dist/generated-environment/transaction.d.ts +186 -0
- package/dist/generated-environment/transaction.js +1770 -0
- package/dist/grading/evaluate.d.ts +71 -0
- package/dist/grading/evaluate.js +403 -0
- package/dist/grading/grade.d.ts +33 -0
- package/dist/grading/grade.js +57 -0
- package/dist/guards/answer-confirmation.d.ts +41 -0
- package/dist/guards/answer-confirmation.js +109 -0
- package/dist/guards/evaluator.d.ts +130 -0
- package/dist/guards/evaluator.js +1258 -0
- package/dist/guards/harness-adapter.d.ts +17 -0
- package/dist/guards/harness-adapter.js +57 -0
- package/dist/guards/host.d.ts +8 -0
- package/dist/guards/host.js +10 -0
- package/dist/guards/invocation-parser.d.ts +66 -0
- package/dist/guards/invocation-parser.js +595 -0
- package/dist/guards/local-identity.d.ts +44 -0
- package/dist/guards/local-identity.js +129 -0
- package/dist/guards/policy-change.d.ts +43 -0
- package/dist/guards/policy-change.js +159 -0
- package/dist/guards/policy-pin.d.ts +13 -0
- package/dist/guards/policy-pin.js +177 -0
- package/dist/guards/protected-locations.d.ts +62 -0
- package/dist/guards/protected-locations.js +461 -0
- package/dist/guards/read-only.d.ts +37 -0
- package/dist/guards/read-only.js +315 -0
- package/dist/init/command.d.ts +41 -0
- package/dist/init/command.js +330 -0
- package/dist/init/derive.d.ts +53 -0
- package/dist/init/derive.js +819 -0
- package/dist/init/draft.d.ts +140 -0
- package/dist/init/draft.js +1228 -0
- package/dist/init/render.d.ts +47 -0
- package/dist/init/render.js +104 -0
- package/dist/init/scaffold.d.ts +53 -0
- package/dist/init/scaffold.js +121 -0
- package/dist/invocation.d.ts +13 -0
- package/dist/invocation.js +20 -0
- package/dist/package-metadata.d.ts +9 -0
- package/dist/package-metadata.js +19 -0
- package/dist/readiness.d.ts +53 -0
- package/dist/readiness.js +88 -0
- package/dist/references/named.d.ts +24 -0
- package/dist/references/named.js +27 -0
- package/dist/refusal.d.ts +15 -0
- package/dist/refusal.js +7 -0
- package/dist/registry-derivation.d.ts +31 -0
- package/dist/registry-derivation.js +32 -0
- package/dist/registry-resolve/command.d.ts +47 -0
- package/dist/registry-resolve/command.js +226 -0
- package/dist/registry-resolve/registry.d.ts +68 -0
- package/dist/registry-resolve/registry.js +292 -0
- package/dist/registry-resolve/render-shell.d.ts +18 -0
- package/dist/registry-resolve/render-shell.js +36 -0
- package/dist/repair.d.ts +29 -0
- package/dist/repair.js +8 -0
- package/dist/repository-path.d.ts +9 -0
- package/dist/repository-path.js +16 -0
- package/dist/schema-json.d.ts +1 -0
- package/dist/schema-json.js +177 -0
- package/dist/schema.d.ts +1289 -0
- package/dist/schema.js +985 -0
- package/dist/setup/command.d.ts +4 -0
- package/dist/setup/command.js +4 -0
- package/dist/sha256.d.ts +1 -0
- package/dist/sha256.js +4 -0
- package/dist/surfaces/adoption.d.ts +41 -0
- package/dist/surfaces/adoption.js +217 -0
- package/dist/surfaces/consumer-instructions.d.ts +20 -0
- package/dist/surfaces/consumer-instructions.js +43 -0
- package/dist/surfaces/contract.d.ts +42 -0
- package/dist/surfaces/contract.js +169 -0
- package/dist/surfaces/core-declarations.d.ts +24 -0
- package/dist/surfaces/core-declarations.js +79 -0
- package/dist/surfaces/development-markers.d.ts +1 -0
- package/dist/surfaces/development-markers.js +18 -0
- package/dist/surfaces/generator-adapter.d.ts +71 -0
- package/dist/surfaces/generator-adapter.js +809 -0
- package/dist/surfaces/harness-registry.d.ts +260 -0
- package/dist/surfaces/harness-registry.js +146 -0
- package/dist/surfaces/mcp.d.ts +145 -0
- package/dist/surfaces/mcp.js +349 -0
- package/dist/surfaces/merge.d.ts +30 -0
- package/dist/surfaces/merge.js +105 -0
- package/dist/surfaces/ownership.d.ts +190 -0
- package/dist/surfaces/ownership.js +795 -0
- package/dist/surfaces/projection.d.ts +136 -0
- package/dist/surfaces/projection.js +716 -0
- package/dist/surfaces/render.d.ts +79 -0
- package/dist/surfaces/render.js +636 -0
- package/dist/surfaces/restrictions.d.ts +130 -0
- package/dist/surfaces/restrictions.js +447 -0
- package/dist/surfaces/selftest.d.ts +162 -0
- package/dist/surfaces/selftest.js +393 -0
- package/dist/surfaces/skill-contract.d.ts +85 -0
- package/dist/surfaces/skill-contract.js +449 -0
- package/dist/surfaces/sync.d.ts +57 -0
- package/dist/surfaces/sync.js +164 -0
- package/dist/team-metadata.d.ts +41 -0
- package/dist/team-metadata.js +513 -0
- package/dist/testing/gates.d.ts +91 -0
- package/dist/testing/gates.js +182 -0
- package/dist/testing/hooks.d.ts +59 -0
- package/dist/testing/hooks.js +139 -0
- package/dist/testing/test-protection.d.ts +34 -0
- package/dist/testing/test-protection.js +137 -0
- package/dist/testing/verdict.d.ts +29 -0
- package/dist/testing/verdict.js +62 -0
- package/dist/testing/weakening.d.ts +15 -0
- package/dist/testing/weakening.js +30 -0
- package/dist/work-orders/application-closure.d.ts +7 -0
- package/dist/work-orders/application-closure.js +76 -0
- package/dist/work-orders/application-context.d.ts +162 -0
- package/dist/work-orders/application-context.js +137 -0
- package/dist/work-orders/application-decisions.d.ts +27 -0
- package/dist/work-orders/application-decisions.js +121 -0
- package/dist/work-orders/application-grading.d.ts +11 -0
- package/dist/work-orders/application-grading.js +212 -0
- package/dist/work-orders/application.d.ts +6 -0
- package/dist/work-orders/application.js +223 -0
- package/dist/work-orders/composition.d.ts +101 -0
- package/dist/work-orders/composition.js +1202 -0
- package/dist/work-orders/contract.d.ts +77 -0
- package/dist/work-orders/contract.js +140 -0
- package/dist/work-orders/decisions.d.ts +23 -0
- package/dist/work-orders/decisions.js +55 -0
- package/dist/work-orders/store.d.ts +207 -0
- package/dist/work-orders/store.js +291 -0
- package/docs/README.md +68 -0
- package/docs/architecture.md +136 -0
- package/docs/capability-matrix.md +58 -0
- package/docs/cli-reference.md +807 -0
- package/docs/command-list.md +62 -0
- package/docs/compose-patterns.md +99 -0
- package/docs/concepts.md +173 -0
- package/docs/configuration-essentials.md +177 -0
- package/docs/configuration-reference.md +636 -0
- package/docs/docs-check.md +76 -0
- package/docs/environment.md +948 -0
- package/docs/extending.md +43 -0
- package/docs/faq.md +113 -0
- package/docs/getting-started.md +692 -0
- package/docs/harness-surfaces.md +500 -0
- package/docs/joining-a-team.md +76 -0
- package/docs/release-policy.md +49 -0
- package/docs/safety-and-autonomy.md +463 -0
- package/docs/troubleshooting.md +382 -0
- package/docs/tutorial.md +171 -0
- package/docs/work-and-browser.md +420 -0
- package/libexec/browser-operation.cjs +270 -0
- package/libexec/fence-marker.cjs +101 -0
- package/libexec/fence-marker.d.cts +24 -0
- package/libexec/fenced-group-runner.cjs +77 -0
- package/libexec/fenced-supervisor.cjs +137 -0
- package/libexec/generated-filesystem.cjs +731 -0
- package/libexec/install-filesystem.cjs +225 -0
- package/libexec/rulesync-generator.NOTICE.md +1112 -0
- package/libexec/rulesync-generator.cjs +743 -0
- package/libexec/surface-generator-worker.cjs +266 -0
- package/libexec/surface-output-reader.cjs +99 -0
- package/libexec/surface-scratch-cleanup.cjs +14 -0
- package/libexec/validate-harness-evidence.d.mts +183 -0
- package/libexec/validate-harness-evidence.mjs +1312 -0
- package/package.json +74 -4
- package/surfaces/README.md +33 -0
- package/surfaces/agents/evaluator.agent.md +76 -0
- package/surfaces/guards/bash-guard.sh +48 -0
- package/surfaces/guards/claude.adapter.json +25 -0
- package/surfaces/guards/codex.adapter.json +24 -0
- package/surfaces/guards/opencode.adapter.json +25 -0
- package/surfaces/references/browser.md +63 -0
- package/surfaces/references/test-data-and-personas.md +84 -0
- package/surfaces/references/testing-tiers.md +11 -0
- package/surfaces/skills/cockpit-browser.skill.md +59 -0
- package/surfaces/skills/cockpit-explain.skill.md +32 -0
- package/surfaces/skills/cockpit-fix.skill.md +37 -0
- package/surfaces/skills/cockpit-setup.skill.md +39 -0
- package/surfaces/skills/cockpit-work.skill.md +34 -0
- package/surfaces/skills/collection.json +5 -0
- package/surfaces/skills/procedures/explain.md +66 -0
- package/surfaces/skills/procedures/fix.md +95 -0
- package/surfaces/skills/procedures/setup.md +452 -0
- package/surfaces/skills/procedures/work.md +134 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const WORK_ORDER_ID: RegExp;
|
|
3
|
+
declare const Check: z.ZodUnion<readonly [z.ZodObject<{
|
|
4
|
+
gate: z.ZodString;
|
|
5
|
+
select: z.ZodOptional<z.ZodString>;
|
|
6
|
+
}, z.core.$strict>, z.ZodArray<z.ZodString>]>;
|
|
7
|
+
export type WorkOrderCheck = z.infer<typeof Check>;
|
|
8
|
+
export declare const WorkOrderFrontMatter: z.ZodObject<{
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
objective: z.ZodString;
|
|
11
|
+
scope: z.ZodArray<z.ZodString>;
|
|
12
|
+
depends_on: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
13
|
+
gates: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
14
|
+
criteria: z.ZodArray<z.ZodObject<{
|
|
15
|
+
id: z.ZodString;
|
|
16
|
+
text: z.ZodString;
|
|
17
|
+
check: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
18
|
+
gate: z.ZodString;
|
|
19
|
+
select: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strict>, z.ZodArray<z.ZodString>]>>;
|
|
21
|
+
source: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strict>>;
|
|
23
|
+
non_goals: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
export type WorkOrder = z.infer<typeof WorkOrderFrontMatter>;
|
|
26
|
+
export type WorkOrderCriterion = WorkOrder['criteria'][number];
|
|
27
|
+
export type ParsedFile<T> = Readonly<{
|
|
28
|
+
ok: true;
|
|
29
|
+
value: T;
|
|
30
|
+
}> | Readonly<{
|
|
31
|
+
ok: false;
|
|
32
|
+
problems: readonly string[];
|
|
33
|
+
}>;
|
|
34
|
+
/** Parses `workorders/<id>.md`; the id the file declares must be the name it is stored under. */
|
|
35
|
+
export declare function parseWorkOrder(bytes: Uint8Array, fileId: string): ParsedFile<WorkOrder>;
|
|
36
|
+
/** The quick-path file `cockpit grade --criteria` reads: front-matter with criteria, and optionally scope and gates. */
|
|
37
|
+
declare const CriteriaFile: z.ZodObject<{
|
|
38
|
+
criteria: z.ZodArray<z.ZodObject<{
|
|
39
|
+
id: z.ZodString;
|
|
40
|
+
text: z.ZodString;
|
|
41
|
+
check: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
42
|
+
gate: z.ZodString;
|
|
43
|
+
select: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strict>, z.ZodArray<z.ZodString>]>>;
|
|
45
|
+
source: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, z.core.$strict>>;
|
|
47
|
+
scope: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
48
|
+
gates: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
49
|
+
objective: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
export declare function parseCriteriaFile(bytes: Uint8Array): ParsedFile<z.infer<typeof CriteriaFile>>;
|
|
52
|
+
/** The digest an acceptance binds: the contract, each cited source's bytes, and the base commits. */
|
|
53
|
+
export declare function workOrderDigest(order: WorkOrder, sources: Readonly<Record<string, string>>, base: Readonly<Record<string, string>>): string;
|
|
54
|
+
/** One part of a contract an amendment changed in a way that may lower the bar, as it read before and after. */
|
|
55
|
+
export type AmendmentReview = Readonly<{
|
|
56
|
+
field: string;
|
|
57
|
+
before: string;
|
|
58
|
+
after: string;
|
|
59
|
+
}>;
|
|
60
|
+
type ContractAmendment = Readonly<{
|
|
61
|
+
removed: readonly string[];
|
|
62
|
+
review: readonly AmendmentReview[];
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* How a changed contract moves the bar. Dropping an accepted criterion or gate lowers it in every
|
|
66
|
+
* reading, so it is `removed`. A rewritten criterion, a widened scope, a dropped or reworded non-goal
|
|
67
|
+
* or a new objective may lower it or only clarify it: no byte comparison can tell which, so each is
|
|
68
|
+
* returned for review with its text before and after. Adding a criterion or gate, narrowing scope and
|
|
69
|
+
* adding a non-goal only raise the bar.
|
|
70
|
+
*/
|
|
71
|
+
export declare function contractAmendment(accepted: WorkOrder, changed: WorkOrder): ContractAmendment;
|
|
72
|
+
/** The review fields a `checks` grade enforces: the criteria's checks and the scope. Objective and non-goals bind only where a model grades. */
|
|
73
|
+
export declare const checksBindsField: (field: string) => boolean;
|
|
74
|
+
/** Whether a path falls in `scope`, with each glob compiled once for the many paths a caller tests. */
|
|
75
|
+
export declare function scopeMatcher(scope: readonly string[]): (path: string) => boolean;
|
|
76
|
+
export declare const scopeMatches: (scope: readonly string[], path: string) => boolean;
|
|
77
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// Owns the work-order file: `workorders/<id>.md`, whose YAML front-matter is the whole contract an
|
|
2
|
+
// order is accepted, checked and graded against, and whose Markdown body is free notes cockpit never
|
|
3
|
+
// reads. One schema validates the front-matter; the digest binds it with the bytes of every source a
|
|
4
|
+
// criterion cites and the commit each repository stood at when the order was accepted.
|
|
5
|
+
import { createHash } from 'node:crypto';
|
|
6
|
+
import { parseDocument } from 'yaml';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { REPOSITORY_PATH } from '../repository-path.js';
|
|
9
|
+
// One inert word, never a path or an option: the CLI, the guard and the store each admit it before it names a file.
|
|
10
|
+
export const WORK_ORDER_ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
11
|
+
const WORK_ORDER_LIMITS = Object.freeze({ bytes: 65_536, criteria: 12, scope: 64, textBytes: 2_048, arguments: 32, argumentBytes: 2_048 });
|
|
12
|
+
const PRINTABLE = /^[^\x00-\x08\x0b-\x1f\x7f]*$/;
|
|
13
|
+
const text = z.string().trim().min(1).refine(value => Buffer.byteLength(value) <= WORK_ORDER_LIMITS.textBytes && PRINTABLE.test(value), `at most ${WORK_ORDER_LIMITS.textBytes} bytes without control characters`);
|
|
14
|
+
const repositoryPath = z.string().max(1_024).regex(REPOSITORY_PATH, 'a relative path, optionally <sibling slug>:path, without .. or a leading /');
|
|
15
|
+
const sourcePath = repositoryPath.refine(value => !/[*?]/.test(value), 'a source names one file, without wildcards');
|
|
16
|
+
const argument = z.string().min(1).refine(value => Buffer.byteLength(value) <= WORK_ORDER_LIMITS.argumentBytes && !/[\x00-\x1f\x7f]/.test(value), 'a bounded argument without control characters');
|
|
17
|
+
const GateCheck = z.object({
|
|
18
|
+
gate: z.string().regex(/^[a-z][a-z0-9-]{0,63}$/, 'a declared [testing] gate id'),
|
|
19
|
+
// A selected value that starts with `-` would reach the product's tool as an option of its own.
|
|
20
|
+
select: z.string().max(4_096).regex(/^(?:spec|file|test|route):[^-]/, 'spec|file|test|route:<value>').optional(),
|
|
21
|
+
}).strict();
|
|
22
|
+
const Check = z.union([GateCheck, z.array(argument).min(1).max(WORK_ORDER_LIMITS.arguments)]);
|
|
23
|
+
const Criterion = z.object({
|
|
24
|
+
id: z.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,31}$/, 'a short identifier such as AC1'),
|
|
25
|
+
text,
|
|
26
|
+
check: Check.optional(),
|
|
27
|
+
source: sourcePath.optional(),
|
|
28
|
+
}).strict();
|
|
29
|
+
const Criteria = z.array(Criterion).min(1).max(WORK_ORDER_LIMITS.criteria)
|
|
30
|
+
.refine(rows => new Set(rows.map(row => row.id)).size === rows.length, 'each criterion id is used once');
|
|
31
|
+
export const WorkOrderFrontMatter = z.object({
|
|
32
|
+
id: z.string().regex(WORK_ORDER_ID, 'letters, digits, dot, underscore or hyphen, at most 128'),
|
|
33
|
+
objective: text,
|
|
34
|
+
scope: z.array(repositoryPath).min(1).max(WORK_ORDER_LIMITS.scope).describe('Paths and globs the work may change.'),
|
|
35
|
+
depends_on: z.array(z.string().regex(WORK_ORDER_ID)).max(32).default([]),
|
|
36
|
+
gates: z.array(z.string().regex(/^[a-z][a-z0-9-]{0,63}$/)).max(16).default([]).describe('Declared [testing] gates that must pass at work check.'),
|
|
37
|
+
criteria: Criteria,
|
|
38
|
+
non_goals: z.array(text).max(32).default([]),
|
|
39
|
+
}).strict();
|
|
40
|
+
function frontMatter(bytes) {
|
|
41
|
+
if (bytes.byteLength > WORK_ORDER_LIMITS.bytes)
|
|
42
|
+
return { ok: false, problems: [`the file exceeds ${WORK_ORDER_LIMITS.bytes} bytes`] };
|
|
43
|
+
let source;
|
|
44
|
+
try {
|
|
45
|
+
source = new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (!(error instanceof TypeError))
|
|
49
|
+
throw error;
|
|
50
|
+
return { ok: false, problems: ['the file is not UTF-8'] };
|
|
51
|
+
}
|
|
52
|
+
const lines = source.replace(/^/, '').split(/\r?\n/);
|
|
53
|
+
const end = lines.indexOf('---', 1);
|
|
54
|
+
if (lines[0] !== '---' || end < 0)
|
|
55
|
+
return { ok: false, problems: ['the file must start with YAML front-matter between two --- lines'] };
|
|
56
|
+
const document = parseDocument(lines.slice(1, end).join('\n'), { uniqueKeys: true, prettyErrors: false });
|
|
57
|
+
if (document.errors.length)
|
|
58
|
+
return { ok: false, problems: document.errors.map(error => `front-matter is not YAML: ${error.message.split('\n')[0]}`) };
|
|
59
|
+
return { ok: true, value: document.toJS({ maxAliasCount: 0 }) };
|
|
60
|
+
}
|
|
61
|
+
function issues(error) {
|
|
62
|
+
return error.issues.map(issue => `${issue.path.length ? issue.path.join('.') : 'front-matter'}: ${issue.message}`);
|
|
63
|
+
}
|
|
64
|
+
/** Parses `workorders/<id>.md`; the id the file declares must be the name it is stored under. */
|
|
65
|
+
export function parseWorkOrder(bytes, fileId) {
|
|
66
|
+
const read = frontMatter(bytes);
|
|
67
|
+
if (!read.ok)
|
|
68
|
+
return read;
|
|
69
|
+
const parsed = WorkOrderFrontMatter.safeParse(read.value);
|
|
70
|
+
if (!parsed.success)
|
|
71
|
+
return { ok: false, problems: issues(parsed.error) };
|
|
72
|
+
if (parsed.data.id !== fileId)
|
|
73
|
+
return { ok: false, problems: [`id: the file workorders/${fileId}.md declares id ${parsed.data.id}; they must match`] };
|
|
74
|
+
if (parsed.data.depends_on.includes(parsed.data.id))
|
|
75
|
+
return { ok: false, problems: ['depends_on: an order cannot depend on itself'] };
|
|
76
|
+
return { ok: true, value: parsed.data };
|
|
77
|
+
}
|
|
78
|
+
/** The quick-path file `cockpit grade --criteria` reads: front-matter with criteria, and optionally scope and gates. */
|
|
79
|
+
const CriteriaFile = z.object({ criteria: Criteria, scope: z.array(repositoryPath).max(WORK_ORDER_LIMITS.scope).default([]),
|
|
80
|
+
gates: z.array(z.string().regex(/^[a-z][a-z0-9-]{0,63}$/)).max(16).default([]), objective: text.optional() }).strict();
|
|
81
|
+
export function parseCriteriaFile(bytes) {
|
|
82
|
+
const read = frontMatter(bytes);
|
|
83
|
+
if (!read.ok)
|
|
84
|
+
return read;
|
|
85
|
+
const parsed = CriteriaFile.safeParse(read.value);
|
|
86
|
+
return parsed.success ? { ok: true, value: parsed.data } : { ok: false, problems: issues(parsed.error) };
|
|
87
|
+
}
|
|
88
|
+
function canonical(value) {
|
|
89
|
+
if (Array.isArray(value))
|
|
90
|
+
return value.map(canonical);
|
|
91
|
+
if (value === null || typeof value !== 'object')
|
|
92
|
+
return value;
|
|
93
|
+
return Object.fromEntries(Object.keys(value).sort().map(key => [key, canonical(value[key])]));
|
|
94
|
+
}
|
|
95
|
+
/** The digest an acceptance binds: the contract, each cited source's bytes, and the base commits. */
|
|
96
|
+
export function workOrderDigest(order, sources, base) {
|
|
97
|
+
return createHash('sha256').update(JSON.stringify(canonical({ order, sources, base }))).digest('hex');
|
|
98
|
+
}
|
|
99
|
+
const criterionText = (row) => `${row.text}${row.check ? ` [check: ${JSON.stringify(row.check)}]` : ''}${row.source ? ` [source: ${row.source}]` : ''}`;
|
|
100
|
+
/**
|
|
101
|
+
* How a changed contract moves the bar. Dropping an accepted criterion or gate lowers it in every
|
|
102
|
+
* reading, so it is `removed`. A rewritten criterion, a widened scope, a dropped or reworded non-goal
|
|
103
|
+
* or a new objective may lower it or only clarify it: no byte comparison can tell which, so each is
|
|
104
|
+
* returned for review with its text before and after. Adding a criterion or gate, narrowing scope and
|
|
105
|
+
* adding a non-goal only raise the bar.
|
|
106
|
+
*/
|
|
107
|
+
export function contractAmendment(accepted, changed) {
|
|
108
|
+
const removed = [...accepted.criteria.filter(before => !changed.criteria.some(row => row.id === before.id)).map(row => `${row.id} is removed`),
|
|
109
|
+
...accepted.gates.filter(gate => !changed.gates.includes(gate)).map(gate => `gate ${gate} is removed`)];
|
|
110
|
+
const review = accepted.criteria.flatMap(before => {
|
|
111
|
+
const after = changed.criteria.find(row => row.id === before.id);
|
|
112
|
+
return after && JSON.stringify(canonical(after)) !== JSON.stringify(canonical(before))
|
|
113
|
+
? [{ field: `criteria.${before.id}`, before: criterionText(before), after: criterionText(after) }] : [];
|
|
114
|
+
});
|
|
115
|
+
if (changed.scope.some(entry => !accepted.scope.includes(entry)))
|
|
116
|
+
review.push({ field: 'scope', before: accepted.scope.join(', '), after: changed.scope.join(', ') });
|
|
117
|
+
if (accepted.non_goals.some(goal => !changed.non_goals.includes(goal)))
|
|
118
|
+
review.push({ field: 'non_goals', before: accepted.non_goals.join('; '), after: changed.non_goals.join('; ') });
|
|
119
|
+
if (accepted.objective !== changed.objective)
|
|
120
|
+
review.push({ field: 'objective', before: accepted.objective, after: changed.objective });
|
|
121
|
+
return { removed, review };
|
|
122
|
+
}
|
|
123
|
+
/** The review fields a `checks` grade enforces: the criteria's checks and the scope. Objective and non-goals bind only where a model grades. */
|
|
124
|
+
export const checksBindsField = (field) => field === 'scope' || field.startsWith('criteria.');
|
|
125
|
+
// `**` crosses directories, `*` and `?` stay within one; a plain entry also covers what is below it.
|
|
126
|
+
/** Whether a path falls in `scope`, with each glob compiled once for the many paths a caller tests. */
|
|
127
|
+
export function scopeMatcher(scope) {
|
|
128
|
+
const tests = scope.map((entry) => {
|
|
129
|
+
if (!/[*?]/.test(entry)) {
|
|
130
|
+
const directory = `${entry.replace(/\/$/, '')}/`;
|
|
131
|
+
return path => path === entry || path.startsWith(directory);
|
|
132
|
+
}
|
|
133
|
+
const pattern = entry.split(/(\*\*\/?|\*|\?)/).map(part => part === '**' || part === '**/' ? '(?:.*/)?' + (part === '**' ? '.*' : '')
|
|
134
|
+
: part === '*' ? '[^/]*' : part === '?' ? '[^/]' : part.replace(/[.+^${}()|[\]\\]/g, '\\$&')).join('');
|
|
135
|
+
const compiled = new RegExp(`^${pattern}$`);
|
|
136
|
+
return path => compiled.test(path);
|
|
137
|
+
});
|
|
138
|
+
return path => tests.some(test => test(path));
|
|
139
|
+
}
|
|
140
|
+
export const scopeMatches = (scope, path) => scopeMatcher(scope)(path);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type RecordName = Readonly<{
|
|
2
|
+
name: string;
|
|
3
|
+
number?: string;
|
|
4
|
+
}>;
|
|
5
|
+
/** The next record's file name: the next free number, at least four digits wide, unless the directory names records by date. */
|
|
6
|
+
export declare function nextRecordName(existing: readonly string[], title: string, today: string): RecordName;
|
|
7
|
+
/** A single-line title, safe inside a heading and a Markdown link label. */
|
|
8
|
+
export declare function recordTitle(text: string): string;
|
|
9
|
+
export declare function scaffoldRecord(input: Readonly<{
|
|
10
|
+
title: string;
|
|
11
|
+
number?: string;
|
|
12
|
+
workOrder: string;
|
|
13
|
+
supersedes?: string;
|
|
14
|
+
}>): string;
|
|
15
|
+
export declare const holdsPlaceholders: (text: string) => boolean;
|
|
16
|
+
/** The work orders a record cites, from a `Work order:` line or a `work_order:` front-matter field. */
|
|
17
|
+
export declare function citedOrders(text: string): readonly string[];
|
|
18
|
+
/**
|
|
19
|
+
* Whether a record names a path inside `scope`. A path-like word is one with a slash; a record kept
|
|
20
|
+
* in a sibling names that sibling's paths without its prefix, so `prefix` qualifies them.
|
|
21
|
+
*/
|
|
22
|
+
export declare function namesScope(text: string, scope: readonly string[], prefix: string): boolean;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Owns the decision records a work order cites, read and written as text: how a new record is named,
|
|
2
|
+
// the template cockpit scaffolds, whether a record still holds that template's placeholders, which
|
|
3
|
+
// order it cites, and which paths it names. The integrity of the whole directory (duplicate numbers,
|
|
4
|
+
// an index that misses a file) is the docs check's; this module reads only what an order needs.
|
|
5
|
+
import { isDatedRecordName, recordNumber } from '../docs/decision-record.js';
|
|
6
|
+
import { splitRepositoryPath } from '../repository-path.js';
|
|
7
|
+
import { scopeMatcher, WORK_ORDER_ID } from './contract.js';
|
|
8
|
+
// Every placeholder the template writes carries this, so a record nobody filled in is detectable.
|
|
9
|
+
const PLACEHOLDER = 'cockpit: replace this';
|
|
10
|
+
/** The next record's file name: the next free number, at least four digits wide, unless the directory names records by date. */
|
|
11
|
+
export function nextRecordName(existing, title, today) {
|
|
12
|
+
const records = existing.filter(name => name.endsWith('.md'));
|
|
13
|
+
const numbers = records.flatMap(name => recordNumber(name) ?? []);
|
|
14
|
+
const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 64).replace(/-+$/, '') || 'decision';
|
|
15
|
+
if (!numbers.length && records.some(isDatedRecordName)) {
|
|
16
|
+
// Two decisions with one title on one day would otherwise share a name.
|
|
17
|
+
let name = `${today}-${slug}.md`;
|
|
18
|
+
for (let suffix = 2; records.includes(name); suffix++)
|
|
19
|
+
name = `${today}-${slug}-${suffix}.md`;
|
|
20
|
+
return { name };
|
|
21
|
+
}
|
|
22
|
+
const next = numbers.reduce((max, value) => Math.max(max, Number(value)), 0) + 1;
|
|
23
|
+
const number = String(next).padStart(Math.max(4, ...numbers.map(value => value.length)), '0');
|
|
24
|
+
return { name: `${number}-${slug}.md`, number };
|
|
25
|
+
}
|
|
26
|
+
/** A single-line title, safe inside a heading and a Markdown link label. */
|
|
27
|
+
export function recordTitle(text) {
|
|
28
|
+
return text.replace(/\s+/g, ' ').trim().replace(/[[\]]/g, '');
|
|
29
|
+
}
|
|
30
|
+
export function scaffoldRecord(input) {
|
|
31
|
+
return [`# ${input.number ? `${input.number}. ` : ''}${input.title}`, '', 'Status: accepted', `Work order: ${input.workOrder}`,
|
|
32
|
+
...input.supersedes ? [`Supersedes: ${input.supersedes}`] : [], '',
|
|
33
|
+
'## Context', '', `<!-- ${PLACEHOLDER} with what made a decision necessary. -->`, '',
|
|
34
|
+
'## Decision', '', `<!-- ${PLACEHOLDER} with what was decided. -->`, '',
|
|
35
|
+
'## Consequences', '', `<!-- ${PLACEHOLDER} with what becomes easier or harder because of it. -->`, ''].join('\n');
|
|
36
|
+
}
|
|
37
|
+
export const holdsPlaceholders = (text) => text.includes(PLACEHOLDER);
|
|
38
|
+
/** The work orders a record cites, from a `Work order:` line or a `work_order:` front-matter field. */
|
|
39
|
+
export function citedOrders(text) {
|
|
40
|
+
return [...text.matchAll(/^\**work[ _-]order\**:\**[ \t]*(.+)$/gim)]
|
|
41
|
+
.flatMap(match => match[1].split(/[\s,`]+/)).filter(id => id && WORK_ORDER_ID.test(id));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Whether a record names a path inside `scope`. A path-like word is one with a slash; a record kept
|
|
45
|
+
* in a sibling names that sibling's paths without its prefix, so `prefix` qualifies them.
|
|
46
|
+
*/
|
|
47
|
+
export function namesScope(text, scope, prefix) {
|
|
48
|
+
const inScope = scopeMatcher(scope);
|
|
49
|
+
for (const match of text.matchAll(/(?:^|[\s`(<"'[])((?:[a-z0-9][a-z0-9-]{0,63}:)?[A-Za-z0-9._@+-]+(?:\/[A-Za-z0-9._@+-]*)+)/g)) {
|
|
50
|
+
const path = match[1].replace(/^\.\//, '').replace(/[.,;:]+$/, '');
|
|
51
|
+
if (inScope(splitRepositoryPath(path).slug === undefined ? `${prefix}${path}` : path))
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const WORK_RECORD_DIRECTORY = ".cockpit/work-orders";
|
|
3
|
+
declare const CheckResult: z.ZodObject<{
|
|
4
|
+
criterion: z.ZodString;
|
|
5
|
+
kind: z.ZodEnum<{
|
|
6
|
+
argv: "argv";
|
|
7
|
+
gate: "gate";
|
|
8
|
+
}>;
|
|
9
|
+
passed: z.ZodBoolean;
|
|
10
|
+
outcome: z.ZodString;
|
|
11
|
+
output: z.ZodString;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
export type CheckResult = z.infer<typeof CheckResult>;
|
|
14
|
+
export declare const WorkRecord: z.ZodObject<{
|
|
15
|
+
format: z.ZodLiteral<"cockpit-work-order/v1">;
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
state: z.ZodEnum<{
|
|
18
|
+
abandoned: "abandoned";
|
|
19
|
+
accepted: "accepted";
|
|
20
|
+
checked: "checked";
|
|
21
|
+
done: "done";
|
|
22
|
+
graded: "graded";
|
|
23
|
+
partial: "partial";
|
|
24
|
+
}>;
|
|
25
|
+
accepted: z.ZodObject<{
|
|
26
|
+
at: z.ZodString;
|
|
27
|
+
by: z.ZodEnum<{
|
|
28
|
+
agent: "agent";
|
|
29
|
+
ci: "ci";
|
|
30
|
+
person: "person";
|
|
31
|
+
}>;
|
|
32
|
+
digest: z.ZodString;
|
|
33
|
+
order: z.ZodObject<{
|
|
34
|
+
id: z.ZodString;
|
|
35
|
+
objective: z.ZodString;
|
|
36
|
+
scope: z.ZodArray<z.ZodString>;
|
|
37
|
+
depends_on: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
38
|
+
gates: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
39
|
+
criteria: z.ZodArray<z.ZodObject<{
|
|
40
|
+
id: z.ZodString;
|
|
41
|
+
text: z.ZodString;
|
|
42
|
+
check: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
43
|
+
gate: z.ZodString;
|
|
44
|
+
select: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, z.core.$strict>, z.ZodArray<z.ZodString>]>>;
|
|
46
|
+
source: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.core.$strict>>;
|
|
48
|
+
non_goals: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
sources: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
51
|
+
base: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
amendments: z.ZodArray<z.ZodObject<{
|
|
54
|
+
at: z.ZodString;
|
|
55
|
+
by: z.ZodEnum<{
|
|
56
|
+
agent: "agent";
|
|
57
|
+
ci: "ci";
|
|
58
|
+
person: "person";
|
|
59
|
+
}>;
|
|
60
|
+
from: z.ZodString;
|
|
61
|
+
to: z.ZodString;
|
|
62
|
+
weakened: z.ZodArray<z.ZodString>;
|
|
63
|
+
review: z.ZodArray<z.ZodObject<{
|
|
64
|
+
field: z.ZodString;
|
|
65
|
+
before: z.ZodString;
|
|
66
|
+
after: z.ZodString;
|
|
67
|
+
}, z.core.$strict>>;
|
|
68
|
+
}, z.core.$strict>>;
|
|
69
|
+
acknowledgements: z.ZodArray<z.ZodObject<{
|
|
70
|
+
at: z.ZodString;
|
|
71
|
+
by: z.ZodEnum<{
|
|
72
|
+
agent: "agent";
|
|
73
|
+
ci: "ci";
|
|
74
|
+
person: "person";
|
|
75
|
+
}>;
|
|
76
|
+
digest: z.ZodString;
|
|
77
|
+
findings: z.ZodArray<z.ZodString>;
|
|
78
|
+
note: z.ZodString;
|
|
79
|
+
}, z.core.$strict>>;
|
|
80
|
+
attempts: z.ZodNumber;
|
|
81
|
+
checks: z.ZodOptional<z.ZodObject<{
|
|
82
|
+
at: z.ZodString;
|
|
83
|
+
digest: z.ZodString;
|
|
84
|
+
results: z.ZodArray<z.ZodObject<{
|
|
85
|
+
criterion: z.ZodString;
|
|
86
|
+
kind: z.ZodEnum<{
|
|
87
|
+
argv: "argv";
|
|
88
|
+
gate: "gate";
|
|
89
|
+
}>;
|
|
90
|
+
passed: z.ZodBoolean;
|
|
91
|
+
outcome: z.ZodString;
|
|
92
|
+
output: z.ZodString;
|
|
93
|
+
}, z.core.$strict>>;
|
|
94
|
+
}, z.core.$strict>>;
|
|
95
|
+
grade: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
at: z.ZodString;
|
|
97
|
+
digest: z.ZodString;
|
|
98
|
+
mode: z.ZodEnum<{
|
|
99
|
+
checks: "checks";
|
|
100
|
+
independent: "independent";
|
|
101
|
+
self: "self";
|
|
102
|
+
}>;
|
|
103
|
+
passed: z.ZodBoolean;
|
|
104
|
+
criteria: z.ZodArray<z.ZodObject<{
|
|
105
|
+
id: z.ZodString;
|
|
106
|
+
verdict: z.ZodEnum<{
|
|
107
|
+
met: "met";
|
|
108
|
+
unclear: "unclear";
|
|
109
|
+
unmet: "unmet";
|
|
110
|
+
}>;
|
|
111
|
+
note: z.ZodString;
|
|
112
|
+
}, z.core.$strict>>;
|
|
113
|
+
outOfScope: z.ZodArray<z.ZodString>;
|
|
114
|
+
evaluator: z.ZodOptional<z.ZodObject<{
|
|
115
|
+
tool: z.ZodString;
|
|
116
|
+
fallbacks: z.ZodArray<z.ZodObject<{
|
|
117
|
+
tool: z.ZodString;
|
|
118
|
+
code: z.ZodString;
|
|
119
|
+
message: z.ZodString;
|
|
120
|
+
}, z.core.$strict>>;
|
|
121
|
+
}, z.core.$strict>>;
|
|
122
|
+
note: z.ZodOptional<z.ZodString>;
|
|
123
|
+
}, z.core.$strict>>;
|
|
124
|
+
amendmentsFailedReview: z.ZodOptional<z.ZodObject<{
|
|
125
|
+
at: z.ZodString;
|
|
126
|
+
note: z.ZodString;
|
|
127
|
+
}, z.core.$strict>>;
|
|
128
|
+
notes: z.ZodArray<z.ZodObject<{
|
|
129
|
+
at: z.ZodString;
|
|
130
|
+
by: z.ZodEnum<{
|
|
131
|
+
agent: "agent";
|
|
132
|
+
ci: "ci";
|
|
133
|
+
person: "person";
|
|
134
|
+
}>;
|
|
135
|
+
kind: z.ZodEnum<{
|
|
136
|
+
answer: "answer";
|
|
137
|
+
decision: "decision";
|
|
138
|
+
note: "note";
|
|
139
|
+
question: "question";
|
|
140
|
+
resolution: "resolution";
|
|
141
|
+
}>;
|
|
142
|
+
text: z.ZodString;
|
|
143
|
+
answers: z.ZodOptional<z.ZodNumber>;
|
|
144
|
+
resolves: z.ZodOptional<z.ZodNumber>;
|
|
145
|
+
record: z.ZodOptional<z.ZodString>;
|
|
146
|
+
}, z.core.$strict>>;
|
|
147
|
+
closure: z.ZodOptional<z.ZodObject<{
|
|
148
|
+
at: z.ZodString;
|
|
149
|
+
by: z.ZodEnum<{
|
|
150
|
+
agent: "agent";
|
|
151
|
+
ci: "ci";
|
|
152
|
+
person: "person";
|
|
153
|
+
}>;
|
|
154
|
+
how: z.ZodEnum<{
|
|
155
|
+
abandoned: "abandoned";
|
|
156
|
+
"checks-passed": "checks-passed";
|
|
157
|
+
graded: "graded";
|
|
158
|
+
partial: "partial";
|
|
159
|
+
"self-reported": "self-reported";
|
|
160
|
+
}>;
|
|
161
|
+
note: z.ZodOptional<z.ZodString>;
|
|
162
|
+
}, z.core.$strict>>;
|
|
163
|
+
recoveries: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
164
|
+
at: z.ZodString;
|
|
165
|
+
holder: z.ZodString;
|
|
166
|
+
checked: z.ZodArray<z.ZodString>;
|
|
167
|
+
}, z.core.$strict>>>;
|
|
168
|
+
}, z.core.$strict>;
|
|
169
|
+
export type WorkRecord = z.infer<typeof WorkRecord>;
|
|
170
|
+
/** Keeps the end of a command's output, where a runner prints its summary, within the record's bound. */
|
|
171
|
+
export declare function outputTail(value: string): string;
|
|
172
|
+
export interface WorkStore {
|
|
173
|
+
readonly read: (id: string) => Promise<WorkRecord | undefined>;
|
|
174
|
+
readonly list: () => Promise<readonly WorkRecord[]>;
|
|
175
|
+
/** Runs `change` holding the order's lock; it returns the next record, or undefined to write nothing. */
|
|
176
|
+
readonly update: <T>(id: string, change: (current: WorkRecord | undefined) => Promise<{
|
|
177
|
+
record?: WorkRecord;
|
|
178
|
+
value: T;
|
|
179
|
+
}>) => Promise<T>;
|
|
180
|
+
/** Names a lock's holder and, with `apply`, removes the lock once the holder is shown gone, recording what was checked. */
|
|
181
|
+
readonly recover: (id: string, apply: boolean, containers: () => Promise<ContainerEvidence>) => Promise<LockRecovery>;
|
|
182
|
+
}
|
|
183
|
+
/** The containers cockpit labels on this machine's Docker daemon, which a process probe cannot look inside. */
|
|
184
|
+
export type ContainerEvidence = Readonly<{
|
|
185
|
+
state: 'listed';
|
|
186
|
+
context: string;
|
|
187
|
+
containers: readonly Readonly<{
|
|
188
|
+
id: string;
|
|
189
|
+
name: string;
|
|
190
|
+
running: boolean;
|
|
191
|
+
}>[];
|
|
192
|
+
}> | Readonly<{
|
|
193
|
+
state: 'no-docker';
|
|
194
|
+
reason: string;
|
|
195
|
+
}> | Readonly<{
|
|
196
|
+
state: 'unavailable';
|
|
197
|
+
reason: string;
|
|
198
|
+
}>;
|
|
199
|
+
type LockRecovery = Readonly<{
|
|
200
|
+
id: string;
|
|
201
|
+
lock: 'none' | 'live' | 'unknown' | 'dead' | 'removed';
|
|
202
|
+
holder?: string;
|
|
203
|
+
checked?: readonly string[];
|
|
204
|
+
recorded?: boolean;
|
|
205
|
+
}>;
|
|
206
|
+
export declare function createWorkStore(root: string): WorkStore;
|
|
207
|
+
export {};
|