@yunhozz/arc 0.4.6 → 0.5.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/MANIFEST.sha256 +89 -76
- package/README.md +35 -51
- package/claude/agents/arc-implementer.md +2 -2
- package/claude/agents/arc-planner.md +1 -1
- package/claude/agents/arc-qa.md +1 -1
- package/claude/agents/arc-reviewer.md +1 -1
- package/claude/agents/arc-scouter.md +1 -1
- package/claude/skill/models.toml +7 -7
- package/claude/skill/references/coordination.md +6 -2
- package/claude/skill/references/handoff-prep.md +5 -0
- package/claude/skill/references/handoff.md +2 -2
- package/claude/skill/references/planning.md +2 -2
- package/claude/skill/references/verification.md +21 -3
- package/claude/skill/references/worktree-creation.md +2 -2
- package/codex/agents/arc-implementer.toml +1 -1
- package/codex/agents/arc-planner.toml +1 -1
- package/codex/agents/arc-qa.toml +1 -1
- package/codex/agents/arc-reviewer.toml +1 -1
- package/codex/agents/arc-scouter.toml +1 -1
- package/codex/skill/models.toml +5 -5
- package/codex/skill/references/coordination.md +6 -2
- package/codex/skill/references/handoff-prep.md +5 -0
- package/codex/skill/references/handoff.md +2 -2
- package/codex/skill/references/planning.md +2 -2
- package/codex/skill/references/verification.md +20 -2
- package/gemini/agents/arc-implementer.md +3 -3
- package/gemini/agents/arc-planner.md +2 -2
- package/gemini/agents/arc-qa.md +2 -2
- package/gemini/agents/arc-reviewer.md +2 -2
- package/gemini/agents/arc-scouter.md +2 -2
- package/gemini/skill/models.toml +6 -6
- package/gemini/skill/references/coordination.md +7 -3
- package/gemini/skill/references/handoff-prep.md +5 -0
- package/gemini/skill/references/handoff.md +2 -2
- package/gemini/skill/references/planning.md +2 -2
- package/gemini/skill/references/verification.md +21 -3
- package/gemini/skill/references/worktree-creation.md +2 -2
- package/grok/agents/arc-implementer.md +2 -2
- package/grok/agents/arc-planner.md +1 -1
- package/grok/agents/arc-qa.md +1 -1
- package/grok/agents/arc-reviewer.md +1 -1
- package/grok/agents/arc-scouter.md +1 -1
- package/grok/skill/references/coordination.md +6 -2
- package/grok/skill/references/handoff-prep.md +5 -0
- package/grok/skill/references/handoff.md +2 -2
- package/grok/skill/references/planning.md +2 -2
- package/grok/skill/references/verification.md +21 -3
- package/grok/skill/references/worktree-creation.md +2 -2
- package/lib/cli/postinstall.mjs +1 -1
- package/lib/cli/root.mjs +1 -1
- package/lib/installer/runtime-assets.mjs +5 -1
- package/lib/management/reapply.mjs +117 -0
- package/lib/management/update.mjs +59 -5
- package/lib/models/catalog-gemini.mjs +4 -1
- package/lib/models/gemini-models.json +4 -0
- package/lib/npm/upgrade.mjs +6 -2
- package/lib/policy/role-policy.json +1 -1
- package/lib/prompts/agent-fragments.json +5 -5
- package/lib/runtime/final-verify.mjs +2158 -0
- package/lib/runtime/node-test-reporter.mjs +81 -0
- package/lib/runtime/platform-registry.mjs +1 -1
- package/lib/runtime/role-bridge.mjs +10 -1
- package/lib/runtime/role-dispatch-policy.mjs +4 -0
- package/lib/runtime/role-observe.mjs +192 -14
- package/lib/runtime/role-supervisor.mjs +268 -23
- package/lib/runtime/test-results.mjs +736 -0
- package/lib/runtime/verify-cli.mjs +60 -0
- package/lib/tui/app.mjs +7 -41
- package/lib/tui/interface.mjs +40 -0
- package/lib/tui/render.mjs +1 -1
- package/lib/tui/setup.mjs +27 -16
- package/lib/watch/args.mjs +12 -27
- package/lib/watch/dispatch.mjs +2 -2
- package/lib/watch/index.mjs +38 -26
- package/lib/watch/markdown.mjs +232 -0
- package/lib/watch/menu.mjs +54 -0
- package/lib/watch/model.mjs +7 -3
- package/lib/watch/render.mjs +28 -67
- package/lib/watch/scope.mjs +1 -5
- package/lib/watch/status-line.mjs +2 -4
- package/lib/watch/text-width.mjs +43 -0
- package/lib/watch/watcher.mjs +17 -36
- package/package.json +1 -1
- package/shared/skill/runtime/final-verify.mjs +2158 -0
- package/shared/skill/runtime/node-test-reporter.mjs +81 -0
- package/shared/skill/runtime/platform-registry.mjs +1 -1
- package/shared/skill/runtime/role-bridge.mjs +10 -1
- package/shared/skill/runtime/role-dispatch-policy.mjs +4 -0
- package/shared/skill/runtime/role-observe.mjs +192 -14
- package/shared/skill/runtime/role-policy.json +1 -1
- package/shared/skill/runtime/role-supervisor.mjs +268 -23
- package/shared/skill/runtime/test-results.mjs +736 -0
- package/shared/skill/runtime/verify-cli.mjs +60 -0
package/lib/watch/watcher.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import fsp from 'node:fs/promises';
|
|
3
|
-
import {WATCH_LIMITS as L, MESSAGE_KINDS} from './model.mjs';
|
|
3
|
+
import {WATCH_LIMITS as L, MESSAGE_KINDS, classifyMessageKind} from './model.mjs';
|
|
4
4
|
import {sanitizeText, sanitizeMessage, isVisible} from './policy.mjs';
|
|
5
5
|
import {topLabel, childLabel, dispatchLabel, roleFromName} from './labels.mjs';
|
|
6
6
|
import {createCodexState, normalizeCodexLine, codexLineCwd} from './normalize-codex.mjs';
|
|
@@ -18,15 +18,15 @@ import {GIT_ALLOWED} from './git.mjs';
|
|
|
18
18
|
export function createWatcher({options, homes, scope: initialScope, git, now, registry = DEFAULT_PLATFORM_REGISTRY, dependencies = {}}) {
|
|
19
19
|
const {readClaudeHead: claudeHead = readClaudeHead, readCodexMeta: codexMeta = readCodexMeta,
|
|
20
20
|
lstat = fsp.lstat, maxKnown = L.maxKnown, createClaudeDiscovery: claudeDiscovery = createClaudeDiscovery, createDispatchIndex: dispatchIndex = createDispatchIndex} = dependencies;
|
|
21
|
-
const platforms = options.platforms ??
|
|
22
|
-
const
|
|
21
|
+
const platforms = options.platforms ?? registry.byDisplayOrder().filter(d => d.capabilities.watch.state==='verified').map(d => d.id);
|
|
22
|
+
const verbose = Boolean(options.verbose);
|
|
23
23
|
const tailCount = options.tail ?? L.defaultTail;
|
|
24
24
|
let scope = initialScope, closed = false, started = false;
|
|
25
|
-
let lastDiscovery = -Infinity, lastRefresh = now(), capped = false
|
|
25
|
+
let lastDiscovery = -Infinity, lastRefresh = now(), capped = false;
|
|
26
26
|
const followed = new Map(), pending = new Map(), ignored = new Map(), detached = new Map();
|
|
27
27
|
const seenAtStart = new Map(), heads = new Map(), metas = new Map(), agentMetas = new Map(), childLists = new Map();
|
|
28
28
|
const known = new Map(), latestCwds = new Map();
|
|
29
|
-
const compressed = new Set(), missingDispatch = new Set()
|
|
29
|
+
const compressed = new Set(), missingDispatch = new Set();
|
|
30
30
|
const rootsByCwd = new Map(), gitTopByCwd = new Map(), shellRoots = new Map();
|
|
31
31
|
const nestedChecks = new Map(), nestedFailures = new Map();
|
|
32
32
|
let lastNestedRefresh = -Infinity;
|
|
@@ -38,7 +38,7 @@ export function createWatcher({options, homes, scope: initialScope, git, now, re
|
|
|
38
38
|
const debug = (out, text) => { if (verbose) out.push(notice(text)); };
|
|
39
39
|
const sort = events => events.sort((a,b) => (Date.parse(a.ts) || 0) - (Date.parse(b.ts) || 0));
|
|
40
40
|
const clean = event => {
|
|
41
|
-
const e = {...event};
|
|
41
|
+
const e = {...event,kind:classifyMessageKind(event)};
|
|
42
42
|
if (e.text !== undefined) e.text = MESSAGE_KINDS.includes(e.kind) ? sanitizeMessage(e.text) : sanitizeText(e.text);
|
|
43
43
|
if (e.tool !== undefined) e.tool = sanitizeText(e.tool);
|
|
44
44
|
if (e.skill !== undefined) e.skill = sanitizeText(e.skill);
|
|
@@ -47,18 +47,14 @@ export function createWatcher({options, homes, scope: initialScope, git, now, re
|
|
|
47
47
|
if (e.paths) e.paths = e.paths.map(sanitizeText);
|
|
48
48
|
return e;
|
|
49
49
|
};
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|| (ref.cwd ? inScope(scope,ref.cwd) : [...followed.values()].some(row=>ref.sessionIds.includes(row.id) && cwdInScope(row.cwd))));
|
|
53
|
-
const allowedDispatch = ref => dispatchInScope(ref) && selectedDispatch(ref);
|
|
50
|
+
const dispatchInScope = ref => ref.inScope && (ref.cwd ? inScope(scope,ref.cwd)
|
|
51
|
+
: [...followed.values()].some(row=>ref.sessionIds.includes(row.id) && cwdInScope(row.cwd)));
|
|
54
52
|
function mapped(row) {
|
|
55
53
|
const ref = dispatch.bySession(row.id);
|
|
56
|
-
return ref && ref.inScope && (
|
|
57
|
-
|| (ref.cwd ? inScope(scope,ref.cwd) : cwdInScope(row.cwd))) ? ref : null;
|
|
54
|
+
return ref && ref.inScope && (ref.cwd ? inScope(scope,ref.cwd) : cwdInScope(row.cwd)) ? ref : null;
|
|
58
55
|
}
|
|
59
56
|
const selectedRoot = cwd => path.resolve(cwd)===scope.roots[0] || realPath(cwd)===scope.roots[0];
|
|
60
57
|
function cwdInScope(cwd) {
|
|
61
|
-
if (scope.kind==='all' || scope.kind==='session') return true;
|
|
62
58
|
if (!cwd || !inScope(scope,cwd)) return false;
|
|
63
59
|
return scope.kind!=='repo' || selectedRoot(cwd) || nestedChecks.get(cwd)?.inside===true;
|
|
64
60
|
}
|
|
@@ -102,7 +98,7 @@ export function createWatcher({options, homes, scope: initialScope, git, now, re
|
|
|
102
98
|
return {resolved:!row.parentId,desktop};
|
|
103
99
|
}
|
|
104
100
|
function lineGate(row) {
|
|
105
|
-
return
|
|
101
|
+
return Boolean(mapped(row)) || cwdInScope(row.cwd);
|
|
106
102
|
}
|
|
107
103
|
async function setCwd(row, cwd, out) {
|
|
108
104
|
row.state.cwd=cwd;
|
|
@@ -173,7 +169,7 @@ export function createWatcher({options, homes, scope: initialScope, git, now, re
|
|
|
173
169
|
}
|
|
174
170
|
for (const e of normalized) {
|
|
175
171
|
if (['turn_end','turn_failed'].includes(e.kind)) row.active = false;
|
|
176
|
-
else if (['turn_start','
|
|
172
|
+
else if (MESSAGE_KINDS.includes(e.kind) || ['turn_start','reasoning','command','tool','tool_failed','file_change','file_create','file_delete','spawn','approval'].includes(e.kind)) row.active = true;
|
|
177
173
|
if (!inside) continue;
|
|
178
174
|
if (e.kind==='command' && e.skillOnly && !verbose) continue;
|
|
179
175
|
const shell = shellRoots.get(row.gitTop);
|
|
@@ -202,18 +198,12 @@ export function createWatcher({options, homes, scope: initialScope, git, now, re
|
|
|
202
198
|
row.held=[]; delete row.holdUntil;
|
|
203
199
|
}
|
|
204
200
|
}
|
|
205
|
-
async function rememberRepo(cwd) {
|
|
206
|
-
if (scope.kind !== 'all' && scope.kind !== 'session') return;
|
|
207
|
-
if (repos.has(cwd) || repos.size >= L.maxRepos) return;
|
|
208
|
-
repos.set(cwd, await git(cwd,GIT_ALLOWED[1]));
|
|
209
|
-
}
|
|
210
201
|
async function scanDispatch() {
|
|
211
|
-
|
|
212
|
-
return dispatch.scan({gitCommonDirs:dirs,includeAllLeases:scope.kind==='all'||scope.kind==='session'});
|
|
202
|
+
return dispatch.scan({gitCommonDirs:scope.gitCommonDir ? [scope.gitCommonDir] : []});
|
|
213
203
|
}
|
|
214
204
|
function dispatchEvents(updates, startup, out) {
|
|
215
205
|
for (const {ref,first} of updates) {
|
|
216
|
-
if (!
|
|
206
|
+
if (!dispatchInScope(ref)) continue;
|
|
217
207
|
if (startup && (tailCount === 0 || now()-Date.parse(ref.updatedAt) > L.historyWindowMs || !Number.isFinite(Date.parse(ref.updatedAt)))) continue;
|
|
218
208
|
const followedRow = [...followed.values()].find(row=>ref.sessionIds.includes(row.id));
|
|
219
209
|
const platform = ref.childPlatform ?? followedRow?.platform;
|
|
@@ -230,13 +220,11 @@ export function createWatcher({options, homes, scope: initialScope, git, now, re
|
|
|
230
220
|
function eligible(row) {
|
|
231
221
|
if (!platforms.includes(row.platform) || row.origin === 'Codex Desktop') return false;
|
|
232
222
|
if (row.parentId) {
|
|
233
|
-
if (scope.kind==='all' || scope.kind==='session') return followed.has(row.parentId);
|
|
234
223
|
const chain=ancestry(row);
|
|
235
224
|
if (chain.desktop) {ignored.set(row.file,row.size);return false;}
|
|
236
225
|
return chain.resolved && anyCwdInScope(row);
|
|
237
226
|
}
|
|
238
227
|
const ref = mapped(row);
|
|
239
|
-
if (session) return row.id === session || Boolean(ref && selectedDispatch(ref));
|
|
240
228
|
return Boolean(ref) || anyCwdInScope(row);
|
|
241
229
|
}
|
|
242
230
|
async function attach(row, startup, out) {
|
|
@@ -366,7 +354,7 @@ export function createWatcher({options, homes, scope: initialScope, git, now, re
|
|
|
366
354
|
}
|
|
367
355
|
async function discover(startup, out) {
|
|
368
356
|
const rows=[];
|
|
369
|
-
|
|
357
|
+
const updates = await scanDispatch();
|
|
370
358
|
for (const file of pending.keys()) if (!await details(file)) pending.delete(file);
|
|
371
359
|
if (homes.codex && platforms.includes('codex')) {
|
|
372
360
|
for (const item of await codexCandidates(startup)) {
|
|
@@ -409,10 +397,6 @@ export function createWatcher({options, homes, scope: initialScope, git, now, re
|
|
|
409
397
|
}
|
|
410
398
|
}
|
|
411
399
|
}
|
|
412
|
-
for (const row of rows) {
|
|
413
|
-
await rememberRepo(row.cwd);
|
|
414
|
-
}
|
|
415
|
-
updates ??= await scanDispatch();
|
|
416
400
|
rows.sort((a,b)=>b.mtimeMs-a.mtimeMs||a.file.localeCompare(b.file));
|
|
417
401
|
let remaining=rows.filter(row=> {
|
|
418
402
|
if (followed.has(row.id) || ignored.get(row.file)===row.size) return false;
|
|
@@ -448,8 +432,8 @@ export function createWatcher({options, homes, scope: initialScope, git, now, re
|
|
|
448
432
|
}
|
|
449
433
|
for (const row of remaining) {
|
|
450
434
|
const chain=ancestry(row);
|
|
451
|
-
const missingParent
|
|
452
|
-
if (
|
|
435
|
+
const missingParent=!chain.resolved;
|
|
436
|
+
if (row.parentId && (!missingParent || chain.desktop)) pending.delete(row.file);
|
|
453
437
|
if (row.parentId && row.origin!=='Codex Desktop' && missingParent && !chain.desktop) {
|
|
454
438
|
const wait=pending.get(row.file) ?? {...row,until:now()+L.holdMs};
|
|
455
439
|
if (now()>=wait.until) {pending.delete(row.file);ignored.set(row.file,row.size);debug(out,`parent session not found for ${row.id}`);}
|
|
@@ -466,9 +450,6 @@ export function createWatcher({options, homes, scope: initialScope, git, now, re
|
|
|
466
450
|
emit(row,[],out);
|
|
467
451
|
}
|
|
468
452
|
dispatchEvents(updates,startup,out);
|
|
469
|
-
if (session && !waiting && ![...followed.values()].some(row=>row.id===session||mapped(row)?.dispatchId===session) && !dispatch.byId(session)?.inScope) {
|
|
470
|
-
debug(out,`waiting for session ${session}`);waiting=true;
|
|
471
|
-
}
|
|
472
453
|
lastDiscovery=now();
|
|
473
454
|
}
|
|
474
455
|
async function poll(out) {
|
|
@@ -574,7 +555,7 @@ export function createWatcher({options, homes, scope: initialScope, git, now, re
|
|
|
574
555
|
const storeDir = store.kind === 'none' && homes.codex && registry.isPlatformId('codex')
|
|
575
556
|
? path.join(homes.codex, 'arc-role-dispatch') : store.dir;
|
|
576
557
|
dispatch = dispatchIndex({storeDir});
|
|
577
|
-
const description
|
|
558
|
+
const description=`scope ${scope.roots[0]}`+(scope.kind==='repo'?` (${scope.roots.length} worktrees)`:'');
|
|
578
559
|
const out=[];
|
|
579
560
|
if (store.kind === 'ambiguous') out.push(notice('dispatch store ambiguous'));
|
|
580
561
|
await discover(true,out);
|