sneakoscope 6.0.3 → 6.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 (378) hide show
  1. package/README.md +29 -12
  2. package/config/codex-releases/{rust-v0.142.0.json → rust-v0.144.1.json} +6 -6
  3. package/crates/sks-core/Cargo.lock +1 -1
  4. package/crates/sks-core/Cargo.toml +1 -1
  5. package/dist/bin/fast-inline.js +18 -14
  6. package/dist/bin/sks-dispatch.js +2 -4
  7. package/dist/cli/args.js +2 -0
  8. package/dist/cli/command-manifest-lite.js +2 -3
  9. package/dist/cli/command-registry.js +3 -4
  10. package/dist/cli/help-fast.js +1 -1
  11. package/dist/cli/install-helpers.js +348 -763
  12. package/dist/cli/install-tool-helpers.js +287 -0
  13. package/dist/cli/router.js +91 -6
  14. package/dist/commands/codex-lb.js +188 -53
  15. package/dist/commands/codex.js +44 -5
  16. package/dist/commands/doctor.js +302 -46
  17. package/dist/commands/tmux.js +5 -1
  18. package/dist/commands/versioning.js +7 -0
  19. package/dist/commands/zellij-monitor-pane.js +2 -0
  20. package/dist/commands/zellij-viewport-pane.js +3 -1
  21. package/dist/commands/zellij.js +1 -1
  22. package/dist/config/skills-manifest.json +59 -59
  23. package/dist/core/agent-bridge/agent-manifest.js +48 -0
  24. package/dist/core/agents/agent-central-ledger.js +9 -0
  25. package/dist/core/agents/agent-cleanup-executor.js +334 -41
  26. package/dist/core/agents/agent-cleanup.js +20 -1
  27. package/dist/core/agents/agent-command-surface.js +3 -1
  28. package/dist/core/agents/agent-effort-policy.js +30 -38
  29. package/dist/core/agents/agent-janitor.js +9 -10
  30. package/dist/core/agents/agent-namespace-safety.js +56 -0
  31. package/dist/core/agents/agent-orchestrator.js +25 -3
  32. package/dist/core/agents/agent-output-validator.js +1 -1
  33. package/dist/core/agents/agent-plan.js +100 -21
  34. package/dist/core/agents/agent-role-config.js +43 -49
  35. package/dist/core/agents/agent-runner-codex-exec.js +18 -3
  36. package/dist/core/agents/agent-runner-process.js +1 -0
  37. package/dist/core/agents/agent-schema.js +3 -2
  38. package/dist/core/agents/fast-mode-policy.js +3 -5
  39. package/dist/core/agents/native-cli-session-swarm.js +1 -1
  40. package/dist/core/agents/native-worker-backend-router.js +2 -1
  41. package/dist/core/agents/work-partition/repo-inventory.js +68 -7
  42. package/dist/core/agents/zellij-right-lane-cockpit.js +2 -2
  43. package/dist/core/code-structure.js +5 -4
  44. package/dist/core/codex/agent-config-file-repair.js +94 -193
  45. package/dist/core/codex/codex-cli-update.js +723 -0
  46. package/dist/core/codex/codex-config-guard.js +38 -11
  47. package/dist/core/codex/codex-project-config-policy.js +3 -6
  48. package/dist/core/codex/codex-startup-config-postcheck.js +52 -42
  49. package/dist/core/codex-adapter.js +35 -22
  50. package/dist/core/codex-app/codex-agent-role-sync.js +13 -54
  51. package/dist/core/codex-app/codex-app-fast-ui-repair.js +51 -20
  52. package/dist/core/codex-app/codex-app-launcher.js +48 -17
  53. package/dist/core/codex-app/codex-app-restart.js +23 -2
  54. package/dist/core/codex-app/codex-app-ui-state-snapshot.js +11 -3
  55. package/dist/core/codex-app/sks-menubar.js +136 -5
  56. package/dist/core/codex-app.js +35 -14
  57. package/dist/core/codex-compat/codex-hook-warning-detector.js +10 -1
  58. package/dist/core/codex-compat/codex-release-manifest.js +6 -6
  59. package/dist/core/codex-control/codex-0139-doctor-real-probe.js +7 -1
  60. package/dist/core/codex-control/codex-0139-image-path-real-probe.js +29 -12
  61. package/dist/core/codex-control/codex-0139-probe-runner.js +103 -28
  62. package/dist/core/codex-control/codex-0139-real-probe-summary.js +7 -3
  63. package/dist/core/codex-control/codex-0139-real-probes.js +21 -6
  64. package/dist/core/codex-control/codex-0139-sandbox-real-probe.js +39 -13
  65. package/dist/core/codex-control/codex-0139-web-search-probe.js +28 -14
  66. package/dist/core/codex-control/{codex-0142-capability.js → codex-0144-capability.js} +22 -22
  67. package/dist/core/codex-control/codex-0144-collab-agent-real-probe.js +63 -0
  68. package/dist/core/codex-control/codex-lb-launch-recovery.js +278 -0
  69. package/dist/core/codex-control/codex-multi-agent-event-normalizer.js +5 -1
  70. package/dist/core/codex-control/codex-reliability-shield.js +93 -30
  71. package/dist/core/codex-control/codex-sdk-adapter.js +96 -13
  72. package/dist/core/codex-control/codex-sdk-config-policy.js +2 -1
  73. package/dist/core/codex-control/codex-sdk-sandbox-policy.js +6 -3
  74. package/dist/core/codex-control/codex-task-runner.js +62 -9
  75. package/dist/core/codex-control/python-codex-sdk-adapter.js +30 -3
  76. package/dist/core/codex-exec-output-schema.js +35 -6
  77. package/dist/core/codex-lb/codex-lb-env.js +30 -1
  78. package/dist/core/codex-lb/codex-lb-tool-catalog.js +478 -0
  79. package/dist/core/codex-lb/codex-lb-tool-output-recovery.js +291 -0
  80. package/dist/core/codex-native/codex-native-feature-broker.js +31 -38
  81. package/dist/core/codex-native/codex-native-feature-matrix.js +2 -2
  82. package/dist/core/codex-native/codex-native-repair-transaction.js +1 -1
  83. package/dist/core/codex-native/core-skill-manifest.js +8 -4
  84. package/dist/core/codex-native/native-capability-postcheck.js +16 -8
  85. package/dist/core/codex-native/native-capability-repair-matrix.js +76 -27
  86. package/dist/core/codex-plugins/codex-plugin-json.js +67 -21
  87. package/dist/core/codex-plugins/codex-plugin-repair.js +118 -0
  88. package/dist/core/codex-runtime/codex-desktop-config-policy.js +305 -0
  89. package/dist/core/commands/agent-bridge-command.js +23 -2
  90. package/dist/core/commands/agent-command.js +38 -5
  91. package/dist/core/commands/basic-cli.js +77 -30
  92. package/dist/core/commands/command-utils.js +1 -1
  93. package/dist/core/commands/gc-command.js +27 -4
  94. package/dist/core/commands/image-ux-review-command.js +55 -24
  95. package/dist/core/commands/mad-sks-command.js +182 -137
  96. package/dist/core/commands/naruto-command.js +643 -1153
  97. package/dist/core/commands/pipeline-command.js +1 -0
  98. package/dist/core/commands/research-command.js +293 -231
  99. package/dist/core/commands/run-command.js +100 -23
  100. package/dist/core/commands/team-command.js +2 -3
  101. package/dist/core/commands/team-legacy-observe-command.js +94 -359
  102. package/dist/core/commands/wiki-command.js +179 -83
  103. package/dist/core/computer-use-live-evidence.js +166 -3
  104. package/dist/core/computer-use-status.js +5 -2
  105. package/dist/core/daemon/sksd-hook-daemon-entrypoint.js +2 -2
  106. package/dist/core/daemon/sksd-hook-daemon.js +171 -28
  107. package/dist/core/daemon/sksd-hook-dispatch.js +2 -2
  108. package/dist/core/db-safety.js +2 -2
  109. package/dist/core/decision-lattice.js +6 -6
  110. package/dist/core/dfix/verification-selector.js +6 -4
  111. package/dist/core/doctor/browser-use-repair.js +54 -13
  112. package/dist/core/doctor/codex-0139-doctor.js +3 -2
  113. package/dist/core/doctor/codex-startup-config-repair.js +8 -3
  114. package/dist/core/doctor/computer-use-repair.js +28 -39
  115. package/dist/core/doctor/doctor-codex-startup-repair.js +24 -149
  116. package/dist/core/doctor/doctor-context7-repair.js +1 -1
  117. package/dist/core/doctor/doctor-dirty-planner.js +1 -1
  118. package/dist/core/doctor/doctor-native-capability-repair.js +74 -3
  119. package/dist/core/doctor/imagegen-repair.js +47 -12
  120. package/dist/core/doctor/legacy-global-hook-cleanup.js +179 -0
  121. package/dist/core/feature-fixture-executor.js +71 -7
  122. package/dist/core/feature-fixture-runner.js +53 -12
  123. package/dist/core/feature-fixtures.js +47 -14
  124. package/dist/core/feature-registry.js +53 -58
  125. package/dist/core/fsx.js +54 -6
  126. package/dist/core/harness-conflicts.js +19 -10
  127. package/dist/core/hooks-runtime/code-pack-freshness-preflight.js +5 -4
  128. package/dist/core/hooks-runtime/hook-invocation-dedupe.js +147 -0
  129. package/dist/core/hooks-runtime/hook-io.js +14 -4
  130. package/dist/core/hooks-runtime/light-turn.js +70 -0
  131. package/dist/core/hooks-runtime/payload-signals.js +270 -0
  132. package/dist/core/hooks-runtime/team-digest.js +0 -1
  133. package/dist/core/hooks-runtime/tool-output-quarantine.js +93 -0
  134. package/dist/core/hooks-runtime.js +418 -250
  135. package/dist/core/image/image-artifact-path-contract.js +8 -6
  136. package/dist/core/image/image-artifact-registry.js +5 -1
  137. package/dist/core/image-ux-review/imagegen-adapter.js +5 -2
  138. package/dist/core/imagegen/imagegen-capability.js +10 -13
  139. package/dist/core/imagegen/require-imagegen.js +37 -11
  140. package/dist/core/init/skills.js +16 -30
  141. package/dist/core/init.js +144 -36
  142. package/dist/core/managed-assets/managed-assets-manifest.js +417 -14
  143. package/dist/core/mission.js +24 -1
  144. package/dist/core/naruto/naruto-work-graph.js +70 -4
  145. package/dist/core/ops/reporting.js +3 -0
  146. package/dist/core/pipeline-internals/runtime-core.js +578 -180
  147. package/dist/core/pipeline-internals/runtime-gates.js +191 -49
  148. package/dist/core/ppt/style-tokens.js +1 -1
  149. package/dist/core/ppt-review/index.js +1 -1
  150. package/dist/core/ppt-review/slide-exporter.js +23 -17
  151. package/dist/core/ppt-review/slide-imagegen-review.js +1 -1
  152. package/dist/core/ppt-review/slide-issue-extraction.js +4 -2
  153. package/dist/core/preflight/parallel-preflight-engine.js +50 -1
  154. package/dist/core/product-design-plugin.js +2 -2
  155. package/dist/core/proof/route-finalizer.js +1 -1
  156. package/dist/core/proof/route-proof-gate.js +7 -2
  157. package/dist/core/proof-field.js +3 -3
  158. package/dist/core/provider/model-router.js +38 -32
  159. package/dist/core/recallpulse/policy.js +12 -28
  160. package/dist/core/recallpulse.js +11 -6
  161. package/dist/core/release/gate-manifest.js +18 -12
  162. package/dist/core/release/gate-pack-manifest.js +1 -1
  163. package/dist/core/release/npm-pack-proof.js +247 -0
  164. package/dist/core/release/package-dist-snapshot.js +151 -0
  165. package/dist/core/release/package-size-budget.js +5 -0
  166. package/dist/core/release/release-authorization-snapshot.js +115 -0
  167. package/dist/core/release/release-gate-affected-selector.js +15 -3
  168. package/dist/core/release/release-gate-cache-v2.js +30 -0
  169. package/dist/core/release/release-gate-contract.js +161 -0
  170. package/dist/core/release/release-gate-dag.js +44 -3
  171. package/dist/core/release/release-gate-hermetic-env.js +28 -17
  172. package/dist/core/release/release-real-contract.js +496 -0
  173. package/dist/core/release-parallel-full-coverage.js +31 -143
  174. package/dist/core/research/claim-evidence-matrix.js +41 -6
  175. package/dist/core/research/experiment-plan.js +14 -10
  176. package/dist/core/research/falsification.js +9 -2
  177. package/dist/core/research/implementation-blueprint-densifier.js +82 -60
  178. package/dist/core/research/implementation-blueprint.js +32 -26
  179. package/dist/core/research/mock-result.js +122 -11
  180. package/dist/core/research/replication-pack.js +15 -8
  181. package/dist/core/research/research-adversarial-review.js +1068 -0
  182. package/dist/core/research/research-claim-builder.js +69 -17
  183. package/dist/core/research/research-claim-synthesizer.js +343 -0
  184. package/dist/core/research/research-cycle-runner.js +53 -3
  185. package/dist/core/research/research-falsification-runner.js +176 -0
  186. package/dist/core/research/research-final-reviewer.js +44 -125
  187. package/dist/core/research/research-realistic-report.js +14 -6
  188. package/dist/core/research/research-review-artifact-digest.js +66 -0
  189. package/dist/core/research/research-source-evidence.js +144 -0
  190. package/dist/core/research/research-source-layer-catalog.js +68 -0
  191. package/dist/core/research/research-source-ledger-merge.js +250 -12
  192. package/dist/core/research/research-source-shards.js +26 -70
  193. package/dist/core/research/research-stage-runner.js +237 -247
  194. package/dist/core/research/research-super-search.js +184 -0
  195. package/dist/core/research/research-synthesis-prompt.js +20 -1
  196. package/dist/core/research/research-synthesis-writer.js +86 -5
  197. package/dist/core/research/research-work-graph.js +25 -18
  198. package/dist/core/research/source-quality-report.js +21 -0
  199. package/dist/core/research.js +429 -280
  200. package/dist/core/retention/retention-budget.js +25 -6
  201. package/dist/core/retention.js +980 -101
  202. package/dist/core/routes/constants.js +1 -1
  203. package/dist/core/routes/dollar-manifest-lite.js +11 -11
  204. package/dist/core/routes/evidence.js +4 -4
  205. package/dist/core/routes/ppt-policy.js +1 -1
  206. package/dist/core/routes.js +92 -64
  207. package/dist/core/runtime/task-profile.js +66 -0
  208. package/dist/core/runtime/verification-budget.js +12 -0
  209. package/dist/core/secret-redaction.js +4 -0
  210. package/dist/core/security/high-risk-contracts.js +6 -6
  211. package/dist/core/stop-gate/stop-gate-check.js +49 -12
  212. package/dist/core/subagents/agent-catalog.js +215 -0
  213. package/dist/core/subagents/model-policy.js +118 -0
  214. package/dist/core/subagents/naruto-help-contract.js +40 -0
  215. package/dist/core/subagents/official-subagent-config.js +488 -0
  216. package/dist/core/subagents/official-subagent-preparation.js +251 -0
  217. package/dist/core/subagents/official-subagent-prompt.js +137 -0
  218. package/dist/core/subagents/official-subagent-runner.js +129 -0
  219. package/dist/core/subagents/subagent-evidence.js +663 -0
  220. package/dist/core/subagents/terminology.js +16 -0
  221. package/dist/core/subagents/thread-budget.js +21 -0
  222. package/dist/core/subagents/triwiki-attention.js +65 -0
  223. package/dist/core/super-search/runtime-helpers.js +173 -19
  224. package/dist/core/super-search/runtime.js +140 -15
  225. package/dist/core/super-search/source-records.js +49 -8
  226. package/dist/core/team-review-policy.js +15 -0
  227. package/dist/core/triwiki/code-pack.js +8 -2
  228. package/dist/core/triwiki/triwiki-cache-key.js +108 -29
  229. package/dist/core/triwiki/triwiki-module-card.js +1 -1
  230. package/dist/core/triwiki-attention.js +13 -6
  231. package/dist/core/triwiki-provenance.js +274 -0
  232. package/dist/core/triwiki-runtime.js +21 -7
  233. package/dist/core/triwiki-wrongness/wrongness-ledger.js +187 -61
  234. package/dist/core/triwiki-wrongness/wrongness-retrieval.js +11 -2
  235. package/dist/core/triwiki-wrongness/wrongness-trust-policy.js +2 -0
  236. package/dist/core/update-check.js +23 -15
  237. package/dist/core/version-manager.js +51 -1
  238. package/dist/core/version.js +1 -1
  239. package/dist/core/wiki-coordinate.js +128 -12
  240. package/dist/core/work-order-ledger.js +208 -10
  241. package/dist/core/zellij/zellij-command.js +12 -1
  242. package/dist/core/zellij/zellij-dashboard-pane.js +3 -3
  243. package/dist/core/zellij/zellij-fake-adapter.js +3 -1
  244. package/dist/core/zellij/zellij-launcher.js +51 -21
  245. package/dist/core/zellij/zellij-layout-builder.js +14 -5
  246. package/dist/core/zellij/zellij-official-subagent-activity.js +477 -0
  247. package/dist/core/zellij/zellij-official-subagent-telemetry.js +264 -0
  248. package/dist/core/zellij/zellij-pane-proof.js +32 -6
  249. package/dist/core/zellij/zellij-slot-pane-renderer.js +17 -5
  250. package/dist/core/zellij/zellij-slot-telemetry.js +15 -3
  251. package/dist/core/zellij/zellij-ui-mode.js +1 -1
  252. package/dist/core/zellij/zellij-viewport-binder.js +3 -0
  253. package/dist/core/zellij/zellij-worker-pane-manager.js +5 -3
  254. package/dist/scripts/agent-fast-mode-default-check.js +48 -29
  255. package/dist/scripts/agent-role-config-repair-check.js +34 -15
  256. package/dist/scripts/agent-wiki-context-proof-check.js +16 -2
  257. package/dist/scripts/all-feature-deep-completion-check.js +14 -4
  258. package/dist/scripts/architecture-guard-check.js +8 -1
  259. package/dist/scripts/build-dist.js +17 -5
  260. package/dist/scripts/canonical-test-runner.js +188 -0
  261. package/dist/scripts/check-command-module-budget.js +38 -16
  262. package/dist/scripts/check-legacy-free.js +1 -1
  263. package/dist/scripts/check-route-modularity.js +0 -1
  264. package/dist/scripts/check-ts-contracts.js +1 -1
  265. package/dist/scripts/codex-0139-interrupt-agent-check.js +5 -1
  266. package/dist/scripts/{codex-0142-app-server-v2-check.js → codex-0144-app-server-v2-check.js} +11 -10
  267. package/dist/scripts/{codex-0142-binary-identity-check.js → codex-0144-binary-identity-check.js} +4 -4
  268. package/dist/scripts/codex-0144-capability-check.js +21 -0
  269. package/dist/scripts/{codex-0139-real-probes-check.js → codex-0144-core-real-probes-check.js} +19 -5
  270. package/dist/scripts/{codex-0142-doctor-wiring-check.js → codex-0144-doctor-wiring-check.js} +6 -6
  271. package/dist/scripts/{codex-0142-manifest-check.js → codex-0144-manifest-check.js} +11 -3
  272. package/dist/scripts/{codex-0142-policy-check.js → codex-0144-policy-check.js} +2 -2
  273. package/dist/scripts/{codex-0142-thread-store-check.js → codex-0144-thread-store-check.js} +3 -3
  274. package/dist/scripts/codex-app-provider-model-ui-check.js +53 -19
  275. package/dist/scripts/codex-app-ui-preservation-check.js +35 -4
  276. package/dist/scripts/codex-control-all-pipelines-check.js +7 -3
  277. package/dist/scripts/codex-control-side-effect-scope-check.js +2 -2
  278. package/dist/scripts/codex-control-tool-output-continuity-audit-check.js +27 -0
  279. package/dist/scripts/codex-effort-auto-discovery-check.js +1 -1
  280. package/dist/scripts/codex-lb-fast-mode-truth-check.js +1 -0
  281. package/dist/scripts/{codex-lb-gpt55-fast-profile-check.js → codex-lb-gpt56-fast-profile-check.js} +56 -5
  282. package/dist/scripts/codex-model-metadata-check.js +1 -1
  283. package/dist/scripts/codex-native-agent-role-content-check.js +15 -7
  284. package/dist/scripts/codex-native-repair-transaction-check.js +3 -1
  285. package/dist/scripts/codex-sdk-all-pipelines-check.js +7 -4
  286. package/dist/scripts/codex-sdk-research-pipeline-check.js +30 -8
  287. package/dist/scripts/codex-sdk-sandbox-policy-check.js +5 -1
  288. package/dist/scripts/codex-sdk-version-compat-check.js +2 -1
  289. package/dist/scripts/db-route-materialization-check.js +33 -0
  290. package/dist/scripts/dfix-fixture-check.js +1 -1
  291. package/dist/scripts/docs-truthfulness-check.js +4 -2
  292. package/dist/scripts/doctor-codex-startup-repair-check.js +47 -25
  293. package/dist/scripts/doctor-context7-repair-check.js +2 -1
  294. package/dist/scripts/doctor-fix-production-blackbox.js +12 -2
  295. package/dist/scripts/doctor-fixes-codex-app-fast-ui-check.js +34 -7
  296. package/dist/scripts/doctor-imagegen-repair-check.js +14 -4
  297. package/dist/scripts/doctor-startup-config-repair-blackbox.js +9 -3
  298. package/dist/scripts/doctor-startup-config-repair-check.js +13 -3
  299. package/dist/scripts/install-update-preserves-config-check.js +7 -2
  300. package/dist/scripts/legacy-gate-inventory-check.js +7 -5
  301. package/dist/scripts/legacy-strong-inventory-check.js +7 -5
  302. package/dist/scripts/legacy-upgrade-matrix-check.js +4 -4
  303. package/dist/scripts/lib/native-cli-session-swarm-check-lib.js +173 -13
  304. package/dist/scripts/mad-sks-app-ui-no-mutation-check.js +165 -6
  305. package/dist/scripts/managed-role-manifest-parity-check.js +5 -4
  306. package/dist/scripts/mutation-callsite-coverage-check.js +0 -11
  307. package/dist/scripts/naruto-codex-e2e-check.js +14 -7
  308. package/dist/scripts/naruto-shadow-clone-swarm-check.js +4 -201
  309. package/dist/scripts/npm-publish-performance-check.js +20 -12
  310. package/dist/scripts/official-subagent-workflow-check.js +145 -0
  311. package/dist/scripts/package-published-contract-check.js +6 -20
  312. package/dist/scripts/packlist-performance-check.js +17 -3
  313. package/dist/scripts/parallel-verification-engine-check.js +2 -2
  314. package/dist/scripts/postinstall-safe-side-effects-check.js +8 -3
  315. package/dist/scripts/ppt-no-mock-as-real-check.js +3 -1
  316. package/dist/scripts/prepublish-release-check-or-fast.js +23 -86
  317. package/dist/scripts/product-design-plugin-routing-check.js +1 -1
  318. package/dist/scripts/release-affected-selector-check.js +74 -1
  319. package/dist/scripts/release-check-stamp.js +324 -239
  320. package/dist/scripts/release-dag-full-coverage-check.js +7 -15
  321. package/dist/scripts/release-dynamic-presets-check.js +10 -1
  322. package/dist/scripts/release-gate-dag-runner-check.js +3 -3
  323. package/dist/scripts/release-gate-dag-runner.js +35 -11
  324. package/dist/scripts/release-gate-existence-audit.js +1 -2
  325. package/dist/scripts/release-gate-script-parity-check.js +1 -1
  326. package/dist/scripts/release-parallel-full-coverage-check.js +12 -6
  327. package/dist/scripts/release-parallel-speed-budget-check.js +18 -2
  328. package/dist/scripts/release-real-check.js +390 -157
  329. package/dist/scripts/release-registry-check.js +61 -16
  330. package/dist/scripts/release-runtime-truth-matrix-check.js +22 -0
  331. package/dist/scripts/research-blueprint-densifier-check.js +2 -2
  332. package/dist/scripts/research-real-cycle-no-legacy-final-md-check.js +11 -7
  333. package/dist/scripts/route-proof-artifact-structure-check.js +1 -0
  334. package/dist/scripts/search-visibility-gate-lib.js +1 -1
  335. package/dist/scripts/seo-geo-route-identity-check.js +30 -4
  336. package/dist/scripts/sizecheck.js +4 -4
  337. package/dist/scripts/sks-1-11-gate-lib.js +53 -6
  338. package/dist/scripts/sks-3-1-4-directive-check-lib.js +8 -2
  339. package/dist/scripts/sks-3-1-5-directive-check-lib.js +3 -2
  340. package/dist/scripts/sks-3-1-6-directive-check-lib.js +5 -3
  341. package/dist/scripts/sks-menubar-install-check.js +8 -0
  342. package/dist/scripts/sks-uninstall-regression-check.js +1 -1
  343. package/dist/scripts/sksd-daemon-check.js +16 -6
  344. package/dist/scripts/trust-fixture-check.js +32 -10
  345. package/dist/scripts/write-build-manifest.js +2 -1
  346. package/dist/scripts/wrongness-fixture-check.js +1 -1
  347. package/dist/scripts/zellij-layout-valid-check.js +36 -11
  348. package/dist/scripts/zellij-pane-proof-check.js +33 -2
  349. package/dist/scripts/zellij-real-session-cleanup-check.js +122 -2
  350. package/dist/scripts/zellij-real-session-launch-check.js +76 -5
  351. package/dist/scripts/zellij-slot-pane-renderer-check.js +4 -4
  352. package/dist/scripts/zellij-spawn-on-demand-layout-check.js +3 -3
  353. package/docs/demo.tape +1 -1
  354. package/infra-harness-gates.json +1486 -0
  355. package/package.json +32 -19
  356. package/release-gates.v2.json +4060 -0
  357. package/runtime-required-scripts.json +9 -0
  358. package/schemas/codex/{app-server-0.142 → app-server-0.144}/codex_app_server_protocol.v2.schemas.json +1146 -781
  359. package/schemas/codex/codex-0139-real-probe-result.schema.json +39 -5
  360. package/schemas/codex/ppt-slide-issue-ledger.schema.json +2 -1
  361. package/dist/commands/db.js +0 -6
  362. package/dist/core/codex-control/codex-0139-multi-agent-real-probe.js +0 -107
  363. package/dist/core/commands/db-command.js +0 -146
  364. package/dist/core/research/prompt.js +0 -15
  365. package/dist/scripts/agent-native-release-gate.js +0 -274
  366. package/dist/scripts/codex-0142-capability-check.js +0 -21
  367. package/dist/scripts/codex-control-tool-call-sequence-repair-check.js +0 -14
  368. package/dist/scripts/command-performance-scorecard-check.js +0 -204
  369. package/dist/scripts/config-managed-merge-callsite-coverage-check.js +0 -212
  370. package/dist/scripts/dollar-performance-scorecard-check.js +0 -257
  371. package/dist/scripts/gate-timing-check.js +0 -16
  372. package/dist/scripts/ops-maturity-scorecard-check.js +0 -12
  373. package/dist/scripts/performance-baseline-check.js +0 -12
  374. package/dist/scripts/performance-improvement-report-check.js +0 -58
  375. package/dist/scripts/release-parallel-check.js +0 -389
  376. package/dist/scripts/release-runner-efficiency-check.js +0 -15
  377. package/dist/scripts/retention-long-run-smoke-check.js +0 -299
  378. package/docs/assets/sneakoscope-architecture-pipeline.jpg +0 -0
@@ -1,8 +1,11 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
1
3
  import { sha256 } from './fsx.js';
2
4
  export const WIKI_COORD_SCHEMA = 'sks.wiki-coordinate.v1';
3
5
  export const WIKI_VOXEL_SCHEMA = 'sks.wiki-voxel.v1';
4
6
  export const WIKI_TAU = Math.PI * 2;
5
7
  export const WIKI_VOXEL_LAYERS = Object.freeze(['sem', 'trust', 'fresh', 'prio', 'conflict', 'route', 'cost']);
8
+ export const DEFAULT_WIKI_VOXEL_QUANTIZATION = Object.freeze({ domain: 64, radius: 16, phase: 64 });
6
9
  export function clamp01(x) {
7
10
  return Math.max(0, Math.min(1, Number.isFinite(x) ? x : 0));
8
11
  }
@@ -247,10 +250,20 @@ function riskScore(value) {
247
250
  };
248
251
  return table[String(value || 'medium')] ?? 0.35;
249
252
  }
250
- function quantizeVoxelCoord(c = []) {
251
- const domain = Math.max(0, Math.min(63, Math.floor((wrapTau(c[0]) / WIKI_TAU) * 64)));
252
- const radius = Math.max(0, Math.min(15, Math.floor(clamp01(Number(c[1])) * 16)));
253
- const phase = Math.max(0, Math.min(63, Math.floor((wrapTau(c[2]) / WIKI_TAU) * 64)));
253
+ function normalizeVoxelQuantization(value = {}) {
254
+ const normalize = (key) => {
255
+ const candidate = Number(value?.[key]);
256
+ return Number.isInteger(candidate) && candidate > 0 && candidate <= 65_536
257
+ ? candidate
258
+ : DEFAULT_WIKI_VOXEL_QUANTIZATION[key];
259
+ };
260
+ return { domain: normalize('domain'), radius: normalize('radius'), phase: normalize('phase') };
261
+ }
262
+ function quantizeVoxelCoord(c = [], value = DEFAULT_WIKI_VOXEL_QUANTIZATION) {
263
+ const quantization = normalizeVoxelQuantization(value);
264
+ const domain = Math.max(0, Math.min(quantization.domain - 1, Math.floor((wrapTau(c[0]) / WIKI_TAU) * quantization.domain)));
265
+ const radius = Math.max(0, Math.min(quantization.radius - 1, Math.floor(clamp01(Number(c[1])) * quantization.radius)));
266
+ const phase = Math.max(0, Math.min(quantization.phase - 1, Math.floor((wrapTau(c[2]) / WIKI_TAU) * quantization.phase)));
254
267
  return `${domain}:${radius}:${phase}`;
255
268
  }
256
269
  function conflictShadow(anchor = {}, claim = {}) {
@@ -272,8 +285,10 @@ function layerVector(anchor = {}, claim = {}, q3 = []) {
272
285
  const trust = Number.isFinite(Number(anchor.trust_score))
273
286
  ? Number(anchor.trust_score)
274
287
  : clamp01((0.7 * statusScore(claim.status || anchor.st)) + (0.3 * Math.log1p(Number(claim.evidence_count) || 0) / Math.log1p(8)));
288
+ const concentration = Number(anchor.c?.[3]);
289
+ const similarity = Number(anchor.sim);
275
290
  return [
276
- clamp01((Number(anchor.c?.[3]) || 0.85) * (Number(anchor.sim) || 1)),
291
+ clamp01((Number.isFinite(concentration) ? concentration : 0.85) * (Number.isFinite(similarity) ? similarity : 1)),
277
292
  clamp01(trust),
278
293
  freshnessScore(claim.freshness),
279
294
  clamp01((required / 1.25) + (requestCount * 0.04) + (strongFeedback * 0.18)),
@@ -282,15 +297,16 @@ function layerVector(anchor = {}, claim = {}, q3 = []) {
282
297
  clamp01(tokenCost / 360)
283
298
  ].map(round4);
284
299
  }
285
- export function buildWikiVoxelOverlay({ anchors = [], claimsById = new Map(), q3 = [], quantization = { domain: 64, radius: 16, phase: 64 } } = {}) {
300
+ export function buildWikiVoxelOverlay({ anchors = [], claimsById = new Map(), q3 = [], quantization = DEFAULT_WIKI_VOXEL_QUANTIZATION } = {}) {
301
+ const normalizedQuantization = normalizeVoxelQuantization(quantization);
286
302
  const rows = (anchors || []).map((anchor) => {
287
303
  const claim = claimsById instanceof Map ? claimsById.get(anchor.id) || {} : {};
288
- return [quantizeVoxelCoord(anchor.c), anchor.id, layerVector(anchor, claim, q3)];
304
+ return [quantizeVoxelCoord(anchor.c, normalizedQuantization), anchor.id, layerVector(anchor, claim, q3)];
289
305
  });
290
306
  return {
291
307
  s: WIKI_VOXEL_SCHEMA,
292
308
  base: WIKI_COORD_SCHEMA,
293
- q: quantization,
309
+ q: normalizedQuantization,
294
310
  l: WIKI_VOXEL_LAYERS,
295
311
  v: rows
296
312
  };
@@ -305,16 +321,48 @@ export function validateWikiVoxelOverlay(overlay = {}, anchorIds = null) {
305
321
  issues.push({ id: 'vx_base', severity: 'error' });
306
322
  if (!Array.isArray(overlay.l) || overlay.l.join('|') !== WIKI_VOXEL_LAYERS.join('|'))
307
323
  issues.push({ id: 'vx_layers', severity: 'error' });
324
+ const rawQuantization = overlay.q;
325
+ for (const key of ['domain', 'radius', 'phase']) {
326
+ const value = Number(rawQuantization?.[key]);
327
+ if (!Number.isInteger(value) || value <= 0 || value > 65_536)
328
+ issues.push({ id: 'vx_quantization', severity: 'error', axis: key });
329
+ }
330
+ const quantization = normalizeVoxelQuantization(rawQuantization);
331
+ const expectedById = new Map();
332
+ if (anchorIds instanceof Map) {
333
+ for (const [id, value] of anchorIds) {
334
+ const coord = Array.isArray(value) ? value : value?.c;
335
+ expectedById.set(String(id), Array.isArray(coord) && coord.length === 4 ? quantizeVoxelCoord(coord, quantization) : null);
336
+ }
337
+ }
338
+ else if (anchorIds instanceof Set) {
339
+ for (const id of anchorIds)
340
+ expectedById.set(String(id), null);
341
+ }
308
342
  const rows = Array.isArray(overlay.v) ? overlay.v : [];
343
+ const seenIds = new Set();
309
344
  for (const row of rows) {
310
345
  const id = row[1];
311
346
  const values = row[2];
312
- if (!/^\d{1,2}:\d{1,2}:\d{1,2}$/.test(String(row[0] || '')))
347
+ const key = String(row[0] || '');
348
+ const parts = /^\d+:\d+:\d+$/.test(key) ? key.split(':').map(Number) : [];
349
+ const [domainKey = -1, radiusKey = -1, phaseKey = -1] = parts;
350
+ if (parts.length !== 3
351
+ || domainKey < 0 || domainKey >= quantization.domain
352
+ || radiusKey < 0 || radiusKey >= quantization.radius
353
+ || phaseKey < 0 || phaseKey >= quantization.phase)
313
354
  issues.push({ id: 'vx_key', severity: 'error', anchor: id });
314
355
  if (!id)
315
356
  issues.push({ id: 'vx_id', severity: 'error' });
316
- if (anchorIds && !anchorIds.has(id))
357
+ if (id && seenIds.has(String(id)))
358
+ issues.push({ id: 'vx_duplicate_anchor', severity: 'error', anchor: id });
359
+ if (id)
360
+ seenIds.add(String(id));
361
+ if (anchorIds && !expectedById.has(String(id)))
317
362
  issues.push({ id: 'vx_anchor', severity: 'error', anchor: id });
363
+ const expectedKey = expectedById.get(String(id));
364
+ if (expectedKey && key !== expectedKey)
365
+ issues.push({ id: 'vx_coord_mismatch', severity: 'error', anchor: id });
318
366
  if (!Array.isArray(values) || values.length !== WIKI_VOXEL_LAYERS.length)
319
367
  issues.push({ id: 'vx_tuple', severity: 'error', anchor: id });
320
368
  else {
@@ -325,6 +373,10 @@ export function validateWikiVoxelOverlay(overlay = {}, anchorIds = null) {
325
373
  }
326
374
  }
327
375
  }
376
+ for (const id of expectedById.keys()) {
377
+ if (!seenIds.has(id))
378
+ issues.push({ id: 'vx_missing_anchor', severity: 'error', anchor: id });
379
+ }
328
380
  return { ok: issues.length === 0, checked: rows.length, issues };
329
381
  }
330
382
  function expandedAnchors(index = {}) {
@@ -365,7 +417,55 @@ function validateTrustFields(anchor = {}, issues = []) {
365
417
  issues.push({ id: 'invalid_trust_action', severity: 'error', anchor: anchor.id });
366
418
  }
367
419
  }
368
- export function validateWikiCoordinateIndex(index = {}) {
420
+ function pathIsInsideRoot(root, candidate) {
421
+ const relative = path.relative(root, candidate);
422
+ return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));
423
+ }
424
+ function hydrationValidationRoot(root) {
425
+ if (!root)
426
+ return null;
427
+ const resolved = path.resolve(String(root));
428
+ try {
429
+ return { resolved, real: fs.realpathSync(resolved), cache: new Map() };
430
+ }
431
+ catch {
432
+ return { resolved, real: null, cache: new Map() };
433
+ }
434
+ }
435
+ function validateHydrationPath(anchor = {}, root, issues = []) {
436
+ if (!root || !hasOwn(anchor, 'p') || anchor.p == null)
437
+ return;
438
+ if (typeof anchor.p !== 'string' || !anchor.p.trim()) {
439
+ issues.push({ id: 'invalid_hydration_path', severity: 'error', anchor: anchor.id, path: anchor.p });
440
+ return;
441
+ }
442
+ const citation = anchor.p.trim();
443
+ if (/^[a-z][a-z0-9+.-]*:\/\//i.test(citation))
444
+ return;
445
+ const resolvedCitation = path.isAbsolute(citation) ? path.resolve(citation) : path.resolve(root.resolved, citation);
446
+ if (!pathIsInsideRoot(root.resolved, resolvedCitation)) {
447
+ issues.push({ id: 'hydration_path_outside_root', severity: 'error', anchor: anchor.id, path: citation });
448
+ return;
449
+ }
450
+ let realCitation = root.cache.get(resolvedCitation) || null;
451
+ if (!root.cache.has(resolvedCitation)) {
452
+ try {
453
+ realCitation = fs.realpathSync(resolvedCitation);
454
+ }
455
+ catch {
456
+ realCitation = null;
457
+ }
458
+ root.cache.set(resolvedCitation, realCitation);
459
+ }
460
+ if (!realCitation) {
461
+ issues.push({ id: 'hydration_path_missing', severity: 'error', anchor: anchor.id, path: citation });
462
+ return;
463
+ }
464
+ if (!root.real || !pathIsInsideRoot(root.real, realCitation)) {
465
+ issues.push({ id: 'hydration_path_outside_root', severity: 'error', anchor: anchor.id, path: citation });
466
+ }
467
+ }
468
+ export function validateWikiCoordinateIndex(index = {}, options = {}) {
369
469
  const issues = [];
370
470
  if (index.schema !== WIKI_COORD_SCHEMA)
371
471
  issues.push({ id: 'schema_mismatch', severity: 'error' });
@@ -375,6 +475,10 @@ export function validateWikiCoordinateIndex(index = {}) {
375
475
  if (!anchors.length && !Array.isArray(index.anchors) && !Array.isArray(index.a))
376
476
  issues.push({ id: 'anchors_missing', severity: 'error' });
377
477
  const seen = new Set();
478
+ const hydrationRoot = hydrationValidationRoot(options.root);
479
+ const compactClaims = new Map((Array.isArray(options.claims) ? options.claims : [])
480
+ .filter((claim) => claim && typeof claim.id === 'string')
481
+ .map((claim) => [String(claim.id), claim]));
378
482
  for (const anchor of anchors) {
379
483
  if (!anchor.id)
380
484
  issues.push({ id: 'anchor_id_missing', severity: 'error' });
@@ -385,13 +489,25 @@ export function validateWikiCoordinateIndex(index = {}) {
385
489
  issues.push({ id: 'invalid_rgba_key', severity: 'error', anchor: anchor.id });
386
490
  if (!Array.isArray(anchor.c) || anchor.c.length !== 4)
387
491
  issues.push({ id: 'invalid_coord_tuple', severity: 'error', anchor: anchor.id });
492
+ if (!/^[0-9a-f]{16}$/i.test(String(anchor.h || '')))
493
+ issues.push({ id: 'invalid_anchor_hash', severity: 'error', anchor: anchor.id });
494
+ const compactClaim = compactClaims.get(String(anchor.id));
495
+ if (compactClaim && typeof compactClaim.text === 'string') {
496
+ const expectedHash = sha256(`${anchor.id}\n${compactClaim.text}`).slice(0, 16);
497
+ if (anchor.h !== expectedHash)
498
+ issues.push({ id: 'anchor_hash_mismatch', severity: 'error', anchor: anchor.id });
499
+ if (compactClaim.h !== expectedHash)
500
+ issues.push({ id: 'compact_claim_hash_mismatch', severity: 'error', anchor: anchor.id });
501
+ }
388
502
  validateTrustFields(anchor, issues);
503
+ validateHydrationPath(anchor, hydrationRoot, issues);
389
504
  }
390
505
  const voxel = index.vx || index.voxel_overlay;
391
506
  if (!voxel)
392
507
  issues.push({ id: 'vx_missing', severity: 'error' });
393
508
  else {
394
- const voxelValidation = validateWikiVoxelOverlay(voxel, seen);
509
+ const anchorMap = new Map(anchors.map((anchor) => [String(anchor.id), anchor]));
510
+ const voxelValidation = validateWikiVoxelOverlay(voxel, anchorMap);
395
511
  for (const issue of voxelValidation.issues)
396
512
  issues.push(issue);
397
513
  }
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path';
2
- import { nowIso, readJson, writeJsonAtomic } from './fsx.js';
2
+ import { exists, nowIso, readJson, writeJsonAtomic } from './fsx.js';
3
3
  import { ARTIFACT_FILES, validateWorkOrderLedger } from './artifact-schemas.js';
4
4
  import { promptRequirementItems } from './questions.js';
5
5
  export function createWorkOrderLedger({ missionId = 'unassigned', route = 'team', requests = [], sourcesComplete = false } = {}) {
@@ -28,7 +28,7 @@ export function createWorkOrderLedger({ missionId = 'unassigned', route = 'team'
28
28
  source_inventory_complete: Boolean(sourcesComplete),
29
29
  all_customer_requests_preserved: items.every((item) => Boolean(item.source.verbatim)),
30
30
  all_customer_requests_mapped: items.every((item) => item.implementation_tasks.length > 0 || item.blocker.blocked === true),
31
- all_work_items_verified: items.length > 0 && items.every((item) => item.status === 'verified' || item.status === 'blocked'),
31
+ all_work_items_verified: items.length > 0 && items.every(workOrderItemResolved),
32
32
  items
33
33
  };
34
34
  }
@@ -51,11 +51,20 @@ export function evaluateWorkOrderCoverage(ledger) {
51
51
  blockers.push('work_order_items_not_verified');
52
52
  let uncovered_count = 0;
53
53
  for (const item of (ledger.items || [])) {
54
- const isVerified = item.status === 'verified';
54
+ const isVerified = item.status === 'verified'
55
+ && Array.isArray(item.implementation_evidence) && item.implementation_evidence.length > 0
56
+ && Array.isArray(item.verification_evidence) && item.verification_evidence.length > 0;
55
57
  const isBlockedWithEvidence = item.status === 'blocked' && item.blocker?.blocked === true;
56
58
  if (!isVerified && !isBlockedWithEvidence) {
57
59
  uncovered_count += 1;
58
- blockers.push(`work_order_uncovered:${item.id}:"${item.source?.verbatim?.slice(0, 40) || ''}"`);
60
+ if (item.status === 'verified' && (!Array.isArray(item.implementation_evidence) || item.implementation_evidence.length === 0)) {
61
+ blockers.push(`work_order_implementation_evidence_missing:${item.id}`);
62
+ }
63
+ if (item.status === 'verified' && (!Array.isArray(item.verification_evidence) || item.verification_evidence.length === 0)) {
64
+ blockers.push(`work_order_verification_evidence_missing:${item.id}`);
65
+ }
66
+ if (item.status !== 'verified')
67
+ blockers.push(`work_order_uncovered:${item.id}:"${item.source?.verbatim?.slice(0, 40) || ''}"`);
59
68
  }
60
69
  }
61
70
  return { ok: blockers.length === 0, blockers, uncovered_count };
@@ -69,7 +78,7 @@ export function updateWorkOrderItem(ledger, id, patch = {}) {
69
78
  : ((item.implementation_tasks || []).length > 0 || item.blocker?.blocked === true)),
70
79
  all_work_items_verified: (ledger.items || []).every((item) => {
71
80
  const next = item.id === id ? { ...item, ...patch } : item;
72
- return next.status === 'verified' || next.status === 'blocked';
81
+ return workOrderItemResolved(next);
73
82
  })
74
83
  };
75
84
  }
@@ -79,16 +88,168 @@ export function updateWorkOrderItem(ledger, id, patch = {}) {
79
88
  * so every item is registered verbatim before any execution starts.
80
89
  */
81
90
  export async function createAndWriteWorkOrderLedgerForPrompt(dir, { missionId, route, prompt } = {}) {
82
- const { items, truncated } = promptRequirementItems(String(prompt || ''));
91
+ const parsed = semanticSliceRequirementItems(String(prompt || '')) || promptRequirementItems(String(prompt || ''));
92
+ const { items, truncated } = parsed;
83
93
  const requests = items.map((item) => ({
84
94
  type: 'chat_text',
85
95
  verbatim: item.text,
96
+ normalized_requirement: item.context ? `${item.context}: ${item.text}` : item.text,
97
+ acceptance_criteria: item.acceptance_context ? [item.acceptance_context] : [],
86
98
  location: `prompt:${item.id}`
87
99
  }));
88
- const ledger = createWorkOrderLedger({ missionId, route, requests, sourcesComplete: !truncated });
100
+ const candidate = createWorkOrderLedger({ missionId, route, requests, sourcesComplete: !truncated });
101
+ const existing = await readWorkOrderLedger(dir);
102
+ const ledger = mergeWorkOrderLedger(existing, candidate);
89
103
  await writeWorkOrderLedger(dir, ledger);
90
104
  return ledger;
91
105
  }
106
+ export function mergeWorkOrderLedger(existing, candidate) {
107
+ if (!existing || !Array.isArray(existing.items))
108
+ return candidate;
109
+ const seen = new Set(existing.items.map(workOrderRequirementKey).filter(Boolean));
110
+ const appended = (candidate?.items || [])
111
+ .filter((item) => {
112
+ const key = workOrderRequirementKey(item);
113
+ if (!key || seen.has(key))
114
+ return false;
115
+ seen.add(key);
116
+ return true;
117
+ })
118
+ .map((item, index) => ({
119
+ ...item,
120
+ id: `WO-${String(existing.items.length + index + 1).padStart(3, '0')}`
121
+ }));
122
+ if (appended.length === 0)
123
+ return existing;
124
+ const items = [...existing.items, ...appended];
125
+ return {
126
+ ...existing,
127
+ mission_id: existing.mission_id || candidate.mission_id,
128
+ route: existing.route || candidate.route,
129
+ source_inventory_complete: Boolean(existing.source_inventory_complete && candidate.source_inventory_complete),
130
+ all_customer_requests_preserved: items.every((item) => Boolean(item.source?.verbatim)),
131
+ all_customer_requests_mapped: items.every((item) => (item.implementation_tasks || []).length > 0 || item.blocker?.blocked === true),
132
+ all_work_items_verified: items.length > 0 && items.every(workOrderItemResolved),
133
+ items
134
+ };
135
+ }
136
+ function workOrderRequirementKey(item) {
137
+ return String(item?.source?.verbatim || item?.normalized_requirement || '')
138
+ .normalize('NFKC')
139
+ .replace(/\s+/g, ' ')
140
+ .trim()
141
+ .toLowerCase();
142
+ }
143
+ const SEMANTIC_SLICE_ITEM_CEILING = 128;
144
+ function semanticSliceRequirementItems(prompt) {
145
+ const text = String(prompt || '').replace(/(?:^|\s)\$[A-Za-z0-9_-]+(?:\s|$)/g, ' ').trim();
146
+ const repeatedScopes = repeatedNamedSliceParts(text);
147
+ if (repeatedScopes)
148
+ return repeatedScopes;
149
+ const marker = /\bslices?\s*:\s*|(?:슬라이스|영역|항목)\s*:\s*/i.exec(text);
150
+ if (!marker)
151
+ return null;
152
+ const context = text.slice(0, marker.index).replace(/\s+/g, ' ').trim();
153
+ const body = text.slice(marker.index + marker[0].length).trim();
154
+ if (!body)
155
+ return null;
156
+ const semicolonParts = body.split(/[;;]/).map((part) => part.trim()).filter(Boolean);
157
+ let parts = semicolonParts.length > 1 ? semicolonParts : numberedSliceParts(body);
158
+ let instructionTail = '';
159
+ if (parts.length <= 1) {
160
+ const sentenceSplit = sentenceSliceParts(body);
161
+ parts = sentenceSplit.parts;
162
+ instructionTail = sentenceSplit.tail;
163
+ }
164
+ if (parts.length <= 1)
165
+ return null;
166
+ const last = splitSliceInstructionTail(parts.at(-1) || '');
167
+ parts[parts.length - 1] = last.topic;
168
+ instructionTail ||= last.tail;
169
+ const topics = parts.map(stripSliceMarker).filter(Boolean);
170
+ if (topics.length <= 1)
171
+ return null;
172
+ const truncated = topics.length > SEMANTIC_SLICE_ITEM_CEILING;
173
+ const kept = topics.slice(0, SEMANTIC_SLICE_ITEM_CEILING);
174
+ return {
175
+ items: kept.map((topic, index) => ({
176
+ id: `REQ-${String(index + 1).padStart(3, '0')}`,
177
+ text: topic,
178
+ context,
179
+ acceptance_context: instructionTail,
180
+ required: true,
181
+ confidence: 1
182
+ })),
183
+ truncated,
184
+ truncated_count: truncated ? topics.length - SEMANTIC_SLICE_ITEM_CEILING : 0
185
+ };
186
+ }
187
+ function repeatedNamedSliceParts(text) {
188
+ const matches = [...text.matchAll(/(?:^|\s)(?:scope|slice|영역|범위)\s*(\d{1,3})\s*[::]\s*/gi)];
189
+ if (matches.length < 2)
190
+ return null;
191
+ const context = text.slice(0, Number(matches[0]?.index || 0)).replace(/\s+/g, ' ').trim();
192
+ const rawParts = matches.map((match, index) => {
193
+ const start = Number(match.index || 0) + match[0].length;
194
+ const end = index + 1 < matches.length ? Number(matches[index + 1]?.index ?? text.length) : text.length;
195
+ return text.slice(start, end).trim();
196
+ });
197
+ const last = splitSliceInstructionTail(rawParts.at(-1) || '');
198
+ rawParts[rawParts.length - 1] = last.topic;
199
+ const topics = rawParts.map(stripSliceMarker).filter(Boolean);
200
+ const truncated = topics.length > SEMANTIC_SLICE_ITEM_CEILING;
201
+ return {
202
+ items: topics.slice(0, SEMANTIC_SLICE_ITEM_CEILING).map((topic, index) => ({
203
+ id: `REQ-${String(index + 1).padStart(3, '0')}`,
204
+ text: topic,
205
+ context,
206
+ acceptance_context: last.tail,
207
+ required: true,
208
+ confidence: 1
209
+ })),
210
+ truncated,
211
+ truncated_count: truncated ? topics.length - SEMANTIC_SLICE_ITEM_CEILING : 0
212
+ };
213
+ }
214
+ function numberedSliceParts(text) {
215
+ const matches = [...text.matchAll(/(?:^|\s)(?:\d{1,3}[.)]|[①-⑳])\s+/g)];
216
+ if (matches.length < 2)
217
+ return [text];
218
+ return matches.map((match, index) => {
219
+ const start = Number(match.index || 0) + match[0].length;
220
+ const end = index + 1 < matches.length ? Number(matches[index + 1]?.index ?? text.length) : text.length;
221
+ return text.slice(start, end).trim();
222
+ }).filter(Boolean);
223
+ }
224
+ function sentenceSliceParts(text) {
225
+ const sentences = text.split(/(?<=[.!?。!?])\s+/).map((part) => part.trim()).filter(Boolean);
226
+ if (sentences.length < 2)
227
+ return { parts: [text], tail: '' };
228
+ const instructionIndex = sentences.findIndex((sentence) => isSliceInstruction(sentence));
229
+ return instructionIndex > 1
230
+ ? { parts: sentences.slice(0, instructionIndex), tail: sentences.slice(instructionIndex).join(' ') }
231
+ : { parts: [text], tail: '' };
232
+ }
233
+ function splitSliceInstructionTail(text) {
234
+ const sentences = text.split(/(?<=[.!?。!?])\s+/).map((part) => part.trim()).filter(Boolean);
235
+ const instructionIndex = sentences.findIndex((sentence, index) => index > 0 && isSliceInstruction(sentence));
236
+ if (instructionIndex < 0)
237
+ return { topic: text.trim(), tail: '' };
238
+ return {
239
+ topic: sentences.slice(0, instructionIndex).join(' ').trim(),
240
+ tail: sentences.slice(instructionIndex).join(' ').trim()
241
+ };
242
+ }
243
+ function isSliceInstruction(text) {
244
+ return /^(?:inspect|review|check|verify|use|do\s+not|never|return|report|limit|only|검사|검토|확인|검증|사용|수정하지|실행하지|반환|보고|제한)/i.test(String(text || '').trim());
245
+ }
246
+ function stripSliceMarker(text) {
247
+ return String(text || '')
248
+ .replace(/^\s*(?:\d{1,3}[.)]|[①-⑳]|[-*])\s*/, '')
249
+ .replace(/[.!?。!?]+$/, '')
250
+ .replace(/\s+/g, ' ')
251
+ .trim();
252
+ }
92
253
  /**
93
254
  * Closes out every item in a mission's ledger to a terminal state once the
94
255
  * route's own gate has decided ok/not-ok, so evaluateStop's coverage gate
@@ -101,14 +262,51 @@ export async function closeWorkOrderLedgerForRouteResult(dir, { ok, blockers = [
101
262
  const ledger = await readWorkOrderLedger(dir);
102
263
  if (!ledger || !Array.isArray(ledger.items) || ledger.items.length === 0)
103
264
  return null;
265
+ const routeEvidence = ok ? await existingRouteEvidence(dir) : [];
266
+ const verified = ok && routeEvidence.length > 0;
104
267
  let next = ledger;
105
268
  for (const item of ledger.items) {
106
- const patch = ok
107
- ? { status: 'verified', implementation_tasks: item.implementation_tasks?.length ? item.implementation_tasks : ['route_completion'] }
108
- : { status: 'blocked', blocker: { blocked: true, reason: blockers.join(', ') || 'route_completion_blocked', needed_to_unblock: 'resolve the route blockers and re-run' } };
269
+ const patch = verified
270
+ ? {
271
+ status: 'verified',
272
+ implementation_tasks: item.implementation_tasks?.length ? item.implementation_tasks : ['route_completion'],
273
+ implementation_evidence: item.implementation_evidence?.length ? item.implementation_evidence : routeEvidence,
274
+ verification_evidence: item.verification_evidence?.length ? item.verification_evidence : routeEvidence
275
+ }
276
+ : {
277
+ status: 'blocked',
278
+ blocker: {
279
+ blocked: true,
280
+ reason: blockers.join(', ') || (ok ? 'route_completion_evidence_missing' : 'route_completion_blocked'),
281
+ needed_to_unblock: ok ? 'write the route gate/proof artifact and close the work order again' : 'resolve the route blockers and re-run'
282
+ }
283
+ };
109
284
  next = updateWorkOrderItem(next, item.id, patch);
110
285
  }
111
286
  await writeWorkOrderLedger(dir, next);
112
287
  return next;
113
288
  }
289
+ function workOrderItemResolved(item) {
290
+ if (item?.status === 'blocked')
291
+ return item?.blocker?.blocked === true;
292
+ return item?.status === 'verified'
293
+ && Array.isArray(item?.implementation_evidence) && item.implementation_evidence.length > 0
294
+ && Array.isArray(item?.verification_evidence) && item.verification_evidence.length > 0;
295
+ }
296
+ async function existingRouteEvidence(dir) {
297
+ const candidates = [
298
+ 'completion-proof.json',
299
+ 'naruto-gate.json',
300
+ 'loop-graph-proof.json',
301
+ 'run-gate.json',
302
+ 'agents/agent-proof-evidence.json',
303
+ 'agents/agent-output-validation.json'
304
+ ];
305
+ const found = [];
306
+ for (const candidate of candidates) {
307
+ if (await exists(path.join(dir, candidate)))
308
+ found.push(candidate);
309
+ }
310
+ return found;
311
+ }
114
312
  //# sourceMappingURL=work-order-ledger.js.map
@@ -32,7 +32,7 @@ export async function runZellij(args = [], opts = {}) {
32
32
  const stderr = String(result.stderr || '');
33
33
  const missing = result.code === -1 && /ENOENT|not found|spawn zellij/i.test(stderr);
34
34
  const socketPathTooLong = isZellijSocketPathTooLong(stderr);
35
- return {
35
+ const record = {
36
36
  ok,
37
37
  command: 'zellij',
38
38
  args: [...args],
@@ -43,6 +43,7 @@ export async function runZellij(args = [], opts = {}) {
43
43
  stdout_bytes: result.stdoutBytes,
44
44
  stderr_bytes: result.stderrBytes,
45
45
  timed_out: result.timedOut,
46
+ output_truncated: result.truncated,
46
47
  duration_ms: Date.now() - started,
47
48
  env: preparedEnv.meta,
48
49
  blockers: ok ? [] : [missing ? 'zellij_missing' : socketPathTooLong ? 'zellij_socket_path_too_long' : result.timedOut ? 'zellij_command_timeout' : 'zellij_command_failed'],
@@ -51,6 +52,16 @@ export async function runZellij(args = [], opts = {}) {
51
52
  ...(ok || opts.optional !== true ? [] : ['zellij_command_failed_optional'])
52
53
  ]
53
54
  };
55
+ Object.defineProperty(record, 'stdout_for_parsing', {
56
+ value: String(result.stdout || ''),
57
+ enumerable: false,
58
+ configurable: false,
59
+ writable: false
60
+ });
61
+ return record;
62
+ }
63
+ export function zellijCommandStdout(result) {
64
+ return String(result?.stdout_for_parsing ?? result?.stdout_tail ?? '');
54
65
  }
55
66
  export async function prepareZellijProcessEnv(envOverrides = {}) {
56
67
  const mergedEnv = { ...process.env, ...envOverrides };
@@ -1,6 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { ensureDir, nowIso, writeJsonAtomic } from '../fsx.js';
3
- import { runZellij } from './zellij-command.js';
3
+ import { runZellij, zellijCommandStdout } from './zellij-command.js';
4
4
  import { extractZellijPaneIdFromOutput } from './zellij-lane-runtime.js';
5
5
  import { buildZellijDashboardSnapshot } from './zellij-dashboard-renderer.js';
6
6
  export const ZELLIJ_DASHBOARD_PANE_SCHEMA = 'sks.zellij-dashboard-pane.v1';
@@ -22,8 +22,8 @@ export async function openZellijDashboardPane(input) {
22
22
  optional: false
23
23
  });
24
24
  const stdoutPaneId = launch.ok ? extractZellijPaneIdFromOutput(launch.stdout_tail) : null;
25
- const listed = await runZellij(['--session', input.sessionName, 'action', 'list-panes', '--json', '--all'], { cwd, timeoutMs: 5000, optional: true });
26
- const rows = parseRows(listed.stdout_tail);
25
+ const listed = await runZellij(['--session', input.sessionName, 'action', 'list-panes', '--json', '--all'], { cwd, timeoutMs: 5000, maxOutputBytes: 1024 * 1024, optional: true });
26
+ const rows = parseRows(zellijCommandStdout(listed));
27
27
  const pane = stdoutPaneId ? null : rows.find((row) => String(row.title || row.name || '').includes(paneTitle));
28
28
  const paneId = stdoutPaneId || pane?.pane_id || pane?.paneId || pane?.id || null;
29
29
  const dump = await runZellij(['--session', input.sessionName, 'action', 'dump-screen'], { cwd, timeoutMs: 5000, optional: true });
@@ -89,7 +89,9 @@ export async function runFakeZellij(args = [], opts = {}) {
89
89
  session_name: sessionName,
90
90
  version,
91
91
  exit_code: result.code,
92
- duration_ms: Date.now() - startedAt
92
+ duration_ms: Date.now() - startedAt,
93
+ sks_zellij_viewports: env.SKS_ZELLIJ_VIEWPORTS || null,
94
+ sks_zellij_refresh_ms: env.SKS_ZELLIJ_REFRESH_MS || null
93
95
  });
94
96
  return result;
95
97
  }