sneakoscope 1.18.10 → 1.18.11

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 (36) 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 +17 -9
  8. package/dist/core/agents/agent-output-validator.d.ts +53 -0
  9. package/dist/core/agents/agent-output-validator.js +15 -0
  10. package/dist/core/agents/agent-patch-conflict-rebase.js +28 -1
  11. package/dist/core/agents/agent-patch-schema.d.ts +8 -0
  12. package/dist/core/agents/agent-patch-schema.js +25 -2
  13. package/dist/core/agents/agent-runner-codex-exec.d.ts +7 -0
  14. package/dist/core/agents/agent-runner-codex-exec.js +28 -1
  15. package/dist/core/agents/agent-runner-fake.js +7 -0
  16. package/dist/core/agents/agent-schema.d.ts +7 -0
  17. package/dist/core/agents/agent-worker-pipeline.js +7 -0
  18. package/dist/core/agents/codex-exec-worker-adapter.d.ts +124 -0
  19. package/dist/core/agents/codex-exec-worker-adapter.js +143 -0
  20. package/dist/core/agents/native-cli-worker.js +53 -24
  21. package/dist/core/agents/native-worker-backend-router.d.ts +42 -0
  22. package/dist/core/agents/native-worker-backend-router.js +199 -0
  23. package/dist/core/agents/real-codex-parallel-proof.d.ts +69 -0
  24. package/dist/core/agents/real-codex-parallel-proof.js +106 -0
  25. package/dist/core/fsx.d.ts +1 -1
  26. package/dist/core/fsx.js +1 -1
  27. package/dist/core/proof/runtime-truth-matrix.d.ts +1 -1
  28. package/dist/core/proof/runtime-truth-matrix.js +22 -3
  29. package/dist/core/strategy/adhd-orchestrating-gate.js +1 -1
  30. package/dist/core/tmux/warp-tmux-right-lane-layout.d.ts +155 -0
  31. package/dist/core/tmux/warp-tmux-right-lane-layout.js +186 -0
  32. package/dist/core/version.d.ts +1 -1
  33. package/dist/core/version.js +1 -1
  34. package/dist/scripts/release-parallel-check.js +7 -0
  35. package/package.json +15 -4
  36. 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.11** adds the Real Worker Backend Router and Warp/tmux right-lane physical proof closure: native CLI workers now route fake, process, codex-exec, and tmux backends through explicit child-execution reports, real Codex proof separates native worker processes from Codex child process overlap and model-authored patch envelopes, and tmux lane proof checks right-side pane coordinates plus lane content instead of accepting manifest-only 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.11 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.11"
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.11"
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.11"),
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.11",
5
+ "source_digest": "d004681e2602ecbdc874d004fbaea06decb2fceda7cae54121f35eeb176d9f37",
6
+ "source_file_count": 1616,
7
+ "built_at_source_time": 1779978966188
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.11';
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.11",
4
+ "package_version": "1.18.11",
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": 932,
8
+ "compiled_js_count": 466,
9
+ "compiled_dts_count": 466,
10
+ "source_digest": "d004681e2602ecbdc874d004fbaea06decb2fceda7cae54121f35eeb176d9f37",
11
+ "source_file_count": 1616,
12
+ "source_files_hash": "8a3b749a48f8693f57f3dfaf93354e4224feb1e0e88730df901d0b6f8f30c10a",
13
+ "source_list_hash": "8a3b749a48f8693f57f3dfaf93354e4224feb1e0e88730df901d0b6f8f30c10a",
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",
@@ -837,6 +843,8 @@
837
843
  "core/team-review-policy.js",
838
844
  "core/tmux-ui.d.ts",
839
845
  "core/tmux-ui.js",
846
+ "core/tmux/warp-tmux-right-lane-layout.d.ts",
847
+ "core/tmux/warp-tmux-right-lane-layout.js",
840
848
  "core/triwiki-attention.d.ts",
841
849
  "core/triwiki-attention.js",
842
850
  "core/triwiki-wrongness/avoidance-rules.d.ts",
@@ -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 {
@@ -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[];
@@ -15,6 +15,8 @@ export function buildCodexExecAgentArgs(agent, prompt, opts = {}) {
15
15
  resultFile,
16
16
  '--ephemeral',
17
17
  ];
18
+ if (opts.skipGitRepoCheck !== false)
19
+ args.push('--skip-git-repo-check');
18
20
  if (opts.profile)
19
21
  args.push('--profile', String(opts.profile));
20
22
  else
@@ -93,7 +95,20 @@ export async function runCodexExecAgent(agent, slice, opts = {}) {
93
95
  if (result.code === 0) {
94
96
  const parsed = await readJson(command.resultFile, null).catch(() => null);
95
97
  if (parsed) {
96
- const validated = validateAgentWorkerResult({ ...parsed, mission_id: parsed.mission_id || opts.missionId || opts.mission_id || '', agent_id: parsed.agent_id || agent.id, session_id: parsed.session_id || agent.session_id, persona_id: parsed.persona_id || agent.persona_id || agent.id, task_slice_id: parsed.task_slice_id || slice?.id || '', backend: 'codex-exec', source_intelligence_refs: parsed.source_intelligence_refs || agent.source_intelligence_refs || null, goal_mode_ref: parsed.goal_mode_ref || agent.goal_mode_ref || null, artifacts: [...(Array.isArray(parsed.artifacts) ? parsed.artifacts : []), command.resultFile, report], verification: { status: parsed.verification?.status || 'passed', checks: [...(Array.isArray(parsed.verification?.checks) ? parsed.verification.checks : []), 'codex-exec-output-last-message', 'agent-result-schema'] } });
98
+ const validated = validateAgentWorkerResult({
99
+ ...parsed,
100
+ mission_id: parsed.mission_id || opts.missionId || opts.mission_id || '',
101
+ agent_id: parsed.agent_id || agent.id,
102
+ session_id: parsed.session_id || agent.session_id,
103
+ persona_id: parsed.persona_id || agent.persona_id || agent.id,
104
+ task_slice_id: parsed.task_slice_id || slice?.id || '',
105
+ backend: 'codex-exec',
106
+ patch_envelopes: normalizeCodexRuntimePatchEnvelopes(parsed.patch_envelopes, { childPid: Number.isFinite(Number(result.pid)) ? Number(result.pid) : null, workerPid: process.pid, fastPolicy }),
107
+ source_intelligence_refs: parsed.source_intelligence_refs || agent.source_intelligence_refs || null,
108
+ goal_mode_ref: parsed.goal_mode_ref || agent.goal_mode_ref || null,
109
+ artifacts: [...(Array.isArray(parsed.artifacts) ? parsed.artifacts : []), command.resultFile, report],
110
+ verification: { status: parsed.verification?.status || 'passed', checks: [...(Array.isArray(parsed.verification?.checks) ? parsed.verification.checks : []), 'codex-exec-output-last-message', 'agent-result-schema'] }
111
+ });
97
112
  if (!validated.blockers.some((blocker) => blocker.startsWith('schema_invalid:')))
98
113
  return validated;
99
114
  return { ...validated, status: 'blocked', blockers: [...validated.blockers, 'codex_exec_result_schema_invalid'] };
@@ -106,4 +121,16 @@ async function writeCodexProcessReport(root, agent, report) {
106
121
  await writeJsonAtomic(path.join(root, rel), { schema: 'sks.agent-process-report.v1', backend: 'codex-exec', agent_id: agent.id, session_id: agent.session_id, service_tier: report.service_tier || agent.service_tier || 'fast', fast_mode: report.fast_mode !== false, ...report });
107
122
  return rel;
108
123
  }
124
+ function normalizeCodexRuntimePatchEnvelopes(envelopes, input) {
125
+ if (!Array.isArray(envelopes))
126
+ return envelopes;
127
+ return envelopes.map((envelope) => ({
128
+ ...envelope,
129
+ source: 'model_authored',
130
+ ...(Number.isFinite(Number(input.childPid)) ? { backend_child_process_id: Number(input.childPid) } : {}),
131
+ ...(Number.isFinite(Number(input.workerPid)) ? { worker_process_id: Number(input.workerPid), native_cli_process_id: Number(input.workerPid) } : {}),
132
+ fast_mode: input.fastPolicy.fast_mode,
133
+ service_tier: input.fastPolicy.service_tier
134
+ }));
135
+ }
109
136
  //# sourceMappingURL=agent-runner-codex-exec.js.map
@@ -58,6 +58,7 @@ export function buildFixturePatchEnvelopes(agent, slice, opts = {}) {
58
58
  const rollbackNodeId = String(slice?.rollback_node_id || `rollback:${nodeId}`);
59
59
  return {
60
60
  schema: 'sks.agent-patch-envelope.v1',
61
+ source: 'fixture',
61
62
  mission_id: String(opts.missionId || opts.mission_id || ''),
62
63
  route: String(opts.route || '$Agent'),
63
64
  agent_id: String(agent.id),
@@ -66,10 +67,16 @@ export function buildFixturePatchEnvelopes(agent, slice, opts = {}) {
66
67
  generation_index: Number(agent.generation_index || 1),
67
68
  native_cli_worker_session_id: opts.nativeCliWorkerSessionId || agent.native_cli_worker_session_id || agent.session_id,
68
69
  native_cli_process_id: Number(opts.nativeCliProcessId || agent.native_cli_process_id || process.pid),
70
+ worker_process_id: Number(opts.workerProcessId || opts.nativeCliProcessId || agent.native_cli_process_id || process.pid),
69
71
  fast_mode: opts.fastMode !== false,
70
72
  service_tier: opts.serviceTier === 'standard' ? 'standard' : 'fast',
71
73
  task_slice_id: String(slice?.id || ''),
72
74
  lease_id: leaseId,
75
+ allowed_paths: [file],
76
+ strategy_task_id: nodeId,
77
+ ...(slice?.micro_win_id ? { micro_win_id: String(slice.micro_win_id) } : {}),
78
+ verification_node_id: verificationNodeId,
79
+ rollback_node_id: rollbackNodeId,
73
80
  lease_proof: {
74
81
  lease_id: leaseId,
75
82
  owner_agent: String(agent.id),
@@ -168,6 +168,13 @@ export interface AgentRunnerResult {
168
168
  patch_queue_refs?: string[];
169
169
  applied_patch_refs?: string[];
170
170
  rollback_refs?: string[];
171
+ backend_router_report?: Record<string, unknown>;
172
+ codex_child_report?: Record<string, unknown>;
173
+ process_child_report?: Record<string, unknown>;
174
+ tmux_child_report?: Record<string, unknown>;
175
+ model_authored_patch_envelopes?: boolean;
176
+ fixture_patch_envelopes?: boolean;
177
+ no_patch_reason?: Record<string, unknown>;
171
178
  source_intelligence_refs?: Record<string, unknown> | null;
172
179
  goal_mode_ref?: Record<string, unknown> | null;
173
180
  follow_up_work_items?: import('./agent-follow-up-work-items.js').AgentFollowUpWorkItem[];
@@ -44,6 +44,13 @@ export function validateAgentWorkerResult(result) {
44
44
  ...(Array.isArray(result?.patch_queue_refs) ? { patch_queue_refs: result.patch_queue_refs.map(String) } : {}),
45
45
  ...(Array.isArray(result?.applied_patch_refs) ? { applied_patch_refs: result.applied_patch_refs.map(String) } : {}),
46
46
  ...(Array.isArray(result?.rollback_refs) ? { rollback_refs: result.rollback_refs.map(String) } : {}),
47
+ ...(result?.backend_router_report === undefined ? {} : { backend_router_report: result.backend_router_report }),
48
+ ...(result?.codex_child_report === undefined ? {} : { codex_child_report: result.codex_child_report }),
49
+ ...(result?.process_child_report === undefined ? {} : { process_child_report: result.process_child_report }),
50
+ ...(result?.tmux_child_report === undefined ? {} : { tmux_child_report: result.tmux_child_report }),
51
+ ...(result?.model_authored_patch_envelopes === undefined ? {} : { model_authored_patch_envelopes: Boolean(result.model_authored_patch_envelopes) }),
52
+ ...(result?.fixture_patch_envelopes === undefined ? {} : { fixture_patch_envelopes: Boolean(result.fixture_patch_envelopes) }),
53
+ ...(result?.no_patch_reason === undefined ? {} : { no_patch_reason: result.no_patch_reason }),
47
54
  ...(result?.source_intelligence_refs === undefined ? {} : { source_intelligence_refs: result.source_intelligence_refs }),
48
55
  ...(result?.goal_mode_ref === undefined ? {} : { goal_mode_ref: result.goal_mode_ref }),
49
56
  ...(result?.follow_up_work_items === undefined ? {} : { follow_up_work_items: followUps.accepted }),
@@ -0,0 +1,124 @@
1
+ import { type AgentPatchEnvelope } from './agent-patch-schema.js';
2
+ export declare const CODEX_EXEC_WORKER_ADAPTER_SCHEMA = "sks.codex-exec-worker-adapter.v1";
3
+ export declare function runCodexExecWorkerAdapter(input: {
4
+ agentRoot: string;
5
+ workerDirRel: string;
6
+ agent: any;
7
+ slice: any;
8
+ intake?: any;
9
+ fastModePolicy: {
10
+ fast_mode: boolean;
11
+ service_tier: 'fast' | 'standard';
12
+ };
13
+ outputSchemaFile?: string;
14
+ resultFile?: string;
15
+ real?: boolean;
16
+ }): Promise<{
17
+ result: {
18
+ patch_envelopes: AgentPatchEnvelope[];
19
+ artifacts: string[];
20
+ codex_child_report: {
21
+ schema: string;
22
+ generated_at: string;
23
+ backend: string;
24
+ agent_id: any;
25
+ session_id: any;
26
+ command: any[];
27
+ codex_child_pid: number | null;
28
+ codex_child_started_at: string | null;
29
+ codex_child_finished_at: string | null;
30
+ output_last_message_path: string;
31
+ output_schema_file: string | null;
32
+ fast_mode: boolean;
33
+ service_tier: "standard" | "fast";
34
+ managed_proxy_env_keys: any;
35
+ recursion_guard_env: boolean;
36
+ dry_run: boolean;
37
+ exit_code: any;
38
+ synthetic_stdout_fallback: boolean;
39
+ patch_envelope_count: number;
40
+ model_authored_patch_envelopes: boolean;
41
+ blockers: string[];
42
+ };
43
+ model_authored_patch_envelopes: boolean;
44
+ fixture_patch_envelopes: boolean;
45
+ blockers: string[];
46
+ status: string;
47
+ schema: typeof import("./agent-schema.js").AGENT_RESULT_SCHEMA;
48
+ mission_id: string;
49
+ agent_id: string;
50
+ session_id: string;
51
+ persona_id: string;
52
+ task_slice_id: string;
53
+ backend: import("./agent-schema.js").AgentBackend;
54
+ summary: string;
55
+ findings: string[];
56
+ proposed_changes: string[];
57
+ changed_files: string[];
58
+ lease_compliance: {
59
+ ok: boolean;
60
+ violations: string[];
61
+ };
62
+ confidence: string;
63
+ handoff_notes: string;
64
+ unverified: string[];
65
+ writes: string[];
66
+ patch_queue_refs?: string[];
67
+ applied_patch_refs?: string[];
68
+ rollback_refs?: string[];
69
+ backend_router_report?: Record<string, unknown>;
70
+ process_child_report?: Record<string, unknown>;
71
+ tmux_child_report?: Record<string, unknown>;
72
+ no_patch_reason?: Record<string, unknown>;
73
+ source_intelligence_refs?: Record<string, unknown> | null;
74
+ goal_mode_ref?: Record<string, unknown> | null;
75
+ follow_up_work_items?: import("./agent-follow-up-work-items.js").AgentFollowUpWorkItem[];
76
+ recursion_guard: {
77
+ ok: boolean;
78
+ violations: string[];
79
+ };
80
+ verification: {
81
+ status: string;
82
+ checks: string[];
83
+ };
84
+ };
85
+ processReport: {
86
+ schema: string;
87
+ generated_at: string;
88
+ backend: string;
89
+ agent_id: any;
90
+ session_id: any;
91
+ command: any[];
92
+ codex_child_pid: number | null;
93
+ codex_child_started_at: string | null;
94
+ codex_child_finished_at: string | null;
95
+ output_last_message_path: string;
96
+ output_schema_file: string | null;
97
+ fast_mode: boolean;
98
+ service_tier: "standard" | "fast";
99
+ managed_proxy_env_keys: any;
100
+ recursion_guard_env: boolean;
101
+ dry_run: boolean;
102
+ exit_code: any;
103
+ synthetic_stdout_fallback: boolean;
104
+ patch_envelope_count: number;
105
+ model_authored_patch_envelopes: boolean;
106
+ blockers: string[];
107
+ };
108
+ outputTruth: {
109
+ schema: string;
110
+ generated_at: string;
111
+ ok: boolean;
112
+ output_last_message_path: string;
113
+ output_last_message_exists: boolean;
114
+ output_last_message_json_parsed: boolean;
115
+ patch_envelope_count: number;
116
+ model_authored_patch_envelopes: boolean;
117
+ synthetic_stdout_fallback: boolean;
118
+ blockers: string[];
119
+ };
120
+ patchEnvelopes: AgentPatchEnvelope[];
121
+ reportRel: string;
122
+ outputTruthRel: string;
123
+ }>;
124
+ //# sourceMappingURL=codex-exec-worker-adapter.d.ts.map