sneakoscope 1.18.10 → 1.18.12

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 (51) hide show
  1. package/README.md +2 -2
  2. package/crates/sks-core/Cargo.lock +1 -1
  3. package/crates/sks-core/Cargo.toml +1 -1
  4. package/crates/sks-core/src/main.rs +1 -1
  5. package/dist/.sks-build-stamp.json +4 -4
  6. package/dist/bin/sks.js +1 -1
  7. package/dist/build-manifest.json +27 -9
  8. package/dist/commands/doctor.js +22 -4
  9. package/dist/commands/mad-sks.d.ts +73 -0
  10. package/dist/core/agents/agent-output-validator.d.ts +53 -0
  11. package/dist/core/agents/agent-output-validator.js +15 -0
  12. package/dist/core/agents/agent-patch-conflict-rebase.js +28 -1
  13. package/dist/core/agents/agent-patch-schema.d.ts +8 -0
  14. package/dist/core/agents/agent-patch-schema.js +25 -2
  15. package/dist/core/agents/agent-runner-codex-exec.d.ts +8 -1
  16. package/dist/core/agents/agent-runner-codex-exec.js +45 -17
  17. package/dist/core/agents/agent-runner-fake.js +7 -0
  18. package/dist/core/agents/agent-schema.d.ts +7 -0
  19. package/dist/core/agents/agent-worker-pipeline.js +7 -0
  20. package/dist/core/agents/codex-exec-worker-adapter.d.ts +126 -0
  21. package/dist/core/agents/codex-exec-worker-adapter.js +144 -0
  22. package/dist/core/agents/native-cli-worker.js +53 -24
  23. package/dist/core/agents/native-worker-backend-router.d.ts +42 -0
  24. package/dist/core/agents/native-worker-backend-router.js +199 -0
  25. package/dist/core/agents/real-codex-parallel-proof.d.ts +69 -0
  26. package/dist/core/agents/real-codex-parallel-proof.js +106 -0
  27. package/dist/core/auto-review.js +1 -1
  28. package/dist/core/codex/codex-cli-syntax-builder.d.ts +20 -0
  29. package/dist/core/codex/codex-cli-syntax-builder.js +39 -0
  30. package/dist/core/codex/codex-config-eperm-repair.d.ts +47 -0
  31. package/dist/core/codex/codex-config-eperm-repair.js +60 -0
  32. package/dist/core/codex/codex-config-readability.d.ts +22 -0
  33. package/dist/core/codex/codex-config-readability.js +182 -0
  34. package/dist/core/codex/codex-project-config-policy.d.ts +34 -0
  35. package/dist/core/codex/codex-project-config-policy.js +203 -0
  36. package/dist/core/commands/mad-sks-command.d.ts +73 -0
  37. package/dist/core/commands/mad-sks-command.js +15 -1
  38. package/dist/core/fsx.d.ts +1 -1
  39. package/dist/core/fsx.js +1 -1
  40. package/dist/core/preflight/parallel-preflight-engine.d.ts +94 -0
  41. package/dist/core/preflight/parallel-preflight-engine.js +73 -0
  42. package/dist/core/proof/runtime-truth-matrix.d.ts +1 -1
  43. package/dist/core/proof/runtime-truth-matrix.js +22 -3
  44. package/dist/core/strategy/adhd-orchestrating-gate.js +1 -1
  45. package/dist/core/tmux/warp-tmux-right-lane-layout.d.ts +155 -0
  46. package/dist/core/tmux/warp-tmux-right-lane-layout.js +186 -0
  47. package/dist/core/version.d.ts +1 -1
  48. package/dist/core/version.js +1 -1
  49. package/dist/scripts/release-parallel-check.js +7 -0
  50. package/package.json +16 -4
  51. package/schemas/codex/agent-result.schema.json +83 -4
package/README.md CHANGED
@@ -16,7 +16,7 @@ Set up this agent project with Sneakoscope Codex. Use [[mandarange/Sneakoscope-C
16
16
 
17
17
  ## Current Release
18
18
 
19
- SKS **1.18.10** hardens the Patch Swarm runtime closure: patch truth now requires route execution, transaction journal evidence, conflict rebase results, strict strategy-to-patch wiring, verification, rollback proof, and final proof rather than route flags alone. It also closes the Native CLI Session Swarm addendum: `--agents N` now means N real `sks --agent worker` child CLI processes, not Codex internal subagent/scout counts, and Fast mode is the default service tier for agent workers, Codex exec children, tmux workers, and MAD target workers unless explicitly disabled.
19
+ SKS **1.18.12** adds Codex config EPERM self-heal, doctor real-fix proof, MAD launch preflight, and official Fast mode closure: doctor now proves `.codex/config.toml` is readable by a spawned child, project-local config is split away from ignored provider/profile/telemetry keys, MAD blocks tmux launch before unreadable config can crash Codex, and Codex children receive `-c service_tier=fast` with process-report evidence.
20
20
 
21
21
  ```bash
22
22
  sks mad-sks plan --target-root <path> --json
@@ -700,7 +700,7 @@ npm run release:check
700
700
  npm run publish:dry
701
701
  ```
702
702
 
703
- `release:check` runs the 1.18.10 route-truth closure DAG, writes a source digest stamp under `.sneakoscope/reports/`, then refreshes release readiness so publish commands can verify the same stamp. The DAG preserves the 1.18 baseline gates and adds patch swarm runtime truth, transaction journaling, serial conflict rebase, strict strategy-to-patch proof, rollback command proof, Native CLI Session Swarm 5/10/20-process proof, no-subagent-scaling proof, Fast mode default/worker/Codex/MAD propagation proof, Appshots attachment provenance, MCP runtime overlap evidence, Codex 0.134 runner truth, task graph expansion, schema-bound follow-up work, actual Agent/Team/Research/QA route blackboxes, scheduler proof hardening, tmux lane proof, Source Intelligence propagation, and Goal mode propagation checks. Broader live gates remain explicit scripts such as `release:real-check`; real Codex patch smoke is optional unless `SKS_REQUIRE_REAL_CODEX_PATCHES=1`. Generate the human-readable registry with `sks features inventory --write-docs`. Plain `npm publish` uses the `latest` dist-tag. npm's `prepublishOnly` verifies the fresh release stamp instead of rerunning the full gate, and `prepack` only rebuilds `dist`; publish no longer repeats the expensive release suite during packaging. `npm run publish:dry` remains the explicit dry-run helper.
703
+ `release:check` runs the 1.18.12 route-truth closure DAG, writes a source digest stamp under `.sneakoscope/reports/`, then refreshes release readiness so publish commands can verify the same stamp. The DAG preserves the 1.18 baseline gates and adds patch swarm runtime truth, transaction journaling, serial conflict rebase, strict strategy-to-patch proof, rollback command proof, Native CLI Session Swarm 5/10/20-process proof, Real Worker Backend Router proof, Codex child overlap proof, model-authored patch-envelope separation, Warp/tmux right-lane physical UI proof, no-subagent-scaling proof, Fast mode default/worker/Codex/MAD propagation proof, Appshots attachment provenance, MCP runtime overlap evidence, Codex 0.134 runner truth, task graph expansion, schema-bound follow-up work, actual Agent/Team/Research/QA route blackboxes, scheduler proof hardening, tmux lane proof, Source Intelligence propagation, and Goal mode propagation checks. Broader live gates remain explicit scripts such as `release:real-check`; real Codex patch smoke and real Codex parallel worker proof are optional unless their `SKS_REQUIRE_REAL_*` environment variables are set. Generate the human-readable registry with `sks features inventory --write-docs`. Plain `npm publish` uses the `latest` dist-tag. npm's `prepublishOnly` verifies the fresh release stamp instead of rerunning the full gate, and `prepack` only rebuilds `dist`; publish no longer repeats the expensive release suite during packaging. `npm run publish:dry` remains the explicit dry-run helper.
704
704
 
705
705
  Version bumps are manual. Run `sks versioning bump` only when preparing release metadata; SKS will not create `.git/hooks/pre-commit` or auto-bump during ordinary commits.
706
706
 
@@ -76,7 +76,7 @@ dependencies = [
76
76
 
77
77
  [[package]]
78
78
  name = "sks-core"
79
- version = "1.18.10"
79
+ version = "1.18.12"
80
80
  dependencies = [
81
81
  "serde_json",
82
82
  ]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "sks-core"
3
- version = "1.18.10"
3
+ version = "1.18.12"
4
4
  edition = "2021"
5
5
 
6
6
  [dependencies]
@@ -4,7 +4,7 @@ use std::io::{self, Read, Seek, SeekFrom};
4
4
  fn main() {
5
5
  let mut args = std::env::args().skip(1);
6
6
  match args.next().as_deref() {
7
- Some("--version") => println!("sks-rs 1.18.10"),
7
+ Some("--version") => println!("sks-rs 1.18.12"),
8
8
  Some("compact-info") => {
9
9
  let mut input = String::new();
10
10
  let _ = io::stdin().read_to_string(&mut input);
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schema": "sks.dist-build-stamp.v1",
3
3
  "package_name": "sneakoscope",
4
- "package_version": "1.18.10",
5
- "source_digest": "b3a6c859062e168fd7b9e3684deb0281a4fded2a083f823891a561b8a25ed234",
6
- "source_file_count": 1588,
7
- "built_at_source_time": 1779959794132
4
+ "package_version": "1.18.12",
5
+ "source_digest": "2cb365dedaaf3adf494af387fa19195a82c8dabc0e4436c4f8921120ab3627e7",
6
+ "source_file_count": 1630,
7
+ "built_at_source_time": 1779984628787
8
8
  }
package/dist/bin/sks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const FAST_PACKAGE_VERSION = '1.18.10';
2
+ const FAST_PACKAGE_VERSION = '1.18.12';
3
3
  const args = process.argv.slice(2);
4
4
  try {
5
5
  if (args[0] === '--agent' && args[1] === 'worker') {
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "schema": "sks.dist-build.v2",
3
- "version": "1.18.10",
4
- "package_version": "1.18.10",
3
+ "version": "1.18.12",
4
+ "package_version": "1.18.12",
5
5
  "typescript": true,
6
6
  "mjs_runtime_files": 0,
7
- "compiled_file_count": 924,
8
- "compiled_js_count": 462,
9
- "compiled_dts_count": 462,
10
- "source_digest": "b3a6c859062e168fd7b9e3684deb0281a4fded2a083f823891a561b8a25ed234",
11
- "source_file_count": 1588,
12
- "source_files_hash": "a4275c20221e4bfb67b1de2fc810dc7b13369fbcc5336d5f4b2263a7df596202",
13
- "source_list_hash": "a4275c20221e4bfb67b1de2fc810dc7b13369fbcc5336d5f4b2263a7df596202",
7
+ "compiled_file_count": 942,
8
+ "compiled_js_count": 471,
9
+ "compiled_dts_count": 471,
10
+ "source_digest": "2cb365dedaaf3adf494af387fa19195a82c8dabc0e4436c4f8921120ab3627e7",
11
+ "source_file_count": 1630,
12
+ "source_files_hash": "b777fa1c9f49a7269df34a856ac0c22d77537df0ce51e63efd02852e49309b8b",
13
+ "source_list_hash": "b777fa1c9f49a7269df34a856ac0c22d77537df0ce51e63efd02852e49309b8b",
14
14
  "src_mjs_runtime_files": 0,
15
15
  "dist_stamp_schema": "sks.dist-build-stamp.v1",
16
16
  "files": [
@@ -280,6 +280,8 @@
280
280
  "core/agents/agent-worker-slot.js",
281
281
  "core/agents/agent-wrongness.d.ts",
282
282
  "core/agents/agent-wrongness.js",
283
+ "core/agents/codex-exec-worker-adapter.d.ts",
284
+ "core/agents/codex-exec-worker-adapter.js",
283
285
  "core/agents/fast-mode-policy.d.ts",
284
286
  "core/agents/fast-mode-policy.js",
285
287
  "core/agents/intelligent-work-graph.d.ts",
@@ -290,8 +292,12 @@
290
292
  "core/agents/native-cli-session-swarm.js",
291
293
  "core/agents/native-cli-worker.d.ts",
292
294
  "core/agents/native-cli-worker.js",
295
+ "core/agents/native-worker-backend-router.d.ts",
296
+ "core/agents/native-worker-backend-router.js",
293
297
  "core/agents/no-subagent-scaling-policy.d.ts",
294
298
  "core/agents/no-subagent-scaling-policy.js",
299
+ "core/agents/real-codex-parallel-proof.d.ts",
300
+ "core/agents/real-codex-parallel-proof.js",
295
301
  "core/agents/route-collaboration-ledger.d.ts",
296
302
  "core/agents/route-collaboration-ledger.js",
297
303
  "core/agents/scout-policy.d.ts",
@@ -390,6 +396,14 @@
390
396
  "core/codex/appshots-operator-policy.js",
391
397
  "core/codex/codex-0-134-compat.d.ts",
392
398
  "core/codex/codex-0-134-compat.js",
399
+ "core/codex/codex-cli-syntax-builder.d.ts",
400
+ "core/codex/codex-cli-syntax-builder.js",
401
+ "core/codex/codex-config-eperm-repair.d.ts",
402
+ "core/codex/codex-config-eperm-repair.js",
403
+ "core/codex/codex-config-readability.d.ts",
404
+ "core/codex/codex-config-readability.js",
405
+ "core/codex/codex-project-config-policy.d.ts",
406
+ "core/codex/codex-project-config-policy.js",
393
407
  "core/codex/codex-web-search-adapter.d.ts",
394
408
  "core/codex/codex-web-search-adapter.js",
395
409
  "core/codex/managed-proxy-env.d.ts",
@@ -745,6 +759,8 @@
745
759
  "core/ppt-review/slide-issue-extraction.js",
746
760
  "core/ppt.d.ts",
747
761
  "core/ppt.js",
762
+ "core/preflight/parallel-preflight-engine.d.ts",
763
+ "core/preflight/parallel-preflight-engine.js",
748
764
  "core/prompt-context-builder.d.ts",
749
765
  "core/prompt-context-builder.js",
750
766
  "core/proof-field.d.ts",
@@ -837,6 +853,8 @@
837
853
  "core/team-review-policy.js",
838
854
  "core/tmux-ui.d.ts",
839
855
  "core/tmux-ui.js",
856
+ "core/tmux/warp-tmux-right-lane-layout.d.ts",
857
+ "core/tmux/warp-tmux-right-lane-layout.js",
840
858
  "core/triwiki-attention.d.ts",
841
859
  "core/triwiki-attention.js",
842
860
  "core/triwiki-wrongness/avoidance-rules.d.ts",
@@ -7,8 +7,10 @@ import { codexAppIntegrationStatus } from '../core/codex-app.js';
7
7
  import { codexLbMetrics, readCodexLbCircuit } from '../core/codex-lb-circuit.js';
8
8
  import { ensureGlobalCodexSkillsDuringInstall } from '../cli/install-helpers.js';
9
9
  import { normalizeInstallScope } from '../core/init.js';
10
+ import { inspectCodexConfigReadability } from '../core/codex/codex-config-readability.js';
11
+ import { repairCodexConfigEperm } from '../core/codex/codex-config-eperm-repair.js';
10
12
  export async function run(_command, args = []) {
11
- let repair = null;
13
+ let setupRepair = null;
12
14
  if (flag(args, '--fix')) {
13
15
  const { setupCommand } = await import('../core/commands/basic-cli.js');
14
16
  const installScope = installScopeFromArgs(args);
@@ -16,7 +18,7 @@ export async function run(_command, args = []) {
16
18
  if (flag(args, '--local-only'))
17
19
  setupArgs.push('--local-only');
18
20
  await setupCommand(setupArgs);
19
- repair = {
21
+ setupRepair = {
20
22
  install_scope: installScope,
21
23
  global_skills: installScope === 'global' && !flag(args, '--local-only')
22
24
  ? await ensureGlobalCodexSkillsDuringInstall({ force: true })
@@ -24,6 +26,8 @@ export async function run(_command, args = []) {
24
26
  };
25
27
  }
26
28
  const root = await projectRoot();
29
+ const configRepair = flag(args, '--fix') ? await repairCodexConfigEperm(root, { fix: true }) : null;
30
+ const codexConfig = configRepair?.after || await inspectCodexConfigReadability(root);
27
31
  const codex = await getCodexInfo().catch(() => ({ bin: null, version: null, available: false }));
28
32
  const rust = await rustInfo().catch((err) => ({
29
33
  available: false,
@@ -35,18 +39,26 @@ export async function run(_command, args = []) {
35
39
  const codexApp = await codexAppIntegrationStatus({ codex }).catch((err) => ({ ok: false, error: err.message }));
36
40
  const codexLb = codexLbMetrics(await readCodexLbCircuit(root).catch(() => ({})));
37
41
  const pkgBytes = await dirSize(root).catch(() => 0);
42
+ const readyBlockers = [
43
+ ...(!codex.bin ? ['codex_cli_missing'] : []),
44
+ ...(!codexConfig.ok ? ['codex_config_unreadable', ...(codexConfig.blockers || [])] : []),
45
+ ...(!codexApp.ok ? ['codex_app_setup_incomplete'] : []),
46
+ ...(!codexLb.ok ? [`codex_lb_${codexLb.circuit?.state || 'blocked'}`] : [])
47
+ ];
38
48
  const result = {
39
49
  schema: 'sks.doctor-status.v1',
40
- ok: Boolean(codex.bin) && codexApp.ok && codexLb.ok,
50
+ ok: Boolean(codex.bin) && codexConfig.ok && codexApp.ok && codexLb.ok,
41
51
  root,
42
52
  node: { ok: Number(process.versions.node.split('.')[0]) >= 20, version: process.version },
43
53
  codex,
54
+ codex_config: codexConfig,
44
55
  rust,
45
56
  codex_app: codexApp,
46
57
  codex_lb: codexLb,
58
+ ready: { ok: readyBlockers.length === 0, blockers: readyBlockers },
47
59
  sneakoscope: { ok: await exists(`${root}/.sneakoscope`) },
48
60
  package: { bytes: pkgBytes, human: formatBytes(pkgBytes) },
49
- repair
61
+ repair: { setup: setupRepair, codex_config: configRepair }
50
62
  };
51
63
  if (flag(args, '--json')) {
52
64
  printJson(result);
@@ -58,10 +70,16 @@ export async function run(_command, args = []) {
58
70
  console.log(`Root: ${root}`);
59
71
  console.log(`Node: ${result.node.ok ? 'ok' : 'fail'} ${result.node.version}`);
60
72
  console.log(`Codex: ${codex.bin ? 'ok' : 'missing'} ${codex.version || ''}`);
73
+ console.log(`Codex cfg: ${codexConfig.ok ? 'ok' : `blocked ${(codexConfig.blockers || []).join(', ') || 'unknown'}`}`);
61
74
  console.log(`Rust acc.: ${rust.mode || (rust.available ? 'rust_accelerated' : 'js_fallback')} ${rust.version || rust.status || ''}`);
62
75
  console.log(`Codex App: ${codexApp.ok ? 'ok' : 'needs setup'}`);
63
76
  console.log(`codex-lb: ${codexLb.ok ? 'ok' : `blocked ${codexLb.circuit?.state || 'unknown'}`}`);
64
77
  console.log(`Ready: ${result.ok ? 'yes' : 'no'}`);
78
+ if (!codexConfig.ok && codexConfig.operator_actions?.length) {
79
+ console.log('Config action:');
80
+ for (const action of codexConfig.operator_actions)
81
+ console.log(`- ${action}`);
82
+ }
65
83
  if (!result.ok)
66
84
  process.exitCode = 1;
67
85
  }
@@ -49,5 +49,78 @@ export declare function run(_command: any, args?: any): Promise<void | {
49
49
  mode: string;
50
50
  mission_id: any;
51
51
  codex_lb_cleanup: any;
52
+ } | {
53
+ schema: string;
54
+ generated_at: string;
55
+ root: string;
56
+ ok: boolean;
57
+ readonly: {
58
+ schema: string;
59
+ generated_at: string;
60
+ started_at: string;
61
+ ok: boolean;
62
+ results: {
63
+ id: string;
64
+ ok: boolean;
65
+ status: "fulfilled" | "rejected";
66
+ value: any;
67
+ error: string | null;
68
+ }[];
69
+ blockers: any[];
70
+ operator_actions: any[];
71
+ };
72
+ repair: {
73
+ schema: string;
74
+ generated_at: string;
75
+ root: string;
76
+ config_path: string;
77
+ ok: boolean;
78
+ fix: boolean;
79
+ before: import("../core/codex/codex-config-readability.js").CodexConfigReadabilityReport;
80
+ policy: {
81
+ schema: string;
82
+ generated_at: string;
83
+ root: string;
84
+ config_path: string;
85
+ codex_home: string;
86
+ ok: boolean;
87
+ status: string;
88
+ changed: boolean;
89
+ moved_keys: never[];
90
+ moved_tables: never[];
91
+ actions: never[];
92
+ blockers: never[];
93
+ } | {
94
+ schema: string;
95
+ generated_at: string;
96
+ root: string;
97
+ config_path: string;
98
+ codex_home: string;
99
+ ok: boolean;
100
+ changed: boolean;
101
+ applied: boolean;
102
+ backup_path: string | null;
103
+ user_config_path: string | null;
104
+ profile_config_path: string | null;
105
+ profile_name: any;
106
+ moved_keys: string[];
107
+ moved_tables: string[];
108
+ deprecated_approval_policy_fixed: boolean;
109
+ actions: string[];
110
+ blockers: never[];
111
+ };
112
+ repair_actions: any[];
113
+ after: import("../core/codex/codex-config-readability.js").CodexConfigReadabilityReport;
114
+ blockers: string[];
115
+ operator_actions: string[];
116
+ } | null;
117
+ fast_tier_proof: {
118
+ schema: string;
119
+ ok: boolean;
120
+ service_tier: any;
121
+ codex_args: string[];
122
+ };
123
+ blockers: any[];
124
+ operator_actions: any[];
52
125
  }>;
53
126
  //# sourceMappingURL=mad-sks.d.ts.map
@@ -136,6 +136,9 @@ export declare const AGENT_RESULT_RUNTIME_SCHEMA: {
136
136
  readonly schema: {
137
137
  readonly const: "sks.agent-patch-envelope.v1";
138
138
  };
139
+ readonly source: {
140
+ readonly enum: readonly ["fixture", "model_authored", "process_generated", "tmux_generated"];
141
+ };
139
142
  readonly mission_id: {
140
143
  readonly type: "string";
141
144
  };
@@ -167,6 +170,12 @@ export declare const AGENT_RESULT_RUNTIME_SCHEMA: {
167
170
  readonly native_cli_process_id: {
168
171
  readonly type: "number";
169
172
  };
173
+ readonly worker_process_id: {
174
+ readonly type: "number";
175
+ };
176
+ readonly backend_child_process_id: {
177
+ readonly type: "number";
178
+ };
170
179
  readonly fast_mode: {
171
180
  readonly type: "boolean";
172
181
  };
@@ -176,6 +185,24 @@ export declare const AGENT_RESULT_RUNTIME_SCHEMA: {
176
185
  readonly lease_id: {
177
186
  readonly type: "string";
178
187
  };
188
+ readonly allowed_paths: {
189
+ readonly type: "array";
190
+ readonly items: {
191
+ readonly type: "string";
192
+ };
193
+ };
194
+ readonly strategy_task_id: {
195
+ readonly type: "string";
196
+ };
197
+ readonly micro_win_id: {
198
+ readonly type: "string";
199
+ };
200
+ readonly verification_node_id: {
201
+ readonly type: "string";
202
+ };
203
+ readonly rollback_node_id: {
204
+ readonly type: "string";
205
+ };
179
206
  readonly lease_proof: {
180
207
  readonly type: "object";
181
208
  readonly properties: {
@@ -282,6 +309,32 @@ export declare const AGENT_RESULT_RUNTIME_SCHEMA: {
282
309
  readonly type: "string";
283
310
  };
284
311
  };
312
+ readonly backend_router_report: {
313
+ readonly type: "object";
314
+ readonly additionalProperties: true;
315
+ };
316
+ readonly codex_child_report: {
317
+ readonly type: "object";
318
+ readonly additionalProperties: true;
319
+ };
320
+ readonly process_child_report: {
321
+ readonly type: "object";
322
+ readonly additionalProperties: true;
323
+ };
324
+ readonly tmux_child_report: {
325
+ readonly type: "object";
326
+ readonly additionalProperties: true;
327
+ };
328
+ readonly model_authored_patch_envelopes: {
329
+ readonly type: "boolean";
330
+ };
331
+ readonly fixture_patch_envelopes: {
332
+ readonly type: "boolean";
333
+ };
334
+ readonly no_patch_reason: {
335
+ readonly type: "object";
336
+ readonly additionalProperties: true;
337
+ };
285
338
  readonly follow_up_work_items: {
286
339
  readonly type: "array";
287
340
  readonly items: {
@@ -78,6 +78,7 @@ export const AGENT_RESULT_RUNTIME_SCHEMA = {
78
78
  required: ['schema', 'agent_id', 'session_id', 'slot_id', 'generation_index', 'operations'],
79
79
  properties: {
80
80
  schema: { const: 'sks.agent-patch-envelope.v1' },
81
+ source: { enum: ['fixture', 'model_authored', 'process_generated', 'tmux_generated'] },
81
82
  mission_id: { type: 'string' },
82
83
  route: { type: 'string' },
83
84
  agent_id: { type: 'string', minLength: 1 },
@@ -87,9 +88,16 @@ export const AGENT_RESULT_RUNTIME_SCHEMA = {
87
88
  task_slice_id: { type: 'string' },
88
89
  native_cli_worker_session_id: { type: 'string' },
89
90
  native_cli_process_id: { type: 'number' },
91
+ worker_process_id: { type: 'number' },
92
+ backend_child_process_id: { type: 'number' },
90
93
  fast_mode: { type: 'boolean' },
91
94
  service_tier: { enum: ['fast', 'standard'] },
92
95
  lease_id: { type: 'string' },
96
+ allowed_paths: { type: 'array', items: { type: 'string' } },
97
+ strategy_task_id: { type: 'string' },
98
+ micro_win_id: { type: 'string' },
99
+ verification_node_id: { type: 'string' },
100
+ rollback_node_id: { type: 'string' },
93
101
  lease_proof: {
94
102
  type: 'object',
95
103
  properties: {
@@ -133,6 +141,13 @@ export const AGENT_RESULT_RUNTIME_SCHEMA = {
133
141
  patch_queue_refs: { type: 'array', items: { type: 'string' } },
134
142
  applied_patch_refs: { type: 'array', items: { type: 'string' } },
135
143
  rollback_refs: { type: 'array', items: { type: 'string' } },
144
+ backend_router_report: { type: 'object', additionalProperties: true },
145
+ codex_child_report: { type: 'object', additionalProperties: true },
146
+ process_child_report: { type: 'object', additionalProperties: true },
147
+ tmux_child_report: { type: 'object', additionalProperties: true },
148
+ model_authored_patch_envelopes: { type: 'boolean' },
149
+ fixture_patch_envelopes: { type: 'boolean' },
150
+ no_patch_reason: { type: 'object', additionalProperties: true },
136
151
  follow_up_work_items: {
137
152
  type: 'array',
138
153
  items: {
@@ -25,7 +25,10 @@ export async function executeAgentPatchConflictRebase(root, entries, merge, opts
25
25
  let attempt = 0;
26
26
  for (const entry of groupEntries) {
27
27
  attempt += 1;
28
- const applyResult = await applyAgentPatchQueueEntry(root, entry, { dryRun: opts.dryRun === true, ...(opts.artifactsDir ? { artifactsDir: opts.artifactsDir } : {}) });
28
+ const applyResult = await safelyApplySerialRebaseEntry(root, entry, {
29
+ dryRun: opts.dryRun === true,
30
+ ...(opts.artifactsDir ? { artifactsDir: opts.artifactsDir } : {})
31
+ });
29
32
  const rollbackDryRun = applyResult?.ok === true
30
33
  ? await runSerialRebaseRollbackDryRun(root, applyResult, opts.artifactsDir)
31
34
  : null;
@@ -77,6 +80,30 @@ export async function executeAgentPatchConflictRebase(root, entries, merge, opts
77
80
  await writeJsonAtomic(path.join(opts.artifactsDir, AGENT_PATCH_CONFLICT_REBASE_ARTIFACT), result);
78
81
  return result;
79
82
  }
83
+ async function safelyApplySerialRebaseEntry(root, entry, opts) {
84
+ try {
85
+ return await applyAgentPatchQueueEntry(root, entry, opts);
86
+ }
87
+ catch (err) {
88
+ const message = err instanceof Error ? err.message : String(err);
89
+ return {
90
+ schema: 'sks.agent-patch-apply-result.v1',
91
+ entry_id: entry.id,
92
+ agent_id: entry.agent_id,
93
+ lease_id: entry.lease_id || entry.envelope?.lease_id || entry.envelope?.lease_proof?.lease_id || null,
94
+ ok: false,
95
+ status: 'blocked',
96
+ dry_run: opts.dryRun === true,
97
+ changed_files: [],
98
+ rollback: [],
99
+ rollback_digest: null,
100
+ before_hashes: {},
101
+ after_hashes: {},
102
+ verification: { status: 'blocked', checks: ['serial-rebase-exception'] },
103
+ violations: [`serial_rebase_exception:${message}`]
104
+ };
105
+ }
106
+ }
80
107
  function serialRetryAllowed(reason, opts) {
81
108
  if (/protected_path|lease_path_not_allowed|entry_not_pending/.test(reason))
82
109
  return false;
@@ -10,6 +10,7 @@ export interface AgentPatchOperation {
10
10
  }
11
11
  export interface AgentPatchEnvelope {
12
12
  schema: typeof AGENT_PATCH_SCHEMA;
13
+ source?: 'fixture' | 'model_authored' | 'process_generated' | 'tmux_generated';
13
14
  mission_id?: string;
14
15
  route?: string;
15
16
  agent_id: string;
@@ -19,9 +20,16 @@ export interface AgentPatchEnvelope {
19
20
  task_slice_id?: string;
20
21
  native_cli_worker_session_id?: string;
21
22
  native_cli_process_id?: number;
23
+ worker_process_id?: number;
24
+ backend_child_process_id?: number;
22
25
  fast_mode?: boolean;
23
26
  service_tier?: 'fast' | 'standard';
24
27
  lease_id?: string;
28
+ allowed_paths?: string[];
29
+ strategy_task_id?: string;
30
+ micro_win_id?: string;
31
+ verification_node_id?: string;
32
+ rollback_node_id?: string;
25
33
  lease_proof?: {
26
34
  lease_id?: string;
27
35
  owner_agent?: string;
@@ -1,8 +1,10 @@
1
1
  export const AGENT_PATCH_SCHEMA = 'sks.agent-patch-envelope.v1';
2
2
  export function normalizeAgentPatchEnvelope(input) {
3
3
  const generationIndex = Number(input?.generation_index ?? input?.generationIndex);
4
+ const source = normalizeEnvelopeSource(input?.source);
4
5
  return {
5
6
  schema: AGENT_PATCH_SCHEMA,
7
+ ...(source ? { source } : {}),
6
8
  ...(input?.mission_id ? { mission_id: String(input.mission_id) } : {}),
7
9
  ...(input?.route ? { route: String(input.route) } : {}),
8
10
  agent_id: String(input?.agent_id || input?.agentId || 'unknown-agent'),
@@ -11,10 +13,17 @@ export function normalizeAgentPatchEnvelope(input) {
11
13
  generation_index: Number.isFinite(generationIndex) ? Math.floor(generationIndex) : -1,
12
14
  ...(input?.task_slice_id ? { task_slice_id: String(input.task_slice_id) } : {}),
13
15
  ...(input?.native_cli_worker_session_id ? { native_cli_worker_session_id: String(input.native_cli_worker_session_id) } : {}),
14
- ...(Number.isFinite(Number(input?.native_cli_process_id)) ? { native_cli_process_id: Number(input.native_cli_process_id) } : {}),
16
+ ...(hasFiniteNumber(input?.native_cli_process_id) ? { native_cli_process_id: Number(input.native_cli_process_id) } : {}),
17
+ ...(hasFiniteNumber(input?.worker_process_id) ? { worker_process_id: Number(input.worker_process_id) } : {}),
18
+ ...(hasFiniteNumber(input?.backend_child_process_id) ? { backend_child_process_id: Number(input.backend_child_process_id) } : {}),
15
19
  ...(input?.fast_mode === undefined ? {} : { fast_mode: Boolean(input.fast_mode) }),
16
20
  ...(input?.service_tier === 'fast' || input?.service_tier === 'standard' ? { service_tier: input.service_tier } : {}),
17
21
  ...(input?.lease_id ? { lease_id: String(input.lease_id) } : {}),
22
+ ...(Array.isArray(input?.allowed_paths) ? { allowed_paths: input.allowed_paths.map(String) } : {}),
23
+ ...(input?.strategy_task_id === undefined ? {} : { strategy_task_id: String(input.strategy_task_id) }),
24
+ ...(input?.micro_win_id === undefined ? {} : { micro_win_id: String(input.micro_win_id) }),
25
+ ...(input?.verification_node_id === undefined ? {} : { verification_node_id: String(input.verification_node_id) }),
26
+ ...(input?.rollback_node_id === undefined ? {} : { rollback_node_id: String(input.rollback_node_id) }),
18
27
  ...(input?.lease_proof ? { lease_proof: normalizeLeaseProof(input.lease_proof) } : {}),
19
28
  ...(input?.rationale ? { rationale: String(input.rationale) } : {}),
20
29
  ...(input?.verification_hint ? { verification_hint: normalizeHint(input.verification_hint) } : {}),
@@ -38,6 +47,12 @@ export function validateAgentPatchEnvelope(envelope) {
38
47
  violations.push('lease_id_missing');
39
48
  if (!envelope.operations.length)
40
49
  violations.push('operations_missing');
50
+ if (envelope.source && !['fixture', 'model_authored', 'process_generated', 'tmux_generated'].includes(envelope.source))
51
+ violations.push('source_invalid');
52
+ if (envelope.source === 'model_authored' && !hasFiniteNumber(envelope.backend_child_process_id))
53
+ violations.push('model_authored_backend_child_process_id_missing');
54
+ if (envelope.source === 'fixture' && envelope.backend_child_process_id !== undefined)
55
+ violations.push('fixture_backend_child_process_id_present');
41
56
  for (const operation of envelope.operations) {
42
57
  if (!operation.path || operation.path.includes('\0') || operation.path.startsWith('/') || operation.path.split(/[\\/]/).includes('..')) {
43
58
  violations.push(`invalid_path:${operation.path || 'missing'}`);
@@ -48,12 +63,20 @@ export function validateAgentPatchEnvelope(envelope) {
48
63
  violations.push(`write_content_missing:${operation.path}`);
49
64
  if (operation.op === 'unified_diff' && typeof operation.diff !== 'string')
50
65
  violations.push(`unified_diff_missing:${operation.path}`);
51
- if (envelope.lease_proof?.allowed_paths?.length && !pathAllowedByLease(operation.path, envelope.lease_proof.allowed_paths)) {
66
+ const allowedPaths = envelope.allowed_paths?.length ? envelope.allowed_paths : envelope.lease_proof?.allowed_paths;
67
+ if (allowedPaths?.length && !pathAllowedByLease(operation.path, allowedPaths)) {
52
68
  violations.push(`lease_path_not_allowed:${operation.path}`);
53
69
  }
54
70
  }
55
71
  return { ok: violations.length === 0, violations };
56
72
  }
73
+ function normalizeEnvelopeSource(value) {
74
+ const text = String(value || '');
75
+ return text === 'fixture' || text === 'model_authored' || text === 'process_generated' || text === 'tmux_generated' ? text : null;
76
+ }
77
+ function hasFiniteNumber(value) {
78
+ return value !== null && value !== undefined && value !== '' && Number.isFinite(Number(value));
79
+ }
57
80
  function normalizeOperation(input) {
58
81
  const op = input?.op === 'write' ? 'write' : input?.op === 'unified_diff' || input?.op === 'patch' ? 'unified_diff' : 'replace';
59
82
  return {
@@ -1,6 +1,6 @@
1
1
  export declare function buildCodexExecAgentArgs(agent: any, prompt: string, opts?: any): {
2
2
  resultFile: any;
3
- args: any[];
3
+ args: string[];
4
4
  };
5
5
  export declare function runCodexExecAgent(agent: any, slice: any, opts?: any): Promise<{
6
6
  status: string;
@@ -29,6 +29,13 @@ export declare function runCodexExecAgent(agent: any, slice: any, opts?: any): P
29
29
  patch_queue_refs?: string[];
30
30
  applied_patch_refs?: string[];
31
31
  rollback_refs?: string[];
32
+ backend_router_report?: Record<string, unknown>;
33
+ codex_child_report?: Record<string, unknown>;
34
+ process_child_report?: Record<string, unknown>;
35
+ tmux_child_report?: Record<string, unknown>;
36
+ model_authored_patch_envelopes?: boolean;
37
+ fixture_patch_envelopes?: boolean;
38
+ no_patch_reason?: Record<string, unknown>;
32
39
  source_intelligence_refs?: Record<string, unknown> | null;
33
40
  goal_mode_ref?: Record<string, unknown> | null;
34
41
  follow_up_work_items?: import("./agent-follow-up-work-items.js").AgentFollowUpWorkItem[];