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,6 +1,8 @@
1
+ import { sha256 } from '../fsx.js';
1
2
  export const MANAGED_ASSET_SCHEMA_VERSION = 1;
2
- export const MANAGED_ASSET_VERSION = '4.8.1';
3
+ export const MANAGED_ASSET_VERSION = '6.1.2';
3
4
  export const MANAGED_ASSET_MARKER = 'SKS-MANAGED-ASSET';
5
+ export const MANAGED_OFFICIAL_SUBAGENT_MARKER = 'SKS-MANAGED-OFFICIAL-SUBAGENT';
4
6
  export const MANAGED_AGENT_ROLES = Object.freeze([
5
7
  role('sks-explorer', 'analysis-scout.toml', 'analysis_scout', 'SKS analysis scout for bounded read/write slices retained for stale Codex agent-role config repair.', 'workspace-write', ['analysis-scout', 'analysis_scout']),
6
8
  role('sks-native-agent', 'native-agent-intake.toml', 'native_agent', 'SKS native agent for bounded read/write intake slices.', 'workspace-write', ['native-agent-intake', 'native_agent']),
@@ -12,6 +14,295 @@ export const MANAGED_AGENT_ROLES = Object.freeze([
12
14
  role('sks-codex-probe-verifier', 'sks-codex-probe-verifier.toml', 'sks_codex_probe_verifier', 'Codex probe verifier for CLI, App, SDK, MCP, and native capability evidence with bounded write capability.', 'workspace-write', ['codex-probe-verifier']),
13
15
  role('db-safety-reviewer', 'db-safety-reviewer.toml', 'db_safety_reviewer', 'Database safety reviewer for SQL, migrations, Supabase, and rollback safety with bounded write capability.', 'workspace-write', ['db-safety-reviewer', 'db_safety_reviewer'])
14
16
  ]);
17
+ /**
18
+ * Canonical project-scoped Codex custom agents for the official subagent workflow.
19
+ * Each role is intentionally narrow so Codex can select it from its description
20
+ * instead of forcing every slice through a generic worker/reviewer pair.
21
+ */
22
+ export const MANAGED_OFFICIAL_SUBAGENT_ROLES = Object.freeze([
23
+ officialSubagentRole({
24
+ id: 'sks-official-worker',
25
+ filename: 'worker.toml',
26
+ aliases: ['worker'],
27
+ codexName: 'worker',
28
+ description: 'Execution-focused subagent for clear, bounded, repeatable work with an explicit done condition.',
29
+ model: 'gpt-5.6-luna',
30
+ keywords: ['bounded', 'mechanical', 'repeatable', 'rename', 'format', 'copy', 'fixture'],
31
+ nicknames: ['Kite', 'Moss', 'Pico', 'Reed', 'Vale', 'Wren'],
32
+ instructions: `You are a bounded execution subagent.
33
+
34
+ Work only on the exact slice assigned by the parent agent.
35
+ Do not redesign the task, expand scope, or spawn another subagent.
36
+ Prefer clear, mechanical, repeatable execution.
37
+ Respect the parent session's sandbox and approval mode.
38
+ When writing, touch only the assigned files or paths.
39
+ Run only the verification directly relevant to your slice.
40
+ Return:
41
+ 1. concise result,
42
+ 2. files inspected or changed,
43
+ 3. verification performed,
44
+ 4. blockers or uncertainty.
45
+ Do not claim success without direct evidence.`
46
+ }),
47
+ officialSubagentRole({
48
+ id: 'sks-official-implementation-specialist',
49
+ filename: 'implementation-specialist.toml',
50
+ aliases: ['implementation-specialist', 'core-implementer'],
51
+ codexName: 'implementation_specialist',
52
+ description: 'Sol implementation specialist for bounded backend, core, API, lifecycle, and cross-file refactors with disjoint ownership.',
53
+ model: 'gpt-5.6-sol',
54
+ keywords: ['implementation', 'backend', 'core', 'api', 'lifecycle fix', 'cross-file refactor', 'complex change', '구현', '백엔드', '핵심 로직'],
55
+ nicknames: ['Builder', 'Forge', 'Mason', 'Rivet'],
56
+ instructions: `You are the bounded complex implementation specialist.
57
+
58
+ Own only the disjoint files and acceptance criteria assigned by the parent.
59
+ Use this role for non-mechanical backend, core, API, lifecycle, and cross-file implementation.
60
+ Do not redesign unrelated architecture or integrate sibling work.
61
+ Make the smallest defensible change, run focused verification, and return files, evidence, and residual risks.`
62
+ }),
63
+ officialSubagentRole({
64
+ id: 'sks-official-expert',
65
+ filename: 'expert.toml',
66
+ aliases: ['expert'],
67
+ codexName: 'expert',
68
+ description: 'Read-only reasoning fallback for ambiguous analysis when no narrower specialist matches.',
69
+ model: 'gpt-5.6-sol',
70
+ sandbox: 'read-only',
71
+ keywords: ['ambiguous', 'strategy', 'planning', 'trade-off', 'risk', 'judgment'],
72
+ nicknames: ['Atlas', 'Delta', 'Helix', 'Orion', 'Sage', 'Vector'],
73
+ instructions: `You are the reasoning and judgment fallback subagent.
74
+
75
+ Use this role only when no narrower SKS custom agent matches the slice.
76
+ Stay read-only and return a decision-ready analysis to the parent.
77
+
78
+ Do not spawn another subagent.
79
+ Separate evidence from inference.
80
+ For reviews, lead with concrete findings and file references.
81
+ For debugging, reproduce or trace the failure before proposing a fix.
82
+ For planning, produce a bounded plan with clear ownership and stop conditions.
83
+ Run only verification that can change the decision.
84
+ Return a concise result, evidence, risks, and next action.`
85
+ }),
86
+ officialSubagentRole({
87
+ id: 'sks-official-explorer',
88
+ filename: 'explorer.toml',
89
+ aliases: ['explorer', 'code-explorer'],
90
+ codexName: 'explorer',
91
+ description: 'Read-only codebase explorer for locating entry points, ownership, dependencies, and bounded evidence before changes.',
92
+ model: 'gpt-5.6-luna',
93
+ sandbox: 'read-only',
94
+ keywords: ['explore', 'map', 'trace', 'inventory', 'locate', 'search', 'read-only'],
95
+ nicknames: ['Beacon', 'Compass', 'Maple', 'Scout'],
96
+ instructions: `You are the read-only code explorer.
97
+
98
+ Map only the code paths relevant to the assigned question.
99
+ Prefer targeted search and exact symbol references over broad repository scans.
100
+ Identify entry points, state transitions, owners, and evidence gaps.
101
+ Do not propose a broad redesign and do not edit files.
102
+ Return concise findings with exact paths and symbols.`
103
+ }),
104
+ officialSubagentRole({
105
+ id: 'sks-official-debugger',
106
+ filename: 'debugger.toml',
107
+ aliases: ['debugger', 'root-cause'],
108
+ codexName: 'debugger',
109
+ description: 'Read-only root-cause specialist for failures, flaky behavior, regressions, and cross-layer diagnostics.',
110
+ model: 'gpt-5.6-sol',
111
+ sandbox: 'read-only',
112
+ keywords: ['debug', 'diagnose', 'root cause', 'failure', 'flaky', 'regression', 'why'],
113
+ nicknames: ['Ada', 'Kepler', 'Trace', 'Vega'],
114
+ instructions: `You are the root-cause debugger.
115
+
116
+ Reproduce or trace the failure before suggesting a fix.
117
+ Separate observations, hypotheses, and confirmed causes.
118
+ Inspect logs and tests narrowly; do not edit application code.
119
+ Return the minimal causal chain, exact evidence, and the smallest defensible fix surface.`
120
+ }),
121
+ officialSubagentRole({
122
+ id: 'sks-official-test-engineer',
123
+ filename: 'test-engineer.toml',
124
+ aliases: ['test-engineer', 'qa-engineer'],
125
+ codexName: 'test_engineer',
126
+ description: 'Test engineer for focused regression coverage, deterministic fixtures, and failure-oriented verification.',
127
+ model: 'gpt-5.6-sol',
128
+ keywords: ['test', 'qa', 'fixture', 'regression', 'coverage', 'verification'],
129
+ nicknames: ['Check', 'Proof', 'Quill', 'Tess'],
130
+ instructions: `You are the focused test engineer.
131
+
132
+ Own only the assigned test files and fixtures.
133
+ Add the smallest regression coverage that would have caught the issue.
134
+ Avoid duplicating production logic in assertions.
135
+ Run only the focused checks needed for the slice and report exact commands and outcomes.`
136
+ }),
137
+ officialSubagentRole({
138
+ id: 'sks-official-ui-implementer',
139
+ filename: 'ui-implementer.toml',
140
+ aliases: ['ui-implementer', 'frontend-specialist'],
141
+ codexName: 'ui_implementer',
142
+ description: 'UI and terminal-interface implementation specialist for visual behavior, interaction, accessibility, and rendered state.',
143
+ model: 'gpt-5.6-sol',
144
+ keywords: ['ui', 'ux', 'frontend', 'visual', 'terminal', 'zellij', 'pane', 'accessibility'],
145
+ nicknames: ['Canvas', 'Iris', 'Pixel', 'Turing'],
146
+ instructions: `You are the UI implementation specialist.
147
+
148
+ Trace the rendered user-visible behavior before editing.
149
+ Make the smallest change that fixes interaction, layout, accessibility, or terminal presentation.
150
+ Preserve the existing design system and unrelated behavior.
151
+ Verify the rendered result with the appropriate live or deterministic surface and report evidence.`
152
+ }),
153
+ officialSubagentRole({
154
+ id: 'sks-official-architecture-reviewer',
155
+ filename: 'architecture-reviewer.toml',
156
+ aliases: ['architecture-reviewer', 'architect'],
157
+ codexName: 'architecture_reviewer',
158
+ description: 'Read-only architecture reviewer for boundaries, lifecycle, state ownership, coupling, and refactor risk.',
159
+ model: 'gpt-5.6-sol',
160
+ sandbox: 'read-only',
161
+ keywords: ['architecture', 'design', 'lifecycle', 'state ownership', 'refactor', 'coupling'],
162
+ nicknames: ['Archimedes', 'Euler', 'Frame', 'Mencius'],
163
+ instructions: `You are the architecture reviewer.
164
+
165
+ Review boundaries, ownership, lifecycle, and failure recovery like a maintainer.
166
+ Prefer concrete execution paths over abstract style commentary.
167
+ Identify duplication, hidden coupling, and unsafe state transitions.
168
+ Do not edit files; return prioritized findings and a bounded recommendation.`
169
+ }),
170
+ officialSubagentRole({
171
+ id: 'sks-official-security-reviewer',
172
+ filename: 'security-reviewer.toml',
173
+ aliases: ['security-reviewer', 'security'],
174
+ codexName: 'security_reviewer',
175
+ description: 'Read-only security reviewer for trust boundaries, permissions, secrets, authentication, and abuse cases.',
176
+ model: 'gpt-5.6-sol',
177
+ sandbox: 'read-only',
178
+ keywords: ['security', 'permission', 'secret', 'auth', 'trust boundary', 'abuse'],
179
+ nicknames: ['Aegis', 'Cipher', 'Sentinel', 'Shield'],
180
+ instructions: `You are the security reviewer.
181
+
182
+ Inspect only the assigned threat surface.
183
+ Prioritize exploitable trust-boundary failures, permission escalation, secret exposure, and unsafe defaults.
184
+ Do not perform destructive probes or edit files.
185
+ Return findings with severity, evidence, exploit preconditions, and the smallest mitigation.`
186
+ }),
187
+ officialSubagentRole({
188
+ id: 'sks-official-database-reviewer',
189
+ filename: 'database-reviewer.toml',
190
+ aliases: ['database-reviewer', 'db-reviewer'],
191
+ codexName: 'database_reviewer',
192
+ description: 'Read-only database reviewer for SQL, migrations, schemas, RLS, rollback safety, and data integrity.',
193
+ model: 'gpt-5.6-sol',
194
+ sandbox: 'read-only',
195
+ keywords: ['database', 'db', 'sql', 'migration', 'schema', 'rls', 'rollback'],
196
+ nicknames: ['Ledger', 'Oracle', 'Rowan', 'Schema'],
197
+ instructions: `You are the database safety reviewer.
198
+
199
+ Keep all inspection read-only unless the parent supplied a separately sealed mutation contract.
200
+ Check migration ordering, rollback, locks, RLS, data loss, and integrity assumptions.
201
+ Never execute live mutations.
202
+ Return exact risks, evidence, and safe verification or migration recommendations.`
203
+ }),
204
+ officialSubagentRole({
205
+ id: 'sks-official-research-synthesizer',
206
+ filename: 'research-synthesizer.toml',
207
+ aliases: ['research-synthesizer', 'researcher'],
208
+ codexName: 'research_synthesizer',
209
+ description: 'Evidence-bound research specialist for source synthesis, falsification, novelty, and adversarial manuscript improvement.',
210
+ model: 'gpt-5.6-sol',
211
+ keywords: ['research', 'paper', 'hypothesis', 'synthesis', 'falsification', 'novelty', 'super search'],
212
+ nicknames: ['Curie', 'Einstein', 'Feynman', 'Noether'],
213
+ instructions: `You are the evidence-bound research synthesizer.
214
+
215
+ Use only cited sources and explicit experiments.
216
+ Separate facts, inference, hypotheses, novelty claims, and unknowns.
217
+ Actively falsify the strongest claim and revise only mission-local research artifacts.
218
+ Do not invent evidence or promise publication acceptance.
219
+ Return a structured synthesis, strongest challenge, required revisions, and residual uncertainty.`
220
+ }),
221
+ officialSubagentRole({
222
+ id: 'sks-official-research-reviewer',
223
+ filename: 'research-reviewer.toml',
224
+ aliases: ['research-reviewer', 'paper-reviewer'],
225
+ codexName: 'research_reviewer',
226
+ description: 'Read-only adversarial research reviewer for evidence quality, falsification, methodology, novelty, and reproducibility.',
227
+ model: 'gpt-5.6-sol',
228
+ sandbox: 'read-only',
229
+ keywords: ['research review', 'paper review', 'adversarial review', 'methodology', 'reproducibility', 'falsification'],
230
+ nicknames: ['Gauss', 'Skeptic', 'Turing', 'von Neumann'],
231
+ instructions: `You are the adversarial research reviewer.
232
+
233
+ Attack the strongest claim with source-bound counterevidence, base rates, and reproducibility checks.
234
+ Do not edit files or reward impressive language without evidence.
235
+ Return the strongest falsification attempt, objections with required revisions, evidence source IDs, and an approve/revise/reject verdict.
236
+ Approve only when no critical, major, minor, or required revision remains.`
237
+ }),
238
+ officialSubagentRole({
239
+ id: 'sks-official-release-reviewer',
240
+ filename: 'release-reviewer.toml',
241
+ aliases: ['release-reviewer', 'release'],
242
+ codexName: 'release_reviewer',
243
+ description: 'Read-only release reviewer for versioning, package contents, CI, migration safety, and publish authorization.',
244
+ model: 'gpt-5.6-sol',
245
+ sandbox: 'read-only',
246
+ keywords: ['release', 'publish', 'package', 'version', 'changelog', 'ci', 'distribution'],
247
+ nicknames: ['Galileo', 'Harbor', 'Launch', 'Mercury'],
248
+ instructions: `You are the release reviewer.
249
+
250
+ Audit version metadata, package contents, CI workflow, migration notes, and release evidence.
251
+ Do not publish, tag, push, or mutate package registries.
252
+ Fail closed on stale or simulated proof.
253
+ Return release blockers, exact evidence, and the minimal verification still required.`
254
+ }),
255
+ officialSubagentRole({
256
+ id: 'sks-official-docs-maintainer',
257
+ filename: 'docs-maintainer.toml',
258
+ aliases: ['docs-maintainer', 'documentation'],
259
+ codexName: 'docs_maintainer',
260
+ description: 'Documentation maintainer for bounded README, changelog, migration, and reference updates after behavior is known.',
261
+ model: 'gpt-5.6-luna',
262
+ keywords: ['docs', 'documentation', 'readme', 'changelog', 'migration guide', 'reference'],
263
+ nicknames: ['Ink', 'Page', 'Scribe', 'Slate'],
264
+ instructions: `You are the bounded documentation maintainer.
265
+
266
+ Update only the assigned documentation files after behavior is established by code or official sources.
267
+ Keep examples executable and avoid unsupported claims.
268
+ Preserve historical notes unless the parent explicitly scopes a cleanup.
269
+ Return changed files and the source of truth used for each behavioral statement.`
270
+ }),
271
+ officialSubagentRole({
272
+ id: 'sks-official-integration-reviewer',
273
+ filename: 'integration-reviewer.toml',
274
+ aliases: ['integration-reviewer', 'integration'],
275
+ codexName: 'integration_reviewer',
276
+ description: 'Read-only cross-module integration reviewer for merge risk, contracts, compatibility, and end-to-end state flow.',
277
+ model: 'gpt-5.6-sol',
278
+ sandbox: 'read-only',
279
+ keywords: ['integration', 'merge', 'rebase', 'compatibility', 'cross-module', 'end-to-end'],
280
+ nicknames: ['Bridge', 'Concord', 'Link', 'Weave'],
281
+ instructions: `You are the integration reviewer.
282
+
283
+ Trace contracts across the assigned modules and identify incompatible assumptions or merge hazards.
284
+ The parent owns final integration; do not edit files or combine sibling work.
285
+ Prioritize end-to-end state flow, compatibility, and recovery behavior.
286
+ Return concrete integration risks and focused checks.`
287
+ }),
288
+ officialSubagentRole({
289
+ id: 'sks-official-performance-analyst',
290
+ filename: 'performance-analyst.toml',
291
+ aliases: ['performance-analyst', 'performance'],
292
+ codexName: 'performance_analyst',
293
+ description: 'Read-only performance analyst for latency, concurrency, token cost, resource usage, and benchmark validity.',
294
+ model: 'gpt-5.6-sol',
295
+ sandbox: 'read-only',
296
+ keywords: ['performance', 'latency', 'benchmark', 'concurrency', 'token', 'memory', 'throughput'],
297
+ nicknames: ['Ampere', 'Hopper', 'Pulse', 'Watt'],
298
+ instructions: `You are the performance analyst.
299
+
300
+ Require measured evidence before claiming improvement.
301
+ Inspect latency, concurrency, token, memory, and resource trade-offs within the assigned scope.
302
+ Do not edit files or extrapolate from unscored anecdotes.
303
+ Return the measurement method, observed result, uncertainty, and next cheapest experiment.`
304
+ })
305
+ ]);
15
306
  export const MANAGED_SKILLS = Object.freeze([
16
307
  'loop',
17
308
  'naruto',
@@ -54,6 +345,20 @@ export function managedAgentRoleByName(name) {
54
345
  ...role.legacy_ids
55
346
  ].map(normalizeRoleName).includes(normalized)) || null;
56
347
  }
348
+ export function managedOfficialSubagentRoleByFile(filename) {
349
+ const base = filename.split(/[\\/]/).pop() || filename;
350
+ assertUniqueManagedAgentRoleFilenames();
351
+ return MANAGED_OFFICIAL_SUBAGENT_ROLES.find((role) => role.filename === base) || null;
352
+ }
353
+ export function managedOfficialSubagentRoleByName(name) {
354
+ const normalized = normalizeRoleName(name);
355
+ return MANAGED_OFFICIAL_SUBAGENT_ROLES.find((role) => [
356
+ role.id,
357
+ role.codex_name,
358
+ role.filename.replace(/\.toml$/i, ''),
359
+ ...role.aliases
360
+ ].map(normalizeRoleName).includes(normalized)) || null;
361
+ }
57
362
  export function managedAgentRoleContent(role) {
58
363
  return [
59
364
  `# ${MANAGED_ASSET_MARKER}`,
@@ -63,8 +368,6 @@ export function managedAgentRoleContent(role) {
63
368
  `name = "${role.codex_name}"`,
64
369
  `description = "${role.description}"`,
65
370
  `sandbox_mode = "${role.sandbox}"`,
66
- `permission_profile = "${role.permission_profile}"`,
67
- `legacy_sandbox_projection = "${role.legacy_sandbox_projection}"`,
68
371
  'developer_instructions = """',
69
372
  `You are the SKS ${role.id} role.`,
70
373
  role.sandbox === 'read-only' ? 'Do not edit files.' : 'Only edit the bounded files assigned by the parent orchestrator.',
@@ -74,21 +377,69 @@ export function managedAgentRoleContent(role) {
74
377
  ].join('\n');
75
378
  }
76
379
  export function managedAgentRoleOwnsText(text, role) {
77
- const hasManagedMarker = text.includes(MANAGED_ASSET_MARKER)
78
- && text.includes(`sks_managed_id = "${role.id}"`)
79
- && text.includes(`name = "${role.codex_name}"`)
80
- && text.includes(`sandbox_mode = "${role.sandbox}"`);
81
- const legacyCompatible = text.includes(`name = "${role.codex_name}"`)
82
- && text.includes(`sandbox_mode = "${role.sandbox}"`)
83
- && text.includes('developer_instructions = """');
84
- return hasManagedMarker || legacyCompatible;
380
+ const source = normalizeManagedLegacyAgentText(text);
381
+ if (!source.startsWith(`# ${MANAGED_ASSET_MARKER}\n`))
382
+ return false;
383
+ if (!source.includes(`# sks_managed_id = "${role.id}"\n`))
384
+ return false;
385
+ return managedLegacyAgentRoleVariants(role)
386
+ .map(normalizeManagedLegacyAgentText)
387
+ .some((candidate) => source === candidate);
388
+ }
389
+ export function managedOfficialSubagentRoleBody(role) {
390
+ return [
391
+ `name = "${role.codex_name}"`,
392
+ `description = "${role.description}"`,
393
+ `model = "${role.model}"`,
394
+ `model_reasoning_effort = "${role.model_reasoning_effort}"`,
395
+ ...(role.sandbox ? [`sandbox_mode = "${role.sandbox}"`] : []),
396
+ '',
397
+ 'nickname_candidates = [',
398
+ ...role.nickname_candidates.map((nickname) => ` "${nickname}",`),
399
+ ']',
400
+ '',
401
+ 'developer_instructions = """',
402
+ role.developer_instructions,
403
+ '"""',
404
+ ''
405
+ ].join('\n');
406
+ }
407
+ export function managedOfficialSubagentRoleContent(role) {
408
+ const body = managedOfficialSubagentRoleBody(role);
409
+ return [
410
+ `# ${MANAGED_OFFICIAL_SUBAGENT_MARKER}`,
411
+ `# sks_managed_schema = ${role.schema_version}`,
412
+ `# sks_managed_id = "${role.id}"`,
413
+ `# sks_managed_body_sha256 = "${sha256(body)}"`,
414
+ '',
415
+ body
416
+ ].join('\n');
417
+ }
418
+ export function managedOfficialSubagentRoleOwnsText(text, role) {
419
+ const source = String(text || '');
420
+ if (!source.includes(`# ${MANAGED_OFFICIAL_SUBAGENT_MARKER}`))
421
+ return false;
422
+ if (!source.includes(`sks_managed_id = "${role.id}"`))
423
+ return false;
424
+ const lines = source.split('\n');
425
+ const hashIndex = lines.findIndex((line) => /^#\s*sks_managed_body_sha256\s*=/.test(line.trim()));
426
+ if (hashIndex === -1)
427
+ return false;
428
+ const expectedHash = lines[hashIndex]?.match(/^#\s*sks_managed_body_sha256\s*=\s*"([a-f0-9]{64})"\s*$/i)?.[1];
429
+ if (!expectedHash)
430
+ return false;
431
+ const separatorIndex = lines.findIndex((line, index) => index > hashIndex && line.trim() === '');
432
+ if (separatorIndex === -1)
433
+ return false;
434
+ const body = lines.slice(separatorIndex + 1).join('\n');
435
+ return sha256(body) === expectedHash;
85
436
  }
86
437
  export function normalizeRoleName(name) {
87
438
  return String(name || '').trim().replace(/\.toml$/i, '').replace(/_/g, '-').toLowerCase();
88
439
  }
89
440
  export function assertUniqueManagedAgentRoleFilenames() {
90
441
  const seen = new Map();
91
- for (const role of MANAGED_AGENT_ROLES) {
442
+ for (const role of [...MANAGED_AGENT_ROLES, ...MANAGED_OFFICIAL_SUBAGENT_ROLES]) {
92
443
  const existing = seen.get(role.filename);
93
444
  if (existing)
94
445
  throw new Error(`duplicate managed agent role filename: ${role.filename} for ${existing} and ${role.id}`);
@@ -104,11 +455,63 @@ function role(id, filename, codexName, description, sandbox, aliases) {
104
455
  codex_name: codexName,
105
456
  description,
106
457
  sandbox,
107
- permission_profile: sandbox === 'read-only' ? 'sks-readonly' : 'sks-workspace-write',
108
- legacy_sandbox_projection: sandbox,
109
458
  required_for: ['codex-native-runtime'],
110
459
  ownership_marker: MANAGED_ASSET_MARKER,
111
460
  schema_version: MANAGED_ASSET_SCHEMA_VERSION
112
461
  };
113
462
  }
463
+ function officialSubagentRole(input) {
464
+ return {
465
+ id: input.id,
466
+ filename: input.filename,
467
+ aliases: input.aliases,
468
+ codex_name: input.codexName,
469
+ description: input.description,
470
+ model: input.model,
471
+ model_reasoning_effort: 'max',
472
+ ...(input.sandbox ? { sandbox: input.sandbox } : {}),
473
+ nickname_candidates: input.nicknames,
474
+ selection_keywords: input.keywords,
475
+ developer_instructions: input.instructions,
476
+ required_for: ['codex-official-subagent-workflow'],
477
+ ownership_marker: MANAGED_OFFICIAL_SUBAGENT_MARKER,
478
+ schema_version: MANAGED_ASSET_SCHEMA_VERSION
479
+ };
480
+ }
481
+ function managedLegacyAgentRoleVariants(role) {
482
+ const base = [
483
+ `# ${MANAGED_ASSET_MARKER}`,
484
+ `# sks_managed_schema = ${role.schema_version}`,
485
+ `# sks_managed_id = "${role.id}"`,
486
+ '# sks_managed_version = "<legacy-version>"',
487
+ `name = "${role.codex_name}"`,
488
+ `description = "${role.description}"`
489
+ ];
490
+ const instructions = [
491
+ 'developer_instructions = """',
492
+ `You are the SKS ${role.id} role.`,
493
+ role.sandbox === 'read-only' ? 'Do not edit files.' : 'Only edit the bounded files assigned by the parent orchestrator.',
494
+ 'Return concise source-backed findings and LIVE_EVENT lines when applicable.',
495
+ '"""',
496
+ ''
497
+ ];
498
+ const legacyPolicy = [
499
+ `sandbox_mode = "${role.sandbox}"`,
500
+ `permission_profile = "${role.sandbox === 'read-only' ? 'sks-readonly' : 'sks-workspace-write'}"`,
501
+ `legacy_sandbox_projection = "${role.sandbox}"`
502
+ ];
503
+ return [
504
+ [...base, `sandbox_mode = "${role.sandbox}"`, ...instructions].join('\n'),
505
+ [...base, ...legacyPolicy, ...instructions].join('\n'),
506
+ [...base, 'model = "gpt-5.5"', 'model_reasoning_effort = "medium"', ...legacyPolicy, ...instructions].join('\n'),
507
+ [...base, 'model = "gpt-5.6-terra"', 'model_reasoning_effort = "high"', ...legacyPolicy, ...instructions].join('\n')
508
+ ];
509
+ }
510
+ function normalizeManagedLegacyAgentText(text) {
511
+ return String(text || '')
512
+ .replace(/\r\n?/g, '\n')
513
+ .replace(/^#\s*sks_managed_version\s*=\s*"[^"]+"\s*$/m, '# sks_managed_version = "<legacy-version>"')
514
+ .trimEnd()
515
+ .concat('\n');
516
+ }
114
517
  //# sourceMappingURL=managed-assets-manifest.js.map
@@ -21,6 +21,9 @@ export function stateFileForSession(root, sessionKey) {
21
21
  return path.join(stateSessionsDir(root), `${sessionStateKey(sessionKey)}.json`);
22
22
  }
23
23
  export async function createMission(root, { mode, prompt, sessionKey }) {
24
+ return withStateLock(root, () => createMissionUnlocked(root, { mode, prompt, sessionKey }));
25
+ }
26
+ async function createMissionUnlocked(root, { mode, prompt, sessionKey }) {
24
27
  const id = missionId();
25
28
  const dir = missionDir(root, id);
26
29
  await ensureDir(dir);
@@ -38,9 +41,26 @@ export async function createMission(root, { mode, prompt, sessionKey }) {
38
41
  };
39
42
  await writeJsonAtomic(path.join(dir, 'mission.json'), mission);
40
43
  await appendJsonl(path.join(dir, 'events.jsonl'), { ts: nowIso(), type: 'mission.created', mission: id, mode, prompt });
41
- await setCurrent(root, { mission_id: id, mode: mode.toUpperCase(), phase: mission.phase }, { replace: true, sessionKey });
44
+ await setCurrentUnlocked(root, { mission_id: id, mode: mode.toUpperCase(), phase: mission.phase }, { replace: true, sessionKey });
42
45
  return { id, dir, mission };
43
46
  }
47
+ export async function getOrCreateSessionMission(root, input) {
48
+ return withStateLock(root, async () => {
49
+ const state = await loadStateForSessionUnlocked(root, input.sessionKey);
50
+ const selectedMissionId = String(input.selectMissionId(state) || '').trim();
51
+ if (selectedMissionId) {
52
+ const loaded = await loadMission(root, selectedMissionId).catch(() => null);
53
+ if (loaded)
54
+ return { ...loaded, reused: true };
55
+ }
56
+ const created = await createMissionUnlocked(root, {
57
+ mode: input.mode,
58
+ prompt: input.prompt,
59
+ sessionKey: input.sessionKey
60
+ });
61
+ return { ...created, reused: false };
62
+ });
63
+ }
44
64
  export async function loadMission(root, id) {
45
65
  const dir = missionDir(root, id);
46
66
  const mission = await readJson(path.join(dir, 'mission.json'));
@@ -200,6 +220,9 @@ function routePreemptions(current = {}, patch = {}, opts = {}) {
200
220
  return [row, ...(Array.isArray(current?.preempted_missions) ? current.preempted_missions : [])].slice(0, 25);
201
221
  }
202
222
  export async function loadStateForSession(root, sessionKey) {
223
+ return loadStateForSessionUnlocked(root, sessionKey);
224
+ }
225
+ async function loadStateForSessionUnlocked(root, sessionKey) {
203
226
  const hashed = sessionStateKey(sessionKey || 'default');
204
227
  const file = path.join(stateSessionsDir(root), `${hashed}.json`);
205
228
  const sessionState = await readJson(file, null).catch(() => null);
@@ -38,6 +38,8 @@ export function buildNarutoWorkGraph(input = {}) {
38
38
  const basePath = normalizeNarutoPath(input.leaseBasePath || '.sneakoscope/naruto/patch-envelopes');
39
39
  const targetPaths = normalizePaths(input.targetPaths || []);
40
40
  const readonlyPaths = normalizePaths(input.readonlyPaths || []);
41
+ const readonlyPathPool = normalizePaths([...readonlyPaths, ...targetPaths]);
42
+ const promptScopes = writeCapable ? [] : extractNarutoPromptScopes(input.prompt || '', totalWorkItems);
41
43
  const worktreePolicy = input.worktreePolicy || {
42
44
  mode: 'patch-envelope-only',
43
45
  required: false,
@@ -60,9 +62,13 @@ export function buildNarutoWorkGraph(input = {}) {
60
62
  ? deliveryKind
61
63
  : baseKind;
62
64
  const kindWrites = writeCapable && isNarutoWriteKind(kind);
63
- const selectedTarget = targetPaths.length ? targetPaths[index % targetPaths.length] || targetPaths[0] || '' : `${basePath}/${id}.json`;
65
+ const selectedTarget = writeCapable
66
+ ? targetPaths.length ? targetPaths[index % targetPaths.length] || targetPaths[0] || '' : `${basePath}/${id}.json`
67
+ : '';
64
68
  const writePaths = kindWrites ? [selectedTarget].filter(Boolean) : [];
65
- const readPaths = readonlyPaths.length ? readonlyPaths : targetPaths.filter((item) => !writePaths.includes(item));
69
+ const readPaths = writeCapable
70
+ ? readonlyPaths.length ? readonlyPaths : targetPaths.filter((item) => !writePaths.includes(item))
71
+ : distributeReadonlyPaths(readonlyPathPool, index, totalWorkItems);
66
72
  const leaseRequirements = [
67
73
  ...writePaths.map((file) => ({ path: file, kind: 'write' })),
68
74
  ...readPaths.map((file) => ({ path: file, kind: 'read' }))
@@ -72,8 +78,10 @@ export function buildNarutoWorkGraph(input = {}) {
72
78
  workItems.push({
73
79
  id,
74
80
  kind,
75
- title: titleForKind(kind, id),
76
- target_paths: [...new Set([...(writePaths.length ? writePaths : [selectedTarget].filter(Boolean)), ...readPaths])],
81
+ title: promptScopes[index] ? titleForScope(promptScopes[index], index) : titleForKind(kind, id),
82
+ target_paths: writeCapable
83
+ ? [...new Set([...(writePaths.length ? writePaths : [selectedTarget].filter(Boolean)), ...readPaths])]
84
+ : readPaths,
77
85
  readonly_paths: readPaths,
78
86
  write_paths: writePaths,
79
87
  required_role: mapWorkKindToNarutoRole(kind),
@@ -224,6 +232,58 @@ function estimateCost(kind) {
224
232
  function titleForKind(kind, id) {
225
233
  return `${id} ${kind.replace(/_/g, ' ')}`;
226
234
  }
235
+ function titleForScope(scope, index) {
236
+ const compact = String(scope || '').replace(/\s+/g, ' ').trim().slice(0, 220);
237
+ return `Scope ${index + 1}: ${compact}`;
238
+ }
239
+ export function extractNarutoPromptScopes(prompt, maxItems) {
240
+ const limit = Math.max(1, normalizePositiveInt(maxItems, 1));
241
+ const text = String(prompt || '').replace(/\r/g, '').trim();
242
+ if (!text)
243
+ return [];
244
+ const label = /(?:^|\s)(?:(?:five|\d+)\s+(?:independent\s+)?slices?|다섯\s*(?:개(?:의)?)?\s*(?:독립\s*)?(?:슬라이스|영역|항목))\s*:\s*/i.exec(text);
245
+ let source = label ? text.slice((label.index || 0) + label[0].length) : text;
246
+ const numbered = (source.match(/(?:^|[\s;])\d{1,2}[.):]\s+/g) || []).length >= 2;
247
+ const bulleted = (source.match(/^\s*[-*•]\s+/gm) || []).length >= 2;
248
+ const semicolonDelimited = source.includes(';');
249
+ if (!label && !numbered && !bulleted && !semicolonDelimited)
250
+ return [];
251
+ if (!label && numbered) {
252
+ const firstMarker = /(?:^|[\s;])\d{1,2}[.):]\s+/.exec(source);
253
+ if (firstMarker)
254
+ source = source.slice(firstMarker.index);
255
+ }
256
+ else if (!label && bulleted) {
257
+ const firstBullet = /^\s*[-*•]\s+/m.exec(source);
258
+ if (firstBullet)
259
+ source = source.slice(firstBullet.index);
260
+ }
261
+ const normalized = source.replace(/\s+(?=\d{1,2}[.):]\s+)/g, '\n');
262
+ const scopes = [];
263
+ const seen = new Set();
264
+ for (const raw of normalized.split(/[;\n]+/)) {
265
+ const scope = stripNarutoScopeInstructionTail(raw
266
+ .replace(/^\s*(?:[-*•]\s+|\d{1,2}[.):]\s*)/, '')
267
+ .replace(/[;\s]+$/, '')
268
+ .replace(/\s+/g, ' ')
269
+ .trim())
270
+ .replace(/[.!?。!?]+$/, '')
271
+ .trim();
272
+ const key = scope.toLowerCase();
273
+ if (!scope || seen.has(key))
274
+ continue;
275
+ seen.add(key);
276
+ scopes.push(scope);
277
+ if (scopes.length >= limit)
278
+ break;
279
+ }
280
+ return scopes;
281
+ }
282
+ function stripNarutoScopeInstructionTail(text) {
283
+ const sentences = String(text || '').split(/(?<=[.!?。!?])\s+/).map((part) => part.trim()).filter(Boolean);
284
+ const instructionIndex = sentences.findIndex((sentence, index) => index > 0 && /^(?:inspect|review|check|verify|use|do\s+not|never|return|report|limit|only|검사|검토|확인|검증|사용|수정하지|실행하지|반환|보고|제한)/i.test(sentence));
285
+ return (instructionIndex < 0 ? text : sentences.slice(0, instructionIndex).join(' ')).trim();
286
+ }
227
287
  function normalizePositiveInt(value, fallback) {
228
288
  const parsed = Number(value);
229
289
  if (!Number.isFinite(parsed) || parsed < 1)
@@ -233,4 +293,10 @@ function normalizePositiveInt(value, fallback) {
233
293
  function normalizePaths(paths) {
234
294
  return [...new Set(paths.map(normalizeNarutoPath).filter(Boolean))];
235
295
  }
296
+ function distributeReadonlyPaths(paths, index, totalItems) {
297
+ if (!paths.length)
298
+ return [];
299
+ const assigned = paths.filter((_path, pathIndex) => pathIndex % Math.max(1, totalItems) === index);
300
+ return assigned.length ? assigned : [paths[index % paths.length]];
301
+ }
236
302
  //# sourceMappingURL=naruto-work-graph.js.map
@@ -7,6 +7,9 @@ export async function writeOpsReport(root, fileName, report) {
7
7
  if (report.ok === true && report.blockers.length > 0) {
8
8
  throw new Error(`invalid ops report: ok true with blockers in ${fileName}`);
9
9
  }
10
+ if (!/^[A-Za-z0-9._-]+\.json$/.test(fileName) || path.basename(fileName) !== fileName) {
11
+ throw new Error(`invalid ops report file name: ${fileName}`);
12
+ }
10
13
  const reportPath = path.join(root, '.sneakoscope', 'reports', fileName);
11
14
  await fs.mkdir(path.dirname(reportPath), { recursive: true });
12
15
  await fs.writeFile(reportPath, `${JSON.stringify(report, null, 2)}\n`, 'utf8');