harma-kit 0.0.0-stage → 0.2.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.
- package/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/README.md +77 -2
- package/bin/harma.mjs +4 -0
- package/data/catalog.json +1085 -0
- package/docs/agents-and-sessions.md +55 -0
- package/docs/choosing-models.md +83 -0
- package/docs/commands.md +103 -0
- package/docs/development.md +42 -0
- package/docs/how-harma-decides.md +71 -0
- package/docs/troubleshooting.md +41 -0
- package/package.json +49 -4
- package/skill/SKILL.md +122 -0
- package/skill/references/commands.md +49 -0
- package/skill/references/troubleshooting.md +37 -0
- package/src/backends.mjs +233 -0
- package/src/catalog.mjs +54 -0
- package/src/cli.mjs +98 -0
- package/src/commands.mjs +680 -0
- package/src/credits.mjs +101 -0
- package/src/harness.mjs +94 -0
- package/src/install.mjs +106 -0
- package/src/inventory.mjs +72 -0
- package/src/rank.mjs +102 -0
- package/src/roster.mjs +177 -0
- package/src/route.mjs +69 -0
- package/src/state.mjs +134 -0
- package/src/tui.mjs +345 -0
- package/src/usage.mjs +127 -0
- package/src/util.mjs +90 -0
package/src/credits.mjs
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// Credits and limits per provider.
|
|
2
|
+
// Primary source: CodexBar (`codexbar usage --format json --provider all`).
|
|
3
|
+
// Fallbacks, in order: a budget the user declared in .harma/config.json,
|
|
4
|
+
// then the local-log estimate (claude, codex). Otherwise "sconosciuto".
|
|
5
|
+
import { run, which, parseJson, stripIdentity, now } from './util.mjs';
|
|
6
|
+
import { HARNESS_META } from './harness.mjs';
|
|
7
|
+
import { usageFor, estimateCost } from './usage.mjs';
|
|
8
|
+
|
|
9
|
+
export async function readCodexbar({ env = process.env, bin = 'codexbar', timeoutSec = 120 } = {}) {
|
|
10
|
+
if (!which(bin, env)) return { ok: false, detail: 'codexbar non installato (https://github.com/steipete/CodexBar)', entries: [] };
|
|
11
|
+
const res = await run(bin, ['usage', '--format', 'json', '--provider', 'all', '--no-color'], { env, timeout: timeoutSec * 1000 });
|
|
12
|
+
const data = parseJson(res.stdout);
|
|
13
|
+
if (!Array.isArray(data)) {
|
|
14
|
+
return { ok: false, detail: `codexbar non ha restituito JSON (exit ${res.code})`, entries: [] };
|
|
15
|
+
}
|
|
16
|
+
return { ok: true, entries: data.map(stripIdentity) };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Collapse one CodexBar entry to the figures harma uses. */
|
|
20
|
+
export function summarizeEntry(e) {
|
|
21
|
+
const u = e.usage ?? {};
|
|
22
|
+
const windows = ['primary', 'secondary', 'tertiary']
|
|
23
|
+
.map((k) => (u[k] && typeof u[k].usedPercent === 'number' ? { window: k, used_pct: round(u[k].usedPercent), resets_at: u[k].resetsAt ?? null, minutes: u[k].windowMinutes ?? null } : null))
|
|
24
|
+
.filter(Boolean);
|
|
25
|
+
const maxUsed = windows.length ? Math.max(...windows.map((w) => w.used_pct)) : null;
|
|
26
|
+
const pc = u.providerCost;
|
|
27
|
+
const cost = pc && (pc.used !== undefined || pc.limit !== undefined) ? {
|
|
28
|
+
used: pc.used ?? null, limit: pc.limit ?? null, currency: pc.currencyCode ?? null, period: pc.period ?? null,
|
|
29
|
+
} : null;
|
|
30
|
+
let remaining = maxUsed === null ? null : round(100 - maxUsed);
|
|
31
|
+
if (remaining === null && cost?.limit) remaining = round(100 - (100 * (cost.used ?? 0)) / cost.limit);
|
|
32
|
+
return {
|
|
33
|
+
provider: e.provider,
|
|
34
|
+
ok: !e.error && !!e.usage,
|
|
35
|
+
error: e.error ? (e.error.message ?? String(e.error)).slice(0, 160) : null,
|
|
36
|
+
source: `codexbar:${e.source ?? '?'}`,
|
|
37
|
+
updated_at: u.updatedAt ?? null,
|
|
38
|
+
windows,
|
|
39
|
+
remaining_pct: remaining,
|
|
40
|
+
credits_remaining: e.credits?.remaining ?? null,
|
|
41
|
+
cost,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function classify(remaining, thresholds) {
|
|
46
|
+
if (remaining === null || remaining === undefined) return 'sconosciuto';
|
|
47
|
+
if (remaining < thresholds.exhausted_remaining_pct) return 'esaurito';
|
|
48
|
+
if (remaining < thresholds.low_remaining_pct) return 'scarso';
|
|
49
|
+
if (remaining >= thresholds.high_remaining_pct) return 'ampio';
|
|
50
|
+
return 'ok';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* One row per harness: its provider's credit state with source and time.
|
|
55
|
+
* `harnessNames` are the harnesses to report (normally the installed ones).
|
|
56
|
+
*/
|
|
57
|
+
export async function collectCredits({ harnessNames, config, catalog, env = process.env, codexbar, windowDays = 7 }) {
|
|
58
|
+
const cb = codexbar ?? await readCodexbar({ env });
|
|
59
|
+
const byProvider = new Map(cb.entries.map((e) => [e.provider, summarizeEntry(e)]));
|
|
60
|
+
const sinceMs = Date.now() - windowDays * 86_400_000;
|
|
61
|
+
const rows = [];
|
|
62
|
+
for (const h of harnessNames) {
|
|
63
|
+
const provider = HARNESS_META[h]?.codexbar ?? null;
|
|
64
|
+
const s = provider ? byProvider.get(provider) : null;
|
|
65
|
+
const row = {
|
|
66
|
+
harness: h, provider, fetched_at: now(),
|
|
67
|
+
source: null, remaining_pct: null, status: 'sconosciuto', detail: null, windows: [], cost: null, estimate: null,
|
|
68
|
+
};
|
|
69
|
+
if (s?.ok) {
|
|
70
|
+
Object.assign(row, { source: s.source, remaining_pct: s.remaining_pct, windows: s.windows, cost: s.cost, credits_remaining: s.credits_remaining, updated_at: s.updated_at });
|
|
71
|
+
} else if (s?.error) {
|
|
72
|
+
row.detail = `codexbar: ${s.error}`;
|
|
73
|
+
} else if (!cb.ok) {
|
|
74
|
+
row.detail = cb.detail;
|
|
75
|
+
} else if (provider) {
|
|
76
|
+
row.detail = `codexbar non riporta ${provider} (attivalo nell'app CodexBar)`;
|
|
77
|
+
}
|
|
78
|
+
const spent = HARNESS_META[h]?.logs ? estimateSpend(h, catalog, env, sinceMs) : null;
|
|
79
|
+
if (spent !== null) {
|
|
80
|
+
row.estimate = { usd: spent, window_days: windowDays, note: 'stima a listino API dai log locali; non è l\'addebito di un abbonamento' };
|
|
81
|
+
}
|
|
82
|
+
const budget = provider ? config.budgets?.[provider] : null;
|
|
83
|
+
if (row.remaining_pct === null && budget?.limit && spent !== null) {
|
|
84
|
+
row.remaining_pct = round(100 - (100 * spent) / budget.limit);
|
|
85
|
+
row.source = `budget dichiarato (${budget.limit} ${budget.currency ?? 'USD'}) − stima log locali ${windowDays}g`;
|
|
86
|
+
}
|
|
87
|
+
row.status = classify(row.remaining_pct, config.thresholds);
|
|
88
|
+
rows.push(row);
|
|
89
|
+
}
|
|
90
|
+
return { fetched_at: now(), codexbar: cb.ok ? 'ok' : cb.detail, rows };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function estimateSpend(harness, catalog, env, sinceMs) {
|
|
94
|
+
const sessions = usageFor(harness, { env, sinceMs });
|
|
95
|
+
if (!sessions.length) return null;
|
|
96
|
+
let total = 0;
|
|
97
|
+
for (const s of sessions) total += estimateCost(s, catalog).usd ?? 0;
|
|
98
|
+
return Math.round(total * 100) / 100;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function round(n) { return Math.round(n * 10) / 10; }
|
package/src/harness.mjs
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// How harma drives each agent CLI ("harness"): launch argv for a model and an
|
|
2
|
+
// effort, which CodexBar provider meters it, which herdr agent kind it is,
|
|
3
|
+
// how its native session id is obtained and how a session is resumed.
|
|
4
|
+
import { randomUUID } from 'node:crypto';
|
|
5
|
+
import { harnesses } from './catalog.mjs';
|
|
6
|
+
import { HarmaError } from './util.mjs';
|
|
7
|
+
|
|
8
|
+
// Facts not in the model catalog. Session/resume syntax verified with
|
|
9
|
+
// `claude --help` (2.1.319) and `codex resume --help` (codex-cli 0.167.0).
|
|
10
|
+
export const HARNESS_META = {
|
|
11
|
+
claude: { herdrKind: 'claude', codexbar: 'claude', logs: 'claude', presetSession: '--session-id', resume: (id) => ['claude', '--resume', id] },
|
|
12
|
+
codex: { herdrKind: 'codex', codexbar: 'codex', logs: 'codex', resume: (id) => ['codex', 'resume', id] },
|
|
13
|
+
agy: { herdrKind: 'agy', codexbar: 'antigravity' },
|
|
14
|
+
kimi: { herdrKind: 'kimi', codexbar: 'kimi' },
|
|
15
|
+
grok: { herdrKind: 'grok', codexbar: 'grok' },
|
|
16
|
+
muse: { herdrKind: 'muse', codexbar: 'muse', interactiveBinary: 'muse' },
|
|
17
|
+
qwen: { herdrKind: 'qwen', codexbar: 'qwencloud' },
|
|
18
|
+
mmx: { codexbar: 'minimax' },
|
|
19
|
+
vibe: { codexbar: 'mistral' },
|
|
20
|
+
// Claude Code pointed at another provider: needs that provider's env set up.
|
|
21
|
+
'claude-moonshot': { codexbar: 'moonshot', variantOf: 'claude' },
|
|
22
|
+
'claude-zai': { codexbar: 'zai', variantOf: 'claude' },
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function meta(name) {
|
|
26
|
+
return HARNESS_META[name] ?? {};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Parse "codex:gpt-6-astra" or a bare model id (harness inferred from the catalog). */
|
|
30
|
+
export function parseTarget(spec, catalog) {
|
|
31
|
+
if (!spec) throw new HarmaError('Manca il modello: usa <harness>:<model>, es. codex:gpt-6-astra');
|
|
32
|
+
const hs = harnesses(catalog);
|
|
33
|
+
if (spec.includes(':')) {
|
|
34
|
+
const [harness, model] = spec.split(/:(.*)/s);
|
|
35
|
+
if (!hs[harness]) throw new HarmaError(`Harness sconosciuto: ${harness}`, { hint: `Noti: ${Object.keys(hs).join(', ')}` });
|
|
36
|
+
return { harness, model };
|
|
37
|
+
}
|
|
38
|
+
const owners = Object.entries(hs).filter(([n, h]) => h.models?.[spec] && !meta(n).variantOf).map(([n]) => n);
|
|
39
|
+
if (owners.length === 1) return { harness: owners[0], model: spec };
|
|
40
|
+
if (owners.length > 1) throw new HarmaError(`Il modello ${spec} gira su più CLI: ${owners.join(', ')}`, { hint: 'Specifica <harness>:<model>' });
|
|
41
|
+
throw new HarmaError(`Modello sconosciuto: ${spec}`, { hint: 'Vedi `harma models`' });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function effortValues(harness, model, catalog) {
|
|
45
|
+
const h = harnesses(catalog)[harness];
|
|
46
|
+
return h?.models?.[model]?.effort_values ?? h?.effort_values ?? catalog.models?.[model]?.efforts ?? [];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The argv and env that start <harness> on <model> at <effort>.
|
|
51
|
+
* Returns {argv, env, effortApplied, sessionId, notes}.
|
|
52
|
+
*/
|
|
53
|
+
export function launchSpec({ harness, model, effort }, catalog, { sessionId } = {}) {
|
|
54
|
+
const h = harnesses(catalog)[harness];
|
|
55
|
+
if (!h) throw new HarmaError(`Harness sconosciuto: ${harness}`);
|
|
56
|
+
const m = meta(harness);
|
|
57
|
+
const hm = h.models?.[model];
|
|
58
|
+
if (!hm) throw new HarmaError(`${harness} non serve il modello ${model}`, { hint: `Modelli: ${Object.keys(h.models ?? {}).join(', ')}` });
|
|
59
|
+
|
|
60
|
+
const allowed = effortValues(harness, model, catalog);
|
|
61
|
+
if (effort && allowed.length && !allowed.includes(effort)) {
|
|
62
|
+
throw new HarmaError(`Effort ${effort} non supportato da ${harness}:${model}`, { hint: `Valori: ${allowed.join(', ')}` });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const binary = m.interactiveBinary ?? h.binary.split(' ')[0];
|
|
66
|
+
const name = (effort && hm.names?.[effort]) || hm.name || model;
|
|
67
|
+
const argv = [binary];
|
|
68
|
+
const env = {};
|
|
69
|
+
const notes = [];
|
|
70
|
+
if (h.model_flag) argv.push(h.model_flag, name);
|
|
71
|
+
else notes.push('questa CLI non ha un flag per il modello: usa quello configurato');
|
|
72
|
+
|
|
73
|
+
let effortApplied = false;
|
|
74
|
+
if (effort && h.effort_via) {
|
|
75
|
+
const [kind, key] = h.effort_via.split(/:(.*)/s);
|
|
76
|
+
if (kind === 'flag') { argv.push(key, effort); effortApplied = true; }
|
|
77
|
+
else if (kind === 'config') { argv.push('-c', `${key}="${effort}"`); effortApplied = true; }
|
|
78
|
+
else if (kind === 'env') { env[key] = effort; effortApplied = true; }
|
|
79
|
+
}
|
|
80
|
+
if (effort && !effortApplied) notes.push(`effort ${effort} non impostabile per ${harness}: resta il default della CLI`);
|
|
81
|
+
|
|
82
|
+
let sid = null;
|
|
83
|
+
if (m.presetSession) {
|
|
84
|
+
sid = sessionId ?? randomUUID();
|
|
85
|
+
argv.push(m.presetSession, sid);
|
|
86
|
+
}
|
|
87
|
+
return { argv, env, effortApplied, sessionId: sid, notes, billing: h.billing };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function resumeArgv(harness, sessionId) {
|
|
91
|
+
const m = meta(harness);
|
|
92
|
+
if (!sessionId) return null;
|
|
93
|
+
return m.resume ? m.resume(sessionId) : null;
|
|
94
|
+
}
|
package/src/install.mjs
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// install / uninstall / doctor.
|
|
2
|
+
// The skill directory (skill/) is copied to ~/.claude/skills/harma and/or
|
|
3
|
+
// ~/.codex/skills/harma. Both hosts load <dir>/SKILL.md.
|
|
4
|
+
import { cpSync, rmSync, existsSync, readFileSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { join, dirname } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { homedir } from 'node:os';
|
|
8
|
+
import { which, run, HarmaError } from './util.mjs';
|
|
9
|
+
import { loadCatalog } from './catalog.mjs';
|
|
10
|
+
import { aaKey } from './rank.mjs';
|
|
11
|
+
import { HerdrBackend, HcBackend } from './backends.mjs';
|
|
12
|
+
|
|
13
|
+
const PKG_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
14
|
+
const SKILL_SRC = join(PKG_ROOT, 'skill');
|
|
15
|
+
const MARKER = '.installed-by-harma';
|
|
16
|
+
|
|
17
|
+
export function skillTargets(target, env = process.env) {
|
|
18
|
+
const home = env.HOME || homedir();
|
|
19
|
+
const all = {
|
|
20
|
+
claude: join(env.CLAUDE_CONFIG_DIR || join(home, '.claude'), 'skills', 'harma'),
|
|
21
|
+
codex: join(env.CODEX_HOME || join(home, '.codex'), 'skills', 'harma'),
|
|
22
|
+
};
|
|
23
|
+
if (target === 'both' || !target) return all;
|
|
24
|
+
if (!all[target]) throw new HarmaError(`--target: claude | codex | both (non ${target})`);
|
|
25
|
+
return { [target]: all[target] };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function version() {
|
|
29
|
+
return JSON.parse(readFileSync(join(PKG_ROOT, 'package.json'), 'utf8')).version;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function cmdInstall(flags, opts = {}) {
|
|
33
|
+
const out = opts.out ?? ((s) => process.stdout.write(s + '\n'));
|
|
34
|
+
const env = opts.env ?? process.env;
|
|
35
|
+
const lines = [];
|
|
36
|
+
for (const [host, dest] of Object.entries(skillTargets(flags.target ?? 'both', env))) {
|
|
37
|
+
if (existsSync(dest) && !existsSync(join(dest, MARKER)) && !flags.force) {
|
|
38
|
+
lines.push(`${host}: ${dest} esiste e non è stato installato da harma — saltato (usa --force per sovrascrivere)`);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
rmSync(dest, { recursive: true, force: true });
|
|
42
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
43
|
+
cpSync(SKILL_SRC, dest, { recursive: true });
|
|
44
|
+
writeFileSync(join(dest, MARKER), `harma ${version()}\n`);
|
|
45
|
+
lines.push(`${host}: skill installata in ${dest}`);
|
|
46
|
+
}
|
|
47
|
+
lines.push('', 'Per la CLI: npm i -g harma-kit (comando: harma; oppure npx harma-kit <comando>)', 'Poi, nel progetto: harma init --orchestrator <harness>:<model> --effort <level>');
|
|
48
|
+
out(lines.join('\n'));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export async function cmdUninstall(flags, opts = {}) {
|
|
52
|
+
const out = opts.out ?? ((s) => process.stdout.write(s + '\n'));
|
|
53
|
+
const env = opts.env ?? process.env;
|
|
54
|
+
const lines = [];
|
|
55
|
+
for (const [host, dest] of Object.entries(skillTargets(flags.target ?? 'both', env))) {
|
|
56
|
+
if (!existsSync(dest)) { lines.push(`${host}: non installata`); continue; }
|
|
57
|
+
if (!existsSync(join(dest, MARKER)) && !flags.force) { lines.push(`${host}: ${dest} non è di harma — lasciata`); continue; }
|
|
58
|
+
rmSync(dest, { recursive: true, force: true });
|
|
59
|
+
lines.push(`${host}: rimossa ${dest}`);
|
|
60
|
+
}
|
|
61
|
+
out(lines.join('\n'));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export async function cmdDoctor(flags, opts = {}) {
|
|
65
|
+
const out = opts.out ?? ((s) => process.stdout.write(s + '\n'));
|
|
66
|
+
const env = opts.env ?? process.env;
|
|
67
|
+
const checks = [];
|
|
68
|
+
const add = (name, ok, detail, required = false) => checks.push({ name, ok, detail, required });
|
|
69
|
+
|
|
70
|
+
const major = Number(process.versions.node.split('.')[0]);
|
|
71
|
+
add('node >= 20', major >= 20, process.versions.node, true);
|
|
72
|
+
|
|
73
|
+
const cat = loadCatalog({ env });
|
|
74
|
+
add('catalogo modelli', Boolean(cat?.models && Object.keys(cat.models).length), cat ? `${Object.keys(cat.models).length} modelli, ${cat.origin} ${cat.generated_at}` : 'non leggibile', true);
|
|
75
|
+
add('file della skill', existsSync(join(SKILL_SRC, 'SKILL.md')), SKILL_SRC, true);
|
|
76
|
+
|
|
77
|
+
const herdr = await new HerdrBackend({ env }).available();
|
|
78
|
+
const hc = await new HcBackend({ env }).available();
|
|
79
|
+
add('backend herdr', herdr.ok, `${herdr.version ?? ''} ${herdr.detail}`.trim());
|
|
80
|
+
add('backend hc (herdr-core)', hc.ok, `${hc.version ?? ''} ${hc.detail}`.trim());
|
|
81
|
+
add('almeno un backend', herdr.ok || hc.ok, herdr.ok || hc.ok ? 'ok' : 'installa herdr o herdr-core per avviare agenti', true);
|
|
82
|
+
|
|
83
|
+
const agentClis = ['claude', 'codex', 'agy', 'kimi', 'grok', 'muse', 'qwen'].filter((b) => which(b, env));
|
|
84
|
+
add('CLI di agenti', agentClis.length > 0, agentClis.join(', ') || 'nessuna', true);
|
|
85
|
+
|
|
86
|
+
const cb = which('codexbar', env);
|
|
87
|
+
let cbDetail = 'non installato: crediti da budget dichiarati o stima dai log';
|
|
88
|
+
if (cb) {
|
|
89
|
+
const v = await run('codexbar', ['--version'], { env, timeout: 10_000 });
|
|
90
|
+
cbDetail = v.stdout.trim().split('\n')[0] || 'presente';
|
|
91
|
+
}
|
|
92
|
+
add('codexbar (crediti)', Boolean(cb), cbDetail);
|
|
93
|
+
add('chiave Artificial Analysis', Boolean(aaKey(env)), aaKey(env) ? 'presente (harma rank --refresh)' : 'assente: si usa lo snapshot incluso');
|
|
94
|
+
|
|
95
|
+
for (const [host, dest] of Object.entries(skillTargets('both', env))) {
|
|
96
|
+
add(`skill per ${host}`, existsSync(join(dest, 'SKILL.md')), existsSync(dest) ? dest : `non installata (npx harma-kit install --target ${host})`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const failed = checks.filter((c) => c.required && !c.ok);
|
|
100
|
+
if (flags.json) out(JSON.stringify({ ok: !failed.length, checks }, null, 2));
|
|
101
|
+
else {
|
|
102
|
+
out(checks.map((c) => `${c.ok ? 'ok ' : c.required ? 'FAIL' : 'warn'} ${c.name} — ${c.detail}`).join('\n'));
|
|
103
|
+
out(failed.length ? `\n${failed.length} controlli obbligatori falliti.` : '\nharma è pronto.');
|
|
104
|
+
}
|
|
105
|
+
return { ok: !failed.length, checks, exitCode: failed.length ? 1 : 0 };
|
|
106
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// What this machine can run: agent CLIs on PATH, their models, their efforts.
|
|
2
|
+
// Codex lists its models and efforts in ~/.codex/models_cache.json (machine
|
|
3
|
+
// source). The other CLIs do not list models offline, so their models come
|
|
4
|
+
// from the catalog and are reported with that source.
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { homedir } from 'node:os';
|
|
7
|
+
import { which, run, readJson, now } from './util.mjs';
|
|
8
|
+
import { harnesses } from './catalog.mjs';
|
|
9
|
+
import { meta } from './harness.mjs';
|
|
10
|
+
|
|
11
|
+
export async function inventory({ catalog, env = process.env, config = {}, versions = true } = {}) {
|
|
12
|
+
const hs = harnesses(catalog);
|
|
13
|
+
const clis = [];
|
|
14
|
+
const rows = [];
|
|
15
|
+
for (const [name, h] of Object.entries(hs)) {
|
|
16
|
+
const m = meta(name);
|
|
17
|
+
const bin = h.binary.split(' ')[0];
|
|
18
|
+
const path = which(bin, env);
|
|
19
|
+
let state = path ? 'installato' : 'assente';
|
|
20
|
+
if (path && m.variantOf && !config.harnesses?.[name]?.enabled) {
|
|
21
|
+
state = 'richiede configurazione';
|
|
22
|
+
}
|
|
23
|
+
let version = null;
|
|
24
|
+
if (path && versions && !m.variantOf) {
|
|
25
|
+
const v = await run(bin, ['--version'], { env, timeout: 10_000 });
|
|
26
|
+
version = v.ok ? v.stdout.trim().split('\n')[0].slice(0, 60) : null;
|
|
27
|
+
}
|
|
28
|
+
clis.push({ harness: name, binary: bin, state, version, billing: h.billing, effort_via: h.effort_via });
|
|
29
|
+
if (state !== 'installato') continue;
|
|
30
|
+
|
|
31
|
+
const machine = name === 'codex' ? codexModels(env) : null;
|
|
32
|
+
const models = machine ?? Object.keys(h.models ?? {}).map((id) => {
|
|
33
|
+
const def = catalog.models?.[id]?.effort_default ?? null;
|
|
34
|
+
// A CLI with no effort control runs at its own default: list only that.
|
|
35
|
+
if (!h.effort_via) {
|
|
36
|
+
return { model: id, efforts: def ? [def] : [], effort_fixed: true, default: def, source: `catalogo (${h.source}, ${h.verified_on}); effort non impostabile dalla CLI` };
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
model: id,
|
|
40
|
+
efforts: h.models[id].effort_values ?? h.effort_values ?? catalog.models?.[id]?.efforts ?? [],
|
|
41
|
+
default: def,
|
|
42
|
+
source: `catalogo (${h.source}, ${h.verified_on})`,
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
for (const mm of models) {
|
|
46
|
+
rows.push({
|
|
47
|
+
harness: name,
|
|
48
|
+
model: mm.model,
|
|
49
|
+
efforts: mm.efforts,
|
|
50
|
+
effort_fixed: Boolean(mm.effort_fixed),
|
|
51
|
+
default_effort: mm.default ?? null,
|
|
52
|
+
in_catalog: Boolean(catalog.models?.[mm.model]),
|
|
53
|
+
source: mm.source,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return { fetched_at: now(), clis, models: rows };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function codexModels(env) {
|
|
61
|
+
const path = join(env.HOME || homedir(), '.codex', 'models_cache.json');
|
|
62
|
+
const data = readJson(path);
|
|
63
|
+
if (!Array.isArray(data?.models)) return null;
|
|
64
|
+
return data.models
|
|
65
|
+
.filter((m) => m.slug && m.visibility !== 'hidden')
|
|
66
|
+
.map((m) => ({
|
|
67
|
+
model: m.slug,
|
|
68
|
+
efforts: (m.supported_reasoning_levels ?? []).map((l) => l.effort).filter(Boolean),
|
|
69
|
+
default: m.default_reasoning_level ?? null,
|
|
70
|
+
source: `~/.codex/models_cache.json (${(data.fetched_at ?? '').slice(0, 10)})`,
|
|
71
|
+
}));
|
|
72
|
+
}
|
package/src/rank.mjs
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Intelligence per model x effort: the Artificial Analysis Intelligence Index.
|
|
2
|
+
// From the catalog snapshot, or refreshed from the AA API when a key exists
|
|
3
|
+
// (AA_API_KEY, or the delegation-kit key file). Missing scores stay null and
|
|
4
|
+
// are printed as "sconosciuto"; nothing is interpolated.
|
|
5
|
+
import { readFileSync, mkdirSync, writeFileSync, existsSync } from 'node:fs';
|
|
6
|
+
import { dirname, join } from 'node:path';
|
|
7
|
+
import { homedir } from 'node:os';
|
|
8
|
+
import { aaIndex, aaCost, userCatalogPath } from './catalog.mjs';
|
|
9
|
+
import { EFFORT_ORDER, HarmaError } from './util.mjs';
|
|
10
|
+
|
|
11
|
+
export function rankRows(catalog, inventoryModels) {
|
|
12
|
+
const rows = [];
|
|
13
|
+
for (const m of inventoryModels) {
|
|
14
|
+
const model = catalog.models?.[m.model];
|
|
15
|
+
const efforts = m.efforts?.length ? m.efforts : [null];
|
|
16
|
+
for (const effort of efforts) {
|
|
17
|
+
rows.push({
|
|
18
|
+
harness: m.harness,
|
|
19
|
+
model: m.model,
|
|
20
|
+
effort,
|
|
21
|
+
index: model ? aaIndex(model, effort) : null,
|
|
22
|
+
cost_per_task: model ? aaCost(model, effort) : null,
|
|
23
|
+
provider: model?.provider ?? null,
|
|
24
|
+
aa_date: model?.aa?.date ?? null,
|
|
25
|
+
index_version: model?.aa?.index_version ?? null,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return rows.sort((a, b) => (b.index ?? -1) - (a.index ?? -1)
|
|
30
|
+
|| EFFORT_ORDER.indexOf(a.effort) - EFFORT_ORDER.indexOf(b.effort));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const VARIANT = /^(.*?)\s*\(([^()]*)\)\s*$/;
|
|
34
|
+
const VARIANT_WORDS = new Set([...EFFORT_ORDER, 'non-reasoning', 'reasoning', 'thinking']);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* AA rows -> family slug -> variant -> index. Same rule as controller-models:
|
|
38
|
+
* the variant is the first effort word in the name's parenthetical
|
|
39
|
+
* ("Claude Opus 5.5 (Max)") and the family slug drops "-<variant>".
|
|
40
|
+
*/
|
|
41
|
+
export function aaFamilies(rows) {
|
|
42
|
+
const out = {};
|
|
43
|
+
for (const r of rows) {
|
|
44
|
+
const name = r.name ?? '';
|
|
45
|
+
const slug = r.slug ?? '';
|
|
46
|
+
const index = r.evaluations?.artificial_analysis_intelligence_index ?? null;
|
|
47
|
+
let variant = null;
|
|
48
|
+
const m = name.match(VARIANT);
|
|
49
|
+
if (m) variant = m[2].split(',').map((p) => p.trim().toLowerCase()).find((p) => VARIANT_WORDS.has(p)) ?? null;
|
|
50
|
+
const family = variant && slug.endsWith(`-${variant}`) ? slug.slice(0, -variant.length - 1) : slug;
|
|
51
|
+
(out[family] ??= {})[variant ?? 'default'] = index;
|
|
52
|
+
}
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function aaKey(env = process.env) {
|
|
57
|
+
if (env.AA_API_KEY) return env.AA_API_KEY;
|
|
58
|
+
const file = join(env.HOME || homedir(), '.local/share/delegation-kit/config/artificial-analysis.env');
|
|
59
|
+
if (!existsSync(file)) return null;
|
|
60
|
+
for (const line of readFileSync(file, 'utf8').split('\n')) {
|
|
61
|
+
if (line.startsWith('AA_API_KEY=')) return line.slice(11).trim().replace(/^['"]|['"]$/g, '');
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Fetch AA and write a refreshed catalog to the user config dir. Returns a change list. */
|
|
67
|
+
export async function refreshFromAA(catalog, { env = process.env, fetchImpl = fetch } = {}) {
|
|
68
|
+
const key = aaKey(env);
|
|
69
|
+
if (!key) {
|
|
70
|
+
throw new HarmaError('Nessuna chiave Artificial Analysis', { hint: 'Imposta AA_API_KEY (gratuita su artificialanalysis.ai). Senza chiave harma usa lo snapshot incluso.' });
|
|
71
|
+
}
|
|
72
|
+
let res;
|
|
73
|
+
try {
|
|
74
|
+
res = await fetchImpl(catalog.aa_api_url, { headers: { 'x-api-key': key, Accept: 'application/json', 'User-Agent': 'harma' } });
|
|
75
|
+
} catch (e) {
|
|
76
|
+
throw new HarmaError(`Artificial Analysis non raggiungibile: ${e.name}`);
|
|
77
|
+
}
|
|
78
|
+
if (!res.ok) throw new HarmaError(`Artificial Analysis ha risposto HTTP ${res.status}`);
|
|
79
|
+
const body = await res.json();
|
|
80
|
+
const rows = Array.isArray(body) ? body : body?.data;
|
|
81
|
+
if (!Array.isArray(rows)) throw new HarmaError('Risposta Artificial Analysis inattesa');
|
|
82
|
+
const fams = aaFamilies(rows);
|
|
83
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
84
|
+
const next = structuredClone(catalog);
|
|
85
|
+
delete next.origin;
|
|
86
|
+
const changes = [];
|
|
87
|
+
for (const [id, m] of Object.entries(next.models)) {
|
|
88
|
+
const fam = m.aa?.slug ? fams[m.aa.slug] : null;
|
|
89
|
+
if (!fam) { changes.push({ model: id, change: m.aa?.slug ? 'non trovato su AA' : 'senza slug AA' }); continue; }
|
|
90
|
+
const index = Object.fromEntries(Object.entries(fam).filter(([, v]) => v !== null && v !== undefined));
|
|
91
|
+
if (JSON.stringify(index) !== JSON.stringify(m.aa.index)) changes.push({ model: id, change: 'indice aggiornato', old: m.aa.index, new: index });
|
|
92
|
+
m.aa.index = Object.keys(index).length ? index : null;
|
|
93
|
+
m.aa.date = today;
|
|
94
|
+
m.aa.source = 'aa-api';
|
|
95
|
+
}
|
|
96
|
+
next.generated_at = today;
|
|
97
|
+
next.source = 'Artificial Analysis API (refresh harma) su catalogo ' + (catalog.registry_updated ?? '');
|
|
98
|
+
const dest = userCatalogPath(env);
|
|
99
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
100
|
+
writeFileSync(dest, JSON.stringify(next, null, 2) + '\n');
|
|
101
|
+
return { dest, changes };
|
|
102
|
+
}
|
package/src/roster.mjs
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// The roster: which models (in order of preference) the user wants for each
|
|
2
|
+
// kind of work, plus the orchestrator. Proposals come from route(); the user
|
|
3
|
+
// accepts or overrides them in the TUI (harma select) or with --accept / --set.
|
|
4
|
+
// Stored in .harma/config.json → roster, orchestrator.
|
|
5
|
+
//
|
|
6
|
+
// A row's choice is null (undecided), { none: true } (no model for this job) or
|
|
7
|
+
// { picks: [{harness, model, effort}, …] } in order of preference. At dispatch
|
|
8
|
+
// choosePick() takes the first pick with usable credits.
|
|
9
|
+
import { route, TASK_PROFILES, taskProfile } from './route.mjs';
|
|
10
|
+
import { EFFORT_ORDER, HarmaError, now } from './util.mjs';
|
|
11
|
+
|
|
12
|
+
export const ORCHESTRATOR = 'orchestratore';
|
|
13
|
+
export const TASK_TYPES = Object.keys(TASK_PROFILES);
|
|
14
|
+
export const MAX_PICKS = 5;
|
|
15
|
+
|
|
16
|
+
/** One option per installed harness:model, with every effort's index and cost. */
|
|
17
|
+
export function modelOptions(invModels, rankRowsArr, credits = []) {
|
|
18
|
+
const creditBy = new Map(credits.map((c) => [c.harness, c]));
|
|
19
|
+
const out = [];
|
|
20
|
+
for (const m of invModels) {
|
|
21
|
+
const rows = rankRowsArr.filter((r) => r.harness === m.harness && r.model === m.model);
|
|
22
|
+
const efforts = (m.efforts?.length ? m.efforts : [null]).map((e) => {
|
|
23
|
+
const r = rows.find((x) => x.effort === e);
|
|
24
|
+
return { effort: e, index: r?.index ?? null, cost: r?.cost_per_task ?? null };
|
|
25
|
+
}).sort((a, b) => EFFORT_ORDER.indexOf(a.effort) - EFFORT_ORDER.indexOf(b.effort));
|
|
26
|
+
const known = efforts.filter((e) => e.index !== null);
|
|
27
|
+
const best = known.length ? known.reduce((a, b) => (b.index > a.index ? b : a)) : null;
|
|
28
|
+
const c = creditBy.get(m.harness);
|
|
29
|
+
out.push({
|
|
30
|
+
harness: m.harness, model: m.model, provider: rows[0]?.provider ?? null,
|
|
31
|
+
efforts, best, default_effort: m.default_effort ?? null, effort_fixed: Boolean(m.effort_fixed),
|
|
32
|
+
credit: c?.status ?? 'sconosciuto', remaining: c?.remaining_pct ?? null,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return out.sort((a, b) => (b.best?.index ?? -1) - (a.best?.index ?? -1));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Picks of a saved roster entry; reads the 0.2.0 single-model shape too. */
|
|
39
|
+
export function rosterPicks(entry) {
|
|
40
|
+
if (!entry || entry.none) return [];
|
|
41
|
+
if (Array.isArray(entry.picks)) return entry.picks.map(bare);
|
|
42
|
+
return entry.harness ? [bare(entry)] : [];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const bare = (x) => ({ harness: x.harness, model: x.model, effort: x.effort ?? null });
|
|
46
|
+
|
|
47
|
+
/** Rows for the selection: orchestrator first, then one per task type. */
|
|
48
|
+
export function selectionRows({ cfg, rankRowsArr, credits }) {
|
|
49
|
+
const rows = [{
|
|
50
|
+
type: ORCHESTRATOR,
|
|
51
|
+
label: 'orchestratore (dirige il progetto)',
|
|
52
|
+
single: true,
|
|
53
|
+
proposal: cfg.orchestrator ? { picks: [bare(cfg.orchestrator)] } : null,
|
|
54
|
+
choice: cfg.orchestrator ? { picks: [bare(cfg.orchestrator)], source: 'configurato' } : null,
|
|
55
|
+
}];
|
|
56
|
+
for (const type of TASK_TYPES) {
|
|
57
|
+
const p = taskProfile(type, cfg);
|
|
58
|
+
const res = route(type, { rankRows: rankRowsArr, credits, config: cfg, top: 1000 });
|
|
59
|
+
const cands = res?.candidates ?? [];
|
|
60
|
+
const first = cands[0];
|
|
61
|
+
// A backup on another CLI, so a job still has a model when one provider runs low.
|
|
62
|
+
const backup = first && cands.find((c) => c.harness !== first.harness);
|
|
63
|
+
const saved = cfg.roster?.[type];
|
|
64
|
+
rows.push({
|
|
65
|
+
type,
|
|
66
|
+
label: p.label,
|
|
67
|
+
proposal: first ? {
|
|
68
|
+
picks: [first, backup].filter(Boolean).map(bare),
|
|
69
|
+
why: `${first.why}${backup ? ` · riserva su un'altra CLI: ${describePick(backup)}` : ''}`,
|
|
70
|
+
} : null,
|
|
71
|
+
choice: !saved ? null : saved.none ? { none: true, source: saved.source } : { picks: rosterPicks(saved), source: saved.source ?? 'utente' },
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
for (const r of rows) r.original = r.choice ? structuredClone(r.choice) : null;
|
|
75
|
+
return rows;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const samePick = (a, b) => Boolean(a && b && !a.none && !b.none
|
|
79
|
+
&& a.harness === b.harness && a.model === b.model && (a.effort ?? null) === (b.effort ?? null));
|
|
80
|
+
|
|
81
|
+
/** Same choice: both undecided, both "none", or the same picks in the same order. */
|
|
82
|
+
export function sameChoice(a, b) {
|
|
83
|
+
if (!a && !b) return true;
|
|
84
|
+
if (!a || !b) return false;
|
|
85
|
+
if (a.none || b.none) return Boolean(a.none && b.none);
|
|
86
|
+
const pa = a.picks ?? [a];
|
|
87
|
+
const pb = b.picks ?? [b];
|
|
88
|
+
return pa.length === pb.length && pa.every((p, i) => samePick(p, pb[i]));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const describePick = (p) => `${p.harness}:${p.model} @ ${p.effort ?? 'default'}`;
|
|
92
|
+
|
|
93
|
+
/** A single pick, a choice with picks, a saved roster entry, "none" or nothing. */
|
|
94
|
+
export function describe(p) {
|
|
95
|
+
if (!p) return '— da decidere';
|
|
96
|
+
if (p.none) return '— nessun modello';
|
|
97
|
+
const picks = p.picks ?? (p.harness ? [p] : []);
|
|
98
|
+
if (!picks.length) return '— da decidere';
|
|
99
|
+
return picks.map(describePick).join(' → ');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const CREDIT_RANK = { ampio: 0, ok: 0, sconosciuto: 0, scarso: 1 };
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Which of the user's picks to use now. The user's order wins; a pick is skipped
|
|
106
|
+
* when its CLI is missing or its credits are exhausted, and passed over for a
|
|
107
|
+
* later one when its credits are low ("scarso") and a later one's are not.
|
|
108
|
+
*/
|
|
109
|
+
export function choosePick(picks, credits = [], { installed = () => true } = {}) {
|
|
110
|
+
const by = new Map(credits.map((c) => [c.harness, c]));
|
|
111
|
+
const rated = picks.map((p, i) => {
|
|
112
|
+
const c = by.get(p.harness);
|
|
113
|
+
const credit = c?.status ?? 'sconosciuto';
|
|
114
|
+
const skip = !installed(p.harness) ? 'CLI non installata' : credit === 'esaurito' ? 'crediti esauriti' : null;
|
|
115
|
+
return { ...bare(p), position: i + 1, credit, remaining: c?.remaining_pct ?? null, skip };
|
|
116
|
+
});
|
|
117
|
+
const usable = rated.filter((p) => !p.skip);
|
|
118
|
+
const best = usable.reduce((a, p) => (a === null || CREDIT_RANK[p.credit] < CREDIT_RANK[a.credit] ? p : a), null);
|
|
119
|
+
const notes = rated.filter((p) => p !== best && best && p.position < best.position)
|
|
120
|
+
.map((p) => `n.${p.position} ${describePick(p)} saltato: ${p.skip ?? `crediti ${p.credit}`}`);
|
|
121
|
+
return { pick: best, rated, notes };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** "sviluppo=codex:gpt-6.1-sol@high|claude:claude-sonnet-5-5@high,review=none,orchestratore=claude:claude-opus-5-5@high" */
|
|
125
|
+
export function parseSetSpec(spec, { catalog, parseTarget, effortValues }) {
|
|
126
|
+
const out = {};
|
|
127
|
+
for (const part of String(spec).split(',').map((s) => s.trim()).filter(Boolean)) {
|
|
128
|
+
const [rawType, value] = part.split(/=(.*)/s);
|
|
129
|
+
const type = rawType === ORCHESTRATOR || TASK_PROFILES[rawType] ? rawType : taskProfile(rawType)?.type;
|
|
130
|
+
if (!type) throw new HarmaError(`Tipo di lavoro sconosciuto in --set: ${rawType}`, { hint: `Tipi: ${[ORCHESTRATOR, ...TASK_TYPES].join(', ')}` });
|
|
131
|
+
if (!value) throw new HarmaError(`--set ${rawType}: manca il modello (tipo=harness:modello@effort)`);
|
|
132
|
+
if (value === 'none') {
|
|
133
|
+
if (type === ORCHESTRATOR) throw new HarmaError('L\'orchestratore non può essere "none"');
|
|
134
|
+
out[type] = { none: true, source: 'utente' };
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
const picks = value.split('|').map((s) => s.trim()).filter(Boolean).map((v) => {
|
|
138
|
+
const [target, effort] = v.split('@');
|
|
139
|
+
const t = parseTarget(target, catalog);
|
|
140
|
+
const allowed = effortValues(t.harness, t.model, catalog);
|
|
141
|
+
if (effort && allowed.length && !allowed.includes(effort)) {
|
|
142
|
+
throw new HarmaError(`Effort ${effort} non supportato da ${t.harness}:${t.model}`, { hint: `Valori: ${allowed.join(', ')}` });
|
|
143
|
+
}
|
|
144
|
+
return { harness: t.harness, model: t.model, effort: effort || catalog.models?.[t.model]?.effort_default || null };
|
|
145
|
+
});
|
|
146
|
+
if (type === ORCHESTRATOR && picks.length > 1) throw new HarmaError('L\'orchestratore è un solo modello');
|
|
147
|
+
if (picks.length > MAX_PICKS) throw new HarmaError(`Al massimo ${MAX_PICKS} modelli per lavoro`);
|
|
148
|
+
const dup = picks.find((p, i) => picks.findIndex((q) => samePick(p, q)) !== i);
|
|
149
|
+
if (dup) throw new HarmaError(`--set ${type}: ${describePick(dup)} compare due volte`);
|
|
150
|
+
out[type] = { picks, source: 'utente' };
|
|
151
|
+
}
|
|
152
|
+
return out;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Write the rows' choices into cfg (roster + orchestrator). Returns the saved roster. */
|
|
156
|
+
export function applySelection(cfg, rows) {
|
|
157
|
+
const at = now();
|
|
158
|
+
const roster = { ...(cfg.roster ?? {}) };
|
|
159
|
+
for (const r of rows) {
|
|
160
|
+
if (r.type === ORCHESTRATOR) {
|
|
161
|
+
const o = r.choice?.picks?.[0];
|
|
162
|
+
if (o && !sameChoice(r.choice, r.original)) cfg.orchestrator = { ...bare(o), set_at: at };
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (!r.choice || (!r.choice.none && !r.choice.picks?.length)) { delete roster[r.type]; continue; }
|
|
166
|
+
if (r.choice.none) { roster[r.type] = { none: true, source: 'utente', at }; continue; }
|
|
167
|
+
roster[r.type] = {
|
|
168
|
+
picks: r.choice.picks.map(bare),
|
|
169
|
+
source: r.proposal && sameChoice(r.choice, r.proposal) ? 'proposta' : 'utente',
|
|
170
|
+
proposed: r.proposal ? describe(r.proposal) : null,
|
|
171
|
+
at,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
cfg.roster = roster;
|
|
175
|
+
cfg.roster_updated_at = at;
|
|
176
|
+
return roster;
|
|
177
|
+
}
|