agentskeptic 0.1.1 → 0.1.2

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.
Files changed (43) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +342 -342
  3. package/dist/cli.js +157 -157
  4. package/dist/debug-ui/app.css +188 -188
  5. package/dist/debug-ui/app.js +245 -245
  6. package/dist/debug-ui/index.html +79 -79
  7. package/dist/enforceCli.js +11 -11
  8. package/dist/planTransition.test.js +235 -235
  9. package/dist/planTransitionPathHarvest.test.js +116 -116
  10. package/dist/quickVerify/postgresCatalog.js +53 -53
  11. package/package.json +1 -1
  12. package/schemas/agent-run-record-v1.schema.json +51 -51
  13. package/schemas/agent-run-record-v2.schema.json +61 -61
  14. package/schemas/assurance-manifest-v1.schema.json +28 -28
  15. package/schemas/assurance-run-report-v1.schema.json +28 -28
  16. package/schemas/ci-lock-v1.schema.json +163 -163
  17. package/schemas/cli-error-envelope.schema.json +48 -48
  18. package/schemas/event.schema.json +111 -111
  19. package/schemas/execution-trace-view.schema.json +122 -122
  20. package/schemas/plan-validation-core.schema.json +95 -95
  21. package/schemas/quick-verify-report.schema.json +251 -251
  22. package/schemas/registry-validation-result.schema.json +99 -99
  23. package/schemas/run-comparison-report.schema.json +513 -513
  24. package/schemas/tools-registry-export.schema.json +9 -9
  25. package/schemas/tools-registry.schema.json +284 -284
  26. package/schemas/workflow-engine-result.schema.json +591 -591
  27. package/schemas/workflow-result-compare-input.schema.json +15 -15
  28. package/schemas/workflow-result-signature.schema.json +20 -20
  29. package/schemas/workflow-result-v9.schema.json +85 -85
  30. package/schemas/workflow-result.schema.json +80 -80
  31. package/schemas/workflow-truth-report.schema.json +761 -761
  32. package/dist/failureOriginSchemaEnum.test.d.ts +0 -2
  33. package/dist/failureOriginSchemaEnum.test.d.ts.map +0 -1
  34. package/dist/failureOriginSchemaEnum.test.js +0 -21
  35. package/dist/failureOriginSchemaEnum.test.js.map +0 -1
  36. package/dist/failureOriginSchemaParity.test.d.ts +0 -2
  37. package/dist/failureOriginSchemaParity.test.d.ts.map +0 -1
  38. package/dist/failureOriginSchemaParity.test.js +0 -33
  39. package/dist/failureOriginSchemaParity.test.js.map +0 -1
  40. package/dist/slice6.compare.ac.test.d.ts +0 -2
  41. package/dist/slice6.compare.ac.test.d.ts.map +0 -1
  42. package/dist/slice6.compare.ac.test.js +0 -81
  43. package/dist/slice6.compare.ac.test.js.map +0 -1
package/dist/cli.js CHANGED
@@ -35,97 +35,97 @@ import { runBatchCiLockFromRestArgs, runQuickCiLockFromRestArgs } from "./ciLock
35
35
  import { formatDistributionFooter } from "./distributionFooter.js";
36
36
  import { postPublicVerificationReport } from "./shareReport/postPublicVerificationReport.js";
37
37
  function usageQuick() {
38
- return `Usage:
39
- agentskeptic quick --input <path> (--postgres-url <url> | --db <sqlitePath>) --export-registry <path>
40
- [--emit-events <path>] [--workflow-id <id>] [--share-report-origin <https://host>]
41
-
42
- Input must contain structured tool activity (tool names and parameters extractable as JSON). Verification uses read-only SQL against the database you pass.
43
-
44
- Use - for stdin. Writes registry JSON array atomically, then optional events file, then stdout (see docs/quick-verify-normative.md).
45
- With --share-report-origin, human stderr is deferred until after a successful POST (same contract as batch verify; see docs/shareable-verification-reports.md).
46
-
47
- Exit codes:
48
- 0 verdict pass
49
- 1 verdict fail
50
- 2 verdict uncertain
51
- 3 operational failure (stderr: JSON envelope)
52
-
38
+ return `Usage:
39
+ agentskeptic quick --input <path> (--postgres-url <url> | --db <sqlitePath>) --export-registry <path>
40
+ [--emit-events <path>] [--workflow-id <id>] [--share-report-origin <https://host>]
41
+
42
+ Input must contain structured tool activity (tool names and parameters extractable as JSON). Verification uses read-only SQL against the database you pass.
43
+
44
+ Use - for stdin. Writes registry JSON array atomically, then optional events file, then stdout (see docs/quick-verify-normative.md).
45
+ With --share-report-origin, human stderr is deferred until after a successful POST (same contract as batch verify; see docs/shareable-verification-reports.md).
46
+
47
+ Exit codes:
48
+ 0 verdict pass
49
+ 1 verdict fail
50
+ 2 verdict uncertain
51
+ 3 operational failure (stderr: JSON envelope)
52
+
53
53
  --help, -h print this message and exit 0`;
54
54
  }
55
55
  function usageVerify() {
56
- return `Usage:
57
- agentskeptic quick --input <path> (--postgres-url <url> | --db <sqlitePath>) --export-registry <path> [--emit-events <path>] [--workflow-id <id>]
58
- (zero-config path; structured tool activity + read-only SQL; see docs/quick-verify-normative.md)
59
-
60
- agentskeptic --workflow-id <id> --events <path> --registry <path> --db <sqlitePath>
61
- agentskeptic --workflow-id <id> --events <path> --registry <path> --postgres-url <url>
62
-
63
- Optional CI lock (commercial build; same as enforce batch): append exactly one of
64
- --output-lock <path> or --expect-lock <path> (requires active subscription; see docs/ci-enforcement.md).
65
-
66
- Optional consistency (default strong):
67
- --consistency strong|eventual
68
- With eventual, required:
69
- --verification-window-ms <int>
70
- --poll-interval-ms <int> (must be >= 1 and <= window)
71
-
72
- With strong, do not pass --verification-window-ms or --poll-interval-ms.
73
-
74
- Provide exactly one of --db or --postgres-url.
75
-
76
- Optional output:
77
- --no-truth-report For verdict exits 0–2, do not print the human truth report to stderr (stderr empty). stdout WorkflowResult JSON is unchanged. Exit 3 stderr is unchanged (single-line JSON envelope).
78
- --share-report-origin <https://host> After successful verification, POST a shareable report to that origin (https only, origin with no path), then print human report + footer to stderr and WorkflowResult JSON to stdout. On POST failure: exit 3, stdout empty, stderr single-line JSON envelope (code SHARE_REPORT_FAILED). See docs/shareable-verification-reports.md.
79
-
80
- Exit codes:
81
- 0 workflow status complete
82
- 1 workflow status inconsistent
83
- 2 workflow status incomplete
84
- 3 operational failure (see stderr JSON)
85
- 4 CI lock mismatch with --expect-lock (stdout: WorkflowResult line; stderr: envelope after human report if any)
86
-
87
- agentskeptic compare --prior <path> [--prior <path> ...] --current <path>
88
- Compare saved WorkflowResult JSON files (local only; see docs).
89
-
90
- agentskeptic validate-registry --registry <path>
91
- agentskeptic validate-registry --registry <path> --events <path> --workflow-id <id>
92
- Validate tools registry JSON (and optionally resolution vs events) without a database.
93
- See docs/agentskeptic.md (Registry validation).
94
-
95
- agentskeptic execution-trace --workflow-id <id> --events <path> [--workflow-result <path>] [--format json|text]
96
- Emit ExecutionTraceView JSON or text (see docs/agentskeptic.md).
97
-
98
- agentskeptic enforce batch (--expect-lock <path> | --output-lock <path>) <same flags as batch verify>
99
- agentskeptic enforce quick (--expect-lock <path> | --output-lock <path>) <same flags as quick>
100
- CI enforcement with pinned ci-lock-v1 (see docs/ci-enforcement.md).
101
-
102
- agentskeptic assurance run --manifest <path> [--write-report <path>]
103
- agentskeptic assurance stale --report <path> --max-age-hours <n>
104
- Multi-scenario assurance sweep and staleness gate (see docs/agentskeptic.md).
105
-
106
- Advanced / optional (persisted runs, signing, local UI, plan/git checks):
107
- --write-run-bundle <dir> After a successful verify (schema-valid WorkflowResult), write a canonical run directory: events.ndjson (byte copy of --events), workflow-result.json (emitted result), agent-run.json (SHA-256 manifest). Directory is created if missing. Requires exit 0–2 (operational failure skips the write).
108
- --sign-ed25519-private-key <path> With --write-run-bundle only: PKCS#8 PEM Ed25519 private key; also writes workflow-result.sig.json and manifest schemaVersion 2.
109
-
110
- verify-bundle-signature --run-dir <dir> --public-key <path>
111
- Verify signed bundle (Ed25519 + manifest v2). Exit 0 if valid; exit 3 with JSON envelope on failure.
112
-
113
- agentskeptic debug --corpus <dir> [--port <n>]
114
- Local Debug Console on 127.0.0.1 (see docs/agentskeptic.md — Debug Console).
115
-
116
- agentskeptic plan-transition --repo <dir> --before <ref> --after <ref> --plan <path>
117
- Validate git Before..After against machine plan rules (planValidation, body YAML section, or derived path citations as required diff surfaces; Git >= 2.30.0; see docs).
118
-
56
+ return `Usage:
57
+ agentskeptic quick --input <path> (--postgres-url <url> | --db <sqlitePath>) --export-registry <path> [--emit-events <path>] [--workflow-id <id>]
58
+ (zero-config path; structured tool activity + read-only SQL; see docs/quick-verify-normative.md)
59
+
60
+ agentskeptic --workflow-id <id> --events <path> --registry <path> --db <sqlitePath>
61
+ agentskeptic --workflow-id <id> --events <path> --registry <path> --postgres-url <url>
62
+
63
+ Optional CI lock (commercial build; same as enforce batch): append exactly one of
64
+ --output-lock <path> or --expect-lock <path> (requires active subscription; see docs/ci-enforcement.md).
65
+
66
+ Optional consistency (default strong):
67
+ --consistency strong|eventual
68
+ With eventual, required:
69
+ --verification-window-ms <int>
70
+ --poll-interval-ms <int> (must be >= 1 and <= window)
71
+
72
+ With strong, do not pass --verification-window-ms or --poll-interval-ms.
73
+
74
+ Provide exactly one of --db or --postgres-url.
75
+
76
+ Optional output:
77
+ --no-truth-report For verdict exits 0–2, do not print the human truth report to stderr (stderr empty). stdout WorkflowResult JSON is unchanged. Exit 3 stderr is unchanged (single-line JSON envelope).
78
+ --share-report-origin <https://host> After successful verification, POST a shareable report to that origin (https only, origin with no path), then print human report + footer to stderr and WorkflowResult JSON to stdout. On POST failure: exit 3, stdout empty, stderr single-line JSON envelope (code SHARE_REPORT_FAILED). See docs/shareable-verification-reports.md.
79
+
80
+ Exit codes:
81
+ 0 workflow status complete
82
+ 1 workflow status inconsistent
83
+ 2 workflow status incomplete
84
+ 3 operational failure (see stderr JSON)
85
+ 4 CI lock mismatch with --expect-lock (stdout: WorkflowResult line; stderr: envelope after human report if any)
86
+
87
+ agentskeptic compare --prior <path> [--prior <path> ...] --current <path>
88
+ Compare saved WorkflowResult JSON files (local only; see docs).
89
+
90
+ agentskeptic validate-registry --registry <path>
91
+ agentskeptic validate-registry --registry <path> --events <path> --workflow-id <id>
92
+ Validate tools registry JSON (and optionally resolution vs events) without a database.
93
+ See docs/agentskeptic.md (Registry validation).
94
+
95
+ agentskeptic execution-trace --workflow-id <id> --events <path> [--workflow-result <path>] [--format json|text]
96
+ Emit ExecutionTraceView JSON or text (see docs/agentskeptic.md).
97
+
98
+ agentskeptic enforce batch (--expect-lock <path> | --output-lock <path>) <same flags as batch verify>
99
+ agentskeptic enforce quick (--expect-lock <path> | --output-lock <path>) <same flags as quick>
100
+ CI enforcement with pinned ci-lock-v1 (see docs/ci-enforcement.md).
101
+
102
+ agentskeptic assurance run --manifest <path> [--write-report <path>]
103
+ agentskeptic assurance stale --report <path> --max-age-hours <n>
104
+ Multi-scenario assurance sweep and staleness gate (see docs/agentskeptic.md).
105
+
106
+ Advanced / optional (persisted runs, signing, local UI, plan/git checks):
107
+ --write-run-bundle <dir> After a successful verify (schema-valid WorkflowResult), write a canonical run directory: events.ndjson (byte copy of --events), workflow-result.json (emitted result), agent-run.json (SHA-256 manifest). Directory is created if missing. Requires exit 0–2 (operational failure skips the write).
108
+ --sign-ed25519-private-key <path> With --write-run-bundle only: PKCS#8 PEM Ed25519 private key; also writes workflow-result.sig.json and manifest schemaVersion 2.
109
+
110
+ verify-bundle-signature --run-dir <dir> --public-key <path>
111
+ Verify signed bundle (Ed25519 + manifest v2). Exit 0 if valid; exit 3 with JSON envelope on failure.
112
+
113
+ agentskeptic debug --corpus <dir> [--port <n>]
114
+ Local Debug Console on 127.0.0.1 (see docs/agentskeptic.md — Debug Console).
115
+
116
+ agentskeptic plan-transition --repo <dir> --before <ref> --after <ref> --plan <path>
117
+ Validate git Before..After against machine plan rules (planValidation, body YAML section, or derived path citations as required diff surfaces; Git >= 2.30.0; see docs).
118
+
119
119
  --help, -h print this message and exit 0`;
120
120
  }
121
121
  function usageExecutionTrace() {
122
- return `Usage:
123
- agentskeptic execution-trace --workflow-id <id> --events <path> [--workflow-result <path>] [--format json|text]
124
-
125
- Exit codes:
126
- 0 success (stdout: ExecutionTraceView JSON or text; stderr empty)
127
- 3 operational failure (stderr: JSON envelope only; stdout empty)
128
-
122
+ return `Usage:
123
+ agentskeptic execution-trace --workflow-id <id> --events <path> [--workflow-result <path>] [--format json|text]
124
+
125
+ Exit codes:
126
+ 0 success (stdout: ExecutionTraceView JSON or text; stderr empty)
127
+ 3 operational failure (stderr: JSON envelope only; stdout empty)
128
+
129
129
  --help, -h print this message and exit 0`;
130
130
  }
131
131
  function assertExecutionTraceArgsWellFormed(args) {
@@ -261,41 +261,41 @@ function runExecutionTraceSubcommand(args) {
261
261
  process.exit(0);
262
262
  }
263
263
  function usageCompare() {
264
- return `Usage:
265
- agentskeptic compare --prior <workflowResult.json> [--prior <path> ...] --current <workflowResult.json>
266
-
267
- Compares the current run (last file) against the immediate prior run (last --prior).
268
- Recurrence uses all runs in order: each --prior in order, then --current.
269
-
270
- Exit codes:
271
- 0 comparison succeeded (stdout: RunComparisonReport JSON; stderr: human summary)
272
- 3 operational failure (stderr: JSON envelope only; stdout empty)
273
-
264
+ return `Usage:
265
+ agentskeptic compare --prior <workflowResult.json> [--prior <path> ...] --current <workflowResult.json>
266
+
267
+ Compares the current run (last file) against the immediate prior run (last --prior).
268
+ Recurrence uses all runs in order: each --prior in order, then --current.
269
+
270
+ Exit codes:
271
+ 0 comparison succeeded (stdout: RunComparisonReport JSON; stderr: human summary)
272
+ 3 operational failure (stderr: JSON envelope only; stdout empty)
273
+
274
274
  --help, -h print this message and exit 0`;
275
275
  }
276
276
  function writeCliError(code, message) {
277
277
  console.error(cliErrorEnvelope(code, message));
278
278
  }
279
279
  function usageAssurance() {
280
- return `Usage:
281
- agentskeptic assurance run --manifest <path> [--write-report <path>]
282
- agentskeptic assurance stale --report <path> --max-age-hours <n>
283
-
284
- assurance run executes each manifest scenario by spawning this CLI (schemas/assurance-manifest-v1.schema.json).
285
- Path arguments in each scenario argv are resolved relative to the manifest file's directory unless absolute.
286
-
287
- assurance stale exits 1 when the report issuedAt is older than max-age-hours (UTC wall clock).
288
-
289
- Exit codes (run):
290
- 0 all scenarios exited 0
291
- 1 at least one scenario non-zero
292
- 3 operational failure (stderr: JSON envelope)
293
-
294
- Exit codes (stale):
295
- 0 report fresh
296
- 1 report stale
297
- 3 missing/invalid report (stderr: JSON envelope)
298
-
280
+ return `Usage:
281
+ agentskeptic assurance run --manifest <path> [--write-report <path>]
282
+ agentskeptic assurance stale --report <path> --max-age-hours <n>
283
+
284
+ assurance run executes each manifest scenario by spawning this CLI (schemas/assurance-manifest-v1.schema.json).
285
+ Path arguments in each scenario argv are resolved relative to the manifest file's directory unless absolute.
286
+
287
+ assurance stale exits 1 when the report issuedAt is older than max-age-hours (UTC wall clock).
288
+
289
+ Exit codes (run):
290
+ 0 all scenarios exited 0
291
+ 1 at least one scenario non-zero
292
+ 3 operational failure (stderr: JSON envelope)
293
+
294
+ Exit codes (stale):
295
+ 0 report fresh
296
+ 1 report stale
297
+ 3 missing/invalid report (stderr: JSON envelope)
298
+
299
299
  --help, -h print this message and exit 0`;
300
300
  }
301
301
  function runAssuranceSubcommand(args) {
@@ -512,13 +512,13 @@ async function runQuickSubcommand(args) {
512
512
  }
513
513
  function runVerifyBundleSignatureSubcommand(args) {
514
514
  if (args.includes("--help") || args.includes("-h")) {
515
- console.log(`Usage:
516
- agentskeptic verify-bundle-signature --run-dir <dir> --public-key <path>
517
-
518
- Exit codes:
519
- 0 signature and manifest integrity OK
520
- 3 verification failed (stderr: JSON envelope; code is BUNDLE_SIGNATURE_*)
521
-
515
+ console.log(`Usage:
516
+ agentskeptic verify-bundle-signature --run-dir <dir> --public-key <path>
517
+
518
+ Exit codes:
519
+ 0 signature and manifest integrity OK
520
+ 3 verification failed (stderr: JSON envelope; code is BUNDLE_SIGNATURE_*)
521
+
522
522
  --help, -h print this message and exit 0`);
523
523
  process.exit(0);
524
524
  }
@@ -536,17 +536,17 @@ Exit codes:
536
536
  process.exit(3);
537
537
  }
538
538
  function usageValidateRegistry() {
539
- return `Usage:
540
- agentskeptic validate-registry --registry <path>
541
- agentskeptic validate-registry --registry <path> --events <path> --workflow-id <id>
542
-
543
- Exit codes:
544
- 0 registry valid (stdout: RegistryValidationResult JSON; stderr empty)
545
- 1 validation failed (stdout: RegistryValidationResult JSON; stderr human report)
546
- 3 operational failure (stderr JSON envelope only; stdout empty)
547
-
548
- Options: --registry (required), --events and --workflow-id (both or neither).
549
-
539
+ return `Usage:
540
+ agentskeptic validate-registry --registry <path>
541
+ agentskeptic validate-registry --registry <path> --events <path> --workflow-id <id>
542
+
543
+ Exit codes:
544
+ 0 registry valid (stdout: RegistryValidationResult JSON; stderr empty)
545
+ 1 validation failed (stdout: RegistryValidationResult JSON; stderr human report)
546
+ 3 operational failure (stderr JSON envelope only; stdout empty)
547
+
548
+ Options: --registry (required), --events and --workflow-id (both or neither).
549
+
550
550
  --help, -h print this message and exit 0`;
551
551
  }
552
552
  function assertValidateRegistryArgsWellFormed(args) {
@@ -701,14 +701,14 @@ function runCompareSubcommand(args) {
701
701
  process.exit(0);
702
702
  }
703
703
  function usageDebug() {
704
- return `Usage:
705
- agentskeptic debug --corpus <dir> [--port <n>]
706
-
707
- Serves the Debug Console on 127.0.0.1 only. Each run is a subfolder of the corpus
708
- with workflow-result.json and events.ndjson (see docs/agentskeptic.md).
709
-
710
- Exit: Ctrl+C ends the server (exit 0). Port in use or bad corpus → exit 3.
711
-
704
+ return `Usage:
705
+ agentskeptic debug --corpus <dir> [--port <n>]
706
+
707
+ Serves the Debug Console on 127.0.0.1 only. Each run is a subfolder of the corpus
708
+ with workflow-result.json and events.ndjson (see docs/agentskeptic.md).
709
+
710
+ Exit: Ctrl+C ends the server (exit 0). Port in use or bad corpus → exit 3.
711
+
712
712
  --help, -h print this message and exit 0`;
713
713
  }
714
714
  async function runDebugSubcommand(args) {
@@ -762,23 +762,23 @@ async function runDebugSubcommand(args) {
762
762
  process.on("SIGTERM", onSig);
763
763
  }
764
764
  function usagePlanTransition() {
765
- return `Usage:
766
- agentskeptic plan-transition --repo <dir> --before <ref> --after <ref> --plan <path>
767
-
768
- Optional:
769
- --workflow-id <id> (default ${PLAN_TRANSITION_WORKFLOW_ID})
770
- --no-truth-report
771
- --write-run-bundle <dir>
772
- --sign-ed25519-private-key <path> (requires --write-run-bundle)
773
-
774
- Requires Git >= 2.30.0. Plan file must start with YAML front matter; rules from front matter planValidation, or from a body section "Repository transition validation", or derived from path citations as required diff surfaces when neither is present (see docs).
775
-
776
- Exit codes:
777
- 0 workflow status complete
778
- 1 workflow status inconsistent
779
- 2 workflow status incomplete
780
- 3 operational failure (see stderr JSON)
781
-
765
+ return `Usage:
766
+ agentskeptic plan-transition --repo <dir> --before <ref> --after <ref> --plan <path>
767
+
768
+ Optional:
769
+ --workflow-id <id> (default ${PLAN_TRANSITION_WORKFLOW_ID})
770
+ --no-truth-report
771
+ --write-run-bundle <dir>
772
+ --sign-ed25519-private-key <path> (requires --write-run-bundle)
773
+
774
+ Requires Git >= 2.30.0. Plan file must start with YAML front matter; rules from front matter planValidation, or from a body section "Repository transition validation", or derived from path citations as required diff surfaces when neither is present (see docs).
775
+
776
+ Exit codes:
777
+ 0 workflow status complete
778
+ 1 workflow status inconsistent
779
+ 2 workflow status incomplete
780
+ 3 operational failure (see stderr JSON)
781
+
782
782
  --help, -h print this message and exit 0`;
783
783
  }
784
784
  function runPlanTransitionSubcommand(args) {