sneakoscope 1.14.0 → 1.15.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.
Files changed (103) hide show
  1. package/README.md +9 -6
  2. package/crates/sks-core/Cargo.lock +1 -1
  3. package/crates/sks-core/Cargo.toml +1 -1
  4. package/crates/sks-core/src/main.rs +1 -1
  5. package/dist/.sks-build-stamp.json +8 -0
  6. package/dist/bin/sks.js +1 -1
  7. package/dist/build-manifest.json +23 -1
  8. package/dist/cli/feature-commands.js +37 -2
  9. package/dist/commands/image-ux-review.d.ts +61 -3
  10. package/dist/commands/wiki.d.ts +1 -1
  11. package/dist/core/codex-exec-output-schema.d.ts +29 -0
  12. package/dist/core/codex-exec-output-schema.js +81 -0
  13. package/dist/core/codex-hooks/codex-hook-official-hash-oracle.d.ts +19 -0
  14. package/dist/core/codex-hooks/codex-hook-official-hash-oracle.js +96 -0
  15. package/dist/core/codex-hooks/codex-hook-official-parity.d.ts +80 -0
  16. package/dist/core/codex-hooks/codex-hook-official-parity.js +37 -5
  17. package/dist/core/commands/image-ux-review-command.d.ts +61 -3
  18. package/dist/core/commands/image-ux-review-command.js +21 -9
  19. package/dist/core/commands/mad-sks-command.js +253 -1
  20. package/dist/core/commands/scouts-command.js +177 -19
  21. package/dist/core/commands/wiki-command.d.ts +2 -2
  22. package/dist/core/evidence/flagship-proof-graph-validator.d.ts +25 -0
  23. package/dist/core/evidence/flagship-proof-graph-validator.js +286 -0
  24. package/dist/core/feature-fixture-runner.d.ts +3 -0
  25. package/dist/core/feature-fixture-runner.js +12 -2
  26. package/dist/core/feature-fixtures.js +1 -1
  27. package/dist/core/feature-registry.js +6 -1
  28. package/dist/core/fsx.d.ts +1 -1
  29. package/dist/core/fsx.js +1 -1
  30. package/dist/core/hooks-runtime.js +25 -0
  31. package/dist/core/image-ux-review/imagegen-adapter.js +28 -32
  32. package/dist/core/image-ux-review.d.ts +67 -5
  33. package/dist/core/image-ux-review.js +327 -37
  34. package/dist/core/imagegen/imagegen-capability.js +82 -6
  35. package/dist/core/init.js +1 -1
  36. package/dist/core/mad-sks/audit-ledger.d.ts +55 -0
  37. package/dist/core/mad-sks/audit-ledger.js +46 -0
  38. package/dist/core/mad-sks/authorization-manifest.d.ts +28 -0
  39. package/dist/core/mad-sks/authorization-manifest.js +58 -0
  40. package/dist/core/mad-sks/immutable-harness-guard.d.ts +142 -0
  41. package/dist/core/mad-sks/immutable-harness-guard.js +195 -0
  42. package/dist/core/mad-sks/permission-model.d.ts +54 -0
  43. package/dist/core/mad-sks/permission-model.js +167 -0
  44. package/dist/core/mad-sks/proof-evidence.d.ts +40 -0
  45. package/dist/core/mad-sks/proof-evidence.js +38 -0
  46. package/dist/core/mad-sks/rollback-plan.d.ts +39 -0
  47. package/dist/core/mad-sks/rollback-plan.js +26 -0
  48. package/dist/core/mad-sks/write-guard.d.ts +71 -0
  49. package/dist/core/mad-sks/write-guard.js +88 -0
  50. package/dist/core/permission-gates.js +18 -1
  51. package/dist/core/pipeline-internals/runtime-gates.js +49 -14
  52. package/dist/core/ppt-review/index.js +2 -0
  53. package/dist/core/ppt-review/slide-exporter.js +2 -2
  54. package/dist/core/proof/auto-finalize.d.ts +1 -1
  55. package/dist/core/proof/auto-finalize.js +14 -3
  56. package/dist/core/proof/evidence-collector.d.ts +4 -1
  57. package/dist/core/proof/route-adapter.d.ts +50 -0
  58. package/dist/core/proof/route-finalizer.d.ts +51 -1
  59. package/dist/core/proof/route-finalizer.js +10 -4
  60. package/dist/core/proof/route-proof-gate.js +2 -1
  61. package/dist/core/proof/selftest-proof-fixtures.d.ts +50 -0
  62. package/dist/core/routes.d.ts +1 -1
  63. package/dist/core/routes.js +2 -2
  64. package/dist/core/scouts/engines/codex-app-subagent-engine.d.ts +11 -2
  65. package/dist/core/scouts/engines/codex-app-subagent-engine.js +21 -7
  66. package/dist/core/scouts/engines/codex-exec-parallel-engine.d.ts +23 -1
  67. package/dist/core/scouts/engines/codex-exec-parallel-engine.js +54 -7
  68. package/dist/core/scouts/engines/scout-engine-base.d.ts +15 -2
  69. package/dist/core/scouts/engines/scout-engine-base.js +51 -7
  70. package/dist/core/scouts/engines/scout-engine-detect.js +20 -0
  71. package/dist/core/scouts/engines/scout-engine-policy.d.ts +2 -1
  72. package/dist/core/scouts/engines/scout-engine-policy.js +7 -3
  73. package/dist/core/scouts/engines/tmux-lane-engine.d.ts +4 -1
  74. package/dist/core/scouts/engines/tmux-lane-engine.js +30 -7
  75. package/dist/core/scouts/scout-consensus.d.ts +6 -2
  76. package/dist/core/scouts/scout-consensus.js +39 -14
  77. package/dist/core/scouts/scout-gate.d.ts +1 -0
  78. package/dist/core/scouts/scout-gate.js +25 -5
  79. package/dist/core/scouts/scout-output-parser.d.ts +2 -2
  80. package/dist/core/scouts/scout-output-parser.js +77 -8
  81. package/dist/core/scouts/scout-proof-evidence.d.ts +11 -0
  82. package/dist/core/scouts/scout-proof-evidence.js +25 -0
  83. package/dist/core/scouts/scout-readonly-guard.d.ts +41 -0
  84. package/dist/core/scouts/scout-readonly-guard.js +93 -3
  85. package/dist/core/scouts/scout-runner.d.ts +49 -5
  86. package/dist/core/scouts/scout-runner.js +213 -57
  87. package/dist/core/scouts/scout-schema.d.ts +4 -2
  88. package/dist/core/scouts/scout-schema.js +8 -2
  89. package/dist/core/triwiki-wrongness/wrongness-cli.d.ts +2 -2
  90. package/dist/core/triwiki-wrongness/wrongness-proof-linker.d.ts +7 -2
  91. package/dist/core/triwiki-wrongness/wrongness-proof-linker.js +14 -8
  92. package/dist/core/triwiki-wrongness/wrongness-retrieval.d.ts +1 -1
  93. package/dist/core/triwiki-wrongness/wrongness-schema.d.ts +1 -1
  94. package/dist/core/triwiki-wrongness/wrongness-schema.js +8 -0
  95. package/dist/core/triwiki-wrongness/wrongness-trust-policy.js +9 -2
  96. package/dist/core/trust-kernel/completion-contract.js +9 -1
  97. package/dist/core/trust-kernel/trust-report.d.ts +100 -0
  98. package/dist/core/trust-kernel/trust-report.js +40 -3
  99. package/dist/core/version.d.ts +1 -1
  100. package/dist/core/version.js +1 -1
  101. package/dist/vendor/openai-codex/latest/hooks/snapshot-metadata.json +1 -1
  102. package/package.json +33 -8
  103. package/schemas/codex/scout-result.schema.json +163 -6
package/README.md CHANGED
@@ -10,15 +10,15 @@ SKS does not try to clone every other harness. It focuses on one thing: making C
10
10
 
11
11
  ## Current Release
12
12
 
13
- SKS **1.14.0** focuses on Codex hook trust parity and real imagegen route hardening: hooks now prefer managed installs when official hashes are unavailable, `trust-doctor --actual` reports real config state, and UX/PPT image routes validate gpt-image-2 requests before generation while fake blackbox checks stay explicitly mock-like.
13
+ SKS **1.15.0** promotes MAD-SKS into explicit user-authorized full-system authority while keeping the SKS harness itself immutable. It also closes the 1.14.1 freshness gaps: release gates check for stale `dist`, Codex exec output-schema syntax is verified for both fresh `exec` and `exec resume`, Scout engine-run lookup covers status/consensus/handoff/validate plus opt-in real smoke, and flagship proof graph v3 binds MAD-SKS audit, rollback, immutable guard, Hook, UX/PPT, DFix, and Scout evidence.
14
14
 
15
15
  ```bash
16
+ sks mad-sks plan --target-root <path> --json
17
+ sks mad-sks permissions --json
18
+ sks mad-sks proof --json
16
19
  sks features complete --json
17
- sks ux-review run --image <path> --generate-callouts --json
18
- sks ppt fixture --mock --json
19
- sks dfix fixture --json
20
- sks hooks trust-doctor --actual --json
21
- sks hooks install --managed --json
20
+ sks scouts status latest --engine-runs --json
21
+ npm run release:readiness
22
22
  ```
23
23
 
24
24
  Detailed release history lives in [CHANGELOG.md](CHANGELOG.md). Current release gate status lives in [docs/release-readiness.md](docs/release-readiness.md).
@@ -38,6 +38,9 @@ Detailed release history lives in [CHANGELOG.md](CHANGELOG.md). Current release
38
38
  - Package boundary: [docs/package-boundary.md](docs/package-boundary.md)
39
39
  - Black-box package tests: [docs/black-box-package-tests.md](docs/black-box-package-tests.md)
40
40
  - Codex CLI compatibility: [docs/codex-cli-compat.md](docs/codex-cli-compat.md)
41
+ - MAD-SKS: [docs/mad-sks.md](docs/mad-sks.md)
42
+ - Permission kernel: [docs/permission-kernel.md](docs/permission-kernel.md)
43
+ - Immutable harness guard: [docs/immutable-harness-guard.md](docs/immutable-harness-guard.md)
41
44
  - Codex App: [docs/codex-app.md](docs/codex-app.md)
42
45
  - Core dominance: [docs/core-dominance.md](docs/core-dominance.md)
43
46
  - Performance budgets: [docs/performance-budgets.md](docs/performance-budgets.md)
@@ -76,7 +76,7 @@ dependencies = [
76
76
 
77
77
  [[package]]
78
78
  name = "sks-core"
79
- version = "1.14.0"
79
+ version = "1.15.0"
80
80
  dependencies = [
81
81
  "serde_json",
82
82
  ]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "sks-core"
3
- version = "1.14.0"
3
+ version = "1.15.0"
4
4
  edition = "2021"
5
5
 
6
6
  [dependencies]
@@ -4,7 +4,7 @@ use std::io::{self, Read, Seek, SeekFrom};
4
4
  fn main() {
5
5
  let mut args = std::env::args().skip(1);
6
6
  match args.next().as_deref() {
7
- Some("--version") => println!("sks-rs 1.14.0"),
7
+ Some("--version") => println!("sks-rs 1.15.0"),
8
8
  Some("compact-info") => {
9
9
  let mut input = String::new();
10
10
  let _ = io::stdin().read_to_string(&mut input);
@@ -0,0 +1,8 @@
1
+ {
2
+ "schema": "sks.dist-build-stamp.v1",
3
+ "package_name": "sneakoscope",
4
+ "package_version": "1.15.0",
5
+ "source_digest": "0edaa5eb690818f453a1c1fdc205d0edda1766ad38fdf0ce69ecbc472e6bd23e",
6
+ "source_file_count": 1428,
7
+ "built_at_source_time": 1779511366988
8
+ }
package/dist/bin/sks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const FAST_PACKAGE_VERSION = '1.14.0';
2
+ const FAST_PACKAGE_VERSION = '1.15.0';
3
3
  const args = process.argv.slice(2);
4
4
  try {
5
5
  if (args[0] === '--version' || args[0] === '-v' || args[0] === 'version') {
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "schema": "sks.dist-build.v2",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
+ "package_version": "1.15.0",
4
5
  "typescript": true,
5
6
  "mjs_runtime_files": 0,
7
+ "source_digest": "0edaa5eb690818f453a1c1fdc205d0edda1766ad38fdf0ce69ecbc472e6bd23e",
8
+ "source_file_count": 1428,
9
+ "dist_stamp_schema": "sks.dist-build-stamp.v1",
6
10
  "files": [
7
11
  "bin/sks.d.ts",
8
12
  "bin/sks.js",
@@ -226,6 +230,8 @@
226
230
  "core/codex-hooks/codex-hook-hash.js",
227
231
  "core/codex-hooks/codex-hook-managed-install.d.ts",
228
232
  "core/codex-hooks/codex-hook-managed-install.js",
233
+ "core/codex-hooks/codex-hook-official-hash-oracle.d.ts",
234
+ "core/codex-hooks/codex-hook-official-hash-oracle.js",
229
235
  "core/codex-hooks/codex-hook-official-parity.d.ts",
230
236
  "core/codex-hooks/codex-hook-official-parity.js",
231
237
  "core/codex-hooks/codex-hook-state-writer.d.ts",
@@ -370,6 +376,8 @@
370
376
  "core/evidence/evidence-schema.js",
371
377
  "core/evidence/evidence-store.d.ts",
372
378
  "core/evidence/evidence-store.js",
379
+ "core/evidence/flagship-proof-graph-validator.d.ts",
380
+ "core/evidence/flagship-proof-graph-validator.js",
373
381
  "core/feature-fixture-runner.d.ts",
374
382
  "core/feature-fixture-runner.js",
375
383
  "core/feature-fixtures.d.ts",
@@ -452,6 +460,20 @@
452
460
  "core/language-preference.js",
453
461
  "core/loop-blocker.d.ts",
454
462
  "core/loop-blocker.js",
463
+ "core/mad-sks/audit-ledger.d.ts",
464
+ "core/mad-sks/audit-ledger.js",
465
+ "core/mad-sks/authorization-manifest.d.ts",
466
+ "core/mad-sks/authorization-manifest.js",
467
+ "core/mad-sks/immutable-harness-guard.d.ts",
468
+ "core/mad-sks/immutable-harness-guard.js",
469
+ "core/mad-sks/permission-model.d.ts",
470
+ "core/mad-sks/permission-model.js",
471
+ "core/mad-sks/proof-evidence.d.ts",
472
+ "core/mad-sks/proof-evidence.js",
473
+ "core/mad-sks/rollback-plan.d.ts",
474
+ "core/mad-sks/rollback-plan.js",
475
+ "core/mad-sks/write-guard.d.ts",
476
+ "core/mad-sks/write-guard.js",
455
477
  "core/managed-paths.d.ts",
456
478
  "core/managed-paths.js",
457
479
  "core/memory-governor.d.ts",
@@ -151,6 +151,41 @@ export async function hooksCommand(sub = 'explain', args = []) {
151
151
  process.exitCode = 1;
152
152
  return;
153
153
  }
154
+ if (action === 'repair') {
155
+ if (flag(args, '--trusted')) {
156
+ const parity = await writeCodexHookOfficialParityReport(root);
157
+ if (!parity.official_hash_available) {
158
+ const blocked = {
159
+ schema: 'sks.codex-hooks-repair.v1',
160
+ ok: false,
161
+ mode: 'trusted',
162
+ status: 'blocked',
163
+ blocker: 'official_hash_oracle_unavailable',
164
+ next_command: 'sks hooks repair --managed --json',
165
+ parity
166
+ };
167
+ if (flag(args, '--json'))
168
+ return console.log(JSON.stringify(blocked, null, 2));
169
+ console.log('Hooks trusted repair blocked: official hash oracle unavailable. Run `sks hooks repair --managed --json`.');
170
+ process.exitCode = 1;
171
+ return;
172
+ }
173
+ }
174
+ const report = await installManagedCodexHooks(root);
175
+ const result = {
176
+ ...report,
177
+ schema: 'sks.codex-hooks-repair.v1',
178
+ mode: 'managed',
179
+ next_command: 'sks hooks trust-doctor --actual --json',
180
+ actions: ['requirements_toml_managed_install_default']
181
+ };
182
+ if (flag(args, '--json'))
183
+ return console.log(JSON.stringify(result, null, 2));
184
+ console.log(`Hooks managed repair: ${report.ok ? 'ok' : 'blocked'}`);
185
+ if (!report.ok)
186
+ process.exitCode = 1;
187
+ return;
188
+ }
154
189
  if (action === 'install') {
155
190
  const report = flag(args, '--managed')
156
191
  ? await installManagedCodexHooks(root)
@@ -162,7 +197,7 @@ export async function hooksCommand(sub = 'explain', args = []) {
162
197
  process.exitCode = 1;
163
198
  return;
164
199
  }
165
- if (action === 'actual-parity' || action === 'official-parity') {
200
+ if (action === 'actual-parity' || action === 'official-parity' || (action === 'parity' && flag(args, '--official'))) {
166
201
  const report = await writeCodexHookOfficialParityReport(root);
167
202
  if (flag(args, '--json'))
168
203
  return console.log(JSON.stringify(report, null, 2));
@@ -220,7 +255,7 @@ export async function hooksCommand(sub = 'explain', args = []) {
220
255
  return;
221
256
  }
222
257
  if (action !== 'explain') {
223
- console.error('Usage: sks hooks explain|status|doctor|trust-report|trust-state|trust-doctor|trust-fix|install|actual-parity|official-parity|replay <fixture.json>|codex-schema|codex-validate|warning-check|replay-codex-fixtures [--json]');
258
+ console.error('Usage: sks hooks explain|status|doctor|trust-report|trust-state|trust-doctor|trust-fix|install|repair|actual-parity|official-parity|parity --official|replay <fixture.json>|codex-schema|codex-validate|warning-check|replay-codex-fixtures [--json]');
224
259
  process.exitCode = 1;
225
260
  return;
226
261
  }
@@ -49,7 +49,8 @@ export declare function run(command: any, args?: any): Promise<void | {
49
49
  privacy: string;
50
50
  };
51
51
  image_generation_review: {
52
- required_for_gate: boolean;
52
+ required_for_gate: string;
53
+ missing_generated_image_closeout: string;
53
54
  model: string;
54
55
  preferred_surface: string;
55
56
  codex_app_imagegen_doc: string;
@@ -122,12 +123,17 @@ export declare function run(command: any, args?: any): Promise<void | {
122
123
  gpt_image_2_model_doc: string;
123
124
  };
124
125
  required: boolean;
126
+ required_for_full_verification: boolean;
127
+ reference_closeout_allowed_when_unavailable: boolean;
125
128
  generated_review_images: any;
126
129
  planned_reviews: any;
127
130
  generated_count: any;
128
131
  real_generated_count: any;
129
132
  required_count: any;
130
133
  text_only_count: any;
134
+ generated_image_file_evidence_checked: boolean;
135
+ evidence_verified: boolean;
136
+ reference_closeout_eligible: boolean;
131
137
  blockers: string[];
132
138
  passed: boolean;
133
139
  imagegen_blocker: {
@@ -260,6 +266,7 @@ export declare function run(command: any, args?: any): Promise<void | {
260
266
  }[];
261
267
  stopped: boolean;
262
268
  stop_reason: string;
269
+ reference_only: boolean;
263
270
  passed: boolean;
264
271
  };
265
272
  output_schema: import("../core/codex-exec-output-schema.js").CodexExecResumeOutputSchemaAvailability | {
@@ -267,8 +274,24 @@ export declare function run(command: any, args?: any): Promise<void | {
267
274
  status: string;
268
275
  warnings: any[];
269
276
  };
277
+ honest_mode_evidence: {
278
+ schema: string;
279
+ ok: boolean;
280
+ artifact: string;
281
+ validation: {
282
+ schema: any;
283
+ ok: boolean;
284
+ errors: any;
285
+ warnings: any;
286
+ checked_at: string;
287
+ };
288
+ };
270
289
  gate: {
271
- passed: boolean;
290
+ passed: any;
291
+ status: string;
292
+ verified_level: string;
293
+ full_review_passed: boolean;
294
+ reference_only: any;
272
295
  schema: string;
273
296
  schema_version: number;
274
297
  created_at: string;
@@ -282,15 +305,26 @@ export declare function run(command: any, args?: any): Promise<void | {
282
305
  p0_p1_zero_after_fix: boolean;
283
306
  fix_loop_executed_or_not_needed: boolean;
284
307
  changed_screens_rechecked: boolean;
308
+ image_voxel_reference_anchor_created: boolean;
285
309
  image_voxel_relations_created: boolean;
286
310
  wrongness_checked: boolean;
287
311
  honest_mode_complete: boolean;
288
312
  required_artifacts: string[];
289
313
  blockers: any[];
314
+ full_verification_blockers: any[];
315
+ reference_closeout: {
316
+ eligible: any;
317
+ reason: string | null;
318
+ cap: string;
319
+ cannot_claim: string[];
320
+ };
321
+ source_reference_evidence: any;
322
+ honest_mode_evidence: any;
290
323
  verification_caps: {
291
324
  text_only_review: string;
292
325
  mock_fixture: string;
293
326
  codex_less_than_0_132_fallback: string;
327
+ missing_generated_image_reference_closeout: string;
294
328
  };
295
329
  notes: string[];
296
330
  };
@@ -397,7 +431,11 @@ export declare function run(command: any, args?: any): Promise<void | {
397
431
  contract_hash: any;
398
432
  };
399
433
  gate: {
400
- passed: boolean;
434
+ passed: any;
435
+ status: string;
436
+ verified_level: string;
437
+ full_review_passed: boolean;
438
+ reference_only: any;
401
439
  schema: string;
402
440
  schema_version: number;
403
441
  created_at: string;
@@ -411,15 +449,26 @@ export declare function run(command: any, args?: any): Promise<void | {
411
449
  p0_p1_zero_after_fix: boolean;
412
450
  fix_loop_executed_or_not_needed: boolean;
413
451
  changed_screens_rechecked: boolean;
452
+ image_voxel_reference_anchor_created: boolean;
414
453
  image_voxel_relations_created: boolean;
415
454
  wrongness_checked: boolean;
416
455
  honest_mode_complete: boolean;
417
456
  required_artifacts: string[];
418
457
  blockers: any[];
458
+ full_verification_blockers: any[];
459
+ reference_closeout: {
460
+ eligible: any;
461
+ reason: string | null;
462
+ cap: string;
463
+ cannot_claim: string[];
464
+ };
465
+ source_reference_evidence: any;
466
+ honest_mode_evidence: any;
419
467
  verification_caps: {
420
468
  text_only_review: string;
421
469
  mock_fixture: string;
422
470
  codex_less_than_0_132_fallback: string;
471
+ missing_generated_image_reference_closeout: string;
423
472
  };
424
473
  notes: string[];
425
474
  };
@@ -466,6 +515,15 @@ export declare function run(command: any, args?: any): Promise<void | {
466
515
  blockers: string[];
467
516
  passed: boolean;
468
517
  };
518
+ } | {
519
+ schema: string;
520
+ ok: boolean;
521
+ mission_id: any;
522
+ status: any;
523
+ verified_level: any;
524
+ reference_only: boolean;
525
+ blockers: any;
526
+ next_action: string;
469
527
  } | {
470
528
  schema: string;
471
529
  ok: boolean;
@@ -15,7 +15,7 @@ export declare function run(_command: any, args?: any): Promise<void | {
15
15
  };
16
16
  active_records: {
17
17
  id: string;
18
- kind: "callout_extraction_schema_failed" | "missing_evidence" | "incorrect_claim" | "overconfident_claim" | "stale_evidence" | "test_failure" | "route_misclassification" | "scout_error" | "visual_anchor_error" | "image_bbox_error" | "db_safety_false_positive" | "db_safety_false_negative" | "hook_policy_mismatch" | "hook_semantic_mismatch" | "hook_strict_subset_misclassified" | "codex_lb_health_misread" | "codex_lb_missing_env_raw_message" | "codex_lb_setup_choice_drift" | "codex_lb_env_persistence_failure" | "computer_use_policy_misclassification" | "computer_use_live_smoke_mismatch" | "computer_use_external_block_overclaimed" | "mock_real_confusion" | "user_intent_misread" | "artifact_schema_error" | "trust_status_overclaim" | "ux_review_text_only_fallback" | "ux_generated_image_not_real" | "ux_fake_generic_callout_detected" | "ux_callout_ocr_uncertain" | "gpt_image_2_callout_generation_failed" | "callout_bbox_out_of_bounds" | "ux_patch_applied_without_recheck" | "ux_after_recheck_regression" | "ux_image_fidelity_mismatch" | "ux_output_schema_unavailable_fallback" | "fix_loop_noop_patch" | "visual_fix_not_rechecked" | "post_fix_regression_detected" | "ppt_text_only_review_fallback" | "ppt_slide_export_failed" | "ppt_imagegen_callout_generation_failed" | "ppt_slide_callout_extraction_failed" | "ppt_slide_bbox_out_of_bounds" | "ppt_deck_patch_noop" | "ppt_fix_not_reexported" | "ppt_slide_not_rechecked" | "ppt_post_fix_regression_detected" | "dfix_diagnosis_missing" | "dfix_root_cause_missing" | "dfix_patch_plan_missing" | "dfix_verification_missing" | "dfix_noop_patch" | "repeated_blocker_stop";
18
+ kind: "callout_extraction_schema_failed" | "missing_evidence" | "incorrect_claim" | "overconfident_claim" | "stale_evidence" | "test_failure" | "route_misclassification" | "scout_error" | "visual_anchor_error" | "image_bbox_error" | "db_safety_false_positive" | "db_safety_false_negative" | "hook_policy_mismatch" | "hook_semantic_mismatch" | "hook_strict_subset_misclassified" | "codex_lb_health_misread" | "codex_lb_missing_env_raw_message" | "codex_lb_setup_choice_drift" | "codex_lb_env_persistence_failure" | "computer_use_policy_misclassification" | "computer_use_live_smoke_mismatch" | "computer_use_external_block_overclaimed" | "mock_real_confusion" | "user_intent_misread" | "artifact_schema_error" | "trust_status_overclaim" | "ux_review_text_only_fallback" | "ux_generated_image_not_real" | "ux_fake_generic_callout_detected" | "ux_callout_ocr_uncertain" | "gpt_image_2_callout_generation_failed" | "callout_bbox_out_of_bounds" | "ux_patch_applied_without_recheck" | "ux_after_recheck_regression" | "ux_image_fidelity_mismatch" | "ux_output_schema_unavailable_fallback" | "fix_loop_noop_patch" | "visual_fix_not_rechecked" | "post_fix_regression_detected" | "ppt_text_only_review_fallback" | "ppt_slide_export_failed" | "ppt_imagegen_callout_generation_failed" | "ppt_slide_callout_extraction_failed" | "ppt_slide_bbox_out_of_bounds" | "ppt_deck_patch_noop" | "ppt_fix_not_reexported" | "ppt_slide_not_rechecked" | "ppt_post_fix_regression_detected" | "dfix_diagnosis_missing" | "dfix_root_cause_missing" | "dfix_patch_plan_missing" | "dfix_verification_missing" | "dfix_noop_patch" | "mad_sks_protected_core_write_attempt" | "mad_sks_symlink_escape_attempt" | "mad_sks_unapproved_system_access" | "mad_sks_missing_rollback_plan" | "mad_sks_secret_leak_detected" | "mad_sks_unverified_system_change" | "mad_sks_db_write_without_snapshot" | "mad_sks_service_control_without_previous_state" | "repeated_blocker_stop";
19
19
  severity: "high" | "low" | "medium" | "critical";
20
20
  route: string | null;
21
21
  claim: string;
@@ -8,6 +8,26 @@ export interface CodexExecResumeOutputSchemaAvailability {
8
8
  output_last_message_supported: boolean;
9
9
  warnings: string[];
10
10
  }
11
+ export interface CodexExecOutputSchemaSyntaxAvailability {
12
+ schema: 'sks.codex-exec-output-schema-syntax.v1';
13
+ ok: boolean;
14
+ status: 'available' | 'integration_optional' | 'degraded_supported';
15
+ codex_bin: string | null;
16
+ version: string | null;
17
+ exec: {
18
+ output_schema_supported: boolean;
19
+ output_last_message_supported: boolean;
20
+ help_checked: boolean;
21
+ };
22
+ resume: {
23
+ output_schema_supported: boolean;
24
+ output_last_message_supported: boolean;
25
+ help_checked: boolean;
26
+ };
27
+ parity: boolean;
28
+ blockers: string[];
29
+ warnings: string[];
30
+ }
11
31
  export interface CodexResumeOutputSchemaCommandInput {
12
32
  sessionId: string;
13
33
  prompt?: string;
@@ -16,6 +36,14 @@ export interface CodexResumeOutputSchemaCommandInput {
16
36
  json?: boolean;
17
37
  extraArgs?: readonly string[];
18
38
  }
39
+ export interface CodexExecOutputSchemaCommandInput {
40
+ prompt: string;
41
+ outputSchemaPath: string;
42
+ outputFile?: string | null;
43
+ json?: boolean;
44
+ extraArgs?: readonly string[];
45
+ }
46
+ export declare function detectCodexExecOutputSchemaSyntax(opts?: any): Promise<CodexExecOutputSchemaSyntaxAvailability>;
19
47
  export interface CodexExecResumeOutputSchemaRunResult {
20
48
  schema: 'sks.codex-exec-output-schema-run.v1';
21
49
  ok: boolean;
@@ -35,6 +63,7 @@ export interface CodexExecResumeOutputSchemaRunResult {
35
63
  exit_code: number | null;
36
64
  }
37
65
  export declare function detectCodexExecResumeOutputSchema(opts?: any): Promise<CodexExecResumeOutputSchemaAvailability>;
66
+ export declare function buildCodexExecOutputSchemaArgs(input: CodexExecOutputSchemaCommandInput): Promise<string[]>;
38
67
  export declare function codexSchemaPath(name: string): Promise<string>;
39
68
  export declare function assertCodexSchemaFile(schemaPath: string): Promise<{
40
69
  ok: boolean;
@@ -3,6 +3,72 @@ import fsp from 'node:fs/promises';
3
3
  import { ensureDir, exists, packageRoot, readJson, runProcess, which } from './fsx.js';
4
4
  import { codexVersionPolicy, compareSemverLike, parseCodexVersionText } from './codex-compat/codex-version-policy.js';
5
5
  import { validateJsonSchemaRecursive } from './json-schema-validator.js';
6
+ export async function detectCodexExecOutputSchemaSyntax(opts = {}) {
7
+ const codexBin = opts.codexBin || await which('codex').catch(() => null);
8
+ if (!codexBin) {
9
+ return {
10
+ schema: 'sks.codex-exec-output-schema-syntax.v1',
11
+ ok: true,
12
+ status: 'integration_optional',
13
+ codex_bin: null,
14
+ version: null,
15
+ exec: { output_schema_supported: false, output_last_message_supported: false, help_checked: false },
16
+ resume: { output_schema_supported: false, output_last_message_supported: false, help_checked: false },
17
+ parity: false,
18
+ blockers: [],
19
+ warnings: ['codex binary not detected; output-schema syntax check is integration_optional']
20
+ };
21
+ }
22
+ const versionResult = opts.versionText
23
+ ? { code: 0, stdout: String(opts.versionText), stderr: '' }
24
+ : await runProcess(codexBin, ['--version'], { timeoutMs: opts.timeoutMs || 3000, maxOutputBytes: 16 * 1024 });
25
+ const execHelpResult = opts.execHelpText
26
+ ? { code: 0, stdout: String(opts.execHelpText), stderr: '' }
27
+ : await runProcess(codexBin, ['exec', '--help'], { timeoutMs: opts.timeoutMs || 5000, maxOutputBytes: 64 * 1024 });
28
+ const resumeHelpResult = opts.resumeHelpText
29
+ ? { code: 0, stdout: String(opts.resumeHelpText), stderr: '' }
30
+ : await runProcess(codexBin, ['exec', 'resume', '--help'], { timeoutMs: opts.timeoutMs || 5000, maxOutputBytes: 64 * 1024 });
31
+ const rawVersion = `${versionResult.stdout || ''}\n${versionResult.stderr || ''}`;
32
+ const version = parseCodexVersionText(rawVersion);
33
+ const execHelp = `${execHelpResult.stdout || ''}\n${execHelpResult.stderr || ''}`;
34
+ const resumeHelp = `${resumeHelpResult.stdout || ''}\n${resumeHelpResult.stderr || ''}`;
35
+ const execSupported = /--output-schema\b/.test(execHelp);
36
+ const resumeSupported = /--output-schema\b/.test(resumeHelp) || Boolean(version && compareSemverLike(version, '0.132.0') >= 0 && /--output-schema\b/.test(resumeHelp));
37
+ const execLastMessage = /--output-last-message\b|-o,/.test(execHelp);
38
+ const resumeLastMessage = /--output-last-message\b|-o,/.test(resumeHelp);
39
+ const policy = codexVersionPolicy({ available: Boolean(version), version, source: 'codex --version' });
40
+ const blockers = [
41
+ ...(execHelpResult.code === 0 ? [] : ['codex_exec_help_failed']),
42
+ ...(resumeHelpResult.code === 0 ? [] : ['codex_exec_resume_help_failed'])
43
+ ];
44
+ const status = policy.status === 'integration_optional'
45
+ ? 'integration_optional'
46
+ : execSupported || resumeSupported ? 'available' : 'degraded_supported';
47
+ return {
48
+ schema: 'sks.codex-exec-output-schema-syntax.v1',
49
+ ok: blockers.length === 0,
50
+ status,
51
+ codex_bin: codexBin,
52
+ version,
53
+ exec: {
54
+ output_schema_supported: execSupported,
55
+ output_last_message_supported: execLastMessage,
56
+ help_checked: execHelpResult.code === 0
57
+ },
58
+ resume: {
59
+ output_schema_supported: resumeSupported,
60
+ output_last_message_supported: resumeLastMessage,
61
+ help_checked: resumeHelpResult.code === 0
62
+ },
63
+ parity: execSupported === resumeSupported,
64
+ blockers,
65
+ warnings: [
66
+ ...policy.warnings,
67
+ ...(execSupported ? [] : ['codex exec --output-schema unavailable']),
68
+ ...(resumeSupported ? [] : ['codex exec resume --output-schema unavailable'])
69
+ ]
70
+ };
71
+ }
6
72
  export async function detectCodexExecResumeOutputSchema(opts = {}) {
7
73
  const codexBin = opts.codexBin || await which('codex').catch(() => null);
8
74
  if (!codexBin) {
@@ -47,6 +113,21 @@ export async function detectCodexExecResumeOutputSchema(opts = {}) {
47
113
  warnings
48
114
  };
49
115
  }
116
+ export async function buildCodexExecOutputSchemaArgs(input) {
117
+ const schemaPath = path.resolve(input.outputSchemaPath);
118
+ const schema = await assertCodexSchemaFile(schemaPath);
119
+ if (!schema.ok)
120
+ throw new Error(`Invalid output schema: ${schema.issues.join(', ')}`);
121
+ const args = ['exec'];
122
+ if (input.json !== false)
123
+ args.push('--json');
124
+ args.push('--output-schema', schemaPath);
125
+ if (input.outputFile)
126
+ args.push('--output-last-message', path.resolve(input.outputFile));
127
+ args.push(...Array.from(input.extraArgs || []));
128
+ args.push(String(input.prompt || ''));
129
+ return args;
130
+ }
50
131
  export async function codexSchemaPath(name) {
51
132
  const clean = String(name || '').replace(/[^A-Za-z0-9_.-]+/g, '');
52
133
  const file = clean.endsWith('.json') ? clean : `${clean}.schema.json`;
@@ -0,0 +1,19 @@
1
+ import { type CodexHookEventName } from '../codex-compat/codex-hook-events.js';
2
+ import { type CodexCommandHookIdentity } from './codex-hook-hash.js';
3
+ export declare const CODEX_HOOK_HASH_ORACLE_SCHEMA = "sks.codex-hook-hash-oracle.v1";
4
+ export type CodexHookHashOracleMode = 'cli' | 'rust-helper' | 'golden-fixture' | 'unavailable';
5
+ export interface CodexHookHashOracleResult {
6
+ schema: typeof CODEX_HOOK_HASH_ORACLE_SCHEMA;
7
+ ok: boolean;
8
+ mode: CodexHookHashOracleMode;
9
+ event_name: CodexHookEventName | null;
10
+ official_hash_available: boolean;
11
+ official_hash_proven: boolean;
12
+ official_hash: string | null;
13
+ sks_computed_hash: string | null;
14
+ source: string | null;
15
+ blocker: string | null;
16
+ generated_at: string;
17
+ }
18
+ export declare function resolveCodexHookHashOracle(root: string, identity: CodexCommandHookIdentity, opts?: any): Promise<CodexHookHashOracleResult>;
19
+ //# sourceMappingURL=codex-hook-official-hash-oracle.d.ts.map
@@ -0,0 +1,96 @@
1
+ import path from 'node:path';
2
+ import { exists, nowIso, readJson, runProcess, which } from '../fsx.js';
3
+ import {} from '../codex-compat/codex-hook-events.js';
4
+ import { codexCommandHookCurrentHash } from './codex-hook-hash.js';
5
+ export const CODEX_HOOK_HASH_ORACLE_SCHEMA = 'sks.codex-hook-hash-oracle.v1';
6
+ export async function resolveCodexHookHashOracle(root, identity, opts = {}) {
7
+ const sksHash = codexCommandHookCurrentHash(identity);
8
+ const cli = await readCliOracle(identity, opts).catch((err) => unavailable(identity, sksHash, `cli_oracle_failed:${errorMessage(err)}`));
9
+ if (cli.mode === 'cli' && cli.official_hash_available)
10
+ return cli;
11
+ const rust = await readRustOracle(root, identity, opts).catch((err) => unavailable(identity, sksHash, `rust_oracle_failed:${errorMessage(err)}`));
12
+ if (rust.mode === 'rust-helper' && rust.official_hash_available)
13
+ return rust;
14
+ const fixture = await readGoldenFixtureOracle(root, identity, opts).catch((err) => unavailable(identity, sksHash, `golden_fixture_failed:${errorMessage(err)}`));
15
+ if (fixture.mode === 'golden-fixture' && fixture.official_hash_available)
16
+ return fixture;
17
+ return unavailable(identity, sksHash, cli.blocker || rust.blocker || fixture.blocker || 'official_hash_oracle_unavailable');
18
+ }
19
+ async function readCliOracle(identity, opts = {}) {
20
+ const codexBin = opts.codexBin || await which('codex').catch(() => null);
21
+ const sksHash = codexCommandHookCurrentHash(identity);
22
+ if (!codexBin)
23
+ return unavailable(identity, sksHash, 'codex_binary_missing');
24
+ const run = await runProcess(codexBin, ['hooks', 'hash', '--json'], {
25
+ input: `${JSON.stringify(identity)}\n`,
26
+ timeoutMs: 5000,
27
+ maxOutputBytes: 64 * 1024
28
+ }).catch((err) => ({ code: 1, stdout: '', stderr: errorMessage(err) }));
29
+ if (run.code !== 0)
30
+ return unavailable(identity, sksHash, 'codex_hooks_hash_json_unavailable');
31
+ const parsed = JSON.parse(run.stdout || '{}');
32
+ const officialHash = parsed.official_hash || parsed.hash || parsed.current_hash || null;
33
+ return oracleResult('cli', identity, sksHash, officialHash, `${codexBin} hooks hash --json`);
34
+ }
35
+ async function readRustOracle(root, identity, opts = {}) {
36
+ const sksRs = opts.rustHelper || await which('sks-rs').catch(() => null);
37
+ const sksHash = codexCommandHookCurrentHash(identity);
38
+ if (!sksRs)
39
+ return unavailable(identity, sksHash, 'rust_helper_missing');
40
+ const run = await runProcess(sksRs, ['codex-hook-hash', '--json'], {
41
+ cwd: root,
42
+ input: `${JSON.stringify(identity)}\n`,
43
+ timeoutMs: 5000,
44
+ maxOutputBytes: 64 * 1024
45
+ }).catch((err) => ({ code: 1, stdout: '', stderr: errorMessage(err) }));
46
+ if (run.code !== 0)
47
+ return unavailable(identity, sksHash, 'rust_helper_hash_unavailable');
48
+ const parsed = JSON.parse(run.stdout || '{}');
49
+ const officialHash = parsed.official_hash || parsed.hash || null;
50
+ return oracleResult('rust-helper', identity, sksHash, officialHash, `${sksRs} codex-hook-hash --json`);
51
+ }
52
+ async function readGoldenFixtureOracle(root, identity, opts = {}) {
53
+ const fixturePath = opts.fixturePath || path.join(root, 'test', 'fixtures', 'codex-hooks', 'official-hash-oracle.json');
54
+ const sksHash = codexCommandHookCurrentHash(identity);
55
+ if (!(await exists(fixturePath)))
56
+ return unavailable(identity, sksHash, 'golden_fixture_missing');
57
+ const fixture = await readJson(fixturePath, {});
58
+ const rows = Array.isArray(fixture?.entries) ? fixture.entries : [];
59
+ const match = rows.find((row) => row.event_name === identity.event && String(row.command || '') === String(identity.command || '') && String(row.matcher || '') === String(identity.matcher || ''));
60
+ const officialHash = match?.official_hash || match?.hash || null;
61
+ return oracleResult('golden-fixture', identity, sksHash, officialHash, fixturePath);
62
+ }
63
+ function oracleResult(mode, identity, sksHash, officialHash, source) {
64
+ return {
65
+ schema: CODEX_HOOK_HASH_ORACLE_SCHEMA,
66
+ ok: Boolean(officialHash) && officialHash === sksHash,
67
+ mode,
68
+ event_name: identity.event,
69
+ official_hash_available: Boolean(officialHash),
70
+ official_hash_proven: Boolean(officialHash) && officialHash === sksHash,
71
+ official_hash: officialHash,
72
+ sks_computed_hash: sksHash,
73
+ source,
74
+ blocker: officialHash ? (officialHash === sksHash ? null : 'official_hash_mismatch') : 'official_hash_missing',
75
+ generated_at: nowIso()
76
+ };
77
+ }
78
+ function unavailable(identity, sksHash, blocker) {
79
+ return {
80
+ schema: CODEX_HOOK_HASH_ORACLE_SCHEMA,
81
+ ok: true,
82
+ mode: 'unavailable',
83
+ event_name: identity.event || null,
84
+ official_hash_available: false,
85
+ official_hash_proven: false,
86
+ official_hash: null,
87
+ sks_computed_hash: sksHash,
88
+ source: null,
89
+ blocker,
90
+ generated_at: nowIso()
91
+ };
92
+ }
93
+ function errorMessage(err) {
94
+ return err instanceof Error ? err.message : String(err);
95
+ }
96
+ //# sourceMappingURL=codex-hook-official-hash-oracle.js.map