sneakoscope 2.0.15 → 2.0.16

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.
@@ -1,7 +1,10 @@
1
1
  import path from 'node:path';
2
+ import fsp from 'node:fs/promises';
2
3
  import { appendJsonlBounded, ensureDir, nowIso, readJson, readText, writeJsonAtomic } from '../fsx.js';
3
4
  export const ZELLIJ_SLOT_TELEMETRY_EVENT_SCHEMA = 'sks.zellij-slot-telemetry-event.v1';
4
5
  export const ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA = 'sks.zellij-slot-telemetry-snapshot.v1';
6
+ const telemetrySnapshotCache = new Map();
7
+ const telemetrySnapshotWriteCounts = new Map();
5
8
  export function slotTelemetryEventPath(root, missionId) {
6
9
  return path.join(inferMissionDir(root, missionId), 'zellij', 'slot-telemetry.events.jsonl');
7
10
  }
@@ -16,14 +19,51 @@ export async function appendZellijSlotTelemetry(root, event) {
16
19
  const file = slotTelemetryEventPath(root, missionId);
17
20
  await ensureDir(path.dirname(file));
18
21
  await appendJsonlBounded(file, normalized);
22
+ const previous = await readZellijSlotTelemetrySnapshotNoRebuild(root, missionId);
23
+ if (previous) {
24
+ const snapshotPath = slotTelemetrySnapshotPath(root, missionId);
25
+ const next = applyTelemetryEventToSnapshot(previous, normalized);
26
+ telemetrySnapshotCache.set(snapshotPath, next);
27
+ if (shouldFlushTelemetrySnapshot(snapshotPath, normalized))
28
+ await writeTelemetrySnapshotFast(snapshotPath, next);
29
+ return;
30
+ }
19
31
  await rebuildZellijSlotTelemetrySnapshot(root, missionId);
20
32
  }
21
33
  export async function readZellijSlotTelemetrySnapshot(root, missionId) {
22
- const existing = await readJson(slotTelemetrySnapshotPath(root, missionId), null);
34
+ const snapshotPath = slotTelemetrySnapshotPath(root, missionId);
35
+ const cached = telemetrySnapshotCache.get(snapshotPath);
36
+ if (cached?.schema === ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA)
37
+ return cached;
38
+ const existing = await readJson(snapshotPath, null);
23
39
  if (existing?.schema === ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA)
24
40
  return existing;
25
41
  return rebuildZellijSlotTelemetrySnapshot(root, missionId);
26
42
  }
43
+ export async function readZellijSlotTelemetrySnapshotNoRebuild(root, missionId) {
44
+ const snapshotPath = slotTelemetrySnapshotPath(root, missionId);
45
+ const cached = telemetrySnapshotCache.get(snapshotPath);
46
+ if (cached?.schema === ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA)
47
+ return cached;
48
+ const existing = await readJson(snapshotPath, null);
49
+ if (existing?.schema === ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA)
50
+ telemetrySnapshotCache.set(snapshotPath, existing);
51
+ return existing?.schema === ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA ? existing : null;
52
+ }
53
+ export function applyTelemetryEventToSnapshot(snapshot, event) {
54
+ const key = slotTelemetryKey(event.slot_id || event.worker_id, event.generation_index);
55
+ const slots = {
56
+ ...(snapshot.slots || {}),
57
+ [key]: mergeSlotTelemetry(snapshot.slots?.[key], event)
58
+ };
59
+ return {
60
+ schema: ZELLIJ_SLOT_TELEMETRY_SNAPSHOT_SCHEMA,
61
+ mission_id: event.mission_id || snapshot.mission_id,
62
+ updated_at: nowIso(),
63
+ slots,
64
+ counts: countSlotTelemetry(slots)
65
+ };
66
+ }
27
67
  export async function rebuildZellijSlotTelemetrySnapshot(root, missionId) {
28
68
  const eventsPath = slotTelemetryEventPath(root, missionId);
29
69
  const rows = await readTelemetryEvents(eventsPath);
@@ -43,6 +83,7 @@ export async function rebuildZellijSlotTelemetrySnapshot(root, missionId) {
43
83
  counts: countSlotTelemetry(slots)
44
84
  };
45
85
  await writeJsonAtomic(slotTelemetrySnapshotPath(root, missionId), snapshot);
86
+ telemetrySnapshotCache.set(slotTelemetrySnapshotPath(root, missionId), snapshot);
46
87
  return snapshot;
47
88
  }
48
89
  async function readTelemetryEvents(file) {
@@ -167,6 +208,20 @@ function tail(value, max) {
167
208
  const text = String(value || '').replace(/\s+$/g, '');
168
209
  return text.length > max ? text.slice(-max) : text;
169
210
  }
211
+ async function writeTelemetrySnapshotFast(file, snapshot) {
212
+ await ensureDir(path.dirname(file));
213
+ await fsp.writeFile(file, `${JSON.stringify(snapshot)}\n`, 'utf8');
214
+ }
215
+ function shouldFlushTelemetrySnapshot(file, event) {
216
+ const next = (telemetrySnapshotWriteCounts.get(file) || 0) + 1;
217
+ telemetrySnapshotWriteCounts.set(file, next);
218
+ return next === 1
219
+ || next % 100 === 0
220
+ || event.event_type === 'worker_completed'
221
+ || event.event_type === 'worker_failed'
222
+ || event.status === 'completed'
223
+ || event.status === 'failed';
224
+ }
170
225
  function inferMissionDir(root, missionId) {
171
226
  const resolved = path.resolve(root);
172
227
  if (path.basename(resolved) === 'agents' && path.basename(path.dirname(resolved)) === missionId)
@@ -13,6 +13,7 @@ console.log(JSON.stringify({
13
13
  schema: 'sks.release-speed-summary.v1',
14
14
  ok: true,
15
15
  report: latest || null,
16
+ mode: summary?.affected_selection?.mode || (summary?.full === true ? 'full' : 'unknown'),
16
17
  selected_gates: summary?.selected_gates || 0,
17
18
  skipped_by_affected: summary?.skipped_by_affected?.length || 0,
18
19
  cached: summary?.cached || 0,
@@ -20,6 +21,7 @@ console.log(JSON.stringify({
20
21
  wall_ms: summary?.wall_ms || 0,
21
22
  cpu_time_saved_ms: summary?.cpu_time_saved_ms || 0,
22
23
  parallelism_gain: summary?.parallelism_gain || 0,
24
+ max_running: summary?.peak_running || summary?.max_running || 0,
23
25
  slowest_gates: summary?.slowest_gates || []
24
26
  }, null, 2));
25
27
  //# sourceMappingURL=release-speed-summary.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sneakoscope",
3
3
  "displayName": "ㅅㅋㅅ",
4
- "version": "2.0.15",
4
+ "version": "2.0.16",
5
5
  "description": "Sneakoscope Codex: fast proof-first Codex trust layer with image-based Voxel TriWiki.",
6
6
  "type": "module",
7
7
  "homepage": "https://github.com/mandarange/Sneakoscope-Codex#readme",
@@ -599,6 +599,30 @@
599
599
  "release:dynamic-presets": "node ./dist/scripts/release-dynamic-presets-check.js",
600
600
  "release:batch-runner": "node ./dist/scripts/release-batch-runner-check.js",
601
601
  "release:aggressive-resource-governor": "node ./dist/scripts/release-aggressive-resource-governor-check.js",
602
+ "parallel:runtime-proof": "node ./dist/scripts/parallel-runtime-proof-check.js",
603
+ "parallel:runtime-proof-events": "node ./dist/scripts/parallel-runtime-proof-events-check.js",
604
+ "parallel:runtime-real-blackbox": "node ./dist/scripts/parallel-runtime-real-blackbox.js",
605
+ "parallel:claim-enforcement": "node ./dist/scripts/parallel-claim-enforcement-check.js",
606
+ "scheduler:batch-dispatch": "node ./dist/scripts/scheduler-batch-dispatch-check.js",
607
+ "scheduler:utilization-proof": "node ./dist/scripts/scheduler-utilization-proof-check.js",
608
+ "scheduler:no-false-pending-block": "node ./dist/scripts/scheduler-no-false-pending-block-check.js",
609
+ "native-swarm:process-spawn-proof": "node ./dist/scripts/native-swarm-process-spawn-proof-check.js",
610
+ "native-swarm:zellij-does-not-block-workers": "node ./dist/scripts/native-swarm-zellij-does-not-block-workers-check.js",
611
+ "native-swarm:heartbeat-does-not-serialize-launch": "node ./dist/scripts/native-swarm-heartbeat-does-not-serialize-launch-check.js",
612
+ "model-call:concurrency": "node ./dist/scripts/model-call-concurrency-check.js",
613
+ "naruto:parallelism-mode": "node ./dist/scripts/naruto-parallelism-mode-check.js",
614
+ "naruto:visible-vs-active-workers": "node ./dist/scripts/naruto-visible-vs-active-workers-check.js",
615
+ "naruto:parallel-runtime-proof": "node ./dist/scripts/naruto-parallel-runtime-proof-check.js",
616
+ "naruto:parallelism-ux": "node ./dist/scripts/naruto-parallelism-ux-check.js",
617
+ "naruto:real-parallelism-blackbox": "node ./dist/scripts/naruto-real-parallelism-blackbox.js",
618
+ "git:worktree-batch-allocation": "node ./dist/scripts/git-worktree-batch-allocation-check.js",
619
+ "git:worktree-prewarm-runtime": "node ./dist/scripts/git-worktree-prewarm-runtime-check.js",
620
+ "release:full-parallelism-blackbox": "node ./dist/scripts/release-full-parallelism-blackbox.js",
621
+ "zellij:slot-telemetry-incremental": "node ./dist/scripts/zellij-slot-telemetry-incremental-check.js",
622
+ "zellij:slot-telemetry-performance": "node ./dist/scripts/zellij-slot-telemetry-performance-check.js",
623
+ "team:legacy-create-removed": "node ./dist/scripts/team-legacy-create-removed-check.js",
624
+ "mad-db:one-cycle-bounded": "node ./dist/scripts/mad-db-one-cycle-bounded-check.js",
625
+ "mad-db:operation-lifecycle-ledger": "node ./dist/scripts/mad-db-operation-lifecycle-ledger-check.js",
602
626
  "release:speed-summary": "node ./dist/scripts/release-speed-summary-check.js",
603
627
  "release:speed-summary:check": "node ./dist/scripts/release-speed-summary-check.js",
604
628
  "naruto:ssot-routing": "node ./dist/scripts/naruto-ssot-routing-check.js",
@@ -0,0 +1,48 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sks.parallel-runtime-proof.schema.json",
4
+ "type": "object",
5
+ "required": [
6
+ "schema",
7
+ "mission_id",
8
+ "generated_at",
9
+ "requested_workers",
10
+ "target_active_slots",
11
+ "max_observed_active_workers",
12
+ "unique_worker_pids",
13
+ "max_observed_model_calls",
14
+ "launch_span_ms",
15
+ "first_batch_launch_span_ms",
16
+ "wall_ms",
17
+ "sequential_estimate_ms",
18
+ "speedup_ratio",
19
+ "overlap_windows",
20
+ "visible_panes",
21
+ "headless_workers",
22
+ "passed",
23
+ "blockers"
24
+ ],
25
+ "properties": {
26
+ "schema": { "const": "sks.parallel-runtime-proof.v1" },
27
+ "mission_id": { "type": "string", "minLength": 1 },
28
+ "generated_at": { "type": "string" },
29
+ "requested_workers": { "type": "integer", "minimum": 1 },
30
+ "target_active_slots": { "type": "integer", "minimum": 1 },
31
+ "max_observed_active_workers": { "type": "integer", "minimum": 0 },
32
+ "max_observed_worker_processes": { "type": "integer", "minimum": 0 },
33
+ "unique_worker_pids": { "type": "integer", "minimum": 0 },
34
+ "unique_model_call_ids": { "type": "integer", "minimum": 0 },
35
+ "max_observed_model_calls": { "type": "integer", "minimum": 0 },
36
+ "launch_span_ms": { "type": "number", "minimum": 0 },
37
+ "first_batch_launch_span_ms": { "type": "number", "minimum": 0 },
38
+ "wall_ms": { "type": "number", "minimum": 0 },
39
+ "sequential_estimate_ms": { "type": "number", "minimum": 0 },
40
+ "speedup_ratio": { "type": "number", "minimum": 0 },
41
+ "overlap_windows": { "type": "array" },
42
+ "visible_panes": { "type": "integer", "minimum": 0 },
43
+ "headless_workers": { "type": "integer", "minimum": 0 },
44
+ "passed": { "type": "boolean" },
45
+ "blockers": { "type": "array", "items": { "type": "string" } }
46
+ },
47
+ "additionalProperties": true
48
+ }