Files
OmniRoute/scripts/ad-hoc/dump-auto-combos.ts
Jay Ongg 74c9e7e0d2 feat(combo): Auto-Combo snapshot generation/duplication in the UX (#10354)
Adds a snapshot-generation button to each Auto-Combo catalog card: computeSnapshotWeights() scores candidates (taskFit/stability/tierPriority/costInv) at combo-creation time instead of the previous hardcoded weight:1, and the new POST /api/combos/duplicate endpoint materializes any auto/* template into a persistent, editable static combo with normalized weights. Closes #10231.

Validated in an isolated worktree boarded onto origin/release/v3.8.50 (0 conflicts, 51 files):
- 19/19 focused tests pass (snapshot-weights, combos-duplicate-route, combos-duplicate-resolution-audit) — covers auth gate (401/403), input validation (400/422), success shape, weight normalization, naming/dedup, and error-response sanitization (no stack traces).
- check-file-size, check-changelog-integrity: OK.
- typecheck:core: clean.
- check-complexity / check-cognitive-complexity: OK, both under baseline.

Co-authored-by: swingtempo <swingtempo@users.noreply.github.com>
2026-08-20 23:14:00 -03:00

53 lines
1.7 KiB
TypeScript

/**
* One-shot diagnostic: resolve every built-in auto-combo template and dump the
* resulting candidate pool, weight pack, and config as JSON for inspection.
*
* Run from repo root:
* node --import tsx/esm scripts/ad-hoc/dump-auto-combos.ts > _tasks/research/auto-combos-snapshot.json
*/
const { AUTO_TEMPLATE_VARIANTS, AUTO_SUFFIX_VARIANTS, AUTO_FAMILY_IDS } =
await import("@omniroute/open-sse/services/autoCombo/builtinCatalog");
const { createBuiltinAutoCombo, prepareBuiltinAutoComboInputs } =
await import("@omniroute/open-sse/services/autoCombo/builtinCatalog");
// Prepares the candidate pool once (DB reads: connections, settings, capabilities)
const prepared = await prepareBuiltinAutoComboInputs();
const allTemplates: string[] = [];
allTemplates.push(...Object.keys(AUTO_TEMPLATE_VARIANTS));
allTemplates.push(...AUTO_SUFFIX_VARIANTS);
allTemplates.push(...AUTO_FAMILY_IDS);
const results: Array<{
template: string;
candidateCount: number;
models: string[];
weightPack: Record<string, number>;
explorationRate: number;
}> = [];
for (const name of allTemplates) {
try {
const suffix = name.slice("auto/".length);
const combo = await createBuiltinAutoCombo(name, suffix, prepared as never);
results.push({
template: name,
candidateCount: combo.models.length,
models: combo.models.map((m) => m.model ?? `${m.providerId}/unknown`),
weightPack: combo.weights ?? {},
explorationRate: combo.explorationRate,
});
} catch (err) {
results.push({
template: name,
candidateCount: 0,
models: [],
weightPack: {},
explorationRate: 0,
});
}
}
console.log(JSON.stringify(results, null, 2));