@yunhozz/arc 0.5.7 → 0.6.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 +104 -99
- package/README.md +37 -113
- package/claude/agents/arc-architect.md +44 -0
- package/claude/agents/arc-planner.md +4 -4
- package/claude/skill/SKILL.md +5 -5
- package/claude/skill/models.toml +5 -1
- package/claude/skill/references/commit.md +2 -2
- package/claude/skill/references/coordination.md +10 -9
- package/claude/skill/references/git-recovery.md +1 -1
- package/claude/skill/references/handoff-prep.md +2 -2
- package/claude/skill/references/handoff.md +1 -1
- package/claude/skill/references/planning.md +12 -12
- package/claude/skill/references/verification.md +1 -1
- package/claude/skill/scripts/model_config.py +24 -11
- package/codex/agents/arc-architect.md +36 -0
- package/codex/agents/{arc-implementer.toml → arc-implementer.md} +7 -4
- package/codex/agents/{arc-planner.toml → arc-planner.md} +10 -7
- package/codex/agents/{arc-reviewer.toml → arc-reviewer.md} +7 -4
- package/codex/agents/{arc-scouter.toml → arc-scouter.md} +7 -4
- package/codex/agents/{arc-tester.toml → arc-tester.md} +7 -4
- package/codex/skill/SKILL.md +5 -5
- package/codex/skill/models.toml +5 -1
- package/codex/skill/references/commit.md +2 -2
- package/codex/skill/references/coordination.md +6 -5
- package/codex/skill/references/handoff-prep.md +2 -2
- package/codex/skill/references/handoff.md +1 -1
- package/codex/skill/references/planning.md +12 -12
- package/codex/skill/references/verification.md +1 -1
- package/codex/skill/scripts/apply-models.py +5 -5
- package/codex/skill/scripts/model_config.py +23 -12
- package/gemini/GEMINI.md +1 -1
- package/gemini/agents/arc-architect.md +39 -0
- package/gemini/agents/arc-planner.md +4 -4
- package/gemini/instructions.md +1 -1
- package/gemini/skill/SKILL.md +5 -5
- package/gemini/skill/models.toml +5 -1
- package/gemini/skill/references/commit.md +2 -2
- package/gemini/skill/references/coordination.md +10 -9
- package/gemini/skill/references/git-recovery.md +1 -1
- package/gemini/skill/references/handoff-prep.md +2 -2
- package/gemini/skill/references/handoff.md +1 -1
- package/gemini/skill/references/planning.md +12 -12
- package/gemini/skill/references/verification.md +1 -1
- package/grok/AGENTS.md +1 -1
- package/grok/agents/arc-architect.md +39 -0
- package/grok/agents/arc-planner.md +4 -4
- package/grok/instructions.md +1 -1
- package/grok/skill/SKILL.md +5 -5
- package/grok/skill/models.toml +5 -1
- package/grok/skill/references/commit.md +2 -2
- package/grok/skill/references/coordination.md +10 -9
- package/grok/skill/references/git-recovery.md +1 -1
- package/grok/skill/references/handoff-prep.md +2 -2
- package/grok/skill/references/handoff.md +1 -1
- package/grok/skill/references/planning.md +12 -12
- package/grok/skill/references/verification.md +1 -1
- package/lib/installer/global-config.mjs +1 -1
- package/lib/installer/manifest.mjs +20 -3
- package/lib/installer/role-routing.mjs +6 -3
- package/lib/installer/targets.mjs +1 -1
- package/lib/installer/upgrade-state.mjs +3 -2
- package/lib/models/config.mjs +22 -5
- package/lib/models/profiles.mjs +6 -1
- package/lib/platforms/agent-templates.mjs +1 -0
- package/lib/platforms/codex.mjs +2 -0
- package/lib/platforms/formats/codex-markdown.mjs +58 -0
- package/lib/platforms/formats/gemini-markdown.mjs +3 -2
- package/lib/platforms/formats/grok-markdown.mjs +3 -2
- package/lib/platforms/formats/markdown.mjs +3 -2
- package/lib/platforms/formats/toml.mjs +3 -2
- package/lib/policy/placement.mjs +1 -1
- package/lib/policy/render.mjs +6 -5
- package/lib/policy/role-policy.json +36 -7
- package/lib/prompts/agent-fragments.json +90 -18
- package/lib/prompts/render.mjs +53 -14
- package/lib/runtime/evaluate.mjs +4 -3
- package/lib/runtime/identity.mjs +1 -1
- package/lib/runtime/operations.mjs +2 -2
- package/lib/runtime/role-bridge-args.mjs +5 -3
- package/lib/runtime/role-bridge.mjs +24 -2
- package/lib/runtime/role-dispatch-policy.mjs +2 -1
- package/lib/runtime/role-dispatch-store.mjs +44 -1
- package/lib/runtime/role-observe.mjs +12 -4
- package/lib/runtime/role-routing-config.mjs +9 -4
- package/lib/runtime/role-supervisor.mjs +16 -2
- package/lib/tui/diagram.mjs +2 -3
- package/lib/tui/setup.mjs +13 -11
- package/lib/watch/labels.mjs +1 -1
- package/lib/watch/model.mjs +2 -2
- package/lib/watch/render.mjs +2 -2
- package/package.json +1 -1
- package/scripts/update-manifest.mjs +1 -1
- package/shared/skill/references/arc-visual-companion-common.md +2 -2
- package/shared/skill/references/commit-common.md +3 -3
- package/shared/skill/references/coordination-common.md +19 -12
- package/shared/skill/references/handoff-common.md +5 -5
- package/shared/skill/references/handoff-prep-common.md +1 -1
- package/shared/skill/references/planning-common.md +25 -25
- package/shared/skill/references/verification-common.md +5 -3
- package/shared/skill/runtime/evaluate.mjs +4 -3
- package/shared/skill/runtime/identity.mjs +1 -1
- package/shared/skill/runtime/operations.mjs +2 -2
- package/shared/skill/runtime/role-bridge-args.mjs +5 -3
- package/shared/skill/runtime/role-bridge.mjs +24 -2
- package/shared/skill/runtime/role-dispatch-policy.mjs +2 -1
- package/shared/skill/runtime/role-dispatch-store.mjs +44 -1
- package/shared/skill/runtime/role-observe.mjs +12 -4
- package/shared/skill/runtime/role-policy.json +36 -7
- package/shared/skill/runtime/role-routing-config.mjs +9 -4
- package/shared/skill/runtime/role-supervisor.mjs +16 -2
|
@@ -5,13 +5,13 @@ This file holds text shared by every platform's verification.md. Each part belon
|
|
|
5
5
|
<a id="test-scope-and-result-comparison"></a>
|
|
6
6
|
## Test scope and result comparison
|
|
7
7
|
|
|
8
|
-
Tester briefs MUST include the required field `mode: task | final`. One assignment performs one mode; the only exception is the approved full regression follow-up in final mode.
|
|
8
|
+
Tester briefs MUST include the required field `mode: task | final | baseline`. One assignment performs one mode; the only exception is the approved full regression follow-up in final mode.
|
|
9
9
|
|
|
10
10
|
**Task mode** assigns a fresh Tester for each top-level task requiring Tester verification. Task checks and rechecks verify uncommitted work and run only tests related to the change: test files that directly exercise a changed module, contract tests that the change requires updating, and the matching check scripts. The brief lists the minimum set; executors MAY add only items in these three categories, each with a reason. Other additions need Orchestrator authorization. Report every selected item and why. Read only to confirm the brief and identify tests in those categories. In task mode, NEVER run full regression or substitute checks. In task mode, DO NOT search reverse dependencies. Failures follow Implementer → Tester recheck, reusing the current Tester for the same task. This rule takes precedence over the upstream TDD per-task project-suite instruction; upstream text is unchanged. Report every failure observed in any run by name.
|
|
11
11
|
|
|
12
12
|
**Final mode** runs once after all tasks are accepted and committed, as one fresh Tester assignment at the verified HEAD of the execution target worktree. Run (1) all contract tests, (2) all check scripts, (3) the related tests of re-changed files and (4) substitute checks for applicable triggers. Final mode does not rerun the union of tests that task Tester already passed. A re-changed file is a file that a task's Tester verified, as a changed file or a related test file it ran, and that a later commit changed after that task's focused commit (`git diff --name-only <task commit> HEAD`), plus every non-documentation file changed in base..HEAD by a commit that no task Tester verified. Orchestrator computes the list and cites it in the brief; Tester cross-checks it with read-only `git diff`, MAY add items only within the three categories above with reasons, and reports the reason when the list is empty. Tester records `git status --porcelain` at start and end; a state that is not clean is an environment block that holds final verification. While it runs, neither Orchestrator nor any Implementer writes in that workspace. A new failure from final verification follows Implementer → Tester. The final Reviewer starts only after final-mode Tester work concludes: the final Tester report is delivered, every new failure is resolved through Implementer → Tester recheck, every new-failure candidate and intermittent candidate is dispositioned, any approved full regression is complete and every undeterminable-scope item is dispositioned under **Undeterminable scope** below. Reviewer output produced before that point is not the initial final review.
|
|
13
13
|
|
|
14
|
-
**Command execution:** Implementer and Tester briefs MUST NOT prescribe detached execution such as `&`, `nohup` or `setsid`; they require long commands to run in the foreground and be waited on in the same session until an exit code. Orchestrator does not run a Tester's assigned suites in its place unless Tester reports an environment block with evidence and the user chooses that run.
|
|
14
|
+
**Command execution:** Implementer and Tester briefs MUST NOT prescribe detached execution such as `&`, `nohup` or `setsid`; they require long commands to run in the foreground and be waited on in the same session until an exit code. Orchestrator does not run a Tester's assigned suites in its place unless Tester reports an environment block with evidence and the user chooses that run. Tester briefs that assign suite runs MUST name the temporary location for logs, outside the execution target worktree and the base worktree. Tester redirects the standard output and standard error of each suite command to its own log file there, uses a per-test reporter when the runner already has one (for Node, `--test-reporter=tap`), and reports totals, failing test names and failure excerpts read from those log files, not from the returned tool output. If that location cannot be written, Tester reports an environment block. A failing test or check is a result, not a stop condition: Tester finishes every assigned check that does not depend on the failed one, then classifies and reports all failures together, and stops early only for a missing required input, an authority or target mismatch, or unknown state under `scope.non-escalation`.
|
|
15
15
|
|
|
16
16
|
**Suite parallelism:** A Tester runs each multi-file suite command with the test runner's built-in parallel mode inside that one foreground command; a parallel mode that needs a package or plugin not already installed counts as no parallel mode. It runs a suite sequentially only when its tests are known to interfere with each other or the runner has no parallel mode, and reports the reason. Briefs MUST NOT split a suite into sequential groups for any other reason; splitting across Testers follows **Full regression shards** below. This changes how a command runs, not which tests run.
|
|
17
17
|
|
|
@@ -47,7 +47,9 @@ A suspected dynamic reference goes directly to step 5.
|
|
|
47
47
|
|
|
48
48
|
**CI substitution** requires results for the same commit SHA as the verified HEAD or a matching tree hash with evidence, all jobs completed, accessible per-test-name results, results collected read-only by Orchestrator and cited in the brief, and an explicit user approval record. Use CI results as evidence only for the tests and scope they cover when every condition is met; otherwise a new-failure candidate or unverified is the applicable classification. This collection grants no external action authority.
|
|
49
49
|
|
|
50
|
-
**Baseline:** No baseline run is recorded in advance, and no base worktree is prepared in advance. Tester classifies each failure in two steps. First, a static check against the approved base: task Tester, which verifies uncommitted work, uses read-only `git diff --name-only <approved base>` plus the untracked files from `git status --porcelain`; final verification Tester uses `git diff --name-only <approved base> HEAD`. Tester checks whether the test file, the modules it directly imports or loads, the fixtures or data it reads, or its test configuration changed. If none changed, it is an unrelated failure: report it separately with that evidence; it is not a finding, and Orchestrator dispositions it. Because it rests on the diff, not a run, NEVER report it as a baseline failure. If any changed, or the check cannot decide (for example a dynamic import, a failure without a test name, or a file-level load failure), report the failure as needing a base run, with the changed paths. Second, only for those failures, Orchestrator prepares a clean detached worktree of the approved base revision at `<git-common-dir>/arc/base/<workflow>`, never under a managed worktree directory (such as `.claude/worktrees/`) or inside the execution target worktree, reuses it for that workflow, runs no tests there, and sends its path and prerequisite state (prepared, or not prepared with the needed commands) to the current Tester. After all final dispositions Orchestrator removes it only if it is still clean; this ARC-owned base worktree is the only exception to the Preservation rule's worktree-deletion ban, and any other state holds removal for the user. Tester runs only those test names alone in the base worktree, for example with Node `--test-name-pattern` or a Python node id. A failure under the same name at base is a baseline failure; a pass at base, or a test or file absent at base, makes it a new failure; a base run that was not performed, was blocked by the environment, failed to load or lacks the name makes it a new-failure candidate. NEVER absorb a candidate as a baseline failure. Check a file-level load or collection failure by loading the same file at base; an identical load failure at base stays a new-failure candidate (same at base) for Orchestrator disposition. If base needs prerequisites or the sandbox prevents running there, Tester installs or generates nothing and reports an environment block; Orchestrator then prepares the prerequisites or assigns a separate Tester whose workspace is the base worktree. If both are blocked, those failures stay new-failure candidates for Orchestrator disposition. Static checks and base reruns classify failures; they are not intermittency diagnosis.
|
|
50
|
+
**Baseline:** No baseline run is recorded in advance, and no base worktree is prepared in advance, except for a plan-approved capture under **Baseline mode** below. Tester classifies each failure in two steps. First, a static check against the approved base: task Tester, which verifies uncommitted work, uses read-only `git diff --name-only <approved base>` plus the untracked files from `git status --porcelain`; final verification Tester uses `git diff --name-only <approved base> HEAD`. Tester checks whether the test file, the modules it directly imports or loads, the fixtures or data it reads, or its test configuration changed. If none changed, it is an unrelated failure: report it separately with that evidence; it is not a finding, and Orchestrator dispositions it. Because it rests on the diff, not a run, NEVER report it as a baseline failure. If any changed, or the check cannot decide (for example a dynamic import, a failure without a test name, or a file-level load failure), report the failure as needing a base run, with the changed paths. Second, only for those failures, Orchestrator prepares a clean detached worktree of the approved base revision at `<git-common-dir>/arc/base/<workflow>`, never under a managed worktree directory (such as `.claude/worktrees/`) or inside the execution target worktree, reuses it for that workflow, runs no tests there, and sends its path and prerequisite state (prepared, or not prepared with the needed commands) to the current Tester. If the environment blocks running tests at that path, Orchestrator MAY instead prepare the same worktree at a path outside every repository working tree and every managed worktree directory, recording that path in the brief and in the canonical handoff record; the same reuse and removal rules apply. After all final dispositions Orchestrator removes it only if it is still clean; this ARC-owned base worktree is the only exception to the Preservation rule's worktree-deletion ban, and any other state holds removal for the user. Tester runs only those test names alone in the base worktree, for example with Node `--test-name-pattern` or a Python node id. A failure under the same name at base is a baseline failure; a pass at base, or a test or file absent at base, makes it a new failure; a base run that was not performed, was blocked by the environment, failed to load or lacks the name makes it a new-failure candidate. NEVER absorb a candidate as a baseline failure. Check a file-level load or collection failure by loading the same file at base; an identical load failure at base stays a new-failure candidate (same at base) for Orchestrator disposition. If base needs prerequisites or the sandbox prevents running there, Tester installs or generates nothing and reports an environment block; Orchestrator then prepares the prerequisites or assigns a separate Tester whose workspace is the base worktree. If both are blocked, those failures stay new-failure candidates for Orchestrator disposition. Static checks and base reruns classify failures; they are not intermittency diagnosis.
|
|
51
|
+
|
|
52
|
+
**Baseline mode:** A plan MAY name a pre-change capture, such as test results or rendered outputs at the approved base, as an approved plan step with its exact commands and expected outputs only when an acceptance criterion requires comparison against pre-change output and that output cannot be regenerated later from the base commit or generating it later would block task acceptance; the step states which of these conditions it meets. Otherwise the plan names no capture and failures are classified under **Baseline** above. Orchestrator assigns that step to a fresh Tester with `mode: baseline` and, before the first Implementer of the dependent task starts, prepares the base worktree under **Baseline** above and cites its path and prerequisite state in the brief. The baseline Tester runs only those commands in the base worktree; it runs a full suite only when the user separately approved full regression for that workflow, and plan approval alone does not authorize one; it records `git status --porcelain` there at start and end, writes logs and captures only to the brief's temporary location outside every worktree, edits nothing and reports each capture with its command, exit code and output path. If the base worktree needs prerequisites or the environment blocks the run, it installs or generates nothing and reports an environment block. A capture records base state only: it classifies no failure and replaces neither task-mode or final-mode checks nor the base check above. Because the base worktree is a separate checkout, the baseline Tester MAY run while an Implementer writes in the execution target worktree.
|
|
51
53
|
|
|
52
54
|
<a id="risk-scaled-execution"></a>
|
|
53
55
|
## Risk-scaled execution
|
|
@@ -28,7 +28,7 @@ export function evaluate(policy, state, request, evidence){
|
|
|
28
28
|
const actor=state.identities.find(i=>i.actorRef===request.actorRef);
|
|
29
29
|
if(!actor)return result('hold','runtime.identity','platform identity unresolved',['platform-identity']);
|
|
30
30
|
const role=actor.role;
|
|
31
|
-
const roleRule={orchestrator:'role.orchestrator-boundary',scouter:'role.scouter-read-only',planner:'role.planner-draft-only',implementer:'role.implementer-implementation',tester:'role.tester-verification',reviewer:'role.reviewer-independent'}[role]??'runtime.identity';
|
|
31
|
+
const roleRule={orchestrator:'role.orchestrator-boundary',scouter:'role.scouter-read-only',architect:'role.architect-draft-only',planner:'role.planner-draft-only',implementer:'role.implementer-implementation',tester:'role.tester-verification',reviewer:'role.reviewer-independent'}[role]??'runtime.identity';
|
|
32
32
|
if(!ROLE_OPERATIONS[role]?.includes(request.operation))return result('deny',GIT_OPERATIONS.includes(request.operation)?'git.specialists-deny':roleRule,'operation forbidden for assigned role');
|
|
33
33
|
const lease=state.leases.find(l=>l.actorRef===actor.actorRef);
|
|
34
34
|
if(lease?.status==='retired')return result('deny','runtime.identity','retired identity');
|
|
@@ -84,11 +84,12 @@ export function evaluate(policy, state, request, evidence){
|
|
|
84
84
|
if(d.temporary&&!same(d.temporary,approval.scope.temporary))return result('hold','runtime.assignment','delegated temporary scope not approved',['delegated-temporary-scope']);
|
|
85
85
|
if(state.assignments.some(a=>a.assignmentId===request.requestId||a.correlationRef===d.correlationRef))return result('hold','runtime.identity','assignment correlation already registered',['new-assignment-correlation']);
|
|
86
86
|
const next=structuredClone(stored);
|
|
87
|
-
if(d.role==='planner'){
|
|
87
|
+
if(d.role==='planner'||d.role==='architect'){
|
|
88
88
|
const stage=state.plannerLedger?.stages.find(s=>s.id===d.plannerCall?.stageId),proof=fact('planner-call');
|
|
89
89
|
const contract=stage&&{document:stage.document,inputVersion:stage.inputVersion,criteriaVersion:stage.criteriaVersion,scopeVersion:stage.scopeVersion};
|
|
90
90
|
if(!stage||stage.workflowId!==state.workflowId||stage.approvalRef!==approval.id||!same(approval.scope.plannerStage,contract)||!d.paths.includes(stage.document.path)||proof?.sourceRef!==correlation.sourceRef||!same({stageId:proof?.data.stageId,inputVersion:proof?.data.inputVersion,criteriaVersion:proof?.data.criteriaVersion,scopeVersion:proof?.data.scopeVersion},{stageId:stage.id,inputVersion:stage.inputVersion,criteriaVersion:stage.criteriaVersion,scopeVersion:stage.scopeVersion}))return result('hold','runtime.planner-call','Current approved Planner stage and provider evidence required',['planner-stage-ledger','planner-call-evidence']);
|
|
91
91
|
if(state.planningDepth==='Bounded'&&stage.document.kind==='spec')return result('hold','runtime.planner-call','Bounded depth has no spec stage',['approved-spec']);
|
|
92
|
+
if((d.role==='architect')!==(stage.document.kind==='spec'))return result('hold','runtime.planner-call','Architect binds only spec stages and Planner only plan stages',['planner-stage-role']);
|
|
92
93
|
if(stage.document.kind==='plan'&&state.planningDepth!=='Bounded'){
|
|
93
94
|
const reviewedSpecStage=state.plannerLedger.stages.some(s=>s.workflowId===state.workflowId&&s.document.kind==='spec'&&s.ready===true&&s.review.full===true&&s.review.complete===true&&s.scopeVersion===stage.scopeVersion);
|
|
94
95
|
const approvedSpec=reviewedSpecStage||state.documents.some(doc=>doc.kind==='spec'&&state.approvals.some(a=>a.id===doc.approvalRef&&a.contentHash===doc.contentHash&&evidence.provenance.some(p=>p.id===a.id&&p.messageRef===a.messageRef&&p.contentHash===doc.contentHash&&p.verification.sourceRef===a.messageRef)));
|
|
@@ -98,7 +99,7 @@ export function evaluate(policy, state, request, evidence){
|
|
|
98
99
|
if(planner.decision!=='allow')return planner;
|
|
99
100
|
next.plannerLedger.stages[next.plannerLedger.stages.findIndex(s=>s.id===stage.id)]=planner.proposedTransition;
|
|
100
101
|
}
|
|
101
|
-
next.assignments.push({assignmentId:request.requestId,requestId:request.requestId,requestedBy:request.actorRef,status:'pending',actorRef:null,platform:request.platform,correlationRef:d.correlationRef,role:d.role,taskId:d.taskId,paths:[...d.paths],operations:[...d.operations],approvalRef:d.approvalRef,...(d.role==='planner'?{plannerStageId:d.plannerCall.stageId}:{}),...(d.checks?{checks:structuredClone(d.checks)}:{}),...(d.temporary?{temporary:structuredClone(d.temporary)}:{})});
|
|
102
|
+
next.assignments.push({assignmentId:request.requestId,requestId:request.requestId,requestedBy:request.actorRef,status:'pending',actorRef:null,platform:request.platform,correlationRef:d.correlationRef,role:d.role,taskId:d.taskId,paths:[...d.paths],operations:[...d.operations],approvalRef:d.approvalRef,...((d.role==='planner'||d.role==='architect')?{plannerStageId:d.plannerCall.stageId}:{}),...(d.checks?{checks:structuredClone(d.checks)}:{}),...(d.temporary?{temporary:structuredClone(d.temporary)}:{})});
|
|
102
103
|
try{validateWorkflowState(next);}catch{return result('hold','runtime.assignment','invalid pending assignment scope',['valid-assignment']);}
|
|
103
104
|
return {...result('allow','runtime.assignment','pending assignment authorized; observed spawn result still required'),proposedTransition:next};
|
|
104
105
|
}
|
|
@@ -41,7 +41,7 @@ export async function recordPlannerAgentObservation({statePath,expectedRevision,
|
|
|
41
41
|
lock=await fs.open(statePath+'.lock','wx',0o600);const stat=await fs.lstat(statePath);if(!stat.isFile()||stat.isSymbolicLink())throw Error('Observation state must be regular file');
|
|
42
42
|
const state=validateWorkflowState(JSON.parse(await fs.readFile(statePath,'utf8')),{preserveStoredOperations:true}),eventHash=fingerprintRequest({input,observation:observation??null});
|
|
43
43
|
if(state.plannerObservations?.some(o=>o.eventHash===eventHash))return {decision:'hold',reason:'Observation replay',proposedTransition:null,replayed:true};
|
|
44
|
-
const candidates=state.assignments.filter(a=>a.status==='pending'&&a.role==='planner');
|
|
44
|
+
const candidates=state.assignments.filter(a=>a.status==='pending'&&(a.role==='planner'||a.role==='architect'));
|
|
45
45
|
let decision={decision:'hold',reason:'Raw event lacks verified assignment correlation',proposedTransition:null};
|
|
46
46
|
if(state.revision!==expectedRevision)decision.reason='Stale provider context cannot bind identity';
|
|
47
47
|
else if(observation?.actorRef===input.agent_id&&observation.platform===platform)decision=registerAgentObservation(state,observation);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** Canonical semantic operations, independent of platform tool aliases. */
|
|
2
|
-
export const ROLES = Object.freeze(['orchestrator','scouter','planner','implementer','tester','reviewer']);
|
|
2
|
+
export const ROLES = Object.freeze(['orchestrator','scouter','architect','planner','implementer','tester','reviewer']);
|
|
3
3
|
export const GIT_OPERATIONS = Object.freeze(['stage','commit','push','merge','rebase','reset','branch-create','branch-switch','worktree-create','worktree-remove']);
|
|
4
4
|
export const EXTERNAL_OPERATIONS = Object.freeze(['push','merge','deploy','publish','external-message']);
|
|
5
5
|
export const OPERATIONS = Object.freeze(['read','draft','write','check','test','review','temporary-write','operational-query','install','prepare-target','request-approval','assign-agent','accept','transition','scope-expansion','indirect-bypass',...new Set([...GIT_OPERATIONS,...EXTERNAL_OPERATIONS])]);
|
|
6
6
|
export const LEGACY_OPERATIONS = Object.freeze({qa: 'test'});
|
|
7
7
|
export const LEGACY_COOPERATIVE_ROLES = Object.freeze({qa: 'tester'});
|
|
8
|
-
export const ROLE_OPERATIONS = Object.freeze({orchestrator:['read','write','check','prepare-target','request-approval','assign-agent','accept','transition','install',...GIT_OPERATIONS,...EXTERNAL_OPERATIONS],scouter:['read'],planner:['read','draft'],implementer:['read','write','check'],tester:['read','check','temporary-write'],reviewer:['read','review']});
|
|
8
|
+
export const ROLE_OPERATIONS = Object.freeze({orchestrator:['read','write','check','prepare-target','request-approval','assign-agent','accept','transition','install',...GIT_OPERATIONS,...EXTERNAL_OPERATIONS],scouter:['read'],architect:['read','draft'],planner:['read','draft'],implementer:['read','write','check'],tester:['read','check','temporary-write'],reviewer:['read','review']});
|
|
9
9
|
|
|
10
10
|
/** Compare a stored role without rewriting historical evidence. */
|
|
11
11
|
export function canonicalCooperativeRole(role) {
|
|
@@ -6,27 +6,29 @@ import {GEMINI_CONTRACT} from './gemini-stream.mjs';
|
|
|
6
6
|
import {CODEX_PROFILE_ARGS_FORM, CODEX_PROFILE_GIT_ENTRIES, DEFAULT_POLICY, effectiveClaudeSandboxSettings} from './role-dispatch-policy.mjs';
|
|
7
7
|
import {TOOL_PATHS, TOOL_UNIX_SOCKETS} from './tool-access.mjs';
|
|
8
8
|
|
|
9
|
-
const ROLES = ['arc_scouter', 'arc_planner', 'arc_implementer', 'arc_tester', 'arc_reviewer'];
|
|
9
|
+
const ROLES = ['arc_scouter', 'arc_architect', 'arc_planner', 'arc_implementer', 'arc_tester', 'arc_reviewer'];
|
|
10
10
|
const deepFreeze = value => { for (const child of Object.values(value)) if (child && typeof child === 'object') deepFreeze(child); return Object.freeze(value); };
|
|
11
11
|
export const ROLE_BRIDGE_PERMISSIONS = deepFreeze({
|
|
12
12
|
claude: {
|
|
13
13
|
arc_scouter: {permissionMode: 'default', sandbox: false, allowedTools: ['WebFetch', 'WebSearch']},
|
|
14
|
+
arc_architect: {permissionMode: 'default', sandbox: false},
|
|
14
15
|
arc_planner: {permissionMode: 'default', sandbox: false},
|
|
15
16
|
arc_implementer: {permissionMode: 'acceptEdits', sandbox: true}, arc_tester: {permissionMode: 'default', sandbox: true}, arc_reviewer: {permissionMode: 'default', sandbox: false}
|
|
16
17
|
},
|
|
17
18
|
gemini: {
|
|
18
|
-
arc_scouter: {approvalMode: 'plan', sandbox: false}, arc_planner: {approvalMode: 'plan', sandbox: false},
|
|
19
|
+
arc_scouter: {approvalMode: 'plan', sandbox: false}, arc_architect: {approvalMode: 'plan', sandbox: false}, arc_planner: {approvalMode: 'plan', sandbox: false},
|
|
19
20
|
arc_implementer: {approvalMode: 'auto_edit', sandbox: true}, arc_tester: {approvalMode: 'auto_edit', sandbox: true}, arc_reviewer: {approvalMode: 'plan', sandbox: false}
|
|
20
21
|
},
|
|
21
22
|
grok: {
|
|
22
23
|
arc_scouter: {permissionMode: 'plan', sandbox: 'read-only', deny: GROK_CONTRACT.readOnlyDeny},
|
|
24
|
+
arc_architect: {permissionMode: 'plan', sandbox: 'read-only', deny: GROK_CONTRACT.readOnlyDeny},
|
|
23
25
|
arc_planner: {permissionMode: 'plan', sandbox: 'read-only', deny: GROK_CONTRACT.readOnlyDeny},
|
|
24
26
|
arc_reviewer: {permissionMode: 'plan', sandbox: 'read-only', deny: GROK_CONTRACT.readOnlyDeny},
|
|
25
27
|
arc_implementer: {permissionMode: 'acceptEdits', sandbox: 'custom', deny: []},
|
|
26
28
|
arc_tester: {permissionMode: 'acceptEdits', sandbox: 'custom', deny: []},
|
|
27
29
|
},
|
|
28
30
|
codex: {
|
|
29
|
-
arc_scouter: {sandboxMode: 'read-only', search: true}, arc_planner: {sandboxMode: 'read-only', search: false},
|
|
31
|
+
arc_scouter: {sandboxMode: 'read-only', search: true}, arc_architect: {sandboxMode: 'read-only', search: false}, arc_planner: {sandboxMode: 'read-only', search: false},
|
|
30
32
|
arc_implementer: {sandboxMode: 'workspace-write', search: false}, arc_tester: {sandboxMode: 'workspace-write', search: false}, arc_reviewer: {sandboxMode: 'read-only', search: false}
|
|
31
33
|
}
|
|
32
34
|
});
|
|
@@ -5,7 +5,8 @@ import fsp from 'node:fs/promises';
|
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import {DEFAULT_POLICY, HOST_SANDBOX_GATES, reason, profileName, bridgeGateReasons, environmentReasons, capabilityReasons} from './role-dispatch-policy.mjs';
|
|
7
7
|
import {displayRoutingRole} from './role-routing-config.mjs';
|
|
8
|
-
import {readLease, writeLease, listLeases, readHostLimits, NON_TERMINAL_STATES, readHeartbeat, requestCancel, clearCancel, TERMINAL_STATES, validateLease} from './role-dispatch-store.mjs';
|
|
8
|
+
import {readLease, writeLease, listLeases, readHostLimits, NON_TERMINAL_STATES, readHeartbeat, requestCancel, clearCancel, TERMINAL_STATES, validateLease, readWorktreeRecord, writeWorktreeRecord, removeWorktreeRecord, worktreeWriters} from './role-dispatch-store.mjs';
|
|
9
|
+
import {pathsOverlap} from './role-observe.mjs';
|
|
9
10
|
import {withRoutingLock, readActivation, readRevision, authenticate, resolveRuntimeHomes, locateAnchorHome, probeHomeWritable} from './role-routing.mjs';
|
|
10
11
|
import {SUPERVISOR_IMPLEMENTATIONS, startSupervisor, processAlive, resolveWorktree, artifactDirectory, segmentDirectory, buildBridgeInvocation, reapRecordedDescendants, reapRecordedHostServices} from './role-supervisor.mjs';
|
|
11
12
|
|
|
@@ -39,6 +40,18 @@ const residualOf=error=>Array.isArray(error?.residualPaths)?error.residualPaths:
|
|
|
39
40
|
const hold=(context,dispatchId,code,error)=>{const result=blank(context,dispatchId,'hold',code);const residual=residualOf(error);if(residual)result.residualPaths=residual;return result;};
|
|
40
41
|
const classifyLock=error=>{const code=error?.code==='ARC_ROUTING_LOCK_RELEASE'&&error.failure?error.failure.code:error?.code;return code==='ARC_HOST_SANDBOX'?'host_sandbox_blocked':'activation_unverified';};
|
|
41
42
|
|
|
43
|
+
async function overlapHold({anchorHome,lease,worktree,runtimePlatforms}){
|
|
44
|
+
const leases=await listLeases(anchorHome,{runtimePlatforms});
|
|
45
|
+
const records=new Map();
|
|
46
|
+
for(const item of leases){
|
|
47
|
+
if(item.route==='bridge'&&(item.role==='arc_implementer'||item.role==='arc_tester')){
|
|
48
|
+
records.set(item.dispatchId,await readWorktreeRecord(anchorHome,item.dispatchId));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const owners=worktreeWriters({leases,records,dispatchId:lease.dispatchId,worktree,terminalSinceMs:null});
|
|
52
|
+
return owners.some(owner=>pathsOverlap(owner.allowedPaths,lease.allowedPaths));
|
|
53
|
+
}
|
|
54
|
+
|
|
42
55
|
/** Starts the detached supervisor for a reserved bridge lease; the supervisor, not this function, spawns the child. */
|
|
43
56
|
export async function runBridgeDispatch({context,dispatchId,brief,now=Date.now(),policy=DEFAULT_POLICY,startSupervisor:starter=startSupervisor,observeToolContext}={}){
|
|
44
57
|
if(!validContext(context)||typeof dispatchId!=='string'||!ID.test(dispatchId)||dispatchId.startsWith('.')||typeof brief!=='string'){return blank(context,dispatchId,'deny','invalid_request');}
|
|
@@ -59,6 +72,7 @@ export async function runBridgeDispatch({context,dispatchId,brief,now=Date.now()
|
|
|
59
72
|
const capabilities=capabilityReasons({hostPlatform:lease.hostPlatform,targetPlatform:platform,route:lease.route,runtimePlatforms});
|
|
60
73
|
if(capabilities.length){result=blank(context,dispatchId,'hold',capabilities[0]);return;}
|
|
61
74
|
let target;try{target=await resolveWorktree(context.cwd);}catch{result=blank(context,dispatchId,'hold','activation_unverified');return;}
|
|
75
|
+
if(await overlapHold({anchorHome,lease,worktree:target.realpath,runtimePlatforms})){result=blank(context,dispatchId,'hold','allowed_paths_overlap');return;}
|
|
62
76
|
const directory=artifactDirectory(target,lease.workflowId,dispatchId),resultPath=path.join(directory,'result.md');
|
|
63
77
|
let invocation;try{invocation=await buildBridgeInvocation({lease,config,homes,worktree:target.realpath,resultPath,userHome:context.userHome,env:context.env??process.env,target,runtimePlatforms,policy,observeToolContext});}catch(error){result=blank(context,dispatchId,'hold',error.reasonCode??'activation_unverified');return;}
|
|
64
78
|
await fsp.mkdir(directory,{recursive:true,mode:0o700});await fsp.chmod(directory,0o700);
|
|
@@ -68,6 +82,7 @@ export async function runBridgeDispatch({context,dispatchId,brief,now=Date.now()
|
|
|
68
82
|
if(!probe.ok){result=hold(context,dispatchId,probe.code,probe);return;}
|
|
69
83
|
}
|
|
70
84
|
let supervisor;
|
|
85
|
+
await writeWorktreeRecord(anchorHome,dispatchId,{segment:lease.segment,worktree:target.realpath});
|
|
71
86
|
try{supervisor=await starter({codexHome:anchorHome,dispatchId,cwd:target.realpath,userHome:context.userHome,env:context.env??process.env});}
|
|
72
87
|
catch{result=blank(context,dispatchId,'hold','host_sandbox_blocked');return;}
|
|
73
88
|
const next=await writeLease(anchorHome,{...lease,state:'starting',supervisor,argsDigest:invocation.argsDigest,resultPath},{now,runtimePlatforms});
|
|
@@ -196,6 +211,7 @@ export async function resumeRoleDispatch({context,dispatchId,brief,now=Date.now(
|
|
|
196
211
|
if(limits&&(await listLeases(anchorHome,{runtimePlatforms})).filter(item=>item.route==='bridge'&&NON_TERMINAL_STATES.includes(item.state)).length+1>limits.maxConcurrent)codes.add('capacity_exhausted');
|
|
197
212
|
if(codes.size){result=blank(context,dispatchId,'hold','activation_unverified');result.reasons=[...codes].map(reason);return;}
|
|
198
213
|
let target;try{target=await resolveWorktree(context.cwd);}catch{result=blank(context,dispatchId,'hold','activation_unverified');return;}
|
|
214
|
+
if(await overlapHold({anchorHome,lease,worktree:target.realpath,runtimePlatforms})){result=blank(context,dispatchId,'hold','allowed_paths_overlap');return;}
|
|
199
215
|
const segment=lease.segment+1,directory=segmentDirectory(target,lease.workflowId,dispatchId,segment),resultPath=path.join(directory,'result.md');
|
|
200
216
|
let invocation;try{invocation=await buildBridgeInvocation({lease:{...lease,segment},config,homes,worktree:target.realpath,resultPath,userHome:context.userHome,env:context.env??process.env,target,runtimePlatforms,policy,supervisorImplementations,observeToolContext});}catch(error){result=blank(context,dispatchId,'hold',error.reasonCode??'activation_unverified');return;}
|
|
201
217
|
await fsp.mkdir(directory,{recursive:true,mode:0o700});await fsp.chmod(path.dirname(directory),0o700);await fsp.chmod(directory,0o700);
|
|
@@ -204,10 +220,16 @@ export async function resumeRoleDispatch({context,dispatchId,brief,now=Date.now(
|
|
|
204
220
|
const probe=await probeHomeWritable(homes[platform]);
|
|
205
221
|
if(!probe.ok){result=hold(context,dispatchId,probe.code,probe);return;}
|
|
206
222
|
}
|
|
223
|
+
const previousRecord=await readWorktreeRecord(anchorHome,dispatchId);
|
|
224
|
+
await writeWorktreeRecord(anchorHome,dispatchId,{segment,worktree:target.realpath});
|
|
207
225
|
await clearCancel(anchorHome,dispatchId);
|
|
208
226
|
let supervisor;
|
|
209
227
|
try{supervisor=await starter({codexHome:anchorHome,dispatchId,cwd:target.realpath,userHome:context.userHome,env:context.env??process.env});}
|
|
210
|
-
catch{
|
|
228
|
+
catch{
|
|
229
|
+
if(previousRecord)await writeWorktreeRecord(anchorHome,dispatchId,previousRecord);
|
|
230
|
+
else await removeWorktreeRecord(anchorHome,dispatchId);
|
|
231
|
+
result=blank(context,dispatchId,'hold','host_sandbox_blocked');return;
|
|
232
|
+
}
|
|
211
233
|
const claims=lease.claims?{...lease.claims,terminal:{level:'unverified',source:'none'}}:null;
|
|
212
234
|
const next=await writeLease(anchorHome,{...lease,state:'starting',supervisor,child:null,argsDigest:invocation.argsDigest,resultPath,segment,claims,reasons:[]},{now,runtimePlatforms});
|
|
213
235
|
result={...view(next,'allow'),segment};
|
|
@@ -41,7 +41,7 @@ export const effectiveClaudeSandboxSettings = policy => policy?.gates?.G1 === 'p
|
|
|
41
41
|
export const CATALOG_MODEL_ALIASES = Object.freeze(['fable', 'opus', 'sonnet', 'haiku']);
|
|
42
42
|
export const CODEX_DELEGATION_CALL_NAMES = Object.freeze(['spawn_agent', 'wait_agent']);
|
|
43
43
|
export const DESKTOP_CHECKLIST_PASSED = Object.freeze({'claude-desktop': false, 'codex-desktop': false});
|
|
44
|
-
export const ROLE_TIMEOUT_MINUTES = Object.freeze({arc_scouter: 20, arc_planner: 20, arc_implementer: 60, arc_tester: 60, arc_reviewer: 20});
|
|
44
|
+
export const ROLE_TIMEOUT_MINUTES = Object.freeze({arc_scouter: 20, arc_architect: 20, arc_planner: 20, arc_implementer: 60, arc_tester: 60, arc_reviewer: 20});
|
|
45
45
|
export const HEARTBEAT_MS = 5000;
|
|
46
46
|
export const SUPERVISOR_LOST_MS = 30000;
|
|
47
47
|
export const OBSERVE_MAX_WAIT_MS = 540000;
|
|
@@ -86,6 +86,7 @@ export const RELEASE_CONDITIONS = Object.freeze({
|
|
|
86
86
|
environment_unverified: `Desktop hosts are held in this release. If this session is not running inside a Desktop app (for example a terminal or IDE terminal session), declare a CLI environment (${cliEnvironments}) instead; otherwise use a CLI host or a later ARC update that changes the support status.`,
|
|
87
87
|
host_sandbox_blocked: 'Allow the host to write the anchor home and keep a detached supervisor alive, with explicit user approval.',
|
|
88
88
|
capacity_exhausted: 'Finish or release active bridge executions, or raise the host limits.',
|
|
89
|
+
allowed_paths_overlap: 'Wait until the started bridge dispatch whose allowedPaths overlap in the same worktree reaches a terminal state, resolving it first when it is unknown, or prepare a new dispatch with non-overlapping allowedPaths; then run or resume again.',
|
|
89
90
|
permission_scope_unverified: 'Update ARC and verify enforcement of the role permissions and approved scope before starting.',
|
|
90
91
|
native_profile_reload_unverified: 'Verify that the host session loaded the requested profile revision.',
|
|
91
92
|
revision_changed: 'Re-run routing-status and prepare a new dispatch under the current revision.',
|
|
@@ -77,6 +77,7 @@ export async function writeLease(codexHome, lease, {now = Date.now(), runtimePla
|
|
|
77
77
|
return value;
|
|
78
78
|
}
|
|
79
79
|
const HEARTBEAT_SUFFIX = '.heartbeat.json';
|
|
80
|
+
const WORKTREE_SUFFIX = '.worktree';
|
|
80
81
|
const leaseFiles = async codexHome => {
|
|
81
82
|
try { return (await fsp.readdir(dispatchDirectory(codexHome))).filter(name => name.endsWith('.json') && !name.endsWith(HEARTBEAT_SUFFIX) && !name.startsWith('.')).sort(); }
|
|
82
83
|
catch (error) { if (error.code === 'ENOENT') return []; throw error; }
|
|
@@ -97,7 +98,7 @@ export async function pruneTerminalLeases(codexHome, {now = Date.now(), retentio
|
|
|
97
98
|
const updated = Date.parse(lease.updatedAt);
|
|
98
99
|
if (!TERMINAL_STATES.includes(lease.state) || !Number.isFinite(updated) || now - updated <= retentionMs) continue;
|
|
99
100
|
await fsp.unlink(file); removed += 1;
|
|
100
|
-
for (const
|
|
101
|
+
for (const suffix of [HEARTBEAT_SUFFIX, '.cancel', WORKTREE_SUFFIX]) await fsp.unlink(sidecarPath(codexHome, lease.dispatchId, suffix)).catch(() => {});
|
|
101
102
|
} catch { errors += 1; }
|
|
102
103
|
}
|
|
103
104
|
return {removed, errors};
|
|
@@ -117,6 +118,48 @@ export function readHostLimits(hostHome) {
|
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
const sidecarPath = (codexHome, dispatchId, suffix) => path.join(dispatchDirectory(codexHome), `${path.basename(leasePath(codexHome, dispatchId), '.json')}${suffix}`);
|
|
121
|
+
const validWorktree = (segment, worktree) => Number.isInteger(segment) && segment >= 0 && typeof worktree === 'string' && path.isAbsolute(worktree);
|
|
122
|
+
|
|
123
|
+
/** Records the worktree for one segment while the caller holds the routing lock. */
|
|
124
|
+
export async function writeWorktreeRecord(codexHome, dispatchId, {segment, worktree}) {
|
|
125
|
+
if (!validWorktree(segment, worktree)) throw Error('Invalid worktree record');
|
|
126
|
+
const target = sidecarPath(codexHome, dispatchId, WORKTREE_SUFFIX);
|
|
127
|
+
const temp = path.join(dispatchDirectory(codexHome), `.${dispatchId}.${crypto.randomUUID()}.wt.tmp`);
|
|
128
|
+
try {
|
|
129
|
+
const handle = await fsp.open(temp, 'wx', 0o600);
|
|
130
|
+
try { await handle.writeFile(JSON.stringify({version: 1, dispatchId, segment, worktree}) + '\n'); } finally { await handle.close(); }
|
|
131
|
+
await fsp.rename(temp, target);
|
|
132
|
+
} catch (error) { await fsp.unlink(temp).catch(() => {}); throw error; }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export async function readWorktreeRecord(codexHome, dispatchId) {
|
|
136
|
+
try {
|
|
137
|
+
const value = JSON.parse(await fsp.readFile(sidecarPath(codexHome, dispatchId, WORKTREE_SUFFIX), 'utf8'));
|
|
138
|
+
if (!isObject(value) || Object.keys(value).length !== 4 || value.version !== 1 ||
|
|
139
|
+
value.dispatchId !== dispatchId || !validWorktree(value.segment, value.worktree)) return null;
|
|
140
|
+
return value;
|
|
141
|
+
} catch { return null; }
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export async function removeWorktreeRecord(codexHome, dispatchId) {
|
|
145
|
+
try { await fsp.unlink(sidecarPath(codexHome, dispatchId, WORKTREE_SUFFIX)); }
|
|
146
|
+
catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function worktreeWriters({leases, records, dispatchId, worktree, terminalSinceMs, excludeUnknown = false}) {
|
|
150
|
+
const writers = leases.filter(lease => {
|
|
151
|
+
if (lease.dispatchId === dispatchId || lease.route !== 'bridge' ||
|
|
152
|
+
(lease.role !== 'arc_implementer' && lease.role !== 'arc_tester') || !lease.allowedPaths.length) return false;
|
|
153
|
+
if (excludeUnknown && lease.state === 'unknown') return false;
|
|
154
|
+
const record = records.get(lease.dispatchId);
|
|
155
|
+
if (!record || record.segment !== lease.segment || record.worktree !== worktree) return false;
|
|
156
|
+
return (lease.state !== 'reserved' && NON_TERMINAL_STATES.includes(lease.state)) ||
|
|
157
|
+
(terminalSinceMs !== null && TERMINAL_STATES.includes(lease.state) && Date.parse(lease.updatedAt) >= terminalSinceMs);
|
|
158
|
+
});
|
|
159
|
+
return writers.sort((a, b) => a.dispatchId < b.dispatchId ? -1 : a.dispatchId > b.dispatchId ? 1 : 0)
|
|
160
|
+
.map(({dispatchId, allowedPaths}) => ({dispatchId, allowedPaths}));
|
|
161
|
+
}
|
|
162
|
+
|
|
120
163
|
/** The supervisor alone writes its heartbeat; no routing lock is needed because the file is replaced atomically and holds no lease state. */
|
|
121
164
|
export async function writeHeartbeat(codexHome, dispatchId, {at, pid}) {
|
|
122
165
|
if (!Number.isFinite(at) || !Number.isInteger(pid) || pid <= 0) throw Error('Invalid heartbeat');
|
|
@@ -568,6 +568,8 @@ function otherWorktreeBranches(before, after) {
|
|
|
568
568
|
}
|
|
569
569
|
|
|
570
570
|
const allowedBy = (allowedPaths, file) => allowedPaths.some(entry => entry.endsWith('/') ? file.startsWith(entry) : file === entry);
|
|
571
|
+
export const pathsOverlap = (a, b) => a.some(file => allowedBy(b, file)) || b.some(file => allowedBy(a, file));
|
|
572
|
+
const byPath = (a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0;
|
|
571
573
|
const hasBranchRefs = (before, after) => before.branchRef !== undefined && after.branchRef !== undefined;
|
|
572
574
|
const branchChanged = (before, after) => hasBranchRefs(before, after)
|
|
573
575
|
? before.branchRef !== after.branchRef
|
|
@@ -638,7 +640,7 @@ export async function observeHeadAdvance(root, before, after, role, allowedPaths
|
|
|
638
640
|
* commits. Ordinary worktree snapshots omit Git-ignored paths. Control files
|
|
639
641
|
* are compared regardless of role and allowedPaths.
|
|
640
642
|
*/
|
|
641
|
-
export function detectViolations({role, allowedPaths, before, after, headAdvance}) {
|
|
643
|
+
export function detectViolations({role, allowedPaths, before, after, headAdvance, otherOwners = []}) {
|
|
642
644
|
const branchSwitched = branchChanged(before, after);
|
|
643
645
|
const headMoved = before.head !== after.head;
|
|
644
646
|
const targetBranch = before.branchRef;
|
|
@@ -663,8 +665,12 @@ export function detectViolations({role, allowedPaths, before, after, headAdvance
|
|
|
663
665
|
}
|
|
664
666
|
const allowed = (role === 'arc_implementer' || role === 'arc_tester') && Array.isArray(allowedPaths) ? allowedPaths : [];
|
|
665
667
|
const changed = new Set();
|
|
668
|
+
const attributedPaths = [];
|
|
666
669
|
for (const file of new Set([...before.entries.keys(), ...after.entries.keys()])) {
|
|
667
|
-
if (before.entries.get(file)
|
|
670
|
+
if (before.entries.get(file) === after.entries.get(file) || allowedBy(allowed, file)) continue;
|
|
671
|
+
const owners = otherOwners.filter(owner => allowedBy(owner.allowedPaths, file)).map(owner => owner.dispatchId).sort();
|
|
672
|
+
if (owners.length) attributedPaths.push({path: file, owners});
|
|
673
|
+
else changed.add(file);
|
|
668
674
|
}
|
|
669
675
|
if (headAdvance?.state === 'rejected') {
|
|
670
676
|
for (const file of headAdvance.outOfScopePaths ?? []) changed.add(file);
|
|
@@ -679,15 +685,17 @@ export function detectViolations({role, allowedPaths, before, after, headAdvance
|
|
|
679
685
|
}
|
|
680
686
|
const reason = headChanged || refsChanged || changedPaths.length || controlChanged.length ? 'permission_violation_observed' : null;
|
|
681
687
|
const toleratedCommitPaths = acceptedAdvance ? [...headAdvance.paths].sort() : [];
|
|
682
|
-
return {reason, changedPaths, headChanged, refsChanged, controlChanged: controlChanged.sort(), toleratedRefs: toleratedRefs.sort(), toleratedControl, toleratedCommitPaths};
|
|
688
|
+
return {reason, changedPaths, headChanged, refsChanged, controlChanged: controlChanged.sort(), toleratedRefs: toleratedRefs.sort(), toleratedControl, toleratedCommitPaths, attributedPaths: attributedPaths.sort(byPath)};
|
|
683
689
|
}
|
|
684
690
|
|
|
685
|
-
export function toleratedRecord({toleratedRefs = [], toleratedControl = [], toleratedCommitPaths = []} = {}) {
|
|
691
|
+
export function toleratedRecord({toleratedRefs = [], toleratedControl = [], toleratedCommitPaths = [], attributedPaths = []} = {}) {
|
|
686
692
|
const record = {};
|
|
687
693
|
for (const [key, names] of [['refs', toleratedRefs], ['control', toleratedControl], ['commitPaths', toleratedCommitPaths]]) {
|
|
688
694
|
if (!names.length) continue;
|
|
689
695
|
record[key] = [...names].sort().slice(0, 100);
|
|
690
696
|
if (names.length > 100) record.truncated = true;
|
|
691
697
|
}
|
|
698
|
+
if (attributedPaths.length) record.attributed = [...attributedPaths].sort(byPath).slice(0, 100);
|
|
699
|
+
if (attributedPaths.length > 100) record.truncated = true;
|
|
692
700
|
return Object.keys(record).length ? record : null;
|
|
693
701
|
}
|
|
@@ -9,9 +9,13 @@
|
|
|
9
9
|
"id": "scouter",
|
|
10
10
|
"description": "Read assigned static material and report sources and limits."
|
|
11
11
|
},
|
|
12
|
+
{
|
|
13
|
+
"id": "architect",
|
|
14
|
+
"description": "Return design, start summary and spec drafts to Orchestrator."
|
|
15
|
+
},
|
|
12
16
|
{
|
|
13
17
|
"id": "planner",
|
|
14
|
-
"description": "Return
|
|
18
|
+
"description": "Return plan drafts to Orchestrator."
|
|
15
19
|
},
|
|
16
20
|
{
|
|
17
21
|
"id": "implementer",
|
|
@@ -32,6 +36,7 @@
|
|
|
32
36
|
"roles": [
|
|
33
37
|
"orchestrator",
|
|
34
38
|
"scouter",
|
|
39
|
+
"architect",
|
|
35
40
|
"planner",
|
|
36
41
|
"implementer",
|
|
37
42
|
"tester",
|
|
@@ -59,6 +64,7 @@
|
|
|
59
64
|
"id": "git.specialists-deny",
|
|
60
65
|
"roles": [
|
|
61
66
|
"scouter",
|
|
67
|
+
"architect",
|
|
62
68
|
"planner",
|
|
63
69
|
"implementer",
|
|
64
70
|
"tester",
|
|
@@ -121,6 +127,7 @@
|
|
|
121
127
|
"roles": [
|
|
122
128
|
"orchestrator",
|
|
123
129
|
"scouter",
|
|
130
|
+
"architect",
|
|
124
131
|
"planner",
|
|
125
132
|
"implementer",
|
|
126
133
|
"tester",
|
|
@@ -151,6 +158,7 @@
|
|
|
151
158
|
"roles": [
|
|
152
159
|
"orchestrator",
|
|
153
160
|
"scouter",
|
|
161
|
+
"architect",
|
|
154
162
|
"planner",
|
|
155
163
|
"implementer",
|
|
156
164
|
"tester",
|
|
@@ -186,7 +194,7 @@
|
|
|
186
194
|
"role-ownership"
|
|
187
195
|
],
|
|
188
196
|
"authority": "orchestrator",
|
|
189
|
-
"text": "Assign design/brainstorming drafts and first complete spec
|
|
197
|
+
"text": "Assign design/brainstorming drafts and first complete spec drafts only to Architect, first complete plan drafts only to Planner, and implementation/configuration/test edits to Implementer. Orchestrator saves and reviews complete spec/plan drafts and directly revises the same document when needed. Missing or failed first drafts do not transfer initial authorship. New product decisions outside approved scope require user input before revision. Orchestrator owns approval requests, preparation, scheduling, evidence, acceptance and completion. Direct implementation remains limited to the existing small, low-risk path. Use a fresh Implementer per top-level task and a fresh Tester per task requiring Tester; Tester findings alone do not create a new task. Record each plan task's current Implementer conversation ID, status, last result and reuse/replacement decision in the canonical handoff record. While approved scope, workspace, ownership and assignment context remain valid, send same-task corrections, rework and rechecks as follow-up work in that conversation; use the current Tester for Tester findings and required Tester rechecks. Once final overall Reviewer review begins on plan work, Reviewer findings, including behavior, repeat Implementer → Reviewer without Tester reassignment until resolved; separate Tester findings remain Implementer → Tester. A completed or idle turn, partial implementation, failed result, missing brief, division by step or file, or Tester/Reviewer finding alone is not a reason to replace the Implementer. Before a same-task replacement, record the prior conversation ID and status, allowed reason and supporting evidence; hold if the reason is not established. Record the new ID after a successful call; reconcile an uncertain result before another assignment. Replace or restart a role only for invalid/unavailable context or a changed task boundary, except that an approved plan or acceptance-criteria amendment requires a fresh Implementer even within the same task. Before Implementer reuse, refresh actual workspace, branch/HEAD and change state. For Tester findings and required Tester rechecks, Tester reruns reproduction and invalidated related checks and reports actor, target state, outcomes and limits. Preserve task-boundary acceptance and the final plan Reviewer correction exception.",
|
|
190
198
|
"controls": {
|
|
191
199
|
"codex": "prompt",
|
|
192
200
|
"claude": "prompt",
|
|
@@ -216,6 +224,27 @@
|
|
|
216
224
|
"grok": "prompt"
|
|
217
225
|
}
|
|
218
226
|
},
|
|
227
|
+
{
|
|
228
|
+
"id": "role.architect-draft-only",
|
|
229
|
+
"roles": [
|
|
230
|
+
"architect"
|
|
231
|
+
],
|
|
232
|
+
"effect": "allow",
|
|
233
|
+
"operations": [
|
|
234
|
+
"draft-response"
|
|
235
|
+
],
|
|
236
|
+
"evidence": [
|
|
237
|
+
"prepared-target-evidence"
|
|
238
|
+
],
|
|
239
|
+
"authority": "orchestrator",
|
|
240
|
+
"text": "Return design/brainstorming drafts, start summaries and complete first spec drafts with dependencies, criteria, holds and verification needs in the response. During initial drafting and revisions, report progress only to Orchestrator: briefly state the stage, feedback being applied, actual blocker or next step, without draft prose or excerpts. Return the complete first draft and self-review for Orchestrator review; Orchestrator directly revises the same spec when needed. Raw responses may appear in app/tool surfaces; prompt policy cannot hide them. DO NOT save documents, implement, run checks, prepare targets, request user approval or decide acceptance. The first required document draft uses the verified source and selected target intent before target preparation. Require a verified prepared target before saving or handoff. Route decisions to Orchestrator.",
|
|
241
|
+
"controls": {
|
|
242
|
+
"codex": "prompt",
|
|
243
|
+
"claude": "prompt",
|
|
244
|
+
"gemini": "prompt",
|
|
245
|
+
"grok": "prompt"
|
|
246
|
+
}
|
|
247
|
+
},
|
|
219
248
|
{
|
|
220
249
|
"id": "role.planner-draft-only",
|
|
221
250
|
"roles": [
|
|
@@ -230,7 +259,7 @@
|
|
|
230
259
|
"approved-spec-before-dependent-plan"
|
|
231
260
|
],
|
|
232
261
|
"authority": "orchestrator",
|
|
233
|
-
"text": "Return
|
|
262
|
+
"text": "Return complete first plan drafts with dependencies, criteria, holds and verification needs in the response. During initial drafting and revisions, report progress only to Orchestrator: briefly state the stage, feedback being applied, actual blocker or next step, without draft prose or excerpts. Return the complete first draft and self-review for Orchestrator review; Orchestrator directly revises the same plan when needed. Raw responses may appear in app/tool surfaces; prompt policy cannot hide them. DO NOT save documents, implement, run checks, prepare targets, request user approval or decide acceptance. The first required document draft uses the verified source and selected target intent before target preparation. Require a verified prepared target before saving or handoff. Route decisions to Orchestrator.",
|
|
234
263
|
"controls": {
|
|
235
264
|
"codex": "prompt",
|
|
236
265
|
"claude": "prompt",
|
|
@@ -400,11 +429,10 @@
|
|
|
400
429
|
"evidence": [
|
|
401
430
|
"non-progress-content-change-classification",
|
|
402
431
|
"actual-approval-chronology",
|
|
403
|
-
"approved-revision-content-hash"
|
|
404
|
-
"plan-revision-trailers"
|
|
432
|
+
"approved-revision-content-hash"
|
|
405
433
|
],
|
|
406
434
|
"authority": "orchestrator",
|
|
407
|
-
"text": "Task progress records (checkboxes, notes, results, evidence and status) preserving the approved contract need no new user approval; Orchestrator includes the completed task's own records in its accepted implementation commit and records classification, reason and actual time as applicable. Plan-level progress records preserving the approved contract also need no new user approval and alone never trigger the standalone docs(plan) closing commit. All other spec/plan content changes, contract or mechanical, require applicable approval and preparation; changes to goals, scope, criteria, method, risk, dependencies or required verification need revised-version approval, preparation and holds on affected work before it continues, with a fresh Implementer for remaining work. After approval Orchestrator edits the same document, appends a revision-history row and leaves it uncommitted as an Orchestrator-owned pending revision, recording version, content hash, approval reference, actual time, classification, reason, affected tasks and the full approved content in the canonical handoff record. Orchestrator includes all pending revisions
|
|
435
|
+
"text": "Task progress records (checkboxes, notes, results, evidence and status) preserving the approved contract need no new user approval; Orchestrator includes the completed task's own records in its accepted implementation commit and records classification, reason and actual time as applicable. Plan-level progress records preserving the approved contract also need no new user approval and alone never trigger the standalone docs(plan) closing commit. All other spec/plan content changes, contract or mechanical, require applicable approval and preparation; changes to goals, scope, criteria, method, risk, dependencies or required verification need revised-version approval, preparation and holds on affected work before it continues, with a fresh Implementer for remaining work. After approval Orchestrator edits the same document, appends a revision-history row and leaves it uncommitted as an Orchestrator-owned pending revision, recording version, content hash, approval reference, actual time, classification, reason, affected tasks and the full approved content in the canonical handoff record. Orchestrator includes all pending revisions in the accepted commit of the first top-level task executed or reconfirmed against the revised version, otherwise in a current task or final Reviewer follow-up commit; only when no implementation work remains before overall completion MAY it make one standalone docs(plan) closing commit without implementation files. Exclude revision hunks from commits of independent tasks accepted on a prior version, or hold that commit when separation is unsafe. NEVER amend or rewrite planning or implementation commits, create any other docs/fixup commit or authorize past work retroactively. After commit verify the committed document content matches the latest approved content apart from classified progress records of that commit's task or committed for other tasks after approval, or plan-level progress records carried by that commit, and that no pending revision remains. Follow planning, handoff-prep, commit and verification for the full contract.",
|
|
408
436
|
"controls": {
|
|
409
437
|
"codex": "prompt",
|
|
410
438
|
"claude": "prompt",
|
|
@@ -428,7 +456,7 @@
|
|
|
428
456
|
"preceding-approval"
|
|
429
457
|
],
|
|
430
458
|
"authority": "orchestrator",
|
|
431
|
-
"text": "Follow planning.md's
|
|
459
|
+
"text": "Follow planning.md's drafting preparation and review procedure for the drafting role (Architect or Planner), including preflight, ledger, evidence classification, target preparation, preceding approvals, provenance and reference gates. Before drafting-role dispatch, evaluate F1–F8 direct-path eligibility and Bounded plan-omission eligibility independently. Enter each path only when all of that path's existing conditions are proven; if neither path qualifies, use normal full evaluation. Send one complete stage-specific initial brief. Reuse the same Architect instance only within the design/brainstorming stage while its role, context and source remain valid, except that on the Architectural path that Architect continues as the spec author after start confirmation through a spec-stage delta brief; use a fresh Planner instance for each plan stage, reusing it only for a budget-hold delta within that stage, and a fresh Architect for an Architectural spec stage when that Architect is unavailable or its role, context or source is no longer valid; each fresh instance's initial brief contains every required field, saved document paths and approved versions (for the Architectural plan stage, the reviewed spec path, version and SHA-256). Follow-up briefs send changed fields and cite an accessible prior brief for unchanged fields. Reuse evidence only for the same source set, absolute locator, resolved path, content fingerprint, purpose and approval scope in an accessible matching context. Reconfirm affected inputs when source, target or scope changed. The drafting role returns a complete proportional first draft and self-review. Orchestrator reviews and directly revises the same spec or plan when needed. A missing or failed first draft does not transfer initial authorship to Orchestrator. New product decisions outside approved scope require user input before Orchestrator revises the document. For design and brainstorming, follow planning.md's design conversation: each Architect response is exactly one of one question, 2–3 approaches with a recommendation and a selection question, one design section with a confirmation question, or the final design (Architectural: the start summary). Ask one question at a time only when the answer changes the outcome and is not already answered; otherwise state the judgment and its reason. Ask an open question about the user's reason before offering options. For a clear request, Architect MAY return a short design for approval at once; when the user says to proceed, stop asking and list the remaining author judgments in the final design or start summary. Relay user answers verbatim and mark added interpretation separately. Every call needs a new user answer or new evidence; without progress, report the blocked criterion, observed facts and needed decision, and hold. Conversation responses use no correction opportunity. Orchestrator reviews the final design once with the fixed checklist, including decision-inventory completeness and no ambiguous scope wording, and sends one consolidated correction using changed fields only. On the Architectural path the start summary receives no consolidated correction; Orchestrator checks its decision inventory and scope notation before presenting it, and the spec draft takes Orchestrator's review and direct revision. Further calls require user-approved material scope/evidence changes or concrete unmet checklist items after correction, plus meaningful new input or criterion-state progress. State changed input, target criterion, expected artifact and expected progress. Repeated unmet criteria without new input, evidence or progress hold the stage; report the criterion, observed evidence and exact unblock input/decision. DO NOT split omissions, repeat resolved items or count rewording/agent replacement as progress. DO NOT invoke Architect or Planner only for reformatting, re-expression, save errors or patch-application errors; Orchestrator handles these. Evaluate separate substantive work under the normal drafting-role gate. For Bounded work, Architect drafts the short design; obtain design approval before a fresh Planner drafts any required plan. For Architectural work, obtain one start confirmation (scope and explicit target; no design document or design approval) before spec drafting, let the design Architect continue as the spec author (a fresh Architect when it is unavailable or invalid), then draft the plan with a fresh Planner, assigning the Planner only after the spec is saved and reviewed and its path, version and SHA-256 are fixed; NEVER draft them concurrently; then obtain one combined spec+plan approval. Bounded work has no spec stage; required plans keep their own approval. Add no fixed call cap or profile call-count conditions, and NEVER accept an incomplete draft. Keep user progress brief and based on drafting-role status without relaying draft content. At approval, present the integrated, saved and reviewed Markdown without repeating its body in chat.",
|
|
432
460
|
"controls": {
|
|
433
461
|
"codex": "prompt",
|
|
434
462
|
"claude": "prompt",
|
|
@@ -690,6 +718,7 @@
|
|
|
690
718
|
"roles": [
|
|
691
719
|
"orchestrator",
|
|
692
720
|
"scouter",
|
|
721
|
+
"architect",
|
|
693
722
|
"planner",
|
|
694
723
|
"implementer",
|
|
695
724
|
"tester",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {runtimeRegistryOf} from './platform-registry.mjs';
|
|
2
2
|
|
|
3
|
-
export const ROUTING_ROLES = Object.freeze(['arc_scouter', 'arc_planner', 'arc_implementer', 'arc_tester', 'arc_reviewer']);
|
|
3
|
+
export const ROUTING_ROLES = Object.freeze(['arc_scouter', 'arc_architect', 'arc_planner', 'arc_implementer', 'arc_tester', 'arc_reviewer']);
|
|
4
4
|
export const LEGACY_ROUTING_ROLES = Object.freeze({arc_qa: 'arc_tester'});
|
|
5
|
-
export const ROUTING_CONFIG_VERSION =
|
|
5
|
+
export const ROUTING_CONFIG_VERSION = 4;
|
|
6
6
|
const validText = value => typeof value === 'string' && value.length > 0 && value === value.trim() && !/[\p{Cc}\u2028\u2029]/u.test(value);
|
|
7
7
|
const exact = (value, keys) => value && typeof value === 'object' && !Array.isArray(value) && Object.keys(value).length === keys.length && keys.every(key => Object.hasOwn(value, key));
|
|
8
8
|
const v1Platforms = Object.freeze(['codex', 'claude']);
|
|
@@ -22,13 +22,18 @@ export function validRoleValues(platform, model, effort, {runtimePlatforms} = {}
|
|
|
22
22
|
}
|
|
23
23
|
export function validateRoleRoutingConfig(config, opts = {}) {
|
|
24
24
|
const keys = ['version', 'revision', 'platforms', 'roles'];
|
|
25
|
-
if (!(exact(config, keys) || (config?.version === 1 && exact(config, ['version', 'revision', 'roles']))) || ![1, 2, ROUTING_CONFIG_VERSION].includes(config.version) || !validText(config.revision)) throw Error('Invalid role routing configuration');
|
|
25
|
+
if (!(exact(config, keys) || (config?.version === 1 && exact(config, ['version', 'revision', 'roles']))) || ![1, 2, 3, ROUTING_CONFIG_VERSION].includes(config.version) || !validText(config.revision)) throw Error('Invalid role routing configuration');
|
|
26
26
|
let roles = config.roles;
|
|
27
27
|
if (roles && typeof roles === 'object' && !Array.isArray(roles) && Object.hasOwn(roles, 'arc_qa')) {
|
|
28
|
-
if (config.version
|
|
28
|
+
if (config.version >= 3 || Object.hasOwn(roles, 'arc_tester')) throw Error('Invalid role routing configuration');
|
|
29
29
|
roles = Object.fromEntries(Object.entries(roles).map(([role, fields]) => [Object.hasOwn(LEGACY_ROUTING_ROLES, role) ? LEGACY_ROUTING_ROLES[role] : role, fields]));
|
|
30
30
|
}
|
|
31
|
+
if (config.version < ROUTING_CONFIG_VERSION && roles && typeof roles === 'object' && !Array.isArray(roles)
|
|
32
|
+
&& !Object.hasOwn(roles, 'arc_architect') && Object.hasOwn(roles, 'arc_planner')) {
|
|
33
|
+
roles = {...roles, arc_architect: structuredClone(roles.arc_planner)};
|
|
34
|
+
}
|
|
31
35
|
if (!exact(roles, ROUTING_ROLES)) throw Error('Invalid role routing configuration');
|
|
36
|
+
roles = Object.fromEntries(ROUTING_ROLES.map(role => [role, roles[role]]));
|
|
32
37
|
const registry = runtimeRegistryOf(opts);
|
|
33
38
|
const platforms = config.version === 1 && !Object.hasOwn(config, 'platforms') ? [...v1Platforms] : config.platforms;
|
|
34
39
|
if (!Array.isArray(platforms) || platforms.length < 2 || new Set(platforms).size !== platforms.length || platforms.some(id => !registry.isPlatformId(id))) throw Error('Invalid role routing platforms');
|
|
@@ -11,7 +11,7 @@ import {GROK_CONTRACT, normalizeGrokStreamEvent, evaluateGrokObservation} from '
|
|
|
11
11
|
import {GROK_SANDBOX_RELATIVE, grokSandboxProfileName, renderGrokSandboxProfile, grokProfileCovered, inspectGrokProfileSlot, checkGrokHome, createGrokSandboxProfile, verifyGrokSandboxProfile, removeGrokSandboxProfile, grokEventsBaseline, readGrokProfileApplied, grokConfigSecurityProjection} from './grok-sandbox.mjs';
|
|
12
12
|
import {GEMINI_CONTRACT, normalizeGeminiStreamEvent, evaluateGeminiObservation} from './gemini-stream.mjs';
|
|
13
13
|
import {CODEX_PROFILE_SANDBOX_TYPE, DEFAULT_POLICY, DESCENDANT_LIMIT, DESCENDANT_SAMPLE_MS, reason, bridgeGateReasons} from './role-dispatch-policy.mjs';
|
|
14
|
-
import {readLease, writeLease, writeHeartbeat, cancelRequested, dispatchDirectory, TERMINAL_STATES} from './role-dispatch-store.mjs';
|
|
14
|
+
import {readLease, writeLease, writeHeartbeat, cancelRequested, dispatchDirectory, TERMINAL_STATES, listLeases, readWorktreeRecord, worktreeWriters} from './role-dispatch-store.mjs';
|
|
15
15
|
import {withRoutingLock, readActivation, resolveRuntimeHomes} from './role-routing.mjs';
|
|
16
16
|
import {resolveLocalCli, localCliEnvironment} from './local-cli.mjs';
|
|
17
17
|
import {parseCompositeProfile, buildBridgeArgs, argsDigest, ROLE_BRIDGE_PERMISSIONS} from './role-bridge-args.mjs';
|
|
@@ -743,6 +743,7 @@ export async function runSupervisor(options) {
|
|
|
743
743
|
control: await snapshotControlFiles({gitCommonDir: target.gitCommonDir, gitDir: target.gitDir, worktree: target.realpath, extra}),
|
|
744
744
|
});
|
|
745
745
|
let before;
|
|
746
|
+
const sinceMs = Date.now();
|
|
746
747
|
try { before = await snapshot(); } catch { return await failWithProfileCleanup('execution_failed'); }
|
|
747
748
|
|
|
748
749
|
if (invocation.promptFile) {
|
|
@@ -925,9 +926,22 @@ export async function runSupervisor(options) {
|
|
|
925
926
|
}
|
|
926
927
|
|
|
927
928
|
let after = null;
|
|
929
|
+
const otherOwners = await locked(async () => {
|
|
930
|
+
const worktree = target.realpath;
|
|
931
|
+
const own = await readWorktreeRecord(codexHome, dispatchId);
|
|
932
|
+
if (own?.segment !== lease.segment || own.worktree !== worktree) return [];
|
|
933
|
+
const leases = await listLeases(codexHome, {runtimePlatforms});
|
|
934
|
+
const records = new Map();
|
|
935
|
+
for (const item of leases) {
|
|
936
|
+
if (item.dispatchId !== dispatchId && item.route === 'bridge' && (item.role === 'arc_implementer' || item.role === 'arc_tester')) {
|
|
937
|
+
records.set(item.dispatchId, await readWorktreeRecord(codexHome, item.dispatchId));
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
return worktreeWriters({leases, records, dispatchId, worktree, terminalSinceMs: sinceMs, excludeUnknown: true});
|
|
941
|
+
}).catch(() => []);
|
|
928
942
|
try { after = await snapshot(); } catch { after = null; }
|
|
929
943
|
const headAdvance = after ? await observeHeadAdvance(target.realpath, before, after, lease.role, lease.allowedPaths) : null;
|
|
930
|
-
const violations = after ? detectViolations({role: lease.role, allowedPaths: lease.allowedPaths, before, after, headAdvance}) : {reason: null, changedPaths: [], headChanged: false, refsChanged: false, controlChanged: [], toleratedRefs: [], toleratedControl: [], toleratedCommitPaths: []};
|
|
944
|
+
const violations = after ? detectViolations({role: lease.role, allowedPaths: lease.allowedPaths, before, after, headAdvance, otherOwners}) : {reason: null, changedPaths: [], headChanged: false, refsChanged: false, controlChanged: [], toleratedRefs: [], toleratedControl: [], toleratedCommitPaths: [], attributedPaths: []};
|
|
931
945
|
const codes = [];
|
|
932
946
|
if (state.mismatch) codes.push(state.mismatch);
|
|
933
947
|
if (state.internal) codes.push(state.internal);
|