sneakoscope 4.8.7 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/README.md +51 -726
  2. package/config/bench-baseline.json +7 -0
  3. package/crates/sks-core/Cargo.lock +1 -1
  4. package/crates/sks-core/Cargo.toml +1 -1
  5. package/crates/sks-core/src/main.rs +1 -1
  6. package/dist/bin/install.js +35 -0
  7. package/dist/bin/sks.js +1 -1
  8. package/dist/cli/cli-theme.js +51 -0
  9. package/dist/cli/command-registry.js +15 -4
  10. package/dist/cli/help-fast.js +18 -8
  11. package/dist/cli/insane-search-command.js +36 -8
  12. package/dist/cli/install-helpers.js +32 -0
  13. package/dist/commands/codex-lb.js +2 -0
  14. package/dist/commands/doctor.js +94 -9
  15. package/dist/commands/proof.js +6 -3
  16. package/dist/config/skills-manifest.json +82 -54
  17. package/dist/core/agents/agent-conflict-graph.js +5 -0
  18. package/dist/core/agents/agent-lease.js +5 -0
  19. package/dist/core/agents/agent-ledger-schemas.js +1 -0
  20. package/dist/core/agents/agent-lifecycle.js +5 -3
  21. package/dist/core/agents/agent-orchestrator.js +268 -62
  22. package/dist/core/agents/agent-output-validator.js +14 -3
  23. package/dist/core/agents/agent-patch-queue-store.js +95 -2
  24. package/dist/core/agents/agent-patch-queue.js +6 -3
  25. package/dist/core/agents/agent-patch-schema.js +13 -0
  26. package/dist/core/agents/agent-proof-evidence.js +6 -1
  27. package/dist/core/agents/agent-runner-fake.js +40 -0
  28. package/dist/core/agents/agent-worker-pipeline.js +36 -2
  29. package/dist/core/agents/codex-exec-worker-adapter.js +2 -0
  30. package/dist/core/agents/native-cli-worker.js +0 -1
  31. package/dist/core/agents/native-worker-backend-router.js +58 -1
  32. package/dist/core/codex-app/sks-menubar.js +477 -132
  33. package/dist/core/codex-app.js +1 -0
  34. package/dist/core/codex-control/codex-sdk-config-policy.js +2 -1
  35. package/dist/core/codex-control/codex-sdk-env-policy.js +1 -1
  36. package/dist/core/codex-control/schemas/agent-worker-result.schema.js +12 -3
  37. package/dist/core/codex-hooks/codex-hook-managed-install.js +5 -0
  38. package/dist/core/codex-hooks/codex-hook-state-writer.js +70 -11
  39. package/dist/core/codex-hooks/codex-hook-trust-doctor.js +2 -2
  40. package/dist/core/codex-lb/codex-lb-env.js +20 -1
  41. package/dist/core/commands/basic-cli.js +18 -1
  42. package/dist/core/commands/check-command.js +37 -5
  43. package/dist/core/commands/computer-use-command.js +62 -7
  44. package/dist/core/commands/db-command.js +31 -5
  45. package/dist/core/commands/fast-mode-command.js +3 -0
  46. package/dist/core/commands/gate-result-contract.js +43 -0
  47. package/dist/core/commands/gates-command.js +6 -1
  48. package/dist/core/commands/gc-command.js +29 -2
  49. package/dist/core/commands/goal-command.js +9 -2
  50. package/dist/core/commands/gx-command.js +79 -7
  51. package/dist/core/commands/image-ux-review-command.js +188 -13
  52. package/dist/core/commands/mad-db-command.js +85 -176
  53. package/dist/core/commands/mad-sks-command.js +230 -29
  54. package/dist/core/commands/menubar-command.js +24 -2
  55. package/dist/core/commands/naruto-command.js +64 -10
  56. package/dist/core/commands/plan-command.js +76 -0
  57. package/dist/core/commands/ppt-command.js +159 -24
  58. package/dist/core/commands/qa-loop-command.js +6 -2
  59. package/dist/core/commands/release-command.js +55 -2
  60. package/dist/core/commands/research-command.js +1 -1
  61. package/dist/core/commands/review-command.js +217 -0
  62. package/dist/core/commands/route-success-helpers.js +59 -0
  63. package/dist/core/commands/run-command.js +19 -7
  64. package/dist/core/commands/seo-command.js +49 -1
  65. package/dist/core/commands/ui-command.js +161 -0
  66. package/dist/core/commands/uninstall-command.js +15 -1
  67. package/dist/core/db-safety.js +2 -2
  68. package/dist/core/doctor/doctor-dirty-planner.js +51 -7
  69. package/dist/core/doctor/doctor-transaction.js +8 -0
  70. package/dist/core/doctor/doctor-zellij-repair.js +1 -0
  71. package/dist/core/doctor/imagegen-repair.js +161 -0
  72. package/dist/core/feature-fixture-runner.js +2 -2
  73. package/dist/core/feature-fixtures.js +58 -37
  74. package/dist/core/feature-registry.js +102 -2
  75. package/dist/core/fsx.js +39 -6
  76. package/dist/core/image-ux-review/imagegen-adapter.js +48 -11
  77. package/dist/core/image-ux-review.js +16 -0
  78. package/dist/core/imagegen/imagegen-capability.js +11 -5
  79. package/dist/core/imagegen/require-imagegen.js +57 -0
  80. package/dist/core/init/skills.js +10 -5
  81. package/dist/core/mad-db/mad-db-coordinator.js +94 -18
  82. package/dist/core/mad-db/mad-db-policy.js +12 -10
  83. package/dist/core/mad-sks/executors/executor-base.js +8 -2
  84. package/dist/core/mad-sks/executors/index.js +4 -0
  85. package/dist/core/mad-sks/executors/sql-plane-executor.js +194 -0
  86. package/dist/core/naruto/naruto-active-pool.js +15 -4
  87. package/dist/core/naruto/naruto-real-worker-child.js +11 -1
  88. package/dist/core/naruto/naruto-role-policy.js +3 -0
  89. package/dist/core/naruto/naruto-task-hints.js +10 -0
  90. package/dist/core/naruto/naruto-work-graph.js +8 -2
  91. package/dist/core/naruto/naruto-work-item.js +6 -0
  92. package/dist/core/naruto/solution-tournament.js +101 -0
  93. package/dist/core/permission-gates.js +30 -0
  94. package/dist/core/pipeline-internals/runtime-core.js +11 -3
  95. package/dist/core/pipeline-internals/runtime-gates.js +27 -0
  96. package/dist/core/ppt-review/index.js +6 -1
  97. package/dist/core/ppt-review/slide-imagegen-review.js +75 -10
  98. package/dist/core/ppt.js +70 -2
  99. package/dist/core/proof/auto-finalize.js +70 -11
  100. package/dist/core/proof/proof-schema.js +2 -0
  101. package/dist/core/proof/route-adapter.js +5 -1
  102. package/dist/core/proof/route-finalizer.js +8 -5
  103. package/dist/core/proof/selftest-proof-fixtures.js +18 -5
  104. package/dist/core/proof/validation.js +2 -0
  105. package/dist/core/provider/model-router.js +53 -0
  106. package/dist/core/release/release-gate-node.js +3 -0
  107. package/dist/core/release/release-gate-resource-governor.js +1 -0
  108. package/dist/core/routes/constants.js +1 -1
  109. package/dist/core/routes.js +65 -18
  110. package/dist/core/safety/mutation-guard.js +5 -1
  111. package/dist/core/stop-gate/gate-evaluator.js +102 -0
  112. package/dist/core/stop-gate/stop-gate-check.js +16 -1
  113. package/dist/core/stop-gate/stop-gate-writer.js +4 -0
  114. package/dist/core/triwiki/agents-md-projector.js +184 -0
  115. package/dist/core/triwiki-wrongness/wrongness-schema.js +3 -1
  116. package/dist/core/trust-kernel/trust-kernel-schema.js +1 -0
  117. package/dist/core/trust-kernel/trust-report.js +1 -1
  118. package/dist/core/trust-kernel/trust-status.js +2 -0
  119. package/dist/core/ui/dashboard-html.js +111 -0
  120. package/dist/core/update/update-migration-state.js +386 -15
  121. package/dist/core/update-check.js +178 -81
  122. package/dist/core/verification/diff-quality.js +100 -0
  123. package/dist/core/verification/impact-scan.js +164 -0
  124. package/dist/core/verification/machine-feedback.js +146 -0
  125. package/dist/core/verification/mistake-rule-compiler.js +195 -0
  126. package/dist/core/version.js +1 -1
  127. package/dist/core/zellij/zellij-self-heal.js +9 -6
  128. package/dist/core/zellij/zellij-slot-telemetry.js +1 -1
  129. package/dist/scripts/check-feature-quality.js +2 -2
  130. package/dist/scripts/cli-output-consistency-check.js +57 -0
  131. package/dist/scripts/coding-bench-check.js +136 -0
  132. package/dist/scripts/doctor-imagegen-repair-check.js +62 -0
  133. package/dist/scripts/ensure-bin-executable.js +11 -3
  134. package/dist/scripts/harness-benchmark-check.js +104 -0
  135. package/dist/scripts/legacy-update-e2e-check.js +228 -0
  136. package/dist/scripts/mad-db-command-check.js +11 -8
  137. package/dist/scripts/mad-db-route-identity-check.js +8 -6
  138. package/dist/scripts/mad-db-safety-conflict-matrix-check.js +31 -8
  139. package/dist/scripts/mad-db-skill-policy-snapshot-check.js +4 -5
  140. package/dist/scripts/naruto-real-active-pool-runtime-check.js +26 -1
  141. package/dist/scripts/ppt-real-imagegen-wiring-check.js +5 -1
  142. package/dist/scripts/proof-root-cause-policy-check.js +2 -0
  143. package/dist/scripts/release-dag-full-coverage-check.js +13 -4
  144. package/dist/scripts/release-gate-dag-runner.js +14 -0
  145. package/dist/scripts/release-gate-existence-audit.js +2 -1
  146. package/dist/scripts/release-gate-planner.js +2 -1
  147. package/dist/scripts/release-gate-script-parity-check.js +45 -17
  148. package/dist/scripts/release-metadata-1-19-check.js +2 -1
  149. package/dist/scripts/seo-geo-feature-fixture-quality-check.js +1 -1
  150. package/dist/scripts/sks-1-11-gate-lib.js +8 -6
  151. package/dist/scripts/sks-menubar-install-check.js +57 -20
  152. package/dist/scripts/ux-review-real-loop-fixture-check.js +9 -4
  153. package/dist/scripts/ux-review-run-wires-imagegen-check.js +4 -0
  154. package/dist/scripts/zellij-slot-telemetry-runtime-check.js +1 -0
  155. package/docs/assets/sneakoscope-architecture-pipeline.jpg +0 -0
  156. package/docs/demo.tape +28 -0
  157. package/package.json +31 -24
  158. package/schemas/codex/completion-proof.schema.json +3 -2
  159. package/schemas/release/release-gate-node.schema.json +2 -1
  160. package/dist/scripts/agent-backfill-route-blackbox.js +0 -5
  161. package/dist/scripts/agent-dynamic-pool-route-blackbox.js +0 -5
  162. package/dist/scripts/agent-parallel-write-blackbox.js +0 -56
  163. package/dist/scripts/agent-patch-swarm-route-blackbox.js +0 -10
  164. package/dist/scripts/agent-route-blackbox-lib.js +0 -132
  165. package/dist/scripts/blackbox-command-import-smoke.js +0 -143
  166. package/dist/scripts/blackbox-global-shim.js +0 -77
  167. package/dist/scripts/blackbox-matrix.js +0 -70
  168. package/dist/scripts/blackbox-npx-one-shot.js +0 -69
  169. package/dist/scripts/blackbox-pack-install.js +0 -174
  170. package/dist/scripts/brand-neutrality-zero-leakage-blackbox.js +0 -4
  171. package/dist/scripts/build-once-runner-blackbox.js +0 -34
  172. package/dist/scripts/codex-0140-integration-blackbox.js +0 -13
  173. package/dist/scripts/codex-agent-type-blackbox.js +0 -4
  174. package/dist/scripts/codex-app-harness-blackbox.js +0 -4
  175. package/dist/scripts/codex-app-skill-agent-blackbox.js +0 -4
  176. package/dist/scripts/codex-hook-approval-blackbox.js +0 -4
  177. package/dist/scripts/codex-init-deep-directory-local-blackbox.js +0 -4
  178. package/dist/scripts/codex-native-feature-broker-blackbox.js +0 -4
  179. package/dist/scripts/codex-native-pattern-analysis-blackbox.js +0 -4
  180. package/dist/scripts/codex-native-read-repair-split-blackbox.js +0 -55
  181. package/dist/scripts/codex-native-reference-cache-blackbox.js +0 -41
  182. package/dist/scripts/core-skill-integrity-blackbox.js +0 -32
  183. package/dist/scripts/dfix-fast-blackbox-check.js +0 -37
  184. package/dist/scripts/dfix-parallel-write-blackbox.js +0 -48
  185. package/dist/scripts/dfix-patch-swarm-route-blackbox.js +0 -10
  186. package/dist/scripts/doctor-dirty-repair-blackbox.js +0 -22
  187. package/dist/scripts/doctor-dirty-semantic-blackbox.js +0 -8
  188. package/dist/scripts/doctor-native-capability-repair-blackbox.js +0 -39
  189. package/dist/scripts/doctor-transaction-engine-blackbox.js +0 -28
  190. package/dist/scripts/doctor-zellij-fix-blackbox.js +0 -4
  191. package/dist/scripts/doctor-zellij-no-homebrew-blackbox.js +0 -4
  192. package/dist/scripts/doctor-zellij-upgrade-blackbox.js +0 -4
  193. package/dist/scripts/gate-pack-runner-blackbox.js +0 -27
  194. package/dist/scripts/gate-pack-v2-blackbox.js +0 -18
  195. package/dist/scripts/geo-cli-blackbox-check.js +0 -18
  196. package/dist/scripts/loop-collision-blackbox.js +0 -3
  197. package/dist/scripts/loop-concurrency-oversubscription-blackbox.js +0 -3
  198. package/dist/scripts/loop-fixture-production-misuse-blackbox.js +0 -3
  199. package/dist/scripts/loop-kill-interrupt-real-blackbox.js +0 -3
  200. package/dist/scripts/loop-merge-strategy-blackbox.js +0 -3
  201. package/dist/scripts/loop-mesh-production-e2e-blackbox.js +0 -3
  202. package/dist/scripts/loop-side-effect-blackbox.js +0 -3
  203. package/dist/scripts/mad-db-operation-lifecycle-blackbox.js +0 -29
  204. package/dist/scripts/mad-sks-actual-executor-blackbox.js +0 -5
  205. package/dist/scripts/mad-zellij-headless-fallback-blackbox.js +0 -4
  206. package/dist/scripts/mad-zellij-self-heal-blackbox.js +0 -4
  207. package/dist/scripts/naruto-loop-mesh-blackbox.js +0 -3
  208. package/dist/scripts/naruto-real-parallelism-blackbox.js +0 -307
  209. package/dist/scripts/naruto-worktree-coding-blackbox.js +0 -29
  210. package/dist/scripts/parallel-runtime-real-blackbox.js +0 -44
  211. package/dist/scripts/pipeline-codex-native-doctor-mad-routing-real-blackbox.js +0 -77
  212. package/dist/scripts/pipeline-codex-native-e2e-blackbox.js +0 -13
  213. package/dist/scripts/pipeline-codex-native-image-routing-real-blackbox.js +0 -50
  214. package/dist/scripts/pipeline-codex-native-loop-routing-real-blackbox.js +0 -74
  215. package/dist/scripts/pipeline-codex-native-qa-routing-real-blackbox.js +0 -51
  216. package/dist/scripts/pipeline-codex-native-research-routing-real-blackbox.js +0 -45
  217. package/dist/scripts/pipeline-execution-profile-routing-blackbox.js +0 -4
  218. package/dist/scripts/postinstall-global-doctor-blackbox.js +0 -12
  219. package/dist/scripts/ppt-full-e2e-blackbox-check.js +0 -109
  220. package/dist/scripts/ppt-imagegen-blackbox-check.js +0 -46
  221. package/dist/scripts/qa-backfill-route-blackbox.js +0 -5
  222. package/dist/scripts/qa-patch-swarm-route-blackbox.js +0 -10
  223. package/dist/scripts/release-full-parallelism-blackbox.js +0 -41
  224. package/dist/scripts/release-triwiki-first-runner-blackbox.js +0 -48
  225. package/dist/scripts/release-wiring-3110-blackbox.js +0 -27
  226. package/dist/scripts/release-wiring-3112-blackbox.js +0 -17
  227. package/dist/scripts/release-wiring-3113-blackbox.js +0 -17
  228. package/dist/scripts/research-backfill-route-blackbox.js +0 -5
  229. package/dist/scripts/research-final-reviewer-blackbox.js +0 -70
  230. package/dist/scripts/research-stage-cycle-runtime-blackbox.js +0 -40
  231. package/dist/scripts/research-synthesis-writer-blackbox.js +0 -24
  232. package/dist/scripts/route-blackbox-realism-check.js +0 -21
  233. package/dist/scripts/scheduler-resource-claim-blackbox.js +0 -24
  234. package/dist/scripts/seo-cli-blackbox-check.js +0 -18
  235. package/dist/scripts/sks-3110-all-feature-regression-blackbox.js +0 -116
  236. package/dist/scripts/sks-3112-all-feature-regression-blackbox.js +0 -29
  237. package/dist/scripts/sks-3113-all-feature-regression-blackbox.js +0 -17
  238. package/dist/scripts/sks-400-all-feature-regression-blackbox.js +0 -21
  239. package/dist/scripts/sks-400-extreme-parallel-blackbox.js +0 -8
  240. package/dist/scripts/sks-400-five-minute-blackbox.js +0 -9
  241. package/dist/scripts/sks-400-legacy-purge-blackbox.js +0 -8
  242. package/dist/scripts/sks-401-all-feature-regression-blackbox.js +0 -46
  243. package/dist/scripts/sks-401-five-minute-actual-blackbox.js +0 -23
  244. package/dist/scripts/sks-402-all-feature-regression-blackbox.js +0 -9
  245. package/dist/scripts/sks-402-five-minute-real-blackbox.js +0 -22
  246. package/dist/scripts/sksd-warm-cache-blackbox.js +0 -12
  247. package/dist/scripts/team-backfill-route-blackbox.js +0 -5
  248. package/dist/scripts/team-parallel-write-blackbox.js +0 -55
  249. package/dist/scripts/team-patch-swarm-route-blackbox.js +0 -10
  250. package/dist/scripts/triwiki-affected-graph-blackbox.js +0 -28
  251. package/dist/scripts/triwiki-proof-bank-blackbox.js +0 -30
  252. package/dist/scripts/triwiki-proof-bank-lock-blackbox.js +0 -7
  253. package/dist/scripts/ux-patch-swarm-route-blackbox.js +0 -10
  254. package/dist/scripts/ux-review-imagegen-blackbox-check.js +0 -67
  255. package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -28
  256. package/dist/scripts/zellij-pane-lock-concurrency-blackbox.js +0 -80
  257. package/dist/scripts/zellij-pane-lock-open-worker-integration-blackbox.js +0 -137
  258. package/dist/scripts/zellij-self-heal-typed-blackbox.js +0 -4
  259. package/dist/scripts/zellij-slot-telemetry-real-blackbox.js +0 -20
  260. package/dist/scripts/zellij-stacked-fallback-integration-blackbox.js +0 -81
  261. package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -202
@@ -1,202 +0,0 @@
1
- #!/usr/bin/env node
2
- // @ts-nocheck
3
- import fs from 'node:fs';
4
- import path from 'node:path';
5
- import { pathToFileURL } from 'node:url';
6
- import { spawn } from 'node:child_process';
7
- import { assertGate, emitGate, readText, root } from './sks-1-18-gate-lib.js';
8
- import { ensureDistFresh } from './lib/ensure-dist-fresh.js';
9
- const requireReal = process.env.SKS_REQUIRE_ZELLIJ === '1' || process.argv.includes('--require-real');
10
- const manager = readText('src/core/zellij/zellij-worker-pane-manager.ts');
11
- const schema = readText('src/core/agents/agent-schema.ts');
12
- const swarm = readText('src/core/agents/native-cli-session-swarm.ts');
13
- assertGate(manager.includes('action') && manager.includes('new-pane'), 'worker pane manager must call zellij action new-pane');
14
- assertGate(manager.includes('list-panes') && manager.includes('dump-screen'), 'worker pane proof must reconcile real list-panes/dump-screen evidence');
15
- assertGate(schema.includes('AgentWorkerPlacement') && swarm.includes("placement === 'zellij-pane'"), 'worker placement must control Zellij panes independently of backend');
16
- if (!requireReal) {
17
- emitGate('zellij:worker-pane-real-ui:blackbox', { real_required: false, proof_mode: 'source_contract' });
18
- process.exit(0);
19
- }
20
- const { spawnSync } = await import('node:child_process');
21
- const available = spawnSync('zellij', ['--version'], { encoding: 'utf8' });
22
- assertGate(available.status === 0, 'SKS_REQUIRE_ZELLIJ=1 requires zellij binary', { stderr: available.stderr });
23
- const freshness = ensureDistFresh({ rebuild: false });
24
- assertGate(freshness.ok === true, 'dist must be fresh before real Zellij worker-pane blackbox', freshness);
25
- const zellij = await import(pathToFileURL(path.join(root, 'dist', 'core', 'zellij', 'zellij-command.js')).href);
26
- const workerPane = await import(pathToFileURL(path.join(root, 'dist', 'core', 'zellij', 'zellij-worker-pane-manager.js')).href);
27
- const missionId = `M-zellij-worker-pane-real-${Date.now()}`;
28
- const sessionName = `sks-worker-pane-real-${process.pid}`;
29
- const ledgerRoot = path.join(root, '.sneakoscope', 'missions', missionId, 'agents');
30
- fs.rmSync(path.join(root, '.sneakoscope', 'missions', missionId), { recursive: true, force: true });
31
- fs.mkdirSync(ledgerRoot, { recursive: true });
32
- await zellij.runZellij(['kill-session', sessionName], { cwd: root, timeoutMs: 5000, optional: true });
33
- const attachedClient = startAttachedZellijClient(sessionName);
34
- await sleep(1500);
35
- await zellij.runZellij(['--session', sessionName, 'action', 'send-keys', 'Esc'], { cwd: root, timeoutMs: 5000, optional: true });
36
- await sleep(250);
37
- const before = await zellij.runZellij(['--session', sessionName, 'action', 'list-panes', '--json', '--all'], { cwd: root, timeoutMs: 5000, optional: true });
38
- const beforeCount = parsePaneRows(before.stdout_tail).length;
39
- const beforeTerminalCount = parsePaneRows(before.stdout_tail).filter((row) => row && row.is_plugin !== true).length;
40
- const records = [];
41
- try {
42
- for (let index = 1; index <= 3; index += 1) {
43
- const slotId = `slot-${String(index).padStart(3, '0')}`;
44
- const workerDir = path.join('sessions', slotId, 'gen-1', 'worker');
45
- const absWorkerDir = path.join(ledgerRoot, workerDir);
46
- fs.mkdirSync(absWorkerDir, { recursive: true });
47
- const heartbeatRel = path.join(workerDir, 'worker-heartbeat.jsonl');
48
- const resultRel = path.join(workerDir, 'worker-result.json');
49
- const stdoutRel = path.join(workerDir, 'worker.stdout.log');
50
- const stderrRel = path.join(workerDir, 'worker.stderr.log');
51
- const heartbeatAbs = path.join(ledgerRoot, heartbeatRel);
52
- const resultAbs = path.join(ledgerRoot, resultRel);
53
- const backend = index === 1 ? 'codex-sdk' : index === 2 ? 'local-llm' : 'python-codex-sdk';
54
- const expectedTitle = `${slotId}/gen-1 · WT:WT-${String(index).padStart(4, '0')} · branch:fixture · ${backend} · fast · codex-lb · active`;
55
- const workerScript = [
56
- "const fs=require('fs');",
57
- `fs.appendFileSync(${JSON.stringify(heartbeatAbs)}, JSON.stringify({ok:true, slot:${JSON.stringify(slotId)}, ts:new Date().toISOString()})+'\\n');`,
58
- `fs.writeFileSync(${JSON.stringify(resultAbs)}, JSON.stringify({schema:'sks.agent-result.v1', status:'done', slot:${JSON.stringify(slotId)}, heartbeat_seen:true}, null, 2)+'\\n');`,
59
- "setTimeout(()=>process.exit(0), 30000);"
60
- ].join('');
61
- const record = await workerPane.openWorkerPane({
62
- root: ledgerRoot,
63
- missionId,
64
- sessionName,
65
- slotId,
66
- generationIndex: 1,
67
- sessionId: `${slotId}-gen-1`,
68
- workerArtifactDir: workerDir,
69
- workerCommand: `printf ${shellQuote(`\u001b]2;${expectedTitle}\u0007`)}; ${process.execPath} -e ${shellQuote(workerScript)}`,
70
- resultPath: resultRel,
71
- heartbeatPath: heartbeatRel,
72
- patchEnvelopePath: path.join(workerDir, 'worker-patch-envelope.json'),
73
- stdoutLog: stdoutRel,
74
- stderrLog: stderrRel,
75
- cwd: root,
76
- serviceTier: 'fast',
77
- backend,
78
- statusLabel: 'active',
79
- worktree: { id: `WT-${String(index).padStart(4, '0')}`, path: root, branch: 'fixture' }
80
- });
81
- records.push(record);
82
- }
83
- await sleep(750);
84
- const listed = await zellij.runZellij(['--session', sessionName, 'action', 'list-panes', '--json', '--all'], { cwd: root, timeoutMs: 5000, optional: false });
85
- const rows = parsePaneRows(listed.stdout_tail);
86
- const terminalRows = rows.filter((row) => row && row.is_plugin !== true);
87
- const titles = rows.map((row) => String(row.title || row.name || row.pane_name || ''));
88
- const matchedTitles = records.filter((record) => titles.includes(record.pane_title)).length;
89
- const commandMatchedWorkers = records.filter((record) => rows.some((row) => {
90
- const command = `${row.terminal_command || ''} ${row.pane_command || ''} ${row.command || ''}`;
91
- return command.includes(missionId) && command.includes(record.slot_id);
92
- })).length;
93
- const requestedTitleCommands = records.filter((record) => {
94
- const args = Array.isArray(record.launch?.args) ? record.launch.args.map(String) : [];
95
- return args.includes('--name') && args.includes(record.pane_title);
96
- }).length;
97
- const dump = await zellij.runZellij(['--session', sessionName, 'action', 'dump-screen'], { cwd: root, timeoutMs: 5000, optional: true });
98
- const heartbeatSeen = records.filter((record) => fs.existsSync(path.join(ledgerRoot, record.heartbeat_path))).length;
99
- const resultSeen = records.filter((record) => fs.existsSync(path.join(ledgerRoot, record.worker_result_path))).length;
100
- const realPaneIds = records.filter((record) => workerPane.isRealZellijWorkerPaneIdSource(record.pane_id_source) && record.pane_id).length;
101
- const workerKindRecords = records.filter((record) => record.pane_kind === 'worker_codex_sdk').length;
102
- const workerPrimitiveRecords = records.filter((record) => record.scaling_primitive === 'native_cli_process_in_zellij_worker_pane').length;
103
- const recordProofOk = records.length === 3
104
- && realPaneIds === 3
105
- && workerKindRecords === 3
106
- && workerPrimitiveRecords === 3
107
- && requestedTitleCommands === 3
108
- && heartbeatSeen === 3
109
- && resultSeen === 3;
110
- const listPanesVisibilityOk = matchedTitles === 3
111
- || commandMatchedWorkers === 3
112
- || terminalRows.length >= beforeTerminalCount + 3;
113
- const report = {
114
- schema: 'sks.zellij-worker-pane-real-ui-blackbox.v1',
115
- ok: recordProofOk && dump.ok,
116
- real_required: true,
117
- zellij_version: available.stdout.trim(),
118
- mission_id: missionId,
119
- session_name: sessionName,
120
- before_pane_count: beforeCount,
121
- before_terminal_pane_count: beforeTerminalCount,
122
- after_pane_count: rows.length,
123
- terminal_pane_count: terminalRows.length,
124
- worker_pane_count: records.length,
125
- real_pane_ids: realPaneIds,
126
- worker_kind_records: workerKindRecords,
127
- worker_primitive_records: workerPrimitiveRecords,
128
- matched_titles: matchedTitles,
129
- command_matched_workers: commandMatchedWorkers,
130
- requested_title_commands: requestedTitleCommands,
131
- heartbeat_seen: heartbeatSeen,
132
- result_seen: resultSeen,
133
- dump_screen_ok: dump.ok,
134
- record_proof_ok: recordProofOk,
135
- list_panes_visibility_ok: listPanesVisibilityOk,
136
- pane_titles: records.map((record) => record.pane_title),
137
- pane_id_sources: records.map((record) => record.pane_id_source),
138
- proof_root: ledgerRoot,
139
- blockers: []
140
- };
141
- if (!report.ok) {
142
- report.blockers = [
143
- ...(realPaneIds === 3 ? [] : ['real_worker_pane_ids_missing']),
144
- ...(workerKindRecords === 3 ? [] : ['worker_pane_kind_missing']),
145
- ...(workerPrimitiveRecords === 3 ? [] : ['worker_pane_scaling_primitive_missing']),
146
- ...(requestedTitleCommands === 3 ? [] : ['worker_pane_title_request_missing']),
147
- ...(heartbeatSeen === 3 ? [] : ['worker_heartbeat_missing']),
148
- ...(resultSeen === 3 ? [] : ['worker_result_missing']),
149
- ...(dump.ok ? [] : ['worker_pane_dump_screen_failed'])
150
- ];
151
- }
152
- fs.mkdirSync(path.join(root, '.sneakoscope', 'reports'), { recursive: true });
153
- fs.writeFileSync(path.join(root, '.sneakoscope', 'reports', 'zellij-worker-pane-real-ui-blackbox.json'), `${JSON.stringify(report, null, 2)}\n`);
154
- emitGate('zellij:worker-pane-real-ui:blackbox', report);
155
- if (!report.ok)
156
- process.exitCode = 1;
157
- }
158
- finally {
159
- await zellij.runZellij(['kill-session', sessionName], { cwd: root, timeoutMs: 5000, optional: true });
160
- safeKill(attachedClient, 'SIGTERM');
161
- await sleep(250);
162
- safeKill(attachedClient, 'SIGKILL');
163
- }
164
- function parsePaneRows(text) {
165
- if (!String(text || '').trim())
166
- return [];
167
- try {
168
- const parsed = JSON.parse(String(text));
169
- if (Array.isArray(parsed))
170
- return parsed;
171
- if (Array.isArray(parsed?.panes))
172
- return parsed.panes;
173
- return [];
174
- }
175
- catch {
176
- return [];
177
- }
178
- }
179
- function sleep(ms) {
180
- return new Promise((resolve) => setTimeout(resolve, ms));
181
- }
182
- function shellQuote(value) {
183
- return `'${String(value).replace(/'/g, `'\\''`)}'`;
184
- }
185
- function startAttachedZellijClient(sessionName) {
186
- const logFile = path.join(root, '.sneakoscope', 'reports', `${sessionName}.script.log`);
187
- fs.mkdirSync(path.dirname(logFile), { recursive: true });
188
- return spawn('script', ['-q', logFile, 'zellij', 'attach', '--create', sessionName], {
189
- cwd: root,
190
- stdio: ['ignore', 'ignore', 'ignore']
191
- });
192
- }
193
- function safeKill(child, signal) {
194
- try {
195
- if (!child.killed)
196
- child.kill(signal);
197
- }
198
- catch {
199
- // Best-effort cleanup for the disposable pseudo-terminal client.
200
- }
201
- }
202
- //# sourceMappingURL=zellij-worker-pane-real-ui-blackbox.js.map