agent-dealer 1.2.2 → 1.2.4
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.
- package/bundle/server/dist/capacity/claude-events.js +27 -10
- package/bundle/server/dist/capacity/claude-local-cache.js +794 -0
- package/bundle/server/dist/capacity/claude-local-cache.test.js +524 -0
- package/bundle/server/dist/capacity/cursor-individual-credentials.js +203 -16
- package/bundle/server/dist/capacity/cursor-individual-credentials.test.js +186 -2
- package/bundle/server/dist/capacity/cursor-individual.js +69 -2
- package/bundle/server/dist/capacity/cursor-individual.test.js +268 -2
- package/bundle/server/dist/capacity/muse-host.js +778 -0
- package/bundle/server/dist/capacity/muse-host.test.js +480 -0
- package/bundle/server/dist/capacity/muse-lifecycle.test.js +96 -0
- package/bundle/server/dist/capacity/muse-probe.js +250 -0
- package/bundle/server/dist/capacity/muse-probe.test.js +183 -0
- package/bundle/server/dist/capacity/muse.js +320 -63
- package/bundle/server/dist/capacity/muse.test.js +8 -51
- package/bundle/server/dist/coordinator/muse-spawn.js +143 -1
- package/bundle/server/dist/index.js +15 -2
- package/bundle/server/dist/routes/index.js +25 -9
- package/bundle/server/dist/routes/runtime-capacity.test.js +20 -7
- package/bundle/server/dist/runners/muse-code-jsonl.js +7 -1
- package/bundle/server/dist/runners/muse-serve-session.js +314 -0
- package/bundle/server/dist/runners/muse-serve-session.test.js +325 -0
- package/bundle/server/package.json +2 -2
- package/bundle/server/static-ui/assets/codex-YZSpL-SB.png +0 -0
- package/bundle/server/static-ui/assets/{index-DUYzboWh.css → index-CYqRh_-S.css} +1 -1
- package/bundle/server/static-ui/assets/index-UO4lHZw4.js +60 -0
- package/bundle/server/static-ui/assets/muse-CtdcC6ve.svg +33 -0
- package/bundle/server/static-ui/index.html +2 -2
- package/bundle/shared/package.json +1 -1
- package/dist/doctor.d.ts +72 -0
- package/dist/doctor.js +235 -1
- package/dist/doctor.test.d.ts +1 -0
- package/dist/doctor.test.js +276 -0
- package/package.json +1 -1
- package/bundle/server/static-ui/assets/index-0GDYfbaM.js +0 -60
|
@@ -320,20 +320,21 @@ export function extractClaudeCapacityFromEvents(events, nowMs = Date.now(), fall
|
|
|
320
320
|
return { runtime: CLAUDE_RUNTIME, windows: [...byKey.values()], unavailable: [] };
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
323
|
-
* Persist
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
323
|
+
* Persist Claude window readings as normalized capacity snapshots
|
|
324
|
+
* (per-window upserts — siblings not in this observation are left untouched,
|
|
325
|
+
* and a stored row newer than the incoming reading is never overwritten).
|
|
326
|
+
* Shared by session-event ingestion and the local-cache/probe path (NOT-268):
|
|
327
|
+
* both sources write the same `claude_unified_*` window keys, so the freshest
|
|
328
|
+
* observation wins per window regardless of which source produced it.
|
|
329
|
+
* Returns the number of windows persisted, or null when no usable window was
|
|
330
|
+
* observed. Never touches `runtime_availability`.
|
|
329
331
|
*/
|
|
330
|
-
export function
|
|
332
|
+
export function recordClaudeWindowReadings(readings, runtime, nowMs = Date.now()) {
|
|
331
333
|
if (runtime !== CLAUDE_RUNTIME)
|
|
332
334
|
return null;
|
|
333
|
-
|
|
334
|
-
if (!result)
|
|
335
|
+
if (readings.length === 0)
|
|
335
336
|
return null;
|
|
336
|
-
const normalized =
|
|
337
|
+
const normalized = readings.map((w) => normalizeAdapterWindow(runtime, w, nowMs));
|
|
337
338
|
const persistable = normalized.filter((n) => n.unavailableReason === null && n.remainingPercent !== null);
|
|
338
339
|
if (persistable.length === 0)
|
|
339
340
|
return null;
|
|
@@ -371,6 +372,22 @@ export function recordClaudeCapacityFromEvents(events, runtime, nowMs = Date.now
|
|
|
371
372
|
})));
|
|
372
373
|
return fresh.length;
|
|
373
374
|
}
|
|
375
|
+
/**
|
|
376
|
+
* Persist naturally observed unified windows as normalized capacity
|
|
377
|
+
* snapshots. Status is irrelevant — allowed events carry the utilization
|
|
378
|
+
* signal; rejected ones additionally drive NOT-111 elsewhere. Thin wrapper
|
|
379
|
+
* over `recordClaudeWindowReadings`: per-window upserts, newer-wins, never
|
|
380
|
+
* touches `runtime_availability`. Returns the number of windows persisted,
|
|
381
|
+
* or null when the runtime is not Claude or no usable windows were observed.
|
|
382
|
+
*/
|
|
383
|
+
export function recordClaudeCapacityFromEvents(events, runtime, nowMs = Date.now(), fallbackObservedAtMs = nowMs) {
|
|
384
|
+
if (runtime !== CLAUDE_RUNTIME)
|
|
385
|
+
return null;
|
|
386
|
+
const result = extractClaudeCapacityFromEvents(events, nowMs, fallbackObservedAtMs);
|
|
387
|
+
if (!result)
|
|
388
|
+
return null;
|
|
389
|
+
return recordClaudeWindowReadings(result.windows, runtime, nowMs);
|
|
390
|
+
}
|
|
374
391
|
/**
|
|
375
392
|
* File variant for session-end ingestion from a Dealer-managed Claude log.
|
|
376
393
|
* `fallbackObservedAtMs` is the session's spawn start. Returns the persisted
|