@yunhozz/arc 0.4.5 → 0.4.7
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 +78 -73
- 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/references/coordination.md +4 -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 +16 -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/references/coordination.md +4 -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 +15 -2
- package/gemini/agents/arc-implementer.md +2 -2
- package/gemini/agents/arc-planner.md +1 -1
- package/gemini/agents/arc-qa.md +1 -1
- package/gemini/agents/arc-reviewer.md +1 -1
- package/gemini/agents/arc-scouter.md +1 -1
- package/gemini/skill/references/coordination.md +5 -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 +16 -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 +4 -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 +16 -3
- package/grok/skill/references/worktree-creation.md +2 -2
- package/lib/cli/root.mjs +1 -1
- package/lib/management/reapply.mjs +117 -0
- package/lib/management/update.mjs +59 -5
- 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/grok-sandbox.mjs +74 -0
- package/lib/runtime/role-bridge.mjs +10 -1
- package/lib/runtime/role-dispatch-policy.mjs +7 -1
- package/lib/runtime/role-observe.mjs +401 -13
- package/lib/runtime/role-routing.mjs +6 -0
- package/lib/runtime/role-supervisor.mjs +285 -33
- package/lib/tui/app.mjs +3 -39
- package/lib/tui/interface.mjs +40 -0
- 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 +43 -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/grok-sandbox.mjs +74 -0
- package/shared/skill/runtime/role-bridge.mjs +10 -1
- package/shared/skill/runtime/role-dispatch-policy.mjs +7 -1
- package/shared/skill/runtime/role-observe.mjs +401 -13
- package/shared/skill/runtime/role-policy.json +1 -1
- package/shared/skill/runtime/role-routing.mjs +6 -0
- package/shared/skill/runtime/role-supervisor.mjs +285 -33
package/lib/npm/upgrade.mjs
CHANGED
|
@@ -45,10 +45,14 @@ export async function runNpxUpgrade({context,expectedVersion,expectedStateToken,
|
|
|
45
45
|
if(typeof api.inspectNpmContext!=='function'||typeof api.collectInstalledState!=='function'||typeof api.upgradeInstalledTargets!=='function')throw Error('Pinned ARC management API is unavailable');
|
|
46
46
|
const context=await api.inspectNpmContext({packageRoot:root,entryPath:entry,env:process.env,cwd});
|
|
47
47
|
if(context.kind!=='npx'||context.packageRoot!==root)throw Error('Cannot verify pinned npm exec context');
|
|
48
|
-
const state=api.collectInstalledState({safeFs:api.safeFs,userHome
|
|
48
|
+
const userHome=os.homedir(),state=api.collectInstalledState({safeFs:api.safeFs,userHome,env:process.env,cwd,platforms:api.platforms,runtimePlatforms:api.runtimePlatforms});
|
|
49
49
|
if(state.stateToken!==expectedStateToken||!state.targets.length)throw Error('Installed ARC settings changed before pinned upgrade');
|
|
50
50
|
const controller=new AbortController(),abort=()=>controller.abort();process.once('SIGINT',abort);process.once('SIGTERM',abort);
|
|
51
|
-
try{
|
|
51
|
+
try{
|
|
52
|
+
process.exitCode=typeof management.upgradeAndReapply==='function'
|
|
53
|
+
?await management.upgradeAndReapply({api,root,state,output:process.stdout,error:process.stderr,signal:controller.signal,env:process.env,cwd,userHome})
|
|
54
|
+
:management.report(await api.upgradeInstalledTargets({packageRoot:root,state,safeFs:api.safeFs,signal:controller.signal,registry:api.platforms}),process.stdout,process.stderr);
|
|
55
|
+
}finally{process.removeListener('SIGINT',abort);process.removeListener('SIGTERM',abort);}
|
|
52
56
|
}catch(error){console.error('Error: '+error.message);process.exitCode=2;}`;
|
|
53
57
|
return runNpm(context.npmCli,['exec','--yes','--package','@yunhozz/arc@'+expectedVersion,'--',process.execPath,'--input-type=module','-e',bootstrap],{env,cwd,signal});
|
|
54
58
|
}
|
|
@@ -379,7 +379,7 @@
|
|
|
379
379
|
"reviewer-findings"
|
|
380
380
|
],
|
|
381
381
|
"authority": "orchestrator",
|
|
382
|
-
"text": "Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings follow Implementer → QA. Preserve required QA outside this final Reviewer exception.",
|
|
382
|
+
"text": "Complete required QA and QA failure rechecks before the initial final overall Reviewer review. Once that review begins on plan work, every final Reviewer finding, including behavior, follows Implementer → Reviewer without QA reassignment until resolved. Keep corrections uncommitted through Reviewer rechecks, then accept and create one focused follow-up commit. Separate QA findings and new failures from final verification, which may run concurrently with the final Reviewer, follow Implementer → QA; Reviewer evidence for affected files then needs a refreshed-diff recheck. Preserve required QA outside this final Reviewer exception.",
|
|
383
383
|
"controls": {
|
|
384
384
|
"codex": "prompt",
|
|
385
385
|
"claude": "prompt",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
"id": "implementer.execution-steps",
|
|
46
|
-
"text": "1. Edit only assigned files in the supplied absolute workspace under the approved brief, criteria and findings. Accommodate others' edits without reverting them. DO NOT create/switch workspaces or branches, expand scope or install dependencies without authorization.\n2. Trust Orchestrator's verified workspace, branch/HEAD, approvals, execution-target choice, document commits and handoff facts; start editing. Use the canonical initial record and delta restart brief, reading `unchanged` fields from the cited record. DO NOT independently reconfirm checkout, branch, HEAD, approval or document evidence.\n3. Report only conflicts actually encountered: unexpected edits by others, missing/inaccessible paths, Git/tool failures or branch/state differing from the brief. Stop dependent work and return observed state and needed action. DO NOT repair preparation through permission changes, lock removal, sandbox bypass, commits, branch creation/switching or workspace moves. Resume after resolution. Expected TDD RED is evidence, not an operational failure.\n4. DO NOT recreate, clean up or archive worktrees. Wait once for long commands with the longest yield or report them to Orchestrator. DO NOT repeat `sleep` or short status checks.\n5. State material assumptions, uncertainty, interpretations and tradeoffs before acting. Return unresolved decisions to Orchestrator.\n6. Make the simplest change meeting approved requirements and criteria. Add no speculative features, abstractions or settings. Edit surgically in local style without unrelated refactoring. Clean up only artifacts you created.\n7. Connect criteria to verifiable checks. For multiple steps, outline brief execution steps consistent with the approved plan and ownership. Run approved checks or report the precise blocker. Support success claims with evidence.\n8. Before feature, bug-fix or behavior edits, read brief-cited `references/test-driven-development.md` unless waived. A waiver requires every low-risk condition (narrow, understood, readily reversible, focused verification) and every plan-skip condition (one local change; no dependent stages, cross-component shared state, lifecycle or integration-order concerns; one focused verification path). Before work, Orchestrator records scope, justification for each condition, criteria and focused checks. Explicit user/task-specific TDD requirements override the waiver. Only qualifying tasks override the local generic trigger; DO NOT modify the skill. Ordinary multistep and significant/high-risk work are ineligible.\n9. A waiver skips only failure-first/RED-GREEN steps. Focused checks, evidence/limits reporting and risk-appropriate QA/Reviewer remain. DO NOT claim TDD was followed. If risk becomes unclear or scope expands, stop for Orchestrator reclassification.\n10. Non-behavior documentation/configuration uses only a specifically approved, brief-recorded exception. Run approved structural checks and state limits. NEVER generalize the exception to behavior work or claim TDD under it.\n11. Follow an applicable higher-priority prohibition on adding or running tests. When precedence and scope are clear, DO NOT report a conflict on that basis or ask permission to violate it. TDD remains applicable to permitted test work. Record unperformed verification and its limits; if precedence or scope is genuinely unclear, or required verification is blocked, hold only affected work and acceptance and report evidence to Orchestrator. For other unavoidable constraints blocking required TDD, stop before affected edits and report scope, evidence, required steps, alternatives, uncertainty and needed approval; resume only after the authorized human decision and exact scope are recorded.\n12. Implement assigned changes and report only. DO NOT plan, design, QA or review your own work. Report changed files, focused checks/evidence, unresolved issues and exact QA/Reviewer follow-up."
|
|
46
|
+
"text": "1. Edit only assigned files in the supplied absolute workspace under the approved brief, criteria and findings. Accommodate others' edits without reverting them. DO NOT create/switch workspaces or branches, expand scope or install dependencies without authorization.\n2. Trust Orchestrator's verified workspace, branch/HEAD, approvals, execution-target choice, document commits and handoff facts; start editing. Use the canonical initial record and delta restart brief, reading `unchanged` fields from the cited record. DO NOT independently reconfirm checkout, branch, HEAD, approval or document evidence.\n3. Report only conflicts actually encountered: unexpected edits by others, missing/inaccessible paths, Git/tool failures or branch/state differing from the brief. Stop dependent work and return observed state and needed action. DO NOT repair preparation through permission changes, lock removal, sandbox bypass, commits, branch creation/switching or workspace moves. Resume after resolution. Expected TDD RED is evidence, not an operational failure.\n4. DO NOT recreate, clean up or archive worktrees. Wait once for long commands with the longest yield or report them to Orchestrator. DO NOT repeat `sleep` or short status checks.\n5. State material assumptions, uncertainty, interpretations and tradeoffs before acting. Return unresolved decisions to Orchestrator.\n6. Make the simplest change meeting approved requirements and criteria. Add no speculative features, abstractions or settings. Edit surgically in local style without unrelated refactoring. Clean up only artifacts you created.\n7. Connect criteria to verifiable checks. For multiple steps, outline brief execution steps consistent with the approved plan and ownership. Run approved checks or report the precise blocker. Run only related tests per installed ARC `references/verification.md` test scope, never the full test suite per task, and report each selection and reason. Support success claims with evidence.\n8. Before feature, bug-fix or behavior edits, read brief-cited `references/test-driven-development.md` unless waived. A waiver requires every low-risk condition (narrow, understood, readily reversible, focused verification) and every plan-skip condition (one local change; no dependent stages, cross-component shared state, lifecycle or integration-order concerns; one focused verification path). Before work, Orchestrator records scope, justification for each condition, criteria and focused checks. Explicit user/task-specific TDD requirements override the waiver. Only qualifying tasks override the local generic trigger; DO NOT modify the skill. Ordinary multistep and significant/high-risk work are ineligible.\n9. A waiver skips only failure-first/RED-GREEN steps. Focused checks, evidence/limits reporting and risk-appropriate QA/Reviewer remain. DO NOT claim TDD was followed. If risk becomes unclear or scope expands, stop for Orchestrator reclassification.\n10. Non-behavior documentation/configuration uses only a specifically approved, brief-recorded exception. Run approved structural checks and state limits. NEVER generalize the exception to behavior work or claim TDD under it.\n11. Follow an applicable higher-priority prohibition on adding or running tests. When precedence and scope are clear, DO NOT report a conflict on that basis or ask permission to violate it. TDD remains applicable to permitted test work. Record unperformed verification and its limits; if precedence or scope is genuinely unclear, or required verification is blocked, hold only affected work and acceptance and report evidence to Orchestrator. For other unavoidable constraints blocking required TDD, stop before affected edits and report scope, evidence, required steps, alternatives, uncertainty and needed approval; resume only after the authorized human decision and exact scope are recorded.\n12. Implement assigned changes and report only. DO NOT plan, design, QA or review your own work. Report changed files, focused checks/evidence, unresolved issues and exact QA/Reviewer follow-up."
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
"id": "planner.target-evidence",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
"id": "planner.task-shape",
|
|
54
|
-
"text": "Return one complete plan draft covering all top-level tasks and dependencies; DO NOT split it into a Planner call per implementation task. For each top-level task, include ID/title, implementation goal/scope/files, predecessors/dependencies and criteria. For that task, also include required QA/focused checks/evidence before acceptance and holds. Put inseparable changes in one task from the outset. DO NOT merge distinct approved tasks during execution. Substeps/checkboxes track progress, not commit units."
|
|
54
|
+
"text": "Return one complete plan draft covering all top-level tasks and dependencies; DO NOT split it into a Planner call per implementation task. For each top-level task, include ID/title, implementation goal/scope/files, predecessors/dependencies and criteria. For that task, also include required QA/focused checks/evidence before acceptance and holds. List each task's related tests with reasons. In final verification list the union, all contract tests and check scripts, and a provisional full-regression trigger judgment with reason. Put inseparable changes in one task from the outset. DO NOT merge distinct approved tasks during execution. Substeps/checkboxes track progress, not commit units."
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
"id": "planner.commit-boundary",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
"id": "qa.verification-steps",
|
|
82
|
-
"text": "1. Use the shared brief, criteria, Implementer summary and relevant prior findings. Independently verify assigned behavior with the
|
|
82
|
+
"text": "1. Use the shared brief, criteria, Implementer summary and relevant prior findings. Independently verify assigned behavior with related tests only: test files directly exercising changed modules, contract tests the change requires updating and matching check scripts; additions within these categories with reasons are authorized; report each selection and reason. Final verification is run by Orchestrator, not QA. Use approved structural/consistency checks for policy/configuration.\n2. Run authorized tests and inspect output, but DO NOT edit source, documents, tests or configuration. DO NOT repair failures or broaden verification without authorization.\n3. Report every brief criterion by ID or original wording. Record method/scope, run status, accessible evidence, criterion verdict, unverified reason and remaining scope.\n4. Run status is passed, failed, not run or environment blocked. Verdict is proven, unmet or unverified. Passing alone proves no criterion; connect conditions/expected results to observations. Keep partial checks, out-of-scope criteria, missing checks and environment blocks unverified. Omit no criterion. PASS means run status only.\n5. Structural checks prove structural criteria only, not behavior, installation or live agent compliance. After a fix, rerun reproduction and invalidated checks; report the prior finding resolved, unresolved or unverified with evidence. Compare failures with the brief's baseline by test name; only new failures are findings. Rerun a suspected intermittent test alone, up to the brief's limit (default three), as diagnosis rather than retry; report passes-in-isolation and rerun count.\n6. Only with assigned UI criteria and a brief citation to installed ARC `references/verification.md`'s `UI browser acceptance checks`, read/follow that section before launching apps or using browser tools. Otherwise DO NOT launch apps/browsers for UI acceptance. Report missing citations/prerequisites and leave criteria unverified.\n7. Report exact commands, results, evidence, unresolved issues and limits. Separate failures from environment problems. Run approved checks and report only; DO NOT edit, repair, plan or decide acceptance."
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
"id": "reviewer.contract-intro",
|
|
@@ -87,11 +87,11 @@
|
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
"id": "reviewer.review-steps",
|
|
90
|
-
"text": "- Use goal, criteria, assigned diff/source scope and relevant QA evidence. Independently review only that scope for substantive correctness, factual accuracy and security.\n- Return actionable findings, relevant questions, next actions and workspace/path issues with file/page/source references. State when no substantive findings exist.\n- For acceptance-linked behavior findings, report criterion, expected behavior, observed problem, source, reproduction conditions/steps and evidence. Separate source inference from execution observation. DO NOT run QA tests to obtain observations.\n- Outside the final plan Reviewer exception, Orchestrator routes corrections to Implementer and post-fix QA. Continue reviewing structure/design/factual/security issues execution cannot settle.\n- For significant/high-risk work, review the final full change after required QA/focused checks and QA rechecks. QA owns functional/test verification; Orchestrator owns overall completion and acceptance.\n- DO NOT run QA, plan or decide acceptance. "
|
|
90
|
+
"text": "- Use goal, criteria, assigned diff/source scope and relevant QA evidence. Independently review only that scope for substantive correctness, factual accuracy and security.\n- Return actionable findings, relevant questions, next actions and workspace/path issues with file/page/source references. State when no substantive findings exist.\n- For acceptance-linked behavior findings, report criterion, expected behavior, observed problem, source, reproduction conditions/steps and evidence. Separate source inference from execution observation. DO NOT run QA tests to obtain observations.\n- Outside the final plan Reviewer exception, Orchestrator routes corrections to Implementer and post-fix QA. Continue reviewing structure/design/factual/security issues execution cannot settle.\n- For significant/high-risk work, review the final full change after required QA/focused checks and QA rechecks. QA owns task functional/test verification; Orchestrator runs final verification and owns overall completion and acceptance.\n- DO NOT run QA, plan or decide acceptance. "
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
"id": "reviewer.final-plan-findings",
|
|
94
|
-
"text": "Final overall Reviewer findings on plan work, including behavior findings, follow Implementer → Reviewer without QA reassignment until resolved, including repeat findings. Review the latest committed/uncommitted correction diff supplied by Orchestrator. Remain read-only. Earlier QA is not post-fix verification. Preserve required QA and QA failure rechecks before this final stage."
|
|
94
|
+
"text": "Final overall Reviewer findings on plan work, including behavior findings, follow Implementer → Reviewer without QA reassignment until resolved, including repeat findings. Review the latest committed/uncommitted correction diff supplied by Orchestrator. Remain read-only. Earlier QA is not post-fix verification. Preserve required QA and QA failure rechecks before this final stage. New failures from final verification follow Implementer → QA; affected evidence needs a refreshed-diff recheck."
|
|
95
95
|
},
|
|
96
96
|
{
|
|
97
97
|
"id": "scouter.research-brief",
|
|
@@ -19,6 +19,80 @@ const sameEntry = (first, second) => first.dev === second.dev && first.ino === s
|
|
|
19
19
|
const identityOf = ({dev, ino}) => ({dev, ino});
|
|
20
20
|
const sandboxEventsPath = grokHome => path.join(grokHome, 'sessions', 'sandbox-events.jsonl');
|
|
21
21
|
|
|
22
|
+
function parseConfigKeyPath(source) {
|
|
23
|
+
const segment = /\s*(?:"([^"\\]*)"|'([^'\\]*)'|([\w-]+))\s*/y;
|
|
24
|
+
const segments = [];
|
|
25
|
+
for (;;) {
|
|
26
|
+
const match = segment.exec(source);
|
|
27
|
+
if (!match) return null;
|
|
28
|
+
segments.push(match[1] ?? match[2] ?? match[3]);
|
|
29
|
+
if (source[segment.lastIndex] !== '.') return {segments, rest: source.slice(segment.lastIndex)};
|
|
30
|
+
segment.lastIndex += 1;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function isGrokSecurityPath(segments) {
|
|
35
|
+
return segments.includes('permission_mode') || (segments[0] === 'compat' && segments[1] === 'claude')
|
|
36
|
+
|| /^sandbox[\w-]*$/.test(segments[0]);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function arrayDepthAfterLine(value, depth) {
|
|
40
|
+
let quote = null;
|
|
41
|
+
for (let i = 0; i < value.length; i++) {
|
|
42
|
+
const char = value[i];
|
|
43
|
+
if (quote) {
|
|
44
|
+
if (quote === '"' && char === '\\') i += 1;
|
|
45
|
+
else if (char === quote) quote = null;
|
|
46
|
+
} else if (char === '"' || char === "'") {
|
|
47
|
+
quote = char;
|
|
48
|
+
} else if (char === '#') {
|
|
49
|
+
break;
|
|
50
|
+
} else if (char === '[') {
|
|
51
|
+
depth += 1;
|
|
52
|
+
} else if (char === ']') {
|
|
53
|
+
depth -= 1;
|
|
54
|
+
if (depth < 0) return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return quote ? null : depth;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function grokConfigSecurityProjection(bytes) {
|
|
61
|
+
let config;
|
|
62
|
+
try { config = new TextDecoder('utf-8', {fatal: true}).decode(bytes); } catch { return null; }
|
|
63
|
+
if (config.includes('"""') || config.includes("'''")) return null;
|
|
64
|
+
|
|
65
|
+
const lines = [];
|
|
66
|
+
let table = [];
|
|
67
|
+
let arrayDepth = 0, securityValue = false;
|
|
68
|
+
for (const raw of config.split('\n')) {
|
|
69
|
+
const line = raw.trim();
|
|
70
|
+
if (!line || line.startsWith('#')) continue;
|
|
71
|
+
if (arrayDepth > 0) {
|
|
72
|
+
arrayDepth = arrayDepthAfterLine(line, arrayDepth);
|
|
73
|
+
if (arrayDepth === null) return null;
|
|
74
|
+
if (securityValue) lines.push(`${table.join('.')}\t${line}`);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (line.startsWith('[')) {
|
|
78
|
+
const arrayTable = line.startsWith('[[');
|
|
79
|
+
const header = parseConfigKeyPath(line.slice(arrayTable ? 2 : 1));
|
|
80
|
+
const closing = arrayTable ? /^\]\]\s*(?:#.*)?$/ : /^\]\s*(?:#.*)?$/;
|
|
81
|
+
if (!header || !closing.test(header.rest)) return null;
|
|
82
|
+
table = header.segments;
|
|
83
|
+
if (isGrokSecurityPath(table)) lines.push(`${table.join('.')}\t${line}`);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const key = parseConfigKeyPath(line);
|
|
87
|
+
if (!key || !key.rest.startsWith('=')) return null;
|
|
88
|
+
arrayDepth = arrayDepthAfterLine(key.rest.slice(1), 0);
|
|
89
|
+
if (arrayDepth === null) return null;
|
|
90
|
+
securityValue = isGrokSecurityPath([...table, ...key.segments]);
|
|
91
|
+
if (securityValue) lines.push(`${table.join('.')}\t${line}`);
|
|
92
|
+
}
|
|
93
|
+
return arrayDepth === 0 ? lines.join('\n') : null;
|
|
94
|
+
}
|
|
95
|
+
|
|
22
96
|
export function grokSandboxProfileName(dispatchId) {
|
|
23
97
|
const prefix = typeof dispatchId === 'string' ? dispatchId.slice(0, 8) : '';
|
|
24
98
|
return /^[0-9a-f]{8}$/.test(prefix) ? 'arc-bridge-' + prefix : null;
|
|
@@ -6,7 +6,7 @@ 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 {readLease, writeLease, listLeases, readHostLimits, NON_TERMINAL_STATES, readHeartbeat, requestCancel, clearCancel, TERMINAL_STATES, validateLease} from './role-dispatch-store.mjs';
|
|
8
8
|
import {withRoutingLock, readActivation, readRevision, authenticate, resolveRuntimeHomes, locateAnchorHome, probeHomeWritable} from './role-routing.mjs';
|
|
9
|
-
import {SUPERVISOR_IMPLEMENTATIONS, startSupervisor, processAlive, resolveWorktree, artifactDirectory, segmentDirectory, buildBridgeInvocation} from './role-supervisor.mjs';
|
|
9
|
+
import {SUPERVISOR_IMPLEMENTATIONS, startSupervisor, processAlive, resolveWorktree, artifactDirectory, segmentDirectory, buildBridgeInvocation, reapRecordedDescendants} from './role-supervisor.mjs';
|
|
10
10
|
|
|
11
11
|
export const heldRoutingResult=(code,releaseCondition)=>({decision:'hold',routeStatus:'held',supportStatus:'unverified',route:null,executionEnvironment:null,hostPlatform:null,role:null,requested:null,authentication:null,reasons:[{code,releaseCondition}]});
|
|
12
12
|
|
|
@@ -233,6 +233,14 @@ export async function cancelRoleDispatch({context,dispatchId,now=Date.now(),poli
|
|
|
233
233
|
if(!killed&&Date.now()>=begin+graceMs){signalGroup(pid,'SIGKILL');killed=true;}
|
|
234
234
|
await sleep(25);gone=!groupExists(pid);
|
|
235
235
|
}
|
|
236
|
+
let escapes={};
|
|
237
|
+
if(!direct.lease.supervisor||!processAlive(direct.lease.supervisor)){
|
|
238
|
+
try{
|
|
239
|
+
const target=await resolveWorktree(context.cwd);
|
|
240
|
+
const directory=segmentDirectory(target,direct.lease.workflowId,dispatchId,direct.lease.segment??0);
|
|
241
|
+
escapes=await reapRecordedDescendants(directory,direct.lease,{graceMs});
|
|
242
|
+
}catch{/* A missing worktree does not change the group cancellation result. */}
|
|
243
|
+
}
|
|
236
244
|
if(!gone)result=view(direct.lease,'hold');
|
|
237
245
|
else{
|
|
238
246
|
try{
|
|
@@ -248,6 +256,7 @@ export async function cancelRoleDispatch({context,dispatchId,now=Date.now(),poli
|
|
|
248
256
|
else return hold(context,dispatchId,classifyLock(error),error);
|
|
249
257
|
}
|
|
250
258
|
}
|
|
259
|
+
if(result&&escapes.escapedDescendants)result={...result,...escapes};
|
|
251
260
|
}
|
|
252
261
|
if(residual)result.residualPaths=residual;
|
|
253
262
|
return result;
|
|
@@ -14,13 +14,15 @@ function deepFreeze(value) {
|
|
|
14
14
|
return Object.freeze(value);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
// Claude 2.1.
|
|
17
|
+
// Claude 2.1.327, 2026-11-20, T0 M-C10/M-C11/M-C12/FINAL
|
|
18
18
|
const RECORDED_CLAUDE_SANDBOX_SETTINGS = deepFreeze({
|
|
19
|
+
permissions: {deny: ['Edit(./.git/**)', 'Write(./.git/**)']},
|
|
19
20
|
sandbox: {
|
|
20
21
|
enabled: true,
|
|
21
22
|
autoAllowBashIfSandboxed: true,
|
|
22
23
|
allowUnsandboxedCommands: false,
|
|
23
24
|
failIfUnavailable: true,
|
|
25
|
+
filesystem: {denyWrite: ['./.git']},
|
|
24
26
|
},
|
|
25
27
|
});
|
|
26
28
|
const isRecordedObject = value => value !== null && typeof value === 'object' && !Array.isArray(value) && Object.keys(value).length > 0;
|
|
@@ -38,11 +40,15 @@ export const OBSERVE_MAX_WAIT_MS = 540000;
|
|
|
38
40
|
export const BRIEF_MAX_BYTES = 262144;
|
|
39
41
|
export const EVENTS_MAX_BYTES = 4194304;
|
|
40
42
|
export const CANCEL_GRACE_MS = 10000;
|
|
43
|
+
export const DESCENDANT_SAMPLE_MS = 1000;
|
|
44
|
+
export const DESCENDANT_LIMIT = 256;
|
|
41
45
|
export const LOCK_RETRY_MS = 2000;
|
|
42
46
|
export const LEASE_RETENTION_MS = 2592000000;
|
|
43
47
|
export const PROBE_TIMEOUT_MS = 10000;
|
|
44
48
|
|
|
45
49
|
export const DEFAULT_POLICY = Object.freeze({
|
|
50
|
+
descendantSampleMs: DESCENDANT_SAMPLE_MS,
|
|
51
|
+
descendantLimit: DESCENDANT_LIMIT,
|
|
46
52
|
gates: BRIDGE_GATE_RESULTS,
|
|
47
53
|
claudeSandboxSettings: CLAUDE_SANDBOX_SETTINGS,
|
|
48
54
|
codexDelegationCallNames: CODEX_DELEGATION_CALL_NAMES,
|