sneakoscope 7.0.2 → 7.0.3

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 (468) hide show
  1. package/README.md +7 -5
  2. package/crates/sks-core/Cargo.lock +1 -1
  3. package/crates/sks-core/Cargo.toml +1 -1
  4. package/dist/bin/sks-dispatch.js +0 -3
  5. package/dist/cli/command-registry.js +0 -2
  6. package/dist/cli/install-helpers-codex-lb-chain.js +24 -2
  7. package/dist/cli/install-helpers-codex-lb-config.js +0 -7
  8. package/dist/cli/install-helpers-codex-lb-selftest-chain.js +0 -3
  9. package/dist/cli/install-helpers-codex-lb-selftest.js +0 -17
  10. package/dist/cli/install-helpers.js +81 -96
  11. package/dist/cli/router.js +0 -22
  12. package/dist/commands/codex-lb.js +176 -22
  13. package/dist/commands/codex.js +3 -8
  14. package/dist/commands/doctor.js +4 -14
  15. package/dist/commands/perf.js +5 -1
  16. package/dist/commands/zellij-slot-column-anchor.js +0 -2
  17. package/dist/commands/zellij-slot-pane.js +0 -7
  18. package/dist/commands/zellij.js +0 -2
  19. package/dist/config/skills-manifest.json +52 -52
  20. package/dist/core/agent-bridge/agent-manifest.js +192 -1
  21. package/dist/core/agent-bridge/agent-mode.js +0 -5
  22. package/dist/core/agent-bridge/host-capability-policy.js +189 -0
  23. package/dist/core/agent-bridge/host-capability-runtime.js +1395 -0
  24. package/dist/core/agent-bridge/mcp-server.js +1 -11
  25. package/dist/core/agents/agent-effort-policy.js +0 -3
  26. package/dist/core/agents/agent-orchestrator.js +0 -4
  27. package/dist/core/agents/agent-proof-evidence.js +0 -2
  28. package/dist/core/agents/agent-runner-ollama.js +0 -3
  29. package/dist/core/agents/agent-scheduler.js +0 -5
  30. package/dist/core/agents/native-cli-worker-runtime.js +5 -17
  31. package/dist/core/agents/work-partition/repo-inventory.js +0 -2
  32. package/dist/core/auto-review.js +0 -13
  33. package/dist/core/bench.js +0 -14
  34. package/dist/core/code-structure.js +0 -3
  35. package/dist/core/codex/agent-config-file-repair.js +0 -8
  36. package/dist/core/codex/codex-cli-update.js +122 -20
  37. package/dist/core/codex/codex-config-eperm-repair.js +0 -4
  38. package/dist/core/codex/codex-config-guard.js +0 -3
  39. package/dist/core/codex/codex-config-readability.js +0 -13
  40. package/dist/core/codex/codex-project-config-policy.js +0 -33
  41. package/dist/core/codex/official-goal-mode.js +0 -2
  42. package/dist/core/codex-app/codex-app-fast-ui-repair.js +5 -7
  43. package/dist/core/codex-app/codex-app-ui-state-snapshot.js +44 -7
  44. package/dist/core/codex-app/sks-menubar.js +0 -1
  45. package/dist/core/codex-app.js +0 -9
  46. package/dist/core/codex-compat/codex-hook-output-builders.js +9 -1
  47. package/dist/core/codex-compat/codex-hook-output-normalizer.js +1 -1
  48. package/dist/core/codex-compat/codex-hook-semantic-validator.js +3 -2
  49. package/dist/core/codex-compat/codex-hook-warning-detector.js +10 -2
  50. package/dist/core/codex-control/codex-lb-launch-recovery.js +0 -3
  51. package/dist/core/codex-control/codex-reliability-shield.js +0 -8
  52. package/dist/core/codex-control/codex-sdk-adapter.js +0 -3
  53. package/dist/core/codex-control/codex-sdk-config-policy.js +0 -2
  54. package/dist/core/codex-control/codex-sdk-env-policy.js +61 -16
  55. package/dist/core/codex-control/codex-task-runner.js +0 -7
  56. package/dist/core/codex-control/codex-thread-registry.js +0 -4
  57. package/dist/core/codex-lb/codex-lb-env.js +118 -20
  58. package/dist/core/codex-lb/codex-lb-tool-catalog.js +0 -4
  59. package/dist/core/codex-lb/codex-lb-tool-output-recovery.js +1 -1
  60. package/dist/core/codex-model-guard.js +0 -14
  61. package/dist/core/codex-native/codex-native-feature-broker.js +67 -22
  62. package/dist/core/codex-native/codex-native-interop-policy.js +81 -9
  63. package/dist/core/codex-native/confined-report-writer.js +21 -0
  64. package/dist/core/codex-native/core-skill-integrity.js +169 -20
  65. package/dist/core/codex-native/project-skill-dedupe.js +55 -13
  66. package/dist/core/codex-native/skill-registry-ledger.js +137 -16
  67. package/dist/core/codex-native/sks-skill-paths.js +185 -0
  68. package/dist/core/codex-runtime/codex-desktop-config-policy.js +0 -2
  69. package/dist/core/commands/agent-bridge-command.js +28 -8
  70. package/dist/core/commands/basic-cli.js +67 -26
  71. package/dist/core/commands/bench-command.js +5 -1
  72. package/dist/core/commands/command-utils.js +0 -5
  73. package/dist/core/commands/image-ux-review-command.js +0 -9
  74. package/dist/core/commands/mad-sks-command.js +0 -38
  75. package/dist/core/commands/naruto-command.js +46 -12
  76. package/dist/core/commands/ppt-command.js +0 -9
  77. package/dist/core/commands/run-command.js +8 -2
  78. package/dist/core/commands/seo-command.js +0 -6
  79. package/dist/core/commands/wiki-command.js +0 -14
  80. package/dist/core/computer-use-live-evidence.js +0 -5
  81. package/dist/core/config/secret-preservation.js +0 -11
  82. package/dist/core/daemon/sksd-hook-daemon-entrypoint.js +0 -2
  83. package/dist/core/daemon/sksd-hook-daemon.js +1 -29
  84. package/dist/core/daemon/sksd-hook-dispatch.js +0 -17
  85. package/dist/core/db-safety.js +0 -7
  86. package/dist/core/doctor/browser-use-repair.js +0 -2
  87. package/dist/core/doctor/doctor-codex-startup-repair.js +0 -3
  88. package/dist/core/doctor/doctor-readiness-matrix.js +12 -0
  89. package/dist/core/doctor/doctor-skill-reconcile.js +32 -0
  90. package/dist/core/doctor/imagegen-repair.js +0 -2
  91. package/dist/core/doctor/mcp-transport-collision-repair.js +0 -3
  92. package/dist/core/doctor/retired-managed-residue-private.js +0 -1
  93. package/dist/core/doctor/supabase-mcp-repair.js +0 -11
  94. package/dist/core/feature-fixture-executor.js +0 -48
  95. package/dist/core/feature-fixtures.js +0 -5
  96. package/dist/core/fsx.js +11 -12
  97. package/dist/core/hooks-runtime/code-pack-freshness-preflight.js +0 -5
  98. package/dist/core/hooks-runtime/hook-context.js +202 -0
  99. package/dist/core/hooks-runtime/hook-io.js +1 -12
  100. package/dist/core/hooks-runtime/light-turn.js +0 -2
  101. package/dist/core/hooks-runtime/naruto-decision-gate.js +4 -1
  102. package/dist/core/hooks-runtime/naruto-terminal-finalization.js +91 -0
  103. package/dist/core/hooks-runtime/official-subagent-lifecycle.js +370 -0
  104. package/dist/core/hooks-runtime/standalone-parent-host-capability.js +98 -0
  105. package/dist/core/hooks-runtime/subagent-context.js +59 -0
  106. package/dist/core/hooks-runtime/subagent-skill-availability-contract.js +29 -0
  107. package/dist/core/hooks-runtime/subagent-skill-availability-evidence.js +195 -0
  108. package/dist/core/hooks-runtime/subagent-skill-availability-guards.js +316 -0
  109. package/dist/core/hooks-runtime/subagent-skill-availability.js +217 -0
  110. package/dist/core/hooks-runtime.js +259 -535
  111. package/dist/core/image-ux-review/codex-app-generated-image-discovery.js +0 -17
  112. package/dist/core/image-ux-review/imagegen-adapter.js +0 -14
  113. package/dist/core/imagegen/imagegen-auth-readiness.js +0 -9
  114. package/dist/core/imagegen/imagegen-capability.js +0 -3
  115. package/dist/core/init/managed-skill-install.js +42 -0
  116. package/dist/core/init/skills.js +247 -74
  117. package/dist/core/init.js +15 -40
  118. package/dist/core/lean-engineering-policy.js +0 -2
  119. package/dist/core/locks/file-lock.js +0 -21
  120. package/dist/core/loops/loop-planner.js +0 -6
  121. package/dist/core/loops/loop-runtime.js +0 -1
  122. package/dist/core/loops/loop-worker-runtime.js +0 -19
  123. package/dist/core/mad-sks/executors/db-write-executor.js +0 -4
  124. package/dist/core/mad-sks/executors/executor-base.js +0 -10
  125. package/dist/core/mad-sks/immutable-harness-guard.js +0 -5
  126. package/dist/core/mad-sks/sql-plane/coordinator.js +0 -5
  127. package/dist/core/mad-sks/sql-plane/ledger.js +0 -4
  128. package/dist/core/mad-sks/sql-plane/lock.js +0 -4
  129. package/dist/core/mad-sks/sql-plane/mcp-executor.js +0 -9
  130. package/dist/core/mad-sks/sql-plane/policy-resolver.js +0 -2
  131. package/dist/core/mad-sks/sql-plane/postconditions.js +0 -4
  132. package/dist/core/mad-sks/sql-plane/recovery.js +0 -2
  133. package/dist/core/mad-sks/sql-plane/runtime-profile.js +0 -8
  134. package/dist/core/managed-assets/managed-assets-manifest.js +1 -7
  135. package/dist/core/mcp-config/health-check.js +10 -3
  136. package/dist/core/migration/migration-transaction-journal.js +0 -8
  137. package/dist/core/mission.js +0 -2
  138. package/dist/core/naruto/naruto-active-pool.js +0 -2
  139. package/dist/core/naruto/naruto-concurrency-governor.js +0 -1
  140. package/dist/core/naruto/naruto-real-write-proof.js +0 -4
  141. package/dist/core/naruto/naruto-write-e2e.js +0 -1
  142. package/dist/core/perf/perf-budget.js +0 -5
  143. package/dist/core/permission-gates.js +0 -2
  144. package/dist/core/pipeline-internals/runtime-core.js +15 -5
  145. package/dist/core/pipeline-internals/runtime-gates.js +0 -12
  146. package/dist/core/preflight/parallel-preflight-engine.js +0 -11
  147. package/dist/core/proof/evidence-collector.js +0 -2
  148. package/dist/core/proof/route-finalizer.js +0 -1
  149. package/dist/core/proof/selftest-proof-fixtures.js +0 -5
  150. package/dist/core/providers/glm/bench/glm-benchmark-runner.js +0 -2
  151. package/dist/core/providers/glm/glm-request-cache.js +0 -3
  152. package/dist/core/providers/glm/naruto/glm-naruto-command.js +0 -1
  153. package/dist/core/providers/glm/naruto/glm-naruto-decomposer.js +0 -1
  154. package/dist/core/providers/glm/naruto/glm-naruto-orchestrator.js +0 -6
  155. package/dist/core/providers/glm/naruto/glm-naruto-trace.js +0 -1
  156. package/dist/core/providers/glm/naruto/glm-naruto-worker-pool.js +0 -1
  157. package/dist/core/providers/glm/naruto/glm-naruto-worktree.js +0 -1
  158. package/dist/core/providers/openrouter/openrouter-secret-store.js +0 -1
  159. package/dist/core/providers/openrouter/openrouter-stream.js +0 -2
  160. package/dist/core/questions.js +3 -3
  161. package/dist/core/release/gate-manifest.js +0 -5
  162. package/dist/core/release/package-size-budget.js +1 -1
  163. package/dist/core/release/release-gate-batch-runner.js +11 -2
  164. package/dist/core/release/release-gate-cache-v2.js +0 -4
  165. package/dist/core/release/release-gate-hermetic-env.js +0 -5
  166. package/dist/core/release-parallel-full-coverage.js +0 -2
  167. package/dist/core/remote/ssh-worker-client.js +0 -3
  168. package/dist/core/research/research-adversarial-review.js +6 -2
  169. package/dist/core/responses-retry-policy.js +0 -10
  170. package/dist/core/retention.js +0 -7
  171. package/dist/core/routes/constants.js +0 -3
  172. package/dist/core/routes.js +89 -15
  173. package/dist/core/safety/command-contract/contracts.js +2 -0
  174. package/dist/core/safety/mutation-guard.js +0 -25
  175. package/dist/core/safety/mutation-ledger.js +0 -9
  176. package/dist/core/safety/requested-scope-contract.js +0 -0
  177. package/dist/core/security/high-risk-contracts.js +0 -1
  178. package/dist/core/skills/core-skill-card.js +0 -0
  179. package/dist/core/skills/core-skill-deployment.js +0 -13
  180. package/dist/core/skills/core-skill-epoch.js +0 -11
  181. package/dist/core/skills/core-skill-meta-update.js +0 -6
  182. package/dist/core/skills/core-skill-patch-apply.js +0 -7
  183. package/dist/core/skills/core-skill-patch.js +0 -8
  184. package/dist/core/skills/core-skill-reflection.js +0 -16
  185. package/dist/core/skills/core-skill-runtime.js +0 -6
  186. package/dist/core/skills/core-skill-scorer.js +0 -7
  187. package/dist/core/skills/core-skill-trainer.js +0 -11
  188. package/dist/core/skills/core-skill-types.js +0 -9
  189. package/dist/core/skills/core-skill-validation.js +0 -5
  190. package/dist/core/skills/rejected-skill-patch-buffer.js +0 -2
  191. package/dist/core/stop-gate/stop-gate-check.js +0 -8
  192. package/dist/core/stop-gate/stop-gate-resolver.js +0 -7
  193. package/dist/core/stop-gate/stop-gate-writer.js +0 -5
  194. package/dist/core/subagents/model-policy.js +0 -7
  195. package/dist/core/subagents/naruto-help-contract.js +1 -1
  196. package/dist/core/subagents/naruto-proof-projection.js +580 -12
  197. package/dist/core/subagents/official-subagent-config.js +0 -8
  198. package/dist/core/subagents/official-subagent-preparation.js +6 -5
  199. package/dist/core/subagents/official-subagent-prompt.js +29 -0
  200. package/dist/core/subagents/official-subagent-runner.js +343 -37
  201. package/dist/core/subagents/subagent-evidence.js +378 -9
  202. package/dist/core/subagents/thread-budget.js +5 -2
  203. package/dist/core/subagents/triwiki-attention.js +0 -4
  204. package/dist/core/subagents/wave-parent-guidance.js +54 -9
  205. package/dist/core/telegram/runtime.js +0 -1
  206. package/dist/core/triwiki/code-index-scanner.js +0 -3
  207. package/dist/core/triwiki/code-pack-head-freshness.js +0 -10
  208. package/dist/core/triwiki/code-pack.js +0 -2
  209. package/dist/core/triwiki/triwiki-cache-key.js +0 -1
  210. package/dist/core/triwiki/triwiki-proof-bank.js +0 -1
  211. package/dist/core/triwiki-attention.js +0 -10
  212. package/dist/core/triwiki-provenance.js +0 -5
  213. package/dist/core/triwiki-runtime.js +0 -12
  214. package/dist/core/triwiki-wrongness/wrongness-ledger.js +0 -7
  215. package/dist/core/triwiki-wrongness/wrongness-schema.js +0 -3
  216. package/dist/core/trust-kernel/trust-report.js +0 -7
  217. package/dist/core/update/update-migration-state.js +21 -39
  218. package/dist/core/update-check.js +2 -14
  219. package/dist/core/version-manager.js +2 -0
  220. package/dist/core/version.js +1 -1
  221. package/dist/core/work-order-ledger.js +0 -17
  222. package/dist/core/zellij/zellij-clipboard-config.js +0 -18
  223. package/dist/core/zellij/zellij-lane-renderer.js +5 -46
  224. package/dist/core/zellij/zellij-lane-runtime.js +0 -1
  225. package/dist/core/zellij/zellij-launcher.js +0 -26
  226. package/dist/core/zellij/zellij-official-subagent-activity.js +0 -5
  227. package/dist/core/zellij/zellij-official-subagent-telemetry.js +0 -5
  228. package/dist/core/zellij/zellij-screen-proof.js +0 -7
  229. package/dist/core/zellij/zellij-slot-column-anchor.js +0 -1
  230. package/dist/core/zellij/zellij-slot-pane-renderer.js +0 -9
  231. package/dist/core/zellij/zellij-slot-telemetry.js +0 -12
  232. package/dist/core/zellij/zellij-ui-mode.js +0 -7
  233. package/dist/core/zellij/zellij-update.js +0 -29
  234. package/dist/core/zellij/zellij-worker-pane-manager.js +0 -39
  235. package/dist/native/sks-menubar/Sources/ProvidersViewController.swift +213 -27
  236. package/dist/native/sks-menubar/Sources/UpdatesViewController.swift +95 -12
  237. package/dist/scripts/agent-message-bus-reader-check.js +0 -1
  238. package/dist/scripts/all-feature-deep-completion-check.js +0 -1
  239. package/dist/scripts/appshots-thread-attachment-discovery-check.js +0 -1
  240. package/dist/scripts/architecture-guard-check.js +0 -1
  241. package/dist/scripts/build-dist.js +0 -1
  242. package/dist/scripts/build-once-runner-check.js +0 -1
  243. package/dist/scripts/canonical-test-runner.js +0 -2
  244. package/dist/scripts/certificate-sla-check.js +0 -1
  245. package/dist/scripts/changelog-check.js +0 -1
  246. package/dist/scripts/check-cli-entrypoint.js +0 -1
  247. package/dist/scripts/check-command-module-budget.js +0 -7
  248. package/dist/scripts/check-feature-quality.js +0 -1
  249. package/dist/scripts/check-legacy-free.js +0 -1
  250. package/dist/scripts/check-pipeline-runtime.js +0 -1
  251. package/dist/scripts/check-runtime-schemas.js +0 -1
  252. package/dist/scripts/codex-0-134-runner-truth-check.js +0 -1
  253. package/dist/scripts/codex-0-137-compat-check.js +0 -1
  254. package/dist/scripts/codex-0138-capability-artifact-check.js +0 -1
  255. package/dist/scripts/codex-0138-capability-check.js +0 -1
  256. package/dist/scripts/codex-0138-doctor-check.js +0 -1
  257. package/dist/scripts/codex-0138-feature-probes-check.js +0 -1
  258. package/dist/scripts/codex-0144-core-real-probes-check.js +0 -1
  259. package/dist/scripts/codex-app-handoff-check.js +0 -1
  260. package/dist/scripts/codex-app-handoff-launch-check.js +0 -1
  261. package/dist/scripts/codex-config-load-probe.js +0 -5
  262. package/dist/scripts/codex-control-all-pipelines-check.js +0 -1
  263. package/dist/scripts/codex-control-event-stream-ledger-check.js +0 -1
  264. package/dist/scripts/codex-control-tool-output-continuity-audit-check.js +0 -1
  265. package/dist/scripts/codex-permission-profiles-check.js +0 -1
  266. package/dist/scripts/codex-plugin-app-template-policy-check.js +0 -1
  267. package/dist/scripts/codex-project-config-policy-splitter-check.js +0 -1
  268. package/dist/scripts/codex-sdk-all-pipelines-check.js +0 -1
  269. package/dist/scripts/codex-sdk-backend-router-check.js +0 -1
  270. package/dist/scripts/codex-sdk-capability-check.js +0 -1
  271. package/dist/scripts/codex-sdk-event-stream-ledger-check.js +0 -1
  272. package/dist/scripts/codex-sdk-real-smoke-check.js +0 -1
  273. package/dist/scripts/concurrent-session-collision-check.js +9 -0
  274. package/dist/scripts/context7-evidence-dedupe-check.js +0 -1
  275. package/dist/scripts/core-skill-card-schema-check.js +0 -11
  276. package/dist/scripts/core-skill-deployment-snapshot-check.js +0 -10
  277. package/dist/scripts/core-skill-heldout-validation-check.js +0 -11
  278. package/dist/scripts/core-skill-no-inference-optimizer-check.js +0 -11
  279. package/dist/scripts/core-skill-patch-check.js +0 -11
  280. package/dist/scripts/core-skill-route-runtime-integration-check.js +0 -11
  281. package/dist/scripts/current-surface-update-e2e-check.js +0 -4
  282. package/dist/scripts/current-upgrade-matrix-check.js +0 -1
  283. package/dist/scripts/dfix-fixture-check.js +0 -1
  284. package/dist/scripts/dfix-patch-handoff-check.js +0 -1
  285. package/dist/scripts/dfix-verification-check.js +0 -1
  286. package/dist/scripts/dfix-verification-recommendation-check.js +0 -1
  287. package/dist/scripts/docs-truthfulness-check.js +3 -3
  288. package/dist/scripts/doctor-fastpath-check.js +0 -1
  289. package/dist/scripts/doctor-fix-proves-codex-read-check.js +0 -11
  290. package/dist/scripts/doctor-fixes-codex-app-fast-ui-check.js +0 -4
  291. package/dist/scripts/doctor-idempotence-check.js +0 -1
  292. package/dist/scripts/doctor-ops-semantics-check.js +0 -1
  293. package/dist/scripts/ensure-bin-executable.js +0 -1
  294. package/dist/scripts/evidence-flagship-coverage-check.js +0 -1
  295. package/dist/scripts/fast-codex-service-tier-proof-check.js +0 -1
  296. package/dist/scripts/fixtures/fake-codex-config-loader.js +0 -5
  297. package/dist/scripts/fsx-hotpath-check.js +0 -1
  298. package/dist/scripts/gate-policy-audit-check.js +1 -1
  299. package/dist/scripts/geo-claim-evidence-check.js +0 -1
  300. package/dist/scripts/geo-cli-blackbox-check.js +0 -1
  301. package/dist/scripts/geo-crawler-policy-check.js +0 -1
  302. package/dist/scripts/git-worktree-diff-envelope-check.js +0 -1
  303. package/dist/scripts/git-worktree-dirty-lock-check.js +0 -1
  304. package/dist/scripts/git-worktree-dirty-main-detection-check.js +0 -1
  305. package/dist/scripts/git-worktree-integration-primary-check.js +0 -1
  306. package/dist/scripts/git-worktree-manifest-append-check.js +0 -1
  307. package/dist/scripts/git-worktree-untracked-diff-check.js +0 -1
  308. package/dist/scripts/high-risk-contracts-check.js +0 -1
  309. package/dist/scripts/hook-latency-budget-check.js +0 -1
  310. package/dist/scripts/hook-latency-quantum-check.js +0 -1
  311. package/dist/scripts/image-artifact-path-contract-check.js +0 -1
  312. package/dist/scripts/imagegen-real-smoke-check.js +0 -1
  313. package/dist/scripts/import-graph-budget-check.js +0 -1
  314. package/dist/scripts/installed-package-smoke-check.js +0 -1
  315. package/dist/scripts/legacy-gate-purge-check.js +0 -1
  316. package/dist/scripts/lib/codex-sdk-gate-lib.js +0 -3
  317. package/dist/scripts/lib/ensure-dist-fresh.js +0 -1
  318. package/dist/scripts/lib/valid-png-fixture.js +0 -1
  319. package/dist/scripts/local-collab-all-pipelines-final-gpt-check.js +0 -1
  320. package/dist/scripts/loop-directive-check-lib.js +0 -1
  321. package/dist/scripts/loop-worker-fixture-child.js +0 -1
  322. package/dist/scripts/mad-preflight-blocks-unreadable-config-check.js +0 -10
  323. package/dist/scripts/mad-sks-sql-plane-lifecycle-hook-decision-check.js +0 -1
  324. package/dist/scripts/mad-sks-sql-plane-result-lifecycle-check.js +0 -1
  325. package/dist/scripts/mcp-plugin-inventory-check.js +0 -1
  326. package/dist/scripts/mcp-tool-naming-parity-check.js +0 -1
  327. package/dist/scripts/model-call-concurrency-check.js +0 -1
  328. package/dist/scripts/mutation-callsite-coverage-check.js +0 -5
  329. package/dist/scripts/naruto-codex-e2e-check.js +0 -1
  330. package/dist/scripts/naruto-worktree-coding-blackbox.js +0 -1
  331. package/dist/scripts/official-subagent-workflow-check.js +3 -1
  332. package/dist/scripts/ops-diagnostics-bundle-check.js +0 -1
  333. package/dist/scripts/packlist-performance-check.js +1 -3
  334. package/dist/scripts/perf-budget-check.js +0 -1
  335. package/dist/scripts/ppt-full-e2e-blackbox-check.js +0 -1
  336. package/dist/scripts/ppt-real-export-adapter-check.js +0 -1
  337. package/dist/scripts/ppt-real-imagegen-smoke-check.js +0 -1
  338. package/dist/scripts/ppt-real-imagegen-wiring-check.js +0 -1
  339. package/dist/scripts/ppt-reexport-rereview-check.js +0 -1
  340. package/dist/scripts/prepublish-fast-check.js +0 -23
  341. package/dist/scripts/prepublish-release-check-or-fast.js +0 -7
  342. package/dist/scripts/probe-memoization-check.js +0 -1
  343. package/dist/scripts/product-design-plugin-routing-check.js +0 -1
  344. package/dist/scripts/project-skill-dedupe-blackbox.js +36 -9
  345. package/dist/scripts/prompt-placeholder-guard-check.js +0 -1
  346. package/dist/scripts/python-codex-sdk-all-pipelines-check.js +0 -3
  347. package/dist/scripts/qa-loop-app-handoff-capability-check.js +0 -1
  348. package/dist/scripts/qa-loop-app-handoff-check.js +0 -1
  349. package/dist/scripts/qa-loop-app-handoff-cli-check.js +0 -1
  350. package/dist/scripts/qa-loop-app-handoff-confirmation-check.js +0 -1
  351. package/dist/scripts/qa-loop-app-handoff-gate-lifecycle-check.js +0 -1
  352. package/dist/scripts/qa-loop-app-handoff-launch-check.js +0 -1
  353. package/dist/scripts/qa-loop-app-handoff-status-lifecycle-check.js +0 -1
  354. package/dist/scripts/qa-loop-budget-policy-check.js +0 -1
  355. package/dist/scripts/qa-loop-effort-escalation-check.js +0 -1
  356. package/dist/scripts/qa-loop-image-path-exposure-check.js +0 -1
  357. package/dist/scripts/qa-loop-image-path-prompt-injection-check.js +0 -1
  358. package/dist/scripts/release-cache-glob-hashing-check.js +0 -1
  359. package/dist/scripts/release-cache-input-classifier-check.js +0 -1
  360. package/dist/scripts/release-cache-neutralization-report-check.js +0 -1
  361. package/dist/scripts/release-cache-version-neutral-fixture-check.js +0 -1
  362. package/dist/scripts/release-check-stamp.js +0 -4
  363. package/dist/scripts/release-dist-freshness-check.js +0 -1
  364. package/dist/scripts/release-full-parallelism-blackbox.js +3 -3
  365. package/dist/scripts/release-gate-batch-runner-check.js +22 -0
  366. package/dist/scripts/release-gate-budget-check.js +0 -6
  367. package/dist/scripts/release-gate-dag-runner-check.js +0 -1
  368. package/dist/scripts/release-latency-slo-check.js +0 -1
  369. package/dist/scripts/release-metadata-1-19-check.js +0 -1
  370. package/dist/scripts/release-metadata-check.js +0 -3
  371. package/dist/scripts/release-parallel-speed-budget-check.js +0 -5
  372. package/dist/scripts/release-proof-truth-check.js +0 -1
  373. package/dist/scripts/release-provenance-check.js +0 -1
  374. package/dist/scripts/release-real-check.js +0 -1
  375. package/dist/scripts/release-runtime-truth-matrix-check.js +0 -1
  376. package/dist/scripts/release-version-truth-check.js +0 -1
  377. package/dist/scripts/research-blueprint-densifier-check.js +0 -1
  378. package/dist/scripts/research-claim-builder-check.js +0 -1
  379. package/dist/scripts/research-complete-package-fixture-check.js +0 -1
  380. package/dist/scripts/research-final-reviewer-blackbox.js +0 -1
  381. package/dist/scripts/responses-retry-policy-centralized-check.js +0 -1
  382. package/dist/scripts/retention-apply-smoke-check.js +0 -1
  383. package/dist/scripts/retention-budget-check.js +0 -1
  384. package/dist/scripts/retention-dry-run-check.js +0 -1
  385. package/dist/scripts/rollback-recovery-smoke-check.js +0 -1
  386. package/dist/scripts/route-intent-regression-check.js +0 -1
  387. package/dist/scripts/runtime-current-terminal-check.js +0 -1
  388. package/dist/scripts/runtime-dist-parity-check.js +0 -1
  389. package/dist/scripts/runtime-no-src-mjs-check.js +0 -1
  390. package/dist/scripts/runtime-proof-summary-check.js +0 -1
  391. package/dist/scripts/runtime-ts-rust-boundary-check.js +0 -15
  392. package/dist/scripts/runtime-ts-source-of-truth-check.js +0 -1
  393. package/dist/scripts/scheduler-batch-dispatch-check.js +0 -1
  394. package/dist/scripts/scheduler-parallel-proof-consistency-check.js +0 -1
  395. package/dist/scripts/scheduler-utilization-integral-check.js +0 -1
  396. package/dist/scripts/search-visibility-gate-lib.js +0 -1
  397. package/dist/scripts/seo-audit-fixture-check.js +0 -1
  398. package/dist/scripts/seo-cli-blackbox-check.js +0 -1
  399. package/dist/scripts/seo-geo-geo-disambiguation-check.js +0 -1
  400. package/dist/scripts/seo-geo-route-identity-check.js +0 -1
  401. package/dist/scripts/seo-geo-skill-rich-content-check.js +0 -1
  402. package/dist/scripts/seo-marketing-truthfulness-check.js +0 -1
  403. package/dist/scripts/seo-metadata-sync-check.js +0 -1
  404. package/dist/scripts/seo-no-mutation-by-default-check.js +0 -1
  405. package/dist/scripts/shared-memory-fixture-check.js +0 -1
  406. package/dist/scripts/side-effect-runtime-report-check.js +0 -1
  407. package/dist/scripts/sizecheck.js +0 -1
  408. package/dist/scripts/sks-1-11-gate-lib.js +0 -1
  409. package/dist/scripts/sks-1-12-real-execution-check-lib.js +0 -1
  410. package/dist/scripts/sks-1-18-gate-lib.js +0 -1
  411. package/dist/scripts/sks-menubar-install-check.js +0 -3
  412. package/dist/scripts/sksd-daemon-check.js +0 -1
  413. package/dist/scripts/super-search-live-smoke-check.js +0 -1
  414. package/dist/scripts/super-search-local-http-smoke-check.js +0 -1
  415. package/dist/scripts/super-search-offline-contract-check.js +0 -1
  416. package/dist/scripts/super-search-provider-interface-check.js +0 -1
  417. package/dist/scripts/triwiki-cache-key-check.js +0 -1
  418. package/dist/scripts/triwiki-proof-bank-blackbox.js +0 -1
  419. package/dist/scripts/triwiki-proof-bank-check.js +0 -1
  420. package/dist/scripts/triwiki-proof-card-check.js +0 -1
  421. package/dist/scripts/trust-fixture-check.js +0 -1
  422. package/dist/scripts/ultra-router-auto-router-check.js +0 -1
  423. package/dist/scripts/update-fastpath-check.js +0 -1
  424. package/dist/scripts/upgrade-migration-matrix-check.js +0 -1
  425. package/dist/scripts/ux-review-extract-wires-real-extractor-check.js +0 -1
  426. package/dist/scripts/ux-review-imagegen-blackbox-check.js +0 -1
  427. package/dist/scripts/ux-review-patch-diff-recheck-check.js +0 -1
  428. package/dist/scripts/ux-review-real-imagegen-smoke-check.js +0 -1
  429. package/dist/scripts/ux-review-run-wires-imagegen-check.js +0 -1
  430. package/dist/scripts/write-build-manifest.js +0 -1
  431. package/dist/scripts/wrongness-fixture-check.js +0 -1
  432. package/dist/scripts/zellij-capability-check.js +0 -1
  433. package/dist/scripts/zellij-developer-controls-check.js +0 -1
  434. package/dist/scripts/zellij-doctor-readiness-check.js +0 -13
  435. package/dist/scripts/zellij-dynamic-pane-lifecycle-check.js +0 -1
  436. package/dist/scripts/zellij-fake-adapter-check.js +0 -1
  437. package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -1
  438. package/dist/scripts/zellij-lane-renderer-check.js +0 -1
  439. package/dist/scripts/zellij-launch-command-truth-check.js +0 -12
  440. package/dist/scripts/zellij-layout-valid-check.js +0 -1
  441. package/dist/scripts/zellij-pane-creation-lock-metrics-check.js +0 -1
  442. package/dist/scripts/zellij-pane-lock-concurrency-blackbox.js +0 -1
  443. package/dist/scripts/zellij-pane-lock-does-not-block-worker-check.js +0 -1
  444. package/dist/scripts/zellij-pane-lock-open-worker-integration-blackbox.js +0 -1
  445. package/dist/scripts/zellij-pane-proof-check.js +0 -1
  446. package/dist/scripts/zellij-qa-app-handoff-status-check.js +0 -1
  447. package/dist/scripts/zellij-real-session-cleanup-check.js +0 -1
  448. package/dist/scripts/zellij-real-session-launch-check.js +0 -1
  449. package/dist/scripts/zellij-right-column-geometry-proof.js +0 -1
  450. package/dist/scripts/zellij-right-column-headless-overflow-check.js +0 -1
  451. package/dist/scripts/zellij-right-column-manager-check.js +0 -1
  452. package/dist/scripts/zellij-screen-proof-check.js +0 -1
  453. package/dist/scripts/zellij-slot-only-ui-check.js +0 -1
  454. package/dist/scripts/zellij-slot-pane-renderer-check.js +0 -1
  455. package/dist/scripts/zellij-slot-pane-stale-detection-check.js +0 -7
  456. package/dist/scripts/zellij-slot-telemetry-incremental-check.js +0 -1
  457. package/dist/scripts/zellij-slot-telemetry-live-flush-check.js +0 -1
  458. package/dist/scripts/zellij-slot-telemetry-performance-check.js +0 -1
  459. package/dist/scripts/zellij-stacked-capability-routing-check.js +0 -1
  460. package/dist/scripts/zellij-stacked-fallback-integration-blackbox.js +0 -1
  461. package/dist/scripts/zellij-stacked-version-matrix-check.js +0 -1
  462. package/dist/scripts/zellij-stacked-version-parser-check.js +0 -1
  463. package/dist/scripts/zellij-ui-design-check.js +0 -12
  464. package/dist/scripts/zellij-update-prompt-matrix-check.js +0 -1
  465. package/dist/scripts/zellij-update-prompt-mode-check.js +0 -1
  466. package/dist/scripts/zellij-update-prompt-safety-check.js +0 -1
  467. package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -2
  468. package/package.json +1 -1
@@ -10,12 +10,6 @@ export const DEFAULT_OFFICIAL_SUBAGENT_MAX_DEPTH = 1;
10
10
  export const DEFAULT_OFFICIAL_SUBAGENT_JOB_MAX_RUNTIME_SECONDS = 1200;
11
11
  export const DEFAULT_OFFICIAL_SUBAGENT_INTERRUPT_MESSAGE = true;
12
12
  export const LEGACY_SKS_MAX_THREAD_VALUES = Object.freeze([4, 5, 6]);
13
- /**
14
- * Merge the project-scoped Codex [agents] defaults without overriding explicit
15
- * project or inherited global values. Legacy 4/5/6 values migrate only when a
16
- * caller supplies concrete SKS ownership evidence (for example the generated
17
- * file inventory from the previous project manifest).
18
- */
19
13
  export function mergeOfficialSubagentConfig(text = '', opts = {}) {
20
14
  const source = String(text || '');
21
15
  if (!inspectToml(source).ok)
@@ -58,8 +52,6 @@ export async function readOfficialSubagentConfig(root, opts = {}) {
58
52
  const maxDepth = resolveLayeredValue(projectLayer.agents.max_depth, globalLayer.agents.max_depth, DEFAULT_OFFICIAL_SUBAGENT_MAX_DEPTH, positiveInteger);
59
53
  const jobMaxRuntimeSeconds = resolveLayeredValue(projectLayer.agents.job_max_runtime_seconds, globalLayer.agents.job_max_runtime_seconds, DEFAULT_OFFICIAL_SUBAGENT_JOB_MAX_RUNTIME_SECONDS, positiveInteger);
60
54
  const interruptMessage = resolveLayeredValue(projectLayer.agents.interrupt_message, globalLayer.agents.interrupt_message, DEFAULT_OFFICIAL_SUBAGENT_INTERRUPT_MESSAGE, booleanValue);
61
- // Official Naruto admits only depth=1. Coerce higher values so they cannot
62
- // contradict the launcher hard-enforcement or look "supported".
63
55
  const depthCoerced = maxDepth.value > 1;
64
56
  const warnings = depthCoerced
65
57
  ? [`official_subagent_max_depth_coerced_to_one:${maxDepth.value}:${maxDepth.source}`]
@@ -16,6 +16,7 @@ import { SUBAGENT_EVIDENCE_FILENAME, SUBAGENT_EVENT_LOG_FILENAME, SUBAGENT_PAREN
16
16
  import { sksPrefixedDollarCommand, unprefixedSksSkillName } from '../routes/dollar-prefix.js';
17
17
  import { withFileLock, tryWithFileLock } from '../locks/file-lock.js';
18
18
  import { updateCurrentIfMissionAndRun } from '../mission.js';
19
+ import { HOST_CAPABILITY_HOOK_EVIDENCE_FILENAME, HOST_CAPABILITY_HOOK_OBSERVATIONS_FILENAME, HOST_CAPABILITY_HOOK_PENDING_RUNTIME_FILENAME, HOST_CAPABILITY_HOOK_RUNTIME_FILENAME } from '../agent-bridge/host-capability-runtime.js';
19
20
  export const NARUTO_RESULT_SCHEMA = 'sks.naruto-subagent-workflow.v1';
20
21
  export const SUBAGENT_PLAN_FILENAME = 'subagent-plan.json';
21
22
  export const NARUTO_SUMMARY_FILENAME = 'naruto-summary.json';
@@ -128,8 +129,6 @@ async function prepareOfficialSubagentMissionLocked(input) {
128
129
  });
129
130
  return [name, {
130
131
  ...config,
131
- // Catalog TOML remains the spawn-type contract; dynamic decision records why
132
- // this role maps onto the sealed four-profile matrix for this goal.
133
132
  routed_model: decision.model,
134
133
  routed_model_reasoning_effort: decision.model_reasoning_effort,
135
134
  routed_model_policy: decision.model_selection_reason,
@@ -379,7 +378,11 @@ function officialSubagentPreparationTombstoneInventory(mode) {
379
378
  'completion-proof.md',
380
379
  'evidence-index.json',
381
380
  'route-completion-contract.json',
382
- 'trust-report.json'
381
+ 'trust-report.json',
382
+ HOST_CAPABILITY_HOOK_PENDING_RUNTIME_FILENAME,
383
+ HOST_CAPABILITY_HOOK_RUNTIME_FILENAME,
384
+ HOST_CAPABILITY_HOOK_OBSERVATIONS_FILENAME,
385
+ HOST_CAPABILITY_HOOK_EVIDENCE_FILENAME
383
386
  ]
384
387
  : [])
385
388
  ];
@@ -937,8 +940,6 @@ function narutoEventRunIds(value) {
937
940
  }
938
941
  }
939
942
  catch {
940
- // A torn incomplete line is not an identity claim. The admitted owner
941
- // may reset it only after the live/terminal checks above pass.
942
943
  }
943
944
  }
944
945
  return uniqueStrings(values);
@@ -64,6 +64,16 @@ Parent agent:
64
64
  - owns decomposition, integration, and final answer
65
65
  - do not do duplicate work already delegated
66
66
 
67
+ Host capability policy:
68
+ - use a host tool only when it is actually available in the project MCP inventory; do not infer availability from config text or duplicate host tool schemas
69
+ - SQL-generation-only requests: call \`datasource_schema_context\` first, use only reported tables and columns, and may complete without \`datasource_query_readonly\`
70
+ - actual data retrieval: call \`datasource_schema_context\`, generate one bounded parameterized SELECT/CTE, call \`datasource_query_readonly\`, and retain its receipt
71
+ - spreadsheet create: \`spreadsheet_create\` -> \`spreadsheet_inspect\` -> optional one minimal \`spreadsheet_update\` -> \`spreadsheet_inspect\`
72
+ - spreadsheet edit: \`spreadsheet_inspect\` -> one minimal \`spreadsheet_update\` -> \`spreadsheet_inspect\`
73
+ - document delivery: editable source -> render -> artifact receipt
74
+ - when a requested host capability is missing or unhealthy, return blocked proof; do not fabricate a fallback or success evidence
75
+ - Slack delivery belongs to the ACAS runtime and is never a model tool
76
+
67
77
  Subagent rules:
68
78
  - use only Codex official subagent threads; do not launch shell workers, a custom scheduler, a worker pool, or model fanout
69
79
  - select the narrowest matching project custom agent by its description; the custom agent name is the spawn type
@@ -133,10 +143,29 @@ Final parent output:
133
143
  "verification": [
134
144
  { "name": "focused check", "status": "passed|not_applicable", "reason": "required when not_applicable" }
135
145
  ],
146
+ "artifacts": [
147
+ {
148
+ "path": "workspace-relative/verified-output.xlsx",
149
+ "kind": "spreadsheet",
150
+ "media_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
151
+ "sha256": "sha256:<64 lowercase hex>",
152
+ "bytes": 1,
153
+ "role": "deliverable|scratch|temp|log"
154
+ }
155
+ ],
156
+ "capabilities_used": [
157
+ {
158
+ "id": "declared host capability id",
159
+ "status": "passed|failed",
160
+ "tool_names": ["actually called host tool"],
161
+ "receipt_sha256": "sha256:<64 lowercase hex>"
162
+ }
163
+ ],
136
164
  "blockers": []
137
165
  }
138
166
  - include one thread_outcomes row for every requested subagent; a SubagentStop event alone never proves success
139
167
  - if changed_files is non-empty, include at least one passed named check or a specifically justified not_applicable verification row
168
+ - use empty artifacts/capabilities_used arrays when no host capability was used; SKS overwrites these fields with observed Codex JSONL evidence before persistence
140
169
  - keep completion summary and Honest Mode wording inside the JSON fields; do not add prose outside the object
141
170
  `.trim();
142
171
  }
@@ -1,10 +1,13 @@
1
1
  import fsp from 'node:fs/promises';
2
2
  import os from 'node:os';
3
3
  import path from 'node:path';
4
- import { runProcess } from '../fsx.js';
4
+ import { randomId, runProcess, writeJsonAtomic } from '../fsx.js';
5
+ import { missionDir } from '../mission.js';
5
6
  import { NARUTO_PARENT_EFFORT, NARUTO_PARENT_MODEL } from './model-policy.js';
6
7
  import { inspectCodexLbCliLaunchRecovery } from '../codex-control/codex-lb-launch-recovery.js';
7
8
  import { resolveOfficialCodexPackageRuntime } from '../codex-runtime/resolve-codex-runtime.js';
9
+ import { withFileLock } from '../locks/file-lock.js';
10
+ import { HOST_CAPABILITY_HOOK_PENDING_RUNTIME_FILENAME, HOST_CAPABILITY_MCP_SERVER, createHostCapabilityHookPendingRuntime, createHostCapabilityEventCollector, hostCapabilityCodexConfigArgs, inspectHostCapabilityRuntime, requestHostCapabilities } from '../agent-bridge/host-capability-runtime.js';
8
11
  export const OFFICIAL_SUBAGENT_WORKFLOW_SCHEMA = 'sks.subagent-workflow.v1';
9
12
  const OFFICIAL_SUBAGENT_CHILD_ENV_ALLOWLIST = Object.freeze([
10
13
  'HOME',
@@ -73,12 +76,16 @@ export function codexAppSessionKey(env = process.env) {
73
76
  export function buildOfficialSubagentCodexArgs(input) {
74
77
  return [
75
78
  'exec',
79
+ '--json',
80
+ ...(input.workingDirectory ? ['-C', input.workingDirectory] : []),
76
81
  '-m', NARUTO_PARENT_MODEL,
77
82
  '-c', `model_reasoning_effort="${NARUTO_PARENT_EFFORT}"`,
78
83
  '-c', 'model_provider="openai"',
79
84
  '-c', 'forced_login_method="chatgpt"',
80
85
  '-c', `agents.max_threads=${Math.max(1, Math.floor(input.maxThreads))}`,
81
86
  '-c', 'agents.max_depth=1',
87
+ ...(input.projectConfigArgs || []),
88
+ ...(input.hostCapabilityConfigArgs || []),
82
89
  '--output-last-message', input.parentSummaryFile,
83
90
  input.prompt
84
91
  ];
@@ -94,8 +101,84 @@ export function buildOfficialSubagentChildEnv(input = {}) {
94
101
  childEnv.SKS_NARUTO_PARENT_LAUNCH = '1';
95
102
  if (input.missionId)
96
103
  childEnv.SKS_NARUTO_PARENT_MISSION_ID = input.missionId;
104
+ if (input.workflowRunId)
105
+ childEnv.SKS_NARUTO_PARENT_WORKFLOW_RUN_ID = input.workflowRunId;
106
+ if (input.hostCapabilityLaunchNonce) {
107
+ childEnv.SKS_NARUTO_PARENT_HOST_CAPABILITY_NONCE = input.hostCapabilityLaunchNonce;
108
+ }
97
109
  return childEnv;
98
110
  }
111
+ export function hostCapabilityProjectCodexConfigArgs(input) {
112
+ const trustLevel = input.projectTrusted ? 'trusted' : 'untrusted';
113
+ return [
114
+ '-c', `projects={${JSON.stringify(input.canonicalRoot)}={trust_level="${trustLevel}"}}`,
115
+ ...(!input.projectTrusted && input.globalHostCapabilityConfigured
116
+ ? ['-c', `mcp_servers.${HOST_CAPABILITY_MCP_SERVER}.enabled=false`]
117
+ : [])
118
+ ];
119
+ }
120
+ async function inspectConfiguredGlobalHostCapabilityServer(input) {
121
+ const result = await runProcess(input.codexCommand, [
122
+ '-C', input.canonicalRoot,
123
+ ...hostCapabilityProjectCodexConfigArgs({
124
+ canonicalRoot: input.canonicalRoot,
125
+ projectTrusted: false
126
+ }),
127
+ 'mcp', 'list', '--json'
128
+ ], {
129
+ cwd: input.canonicalRoot,
130
+ timeoutMs: 10_000,
131
+ maxOutputBytes: 1024 * 1024,
132
+ env: input.env,
133
+ envMode: 'replace'
134
+ }).catch(() => null);
135
+ if (!result || result.code !== 0 || result.timedOut || result.truncated) {
136
+ return { ok: false, present: false };
137
+ }
138
+ try {
139
+ const rows = JSON.parse(result.stdout);
140
+ if (!Array.isArray(rows))
141
+ return { ok: false, present: false };
142
+ return {
143
+ ok: true,
144
+ present: rows.some((row) => row && typeof row === 'object' && row.name === HOST_CAPABILITY_MCP_SERVER)
145
+ };
146
+ }
147
+ catch {
148
+ return { ok: false, present: false };
149
+ }
150
+ }
151
+ async function writeHostCapabilityPendingRuntime(input) {
152
+ try {
153
+ await withFileLock({
154
+ lockPath: path.join(input.dir, '.host-capability-hooks.lock'),
155
+ timeoutMs: 5_000,
156
+ staleMs: 60_000
157
+ }, async () => {
158
+ await fsp.rm(path.join(input.dir, HOST_CAPABILITY_HOOK_PENDING_RUNTIME_FILENAME), { force: true });
159
+ await writeJsonAtomic(path.join(input.dir, HOST_CAPABILITY_HOOK_PENDING_RUNTIME_FILENAME), createHostCapabilityHookPendingRuntime({
160
+ missionId: input.missionId,
161
+ workflowRunId: input.workflowRunId,
162
+ launchNonce: input.launchNonce,
163
+ runtime: input.runtime
164
+ }));
165
+ });
166
+ return true;
167
+ }
168
+ catch {
169
+ return false;
170
+ }
171
+ }
172
+ async function removeHostCapabilityPendingRuntime(dir) {
173
+ if (!dir)
174
+ return;
175
+ await withFileLock({
176
+ lockPath: path.join(dir, '.host-capability-hooks.lock'),
177
+ timeoutMs: 5_000,
178
+ staleMs: 60_000
179
+ }, () => fsp.rm(path.join(dir, HOST_CAPABILITY_HOOK_PENDING_RUNTIME_FILENAME), { force: true }))
180
+ .catch(() => undefined);
181
+ }
99
182
  function knownInheritedSecretValues(env) {
100
183
  const source = { ...process.env, ...(env || {}) };
101
184
  return [...new Set(Object.entries(source)
@@ -109,7 +192,30 @@ function redactKnownValues(text, values) {
109
192
  redacted = redacted.split(value).join('<redacted>');
110
193
  return redacted;
111
194
  }
195
+ function structuredValueContainsKnownValue(value, values) {
196
+ if (typeof value === 'string')
197
+ return values.some((secret) => value.includes(secret));
198
+ if (Array.isArray(value))
199
+ return value.some((item) => structuredValueContainsKnownValue(item, values));
200
+ if (!value || typeof value !== 'object')
201
+ return false;
202
+ return Object.values(value).some((item) => structuredValueContainsKnownValue(item, values));
203
+ }
204
+ function confineHostCapabilityEvidenceSecrets(evidence, secretValues) {
205
+ if (!structuredValueContainsKnownValue(evidence, secretValues))
206
+ return evidence;
207
+ const confined = createHostCapabilityEventCollector(evidence.runtime).finish();
208
+ return {
209
+ ...confined,
210
+ ok: false,
211
+ blockers: uniqueStrings([
212
+ ...confined.blockers,
213
+ 'host_capability_evidence_secret_reflection'
214
+ ])
215
+ };
216
+ }
112
217
  export async function runOfficialSubagentWorkflow(input) {
218
+ const hostCapabilityRequest = requestHostCapabilities(input.goal);
113
219
  const base = {
114
220
  schema: OFFICIAL_SUBAGENT_WORKFLOW_SCHEMA,
115
221
  workflow: 'official_codex_subagent',
@@ -118,50 +224,118 @@ export async function runOfficialSubagentWorkflow(input) {
118
224
  max_depth: 1,
119
225
  parent_model: NARUTO_PARENT_MODEL,
120
226
  parent_reasoning_effort: NARUTO_PARENT_EFFORT,
121
- session_scope: input.sessionKey || null
227
+ session_scope: input.sessionKey || null,
228
+ host_capability_request: hostCapabilityRequest
122
229
  };
230
+ const hostCapabilityRuntime = await inspectHostCapabilityRuntime({
231
+ root: input.root,
232
+ request: hostCapabilityRequest,
233
+ projectTrusted: input.projectTrusted === true,
234
+ ...(input.hostCapabilityDependencies ? { dependencies: input.hostCapabilityDependencies } : {})
235
+ });
123
236
  if (input.appSession) {
237
+ if (hostCapabilityRequest.capability_ids.length > 0 && !input.sessionKey) {
238
+ return {
239
+ ...base,
240
+ ok: false,
241
+ status: 'host_capability_blocked',
242
+ prepared: false,
243
+ additionalContext: null,
244
+ host_capability_runtime: hostCapabilityRuntime,
245
+ blockers: ['host_capability_session_scope_missing'],
246
+ completion_evidence: false,
247
+ note: 'Requested host capabilities cannot be safely bound without the current Codex session identity.'
248
+ };
249
+ }
250
+ if (!hostCapabilityRuntime.ok) {
251
+ return {
252
+ ...base,
253
+ ok: false,
254
+ status: 'host_capability_blocked',
255
+ prepared: false,
256
+ additionalContext: null,
257
+ host_capability_runtime: hostCapabilityRuntime,
258
+ blockers: hostCapabilityRuntime.blockers,
259
+ completion_evidence: false,
260
+ note: 'Requested project-scoped host capabilities are missing or unhealthy. No runnable delegation context was returned.'
261
+ };
262
+ }
124
263
  return {
125
264
  ...base,
126
265
  ok: false,
127
266
  status: 'delegation_context_ready',
128
267
  prepared: true,
129
268
  additionalContext: input.prompt,
269
+ host_capability_runtime: hostCapabilityRuntime,
130
270
  completion_evidence: false,
131
271
  note: 'The current Codex parent must spawn and await the official subagents. Preparation is not completion evidence.'
132
272
  };
133
273
  }
134
- const childEnv = buildOfficialSubagentChildEnv({
135
- ...(input.env ? { env: input.env } : {}),
136
- ...(input.missionId ? { missionId: input.missionId } : {})
137
- });
138
274
  const inheritedSecretValues = knownInheritedSecretValues(input.env);
139
275
  const parentSummaryFile = path.join(os.tmpdir(), `sks-naruto-parent-summary-${process.pid}-${Date.now()}.txt`);
140
- const args = buildOfficialSubagentCodexArgs({
141
- prompt: input.prompt,
142
- maxThreads: input.maxThreads,
143
- parentSummaryFile
144
- });
145
- const toolOutputRecovery = await inspectCodexLbCliLaunchRecovery({
146
- root: input.root,
147
- env: childEnv,
148
- cliArgs: args.slice(0, -1)
149
- });
150
- if (!toolOutputRecovery.ok) {
276
+ const hostCapabilityCollector = createHostCapabilityEventCollector(hostCapabilityRuntime);
277
+ if (!hostCapabilityRuntime.ok) {
278
+ const hostCapabilityEvidence = hostCapabilityCollector.finish();
151
279
  return {
152
280
  ...base,
153
281
  ok: false,
154
- status: 'tool_output_recovery_blocked',
282
+ status: 'host_capability_blocked',
155
283
  prepared: false,
156
284
  codex_exit_code: null,
157
285
  parent_summary: null,
158
286
  parent_summary_file: null,
159
- tool_output_recovery: toolOutputRecovery,
160
- blockers: toolOutputRecovery.blockers,
161
- operator_actions: toolOutputRecovery.operator_actions,
287
+ host_capability_runtime: hostCapabilityRuntime,
288
+ host_capability_evidence: hostCapabilityEvidence,
289
+ blockers: hostCapabilityEvidence.blockers,
162
290
  completion_evidence: false
163
291
  };
164
292
  }
293
+ const canonicalRoot = await fsp.realpath(input.root).catch(() => null);
294
+ if (!canonicalRoot) {
295
+ return {
296
+ ...base,
297
+ ok: false,
298
+ status: 'trusted_runtime_blocked',
299
+ prepared: false,
300
+ codex_exit_code: null,
301
+ parent_summary: null,
302
+ parent_summary_file: null,
303
+ host_capability_runtime: hostCapabilityRuntime,
304
+ host_capability_evidence: hostCapabilityCollector.finish(),
305
+ blockers: ['host_capability_project_root_realpath_failed'],
306
+ completion_evidence: false
307
+ };
308
+ }
309
+ let hostCapabilityLaunchNonce = null;
310
+ let hostCapabilityPendingDir = null;
311
+ if (hostCapabilityRequest.capability_ids.length > 0) {
312
+ if (!input.missionId || !input.workflowRunId) {
313
+ return {
314
+ ...base,
315
+ ok: false,
316
+ status: 'host_capability_blocked',
317
+ prepared: false,
318
+ codex_exit_code: null,
319
+ parent_summary: null,
320
+ parent_summary_file: null,
321
+ host_capability_runtime: hostCapabilityRuntime,
322
+ host_capability_evidence: hostCapabilityCollector.finish(),
323
+ blockers: ['host_capability_parent_binding_identity_missing'],
324
+ completion_evidence: false
325
+ };
326
+ }
327
+ hostCapabilityLaunchNonce = randomId(32);
328
+ hostCapabilityPendingDir = missionDir(canonicalRoot, input.missionId);
329
+ }
330
+ const childEnv = buildOfficialSubagentChildEnv({
331
+ ...(input.env ? { env: input.env } : {}),
332
+ ...(input.missionId ? { missionId: input.missionId } : {}),
333
+ ...(input.workflowRunId ? { workflowRunId: input.workflowRunId } : {}),
334
+ ...(hostCapabilityLaunchNonce ? { hostCapabilityLaunchNonce } : {})
335
+ });
336
+ const outputSecretValues = hostCapabilityLaunchNonce
337
+ ? [...inheritedSecretValues, hostCapabilityLaunchNonce]
338
+ : inheritedSecretValues;
165
339
  let codexCommand;
166
340
  if (input.runProcessImpl) {
167
341
  codexCommand = input.codexBin || 'codex';
@@ -176,7 +350,8 @@ export async function runOfficialSubagentWorkflow(input) {
176
350
  codex_exit_code: null,
177
351
  parent_summary: null,
178
352
  parent_summary_file: null,
179
- tool_output_recovery: toolOutputRecovery,
353
+ host_capability_runtime: hostCapabilityRuntime,
354
+ host_capability_evidence: hostCapabilityCollector.finish(),
180
355
  blockers: ['codex_parent_executable_override_forbidden'],
181
356
  completion_evidence: false
182
357
  };
@@ -191,23 +366,108 @@ export async function runOfficialSubagentWorkflow(input) {
191
366
  codex_exit_code: null,
192
367
  parent_summary: null,
193
368
  parent_summary_file: null,
194
- tool_output_recovery: toolOutputRecovery,
369
+ host_capability_runtime: hostCapabilityRuntime,
370
+ host_capability_evidence: hostCapabilityCollector.finish(),
195
371
  blockers: [...runtime.blockers],
196
372
  completion_evidence: false
197
373
  };
198
374
  }
199
375
  codexCommand = runtime.identity.realpath;
200
376
  }
377
+ let globalHostCapabilityConfigured = false;
378
+ if (input.projectTrusted !== true && !input.runProcessImpl) {
379
+ const configured = await inspectConfiguredGlobalHostCapabilityServer({
380
+ codexCommand,
381
+ canonicalRoot,
382
+ env: childEnv
383
+ });
384
+ if (!configured.ok) {
385
+ return {
386
+ ...base,
387
+ ok: false,
388
+ status: 'trusted_runtime_blocked',
389
+ prepared: false,
390
+ codex_exit_code: null,
391
+ parent_summary: null,
392
+ parent_summary_file: null,
393
+ host_capability_runtime: hostCapabilityRuntime,
394
+ host_capability_evidence: hostCapabilityCollector.finish(),
395
+ blockers: ['host_capability_global_config_probe_failed'],
396
+ completion_evidence: false
397
+ };
398
+ }
399
+ globalHostCapabilityConfigured = configured.present;
400
+ }
401
+ const args = buildOfficialSubagentCodexArgs({
402
+ prompt: input.prompt,
403
+ maxThreads: input.maxThreads,
404
+ parentSummaryFile,
405
+ workingDirectory: canonicalRoot,
406
+ projectConfigArgs: hostCapabilityProjectCodexConfigArgs({
407
+ canonicalRoot,
408
+ projectTrusted: input.projectTrusted === true,
409
+ globalHostCapabilityConfigured
410
+ }),
411
+ hostCapabilityConfigArgs: hostCapabilityCodexConfigArgs(hostCapabilityRuntime)
412
+ });
413
+ const toolOutputRecovery = await inspectCodexLbCliLaunchRecovery({
414
+ root: input.root,
415
+ env: childEnv,
416
+ cliArgs: args.slice(0, -1)
417
+ });
418
+ if (!toolOutputRecovery.ok) {
419
+ return {
420
+ ...base,
421
+ ok: false,
422
+ status: 'tool_output_recovery_blocked',
423
+ prepared: false,
424
+ codex_exit_code: null,
425
+ parent_summary: null,
426
+ parent_summary_file: null,
427
+ host_capability_runtime: hostCapabilityRuntime,
428
+ host_capability_evidence: hostCapabilityCollector.finish(),
429
+ tool_output_recovery: toolOutputRecovery,
430
+ blockers: toolOutputRecovery.blockers,
431
+ operator_actions: toolOutputRecovery.operator_actions,
432
+ completion_evidence: false
433
+ };
434
+ }
201
435
  await fsp.mkdir(path.dirname(parentSummaryFile), { recursive: true });
436
+ if (hostCapabilityPendingDir && hostCapabilityLaunchNonce && input.missionId && input.workflowRunId) {
437
+ const prepared = await writeHostCapabilityPendingRuntime({
438
+ dir: hostCapabilityPendingDir,
439
+ missionId: input.missionId,
440
+ workflowRunId: input.workflowRunId,
441
+ launchNonce: hostCapabilityLaunchNonce,
442
+ runtime: hostCapabilityRuntime
443
+ });
444
+ if (!prepared) {
445
+ return {
446
+ ...base,
447
+ ok: false,
448
+ status: 'host_capability_blocked',
449
+ prepared: false,
450
+ codex_exit_code: null,
451
+ parent_summary: null,
452
+ parent_summary_file: null,
453
+ host_capability_runtime: hostCapabilityRuntime,
454
+ host_capability_evidence: hostCapabilityCollector.finish(),
455
+ tool_output_recovery: toolOutputRecovery,
456
+ blockers: ['host_capability_pending_runtime_write_failed'],
457
+ completion_evidence: false
458
+ };
459
+ }
460
+ }
202
461
  const execute = input.runProcessImpl || runProcess;
203
462
  let processResult;
204
463
  try {
205
464
  processResult = await execute(codexCommand, args, {
206
- cwd: input.root,
465
+ cwd: canonicalRoot,
207
466
  timeoutMs: input.timeoutMs || 60 * 60 * 1000,
208
467
  maxOutputBytes: 256 * 1024,
209
468
  env: childEnv,
210
469
  envMode: 'replace',
470
+ onStdout: hostCapabilityCollector.push,
211
471
  ...(input.onChildSpawn ? { onSpawn: input.onChildSpawn } : {})
212
472
  });
213
473
  }
@@ -222,33 +482,79 @@ export async function runOfficialSubagentWorkflow(input) {
222
482
  timedOut: false
223
483
  };
224
484
  }
225
- const parentSummary = redactKnownValues(await fsp.readFile(parentSummaryFile, 'utf8').catch(() => ''), inheritedSecretValues);
485
+ finally {
486
+ await removeHostCapabilityPendingRuntime(hostCapabilityPendingDir);
487
+ }
488
+ const parentSummary = redactKnownValues(await fsp.readFile(parentSummaryFile, 'utf8').catch(() => ''), outputSecretValues);
226
489
  await fsp.rm(parentSummaryFile, { force: true }).catch(() => undefined);
227
- const stdout = redactKnownValues(processResult.stdout, inheritedSecretValues);
228
- const stderr = redactKnownValues(processResult.stderr, inheritedSecretValues);
229
- const blockers = processResult.spawnRegistrationFailed === true
230
- ? ['codex_parent_spawn_registration_failed']
231
- : processResult.timedOut
232
- ? ['codex_parent_timeout']
233
- : processResult.code === 0
234
- ? []
235
- : ['codex_parent_exit:' + String(processResult.code ?? 'unknown')];
490
+ const hostCapabilityEvidence = confineHostCapabilityEvidenceSecrets(hostCapabilityCollector.finish(processResult.stdout), outputSecretValues);
491
+ const stdout = summarizeCodexJsonlOutput(processResult.stdout, outputSecretValues);
492
+ const stderr = redactKnownValues(processResult.stderr, outputSecretValues).slice(-12_000);
493
+ const blockers = uniqueStrings([
494
+ ...(processResult.spawnRegistrationFailed === true
495
+ ? ['codex_parent_spawn_registration_failed']
496
+ : processResult.timedOut
497
+ ? ['codex_parent_timeout']
498
+ : processResult.code === 0
499
+ ? []
500
+ : ['codex_parent_exit:' + String(processResult.code ?? 'unknown')]),
501
+ ...hostCapabilityEvidence.blockers
502
+ ]);
503
+ const ok = processResult.code === 0 && hostCapabilityEvidence.ok;
504
+ const status = processResult.code !== 0
505
+ ? 'parent_failed'
506
+ : hostCapabilityEvidence.ok
507
+ ? 'parent_completed'
508
+ : 'host_capability_blocked';
236
509
  return {
237
510
  ...base,
238
- ok: processResult.code === 0,
239
- status: processResult.code === 0 ? 'parent_completed' : 'parent_failed',
511
+ ok,
512
+ status,
240
513
  codex_exit_code: processResult.code,
241
514
  parent_summary: parentSummary.trim() || null,
242
515
  parent_summary_file: null,
243
516
  blockers,
517
+ host_capability_runtime: hostCapabilityRuntime,
518
+ host_capability_evidence: hostCapabilityEvidence,
244
519
  tool_output_recovery: toolOutputRecovery,
245
520
  process: {
246
521
  pid: processResult.pid || null,
247
522
  timed_out: processResult.timedOut,
248
- stdout_tail: stdout,
523
+ stdout_tail: stdout.tail,
249
524
  stderr_tail: stderr,
525
+ jsonl_event_count: stdout.event_count,
526
+ jsonl_event_types: stdout.event_types,
250
527
  output_truncated: processResult.truncated
251
528
  },
252
529
  completion_evidence: false
253
530
  };
254
531
  }
532
+ function summarizeCodexJsonlOutput(text, secretValues) {
533
+ const redacted = redactKnownValues(String(text || ''), secretValues);
534
+ const eventTypes = [];
535
+ let eventCount = 0;
536
+ for (const line of redacted.split(/\r?\n/)) {
537
+ const trimmed = line.trim();
538
+ if (!trimmed)
539
+ continue;
540
+ try {
541
+ const parsed = JSON.parse(trimmed);
542
+ eventCount += 1;
543
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
544
+ const type = String(parsed.type || '').trim();
545
+ if (type)
546
+ eventTypes.push(type);
547
+ }
548
+ continue;
549
+ }
550
+ catch { }
551
+ }
552
+ return {
553
+ tail: '',
554
+ event_count: eventCount,
555
+ event_types: uniqueStrings(eventTypes)
556
+ };
557
+ }
558
+ function uniqueStrings(values) {
559
+ return [...new Set(values.map((value) => String(value || '').trim()).filter(Boolean))].sort();
560
+ }