sneakoscope 5.1.2 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +5 -1
  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/commands/doctor.js +32 -3
  7. package/dist/config/skills-manifest.json +58 -58
  8. package/dist/core/agents/agent-lifecycle.js +5 -3
  9. package/dist/core/agents/agent-orchestrator.js +14 -2
  10. package/dist/core/agents/agent-proof-evidence.js +16 -0
  11. package/dist/core/agents/native-cli-worker.js +0 -1
  12. package/dist/core/bench.js +24 -2
  13. package/dist/core/codex-app/sks-menubar.js +526 -133
  14. package/dist/core/commands/agent-command.js +35 -1
  15. package/dist/core/commands/basic-cli.js +61 -4
  16. package/dist/core/commands/command-utils.js +14 -4
  17. package/dist/core/commands/goal-command.js +3 -0
  18. package/dist/core/commands/image-ux-review-command.js +4 -1
  19. package/dist/core/commands/mad-sks-command.js +10 -1
  20. package/dist/core/commands/menubar-command.js +2 -1
  21. package/dist/core/commands/naruto-command.js +12 -7
  22. package/dist/core/commands/ppt-command.js +40 -1
  23. package/dist/core/commands/qa-loop-command.js +4 -1
  24. package/dist/core/commands/release-command.js +3 -3
  25. package/dist/core/commands/research-command.js +4 -0
  26. package/dist/core/commands/route-success-helpers.js +2 -0
  27. package/dist/core/commands/run-command.js +22 -5
  28. package/dist/core/commands/seo-command.js +31 -4
  29. package/dist/core/db-safety.js +8 -1
  30. package/dist/core/doctor/doctor-dirty-planner.js +51 -7
  31. package/dist/core/feature-fixture-executor.js +262 -0
  32. package/dist/core/feature-fixtures.js +95 -52
  33. package/dist/core/fsx.js +1 -1
  34. package/dist/core/loops/loop-decomposer.js +4 -3
  35. package/dist/core/loops/loop-planner.js +7 -3
  36. package/dist/core/loops/loop-worker-runtime.js +6 -0
  37. package/dist/core/naruto/naruto-real-worker-child.js +1 -1
  38. package/dist/core/pipeline-internals/runtime-gates.js +39 -3
  39. package/dist/core/proof/selftest-proof-fixtures.js +8 -0
  40. package/dist/core/providers/glm/naruto/glm-naruto-requirement-coverage.js +18 -1
  41. package/dist/core/providers/glm/naruto/glm-naruto-requirement-ledger.js +28 -12
  42. package/dist/core/questions.js +12 -10
  43. package/dist/core/release/release-gate-node.js +2 -0
  44. package/dist/core/routes.js +11 -0
  45. package/dist/core/stop-gate/stop-gate-check.js +4 -0
  46. package/dist/core/stop-gate/stop-gate-writer.js +4 -0
  47. package/dist/core/trust-kernel/trust-report.js +10 -1
  48. package/dist/core/update/update-migration-state.js +23 -3
  49. package/dist/core/version.js +1 -1
  50. package/dist/core/work-order-ledger.js +60 -0
  51. package/dist/core/zellij/zellij-slot-telemetry.js +1 -1
  52. package/dist/scripts/doctor-context7-mcp-repair-blackbox.js +16 -0
  53. package/dist/scripts/doctor-fix-production-blackbox.js +26 -0
  54. package/dist/scripts/doctor-startup-config-repair-blackbox.js +13 -0
  55. package/dist/scripts/doctor-supabase-mcp-repair-blackbox.js +14 -0
  56. package/dist/scripts/gate-policy-audit-check.js +2 -2
  57. package/dist/scripts/naruto-real-active-pool-runtime-check.js +26 -1
  58. package/dist/scripts/packlist-performance-check.js +7 -1
  59. package/dist/scripts/project-skill-dedupe-blackbox.js +36 -0
  60. package/dist/scripts/release-dag-full-coverage-check.js +1 -1
  61. package/dist/scripts/release-gate-existence-audit.js +1 -1
  62. package/dist/scripts/release-gate-planner.js +1 -1
  63. package/dist/scripts/release-gate-script-parity-check.js +44 -16
  64. package/dist/scripts/release-metadata-1-19-check.js +2 -2
  65. package/dist/scripts/sks-menubar-install-check.js +57 -20
  66. package/dist/scripts/supabase-secret-preservation-blackbox.js +29 -0
  67. package/dist/scripts/update-preserves-supabase-keys-blackbox.js +27 -0
  68. package/dist/scripts/zellij-slot-telemetry-runtime-check.js +1 -0
  69. package/package.json +12 -65
  70. package/schemas/release/release-gate-node.schema.json +1 -0
  71. package/bench/tasks/t01-off-by-one/repo/package.json +0 -9
  72. package/bench/tasks/t01-off-by-one/repo/src/pagination.js +0 -5
  73. package/bench/tasks/t01-off-by-one/repo/test.js +0 -5
  74. package/bench/tasks/t01-off-by-one/task.json +0 -13
  75. package/bench/tasks/t02-signature-cochange/repo/package.json +0 -9
  76. package/bench/tasks/t02-signature-cochange/repo/src/admin.js +0 -5
  77. package/bench/tasks/t02-signature-cochange/repo/src/audit.js +0 -5
  78. package/bench/tasks/t02-signature-cochange/repo/src/labels.js +0 -3
  79. package/bench/tasks/t02-signature-cochange/repo/src/profile.js +0 -5
  80. package/bench/tasks/t02-signature-cochange/repo/test.js +0 -9
  81. package/bench/tasks/t02-signature-cochange/task.json +0 -12
  82. package/bench/tasks/t03-type-puzzle/repo/package.json +0 -9
  83. package/bench/tasks/t03-type-puzzle/repo/src/config.js +0 -4
  84. package/bench/tasks/t03-type-puzzle/repo/test.js +0 -6
  85. package/bench/tasks/t03-type-puzzle/task.json +0 -13
  86. package/bench/tasks/t04-refactor-preserve/repo/package.json +0 -9
  87. package/bench/tasks/t04-refactor-preserve/repo/src/cart.js +0 -8
  88. package/bench/tasks/t04-refactor-preserve/repo/test.js +0 -4
  89. package/bench/tasks/t04-refactor-preserve/task.json +0 -12
  90. package/bench/tasks/t05-performance/repo/package.json +0 -9
  91. package/bench/tasks/t05-performance/repo/src/pairs.js +0 -9
  92. package/bench/tasks/t05-performance/repo/test.js +0 -11
  93. package/bench/tasks/t05-performance/task.json +0 -12
  94. package/bench/tasks/t06-mistake-rule/repo/package.json +0 -9
  95. package/bench/tasks/t06-mistake-rule/repo/src/loader.js +0 -6
  96. package/bench/tasks/t06-mistake-rule/repo/test.js +0 -7
  97. package/bench/tasks/t06-mistake-rule/task.json +0 -12
@@ -842,7 +842,8 @@ function applyNarutoWorkGraphToPartition(partition, graph, roster, targetActiveS
842
842
  const writePaths = normalizePathList(item.write_paths);
843
843
  const readonlyPaths = normalizePathList(item.readonly_paths);
844
844
  const targetPaths = normalizePathList(item.target_paths);
845
- const parentObjective = normalizeWorkerPromptText(parentPrompt);
845
+ const parentObjectiveNormalized = normalizeWorkerPromptText(parentPrompt);
846
+ const parentObjective = parentObjectiveNormalized.text;
846
847
  return Array.from({ length: candidateCount }, (_unused, candidateOffset) => {
847
848
  const candidateIndex = candidateOffset + 1;
848
849
  const candidateSliceId = candidateCount > 1 ? `${sliceId}-cand${candidateIndex}` : sliceId;
@@ -889,6 +890,9 @@ function applyNarutoWorkGraphToPartition(partition, graph, roster, targetActiveS
889
890
  goal_mode_ref: goalModeRef,
890
891
  strategy_refs: strategyRefs,
891
892
  parent_prompt: parentObjective,
893
+ worker_prompt_truncated: parentObjectiveNormalized.truncated
894
+ ? { worker: owner, dropped_chars: parentObjectiveNormalized.dropped_chars }
895
+ : null,
892
896
  max_attempts: 1,
893
897
  description: [
894
898
  parentObjective ? `Parent Naruto objective:\n${parentObjective}` : null,
@@ -2045,8 +2049,16 @@ function buildDirectSdkWorkerPrompt(slice) {
2045
2049
  'Required JSON fields: status, summary, findings, changed_files, patch_envelopes, verification, rollback_notes, blockers.'
2046
2050
  ].join('\n');
2047
2051
  }
2052
+ const WORKER_PROMPT_TEXT_MAX_CHARS = 32000;
2048
2053
  function normalizeWorkerPromptText(value) {
2049
- return String(value || '').replace(/\s+/g, ' ').trim().slice(0, 4000);
2054
+ const normalized = String(value || '').replace(/[^\S\n]+/g, ' ').replace(/\n{3,}/g, '\n\n').trim();
2055
+ const truncated = normalized.length > WORKER_PROMPT_TEXT_MAX_CHARS;
2056
+ const text = truncated ? normalized.slice(0, WORKER_PROMPT_TEXT_MAX_CHARS) : normalized;
2057
+ return {
2058
+ text,
2059
+ truncated,
2060
+ dropped_chars: truncated ? normalized.length - WORKER_PROMPT_TEXT_MAX_CHARS : 0
2061
+ };
2050
2062
  }
2051
2063
  function buildDirectNoPatchReason(slice, opts) {
2052
2064
  const writePathCount = sdkWritePaths(slice, opts).length;
@@ -134,6 +134,19 @@ export async function writeAgentProofEvidence(root, input) {
134
134
  || (scheduler.pending_queue_drained === true
135
135
  && Number(scheduler.active_slot_count || 0) === 0
136
136
  && Number(scheduler.max_observed_active_slots || 0) >= Number(scheduler.target_active_slots || 0));
137
+ const workQueueItems = Array.isArray(workQueue?.items) ? workQueue.items : [];
138
+ const workItemsNotAllCompletedIds = workQueueItems
139
+ .filter((item) => item.status !== 'completed')
140
+ .map((item) => String(item.id));
141
+ const workItemsFailedOrBlockedCount = Number(scheduler?.failed_count || 0) + Number(scheduler?.blocked_count || 0);
142
+ const workItemStatusById = new Map(workQueueItems.map((item) => [String(item.id), String(item.status)]));
143
+ const orphanedPendingWorkItemIds = workQueueItems
144
+ .filter((item) => item.status === 'pending')
145
+ .filter((item) => (Array.isArray(item.dependencies) ? item.dependencies : []).some((dep) => {
146
+ const depStatus = workItemStatusById.get(String(dep));
147
+ return depStatus === 'failed' || depStatus === 'blocked' || !depStatus;
148
+ }))
149
+ .map((item) => String(item.id));
137
150
  const blockers = [
138
151
  ...(lifecycle.ok ? [] : ['agent_lifecycle_not_all_closed']),
139
152
  ...(lifecycle.ok ? [] : lifecycle.open_sessions.map((id) => 'session_open:' + id)),
@@ -154,6 +167,9 @@ export async function writeAgentProofEvidence(root, input) {
154
167
  ...(taskGraph && !taskGraphMatchesCliOptions ? ['task_graph_cli_options_mismatch'] : []),
155
168
  ...(workQueue && taskGraph && !workQueueMatchesTaskGraph ? ['work_queue_task_graph_mismatch'] : []),
156
169
  ...(scheduler && workQueue && !schedulerMatchesWorkQueue ? ['scheduler_work_queue_mismatch'] : []),
170
+ ...(workQueue && schedulerTotalWorkItems && Number(scheduler?.completed_count || 0) !== schedulerTotalWorkItems ? ['work_items_not_all_completed:' + workItemsNotAllCompletedIds.join(',')] : []),
171
+ ...(workItemsFailedOrBlockedCount > 0 ? ['work_items_failed:' + workItemsFailedOrBlockedCount] : []),
172
+ ...(orphanedPendingWorkItemIds.length ? ['work_items_orphaned_pending:' + orphanedPendingWorkItemIds.join(',')] : []),
157
173
  ...(taskGraph && !taskGraphSourceRefsOk ? ['task_graph_source_refs_missing'] : []),
158
174
  ...(taskGraph && !taskGraphGoalRefsOk ? ['task_graph_goal_refs_missing'] : []),
159
175
  ...(taskGraph && !taskGraphStrategyRefsOk ? ['task_graph_strategy_refs_missing'] : []),
@@ -327,7 +327,6 @@ function startWorkerProgressTelemetry(input) {
327
327
  status: 'running',
328
328
  backend: input.backend,
329
329
  serviceTier: input.serviceTier,
330
- progress: { done: tick, total: 0, label: 'heartbeat' },
331
330
  artifacts: [input.heartbeatRel],
332
331
  logTail: `backend running ${tick}`
333
332
  }).catch(() => undefined);
@@ -121,17 +121,28 @@ export async function runCoreBench(root = process.cwd(), { iterations = 3, tier
121
121
  for (const [label, args, commandRoot] of coreCommands(benchTrustMission)) {
122
122
  const values = [];
123
123
  const failures = [];
124
+ // TRUST_VALIDATE_BENCH_COMMAND measures latency of `sks trust validate` against a
125
+ // mock fixture mission. A --mock `$Naruto` run can never satisfy the real agent
126
+ // gate, so `sks trust validate` legitimately exits 1 (report.ok === false,
127
+ // status: 'blocked') every time regardless of environment. This row exists to
128
+ // measure command latency, not to assert the mock mission's trust status, so a
129
+ // well-formed trust-validation report (valid JSON with the expected schema) is
130
+ // accepted even on a nonzero exit; only a crash/unparseable-output counts as a
131
+ // bench failure for this specific command.
132
+ const acceptNonZeroExit = label === TRUST_VALIDATE_BENCH_COMMAND;
124
133
  for (let i = 0; i < CORE_BENCH_WARMUP_ITERATIONS; i += 1) {
125
134
  const result = await runBenchProcess(commandRoot || root, script, args);
126
- if (result.code !== 0)
135
+ if (result.code !== 0 && !(acceptNonZeroExit && isWellFormedTrustValidation(result.stdout))) {
127
136
  failures.push({ phase: 'warmup', code: result.code, stderr_tail: result.stderr.slice(-400), stdout_tail: result.stdout.slice(-400) });
137
+ }
128
138
  }
129
139
  for (let i = 0; i < measuredIterations; i += 1) {
130
140
  const t0 = performance.now();
131
141
  const result = await runBenchProcess(commandRoot || root, script, args);
132
142
  values.push(performance.now() - t0);
133
- if (result.code !== 0)
143
+ if (result.code !== 0 && !(acceptNonZeroExit && isWellFormedTrustValidation(result.stdout))) {
134
144
  failures.push({ phase: 'measure', code: result.code, stderr_tail: result.stderr.slice(-400), stdout_tail: result.stdout.slice(-400) });
145
+ }
135
146
  }
136
147
  const p95 = Math.round(percentile(values, 95));
137
148
  rows.push({
@@ -165,8 +176,19 @@ async function runBenchProcess(root, script, args) {
165
176
  env: { SKS_SKIP_NPM_FRESHNESS_CHECK: '1', SKS_DISABLE_UPDATE_CHECK: '1', CI: 'true' }
166
177
  });
167
178
  }
179
+ function isWellFormedTrustValidation(stdout) {
180
+ const parsed = parseJsonOutput(stdout);
181
+ return Boolean(parsed && parsed.schema === 'sks.trust-validation.v1' && typeof parsed.status === 'string');
182
+ }
168
183
  async function ensureBenchTrustMission(root, script) {
169
184
  const benchRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'sks-core-bench-trust-')).catch(() => root);
185
+ // `sks run` blocks the agent gate (and skips writing completion-proof.json) when
186
+ // its cwd is not a git repo (git_collaboration.status -> not_git_repo). The bench
187
+ // trust-mission scratch dir must be a git repo so completion-proof.json/
188
+ // trust-report.json/run-classification.json actually get written and
189
+ // hasBenchTrustArtifacts() can find a usable mission instead of falling back to
190
+ // a nonexistent 'bench-fixture-missing' id (which always fails trust validate).
191
+ await runProcess('git', ['init', '-q', '.'], { cwd: benchRoot, timeoutMs: 10_000 }).catch(() => null);
170
192
  const beforeMissionIds = await listMissionIds(benchRoot);
171
193
  const result = await runProcess(process.execPath, [script, 'run', 'fixture', '--mock', '--json'], {
172
194
  cwd: benchRoot,