@yunhozz/arc 0.4.2 → 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 +91 -67
- package/README.md +7 -6
- 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/coordination.md +1 -1
- 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/coordination.md +1 -1
- 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/coordination.md +1 -1
- package/gemini/skill/references/planning.md +36 -0
- package/grok/AGENTS.md +8 -0
- package/grok/agents/arc-implementer.md +38 -0
- package/grok/agents/arc-planner.md +48 -0
- package/grok/agents/arc-qa.md +38 -0
- package/grok/agents/arc-reviewer.md +40 -0
- package/grok/agents/arc-scouter.md +39 -0
- package/grok/instructions.md +4 -0
- package/grok/skill/SKILL.md +81 -0
- package/grok/skill/models.toml +23 -0
- package/grok/skill/references/arc-visual-companion.md +28 -0
- package/grok/skill/references/commit.md +55 -0
- package/grok/skill/references/coordination.md +149 -0
- package/grok/skill/references/git-recovery.md +34 -0
- package/grok/skill/references/handoff-prep.md +110 -0
- package/grok/skill/references/handoff.md +227 -0
- package/grok/skill/references/limits.md +31 -0
- package/grok/skill/references/planning.md +204 -0
- package/grok/skill/references/verification.md +155 -0
- package/grok/skill/references/worktree-creation.md +8 -0
- package/lib/installer/global-config.mjs +8 -3
- package/lib/installer/grok-compat.mjs +107 -0
- package/lib/installer/language.mjs +54 -6
- package/lib/installer/plan.mjs +20 -14
- package/lib/installer/runtime-assets.mjs +1 -0
- package/lib/installer/uninstall.mjs +14 -1
- package/lib/installer/upgrade-state.mjs +13 -4
- package/lib/installer/upgrade.mjs +8 -3
- package/lib/management/operations.mjs +8 -5
- package/lib/management/status.mjs +26 -5
- package/lib/management/update.mjs +4 -4
- package/lib/models/codex-models.json +72 -0
- package/lib/models/grok-models.json +7 -0
- package/lib/platforms/formats/grok-markdown.mjs +49 -0
- package/lib/platforms/grok.mjs +14 -0
- package/lib/platforms/index.mjs +2 -1
- package/lib/policy/placement.mjs +2 -2
- package/lib/policy/render.mjs +1 -1
- package/lib/policy/role-policy.json +60 -15
- package/lib/prompts/agent-fragments.json +71 -1
- package/lib/prompts/render.mjs +7 -2
- package/lib/runtime/bootstrap.mjs +1 -1
- package/lib/runtime/grok-stream.mjs +46 -0
- package/lib/runtime/platform-registry.mjs +21 -0
- package/lib/runtime/role-bridge-args.mjs +40 -0
- package/lib/runtime/role-bridge.mjs +1 -1
- package/lib/runtime/role-dispatch-policy.mjs +4 -2
- package/lib/runtime/role-routing.mjs +2 -1
- package/lib/runtime/role-supervisor.mjs +57 -13
- package/lib/tui/app.mjs +18 -11
- package/lib/tui/custom-preset.mjs +6 -4
- package/lib/tui/mode.mjs +40 -5
- package/lib/tui/render.mjs +19 -8
- package/lib/tui/setup.mjs +53 -36
- package/lib/tui/terminal.mjs +1 -1
- package/lib/watch/status-line.mjs +10 -2
- package/package.json +2 -1
- package/scripts/update-manifest.mjs +2 -2
- package/shared/skill/references/superpowers-provenance.json +1 -1
- package/shared/skill/runtime/bootstrap.mjs +1 -1
- package/shared/skill/runtime/grok-stream.mjs +46 -0
- package/shared/skill/runtime/platform-registry.mjs +21 -0
- package/shared/skill/runtime/role-bridge-args.mjs +40 -0
- package/shared/skill/runtime/role-bridge.mjs +1 -1
- package/shared/skill/runtime/role-dispatch-policy.mjs +4 -2
- package/shared/skill/runtime/role-policy.json +60 -15
- package/shared/skill/runtime/role-routing.mjs +2 -1
- package/shared/skill/runtime/role-supervisor.mjs +57 -13
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import {gradientAt,
|
|
2
|
+
import {gradientAt, toAnsi256} from '../color/palette.mjs';
|
|
3
3
|
import {displayWidth} from './render.mjs';
|
|
4
4
|
import {sanitizeText} from './policy.mjs';
|
|
5
5
|
|
|
6
6
|
const graphemes = new Intl.Segmenter(undefined, {granularity:'grapheme'});
|
|
7
|
+
const PERIOD = 18, SWEEP = 13, R = 2.5;
|
|
8
|
+
|
|
9
|
+
function watchShimmerIntensity(index, tick) {
|
|
10
|
+
const f = tick % PERIOD;
|
|
11
|
+
if (f >= SWEEP) return 0;
|
|
12
|
+
const c = -R + f;
|
|
13
|
+
return Math.max(0, 1 - Math.abs(index - c) / R) ** 2;
|
|
14
|
+
}
|
|
7
15
|
|
|
8
16
|
export function watchLocationLabel({mode, dir, session, home}) {
|
|
9
17
|
let label = dir;
|
|
@@ -18,7 +26,7 @@ export function shimmerText(text, tick) {
|
|
|
18
26
|
const characters = [...text];
|
|
19
27
|
return characters.map((character, i) => {
|
|
20
28
|
const base = gradientAt(i / Math.max(1, characters.length - 1));
|
|
21
|
-
const intensity =
|
|
29
|
+
const intensity = watchShimmerIntensity(i, tick);
|
|
22
30
|
const rgb = base.map(value => Math.round(value + (255 - value) * intensity));
|
|
23
31
|
return `\x1b[38;5;${toAnsi256(rgb)}m${character}`;
|
|
24
32
|
}).join('') + '\x1b[0m';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yunhozz/arc",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"claude/skill/",
|
|
49
49
|
"claude/agents/",
|
|
50
50
|
"gemini/",
|
|
51
|
+
"grok/",
|
|
51
52
|
"MANIFEST.sha256",
|
|
52
53
|
"install.command",
|
|
53
54
|
"!**/__pycache__/**",
|
|
@@ -4,7 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
const i = process.argv.indexOf('--root');
|
|
6
6
|
const root = i < 0 ? fileURLToPath(new URL('../', import.meta.url)) : path.resolve(process.argv[i + 1]);
|
|
7
|
-
const mutable = new Set(['codex/skill/models.toml', 'claude/skill/models.toml', 'gemini/skill/models.toml']);
|
|
7
|
+
const mutable = new Set(['codex/skill/models.toml', 'claude/skill/models.toml', 'gemini/skill/models.toml', 'grok/skill/models.toml']);
|
|
8
8
|
const excluded = new Set(['.DS_Store', '__pycache__', 'build']);
|
|
9
9
|
const files = new Map();
|
|
10
10
|
function visit(relative) {
|
|
@@ -17,7 +17,7 @@ function visit(relative) {
|
|
|
17
17
|
} else if (stat.isFile() && !mutable.has(relative)) files.set(relative,fs.readFileSync(filename));
|
|
18
18
|
else if (!stat.isFile()) throw new Error(`Protected payload is not regular: ${relative}`);
|
|
19
19
|
}
|
|
20
|
-
for (const entry of ['README.md', 'install.command', 'package.json', 'bin', 'lib', 'native/binding.c', 'native/binding.gyp', 'scripts', 'vendor', 'prebuilds', 'shared/skill', 'codex/skill', 'codex/agents', 'claude/skill', 'claude/agents', 'gemini']) visit(entry);
|
|
20
|
+
for (const entry of ['README.md', 'install.command', 'package.json', 'bin', 'lib', 'native/binding.c', 'native/binding.gyp', 'scripts', 'vendor', 'prebuilds', 'shared/skill', 'codex/skill', 'codex/agents', 'claude/skill', 'claude/agents', 'gemini', 'grok']) visit(entry);
|
|
21
21
|
const content = renderManifest(files);
|
|
22
22
|
const manifest = path.join(root, 'MANIFEST.sha256');
|
|
23
23
|
if (process.argv.includes('--check')) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"repository": "https://github.com/obra/superpowers",
|
|
4
4
|
"revision": "22f0b463e7a5e579904dd6211a520321035526f7",
|
|
5
|
-
"fetchedAt": "2026-11-
|
|
5
|
+
"fetchedAt": "2026-11-18T17:04:05.407Z",
|
|
6
6
|
"skills": [
|
|
7
7
|
"brainstorming",
|
|
8
8
|
"writing-plans",
|
|
@@ -8,7 +8,7 @@ export const COOPERATIVE_RUNTIME_MODULES=Object.freeze([
|
|
|
8
8
|
'cli.mjs','command.mjs','bootstrap.mjs','cooperative-schema.mjs','cooperative.mjs','evaluate.mjs',
|
|
9
9
|
'scope.mjs','store.mjs','git-evidence.mjs','assignment.mjs','verification.mjs','acceptance.mjs','external.mjs','schema.mjs','operations.mjs','gate.mjs','adapters/codex.mjs','adapters/claude.mjs','capabilities.mjs','identity.mjs','git-query.mjs','target-preparation.mjs',
|
|
10
10
|
'local-cli.mjs','role-routing-config.mjs','role-routing.mjs','role-bridge.mjs',
|
|
11
|
-
'role-dispatch-policy.mjs','role-dispatch-store.mjs','role-bridge-args.mjs','role-observe.mjs','role-supervisor.mjs','platform-registry.mjs','gemini-stream.mjs'
|
|
11
|
+
'role-dispatch-policy.mjs','role-dispatch-store.mjs','role-bridge-args.mjs','role-observe.mjs','role-supervisor.mjs','platform-registry.mjs','gemini-stream.mjs','grok-stream.mjs'
|
|
12
12
|
]);
|
|
13
13
|
export const cooperativeCoverage=()=>({enforcement:'cooperative',provenance:'operator-attested',nativeVerified:false});
|
|
14
14
|
export function commandResult({workflowId,state,input,decision='allow',ruleId='cooperative.recorded',persisted=false,...extra}){
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Unverified CLI contract: public documentation only; no live enforcement evidence.
|
|
2
|
+
// Sources: https://github.com/xai-org/grok-build/blob/main/crates/codegen/xai-grok-shell/README.md
|
|
3
|
+
// https://github.com/xai-org/grok-build/blob/main/crates/codegen/xai-grok-pager/docs/user-guide/22-permissions-and-safety.md
|
|
4
|
+
// U-K5: the shell README and permissions guide document rule syntax:
|
|
5
|
+
// ToolPrefix(glob_pattern), bare prefix matches the whole tool type; blocking effect unverified.
|
|
6
|
+
// https://github.com/xai-org/grok-build/blob/main/crates/codegen/xai-grok-pager/docs/user-guide/14-headless-mode.md
|
|
7
|
+
// U-K6: the headless guide example {"type":"text","data":…}.
|
|
8
|
+
// U-K7: the same guide lists end_turn, max_tokens, max_turn_requests, refusal, cancelled.
|
|
9
|
+
export const GROK_CONTRACT = Object.freeze({
|
|
10
|
+
outputFormat: 'streaming-json',
|
|
11
|
+
isolationArgs: Object.freeze(['--no-auto-update', '--no-subagents']),
|
|
12
|
+
childEnv: Object.freeze({
|
|
13
|
+
GROK_DISABLE_AUTOUPDATER: '1',
|
|
14
|
+
GROK_CLAUDE_AGENTS_ENABLED: 'false',
|
|
15
|
+
GROK_CLAUDE_SKILLS_ENABLED: 'false',
|
|
16
|
+
GROK_CLAUDE_RULES_ENABLED: 'false',
|
|
17
|
+
GROK_CLAUDE_MCPS_ENABLED: 'false',
|
|
18
|
+
GROK_CLAUDE_HOOKS_ENABLED: 'false',
|
|
19
|
+
}),
|
|
20
|
+
eventKinds: Object.freeze({text: 'text', thought: 'thought', tool_call: 'tool_call', tool_call_update: 'tool_call_update', usage: 'usage', plan: 'plan', available_commands: 'available_commands', error: 'error', end: 'end'}),
|
|
21
|
+
successStopReasons: Object.freeze(['end_turn']),
|
|
22
|
+
resumeFlag: '--resume',
|
|
23
|
+
delegation: 'undetectable',
|
|
24
|
+
readOnlyDeny: Object.freeze(['Bash', 'Edit', 'Write', 'MCPTool']),
|
|
25
|
+
});
|
|
26
|
+
export function normalizeGrokStreamEvent(line) {
|
|
27
|
+
let raw = line;
|
|
28
|
+
if (typeof line === 'string') {try {raw = JSON.parse(line);} catch {return {kind: 'unknown', raw};}}
|
|
29
|
+
const kind = raw && Object.hasOwn(GROK_CONTRACT.eventKinds, raw.type) ? GROK_CONTRACT.eventKinds[raw.type] : 'unknown';
|
|
30
|
+
if (kind === 'unknown') return {kind, raw};
|
|
31
|
+
return {kind, raw, ...(typeof raw.model === 'string' ? {model: raw.model} : {}),
|
|
32
|
+
...(kind === 'end' ? {...(typeof raw.sessionId === 'string' ? {sessionId: raw.sessionId} : {}), ...(typeof raw.stopReason === 'string' ? {stopReason: raw.stopReason} : {})} : {}),
|
|
33
|
+
...(kind === 'text' && typeof raw.data === 'string' ? {text: raw.data} : {})};
|
|
34
|
+
}
|
|
35
|
+
export function evaluateGrokObservation({state, expected, sessionId}) {
|
|
36
|
+
const observedSession = state.grokSessionId, model = state.grokModel;
|
|
37
|
+
const identityOk = observedSession === sessionId && !state.grokSessionMismatch;
|
|
38
|
+
const modelMismatch = state.grokModelMismatch || Boolean(model && model !== expected.model);
|
|
39
|
+
return {reason: !identityOk ? 'execution_identity_unverified' : modelMismatch ? 'model_effort_mismatch' : null,
|
|
40
|
+
claims: {
|
|
41
|
+
identity: identityOk ? {level: 'runtime-observed', source: 'grok-stream-session', observed: observedSession} : {level: 'unverified', source: 'none'},
|
|
42
|
+
model: {level: model && !modelMismatch ? 'runtime-observed' : 'unverified', source: model ? 'grok-stream-model' : 'none', requested: expected.model, observed: model ?? null},
|
|
43
|
+
effort: {level: 'unverified', source: 'none', requested: 'default', observed: null},
|
|
44
|
+
permissions: {level: 'runtime-observed', source: 'worktree-snapshot', details: 'git-visible worktree only'},
|
|
45
|
+
}};
|
|
46
|
+
}
|
|
@@ -58,6 +58,9 @@ function resolveHome(platform, {userHome, env = {}, cwd} = {}) {
|
|
|
58
58
|
const expanded = expand(raw ?? path.join(userHome, '.codex'));
|
|
59
59
|
if (path.isAbsolute(expanded)) home = path.resolve(expanded);
|
|
60
60
|
else { const base = cwd ?? process.cwd(); if (typeof base !== 'string' || !path.isAbsolute(base)) throw Error('cwd must be absolute for relative CODEX_HOME'); home = path.resolve(base, expanded); }
|
|
61
|
+
} else if (platform === 'grok') {
|
|
62
|
+
if (env.GROK_HOME !== undefined) throw Error('GROK_HOME is not verified');
|
|
63
|
+
home = path.join(userHome, '.grok');
|
|
61
64
|
} else if (platform === 'gemini') {
|
|
62
65
|
if (env.GEMINI_CLI_HOME !== undefined) throw Error('GEMINI_CLI_HOME is not verified');
|
|
63
66
|
home = path.join(userHome, '.gemini');
|
|
@@ -121,6 +124,24 @@ export const DEFAULT_PLATFORM_REGISTRY = createPlatformRegistry([
|
|
|
121
124
|
authProbe: 'no official auth status command', watch: 'watch support out of scope',
|
|
122
125
|
}).map(([key, reason]) => [key, {state: 'off', reason}]))},
|
|
123
126
|
},
|
|
127
|
+
{
|
|
128
|
+
id: 'grok', label: 'Grok', displayOrder: 3, anchorOrder: 3,
|
|
129
|
+
home: {env: 'GROK_HOME', resolve: context => resolveHome('grok', context)},
|
|
130
|
+
cli: {command: 'grok', supportedVersions: '>=1.0.0 <1.1.0'},
|
|
131
|
+
auth: {kind: 'none'},
|
|
132
|
+
models: {effortField: 'effort'},
|
|
133
|
+
profile: {
|
|
134
|
+
ext: 'md',
|
|
135
|
+
standaloneName: role => `arc-${role.slice(4)}`,
|
|
136
|
+
routingName: role => `arc-routing-${role.slice(4)}`,
|
|
137
|
+
},
|
|
138
|
+
executionEnvironments: ['grok-cli'],
|
|
139
|
+
routing: {validatePair: (model, effort) => validText(model) && /^[A-Za-z0-9][A-Za-z0-9._:/@+\-]*$/.test(model) && effort === 'default'},
|
|
140
|
+
capabilities: {install: {state: 'verified'}, nativeProfile: {state: 'verified'}, catalog: {state: 'verified'}, standalone: {state: 'verified'}, bridge: {state: 'verified'}, compositeRole: {state: 'verified'}, ...Object.fromEntries(Object.entries({
|
|
141
|
+
compositeHost: 'composite host not verified', authProbe: 'no official auth status command',
|
|
142
|
+
watch: 'watch support out of scope',
|
|
143
|
+
}).map(([key, reason]) => [key, {state: 'off', reason}]))},
|
|
144
|
+
},
|
|
124
145
|
]);
|
|
125
146
|
|
|
126
147
|
export const RUNTIME_PLATFORMS = DEFAULT_PLATFORM_REGISTRY.platforms;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Pure helpers that turn an installed arc-routing profile into role-specific Claude/Codex CLI arguments. No processes are started here.
|
|
2
2
|
import crypto from 'node:crypto';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
import {GROK_CONTRACT} from './grok-stream.mjs';
|
|
4
5
|
import {GEMINI_CONTRACT} from './gemini-stream.mjs';
|
|
5
6
|
import {DEFAULT_POLICY, effectiveClaudeSandboxSettings} from './role-dispatch-policy.mjs';
|
|
6
7
|
|
|
@@ -15,6 +16,13 @@ export const ROLE_BRIDGE_PERMISSIONS = deepFreeze({
|
|
|
15
16
|
arc_scouter: {approvalMode: 'plan', sandbox: false}, arc_planner: {approvalMode: 'plan', sandbox: false},
|
|
16
17
|
arc_implementer: {approvalMode: 'auto_edit', sandbox: true}, arc_qa: {approvalMode: 'auto_edit', sandbox: true}, arc_reviewer: {approvalMode: 'plan', sandbox: false}
|
|
17
18
|
},
|
|
19
|
+
grok: {
|
|
20
|
+
arc_scouter: {permissionMode: 'plan', sandbox: 'read-only', deny: GROK_CONTRACT.readOnlyDeny},
|
|
21
|
+
arc_planner: {permissionMode: 'plan', sandbox: 'read-only', deny: GROK_CONTRACT.readOnlyDeny},
|
|
22
|
+
arc_reviewer: {permissionMode: 'plan', sandbox: 'read-only', deny: GROK_CONTRACT.readOnlyDeny},
|
|
23
|
+
arc_implementer: {permissionMode: 'acceptEdits', sandbox: 'workspace', deny: []},
|
|
24
|
+
arc_qa: {permissionMode: 'acceptEdits', sandbox: 'workspace', deny: []},
|
|
25
|
+
},
|
|
18
26
|
codex: {
|
|
19
27
|
arc_scouter: {sandboxMode: 'read-only', search: true}, arc_planner: {sandboxMode: 'read-only', search: false},
|
|
20
28
|
arc_implementer: {sandboxMode: 'workspace-write', search: false}, arc_qa: {sandboxMode: 'workspace-write', search: false}, arc_reviewer: {sandboxMode: 'read-only', search: false}
|
|
@@ -25,6 +33,7 @@ const BRIDGE_IMPLEMENTATIONS = new Map([
|
|
|
25
33
|
['claude', {parse: parseClaude, buildArgs: buildClaudeArgs}],
|
|
26
34
|
['codex', {parse: parseCodex, buildArgs: buildCodexArgs}],
|
|
27
35
|
['gemini', {parse: parseGemini, buildArgs: buildGeminiArgs}],
|
|
36
|
+
['grok', {parse: parseGrok, buildArgs: buildGrokArgs}],
|
|
28
37
|
]);
|
|
29
38
|
export const BRIDGE_PLATFORM_IDS = Object.freeze([...BRIDGE_IMPLEMENTATIONS.keys()]);
|
|
30
39
|
|
|
@@ -79,6 +88,26 @@ function parseGemini(text) {
|
|
|
79
88
|
return {name: fields.name, description: fields.description, model: fields.model, effort: 'default', tools: null, instructions: match[2].replaceAll('\r\n', '\n')};
|
|
80
89
|
}
|
|
81
90
|
|
|
91
|
+
// ARC Grok metadata uses the same scalar grammar with an exact key set.
|
|
92
|
+
export function parseGrok(text) {
|
|
93
|
+
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]+)$/.exec(text);
|
|
94
|
+
if (!match || !match[2].trim()) bad('missing Grok frontmatter or instructions');
|
|
95
|
+
const fields = {};
|
|
96
|
+
const nonStringScalar = /^(?:~|null|true|false|yes|no|on|off|[-+]?(?:\.inf|\.nan|0[xob][0-9a-f_]+|(?:\d[\d_]*(?:\.[\d_]*)?|\.[\d_]+)(?:e[-+]?\d+)?)|\d{4}-\d{2}-\d{2}(?:[Tt ].*)?)$/i;
|
|
97
|
+
for (const line of match[1].split(/\r?\n/)) {
|
|
98
|
+
const entry = /^([a-z][a-zA-Z0-9_-]*): (.+)$/.exec(line);
|
|
99
|
+
if (!entry || Object.hasOwn(fields, entry[1])) bad('malformed or duplicate Grok field');
|
|
100
|
+
const value = entry[2];
|
|
101
|
+
if (value !== value.trim() || /[\p{Cc}\u2028\u2029{}#&*!|>"']/u.test(value)
|
|
102
|
+
|| /^(?:[-?:](?:\s|$)|[\[\],%@`])/.test(value) || value.includes(': ') || nonStringScalar.test(value)) bad('unsupported Grok scalar');
|
|
103
|
+
fields[entry[1]] = value;
|
|
104
|
+
}
|
|
105
|
+
for (const key of ['name', 'description', 'model']) if (!fields[key]) bad(`missing ${key}`);
|
|
106
|
+
if (Object.keys(fields).length !== 3) bad('Grok fields must be exactly name, description, model');
|
|
107
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._:/@+\-]*$/.test(fields.model)) bad('invalid Grok model');
|
|
108
|
+
return {name: fields.name, description: fields.description, model: fields.model, effort: 'default', tools: null, instructions: match[2].replaceAll('\r\n', '\n')};
|
|
109
|
+
}
|
|
110
|
+
|
|
82
111
|
const ESCAPES = {b: '\b', t: '\t', n: '\n', f: '\f', r: '\r', '"': '"', '\\': '\\'};
|
|
83
112
|
// Decodes a TOML multiline basic string body; returns null when it is not terminated by """ on the same logical line.
|
|
84
113
|
function readMultiline(lines, index, rest) {
|
|
@@ -201,3 +230,14 @@ export function buildGeminiArgs({role, model, profile, sessionId, policyFile, pr
|
|
|
201
230
|
if (resume) args.push(GEMINI_CONTRACT.resumeFlag, sessionId);
|
|
202
231
|
return args;
|
|
203
232
|
}
|
|
233
|
+
|
|
234
|
+
export function buildGrokArgs({role, profile, sessionId, promptFile}) {
|
|
235
|
+
const permissions = permissionsFor('grok', role);
|
|
236
|
+
if (typeof promptFile !== 'string' || !path.isAbsolute(promptFile)) throw Error('Absolute promptFile required');
|
|
237
|
+
if (typeof sessionId !== 'string' || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(sessionId)) throw Error('Grok sessionId must be a UUID');
|
|
238
|
+
const model = requireText(profile?.model, 'model');
|
|
239
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._:/@+\-]*$/.test(model)) throw Error('Invalid Grok model');
|
|
240
|
+
return ['--prompt-file', promptFile, '--output-format', GROK_CONTRACT.outputFormat, '-m', model, '--session-id', sessionId,
|
|
241
|
+
'--permission-mode', permissions.permissionMode, '--sandbox', permissions.sandbox,
|
|
242
|
+
...permissions.deny.flatMap(rule => ['--deny', rule]), ...GROK_CONTRACT.isolationArgs];
|
|
243
|
+
}
|
|
@@ -143,7 +143,7 @@ export async function resumeRoleDispatch({context,dispatchId,brief,now=Date.now(
|
|
|
143
143
|
const lease=await readLease(anchorHome,dispatchId,{runtimePlatforms});
|
|
144
144
|
if(!lease||lease.workflowId!==context.workflowId||lease.hostPlatform!==context.hostPlatform||lease.route!=='bridge'||!['completed','failed'].includes(lease.state)){result=blank(context,dispatchId,'deny','invalid_request');return;}
|
|
145
145
|
const targetPlatform=leaseTargetPlatform(lease,runtimePlatforms);
|
|
146
|
-
if(targetPlatform==='gemini'&&!['on','verified'].includes(supervisorImplementations.get(targetPlatform)?.resume)){result=blank(context,dispatchId,'hold','resume_unverified');return;}
|
|
146
|
+
if((targetPlatform==='gemini'||targetPlatform==='grok')&&!['on','verified'].includes(supervisorImplementations.get(targetPlatform)?.resume)){result=blank(context,dispatchId,'hold','resume_unverified');return;}
|
|
147
147
|
if(!lease.sessionId){result=blank(context,dispatchId,'hold','execution_identity_unverified');return;}
|
|
148
148
|
let config;
|
|
149
149
|
try{config=await readActivation(homes,lease.revision,{anchorHome,host:context.hostPlatform,runtimePlatforms});}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {runtimeRegistryOf} from './platform-registry.mjs';
|
|
2
2
|
// Fixed policy values for composite role dispatch. G2 'escalation' means the bridge runs only with per-call user escalation approval on a Codex host; it is not a verified pass.
|
|
3
|
-
export const BRIDGE_GATE_RESULTS = Object.freeze({G1: 'fail', G2: 'escalation', G3: 'pass', G4: 'pass', G5: 'wide', G6: 'strict', G7: 'pass', G8: 'pass', GG1: 'fail', GG2: 'fail'});
|
|
3
|
+
export const BRIDGE_GATE_RESULTS = Object.freeze({G1: 'fail', G2: 'escalation', G3: 'pass', G4: 'pass', G5: 'wide', G6: 'strict', G7: 'pass', G8: 'pass', GG1: 'fail', GG2: 'fail', GK1: 'fail', GK2: 'fail'});
|
|
4
4
|
// No sandbox settings JSON has been recorded: G1 failed, so there is nothing to apply.
|
|
5
5
|
const RECORDED_CLAUDE_SANDBOX_SETTINGS = null;
|
|
6
6
|
const isRecordedObject = value => value !== null && typeof value === 'object' && !Array.isArray(value) && Object.keys(value).length > 0;
|
|
@@ -41,7 +41,7 @@ export const DEFAULT_POLICY = Object.freeze({
|
|
|
41
41
|
|
|
42
42
|
export const RELEASE_CONDITIONS = Object.freeze({
|
|
43
43
|
activation_unverified: 'Verify the active configuration, all prepared markers, installed bytes, host limits and the shared lock, and inspect the lease records in <anchor home>/arc-role-dispatch for unreadable or corrupted files.',
|
|
44
|
-
resume_unverified: 'Update ARC after verifying
|
|
44
|
+
resume_unverified: 'Update ARC after verifying platform session resume against the recorded session UUID.',
|
|
45
45
|
capability_not_verified: 'Update ARC to a release that verifies this platform capability.',
|
|
46
46
|
'Not Available': 'Install the target platform CLI so that it is found on PATH.',
|
|
47
47
|
Unauthorized: 'Authenticate the target platform CLI.',
|
|
@@ -87,6 +87,8 @@ export function bridgeGateReasons({platform, role, hostPlatform, policy = DEFAUL
|
|
|
87
87
|
const gates = policy.gates ?? BRIDGE_GATE_RESULTS, codes = [];
|
|
88
88
|
if (platform === 'claude' && (role === 'arc_implementer' || role === 'arc_qa') && effectiveClaudeSandboxSettings({gates, claudeSandboxSettings: policy.claudeSandboxSettings}) === null) codes.push('permission_scope_unverified');
|
|
89
89
|
if (platform === 'gemini' && (role === 'arc_implementer' || role === 'arc_qa') && gates.GG1 !== 'pass') codes.push('permission_scope_unverified');
|
|
90
|
+
if (platform === 'grok' && (role === 'arc_implementer' || role === 'arc_qa') && gates.GK1 !== 'pass') codes.push('permission_scope_unverified');
|
|
91
|
+
if (hostPlatform === 'grok' && gates.GK2 !== 'pass') codes.push('host_sandbox_blocked');
|
|
90
92
|
if (hostPlatform === 'gemini' && gates.GG2 !== 'pass') codes.push('host_sandbox_blocked');
|
|
91
93
|
if (platform === 'codex' && gates.G4 === 'fail') codes.push('permission_scope_unverified');
|
|
92
94
|
if (hostPlatform === 'codex' && gates.G2 === 'fail') codes.push('host_sandbox_blocked');
|
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
"controls": {
|
|
52
52
|
"codex": "prompt",
|
|
53
53
|
"claude": "prompt",
|
|
54
|
-
"gemini": "prompt"
|
|
54
|
+
"gemini": "prompt",
|
|
55
|
+
"grok": "prompt"
|
|
55
56
|
}
|
|
56
57
|
},
|
|
57
58
|
{
|
|
@@ -84,7 +85,8 @@
|
|
|
84
85
|
"controls": {
|
|
85
86
|
"codex": "prompt",
|
|
86
87
|
"claude": "prompt",
|
|
87
|
-
"gemini": "prompt"
|
|
88
|
+
"gemini": "prompt",
|
|
89
|
+
"grok": "prompt"
|
|
88
90
|
}
|
|
89
91
|
},
|
|
90
92
|
{
|
|
@@ -110,7 +112,8 @@
|
|
|
110
112
|
"controls": {
|
|
111
113
|
"codex": "prompt",
|
|
112
114
|
"claude": "prompt",
|
|
113
|
-
"gemini": "prompt"
|
|
115
|
+
"gemini": "prompt",
|
|
116
|
+
"grok": "prompt"
|
|
114
117
|
}
|
|
115
118
|
},
|
|
116
119
|
{
|
|
@@ -139,7 +142,34 @@
|
|
|
139
142
|
"controls": {
|
|
140
143
|
"codex": "prompt",
|
|
141
144
|
"claude": "prompt",
|
|
142
|
-
"gemini": "prompt"
|
|
145
|
+
"gemini": "prompt",
|
|
146
|
+
"grok": "prompt"
|
|
147
|
+
}
|
|
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"
|
|
143
173
|
}
|
|
144
174
|
},
|
|
145
175
|
{
|
|
@@ -160,7 +190,8 @@
|
|
|
160
190
|
"controls": {
|
|
161
191
|
"codex": "prompt",
|
|
162
192
|
"claude": "prompt",
|
|
163
|
-
"gemini": "prompt"
|
|
193
|
+
"gemini": "prompt",
|
|
194
|
+
"grok": "prompt"
|
|
164
195
|
}
|
|
165
196
|
},
|
|
166
197
|
{
|
|
@@ -181,7 +212,8 @@
|
|
|
181
212
|
"controls": {
|
|
182
213
|
"codex": "prompt",
|
|
183
214
|
"claude": "prompt",
|
|
184
|
-
"gemini": "prompt"
|
|
215
|
+
"gemini": "prompt",
|
|
216
|
+
"grok": "prompt"
|
|
185
217
|
}
|
|
186
218
|
},
|
|
187
219
|
{
|
|
@@ -202,7 +234,8 @@
|
|
|
202
234
|
"controls": {
|
|
203
235
|
"codex": "prompt",
|
|
204
236
|
"claude": "prompt",
|
|
205
|
-
"gemini": "prompt"
|
|
237
|
+
"gemini": "prompt",
|
|
238
|
+
"grok": "prompt"
|
|
206
239
|
}
|
|
207
240
|
},
|
|
208
241
|
{
|
|
@@ -224,7 +257,8 @@
|
|
|
224
257
|
"controls": {
|
|
225
258
|
"codex": "prompt",
|
|
226
259
|
"claude": "prompt",
|
|
227
|
-
"gemini": "prompt"
|
|
260
|
+
"gemini": "prompt",
|
|
261
|
+
"grok": "prompt"
|
|
228
262
|
}
|
|
229
263
|
},
|
|
230
264
|
{
|
|
@@ -247,7 +281,8 @@
|
|
|
247
281
|
"controls": {
|
|
248
282
|
"codex": "prompt",
|
|
249
283
|
"claude": "prompt",
|
|
250
|
-
"gemini": "prompt"
|
|
284
|
+
"gemini": "prompt",
|
|
285
|
+
"grok": "prompt"
|
|
251
286
|
}
|
|
252
287
|
},
|
|
253
288
|
{
|
|
@@ -268,7 +303,8 @@
|
|
|
268
303
|
"controls": {
|
|
269
304
|
"codex": "prompt",
|
|
270
305
|
"claude": "prompt",
|
|
271
|
-
"gemini": "prompt"
|
|
306
|
+
"gemini": "prompt",
|
|
307
|
+
"grok": "prompt"
|
|
272
308
|
}
|
|
273
309
|
},
|
|
274
310
|
{
|
|
@@ -294,7 +330,8 @@
|
|
|
294
330
|
"controls": {
|
|
295
331
|
"codex": "prompt",
|
|
296
332
|
"claude": "prompt",
|
|
297
|
-
"gemini": "prompt"
|
|
333
|
+
"gemini": "prompt",
|
|
334
|
+
"grok": "prompt"
|
|
298
335
|
}
|
|
299
336
|
},
|
|
300
337
|
{
|
|
@@ -320,7 +357,8 @@
|
|
|
320
357
|
"controls": {
|
|
321
358
|
"codex": "prompt",
|
|
322
359
|
"claude": "prompt",
|
|
323
|
-
"gemini": "prompt"
|
|
360
|
+
"gemini": "prompt",
|
|
361
|
+
"grok": "prompt"
|
|
324
362
|
}
|
|
325
363
|
},
|
|
326
364
|
{
|
|
@@ -345,7 +383,8 @@
|
|
|
345
383
|
"controls": {
|
|
346
384
|
"codex": "prompt",
|
|
347
385
|
"claude": "prompt",
|
|
348
|
-
"gemini": "prompt"
|
|
386
|
+
"gemini": "prompt",
|
|
387
|
+
"grok": "prompt"
|
|
349
388
|
}
|
|
350
389
|
},
|
|
351
390
|
{
|
|
@@ -369,7 +408,8 @@
|
|
|
369
408
|
"controls": {
|
|
370
409
|
"codex": "prompt",
|
|
371
410
|
"claude": "prompt",
|
|
372
|
-
"gemini": "prompt"
|
|
411
|
+
"gemini": "prompt",
|
|
412
|
+
"grok": "prompt"
|
|
373
413
|
}
|
|
374
414
|
},
|
|
375
415
|
{
|
|
@@ -392,7 +432,8 @@
|
|
|
392
432
|
"controls": {
|
|
393
433
|
"codex": "prompt",
|
|
394
434
|
"claude": "prompt",
|
|
395
|
-
"gemini": "prompt"
|
|
435
|
+
"gemini": "prompt",
|
|
436
|
+
"grok": "prompt"
|
|
396
437
|
}
|
|
397
438
|
}
|
|
398
439
|
],
|
|
@@ -408,6 +449,10 @@
|
|
|
408
449
|
"gemini": {
|
|
409
450
|
"level": "prompt",
|
|
410
451
|
"notice": "Role restrictions are prompt-level contracts, not a filesystem sandbox. Native tool restriction fields, observer hooks and Git guards are unverified. Use only available authorized tools; ARC does not write Gemini settings.json."
|
|
452
|
+
},
|
|
453
|
+
"grok": {
|
|
454
|
+
"level": "prompt",
|
|
455
|
+
"notice": "Role restrictions are prompt-level contracts, not a filesystem sandbox. Grok sandboxing, native tool restriction fields, observer hooks and Git guards are unverified, and Grok may continue without its sandbox. Use only available authorized tools; ARC disables Grok Claude compatibility (agents, skills, rules in config.toml; also MCPs and hooks for bridge children), but whether Grok sessions honor these settings is unverified."
|
|
411
456
|
}
|
|
412
457
|
},
|
|
413
458
|
"review": {
|
|
@@ -231,6 +231,7 @@ export async function prepareRoleDispatch({context,assignment,expectedRevision,n
|
|
|
231
231
|
const leases=await listLeases(anchorHome,{runtimePlatforms});
|
|
232
232
|
const live=leases.filter(lease=>NON_TERMINAL_STATES.includes(lease.state));
|
|
233
233
|
if(leases.some(lease=>lease.requestId===assignment.requestId)||live.some(lease=>lease.workflowId===context.workflowId&&lease.taskId===assignment.taskId&&lease.role===role)){duplicate=true;codes.add('duplicate_dispatch');}
|
|
234
|
+
if(host==='grok'&&(policy.gates?.GK2??DEFAULT_POLICY.gates.GK2)!=='pass')codes.add('host_sandbox_blocked');
|
|
234
235
|
if(host==='gemini'&&(policy.gates?.GG2??DEFAULT_POLICY.gates.GG2)!=='pass')codes.add('host_sandbox_blocked');
|
|
235
236
|
if(route==='bridge'){
|
|
236
237
|
let limits;try{limits=readHostLimits(resolveConfigHome(host,context));}catch{codes.add('activation_unverified');}
|
|
@@ -243,7 +244,7 @@ export async function prepareRoleDispatch({context,assignment,expectedRevision,n
|
|
|
243
244
|
result.reasons=[...codes].map(reason);
|
|
244
245
|
if(codes.size){result.decision=duplicate?'deny':'hold';return;}
|
|
245
246
|
const claims=initialClaims(route,policy,requested),iso=new Date(now).toISOString(),dispatchId=crypto.randomUUID();
|
|
246
|
-
const lease=await createLease(anchorHome,{version:2,targetPlatform:route==='native'?host:requested.platform,dispatchId,workflowId:context.workflowId,taskId:assignment.taskId,requestId:assignment.requestId,role,route,hostPlatform:host,executionEnvironment:environment,revision:config.revision,profileHash:await readProfileHash(homes[requested.platform],role),argsDigest:null,state:'reserved',supervisor:null,child:null,sessionId:route==='bridge'&&requested.platform==='gemini'?crypto.randomUUID():null,timeoutMinutes:policy.roleTimeoutMinutes[role],claims,reasons:[],allowedPaths:assignment.allowedPaths??[],resultPath:null,segment:0,nativeAgentId:null,createdAt:iso,updatedAt:iso},{runtimePlatforms,config});
|
|
247
|
+
const lease=await createLease(anchorHome,{version:2,targetPlatform:route==='native'?host:requested.platform,dispatchId,workflowId:context.workflowId,taskId:assignment.taskId,requestId:assignment.requestId,role,route,hostPlatform:host,executionEnvironment:environment,revision:config.revision,profileHash:await readProfileHash(homes[requested.platform],role),argsDigest:null,state:'reserved',supervisor:null,child:null,sessionId:route==='bridge'&&(requested.platform==='gemini'||requested.platform==='grok')?crypto.randomUUID():null,timeoutMinutes:policy.roleTimeoutMinutes[role],claims,reasons:[],allowedPaths:assignment.allowedPaths??[],resultPath:null,segment:0,nativeAgentId:null,createdAt:iso,updatedAt:iso},{runtimePlatforms,config});
|
|
247
248
|
Object.assign(result,{decision:'allow',routeStatus:'reserved',dispatchId:lease.dispatchId,claims});
|
|
248
249
|
},{retryMs:policy.lockRetryMs});
|
|
249
250
|
}catch(error){
|