@yunhozz/arc 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MANIFEST.sha256 +45 -45
- package/README.md +3 -2
- package/claude/agents/arc-implementer.md +1 -0
- package/claude/agents/arc-planner.md +1 -0
- package/claude/agents/arc-qa.md +1 -0
- package/claude/agents/arc-reviewer.md +1 -0
- package/claude/agents/arc-scouter.md +1 -0
- package/claude/skill/SKILL.md +6 -3
- package/claude/skill/references/planning.md +36 -0
- package/codex/agents/arc-implementer.toml +1 -0
- package/codex/agents/arc-planner.toml +1 -0
- package/codex/agents/arc-qa.toml +1 -0
- package/codex/agents/arc-reviewer.toml +1 -0
- package/codex/agents/arc-scouter.toml +1 -0
- package/codex/skill/SKILL.md +6 -3
- package/codex/skill/references/planning.md +36 -0
- package/gemini/agents/arc-implementer.md +1 -0
- package/gemini/agents/arc-planner.md +1 -0
- package/gemini/agents/arc-qa.md +1 -0
- package/gemini/agents/arc-reviewer.md +1 -0
- package/gemini/agents/arc-scouter.md +1 -0
- package/gemini/skill/SKILL.md +6 -3
- package/gemini/skill/references/planning.md +36 -0
- package/grok/agents/arc-implementer.md +1 -0
- package/grok/agents/arc-planner.md +1 -0
- package/grok/agents/arc-qa.md +1 -0
- package/grok/agents/arc-reviewer.md +1 -0
- package/grok/agents/arc-scouter.md +1 -0
- package/grok/skill/SKILL.md +6 -3
- package/grok/skill/references/planning.md +36 -0
- package/lib/installer/global-config.mjs +8 -3
- package/lib/installer/language.mjs +54 -6
- package/lib/installer/plan.mjs +13 -11
- package/lib/installer/upgrade-state.mjs +10 -3
- package/lib/installer/upgrade.mjs +3 -3
- package/lib/management/operations.mjs +7 -4
- package/lib/management/status.mjs +22 -3
- package/lib/policy/placement.mjs +2 -2
- package/lib/policy/render.mjs +1 -1
- package/lib/policy/role-policy.json +26 -0
- package/lib/prompts/agent-fragments.json +1 -1
- package/lib/prompts/render.mjs +1 -1
- package/lib/tui/mode.mjs +15 -3
- package/lib/tui/setup.mjs +51 -34
- package/package.json +1 -1
- package/shared/skill/runtime/role-policy.json +26 -0
|
@@ -1,13 +1,61 @@
|
|
|
1
1
|
import {parseToml} from '../models/config.mjs';
|
|
2
2
|
const MARKER='{{ARC_OUTPUT_LANGUAGE_POLICY}}';
|
|
3
|
+
const RUN_MODE_MARKER = '{{ARC_RUN_MODE_POLICY}}';
|
|
4
|
+
export const RUN_MODES = Object.freeze(['supervised', 'full-auto']);
|
|
5
|
+
|
|
3
6
|
export function validateLanguage(language){if(!['en','ko'].includes(language))throw new Error(`Invalid language: ${language}`);return language;}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return{version:1,language:validateLanguage(data.language)};
|
|
7
|
+
|
|
8
|
+
export function validateRunMode(value) {
|
|
9
|
+
if (!RUN_MODES.includes(value)) throw new Error(`Invalid run mode: ${String(value)}`);
|
|
10
|
+
return value;
|
|
9
11
|
}
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
export function parseSettings(bytes) {
|
|
14
|
+
if (!Buffer.isBuffer(bytes)) throw new Error('Language settings must be bytes');
|
|
15
|
+
const data = parseToml(new TextDecoder('utf-8', {fatal: true, ignoreBOM: true}).decode(bytes));
|
|
16
|
+
const keyCount = Object.keys(data).length;
|
|
17
|
+
const isV1 = (data.version === 1 || data.version === 1n) && keyCount === 2;
|
|
18
|
+
const isV2 = (data.version === 2 || data.version === 2n) && keyCount === 3 && Object.hasOwn(data, 'run_mode');
|
|
19
|
+
if (!Object.hasOwn(data, 'version') || !Object.hasOwn(data, 'language') || (!isV1 && !isV2)) {
|
|
20
|
+
throw new Error('Invalid ARC settings schema or version');
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
version: isV1 ? 1 : 2,
|
|
24
|
+
language: validateLanguage(data.language),
|
|
25
|
+
runMode: isV1 ? 'supervised' : validateRunMode(data.run_mode),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function serializeSettings({language, runMode = 'supervised'}) {
|
|
30
|
+
const validatedLanguage = validateLanguage(language);
|
|
31
|
+
if (validateRunMode(runMode) === 'supervised') {
|
|
32
|
+
return Buffer.from(`version = 1\nlanguage = "${validatedLanguage}"\n`);
|
|
33
|
+
}
|
|
34
|
+
return Buffer.from(`version = 2\nlanguage = "${validatedLanguage}"\nrun_mode = "full-auto"\n`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function parseLanguage(bytes) {
|
|
38
|
+
const {version, language} = parseSettings(bytes);
|
|
39
|
+
return {version, language};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function serializeLanguage(language) {
|
|
43
|
+
return serializeSettings({language});
|
|
44
|
+
}
|
|
45
|
+
|
|
11
46
|
export function defaultLanguage(existing){return existing.length&&existing.every(value=>value===existing[0])&&existing[0]?validateLanguage(existing[0]):'en';}
|
|
12
47
|
export function languagePolicy(language){return `Use ${validateLanguage(language)==='ko'?'Korean':'English'} by default for user-facing responses, progress updates, reports, and document titles and prose, including designs, specs, and plans. An explicit user language request overrides this installed default. Preserve identifiers, skill/API names, code, paths, commands, and literal values exactly.`;}
|
|
13
48
|
export function renderLanguagePolicy(bytes,language){const text=new TextDecoder('utf-8',{fatal:true}).decode(bytes);if(text.split(MARKER).length!==2)throw new Error('Expected exactly one ARC output language policy marker');return Buffer.from(text.replace(MARKER,languagePolicy(language)));}
|
|
49
|
+
|
|
50
|
+
export function runModePolicy(runMode) {
|
|
51
|
+
if (validateRunMode(runMode) === 'supervised') {
|
|
52
|
+
return "**Run mode:** Supervised. Every approval and choice gate in this skill and its references requires the user's explicit answer; Orchestrator does not auto-decide gates.";
|
|
53
|
+
}
|
|
54
|
+
return "**Run mode:** Full Auto. Orchestrator decides the gates listed in [planning](references/planning.md#full-auto-run-mode) itself: it completes that gate's required checks first, then chooses the recommended option; without a recommendation and supporting evidence, it asks the user. New product decisions outside the original request, external actions, failures, partial completion, holds, unknown state, ownership conflicts, preservation-rule Git actions, permission or sandbox approvals, and unknown slots or exhausted capacity still go to the user. Plan depth, local commit rules, QA, Reviewer and acceptance are unchanged. Record each decision as `auto-decided (Full Auto): <gate> → <choice>; reason; alternatives; evidence` in a user-visible progress message and in the canonical handoff record. If the user asks in this chat to stop auto-deciding or to use Supervised, apply Supervised from the next gate; this overrides the installed default, and earlier auto-decisions stay recorded.";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function renderRunModePolicy(bytes, runMode) {
|
|
58
|
+
const text = new TextDecoder('utf-8', {fatal: true}).decode(bytes);
|
|
59
|
+
if (text.split(RUN_MODE_MARKER).length !== 2) throw new Error('Expected exactly one ARC run mode policy marker');
|
|
60
|
+
return Buffer.from(text.replace(RUN_MODE_MARKER, runModePolicy(runMode)));
|
|
61
|
+
}
|
package/lib/installer/plan.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {installerRegistryOf} from '../platforms/index.mjs';
|
|
|
3
3
|
import {renderAgentProfile} from '../prompts/render.mjs';
|
|
4
4
|
import {PayloadValidationError} from './manifest.mjs';
|
|
5
5
|
import {composeSkillSources} from './skill-sources.mjs';
|
|
6
|
-
import{
|
|
6
|
+
import{parseSettings,serializeSettings,renderLanguagePolicy,renderRunModePolicy,validateLanguage,validateRunMode}from'./language.mjs';
|
|
7
7
|
import{resolveLimits}from'../limits.mjs';import{parseLimits,serializeLimits}from'./limits.mjs';import{assertPlanSnapshot}from'./transaction.mjs';
|
|
8
8
|
import{validateModelConfig}from'../models/config.mjs';
|
|
9
9
|
import{assertCatalogRoles}from'../models/catalog.mjs';
|
|
@@ -18,8 +18,8 @@ export function previewLimits({target,safeFs}){
|
|
|
18
18
|
export function previewLanguage({target,safeFs}){
|
|
19
19
|
const snapshot=new Map(),filename=path.join(target.home,'skills/arc/settings.toml');
|
|
20
20
|
const current=inspectPath(safeFs,filename,{kind:'file',read:true,snapshot});
|
|
21
|
-
let
|
|
22
|
-
return{existing,snapshot};
|
|
21
|
+
let settings;try{if(current.exists)settings=parseSettings(current.bytes);}catch(cause){fail(`Invalid ARC language settings: ${cause.message}`);}
|
|
22
|
+
return{existing:settings?.language??null,existingRunMode:settings?.runMode??null,snapshot};
|
|
23
23
|
}
|
|
24
24
|
function renderModelAssets({payload,target,roles,modelConfig,language,verifiedCatalog,platforms,runtimePlatforms}){
|
|
25
25
|
const input=payload.modelInputs[target.platform];if(!input)fail('Selected payload platform is unavailable');
|
|
@@ -30,12 +30,13 @@ function renderModelAssets({payload,target,roles,modelConfig,language,verifiedCa
|
|
|
30
30
|
return{profiles,modelBytes};
|
|
31
31
|
}
|
|
32
32
|
export function renderStandaloneProfiles({payload,target,modelConfig,language,platforms,runtimePlatforms}){return renderModelAssets({payload,target,modelConfig,language,platforms,runtimePlatforms}).profiles;}
|
|
33
|
-
function renderSkillPayload({payload,target,language,modelBytes,limits,platforms}){
|
|
33
|
+
function renderSkillPayload({payload,target,language,runMode,modelBytes,limits,platforms}){
|
|
34
34
|
let skill;try{skill=composeSkillSources(payload.files,target.platform,{platforms});}catch(cause){throw new PayloadValidationError(`Payload skill composition failed: ${cause.message}`,{cause});}
|
|
35
|
-
skill.set('SKILL.md',renderLanguagePolicy(skill.get('SKILL.md'),language)
|
|
35
|
+
skill.set('SKILL.md',renderRunModePolicy(renderLanguagePolicy(skill.get('SKILL.md'),language),runMode));
|
|
36
|
+
skill.set('settings.toml',serializeSettings({language,runMode}));skill.set('models.toml',modelBytes);skill.set('limits.toml',serializeLimits(limits));
|
|
36
37
|
return skill;
|
|
37
38
|
}
|
|
38
|
-
function renderNativeChanges({target,safeFs,snapshot,skipGlobal,preview,concurrentExplicit,limits,summary,language,platforms}){
|
|
39
|
+
function renderNativeChanges({target,safeFs,snapshot,skipGlobal,preview,concurrentExplicit,limits,summary,language,runMode,platforms}){
|
|
39
40
|
const home=target.home;
|
|
40
41
|
const globalChanges=[];
|
|
41
42
|
if(limits.max_concurrent_subagents>limits.max_total_subagents)summary.push(`Effective concurrency is at most ${limits.max_total_subagents} for a fresh ARC session; it may be lower after cumulative use or due to native capacity.`);
|
|
@@ -45,7 +46,7 @@ function renderNativeChanges({target,safeFs,snapshot,skipGlobal,preview,concurre
|
|
|
45
46
|
if(filename!==target.instructionPath&&!runtimeConfig.renderConcurrency&&typeof runtimeConfig.globalRender!=='function')continue;
|
|
46
47
|
const current=inspectPath(safeFs,filename,{kind:'file',read:true,snapshot}),original=current.bytes??null;
|
|
47
48
|
let rendered;
|
|
48
|
-
if(filename===target.instructionPath)rendered=renderManagedBlock(original,agentsBlockBody(home,target.userHome,language,target.platform));
|
|
49
|
+
if(filename===target.instructionPath)rendered=renderManagedBlock(original,agentsBlockBody(home,target.userHome,language,target.platform,runMode));
|
|
49
50
|
else{
|
|
50
51
|
if(typeof runtimeConfig.globalRender==='function'){
|
|
51
52
|
try{rendered=runtimeConfig.globalRender(original);}catch(cause){fail(`Cannot update ${filename}: ${cause.message}; fix it or use --skip-global`);}
|
|
@@ -62,17 +63,18 @@ function renderNativeChanges({target,safeFs,snapshot,skipGlobal,preview,concurre
|
|
|
62
63
|
}
|
|
63
64
|
return globalChanges;
|
|
64
65
|
}
|
|
65
|
-
export function buildInstallPlan({payload,target,roles,profiles:profileMode='write',skipGlobal=false,safeFs,limits,concurrentExplicit=false,limitsPreview,language='en',languagePreview,modelConfig,verifiedCatalog,platforms,runtimePlatforms}){
|
|
66
|
+
export function buildInstallPlan({payload,target,roles,profiles:profileMode='write',skipGlobal=false,safeFs,limits,concurrentExplicit=false,limitsPreview,language='en',languagePreview,runMode,modelConfig,verifiedCatalog,platforms,runtimePlatforms}){
|
|
66
67
|
validateLanguage(language);
|
|
67
68
|
if(languagePreview)assertPlanSnapshot({snapshot:languagePreview.snapshot},{safeFs});
|
|
68
69
|
const languageState=languagePreview??previewLanguage({target,safeFs});
|
|
70
|
+
runMode=runMode!==undefined?validateRunMode(runMode):languageState.existingRunMode??'supervised';
|
|
69
71
|
if(limitsPreview)assertPlanSnapshot({snapshot:limitsPreview.snapshot},{safeFs});
|
|
70
72
|
const preview=limitsPreview??previewLimits({target,safeFs});
|
|
71
73
|
limits=resolveLimits({existing:preview.existing,overrides:limits??{}});
|
|
72
74
|
const modelSnapshot=new Map();
|
|
73
75
|
if(modelConfig===undefined&&roles===undefined){const installed=inspectPath(safeFs,path.join(target.home,'skills/arc/models.toml'),{kind:'file',read:true,snapshot:modelSnapshot});if(installed.exists)modelConfig=loadModelConfig(installed.bytes,target.platform,{runtimePlatforms});}
|
|
74
76
|
const {profiles,modelBytes}=renderModelAssets({payload,target,roles,modelConfig,language,verifiedCatalog,platforms,runtimePlatforms});
|
|
75
|
-
const skill=renderSkillPayload({payload,target,language,modelBytes,limits,platforms});
|
|
77
|
+
const skill=renderSkillPayload({payload,target,language,runMode,modelBytes,limits,platforms});
|
|
76
78
|
const snapshot=new Map(),home=target.home;const skills=path.join(home,'skills'),agents=path.join(home,'agents'),arc=path.join(skills,'arc');
|
|
77
79
|
for(const name of [home,skills,agents])inspectPath(safeFs,name,{kind:'directory',snapshot});
|
|
78
80
|
inspectPath(safeFs,arc,{kind:'directory',tree:true,allowLinks:true,snapshot});
|
|
@@ -80,13 +82,13 @@ export function buildInstallPlan({payload,target,roles,profiles:profileMode='wri
|
|
|
80
82
|
if(profileMode!=='omit')for(const [name,bytes]of profiles){const found=inspectStandaloneProfile({safeFs,target,role:name.split('.')[0].replace('-','_'),snapshot,platforms});if(found.exists&&!found.owned){residualPaths.push(found.path);continue;}profilePaths.push(found.path);profileWrites.set(name,bytes);}
|
|
81
83
|
const externalPaths=[],summary=['Verified packaged Superpowers references will be installed inside ARC'];
|
|
82
84
|
summary.push(`ARC limits: total ${limits.max_total_subagents}; concurrent ${limits.max_concurrent_subagents} (policy: ${arc}/limits.toml)`);
|
|
83
|
-
const globalChanges=renderNativeChanges({target,safeFs,snapshot,skipGlobal,preview,concurrentExplicit,limits,summary,language,platforms});
|
|
85
|
+
const globalChanges=renderNativeChanges({target,safeFs,snapshot,skipGlobal,preview,concurrentExplicit,limits,summary,language,runMode,platforms});
|
|
84
86
|
const managedPaths=[arc,...profilePaths,...globalChanges.map(change=>change.path)];
|
|
85
87
|
for(const [filename,metadata]of preview.snapshot)snapshot.set(filename,metadata);
|
|
86
88
|
for(const [filename,metadata]of languageState.snapshot)snapshot.set(filename,metadata);
|
|
87
89
|
summary.push(`ARC output language: ${language}`);
|
|
88
90
|
for(const item of modelSnapshot)snapshot.set(...item);
|
|
89
|
-
const plan={target,language,roles,skipGlobal,limits,concurrentExplicit,profileWrites,residualPaths,generated:{models:modelBytes,profiles,skill},globalChanges,managedPaths,externalPaths,snapshot,summary};validatePlanSet([plan]);return plan;
|
|
91
|
+
const plan={target,language,runMode,roles,skipGlobal,limits,concurrentExplicit,profileWrites,residualPaths,generated:{models:modelBytes,profiles,skill},globalChanges,managedPaths,externalPaths,snapshot,summary};validatePlanSet([plan]);return plan;
|
|
90
92
|
}
|
|
91
93
|
function overlaps(a,b){return a===b||a.startsWith(b+'/')||b.startsWith(a+'/');}
|
|
92
94
|
export function validatePlanSet(plans){
|
|
@@ -4,7 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import {createHash} from 'node:crypto';
|
|
5
5
|
import {resolveTargets,inspectPath,TargetConfigurationError} from './targets.mjs';
|
|
6
6
|
import {loadModelConfig} from '../models/index.mjs';
|
|
7
|
-
import {
|
|
7
|
+
import {parseSettings} from './language.mjs';
|
|
8
8
|
import {parseLimits} from './limits.mjs';
|
|
9
9
|
import {removeManagedBlock} from './global-config.mjs';
|
|
10
10
|
import {removeShellCompletion} from './shell-completion.mjs';
|
|
@@ -24,14 +24,21 @@ export function collectInstalledState({safeFs,userHome,env={},cwd,platforms,runt
|
|
|
24
24
|
if(!skill.exists){if(profiles.some(item=>item.exists&&item.owned)||managed.changed)fail(`Incomplete ARC installation: ${target.home}`);residualPaths.push(...profiles.filter(item=>item.exists&&!item.owned).map(item=>item.path));continue;}
|
|
25
25
|
function mandatory(name){const found=inspectPath(safeFs,path.join(arc,name),{kind:'file',read:true,snapshot});if(!found.exists||!found.bytes.length)fail(`Incomplete ARC installation: missing ${name} at ${target.home}`);return found.bytes;}
|
|
26
26
|
mandatory('SKILL.md');if(profiles.some(item=>!item.exists))fail(`Incomplete ARC installation: missing profile at ${target.home}`);
|
|
27
|
-
let language,
|
|
27
|
+
let language,runMode,modelConfig,limits;
|
|
28
|
+
try{
|
|
29
|
+
const parsed=parseSettings(mandatory('settings.toml'));
|
|
30
|
+
language=parsed.language;
|
|
31
|
+
runMode=parsed.runMode;
|
|
32
|
+
modelConfig=loadModelConfig(mandatory('models.toml'),platform,{runtimePlatforms});
|
|
33
|
+
limits=parseLimits(mandatory('limits.toml'));
|
|
34
|
+
}catch(cause){throw new TargetConfigurationError(`Invalid installed ARC settings at ${target.home}: ${cause.message}`,{cause});}
|
|
28
35
|
const runtimeConfig=registry.getPlatform(platform).runtimeConfig;
|
|
29
36
|
if(typeof runtimeConfig.readConcurrency==='function'){const native=inspectPath(safeFs,target.runtimeConfigPath,{kind:'file',read:true,snapshot});if(native.exists)try{runtimeConfig.readConcurrency(native.bytes);}catch(cause){throw new TargetConfigurationError(`Invalid native configuration at ${target.runtimeConfigPath}: ${cause.message}`,{cause});}}
|
|
30
37
|
const shell=inspectPath(safeFs,path.join(userHome,'.zshrc'),{kind:'file',read:true,snapshot});if(shell.exists)removeShellCompletion(shell.bytes);
|
|
31
38
|
const modeKeys=new Set();
|
|
32
39
|
if(mode==='composite')for(const [filename,value]of modeSnapshot)if(value){snapshot.set(filename,value);modeKeys.add(filename);}
|
|
33
40
|
for(const [filename,value]of snapshot)if(!value)snapshot.delete(filename);
|
|
34
|
-
targets.push({target,language,modelConfig,limits,snapshot,modeKeys,residualPaths:profiles.filter(item=>item.exists&&!item.owned).map(item=>item.path)});
|
|
41
|
+
targets.push({target,language,runMode,modelConfig,limits,snapshot,modeKeys,residualPaths:profiles.filter(item=>item.exists&&!item.owned).map(item=>item.path)});
|
|
35
42
|
}
|
|
36
43
|
const hash=createHash('sha256');for(const entry of targets){hash.update(entry.target.platform+'\0'+entry.target.home+'\0');for(const [name,value]of [...entry.snapshot].sort(([a],[b])=>a.localeCompare(b)))hash.update(JSON.stringify([name,value],(key,value)=>key==='atimeNs'?undefined:typeof value==='bigint'?value.toString():value));}
|
|
37
44
|
return{targets,mode,platforms:installation.platforms,registry,residualPaths,stateToken:hash.digest('hex')};
|
|
@@ -12,11 +12,11 @@ export function buildUpgradePlans({payload,state,safeFs,registry=state.registry}
|
|
|
12
12
|
const platforms=installerRegistryOf({platforms:registry}),runtimePlatforms=createPlatformRegistry(platforms.byAnchorOrder().map(descriptor=>descriptor.runtime));
|
|
13
13
|
for(const entry of state.targets)assertPlanSnapshot(entry,{safeFs});
|
|
14
14
|
const plans=state.targets.map(entry=>{
|
|
15
|
-
const {target,language,modelConfig,limits}=entry;
|
|
16
|
-
const plan=buildInstallPlan({payload,target,profiles:state.mode==='composite'&&state.platforms.includes(target.platform)?'omit':'write',language,modelConfig,limits,skipGlobal:true,safeFs,platforms,runtimePlatforms});
|
|
15
|
+
const {target,language,runMode,modelConfig,limits}=entry;
|
|
16
|
+
const plan=buildInstallPlan({payload,target,profiles:state.mode==='composite'&&state.platforms.includes(target.platform)?'omit':'write',language,runMode,modelConfig,limits,skipGlobal:true,safeFs,platforms,runtimePlatforms});
|
|
17
17
|
for(const [name,value]of entry.snapshot)plan.snapshot.set(name,value);
|
|
18
18
|
const current=inspectPath(safeFs,target.instructionPath,{kind:'file',read:true,snapshot:plan.snapshot});
|
|
19
|
-
if(current.exists&&removeManagedBlock(current.bytes).changed){const rendered=renderManagedBlock(current.bytes,agentsBlockBody(target.home,target.userHome,language,target.platform));plan.managedPaths.push(target.instructionPath);if(!rendered.content.equals(current.bytes))plan.globalChanges.push({path:target.instructionPath,original:current.bytes,...rendered});}
|
|
19
|
+
if(current.exists&&removeManagedBlock(current.bytes).changed){const rendered=renderManagedBlock(current.bytes,agentsBlockBody(target.home,target.userHome,language,target.platform,runMode));plan.managedPaths.push(target.instructionPath);if(!rendered.content.equals(current.bytes))plan.globalChanges.push({path:target.instructionPath,original:current.bytes,...rendered});}
|
|
20
20
|
return plan;
|
|
21
21
|
});
|
|
22
22
|
const writePaths=plans.map(plan=>new Set(plan.managedPaths));
|
|
@@ -21,7 +21,7 @@ import {prepareCompositeFiles,publishCompositeFiles,readCompositeRoutingConfig,p
|
|
|
21
21
|
import {inspectPath,sameObjectIdentity,TargetConfigurationError} from '../installer/targets.mjs';
|
|
22
22
|
import {assertPlanSnapshot} from '../installer/transaction.mjs';
|
|
23
23
|
import {acquireRoleRoutingLock} from '../runtime/role-routing.mjs';
|
|
24
|
-
import {
|
|
24
|
+
import {parseSettings} from '../installer/language.mjs';
|
|
25
25
|
import path from 'node:path';
|
|
26
26
|
/** @typedef {{packageRoot:string,userHome:string,cwd:string,env:object,safeFs:object,signal?:AbortSignal}} ManagementContext */
|
|
27
27
|
/** @typedef {{kind:string,plans:object[],options:object}} PreparedOperation */
|
|
@@ -50,7 +50,7 @@ export async function prepareOperation(context,options,{selections=[]}={}){
|
|
|
50
50
|
if(options.kind==='uninstall')options={...options,removeCli:options.removeCli!==false};
|
|
51
51
|
let compositeActivePath,compositeUninstallAnchor;if(options.kind==='uninstall'){const mode=readInstallMode(modeOptions),anchor=mode.mode==='composite'?mode.anchor:registry.byAnchorOrder().find(descriptor=>targets[descriptor.runtime.id])?.runtime.id;if(anchor)compositeActivePath=path.join(targets[anchor].home,'arc-role-platform-routing.json');if(mode.mode==='composite')compositeUninstallAnchor=anchor;}
|
|
52
52
|
const platforms=platformOrder.filter(platform=>!skipped.some(item=>item.platform===platform)),payload=options.kind==='install'?verifyPayload(context):null;
|
|
53
|
-
const plans=platforms.map(platform=>{const target=resolveTarget(platform,context),selection=selections.find(item=>item.target.platform===platform&&item.target.home===target.home);if(options.kind==='preset')return buildPresetPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,loadPayload:()=>verifyPayload(context),target,roles:options.roles,safeFs:context.safeFs,verifiedCatalog:options.verifiedCatalog});if(options.kind==='uninstall')return buildUninstallPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,target,safeFs:context.safeFs,skipGlobal:options.skipGlobal,removeCompletion:options.removeCli!==false,compositeActivePath});return buildInstallPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,payload,target,limitsPreview:selection?.preview,languagePreview:selection?.languagePreview,roles:options.roles,verifiedCatalog:options.verifiedCatalog,language:options.language,skipGlobal:options.skipGlobal,safeFs:context.safeFs,limits:{...(options.maxTotalSubagents===undefined?{}:{max_total_subagents:options.maxTotalSubagents}),...(options.maxConcurrentSubagents===undefined?{}:{max_concurrent_subagents:options.maxConcurrentSubagents})},concurrentExplicit:options.maxConcurrentSubagents!==undefined||Boolean(options.concurrentSelected)});});
|
|
53
|
+
const plans=platforms.map(platform=>{const target=resolveTarget(platform,context),selection=selections.find(item=>item.target.platform===platform&&item.target.home===target.home);if(options.kind==='preset')return buildPresetPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,loadPayload:()=>verifyPayload(context),target,roles:options.roles,safeFs:context.safeFs,verifiedCatalog:options.verifiedCatalog});if(options.kind==='uninstall')return buildUninstallPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,target,safeFs:context.safeFs,skipGlobal:options.skipGlobal,removeCompletion:options.removeCli!==false,compositeActivePath});return buildInstallPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,payload,target,limitsPreview:selection?.preview,languagePreview:selection?.languagePreview,roles:options.roles,verifiedCatalog:options.verifiedCatalog,language:options.language,runMode:options.runMode,skipGlobal:options.skipGlobal,safeFs:context.safeFs,limits:{...(options.maxTotalSubagents===undefined?{}:{max_total_subagents:options.maxTotalSubagents}),...(options.maxConcurrentSubagents===undefined?{}:{max_concurrent_subagents:options.maxConcurrentSubagents})},concurrentExplicit:options.maxConcurrentSubagents!==undefined||Boolean(options.concurrentSelected)});});
|
|
54
54
|
// Retain the active config until every other uninstall snapshot has read it.
|
|
55
55
|
if(compositeUninstallAnchor&&options.target==='all')plans.sort((a,b)=>Number(a.target.platform===compositeUninstallAnchor)-Number(b.target.platform===compositeUninstallAnchor));
|
|
56
56
|
if(options.kind==='install')attachShellCompletionCleanup(plans,context);
|
|
@@ -96,8 +96,11 @@ export async function prepareCompositeOperation(context,options){
|
|
|
96
96
|
const payload=verifyPayload(context);
|
|
97
97
|
for(const platform of platforms){
|
|
98
98
|
const target=targets[platform],status=statuses.find(item=>item.platform===platform),existing=new Map(),modelFile=inspectPath(context.safeFs,path.join(target.home,'skills/arc/models.toml'),{kind:'file',read:true,snapshot:existing}),languageFile=inspectPath(context.safeFs,path.join(target.home,'skills/arc/settings.toml'),{kind:'file',read:true,snapshot:existing});
|
|
99
|
-
const modelConfig=loadModelConfig(modelFile.exists?modelFile.bytes:payload.modelInputs[platform].models,platform,context)
|
|
100
|
-
const
|
|
99
|
+
const modelConfig=loadModelConfig(modelFile.exists?modelFile.bytes:payload.modelInputs[platform].models,platform,context);
|
|
100
|
+
const parsed=languageFile.exists?parseSettings(languageFile.bytes):null;
|
|
101
|
+
const language=options.settings?.language??parsed?.language??'en';
|
|
102
|
+
const runMode=options.settings?.runMode??parsed?.runMode??'supervised';
|
|
103
|
+
const plan=buildInstallPlan({platforms:registry,runtimePlatforms:context.runtimePlatforms,payload,target,profiles:mode.mode==='composite'&&mode.platforms.includes(platform)?'omit':'write',modelConfig,language,runMode,safeFs:context.safeFs,limits:{...(options.settings?.maxTotalSubagents===undefined?{}:{max_total_subagents:options.settings.maxTotalSubagents}),...(options.settings?.maxConcurrentSubagents===undefined?{}:{max_concurrent_subagents:options.settings.maxConcurrentSubagents})},skipGlobal:options.settings?.skipGlobal??false,concurrentExplicit:Boolean(options.settings?.concurrentSelected)||options.settings?.maxConcurrentSubagents!==undefined});assertPlanSnapshot({snapshot:existing},{safeFs:context.safeFs});
|
|
101
104
|
plans.push(plan);profileInputs[platform]=plan.generated.profiles;modelConfigs[platform]=modelConfig;
|
|
102
105
|
}
|
|
103
106
|
attachShellCompletionCleanup(plans,context);validatePlanSet(plans);
|
|
@@ -2,7 +2,7 @@ import {readInstallMode,inspectStandaloneProfile} from '../installer/install-mod
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import {resolveTarget,resolveTargets,inspectPath} from '../installer/targets.mjs';
|
|
4
4
|
import {installerRegistryOf} from '../platforms/index.mjs';
|
|
5
|
-
import {
|
|
5
|
+
import {parseSettings} from '../installer/language.mjs';
|
|
6
6
|
import {parseLimits} from '../installer/limits.mjs';
|
|
7
7
|
import {loadModelConfig} from '../models/index.mjs';
|
|
8
8
|
import {removeManagedBlock} from '../installer/global-config.mjs';
|
|
@@ -14,9 +14,28 @@ export async function collectStatus(context,{codexCheck='refresh'}={}){const reg
|
|
|
14
14
|
if(!skill.exists&&!profiles.some(x=>x.exists&&x.owned)&&!managed)return{platform,target,state:'absent',residualPaths:profiles.filter(x=>x.exists&&!x.owned).map(x=>x.path),diagnostics:[]};
|
|
15
15
|
const mandatory=name=>{const found=read(path.join(arc,name));if(!found.exists||!found.bytes.length)throw Error(`Incomplete ARC installation: missing ${name} at ${target.home}`);return found.bytes;};
|
|
16
16
|
mandatory('SKILL.md');if(profiles.some(x=>!x.exists))throw Error(`Incomplete ARC installation: missing profile at ${target.home}`);
|
|
17
|
-
const
|
|
17
|
+
const {language,runMode}=parseSettings(mandatory('settings.toml'));
|
|
18
|
+
const settings={language,runMode,modelConfig:loadModelConfig(mandatory('models.toml'),platform,context),limits:parseLimits(mandatory('limits.toml'))},runtimeConfig=registry.getPlatform(platform).runtimeConfig;if(typeof runtimeConfig.readConcurrency==='function'){const native=read(target.runtimeConfigPath);if(native.exists)runtimeConfig.readConcurrency(native.bytes);}const shell=read(path.join(context.userHome,'.zshrc'));if(shell.exists)removeShellCompletion(shell.bytes);
|
|
18
19
|
return{platform,target,state:'installed',settings,snapshot,residualPaths:profiles.filter(x=>x.exists&&!x.owned).map(x=>x.path),diagnostics:[]};
|
|
19
|
-
}catch(error){
|
|
20
|
+
}catch(error){
|
|
21
|
+
const status={platform,target,state:'incomplete',diagnostics:[error]};
|
|
22
|
+
if(!target)return status;
|
|
23
|
+
const arc=path.join(target.home,'skills/arc');
|
|
24
|
+
const read=name=>inspectPath(context.safeFs,path.join(arc,name),{kind:'file',read:true});
|
|
25
|
+
const settings={};
|
|
26
|
+
try{
|
|
27
|
+
const found=read('settings.toml');
|
|
28
|
+
if(found.exists){
|
|
29
|
+
const {language,runMode}=parseSettings(found.bytes);
|
|
30
|
+
Object.assign(settings,{language,runMode});
|
|
31
|
+
}
|
|
32
|
+
}catch{}
|
|
33
|
+
try{
|
|
34
|
+
const found=read('limits.toml');
|
|
35
|
+
if(found.exists)settings.limits=parseLimits(found.bytes);
|
|
36
|
+
}catch{}
|
|
37
|
+
return Object.keys(settings).length?{...status,settings}:status;
|
|
38
|
+
}
|
|
20
39
|
});return Promise.all(statuses.map(async status=>{
|
|
21
40
|
const runtime=registry.getPlatform(status.platform).runtime;
|
|
22
41
|
if(runtime.capabilities.install.state!=='verified')return{...status,cliVersion:{version:null,reason:'capability_not_verified'},authentication:{authStatus:'unknown',reason:'capability_not_verified'}};
|
package/lib/policy/placement.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Instruction placement only; runtime policy and role authority remain canonical.
|
|
2
2
|
const reviews = ['review.significant-no-plan', 'review.significant-plan', 'review.final-plan-recheck'];
|
|
3
3
|
export const POLICY_PROJECTIONS = Object.freeze(Object.fromEntries(Object.entries({
|
|
4
|
-
core: ['scope.non-escalation', 'external.explicit-user-authority', 'role.orchestrator-boundary'],
|
|
4
|
+
core: ['scope.non-escalation', 'external.explicit-user-authority', 'approval.run-mode', 'role.orchestrator-boundary'],
|
|
5
5
|
assignment: ['git.specialists-deny', 'role.scouter-read-only', 'role.planner-draft-only', 'role.implementer-implementation', 'role.qa-verification', 'role.reviewer-independent'],
|
|
6
|
-
planning: ['git.orchestrator-accept-commit', ...reviews, 'planning.plan-revision', 'planning.planner-brief'],
|
|
6
|
+
planning: ['git.orchestrator-accept-commit', ...reviews, 'planning.plan-revision', 'planning.planner-brief', 'approval.run-mode'],
|
|
7
7
|
handoff: ['git.specialists-deny', 'role.implementer-implementation', ...reviews],
|
|
8
8
|
preparation: ['scope.non-escalation', 'git.specialists-deny', 'git.orchestrator-accept-commit', 'external.explicit-user-authority', 'planning.plan-revision'],
|
|
9
9
|
verification: ['git.orchestrator-accept-commit', ...reviews, 'planning.plan-revision'],
|
package/lib/policy/render.mjs
CHANGED
|
@@ -20,7 +20,7 @@ export function validateRolePolicy(input) {
|
|
|
20
20
|
if (!strings(rule.roles) || rule.roles.some(x=>!ROLES.includes(x)) || !['allow','deny','require'].includes(rule.effect) || !strings(rule.operations) || !strings(rule.evidence) || !['user','orchestrator'].includes(rule.authority) || typeof rule.text !== 'string' || !rule.text || /[\r\n]/.test(rule.text)) fail(`invalid rule ${rule.id}`);
|
|
21
21
|
if (!object(rule.controls) || !same(Object.keys(rule.controls).sort(),[...platformIds()].sort()) || Object.values(rule.controls).some(x=>!CONTROLS.includes(x))) fail(`invalid control level for ${rule.id}`);
|
|
22
22
|
}
|
|
23
|
-
for (const id of ['scope.non-escalation','git.specialists-deny','git.orchestrator-accept-commit','external.explicit-user-authority',...ROLES.map(x=>({orchestrator:'role.orchestrator-boundary',scouter:'role.scouter-read-only',planner:'role.planner-draft-only',implementer:'role.implementer-implementation',qa:'role.qa-verification',reviewer:'role.reviewer-independent'})[x]),'review.significant-no-plan','review.significant-plan','review.final-plan-recheck']) if(!ids.has(id)) fail(`missing required rule ${id}`);
|
|
23
|
+
for (const id of ['scope.non-escalation','git.specialists-deny','git.orchestrator-accept-commit','external.explicit-user-authority','approval.run-mode',...ROLES.map(x=>({orchestrator:'role.orchestrator-boundary',scouter:'role.scouter-read-only',planner:'role.planner-draft-only',implementer:'role.implementer-implementation',qa:'role.qa-verification',reviewer:'role.reviewer-independent'})[x]),'review.significant-no-plan','review.significant-plan','review.final-plan-recheck']) if(!ids.has(id)) fail(`missing required rule ${id}`);
|
|
24
24
|
for (const platform of POLICY_PLATFORMS) if (!object(input.platforms?.[platform]) || !CONTROLS.includes(input.platforms[platform].level) || typeof input.platforms[platform].notice !== 'string' || !input.platforms[platform].notice) fail(`invalid ${platform} controls`);
|
|
25
25
|
// These are workflow invariants, not customizable scheduling options.
|
|
26
26
|
const routes = {noPlan:['implementer','qa','reviewer','orchestrator-accept'],planTask:['implementer','fresh-qa','orchestrator-accept','orchestrator-commit'],planFinal:['required-qa','reviewer'],planFinding:['implementer','reviewer']};
|
|
@@ -146,6 +146,32 @@
|
|
|
146
146
|
"grok": "prompt"
|
|
147
147
|
}
|
|
148
148
|
},
|
|
149
|
+
{
|
|
150
|
+
"id": "approval.run-mode",
|
|
151
|
+
"roles": [
|
|
152
|
+
"orchestrator",
|
|
153
|
+
"scouter",
|
|
154
|
+
"planner",
|
|
155
|
+
"implementer",
|
|
156
|
+
"qa",
|
|
157
|
+
"reviewer"
|
|
158
|
+
],
|
|
159
|
+
"effect": "require",
|
|
160
|
+
"operations": [
|
|
161
|
+
"gate-decision"
|
|
162
|
+
],
|
|
163
|
+
"evidence": [
|
|
164
|
+
"user-choice-or-recorded-full-auto-decision"
|
|
165
|
+
],
|
|
166
|
+
"authority": "user",
|
|
167
|
+
"text": "The installed ARC Run mode is Supervised unless the installed skill states Full Auto. In Full Auto, an Orchestrator decision recorded as `auto-decided (Full Auto)` with gate, choice, reason and evidence counts as the explicit choice or approval for that listed gate only; briefs cite it as `full-auto:<doc>@<version>` or the recorded decision. It never authorizes new product decisions outside the original request, external actions, resolution of failures, holds, unknown state or ownership conflicts, preservation-rule Git actions, permission or sandbox changes, or unknown slots and exhausted capacity, and it changes no plan-depth, commit, QA, Reviewer or acceptance rule. A user request to stop or use Supervised applies from the next gate.",
|
|
168
|
+
"controls": {
|
|
169
|
+
"codex": "prompt",
|
|
170
|
+
"claude": "prompt",
|
|
171
|
+
"gemini": "prompt",
|
|
172
|
+
"grok": "prompt"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
149
175
|
{
|
|
150
176
|
"id": "role.orchestrator-boundary",
|
|
151
177
|
"roles": [
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
"id": "common.preservation-choice-inspection",
|
|
14
|
-
"text": "- **Preservation rule:** Preserve unrelated staged, unstaged and untracked changes and edit ownership. NEVER automatically stash, reset, clean, unstage, discard, amend or delete branches/worktrees. DO NOT change permissions, delete locks or bypass the sandbox to proceed. Stop and report to Orchestrator, who reports to the user.\n- **Explicit choice:** Only a clear user selection counts. Planning approval, silence, refusal of another option and ambiguous replies do not.\n- **Stop and inspect:** On failure or partial completion, stop dependent work. Record actual path, branch or detached HEAD, HEAD, index, files and completed steps. DO NOT automatically retry, fall back or repeat completed work. Revalidate affected gates after resolution."
|
|
14
|
+
"text": "- **Preservation rule:** Preserve unrelated staged, unstaged and untracked changes and edit ownership. NEVER automatically stash, reset, clean, unstage, discard, amend or delete branches/worktrees. DO NOT change permissions, delete locks or bypass the sandbox to proceed. Stop and report to Orchestrator, who reports to the user.\n- **Explicit choice:** Only a clear user selection counts, or a recorded Full Auto auto-decision under [approval.run-mode]. Planning approval, silence, refusal of another option and ambiguous replies do not.\n- **Stop and inspect:** On failure or partial completion, stop dependent work. Record actual path, branch or detached HEAD, HEAD, index, files and completed steps. DO NOT automatically retry, fall back or repeat completed work. Revalidate affected gates after resolution."
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"id": "common.optional-read-exception",
|
package/lib/prompts/render.mjs
CHANGED
|
@@ -142,7 +142,7 @@ export function validateAgentRegistry(registry) {
|
|
|
142
142
|
const ids = new Set(Object.values(EXPECTED).flat());
|
|
143
143
|
const fragments = new Map();
|
|
144
144
|
for (const item of registry.fragments) {
|
|
145
|
-
if (!keys(item, ['id', 'text']) || !ids.has(item.id) || fragments.has(item.id) || typeof item.text !== 'string' || !item.text || /ARC_AGENT_FRAGMENT|ARC_OUTPUT_LANGUAGE_POLICY|\[ARC role policy: contract (?:begin|end)\]/.test(item.text) || item.text.includes('\r')) throw Error('Invalid fragment');
|
|
145
|
+
if (!keys(item, ['id', 'text']) || !ids.has(item.id) || fragments.has(item.id) || typeof item.text !== 'string' || !item.text || /ARC_AGENT_FRAGMENT|ARC_OUTPUT_LANGUAGE_POLICY|ARC_RUN_MODE_POLICY|\[ARC role policy: contract (?:begin|end)\]/.test(item.text) || item.text.includes('\r')) throw Error('Invalid fragment');
|
|
146
146
|
fragments.set(item.id, item.text);
|
|
147
147
|
}
|
|
148
148
|
if (fragments.size !== ids.size || registry.targets.length !== Object.keys(EXPECTED).length) throw Error('Incomplete fragment inventory');
|
package/lib/tui/mode.mjs
CHANGED
|
@@ -49,11 +49,23 @@ export function statusInfo(installState, statuses, registry = installerRegistryO
|
|
|
49
49
|
const status = statuses.find(status => status.platform === runtime.id);
|
|
50
50
|
return status ? [{runtime, status, state: stateLabel(status, runtime)}] : [];
|
|
51
51
|
});
|
|
52
|
+
const settings = statuses.filter(status => status.state === 'installed' && status.settings).map(status => status.settings);
|
|
53
|
+
const settingsRows = settings.length ? [
|
|
54
|
+
['Run mode', ({runMode}) => runMode === 'full-auto' ? 'Full Auto' : 'Supervised'],
|
|
55
|
+
['Language', ({language}) => language === 'ko' ? 'Korean' : 'English'],
|
|
56
|
+
['Total subagents', ({limits}) => String(limits.max_total_subagents)],
|
|
57
|
+
['Concurrent subagents', ({limits}) => String(limits.max_concurrent_subagents)]
|
|
58
|
+
].map(([label, displayValue]) => {
|
|
59
|
+
const values = settings.map(displayValue);
|
|
60
|
+
return [label, values.every(value => value === values[0]) ? values[0] : 'mixed'];
|
|
61
|
+
}) : [];
|
|
52
62
|
const width = text => [...escapeTerminalText(text)].reduce((sum, character) => sum + cellWidth(character), 0);
|
|
53
|
-
const labelWidth = Math.max(width('
|
|
63
|
+
const labelWidth = Math.max(width('Installed on'), ...settingsRows.map(([label]) => width(label)),
|
|
64
|
+
...(version ? [width('Version')] : []), ...platforms.map(({runtime}) => width(runtime.label)));
|
|
54
65
|
const row = (label, value) => label + ' '.repeat(labelWidth - width(label) + 3) + value;
|
|
55
|
-
const info = [row('
|
|
56
|
-
|
|
66
|
+
const info = [row('Installed on', homeModeLine(installState, statuses, registry)),
|
|
67
|
+
...settingsRows.map(([label, value]) => row(label, value)), ''];
|
|
68
|
+
const infoTones = info.map(() => undefined), notes = new Map();
|
|
57
69
|
const humanize = value => value.replace(/\b[a-z]+(?:_[a-z0-9]+)+\b/g, token => REASON_TEXT[token] ?? token.replaceAll('_', ' '));
|
|
58
70
|
const diagnosticText = value => {
|
|
59
71
|
const code = value.trim();
|
package/lib/tui/setup.mjs
CHANGED
|
@@ -12,7 +12,9 @@ import {deriveInstallPlan} from './derive-install-plan.mjs';
|
|
|
12
12
|
import {diagramRows} from './diagram.mjs';
|
|
13
13
|
import {editRole} from './custom-preset.mjs';
|
|
14
14
|
import {arrowValue,cellWidth,wrapDetailRows} from './render.mjs';
|
|
15
|
-
const
|
|
15
|
+
const runModeName = value => value === 'full-auto' ? 'Full Auto' : 'Supervised';
|
|
16
|
+
const languageName = value => value === 'ko' ? 'Korean' : 'English';
|
|
17
|
+
const fullAutoNotice='Full Auto: ARC auto-approves specs, plans, choices; push/merge/holds ask you.';
|
|
16
18
|
export function loadRoleDefaults({context,statuses,target,readText=filename=>readFileSync(filename,'utf8')}) {
|
|
17
19
|
if(!installerRegistryOf(context).isPlatformId(target))throw new ModelValidationError('Unsupported role target');
|
|
18
20
|
const installed=statuses.find(status=>status.platform===target)?.settings?.modelConfig;
|
|
@@ -20,16 +22,20 @@ export function loadRoleDefaults({context,statuses,target,readText=filename=>rea
|
|
|
20
22
|
const resolved=resolveModelSettings(config,context);if(resolved.platform!==target)throw new ModelValidationError('Model configuration platform does not match target');
|
|
21
23
|
return resolved.roles;
|
|
22
24
|
}
|
|
23
|
-
const installSettingKeys=['language','maxTotalSubagents','maxConcurrentSubagents'];
|
|
25
|
+
const installSettingKeys=['runMode','language','maxTotalSubagents','maxConcurrentSubagents'];
|
|
24
26
|
const installRoleNames=['Scouter','Planner','Implementer','QA','Reviewer'];
|
|
25
27
|
export function roleDisplayName(role){return installRoleNames[ROLES.indexOf(role)]??role;}
|
|
26
28
|
|
|
27
29
|
export function installSettingsDraft(statuses,platforms){
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const participatingStatuses=platforms.map(platform=>statuses.find(status=>status.platform===platform))
|
|
31
|
+
.filter(status=>status&&status.state!=='absent');
|
|
32
|
+
const values=participatingStatuses.map(({settings})=>({
|
|
33
|
+
runMode:settings?.runMode??'supervised',
|
|
34
|
+
language:settings?.language??'en',
|
|
35
|
+
maxTotalSubagents:settings?.limits?.max_total_subagents??100,
|
|
36
|
+
maxConcurrentSubagents:settings?.limits?.max_concurrent_subagents??5,
|
|
37
|
+
}));
|
|
38
|
+
const first=values[0]??{runMode:'supervised',language:'en',maxTotalSubagents:100,maxConcurrentSubagents:5};
|
|
33
39
|
return {...first,mixed:new Set(installSettingKeys.filter(key=>values.some(value=>value[key]!==first[key]))),touched:new Set()};
|
|
34
40
|
}
|
|
35
41
|
|
|
@@ -48,26 +54,6 @@ export function installPrepareOptions(plan,draft,catalog){
|
|
|
48
54
|
return {kind:'install',target:'composite',platforms:plan.platforms,config,settings};
|
|
49
55
|
}
|
|
50
56
|
|
|
51
|
-
export async function editInstallSettings({ui,settings}){
|
|
52
|
-
let selected=0;
|
|
53
|
-
const display=(key,state)=>settings.mixed.has(key)&&!settings.touched.has(key)?'(mixed)':key==='language'?arrowValue(languageLabel(settings[key]),state.frame,state.selected===0):String(settings[key]);
|
|
54
|
-
const rows=(state={})=>['Language '+display('language',state),'Total subagents '+display('maxTotalSubagents',state),'Concurrent subagents '+display('maxConcurrentSubagents',state),'Back'];
|
|
55
|
-
const cycleLanguage=()=>{settings.language=settings.language==='ko'?'en':'ko';settings.touched.add('language');};
|
|
56
|
-
while(true){
|
|
57
|
-
const choice=await ui.menu('Settings',rows(),{selected,onHorizontal:({selected})=>{if(selected===0)cycleLanguage();},renderBody:state=>({rows:rows(state),rowKinds:[undefined,undefined,undefined,'cancel'],selected:state.selected,position:null})});
|
|
58
|
-
if(choice===null||choice===3)return;
|
|
59
|
-
selected=choice;
|
|
60
|
-
if(choice===0){cycleLanguage();continue;}
|
|
61
|
-
const key=installSettingKeys[choice];if(!key)continue;
|
|
62
|
-
let raw=settings.mixed.has(key)&&!settings.touched.has(key)?'':String(settings[key]);
|
|
63
|
-
while(true){
|
|
64
|
-
raw=await ui.text(choice===1?'Total subagents':'Concurrent subagents',raw);if(raw===null)break;
|
|
65
|
-
let value;try{value=parsePositiveLimit(raw);}catch{await ui.page('Invalid limit',['Enter a positive whole number.']);continue;}
|
|
66
|
-
settings[key]=value;settings.touched.add(key);break;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
57
|
export async function editHosts({ui,hosts,rolePlatforms,availabilityOf,registry=DEFAULT_INSTALLER_REGISTRY}){
|
|
72
58
|
const ids=registry.byDisplayOrder().map(descriptor=>descriptor.runtime.id),locked=new Set(rolePlatforms),checked=new Set([...hosts,...rolePlatforms]);
|
|
73
59
|
const labels=ids.map(id=>platformLabel(id,registry)),labelWidths=labels.map(label=>[...label].reduce((width,character)=>width+cellWidth(character),0)),suffixColumn=Math.max(0,...labelWidths)+2;
|
|
@@ -149,17 +135,38 @@ export async function runInstallFlow({ui,statuses,draft,installState,currentConf
|
|
|
149
135
|
const reason=firstId?`! ${firstRole===undefined?'Hosts':installRoleNames[firstRole]}: ${platformLabel(firstId,registry)} - Unavailable (${REASON_TEXT[gates.get(firstId).reason]})`:null;
|
|
150
136
|
const warningId=plan.platforms.find(id=>gates.get(id).warning==='auth_unverified');
|
|
151
137
|
const info=[...(installState.legacyAnchor&&plan.anchorMove?['Mixed routing files will move to the Claude home.']:[]),...(reason?[reason]:warningId?[`${platformLabel(warningId,registry)}: auth unverified`]:[])];
|
|
152
|
-
const
|
|
153
|
-
const
|
|
138
|
+
const hostsRow='Hosts: '+sortByDisplay(draft.hosts,registry).map(id=>platformLabel(id,registry)).join(', ');
|
|
139
|
+
const isMixed=key=>settings.mixed.has(key)&&!settings.touched.has(key);
|
|
140
|
+
const display=(key,name=String,state,index)=>{
|
|
141
|
+
if(isMixed(key))return '(mixed)';
|
|
142
|
+
const label=name(settings[key]);
|
|
143
|
+
return state?arrowValue(label,state.frame,state.selected===index):label;
|
|
144
|
+
};
|
|
145
|
+
const controlsFor=state=>[
|
|
146
|
+
hostsRow,
|
|
147
|
+
'Run mode '+display('runMode',runModeName,state,6),
|
|
148
|
+
'Language '+display('language',languageName,state,7),
|
|
149
|
+
'Total subagents '+display('maxTotalSubagents'),
|
|
150
|
+
'Concurrent subagents '+display('maxConcurrentSubagents'),
|
|
151
|
+
`Apply - ${plan.modeLabel}`,'Back',
|
|
152
|
+
];
|
|
153
|
+
const cycleRunMode=()=>{settings.runMode=settings.runMode==='full-auto'?'supervised':'full-auto';settings.touched.add('runMode');};
|
|
154
|
+
const cycleLanguage=()=>{settings.language=settings.language==='ko'?'en':'ko';settings.touched.add('language');};
|
|
155
|
+
const choice=await ui.menu('Configure',[...installRoleNames,...controlsFor().slice(0,-1)],{
|
|
154
156
|
selected,backRow:true,refreshMs:600,notice:info,
|
|
157
|
+
onHorizontal:({selected})=>{if(selected===6)cycleRunMode();else if(selected===7)cycleLanguage();},
|
|
155
158
|
renderBody:state=>{
|
|
156
|
-
const
|
|
159
|
+
const controls=controlsFor(state);
|
|
160
|
+
const notices=settings.runMode==='full-auto'&&!isMixed('runMode')?[...info,fullAutoNotice]:info;
|
|
161
|
+
const noticeRows=wrapDetailRows(notices,state.columns).length;
|
|
162
|
+
const diagram=diagramRows(roleRows,{...state,selectedRole:state.selected<ROLES.length?state.selected:undefined,blocked,footerRows:noticeRows+controls.length,registry});
|
|
157
163
|
if(diagram.mode==='guard')return {rows:diagram.rows,notices:[],selected:undefined,position:null};
|
|
158
164
|
const diagramBody=diagram.mode==='compact'?diagram.rows.slice(0,ROLES.length):diagram.rows;
|
|
159
165
|
const rows=[...diagramBody,...controls];
|
|
160
166
|
const selected=state.selected<ROLES.length?(diagram.mode==='compact'?state.selected:state.selected<3?0:8):diagramBody.length+state.selected-ROLES.length;
|
|
161
|
-
const capacity=Math.max(1,state.rows-
|
|
162
|
-
|
|
167
|
+
const capacity=Math.max(1,state.rows-noticeRows-5),offset=Math.max(0,Math.min(selected-capacity+1,rows.length-capacity));
|
|
168
|
+
const rowKinds=[...diagramBody.map(()=>undefined),...controls.map((_,i)=>i===controls.length-2?'confirm':i===controls.length-1?'cancel':undefined)];
|
|
169
|
+
return {rows:rows.slice(offset,offset+capacity),rowKinds:rowKinds.slice(offset,offset+capacity),selected:selected-offset,notices,showSelection:diagram.mode==='compact'||state.selected>=ROLES.length,position:rows.length>capacity?`${offset+1}-${Math.min(rows.length,offset+capacity)}/${rows.length}`:null};
|
|
163
170
|
},
|
|
164
171
|
});
|
|
165
172
|
if(choice===null)return null;
|
|
@@ -173,8 +180,18 @@ export async function runInstallFlow({ui,statuses,draft,installState,currentConf
|
|
|
173
180
|
}else if(choice===5){
|
|
174
181
|
const hosts=await editHosts({ui,hosts:draft.hosts,rolePlatforms:ROLES.map(role=>draft.roles[role].platform),availabilityOf:id=>availabilityOf(id,'host'),registry});
|
|
175
182
|
if(hosts!==null)draft.hosts=hosts;
|
|
176
|
-
}else if(choice===6)
|
|
177
|
-
else if(choice===7)
|
|
183
|
+
}else if(choice===6)cycleRunMode();
|
|
184
|
+
else if(choice===7)cycleLanguage();
|
|
185
|
+
else if(choice===8||choice===9){
|
|
186
|
+
const key=choice===8?'maxTotalSubagents':'maxConcurrentSubagents';
|
|
187
|
+
const title=choice===8?'Total subagents':'Concurrent subagents';
|
|
188
|
+
let raw=isMixed(key)?'':String(settings[key]);
|
|
189
|
+
while(true){
|
|
190
|
+
raw=await ui.text(title,raw);if(raw===null)break;
|
|
191
|
+
let value;try{value=parsePositiveLimit(raw);}catch{await ui.page('Invalid limit',['Enter a positive whole number.']);continue;}
|
|
192
|
+
settings[key]=value;settings.touched.add(key);break;
|
|
193
|
+
}
|
|
194
|
+
}else if(choice===10){
|
|
178
195
|
if(reason)continue;
|
|
179
196
|
if(plan.rule==='D1-f'){
|
|
180
197
|
await ui.page('Operation unavailable',[installState.reason??'Mixed routing configuration cannot be verified.',...(installState.residualPaths??[]).map(value=>'Residual path: '+value),'No changes were applied.']);continue;
|
package/package.json
CHANGED
|
@@ -146,6 +146,32 @@
|
|
|
146
146
|
"grok": "prompt"
|
|
147
147
|
}
|
|
148
148
|
},
|
|
149
|
+
{
|
|
150
|
+
"id": "approval.run-mode",
|
|
151
|
+
"roles": [
|
|
152
|
+
"orchestrator",
|
|
153
|
+
"scouter",
|
|
154
|
+
"planner",
|
|
155
|
+
"implementer",
|
|
156
|
+
"qa",
|
|
157
|
+
"reviewer"
|
|
158
|
+
],
|
|
159
|
+
"effect": "require",
|
|
160
|
+
"operations": [
|
|
161
|
+
"gate-decision"
|
|
162
|
+
],
|
|
163
|
+
"evidence": [
|
|
164
|
+
"user-choice-or-recorded-full-auto-decision"
|
|
165
|
+
],
|
|
166
|
+
"authority": "user",
|
|
167
|
+
"text": "The installed ARC Run mode is Supervised unless the installed skill states Full Auto. In Full Auto, an Orchestrator decision recorded as `auto-decided (Full Auto)` with gate, choice, reason and evidence counts as the explicit choice or approval for that listed gate only; briefs cite it as `full-auto:<doc>@<version>` or the recorded decision. It never authorizes new product decisions outside the original request, external actions, resolution of failures, holds, unknown state or ownership conflicts, preservation-rule Git actions, permission or sandbox changes, or unknown slots and exhausted capacity, and it changes no plan-depth, commit, QA, Reviewer or acceptance rule. A user request to stop or use Supervised applies from the next gate.",
|
|
168
|
+
"controls": {
|
|
169
|
+
"codex": "prompt",
|
|
170
|
+
"claude": "prompt",
|
|
171
|
+
"gemini": "prompt",
|
|
172
|
+
"grok": "prompt"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
149
175
|
{
|
|
150
176
|
"id": "role.orchestrator-boundary",
|
|
151
177
|
"roles": [
|