chorus-codes 0.8.25 → 0.8.27
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +4 -4
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/connect/page.js +1 -1
- package/.next/server/app/connect/page.js.nft.json +1 -1
- package/.next/server/app/connect/page_client-reference-manifest.js +1 -1
- package/.next/server/app/demo/[scenario]/page.js +1 -1
- package/.next/server/app/demo/[scenario]/page.js.nft.json +1 -1
- package/.next/server/app/demo/[scenario]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/new/page.js +1 -1
- package/.next/server/app/new/page.js.nft.json +1 -1
- package/.next/server/app/new/page_client-reference-manifest.js +1 -1
- package/.next/server/app/new.html +1 -1
- package/.next/server/app/new.rsc +3 -3
- package/.next/server/app/new.segments/_full.segment.rsc +3 -3
- package/.next/server/app/new.segments/_head.segment.rsc +1 -1
- package/.next/server/app/new.segments/_index.segment.rsc +2 -2
- package/.next/server/app/new.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/new.segments/new/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/new.segments/new.segment.rsc +1 -1
- package/.next/server/app/onboarding/page.js +1 -1
- package/.next/server/app/onboarding/page.js.nft.json +1 -1
- package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/.next/server/app/onboarding.html +1 -1
- package/.next/server/app/onboarding.rsc +3 -3
- package/.next/server/app/onboarding.segments/_full.segment.rsc +3 -3
- package/.next/server/app/onboarding.segments/_head.segment.rsc +1 -1
- package/.next/server/app/onboarding.segments/_index.segment.rsc +2 -2
- package/.next/server/app/onboarding.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/onboarding.segments/onboarding.segment.rsc +1 -1
- package/.next/server/app/page.js +2 -2
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/personas/page.js +1 -1
- package/.next/server/app/personas/page.js.nft.json +1 -1
- package/.next/server/app/personas/page_client-reference-manifest.js +1 -1
- package/.next/server/app/personas.html +1 -1
- package/.next/server/app/personas.rsc +3 -3
- package/.next/server/app/personas.segments/_full.segment.rsc +3 -3
- package/.next/server/app/personas.segments/_head.segment.rsc +1 -1
- package/.next/server/app/personas.segments/_index.segment.rsc +2 -2
- package/.next/server/app/personas.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/personas.segments/personas/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/personas.segments/personas.segment.rsc +1 -1
- package/.next/server/app/runs/[runId]/page.js +2 -2
- package/.next/server/app/runs/[runId]/page.js.nft.json +1 -1
- package/.next/server/app/runs/[runId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/runs/page.js +2 -2
- package/.next/server/app/runs/page.js.nft.json +1 -1
- package/.next/server/app/runs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page.js +3 -3
- package/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/permissions/page.js +1 -1
- package/.next/server/app/settings/permissions/page.js.nft.json +1 -1
- package/.next/server/app/settings/permissions/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +3 -3
- package/.next/server/app/settings.segments/_full.segment.rsc +3 -3
- package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/server/app/settings.segments/_index.segment.rsc +2 -2
- package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
- package/.next/server/app/templates/page.js +2 -2
- package/.next/server/app/templates/page.js.nft.json +1 -1
- package/.next/server/app/templates/page_client-reference-manifest.js +1 -1
- package/.next/server/app/templates.html +1 -1
- package/.next/server/app/templates.rsc +3 -3
- package/.next/server/app/templates.segments/_full.segment.rsc +3 -3
- package/.next/server/app/templates.segments/_head.segment.rsc +1 -1
- package/.next/server/app/templates.segments/_index.segment.rsc +2 -2
- package/.next/server/app/templates.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/templates.segments/templates/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/templates.segments/templates.segment.rsc +1 -1
- package/.next/server/app-paths-manifest.json +4 -4
- package/.next/server/chunks/189.js +1 -0
- package/.next/server/chunks/{144.js → 21.js} +1 -1
- package/.next/server/chunks/{668.js → 313.js} +1 -1
- package/.next/server/chunks/325.js +1 -1
- package/.next/server/chunks/681.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{245-e103518e1c6037c0.js → 245-203bd8285e6b0858.js} +1 -1
- package/.next/static/chunks/249-2e840495c38ee022.js +25 -0
- package/.next/static/chunks/641-2908cb9553b8753a.js +1 -0
- package/.next/static/chunks/690-092c26db4082d49a.js +1 -0
- package/.next/static/chunks/app/connect/{page-a3a0af374f90ad4c.js → page-ad4409761e870bd0.js} +1 -1
- package/.next/static/chunks/app/demo/[scenario]/{page-6a0e4aec4bb96fee.js → page-39673968f543c473.js} +1 -1
- package/.next/static/chunks/app/new/{page-b96d75506030acf8.js → page-b5f609ab9413ac00.js} +1 -1
- package/.next/static/chunks/app/onboarding/{page-4be5a1d944e32672.js → page-8b0850fef487abdc.js} +1 -1
- package/.next/static/chunks/app/{page-35375a7c8b3d117a.js → page-9bdbaad592d0ce56.js} +1 -1
- package/.next/static/chunks/app/personas/{page-3884f8907107a4e6.js → page-440c6033a773100c.js} +1 -1
- package/.next/static/chunks/app/runs/[runId]/{page-b5bcf0c093389207.js → page-ffc36f12f1b63ebe.js} +1 -1
- package/.next/static/chunks/app/runs/{page-376175c1ac803558.js → page-6962ea572c9e4b74.js} +1 -1
- package/.next/static/chunks/app/settings/page-ad7180ee0d142704.js +25 -0
- package/.next/static/chunks/app/settings/permissions/{page-c90795aa9299bbe8.js → page-cd767401ac71a29c.js} +1 -1
- package/.next/static/chunks/app/templates/page-0112ab3c7ab5185d.js +1 -0
- package/.next/static/css/df4972a256406ec7.css +3 -0
- package/.next/trace +20 -20
- package/.next/trace-build +1 -1
- package/README.md +22 -0
- package/bin/chorus.mjs +87 -5
- package/dist/cli/commands/diagnose.js +255 -0
- package/dist/cli/commands/diagnose.js.map +1 -0
- package/dist/cli/crash-hook.js +135 -0
- package/dist/cli/crash-hook.js.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/daemon/cli-semaphore.js +266 -0
- package/dist/daemon/cli-semaphore.js.map +1 -0
- package/dist/daemon/routes/settings.js +39 -0
- package/dist/daemon/routes/settings.js.map +1 -1
- package/dist/daemon/runner/doer-driver.js +243 -214
- package/dist/daemon/runner/doer-driver.js.map +1 -1
- package/dist/daemon/runner/fallback-registry.js +110 -0
- package/dist/daemon/runner/fallback-registry.js.map +1 -0
- package/dist/daemon/runner/reviewer-driver.js +345 -256
- package/dist/daemon/runner/reviewer-driver.js.map +1 -1
- package/dist/daemon/runner/template-fallback.js +22 -8
- package/dist/daemon/runner/template-fallback.js.map +1 -1
- package/dist/daemon/runner.js +19 -0
- package/dist/daemon/runner.js.map +1 -1
- package/dist/lib/db/chats.js +28 -0
- package/dist/lib/db/chats.js.map +1 -1
- package/dist/lib/db/connection.js +6 -0
- package/dist/lib/db/connection.js.map +1 -1
- package/dist/lib/db/schema.sql +6 -0
- package/dist/lib/settings/concurrency.js +101 -0
- package/dist/lib/settings/concurrency.js.map +1 -0
- package/package.json +1 -1
- package/.next/server/chunks/946.js +0 -1
- package/.next/static/chunks/116-8bf7e014066cedde.js +0 -25
- package/.next/static/chunks/15-d438a2b057302bed.js +0 -1
- package/.next/static/chunks/641-60721f44faf711b9.js +0 -1
- package/.next/static/chunks/app/settings/page-1792a3e289409b2d.js +0 -25
- package/.next/static/chunks/app/templates/page-1449b0aea2e7cb68.js +0 -1
- package/.next/static/css/d2bb161eb5bee944.css +0 -3
- /package/.next/static/{47MSfijpKVM6q0E0ye9Mr → p1K3tWuW1MBx6L7K5jGPV}/_buildManifest.js +0 -0
- /package/.next/static/{47MSfijpKVM6q0E0ye9Mr → p1K3tWuW1MBx6L7K5jGPV}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Per-chat/round in-flight (lineage, model) registry — prevents two
|
|
4
|
+
* reviewer slots from independently picking the SAME template fallback
|
|
5
|
+
* target when their primaries fail in parallel.
|
|
6
|
+
*
|
|
7
|
+
* Why this exists:
|
|
8
|
+
* `buildSlotFallbackChain` dedups at chain-construction time against
|
|
9
|
+
* every active slot's PRIMARY model, but the template-level fallback
|
|
10
|
+
* list is shared across all slots. Two slots both compute the same
|
|
11
|
+
* tail (e.g. `anthropic/claude-sonnet-4-6`) and, when both primaries
|
|
12
|
+
* fail simultaneously, both dispatch to it in parallel — wasted cost,
|
|
13
|
+
* broken lineage diversity (the whole point of multi-LLM peer review).
|
|
14
|
+
* Real example 2026-05-08: a gemini slot AND an opencode/kimi slot
|
|
15
|
+
* both fell back to claude-sonnet-4-6 on the same run.
|
|
16
|
+
*
|
|
17
|
+
* Semantics:
|
|
18
|
+
* - `tryClaim(chatId, round, lineage, model)` — true on first claim,
|
|
19
|
+
* false if another slot in the same chat/round is already running
|
|
20
|
+
* this exact (lineage, model). Idempotent guard, never throws.
|
|
21
|
+
* - `release(...)` — called by the same slot when its attempt
|
|
22
|
+
* finishes (success, null, throw — all paths). Other slots can now
|
|
23
|
+
* claim. Idempotent.
|
|
24
|
+
* - `resetRound(chatId, round)` — drops all claims for a chat/round.
|
|
25
|
+
* Called from runner on phase_done so a multi-round chat starts
|
|
26
|
+
* each round with a clean registry.
|
|
27
|
+
*
|
|
28
|
+
* Why per-round, not per-chat:
|
|
29
|
+
* Round 2 reviewers are a fresh fan-out; their fallback targets
|
|
30
|
+
* should be claimable independently of round 1's already-completed
|
|
31
|
+
* reviewers. Round-scoped also means the registry self-clears on
|
|
32
|
+
* normal chat termination — no leak risk in long-running daemons.
|
|
33
|
+
*
|
|
34
|
+
* Why this is module-level state, not per-runner:
|
|
35
|
+
* The runner instantiates a fresh closure per chat, but the registry
|
|
36
|
+
* needs to outlive a single attempt() call across all slots in the
|
|
37
|
+
* same phase. Module state with chat-scoped keys is the smallest
|
|
38
|
+
* surface that gives the right reach. Same daemon-wide pattern as
|
|
39
|
+
* `cli-semaphore.ts`.
|
|
40
|
+
*
|
|
41
|
+
* Testing seam:
|
|
42
|
+
* `_testing.reset()` clears all state between vitest cases. Without
|
|
43
|
+
* this, claims from a prior test leak across the whole worker and
|
|
44
|
+
* later cases see false from `tryClaim` for unrelated targets.
|
|
45
|
+
*/
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports._testing = void 0;
|
|
48
|
+
exports.tryClaim = tryClaim;
|
|
49
|
+
exports.release = release;
|
|
50
|
+
exports.resetRound = resetRound;
|
|
51
|
+
exports.snapshot = snapshot;
|
|
52
|
+
const inFlight = new Map();
|
|
53
|
+
function roundKey(chatId, round) {
|
|
54
|
+
return `${chatId}:${round}`;
|
|
55
|
+
}
|
|
56
|
+
function entryKey(lineage, model) {
|
|
57
|
+
// `(default)` is the canonical placeholder when a slot has no
|
|
58
|
+
// declared model — buildSlotFallbackChain emits one such entry per
|
|
59
|
+
// models-less slot. Two slots both falling through to the lineage
|
|
60
|
+
// default would still collide; this key lets us catch that.
|
|
61
|
+
return `${lineage}:${model ?? '(default)'}`;
|
|
62
|
+
}
|
|
63
|
+
function tryClaim(chatId, round, lineage, model) {
|
|
64
|
+
const k = roundKey(chatId, round);
|
|
65
|
+
let set = inFlight.get(k);
|
|
66
|
+
if (!set) {
|
|
67
|
+
set = new Set();
|
|
68
|
+
inFlight.set(k, set);
|
|
69
|
+
}
|
|
70
|
+
const tag = entryKey(lineage, model);
|
|
71
|
+
if (set.has(tag))
|
|
72
|
+
return false;
|
|
73
|
+
set.add(tag);
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
function release(chatId, round, lineage, model) {
|
|
77
|
+
const k = roundKey(chatId, round);
|
|
78
|
+
const set = inFlight.get(k);
|
|
79
|
+
if (!set)
|
|
80
|
+
return;
|
|
81
|
+
set.delete(entryKey(lineage, model));
|
|
82
|
+
// Opportunistically drop the empty-Set parent entry so a long-running
|
|
83
|
+
// daemon processing thousands of chats doesn't accumulate one entry
|
|
84
|
+
// per terminated round. Cheap (one Map.delete per fully-released
|
|
85
|
+
// round); without this, ~50 bytes leak per chat × N chats over the
|
|
86
|
+
// process lifetime. Caught on chorus self-review of this PR.
|
|
87
|
+
if (set.size === 0)
|
|
88
|
+
inFlight.delete(k);
|
|
89
|
+
}
|
|
90
|
+
function resetRound(chatId, round) {
|
|
91
|
+
inFlight.delete(roundKey(chatId, round));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Diagnostic snapshot — currently in-flight tags grouped by chat/round.
|
|
95
|
+
* Useful when debugging "why did slot B skip this entry?" — pair with
|
|
96
|
+
* the [reviewer] daemon log line.
|
|
97
|
+
*/
|
|
98
|
+
function snapshot() {
|
|
99
|
+
const out = {};
|
|
100
|
+
for (const [k, set] of inFlight.entries()) {
|
|
101
|
+
out[k] = [...set];
|
|
102
|
+
}
|
|
103
|
+
return out;
|
|
104
|
+
}
|
|
105
|
+
exports._testing = {
|
|
106
|
+
reset: () => {
|
|
107
|
+
inFlight.clear();
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=fallback-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallback-registry.js","sourceRoot":"","sources":["../../../src/daemon/runner/fallback-registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;;;AAgBH,4BAgBC;AAED,0BAgBC;AAED,gCAEC;AAOD,4BAMC;AAjED,MAAM,QAAQ,GAA6B,IAAI,GAAG,EAAE,CAAC;AAErD,SAAS,QAAQ,CAAC,MAAc,EAAE,KAAa;IAC7C,OAAO,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,QAAQ,CAAC,OAAe,EAAE,KAAyB;IAC1D,8DAA8D;IAC9D,mEAAmE;IACnE,kEAAkE;IAClE,4DAA4D;IAC5D,OAAO,GAAG,OAAO,IAAI,KAAK,IAAI,WAAW,EAAE,CAAC;AAC9C,CAAC;AAED,SAAgB,QAAQ,CACtB,MAAc,EACd,KAAa,EACb,OAAe,EACf,KAAyB;IAEzB,MA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