@yunhozz/arc 0.3.1 → 0.3.3
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 +45 -45
- package/README.md +16 -11
- package/claude/agents/arc-implementer.md +4 -4
- package/claude/agents/arc-planner.md +5 -5
- package/claude/agents/arc-qa.md +4 -4
- package/claude/agents/arc-reviewer.md +4 -4
- package/claude/agents/arc-scouter.md +5 -5
- package/claude/skill/SKILL.md +12 -8
- package/claude/skill/references/arc-visual-companion.md +5 -5
- package/claude/skill/references/commit.md +8 -8
- package/claude/skill/references/coordination.md +18 -18
- package/claude/skill/references/git-recovery.md +4 -4
- package/claude/skill/references/handoff-prep.md +9 -9
- package/claude/skill/references/handoff.md +20 -20
- package/claude/skill/references/limits.md +2 -2
- package/claude/skill/references/planning.md +15 -15
- package/claude/skill/references/verification.md +9 -9
- package/claude/skill/runtime/role-policy.json +10 -10
- package/codex/agents/arc-implementer.toml +4 -4
- package/codex/agents/arc-planner.toml +4 -4
- package/codex/agents/arc-qa.toml +4 -4
- package/codex/agents/arc-reviewer.toml +4 -4
- package/codex/agents/arc-scouter.toml +4 -4
- package/codex/skill/SKILL.md +12 -8
- package/codex/skill/references/arc-visual-companion.md +2 -2
- package/codex/skill/references/commit.md +8 -8
- package/codex/skill/references/coordination.md +17 -17
- package/codex/skill/references/git-recovery.md +4 -4
- package/codex/skill/references/handoff-prep.md +9 -9
- package/codex/skill/references/handoff-worktree.md +6 -6
- package/codex/skill/references/handoff.md +20 -20
- package/codex/skill/references/limits.md +2 -2
- package/codex/skill/references/planning.md +15 -15
- package/codex/skill/references/verification.md +10 -10
- package/codex/skill/runtime/role-policy.json +10 -10
- package/lib/installer/global-config.mjs +2 -2
- package/lib/policy/role-policy.json +10 -10
- package/lib/prompts/agent-fragments.json +16 -16
- package/lib/watch/index.mjs +50 -2
- package/lib/watch/model.mjs +3 -3
- package/lib/watch/normalize-claude.mjs +27 -7
- package/lib/watch/normalize-codex.mjs +23 -1
- package/lib/watch/render.mjs +21 -6
- package/lib/watch/scope.mjs +1 -1
- package/lib/watch/watcher.mjs +24 -4
- package/package.json +1 -1
package/lib/watch/watcher.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import {topLabel, childLabel, dispatchLabel, roleFromName} from './labels.mjs';
|
|
|
6
6
|
import {normalizeCodexLine} from './normalize-codex.mjs';
|
|
7
7
|
import {createClaudeState, normalizeClaudeLine, parseClaudeAgentMeta} from './normalize-claude.mjs';
|
|
8
8
|
import {createTail, readTail, readHead} from './tail.mjs';
|
|
9
|
-
import {refreshScope, inScope, claudeDirPrefixes} from './scope.mjs';
|
|
9
|
+
import {refreshScope, inScope, claudeDirPrefixes, realPath} from './scope.mjs';
|
|
10
10
|
import {listCodexRollouts, readCodexMeta} from './discover-codex.mjs';
|
|
11
11
|
import {createClaudeDiscovery, readClaudeHead} from './discover-claude.mjs';
|
|
12
12
|
import {createDispatchIndex} from './dispatch.mjs';
|
|
@@ -24,6 +24,7 @@ export function createWatcher({options, homes, scope: initialScope, git, now, de
|
|
|
24
24
|
const followed = new Map(), pending = new Map(), ignored = new Map(), detached = new Map();
|
|
25
25
|
const seenAtStart = new Map(), heads = new Map(), metas = new Map(), agentMetas = new Map(), childLists = new Map();
|
|
26
26
|
const compressed = new Set(), missingDispatch = new Set(), repos = new Map();
|
|
27
|
+
const rootsByCwd = new Map();
|
|
27
28
|
const dispatch = dispatchIndex({codexHome:homes.codex});
|
|
28
29
|
const claude = homes.claude ? claudeDiscovery({claudeHome:homes.claude}) : null;
|
|
29
30
|
const stamp = () => new Date(now()).toISOString();
|
|
@@ -57,6 +58,7 @@ export function createWatcher({options, homes, scope: initialScope, git, now, de
|
|
|
57
58
|
v:1, observedAt:stamp(), platform:row.platform,
|
|
58
59
|
source:ref ? 'bridge' : parent ? 'subagent' : 'session',
|
|
59
60
|
origin:row.origin, sessionId:row.id, label:label(row), cwd:row.cwd,
|
|
61
|
+
...(row.root ? {root:row.root} : {}),
|
|
60
62
|
...(row.parentId ? {parentId:row.parentId,depth:row.depth ?? (parent?.depth ?? 0)+1} : {}),
|
|
61
63
|
...(ref ? {dispatchId:ref.dispatchId, ...(ref.workflowId ? {workflowId:ref.workflowId} : {}), ...(ref.role ? {role:ref.role} : {})} : {}),
|
|
62
64
|
...(!ref && roleFromName(row.agent?.agentRole ?? row.agent?.agentType) ? {role:roleFromName(row.agent.agentRole ?? row.agent.agentType)} : {}),
|
|
@@ -72,6 +74,8 @@ export function createWatcher({options, homes, scope: initialScope, git, now, de
|
|
|
72
74
|
for (const line of lines) {
|
|
73
75
|
const events = row.platform === 'codex' ? normalizeCodexLine(line) : normalizeClaudeLine(line,row.state);
|
|
74
76
|
for (const e of events) {
|
|
77
|
+
if (['turn_end','turn_failed'].includes(e.kind)) row.active = false;
|
|
78
|
+
else if (['turn_start','user','agent','reasoning','command','tool','tool_failed','file_change','file_create','spawn','approval'].includes(e.kind)) row.active = true;
|
|
75
79
|
if (!isVisible(e.kind,verbose) || (e.kind === 'notice' && !verbose)) continue;
|
|
76
80
|
out.push(clean({...identity(row),...e,ts:e.ts ?? stamp(),...(e.kind === 'session' ? {text:sessionText(row)} : {})}));
|
|
77
81
|
}
|
|
@@ -123,17 +127,32 @@ export function createWatcher({options, homes, scope: initialScope, git, now, de
|
|
|
123
127
|
let history;
|
|
124
128
|
try { history = previous ? {endOffset:previous.offset} : await readTail(row.file); }
|
|
125
129
|
catch (error) { debug(out,`session file unreadable: ${row.id.slice(0,8)} (${error.code ?? 'error'})`); ignored.set(row.file,row.size); return; }
|
|
130
|
+
row.root = await sessionRoot(row.cwd);
|
|
126
131
|
row.tail=createTail(row.file,{offset:previous?.offset ?? history.endOffset});
|
|
127
|
-
row.state=createClaudeState(); row.held=[]; row.lastActivity=row.mtimeMs;
|
|
132
|
+
row.state=createClaudeState(); row.active=false; row.held=[]; row.lastActivity=row.mtimeMs;
|
|
128
133
|
followed.set(row.id,row); pending.delete(row.file); detached.delete(row.file);
|
|
129
134
|
if (!startup && !previous && !mapped(row) && (row.origin==='codex_exec'||row.platform==='claude') && now()-row.mtimeMs<=L.holdCreatedWithinMs) row.holdUntil=now()+L.holdMs;
|
|
130
135
|
const showHistory = startup ? tailCount > 0 && now()-row.mtimeMs<=L.historyWindowMs : !previous;
|
|
136
|
+
const events=history.lines ? normalize(row,history.lines) : [];
|
|
131
137
|
if (showHistory) {
|
|
132
|
-
const events=normalize(row,history.lines);
|
|
133
138
|
if (!events.some(e=>e.kind==='session')) events.unshift(clean({...identity(row),ts:events[0]?.ts??stamp(),kind:'session',text:sessionText(row)}));
|
|
134
139
|
emit(row,events,out);
|
|
135
140
|
}
|
|
136
141
|
}
|
|
142
|
+
async function sessionRoot(cwd) {
|
|
143
|
+
if (!cwd) return undefined;
|
|
144
|
+
try {
|
|
145
|
+
const matches = (scope.roots ?? []).filter(root => inScope({kind:'dir',roots:[root]},cwd));
|
|
146
|
+
if (matches.length) return matches.sort((a,b) => Math.max(path.resolve(b).length,realPath(b).length) - Math.max(path.resolve(a).length,realPath(a).length))[0];
|
|
147
|
+
if (rootsByCwd.has(cwd)) return rootsByCwd.get(cwd);
|
|
148
|
+
let root = cwd;
|
|
149
|
+
try { root = (await git(cwd,GIT_ALLOWED[0]))?.trim() || cwd; }
|
|
150
|
+
catch { /* A missing repository still has a useful cwd root. */ }
|
|
151
|
+
if (rootsByCwd.size >= L.maxRepos) rootsByCwd.delete(rootsByCwd.keys().next().value);
|
|
152
|
+
rootsByCwd.set(cwd,root);
|
|
153
|
+
return root;
|
|
154
|
+
} catch { return cwd; }
|
|
155
|
+
}
|
|
137
156
|
function rememberStart(item, startup) {
|
|
138
157
|
if (startup) seenAtStart.set(item.file,{...item,offset:item.size});
|
|
139
158
|
}
|
|
@@ -299,7 +318,7 @@ export function createWatcher({options, homes, scope: initialScope, git, now, de
|
|
|
299
318
|
debug(out,`session file unreadable: ${row.id.slice(0,8)} (${error.code??'error'})`);continue;
|
|
300
319
|
}
|
|
301
320
|
if (result.gone) {followed.delete(id);debug(out,`session file removed: ${row.id.slice(0,8)}`);continue;}
|
|
302
|
-
if (result.reset) {row.state=createClaudeState();debug(out,`session restarted from the beginning: ${row.id.slice(0,8)}`);}
|
|
321
|
+
if (result.reset) {row.state=createClaudeState();row.active=false;debug(out,`session restarted from the beginning: ${row.id.slice(0,8)}`);}
|
|
303
322
|
if (result.overflowed && !row.overflowed) debug(out,`line over 4 MiB skipped in ${row.id.slice(0,8)}`);
|
|
304
323
|
row.overflowed=result.overflowed;
|
|
305
324
|
if (row.tail.offset!==row.size) row.lastActivity=now();
|
|
@@ -332,6 +351,7 @@ export function createWatcher({options, homes, scope: initialScope, git, now, de
|
|
|
332
351
|
await poll(out);
|
|
333
352
|
return markEmitted(sort(out));
|
|
334
353
|
},
|
|
354
|
+
busy() {return [...followed.values()].some(row=>row.active && now()-row.lastActivity<=L.spinnerIdleMs);},
|
|
335
355
|
async close() {closed=true;followed.clear();pending.clear();},
|
|
336
356
|
};
|
|
337
357
|
}
|