sneakoscope 4.0.13 → 4.0.14

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 (101) hide show
  1. package/README.md +10 -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/bin/sks.js +1 -1
  6. package/dist/cli/global-mode-router.js +2 -1
  7. package/dist/core/commands/mad-sks-command.js +3 -0
  8. package/dist/core/fsx.js +1 -1
  9. package/dist/core/providers/glm/bench/glm-bench-model-lock-proof.js +32 -3
  10. package/dist/core/providers/glm/bench/glm-benchmark-runner.js +29 -5
  11. package/dist/core/providers/glm/bench/glm-benchmark-types.js +1 -1
  12. package/dist/core/providers/glm/naruto/glm-naruto-critical-path.js +51 -0
  13. package/dist/core/providers/glm/naruto/glm-naruto-final-seal.js +9 -2
  14. package/dist/core/providers/glm/naruto/glm-naruto-orchestrator.js +101 -15
  15. package/dist/core/providers/glm/naruto/glm-naruto-parallelism-summary.js +55 -0
  16. package/dist/core/providers/glm/naruto/glm-naruto-requirement-coverage.js +92 -0
  17. package/dist/core/providers/glm/naruto/glm-naruto-requirement-ledger.js +42 -0
  18. package/dist/core/providers/glm/naruto/glm-naruto-stage-scheduler.js +85 -0
  19. package/dist/core/providers/glm/naruto/glm-naruto-task-size-classifier.js +12 -0
  20. package/dist/core/providers/glm/naruto/glm-naruto-trace.js +4 -0
  21. package/dist/core/providers/glm/naruto/glm-naruto-verifier-output.js +5 -0
  22. package/dist/core/providers/glm/naruto/glm-naruto-worker-pool.js +130 -44
  23. package/dist/core/providers/glm/naruto/glm-naruto-worker-runtime.js +6 -2
  24. package/dist/core/routes/model-mode-router.js +44 -0
  25. package/dist/core/version.js +1 -1
  26. package/package.json +24 -1
  27. package/dist/scripts/agent-dynamic-pool-fixture.js +0 -80
  28. package/dist/scripts/agent-native-release-gate.js +0 -274
  29. package/dist/scripts/agent-patch-swarm-gate-lib.js +0 -113
  30. package/dist/scripts/agent-real-codex-patch-envelope-smoke.js +0 -126
  31. package/dist/scripts/agent-route-blackbox-lib.js +0 -132
  32. package/dist/scripts/blackbox-command-import-smoke.js +0 -143
  33. package/dist/scripts/blackbox-global-shim.js +0 -77
  34. package/dist/scripts/blackbox-matrix.js +0 -70
  35. package/dist/scripts/blackbox-npx-one-shot.js +0 -69
  36. package/dist/scripts/blackbox-pack-install.js +0 -174
  37. package/dist/scripts/build-dist.js +0 -64
  38. package/dist/scripts/check-architecture.js +0 -135
  39. package/dist/scripts/check-cli-entrypoint.js +0 -43
  40. package/dist/scripts/check-command-module-budget.js +0 -25
  41. package/dist/scripts/check-dist-runtime.js +0 -100
  42. package/dist/scripts/check-feature-quality.js +0 -53
  43. package/dist/scripts/check-legacy-free.js +0 -66
  44. package/dist/scripts/check-package-boundary.js +0 -108
  45. package/dist/scripts/check-pipeline-budget.js +0 -69
  46. package/dist/scripts/check-pipeline-runtime.js +0 -25
  47. package/dist/scripts/check-publish-tag.js +0 -30
  48. package/dist/scripts/check-route-modularity.js +0 -82
  49. package/dist/scripts/check-runtime-schemas.js +0 -87
  50. package/dist/scripts/check-source-runtime.js +0 -4
  51. package/dist/scripts/check-ts-contracts.js +0 -69
  52. package/dist/scripts/check-ts-suppressions.js +0 -58
  53. package/dist/scripts/clean-dist.js +0 -8
  54. package/dist/scripts/codex-0140-feature-gate-lib.js +0 -14
  55. package/dist/scripts/codex-config-eperm-fixture.js +0 -32
  56. package/dist/scripts/codex-lb-missing-env-regression.js +0 -40
  57. package/dist/scripts/codex-native-runtime-e2e-fixture.js +0 -75
  58. package/dist/scripts/codex-project-config-policy-merge-regression.js +0 -92
  59. package/dist/scripts/core-skill-legacy-promotion-api-audit.js +0 -54
  60. package/dist/scripts/ensure-bin-executable.js +0 -10
  61. package/dist/scripts/fixtures/fake-codex-config-loader.js +0 -51
  62. package/dist/scripts/github-release-body-helper.js +0 -65
  63. package/dist/scripts/gpt-image-2-real-file-smoke.js +0 -448
  64. package/dist/scripts/hooks-no-unsupported-handlers.js +0 -15
  65. package/dist/scripts/hooks-runtime-replay-warning-zero-v2.js +0 -26
  66. package/dist/scripts/hooks-runtime-replay-warning-zero.js +0 -10
  67. package/dist/scripts/hooks-trust-warning-zero.js +0 -14
  68. package/dist/scripts/lib/codex-sdk-gate-lib.js +0 -92
  69. package/dist/scripts/lib/ensure-dist-fresh.js +0 -142
  70. package/dist/scripts/lib/git-worktree-fixture.js +0 -33
  71. package/dist/scripts/lib/mad-sks-actual-executor-check-lib.js +0 -255
  72. package/dist/scripts/lib/native-cli-session-swarm-check-lib.js +0 -79
  73. package/dist/scripts/lib/real-codex-parallel-gate.js +0 -94
  74. package/dist/scripts/lib/real-codex-parallel-proof-fixture.js +0 -55
  75. package/dist/scripts/lib/valid-png-fixture.js +0 -25
  76. package/dist/scripts/mad-sks-live-protected-core-smoke.js +0 -5
  77. package/dist/scripts/naruto-real-local-gpt-final-smoke.js +0 -25
  78. package/dist/scripts/perf-gate.js +0 -39
  79. package/dist/scripts/prepublish-release-check-or-fast.js +0 -121
  80. package/dist/scripts/release-3112-required-gates.js +0 -30
  81. package/dist/scripts/release-3113-required-gates.js +0 -25
  82. package/dist/scripts/release-4000-required-gates.js +0 -36
  83. package/dist/scripts/release-4001-required-gates.js +0 -13
  84. package/dist/scripts/release-4002-required-gates.js +0 -14
  85. package/dist/scripts/release-check-dynamic-execute.js +0 -259
  86. package/dist/scripts/release-check-dynamic.js +0 -107
  87. package/dist/scripts/release-check-stamp.js +0 -261
  88. package/dist/scripts/release-gate-dag-runner.js +0 -56
  89. package/dist/scripts/release-gate-existence-audit.js +0 -111
  90. package/dist/scripts/release-gate-planner.js +0 -34
  91. package/dist/scripts/release-gate-worker.js +0 -10
  92. package/dist/scripts/release-speed-summary.js +0 -67
  93. package/dist/scripts/repo-audit.js +0 -83
  94. package/dist/scripts/rust-smoke.js +0 -5
  95. package/dist/scripts/sizecheck.js +0 -146
  96. package/dist/scripts/sks-1-11-gate-lib.js +0 -78
  97. package/dist/scripts/sks-1-18-gate-lib.js +0 -55
  98. package/dist/scripts/tmux-removal-inventory.js +0 -36
  99. package/dist/scripts/write-build-manifest.js +0 -71
  100. package/dist/scripts/zellij-dashboard-watch.js +0 -41
  101. package/dist/scripts/zellij-right-column-geometry-proof.js +0 -162
@@ -1,80 +0,0 @@
1
- #!/usr/bin/env node
2
- // @ts-nocheck
3
- import fs from 'node:fs/promises';
4
- import os from 'node:os';
5
- import path from 'node:path';
6
- import { importDist } from './sks-1-18-gate-lib.js';
7
- export async function runDynamicPoolFixture(opts = {}) {
8
- const target = opts.target || 5;
9
- const total = opts.total || 8;
10
- const root = await fs.mkdtemp(path.join(os.tmpdir(), 'sks-dynamic-pool-'));
11
- const scheduler = await importDist('core/agents/agent-scheduler.js');
12
- const roster = {
13
- schema: 'sks.agent-roster.v1',
14
- agent_count: target,
15
- concurrency: target,
16
- roster: Array.from({ length: target }, (_, index) => ({
17
- id: `agent_${index + 1}`,
18
- persona_id: `agent_${index + 1}`,
19
- role: index % 2 === 0 ? 'verifier' : 'implementer',
20
- write_policy: 'read-only',
21
- index: index + 1
22
- }))
23
- };
24
- const slices = Array.from({ length: total }, (_, index) => ({
25
- id: `work-${String(index + 1).padStart(3, '0')}`,
26
- role: 'verifier',
27
- description: `fixture work ${index + 1}`,
28
- delay_ms: index < 2 ? 10 : index < target ? 90 : 15,
29
- write_paths: [],
30
- readonly_paths: []
31
- }));
32
- const launched = [];
33
- const result = await scheduler.runAgentScheduler({
34
- root,
35
- missionId: 'M-dynamic-pool',
36
- rootHash: 'fixture-root',
37
- roster,
38
- partition: { slices },
39
- prompt: 'dynamic pool fixture',
40
- targetActiveSlots: target,
41
- sourceIntelligenceRefs: { artifact: 'source-intelligence-evidence.json', ok: true, mode: 'offline_context7_only' },
42
- goalModeRef: { artifact: 'goal-mode-applied.json', ok: true, mode: 'sks_goal_fallback' },
43
- launchSession: async ({ agent, workItem, generation }) => {
44
- launched.push({ session_id: generation.session_id, slot_id: agent.slot_id, generation_index: agent.generation_index, work_item_id: workItem.id, started_at: Date.now() });
45
- await delay(Number(workItem.slice?.delay_ms || 1));
46
- return {
47
- schema: 'sks.agent-result.v1',
48
- mission_id: 'M-dynamic-pool',
49
- agent_id: agent.id,
50
- session_id: generation.session_id,
51
- persona_id: agent.persona_id,
52
- task_slice_id: workItem.id,
53
- status: 'done',
54
- backend: 'fake',
55
- summary: `completed ${workItem.id}`,
56
- findings: [],
57
- proposed_changes: [],
58
- changed_files: [],
59
- lease_compliance: { ok: true, violations: [] },
60
- artifacts: [path.join(generation.artifact_dir, 'agent-result.json')],
61
- blockers: [],
62
- confidence: 'fixture',
63
- handoff_notes: '',
64
- unverified: [],
65
- writes: [],
66
- source_intelligence_refs: agent.source_intelligence_refs,
67
- goal_mode_ref: agent.goal_mode_ref,
68
- recursion_guard: { ok: true, violations: [] },
69
- verification: { status: 'fixture', checks: ['dynamic-pool-fixture'] }
70
- };
71
- }
72
- });
73
- const eventsText = await fs.readFile(path.join(root, 'agent-scheduler-events.jsonl'), 'utf8');
74
- const events = eventsText.trim().split(/\n+/).filter(Boolean).map((line) => JSON.parse(line));
75
- return { root, result, launched, events };
76
- }
77
- function delay(ms) {
78
- return new Promise((resolve) => setTimeout(resolve, ms));
79
- }
80
- //# sourceMappingURL=agent-dynamic-pool-fixture.js.map
@@ -1,274 +0,0 @@
1
- #!/usr/bin/env node
2
- // @ts-nocheck
3
- import fs from 'node:fs';
4
- import path from 'node:path';
5
- import { assertGate, emitGate, root, runSksJson } from './sks-1-11-gate-lib.js';
6
- const gate = process.argv[2] || path.basename(process.argv[1], '.mjs').replace(/-check$/, '');
7
- const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
8
- const runtimeFiles = [
9
- 'src/core/commands/team-command.ts',
10
- 'src/core/team-dag.ts',
11
- 'src/core/team-live.ts',
12
- 'src/core/research.ts',
13
- 'src/core/commands/research-command.ts',
14
- 'src/core/commands/qa-loop-command.ts',
15
- 'src/core/pipeline-internals/runtime-core.ts',
16
- 'src/core/pipeline-internals/runtime-gates.ts',
17
- 'src/core/proof/auto-finalize.ts',
18
- 'src/core/proof/route-finalizer.ts',
19
- 'src/core/proof/route-proof-gate.ts'
20
- ];
21
- const agentFiles = [
22
- 'src/core/agents/agent-schema.ts',
23
- 'src/core/agents/agent-command-surface.ts',
24
- 'src/core/agents/agent-orchestrator.ts',
25
- 'src/core/agents/agent-worker-pipeline.ts',
26
- 'src/core/agents/agent-runner-codex-exec.ts',
27
- 'src/core/agents/agent-runner-process.ts',
28
- 'src/core/agents/agent-runner-fake.ts',
29
- 'src/core/agents/agent-runner-zellij.ts',
30
- 'src/core/agents/zellij-right-lane-cockpit.ts',
31
- 'src/core/agents/zellij-lane-supervisor.ts',
32
- 'src/core/agents/agent-persona.ts',
33
- 'src/core/agents/agent-roster.ts',
34
- 'src/core/agents/agent-effort-policy.ts',
35
- 'src/core/agents/route-collaboration-ledger.ts',
36
- 'src/core/agents/agent-task-slicer.ts',
37
- 'src/core/agents/agent-work-partition.ts',
38
- 'src/core/agents/agent-lease.ts',
39
- 'src/core/agents/agent-conflict-graph.ts',
40
- 'src/core/agents/agent-central-ledger.ts',
41
- 'src/core/agents/agent-ledger-schemas.ts',
42
- 'src/core/agents/agent-message-bus.ts',
43
- 'src/core/agents/agent-lifecycle.ts',
44
- 'src/core/agents/agent-heartbeat.ts',
45
- 'src/core/agents/agent-consensus.ts',
46
- 'src/core/agents/agent-proof-evidence.ts',
47
- 'src/core/agents/agent-recursion-guard.ts',
48
- 'src/core/agents/agent-output-validator.ts',
49
- 'src/core/agents/agent-cleanup.ts',
50
- 'src/core/agents/agent-trust-report.ts',
51
- 'src/core/agents/agent-wrongness.ts',
52
- 'src/core/commands/agent-command.ts'
53
- ];
54
- const workPartitionFiles = [
55
- 'src/core/agents/work-partition/repo-inventory.ts',
56
- 'src/core/agents/work-partition/dependency-graph.ts',
57
- 'src/core/agents/work-partition/semantic-domain-graph.ts',
58
- 'src/core/agents/work-partition/task-slicer.ts',
59
- 'src/core/agents/work-partition/lease-planner.ts',
60
- 'src/core/agents/work-partition/conflict-detector.ts',
61
- 'src/core/agents/work-partition/no-overlap-proof.ts'
62
- ];
63
- function text(rel) {
64
- return fs.readFileSync(path.join(root, rel), 'utf8');
65
- }
66
- function exists(rel) {
67
- return fs.existsSync(path.join(root, rel));
68
- }
69
- function assertFiles(files) {
70
- for (const file of files)
71
- assertGate(exists(file), `missing required file: ${file}`);
72
- }
73
- function assertLegacyMultiagentRemoved() {
74
- const forbidden = [
75
- /\brunFiveScoutIntake\b/,
76
- /\bsks\s+scouts\s+run\b/,
77
- /\bparallel_analysis_scouting\b/,
78
- /\banalysis_scout(?:_\d+)?\b/
79
- ];
80
- for (const file of runtimeFiles) {
81
- const body = text(file);
82
- const hits = forbidden.filter((re) => re.test(body)).map(String);
83
- assertGate(hits.length === 0, `legacy multi-agent runtime reference found in ${file}`, { hits });
84
- }
85
- for (const rel of ['src/core/scouts', 'src/core/commands/scouts-command.ts', 'src/commands/scouts.ts', 'schemas/codex/scout-result.schema.json']) {
86
- assertGate(!exists(rel), `legacy multi-agent surface still present: ${rel}`);
87
- }
88
- const registry = text('src/cli/command-registry.ts');
89
- assertGate(!/\bscouts?\s*:\s*entry\b/.test(registry), 'command registry must not expose legacy multi-agent commands');
90
- }
91
- function assertAgentSurface() {
92
- assertFiles(agentFiles);
93
- const registry = text('src/cli/command-registry.ts');
94
- const zellij = text('src/core/agents/agent-runner-zellij.ts');
95
- assertGate(/\bagent:\s+entry/.test(registry), 'command registry must expose sks agent');
96
- assertGate(/'--agent': 'agent'/.test(registry), 'CLI parser must route --agent to agent command');
97
- assertGate(zellij.includes('buildZellijAgentPanePlan') && zellij.includes('persistent_worker_slot') && zellij.includes('agent-zellij-report.json'), 'Zellij agent backend must declare lane plan and report policy');
98
- }
99
- function assertNonRecursive() {
100
- const pipeline = text('src/core/agents/agent-worker-pipeline.ts');
101
- const guard = text('src/core/agents/agent-recursion-guard.ts');
102
- const docs = text('docs/agent-non-recursive-pipeline.md');
103
- const orchestrator = text('src/core/agents/agent-orchestrator.ts');
104
- const hooks = text('src/core/hooks-runtime.ts');
105
- assertGate(exists('src/scripts/non-recursive-pipeline-check.ts'), 'missing non-recursive pipeline checker script');
106
- assertGate(exists('schemas/codex/non-recursive-pipeline-report.schema.json'), 'missing non-recursive pipeline report schema');
107
- for (const token of ['AGENT_WORKER_PIPELINE', 'SKS_AGENT_WORKER', 'SKS_PIPELINE_MODE', 'SKS_DISABLE_ROUTE_RECURSION', 'SKS_AGENT_SESSION_ID', 'SKS_AGENT_ID']) {
108
- assertGate(pipeline.includes(token), `agent worker pipeline missing ${token}`);
109
- }
110
- for (const token of ['sks team', 'sks --agent', 'sks agent run', 'sks research run', 'sks autoresearch run', 'sks goal', '$Team', '$Research', '$AutoResearch', '$QA-LOOP', '$Goal']) {
111
- assertGate(guard.includes(token), `agent recursion denylist missing ${token}`);
112
- }
113
- assertGate(guard.includes('agent-recursion-guard.json'), 'recursion guard report must be written');
114
- for (const token of ['NON_RECURSIVE_PIPELINE_REPORT_SCHEMA', 'scanNonRecursivePipelinePolicy', 'wrongness_records', 'trust_report', 'evidence_router', 'next_action', 'local_only', 'secret_redaction_ok', 'performance_budget_ms']) {
115
- assertGate(guard.includes(token), `non-recursive policy module missing ${token}`);
116
- }
117
- for (const token of ['env guard', 'command denylist', 'route denylist', 'worker mission creation block', 'current.json write block', 'stdout transcript scan', 'stderr transcript scan', 'agent result scan', 'wrongness record']) {
118
- assertGate(guard.includes(token), `non-recursive policy contract missing ${token}`);
119
- }
120
- assertGate(docs.includes('Non-Recursive Pipeline Policy Report'), 'non-recursive policy docs section missing');
121
- assertGate(orchestrator.includes('writeAgentRecursionGuardReport'), 'orchestrator must detect recursion attempts');
122
- assertGate(hooks.includes('agentWorkerHookRecursionDecision') && hooks.includes('scanAgentTextForRecursion'), 'Codex PreToolUse hook must integrate agent recursion guard');
123
- }
124
- function assertCentralLedger() {
125
- const ledger = text('src/core/agents/agent-central-ledger.ts');
126
- const schemas = text('src/core/agents/agent-ledger-schemas.ts');
127
- for (const token of ['agent-events.jsonl', 'agent-sessions.json', 'agent-roster.json', 'agent-task-board.json', 'agent-task-board.md', 'agent-messages.jsonl', 'agent-handoffs.jsonl', 'agent-leases.json', 'agent-conflict-graph.json', 'agent-consensus.json', 'agent-proof-evidence.json', 'current_hash', 'previous_hash']) {
128
- assertGate(ledger.includes(token), `central ledger missing ${token}`);
129
- }
130
- for (const token of ['sks.agent-event.v1', 'sks.agent-message.v1', 'sks.agent-task-board.v1', 'sks.agent-session-record.v1', 'sks.agent-lease-ledger.v1', 'sks.agent-conflict-graph.v1', 'sks.agent-consensus.v1', 'sks.agent-proof-evidence.v1', 'sks.agent-cleanup.v1', 'sks.agent-non-recursive-pipeline.v1', 'additionalProperties: false', 'validateJsonSchemaRecursive']) {
131
- assertGate(schemas.includes(token), `central ledger schema registry missing ${token}`);
132
- }
133
- for (const token of ['validateAgentLedgerWriteScope', 'agent_cannot_modify_other_session_record', 'agent_cannot_modify_orchestrator_only_file']) {
134
- assertGate(ledger.includes(token), `central ledger write-scope policy missing ${token}`);
135
- }
136
- const lifecycle = text('src/core/agents/agent-lifecycle.ts');
137
- for (const token of ['agent-lifecycle-policy.json', 'agent-lifecycle-aggregate.json', 'agent-timeout-kill-report.json', 'killTimedOutAgentSessions', 'agentHardTimeoutMs', 'SKS_AGENT_HARD_TIMEOUT_MS', 'sks.agent-session-record.v1']) {
138
- assertGate(lifecycle.includes(token), `agent lifecycle missing ${token}`);
139
- }
140
- }
141
- function assertWorkPartition() {
142
- assertFiles(workPartitionFiles);
143
- const partition = text('src/core/agents/agent-work-partition.ts');
144
- for (const token of ['inventory', 'dependency', 'semantic', 'lease', 'conflict', 'no_overlap_proof']) {
145
- assertGate(partition.includes(token), `work partition missing ${token}`);
146
- }
147
- }
148
- function assertOutputSchema() {
149
- const schema = JSON.parse(text('schemas/codex/agent-result.schema.json'));
150
- assertGate(schema.additionalProperties === false, 'agent result schema must close additionalProperties');
151
- for (const key of ['mission_id', 'agent_id', 'session_id', 'persona_id', 'task_slice_id', 'status', 'summary', 'findings', 'proposed_changes', 'changed_files', 'lease_compliance', 'recursion_guard', 'verification', 'blockers', 'confidence', 'handoff_notes']) {
152
- assertGate(schema.required.includes(key), `agent result schema missing required ${key}`);
153
- }
154
- const validator = text('src/core/agents/agent-output-validator.ts');
155
- const worker = text('src/core/agents/agent-worker-pipeline.ts');
156
- assertGate(validator.includes('validateJsonSchemaRecursive'), 'agent output schema must use recursive validator');
157
- assertGate(worker.includes('schema_invalid:'), 'agent output invalid result must block proof');
158
- }
159
- function assertProofAndTrustArtifacts() {
160
- const proof = text('src/core/agents/agent-proof-evidence.ts');
161
- const orchestrator = text('src/core/agents/agent-orchestrator.ts');
162
- const writers = {
163
- 'agent-cleanup.json': 'writeAgentCleanupReport',
164
- 'agent-trust-report.json': 'writeAgentTrustReport',
165
- 'agent-wrongness-records.json': 'writeAgentWrongnessRecords',
166
- 'agent-output-tails.json': 'writeAgentOutputTailReport',
167
- 'agent-timeout-kill-report.json': 'killTimedOutAgentSessions'
168
- };
169
- for (const [token, writer] of Object.entries(writers)) {
170
- assertGate(proof.includes(token), `agent proof missing ${token}`);
171
- assertGate(orchestrator.includes(writer), `agent orchestrator does not write ${token}`);
172
- }
173
- }
174
- function assertPersonaAndCaps() {
175
- const persona = text('src/core/agents/agent-persona.ts');
176
- const roster = text('src/core/agents/agent-roster.ts');
177
- const schema = text('src/core/agents/agent-schema.ts');
178
- for (const role of ['architect', 'implementer', 'verifier', 'safety', 'integrator']) {
179
- assertGate(persona.includes(role), `default persona missing ${role}`);
180
- }
181
- assertGate(schema.includes('DEFAULT_AGENT_COUNT = 5'), 'default agent count must be 5');
182
- assertGate(schema.includes('MAX_AGENT_COUNT = 20'), 'max agent count must be 20');
183
- assertGate(roster.includes('validatePersonaUniqueness'), 'persona uniqueness must be validated');
184
- assertGate(roster.includes('buildAgentEffortPolicy') && text('src/core/agents/agent-effort-policy.ts').includes('escalation_triggers'), 'agent effort policy must be dynamic and recorded');
185
- assertGate(roster.includes('exceeds max'), 'agent max cap must block overflow');
186
- }
187
- function assertReleaseScripts() {
188
- const required = [
189
- 'agent:non-recursive-pipeline',
190
- 'agent:non-recursive-pipeline-report',
191
- 'agent:legacy-multiagent-removed',
192
- 'agent:central-ledger',
193
- 'agent:work-partition',
194
- 'agent:no-overlap-proof',
195
- 'agent:persona-uniqueness',
196
- 'agent:max-cap',
197
- 'agent:fake-backend-blackbox',
198
- 'agent:lifecycle-close',
199
- 'agent:output-schema',
200
- 'agent:lease-conflicts',
201
- 'agent:proof-graph',
202
- 'team:native-agent-backend',
203
- 'research:native-agent-backend',
204
- 'qa:native-agent-backend'
205
- ];
206
- for (const name of required) {
207
- assertGate(Boolean(pkg.scripts?.[name]), `package script missing ${name}`);
208
- }
209
- const releaseCheck = String(pkg.scripts?.['release:check'] || '');
210
- const affectedReleaseCheck = String(pkg.scripts?.['release:check:affected'] || '');
211
- const delegatesToParallel = releaseCheck.includes('release:check:parallel');
212
- const delegatesToAffectedDag = releaseCheck.includes('release:check:affected')
213
- && affectedReleaseCheck.includes('release-gate-dag-runner')
214
- && /--preset\s+affected/.test(affectedReleaseCheck);
215
- const delegatesDirectlyToDag = releaseCheck.includes('release-gate-dag-runner')
216
- && /--preset\s+(?:release|affected)/.test(releaseCheck);
217
- assertGate(delegatesToParallel || delegatesToAffectedDag || delegatesDirectlyToDag, 'release:check must delegate to the parallel P0 DAG or v2 affected/release DAG', { release_check: releaseCheck, release_check_affected: affectedReleaseCheck });
218
- }
219
- function assertRouteNativeBlackbox(routeName) {
220
- const routeFixtureArgs = ['--agents', '5', '--work-items', '8', '--target-active-slots', '5', '--minimum-work-items', '5', '--max-queue-expansion', '10', '--mock', '--json'];
221
- if (routeName === 'team') {
222
- const result = runSksJson(['team', 'native backend fixture', ...routeFixtureArgs, '--no-open-zellij']);
223
- assertGate(result.mock === true, 'Team mock blackbox did not execute', result);
224
- assertGate(result.native_agent_run?.proof?.ok === true, 'Team blackbox missing native agent proof', result.native_agent_run?.proof);
225
- assertGate(!JSON.stringify(result).includes('analysis_scout'), 'Team runtime artifact leaked legacy analysis_scout');
226
- }
227
- if (routeName === 'research') {
228
- const prepared = runSksJson(['research', 'prepare', 'native backend fixture', '--json']);
229
- const result = runSksJson(['research', 'run', prepared.mission_id, ...routeFixtureArgs, '--native-proof-only']);
230
- assertGate(result.ok === true, 'Research mock blackbox did not pass', result);
231
- assertGate(result.gate?.gate?.native_agent_proof === true || result.gate?.native_agent_proof === true || result.proof?.ok === true, 'Research proof missing native agent evidence artifact', result);
232
- assertGate(!JSON.stringify(result).includes('scout-ledger'), 'Research runtime artifact leaked scout-ledger as SSOT');
233
- }
234
- if (routeName === 'qa') {
235
- const prepared = runSksJson(['qa-loop', 'prepare', 'native backend API fixture', '--json']);
236
- const result = runSksJson(['qa-loop', 'run', prepared.mission_id, ...routeFixtureArgs, '--native-proof-only']);
237
- assertGate(result.ok === true, 'QA mock blackbox did not pass', result);
238
- assertGate(result.gate?.gate?.native_agent_proof === true || result.gate?.native_agent_proof === true || result.proof?.ok === true, 'QA proof missing native agent evidence artifact', result);
239
- }
240
- }
241
- function assertBlackboxAgent() {
242
- const result = runSksJson(['agent', 'run', 'fixture', '--mock', '--json']);
243
- assertGate(result.ok === true, 'fake agent blackbox run failed', result);
244
- assertGate(result.proof?.fake_backend_disclaimer, 'fake backend disclaimer missing', result.proof);
245
- assertGate(result.proof?.all_sessions_closed === true, 'agent lifecycle close proof missing', result.proof);
246
- assertGate(result.proof?.no_overlap_ok === true, 'agent no-overlap proof missing', result.proof);
247
- assertGate(result.proof?.ledger_hash_chain_ok === true, 'agent ledger hash proof missing', result.proof);
248
- }
249
- assertAgentSurface();
250
- assertReleaseScripts();
251
- if (gate.includes('legacy-multiagent') || gate === 'team-native-agent-backend' || gate === 'research-native-agent-backend' || gate === 'qa-native-agent-backend')
252
- assertLegacyMultiagentRemoved();
253
- if (gate === 'team-native-agent-backend')
254
- assertRouteNativeBlackbox('team');
255
- if (gate === 'research-native-agent-backend')
256
- assertRouteNativeBlackbox('research');
257
- if (gate === 'qa-native-agent-backend')
258
- assertRouteNativeBlackbox('qa');
259
- if (gate.includes('non-recursive'))
260
- assertNonRecursive();
261
- if (gate.includes('central-ledger'))
262
- assertCentralLedger();
263
- if (gate.includes('work-partition') || gate.includes('no-overlap') || gate.includes('lease-conflicts'))
264
- assertWorkPartition();
265
- if (gate.includes('persona') || gate.includes('max-cap'))
266
- assertPersonaAndCaps();
267
- if (gate.includes('output-schema'))
268
- assertOutputSchema();
269
- if (gate.includes('proof-graph') || gate.includes('lifecycle-close') || gate.includes('lease-conflicts'))
270
- assertProofAndTrustArtifacts();
271
- if (gate.includes('fake-backend') || gate.includes('lifecycle-close') || gate.includes('proof-graph') || gate.includes('no-overlap') || gate.includes('lease-conflicts'))
272
- assertBlackboxAgent();
273
- emitGate(gate, { version: pkg.version, native_agent_kernel: true });
274
- //# sourceMappingURL=agent-native-release-gate.js.map
@@ -1,113 +0,0 @@
1
- #!/usr/bin/env node
2
- // @ts-nocheck
3
- import fs from 'node:fs';
4
- import os from 'node:os';
5
- import path from 'node:path';
6
- import { assertGate, emitGate, importDist, root } from './sks-1-18-gate-lib.js';
7
- export function writeReport(name, report) {
8
- const out = path.join(root, '.sneakoscope', 'reports', `${name}.json`);
9
- fs.mkdirSync(path.dirname(out), { recursive: true });
10
- fs.writeFileSync(out, `${JSON.stringify(report, null, 2)}\n`);
11
- return out;
12
- }
13
- export function readJson(file) {
14
- return JSON.parse(fs.readFileSync(file, 'utf8'));
15
- }
16
- export function makeTempPatchProject(prefix = 'sks-patch-swarm-') {
17
- const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
18
- for (let index = 1; index <= 10; index += 1) {
19
- fs.writeFileSync(path.join(dir, `file-${index}.txt`), `before-${index}\n`);
20
- }
21
- return dir;
22
- }
23
- export async function runPatchSwarmRouteBlackbox({ gate, route, routeCommand, reportName }) {
24
- const tmp = makeTempPatchProject();
25
- const files = Array.from({ length: 10 }, (_, index) => `file-${index + 1}.txt`);
26
- const prompt = [
27
- 'Patch exactly these ten independent fixture files with one exclusive write lease per file.',
28
- ...files.map((file) => `\`${file}\``)
29
- ].join(' ');
30
- const orchestrator = await importDist('core/agents/agent-orchestrator.js');
31
- const result = await orchestrator.runNativeAgentOrchestrator({
32
- root: tmp,
33
- prompt,
34
- route,
35
- routeCommand,
36
- routeBlackboxKind: `actual_${route.replace(/[^a-z0-9]+/gi, '_').replace(/^_+|_+$/g, '').toLowerCase()}_command`,
37
- backend: 'fake',
38
- mock: true,
39
- agents: 5,
40
- concurrency: 5,
41
- targetActiveSlots: 5,
42
- desiredWorkItemCount: 10,
43
- minimumWorkItems: 10,
44
- writeMode: 'parallel',
45
- applyPatches: true,
46
- dryRunPatches: false,
47
- maxWriteAgents: 5,
48
- json: true
49
- });
50
- const ledgerRoot = path.join(tmp, result.ledger_root);
51
- const queue = readJson(path.join(ledgerRoot, 'agent-patch-queue.json'));
52
- const merge = readJson(path.join(ledgerRoot, 'agent-merge-coordinator-report.json'));
53
- const apply = readJson(path.join(ledgerRoot, 'agent-patch-apply-results.json'));
54
- const verification = readJson(path.join(ledgerRoot, 'agent-patch-verification-results.json'));
55
- const rollback = readJson(path.join(ledgerRoot, 'agent-patch-rollback-proof.json'));
56
- const proof = readJson(path.join(ledgerRoot, 'agent-patch-proof.json'));
57
- const changedFiles = [...new Set((apply.results || []).flatMap((row) => row.changed_files || []))];
58
- const writeOwners = new Map();
59
- for (const entry of queue.entries || []) {
60
- for (const file of entry.write_paths || []) {
61
- if (!writeOwners.has(file))
62
- writeOwners.set(file, new Set());
63
- writeOwners.get(file).add(entry.agent_id);
64
- }
65
- }
66
- const firstParallelWave = Math.max(0, ...(merge.parallel_apply_groups || []).map((group) => (group.entry_ids || []).length));
67
- const report = {
68
- schema: 'sks.patch-swarm-route-blackbox.v1',
69
- ok: result.ok === true && proof.ok === true,
70
- gate,
71
- route,
72
- route_command: routeCommand,
73
- fixture_root: tmp,
74
- mission_id: result.mission_id,
75
- requested_agents: 5,
76
- requested_work_items: 10,
77
- write_mode: result.parallel_write_policy?.write_mode,
78
- apply_patches: result.parallel_write_policy?.apply_patches,
79
- patch_envelopes_enqueued: queue.entries?.length || 0,
80
- first_parallel_wave_entry_count: firstParallelWave,
81
- changed_files: changedFiles,
82
- duplicate_write_owners: [...writeOwners.entries()].filter(([, owners]) => owners.size > 1).map(([file, owners]) => ({ file, owners: [...owners] })),
83
- rollback_digest_count: proof.rollback_digest_count,
84
- verification_ok: verification.ok === true,
85
- rollback_ok: rollback.ok === true,
86
- patch_proof_ok: proof.ok === true,
87
- route_final_proof_ok: result.proof?.ok === true,
88
- policy_only: false,
89
- artifacts: {
90
- queue: path.join(result.ledger_root, 'agent-patch-queue.json'),
91
- merge: path.join(result.ledger_root, 'agent-merge-coordinator-report.json'),
92
- apply: path.join(result.ledger_root, 'agent-patch-apply-results.json'),
93
- verification: path.join(result.ledger_root, 'agent-patch-verification-results.json'),
94
- rollback: path.join(result.ledger_root, 'agent-patch-rollback-proof.json'),
95
- proof: path.join(result.ledger_root, 'agent-patch-proof.json')
96
- },
97
- result
98
- };
99
- writeReport(reportName, report);
100
- assertGate(result.ok === true, `${gate} route final proof must pass`, report);
101
- assertGate(queue.entries?.length === 10, `${gate} must enqueue 10 patch envelopes`, report);
102
- assertGate(firstParallelWave >= 5, `${gate} must prove at least five first-wave disjoint patches`, report);
103
- assertGate(changedFiles.length >= 5, `${gate} must change at least five files`, report);
104
- assertGate(report.duplicate_write_owners.length === 0, `${gate} must not let two agents own the same file`, report);
105
- assertGate(proof.rollback_digest_count >= changedFiles.length, `${gate} must record rollback digests for changed files`, report);
106
- assertGate(verification.ok === true && verification.results?.length === 10, `${gate} verification results must exist for patches`, report);
107
- assertGate(rollback.ok === true, `${gate} rollback proof must pass`, report);
108
- assertGate(proof.ok === true, `${gate} patch proof must pass`, report);
109
- assertGate(result.proof?.ok === true, `${gate} route final proof must pass`, report);
110
- emitGate(gate, { mission_id: result.mission_id, changed_files: changedFiles.length, first_parallel_wave: firstParallelWave });
111
- return report;
112
- }
113
- //# sourceMappingURL=agent-patch-swarm-gate-lib.js.map
@@ -1,126 +0,0 @@
1
- #!/usr/bin/env node
2
- // @ts-nocheck
3
- import fs from 'node:fs';
4
- import os from 'node:os';
5
- import path from 'node:path';
6
- import { spawnSync } from 'node:child_process';
7
- import { assertGate, emitGate, root } from './sks-1-18-gate-lib.js';
8
- const reportPath = path.join(root, '.sneakoscope', 'reports', 'agent-real-codex-patch-envelope-smoke.json');
9
- fs.mkdirSync(path.dirname(reportPath), { recursive: true });
10
- const required = process.env.SKS_REQUIRE_REAL_CODEX_PATCHES === '1';
11
- if (process.env.SKS_TEST_REAL_CODEX_PATCHES !== '1') {
12
- optionalOrBlocked('set SKS_TEST_REAL_CODEX_PATCHES=1 to run real Codex patch envelope smoke', 'real_codex_patch_smoke_not_requested');
13
- }
14
- const fixture = fs.mkdtempSync(path.join(os.tmpdir(), 'sks-real-codex-patches-'));
15
- fs.mkdirSync(path.join(fixture, '.sneakoscope'), { recursive: true });
16
- for (const file of ['alpha.txt', 'beta.txt', 'gamma.txt'])
17
- fs.writeFileSync(path.join(fixture, file), `${file}: before\n`);
18
- const prompt = [
19
- 'Real Codex patch envelope smoke.',
20
- 'Return valid JSON matching schemas/codex/agent-result.schema.json.',
21
- 'Populate patch_envelopes with schema sks.agent-patch-envelope.v1 for alpha.txt, beta.txt, and gamma.txt.',
22
- 'Use write operations only inside this temp project, include lease_proof strategy_task_id, verification_node_id, rollback_node_id, and rollback_hint.'
23
- ].join(' ');
24
- const run = spawnSync(process.execPath, [
25
- path.join(root, 'dist', 'bin', 'sks.js'),
26
- 'agent',
27
- 'run',
28
- prompt,
29
- '--route', '$Agent',
30
- '--backend', 'codex-sdk',
31
- '--real',
32
- '--agents', '2',
33
- '--target-active-slots', '2',
34
- '--minimum-work-items', '2',
35
- '--work-items', '3',
36
- '--write-mode', 'parallel',
37
- '--apply-patches',
38
- '--max-write-agents', '2',
39
- '--json'
40
- ], { cwd: fixture, encoding: 'utf8', env: { ...process.env, SKS_SKIP_NPM_FRESHNESS_CHECK: '1' }, timeout: Number(process.env.SKS_REAL_CODEX_PATCH_TIMEOUT_MS || 10 * 60 * 1000), maxBuffer: 1024 * 1024 * 32 });
41
- assertGate(run.status === 0, 'real Codex patch smoke command failed', { stdout: run.stdout.slice(-4000), stderr: run.stderr.slice(-4000) });
42
- const json = parseJson(run.stdout);
43
- const ledgerRoot = path.join(fixture, json.ledger_root || '');
44
- const queue = readJson(path.join(ledgerRoot, 'agent-patch-queue.json'), null);
45
- const apply = readJson(path.join(ledgerRoot, 'agent-patch-apply-results.json'), null);
46
- const rollback = readJson(path.join(ledgerRoot, 'agent-patch-rollback-proof.json'), null);
47
- const verification = readJson(path.join(ledgerRoot, 'agent-patch-verification-results.json'), null);
48
- const processReports = listNamedFiles(path.join(ledgerRoot, 'sessions'), 'agent-process-report.json').map((file) => readJson(file, null)).filter(Boolean);
49
- const result = {
50
- schema: 'sks.agent-real-codex-patch-envelope-smoke.v1',
51
- ok: true,
52
- status: 'passed',
53
- proof_level: process.env.SKS_AGENT_DYNAMIC_BACKFILL_FIXTURE === '1' ? 'fixture_instrumented_real' : 'proven',
54
- required,
55
- fixture_root: fixture,
56
- mission_id: json.mission_id,
57
- patch_envelope_count: queue?.entries?.length || 0,
58
- queue_enqueue_ok: (queue?.entries?.length || 0) >= 3,
59
- patch_apply_ok: apply?.results?.every?.((row) => row.ok === true) === true,
60
- rollback_ok: rollback?.ok === true,
61
- verification_ok: verification?.ok === true,
62
- protected_path_violations: (queue?.entries || []).some((entry) => {
63
- const lease = entry.envelope?.lease_proof || {};
64
- return lease.protected_path_check === 'blocked' || (entry.violations || []).some((violation) => String(violation).startsWith('protected_path:'));
65
- }),
66
- process_report_profiles: processReports.map((row) => ({ profile: row.profile || null, managed_proxy_env_keys: row.managed_proxy_env_keys || [] })),
67
- blockers: []
68
- };
69
- result.blockers.push(...(result.queue_enqueue_ok ? [] : ['real_codex_patch_queue_enqueue_missing']));
70
- result.blockers.push(...(result.patch_apply_ok ? [] : ['real_codex_patch_apply_failed']));
71
- result.blockers.push(...(result.rollback_ok ? [] : ['real_codex_patch_rollback_proof_missing']));
72
- result.blockers.push(...(result.verification_ok ? [] : ['real_codex_patch_verification_missing']));
73
- result.blockers.push(...(!result.protected_path_violations ? [] : ['real_codex_patch_protected_path_violation']));
74
- result.ok = result.blockers.length === 0;
75
- result.status = result.ok ? 'passed' : 'blocked';
76
- result.proof_level = result.ok ? result.proof_level : 'blocked';
77
- writeReport(result);
78
- assertGate(result.ok === true, 'real Codex patch envelope smoke failed', result);
79
- emitGate('agent:real-codex-patch-envelope-smoke', { status: result.status, patch_envelope_count: result.patch_envelope_count });
80
- function optionalOrBlocked(reason, code, extra = {}) {
81
- const report = {
82
- schema: 'sks.agent-real-codex-patch-envelope-smoke.v1',
83
- ok: !required,
84
- status: required ? 'blocked' : 'integration_optional',
85
- proof_level: required ? 'real_required_missing' : 'integration_optional',
86
- required,
87
- reason,
88
- blockers: required ? [code] : [],
89
- ...extra
90
- };
91
- writeReport(report);
92
- emitGate('agent:real-codex-patch-envelope-smoke', { status: report.status, reason: code });
93
- process.exit(required ? 1 : 0);
94
- }
95
- function writeReport(report) {
96
- fs.writeFileSync(reportPath, `${JSON.stringify(report, null, 2)}\n`);
97
- }
98
- function parseJson(stdout) {
99
- const start = stdout.indexOf('{');
100
- const end = stdout.lastIndexOf('}');
101
- return JSON.parse(stdout.slice(start, end + 1));
102
- }
103
- function readJson(file, fallback) {
104
- try {
105
- return JSON.parse(fs.readFileSync(file, 'utf8'));
106
- }
107
- catch (err) {
108
- if (arguments.length > 1)
109
- return fallback;
110
- throw err;
111
- }
112
- }
113
- function listNamedFiles(dir, name) {
114
- const out = [];
115
- if (!fs.existsSync(dir))
116
- return out;
117
- for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
118
- const file = path.join(dir, entry.name);
119
- if (entry.isDirectory())
120
- out.push(...listNamedFiles(file, name));
121
- else if (entry.isFile() && entry.name === name)
122
- out.push(file);
123
- }
124
- return out;
125
- }
126
- //# sourceMappingURL=agent-real-codex-patch-envelope-smoke.js.map