@technomoron/agent-run 0.99.29 → 0.99.30

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/CHANGES CHANGED
@@ -1,6 +1,19 @@
1
1
  CHANGES
2
2
  =======
3
3
 
4
+ Version 0.99.30 (2026-09-06)
5
+ ----------------------------
6
+ * Add native Gemini CLI and Grok Build adapters alongside Codex and Claude
7
+ Code, with private runtimes, shared instructions, skills, and MCP servers.
8
+ * Add `agent-run gemini`, `agent-run grok`, and a native capability matrix
9
+ through `agent-run status`.
10
+ * Keep vendor configuration and launch options behind a common adapter
11
+ interface, with native arguments passed through to the selected CLI.
12
+ * Add Gemini and Grok to the AI tools updater, use fixed `/usr/local` paths,
13
+ install pnpm last, and remove recurring command-shim deletion.
14
+ * Update the starter configuration, documentation, and integration tests for
15
+ all four native agents.
16
+
4
17
  Version 0.99.29 (2026-09-04)
5
18
  ----------------------------
6
19
  * Add tracked per-profile project memory under `notes/memory`, while keeping
package/README.md CHANGED
@@ -65,7 +65,7 @@ Example:
65
65
  README.md # durable project memory, normally tracked
66
66
  live/
67
67
  CLAUDE.md
68
- .claude/
68
+ .claude/ # Claude settings, MCP, and skills
69
69
  bin/
70
70
  memories/
71
71
  codex-home/
@@ -73,6 +73,14 @@ Example:
73
73
  config.toml
74
74
  memories/ # native Codex memory, local generated state
75
75
  skills/
76
+ gemini/
77
+ AGENTS.md
78
+ settings.json
79
+ home/ # private Gemini state and generated skills
80
+ grok/
81
+ AGENTS.md
82
+ config.toml
83
+ skills/
76
84
  ~/source/org/my-api/
77
85
  ```
78
86
 
@@ -96,11 +104,38 @@ the agent config tree.
96
104
  - `live/memories/codex-home/config.toml`: generated Codex config
97
105
  - `live/memories/codex-home/skills/`: generated Codex skills
98
106
  - `live/CLAUDE.md`: generated Claude instructions
99
- - `live/.claude/`: generated Claude settings and local plugin skills
107
+ - `live/.claude/`: generated Claude settings, MCP configuration, and local
108
+ plugin skills
109
+ - `live/gemini/`: generated Gemini instructions, settings, skills, and private
110
+ runtime state
111
+ - `live/grok/`: generated Grok instructions, configuration, skills, and private
112
+ runtime state
100
113
 
101
114
  Edit only the root defaults and profile overrides that differ. `agent-run` keeps
102
115
  generated files in sync.
103
116
 
117
+ ## Native Agent Adapters
118
+
119
+ Each supported CLI is isolated behind an adapter in `src/agents/`. The shared
120
+ flow is:
121
+
122
+ ```text
123
+ profile and templates
124
+ ↓
125
+ canonical instructions, skills, and MCP servers
126
+ ↓
127
+ Codex | Claude | Gemini | Grok adapter
128
+ ↓
129
+ private generated runtime
130
+ ↓
131
+ native vendor CLI in the real project directory
132
+ ```
133
+
134
+ Codex, Gemini, and Grok receive the same generated `AGENTS.md` content. Claude
135
+ receives a thin `CLAUDE.md` serialization of those same canonical instruction
136
+ sections. Vendor-specific paths, settings formats, environment variables, and
137
+ launch flags stay inside the matching adapter.
138
+
104
139
  ## Manifest Defaults
105
140
 
106
141
  Manifest values are resolved in this order:
@@ -120,6 +155,48 @@ A profile with no differences from the root defaults needs only this marker:
120
155
  {}
121
156
  ```
122
157
 
158
+ Enable or disable native agents under `tools`:
159
+
160
+ ```json
161
+ {
162
+ "tools": {
163
+ "codex": true,
164
+ "claude": true,
165
+ "gemini": true,
166
+ "grok": true
167
+ }
168
+ }
169
+ ```
170
+
171
+ MCP servers have one canonical manifest representation. A server uses either a
172
+ local command or a remote URL:
173
+
174
+ ```json
175
+ {
176
+ "mcp": {
177
+ "servers": {
178
+ "local-tools": {
179
+ "command": "node",
180
+ "args": ["/opt/team-mcp/server.js"],
181
+ "env": {
182
+ "TEAM": "docs"
183
+ }
184
+ },
185
+ "remote-tools": {
186
+ "transport": "http",
187
+ "url": "https://mcp.example.com/mcp",
188
+ "enabled": true
189
+ }
190
+ }
191
+ }
192
+ }
193
+ ```
194
+
195
+ `transport` may be `stdio`, `http`, or `sse`; it is inferred as `stdio` when
196
+ `command` is present and `http` otherwise. The adapters serialize enabled
197
+ servers into each CLI's native MCP format. Disabled servers remain disabled in
198
+ Codex and Grok and are omitted from Claude and Gemini.
199
+
123
200
  `local.md.njk` and `overrides/` are not created unless they contain actual
124
201
  profile-specific configuration.
125
202
 
@@ -178,11 +255,11 @@ Global flag:
178
255
  - `-v`, `--verbose`: print path resolution, file creation, include expansion,
179
256
  generated file writes, and spawned commands
180
257
 
181
- `agent-run codex --help` and `agent-run claude --help` still pass `--help`
182
- through to the underlying tool.
258
+ `agent-run codex --help`, `agent-run claude --help`, `agent-run gemini --help`,
259
+ and `agent-run grok --help` pass `--help` through to the underlying tool.
183
260
 
184
- For `codex` and `claude`, use `--generate` to generate profile files without
185
- launching the underlying tool.
261
+ For any native agent command, use `--generate` to generate profile files
262
+ without launching the underlying tool.
186
263
 
187
264
  Codex defaults to `-a on-request -s workspace-write`. `agent-run` sets
188
265
  `CODEX_HOME` under the private agent directory, where Codex discovers the
@@ -222,17 +299,38 @@ replace the user's normal `CLAUDE_CONFIG_DIR`. If Claude writes remembered
222
299
  permissions to `.claude/settings.local.json`, `agent-run` removes that file
223
300
  after the session unless `--local` was used.
224
301
 
225
- `--yolo` runs either tool unattended, with no approval prompts: Codex with
226
- `-a never -s danger-full-access`, Claude with `--dangerously-skip-permissions`.
302
+ Gemini runs from the real project directory with a private
303
+ `GEMINI_CLI_HOME`. Its generated system settings configure `AGENTS.md` as the
304
+ context filename and add the private runtime plus project memory as context
305
+ directories. Generated skills use Gemini's `.agents/skills` alias. Existing
306
+ Gemini user settings, login credentials, commands, and user skills are linked
307
+ into the private home when present; generated system settings remain the
308
+ highest-priority project layer.
309
+
310
+ Grok runs from the real project directory with `GROK_HOME` set to
311
+ `live/grok/`. Grok natively reads the generated home-level `AGENTS.md`,
312
+ `config.toml`, and `skills/`. Existing Grok login and MCP OAuth credential
313
+ files are linked into the private runtime when present.
314
+
315
+ `--yolo` runs the selected tool unattended, with no approval prompts: Codex
316
+ with `-a never -s danger-full-access`, Claude with
317
+ `--dangerously-skip-permissions`, Gemini with `--yolo`, and Grok with
318
+ `--always-approve`.
227
319
  Only use it when the agent may change or delete anything it can reach. Claude
228
320
  refuses `--dangerously-skip-permissions` when it runs as root, so run it as a
229
- normal user. `--sandboxed` and `--network` stay Codex-only because Claude has no
230
- matching sandbox.
321
+ normal user. `--sandboxed` selects the native workspace sandbox for Codex,
322
+ Gemini, or Grok. `--network` remains Codex-only.
323
+
324
+ By default, all four native agent commands fail when local AI files such as
325
+ `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `.mcp.json`, `.agents`, `.claude`,
326
+ `.codex`, `.gemini`, or `.grok` are present inside the project repository. Use
327
+ `--local` to warn and continue for a specific invocation.
328
+
329
+ Show the native capability matrix:
231
330
 
232
- By default, `agent-run codex` and `agent-run claude` fail when local AI files
233
- such as `AGENTS.md`, `CLAUDE.md`, `CLAUDE.local.md`, `.mcp.json`, `.agents`,
234
- `.claude`, or `.codex` are present inside the project repository. Use `--local`
235
- to warn and continue for a specific invocation.
331
+ ```sh
332
+ agent-run status
333
+ ```
236
334
 
237
335
  Initialize mapped files for the current repo:
238
336
 
@@ -278,6 +376,8 @@ You can also generate from a tool command and stop before launch:
278
376
  ```sh
279
377
  agent-run codex --generate
280
378
  agent-run claude --generate
379
+ agent-run gemini --generate
380
+ agent-run grok --generate
281
381
  ```
282
382
 
283
383
  This reads the root defaults, sparse profile manifest, and Nunjucks templates,
@@ -288,12 +388,16 @@ then rewrites generated files:
288
388
  - `live/memories/codex-home/config.toml`
289
389
  - `live/memories/codex-home/skills/**`
290
390
  - `live/.claude/**`
391
+ - `live/gemini/**`
392
+ - `live/grok/**`
291
393
  - `live/bin/**`
292
394
 
293
395
  Per-profile override templates can be placed in:
294
396
 
295
397
  - `overrides/codex-config.toml.njk`
296
398
  - `overrides/claude-settings.json.njk`
399
+ - `overrides/gemini-settings.json.njk`
400
+ - `overrides/grok-config.toml.njk`
297
401
 
298
402
  ## Default Config Tree
299
403
 
@@ -336,8 +440,9 @@ This reports:
336
440
 
337
441
  - local AI files accidentally present in the source repo
338
442
  - missing mapped files
339
- - stale generated Codex instructions or config
340
- - invalid `CLAUDE.md`
443
+ - stale generated instructions, settings, MCP configuration, or skills for any
444
+ enabled native agent
445
+ - invalid generated JSON or skill metadata
341
446
  - profile resolution problems
342
447
 
343
448
  Check every repo under a source tree:
@@ -372,14 +477,20 @@ sudo scripts/install-systemd-jobs.sh --ai-tools
372
477
  ```
373
478
 
374
479
  This installs and enables `ai-tools-update.timer`, which runs hourly. The
375
- package list is configurable through systemd environment overrides:
480
+ updater uses `/usr/local/bin/npm`, `/usr/local/bin/node`, and
481
+ `/usr/local/bin/pnpm`, keeps global Node packages under `/usr/local`, and does
482
+ not delete command shims during recurring runs. It updates this fixed list of
483
+ Node packages with npm:
376
484
 
377
485
  ```text
378
- AI_TOOLS_NPM_PACKAGES="npm@latest pnpm@latest corepack@latest fallow@latest ripgrep@latest pm2@latest tsx@latest typescript@latest @openai/codex@latest @anthropic-ai/claude-code@latest @technomoron/agent-run@latest"
379
- AI_TOOLS_PNPM_PACKAGE="pnpm@latest"
380
- AI_TOOLS_APT_PACKAGES="gh"
486
+ npm, pnpm, corepack, fallow, ripgrep, pm2, tsx, typescript,
487
+ @openai/codex, @anthropic-ai/claude-code, @google/gemini-cli,
488
+ @xai-official/grok, and @technomoron/agent-run
381
489
  ```
382
490
 
491
+ The optional apt package list still defaults to `gh` and can be changed with
492
+ `AI_TOOLS_APT_PACKAGES`.
493
+
383
494
  ## Login Warning
384
495
 
385
496
  For user-owned machines, `scripts/agent-config-login-warning.sh` can be called
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.claudeAdapter = void 0;
4
+ const path = require("path");
5
+ const render_mcp_1 = require("../config/render-mcp");
6
+ const render_settings_1 = require("../config/render-settings");
7
+ const render_skills_1 = require("../config/render-skills");
8
+ const defaults_1 = require("../defaults");
9
+ const environment_1 = require("../runtime/environment");
10
+ const shared_1 = require("./shared");
11
+ function layout(context) {
12
+ const dir = path.join(context.paths.liveDir, '.claude');
13
+ return {
14
+ dir,
15
+ instructionFile: path.join(context.paths.liveDir, 'CLAUDE.md'),
16
+ configFiles: [
17
+ path.join(dir, 'agent-run-settings.json'),
18
+ path.join(dir, 'mcp.json'),
19
+ path.join(dir, '.claude-plugin', 'plugin.json')
20
+ ],
21
+ skillsDir: context.paths.claudeSkillsDir,
22
+ requiredDirs: [dir, context.paths.claudeSkillsDir]
23
+ };
24
+ }
25
+ function generate(generation) {
26
+ const agentLayout = layout(generation.context);
27
+ const settingsContent = (0, render_settings_1.renderProfileConfig)(generation.env, generation.configRoot, generation.context, 'claude-settings.json.njk', 'global/tool-templates/claude-settings.json.njk', () => (0, defaults_1.defaultClaudeSettingsContent)(generation.context), 'Claude settings', generation.trace);
28
+ (0, render_settings_1.parseJsonObject)(settingsContent, 'Claude settings');
29
+ const files = [
30
+ { path: agentLayout.instructionFile, content: generation.claudeMd },
31
+ { path: agentLayout.configFiles[0] ?? '', content: settingsContent },
32
+ { path: agentLayout.configFiles[1] ?? '', content: `${JSON.stringify((0, render_mcp_1.renderClaudeMcp)(generation.context), null, 2)}\n` },
33
+ { path: agentLayout.configFiles[2] ?? '', content: pluginManifest(generation.context.profile) },
34
+ ...(0, render_skills_1.renderSkillFiles)(generation.context, agentLayout.skillsDir)
35
+ ];
36
+ return { ...agentLayout, id: 'claude', projectDir: generation.context.projectRoot, files, context: generation.context };
37
+ }
38
+ exports.claudeAdapter = {
39
+ id: 'claude',
40
+ displayName: 'Claude',
41
+ capabilities: {
42
+ instructions: true,
43
+ skills: true,
44
+ mcp: true,
45
+ hooks: true,
46
+ subagents: true,
47
+ headless: true
48
+ },
49
+ wrapperOptions: { sandboxed: false, network: false },
50
+ layout,
51
+ generate,
52
+ spawn(runtime, options) {
53
+ (0, shared_1.assertRuntimeFile)('claude', runtime.instructionFile, runtime.context.profileDir);
54
+ const forcedPermissionArgs = process.env.AGENT_WRAPPER_FORCE_PERMISSIVE === '1' &&
55
+ typeof process.getuid === 'function' && process.getuid() !== 0
56
+ ? ['--permission-mode', 'bypassPermissions']
57
+ : [];
58
+ const runtimeArgs = options.wrapperArgs.sandboxMode === 'danger'
59
+ ? ['--dangerously-skip-permissions']
60
+ : forcedPermissionArgs;
61
+ return {
62
+ command: options.binary,
63
+ args: [
64
+ ...runtimeArgs,
65
+ '--add-dir',
66
+ runtime.context.paths.projectMemoryDir,
67
+ '--append-system-prompt-file',
68
+ runtime.instructionFile,
69
+ '--settings',
70
+ runtime.configFiles[0] ?? '',
71
+ '--mcp-config',
72
+ runtime.configFiles[1] ?? '',
73
+ '--plugin-dir',
74
+ runtime.dir,
75
+ ...options.passthroughArgs
76
+ ],
77
+ cwd: runtime.projectDir,
78
+ env: (0, environment_1.buildAgentEnvironment)(runtime.context),
79
+ onExit: (0, shared_1.withPostflight)(runtime, options.wrapperArgs)
80
+ };
81
+ },
82
+ bypassArgs(wrapperArgs) {
83
+ return wrapperArgs.sandboxMode === 'danger' ? ['--dangerously-skip-permissions'] : [];
84
+ }
85
+ };
86
+ function pluginManifest(profile) {
87
+ return `${JSON.stringify({
88
+ name: 'agent-run-profile',
89
+ description: `Generated skills for agent-run profile ${profile}`,
90
+ version: '1.0.0',
91
+ author: { name: 'Technomoron' }
92
+ }, null, 2)}\n`;
93
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.codexAdapter = void 0;
4
+ const os = require("os");
5
+ const path = require("path");
6
+ const defaults_1 = require("../defaults");
7
+ const render_mcp_1 = require("../config/render-mcp");
8
+ const render_settings_1 = require("../config/render-settings");
9
+ const render_skills_1 = require("../config/render-skills");
10
+ const environment_1 = require("../runtime/environment");
11
+ const shared_state_1 = require("../runtime/shared-state");
12
+ const shared_1 = require("./shared");
13
+ function layout(context) {
14
+ return {
15
+ dir: context.paths.codexHomeDir,
16
+ instructionFile: path.join(context.paths.codexHomeDir, 'AGENTS.md'),
17
+ configFiles: [path.join(context.paths.codexHomeDir, 'config.toml')],
18
+ skillsDir: context.paths.codexSkillsDir,
19
+ requiredDirs: [context.paths.codexHomeDir, context.paths.codexSkillsDir],
20
+ preservedSkillNames: new Set(['.system'])
21
+ };
22
+ }
23
+ function generate(generation) {
24
+ const agentLayout = layout(generation.context);
25
+ const baseConfig = (0, render_settings_1.renderProfileConfig)(generation.env, generation.configRoot, generation.context, 'codex-config.toml.njk', 'global/tool-templates/codex-config.toml.njk', () => (0, defaults_1.defaultCodexConfigContent)(generation.context), 'Codex config.toml', generation.trace);
26
+ const mcp = (0, render_mcp_1.renderCodexMcp)(generation.context);
27
+ const files = [
28
+ { path: agentLayout.instructionFile, content: generation.agentsMd },
29
+ { path: agentLayout.configFiles[0] ?? '', content: `${baseConfig.trimEnd()}${mcp ? `\n\n${mcp}` : '\n'}` },
30
+ ...(0, render_skills_1.renderSkillFiles)(generation.context, agentLayout.skillsDir)
31
+ ];
32
+ return { ...agentLayout, id: 'codex', projectDir: generation.context.projectRoot, files, context: generation.context };
33
+ }
34
+ exports.codexAdapter = {
35
+ id: 'codex',
36
+ displayName: 'Codex',
37
+ capabilities: {
38
+ instructions: true,
39
+ skills: true,
40
+ mcp: true,
41
+ hooks: false,
42
+ subagents: true,
43
+ headless: true
44
+ },
45
+ wrapperOptions: { sandboxed: true, network: true },
46
+ layout,
47
+ generate,
48
+ prepare(runtime) {
49
+ (0, shared_state_1.linkSharedEntry)(path.join(os.homedir(), '.codex', 'auth.json'), path.join(runtime.dir, 'auth.json'), 'profile Codex auth');
50
+ },
51
+ spawn(runtime, options) {
52
+ (0, shared_1.assertRuntimeFile)('codex', runtime.instructionFile, runtime.context.profileDir);
53
+ const runtimeArgs = options.wrapperArgs.sandboxMode === 'danger'
54
+ ? ['-a', 'never', '-s', 'danger-full-access']
55
+ : ['-a', 'on-request', '-s', 'workspace-write'];
56
+ return {
57
+ command: options.binary,
58
+ args: [
59
+ ...runtimeArgs,
60
+ '--add-dir',
61
+ runtime.context.paths.projectMemoryDir,
62
+ '-C',
63
+ runtime.projectDir,
64
+ ...(options.wrapperArgs.sandboxMode !== 'danger' && options.wrapperArgs.codexNetwork
65
+ ? ['--config', 'sandbox_workspace_write.network_access=true']
66
+ : []),
67
+ ...options.passthroughArgs
68
+ ],
69
+ cwd: runtime.dir,
70
+ env: { ...(0, environment_1.buildAgentEnvironment)(runtime.context), CODEX_HOME: runtime.dir },
71
+ onExit: (0, shared_1.withPostflight)(runtime, options.wrapperArgs)
72
+ };
73
+ },
74
+ bypassArgs(wrapperArgs) {
75
+ return wrapperArgs.sandboxMode === 'danger' ? ['-a', 'never', '-s', 'danger-full-access'] : [];
76
+ }
77
+ };
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.geminiAdapter = void 0;
4
+ const os = require("os");
5
+ const path = require("path");
6
+ const render_mcp_1 = require("../config/render-mcp");
7
+ const render_settings_1 = require("../config/render-settings");
8
+ const render_skills_1 = require("../config/render-skills");
9
+ const defaults_1 = require("../defaults");
10
+ const environment_1 = require("../runtime/environment");
11
+ const shared_state_1 = require("../runtime/shared-state");
12
+ const shared_1 = require("./shared");
13
+ function layout(context) {
14
+ return {
15
+ dir: context.paths.geminiRuntimeDir,
16
+ instructionFile: path.join(context.paths.geminiRuntimeDir, 'AGENTS.md'),
17
+ configFiles: [path.join(context.paths.geminiRuntimeDir, 'settings.json')],
18
+ skillsDir: context.paths.geminiSkillsDir,
19
+ requiredDirs: [
20
+ context.paths.geminiRuntimeDir,
21
+ context.paths.geminiHomeDir,
22
+ context.paths.geminiSkillsDir
23
+ ]
24
+ };
25
+ }
26
+ function generate(generation) {
27
+ const agentLayout = layout(generation.context);
28
+ const baseSettings = (0, render_settings_1.parseJsonObject)((0, render_settings_1.renderProfileConfig)(generation.env, generation.configRoot, generation.context, 'gemini-settings.json.njk', 'global/tool-templates/gemini-settings.json.njk', () => (0, defaults_1.defaultGeminiSettingsContent)(generation.context), 'Gemini settings', generation.trace), 'Gemini settings');
29
+ const existingContext = asObject(baseSettings.context);
30
+ baseSettings.context = {
31
+ ...existingContext,
32
+ fileName: ['AGENTS.md'],
33
+ includeDirectories: [agentLayout.dir, generation.context.paths.projectMemoryDir],
34
+ loadMemoryFromIncludeDirectories: true,
35
+ fileFiltering: {
36
+ ...asObject(existingContext.fileFiltering),
37
+ respectGitIgnore: false
38
+ }
39
+ };
40
+ baseSettings.mcpServers = (0, render_mcp_1.renderGeminiMcp)(generation.context);
41
+ const files = [
42
+ { path: agentLayout.instructionFile, content: generation.agentsMd },
43
+ { path: agentLayout.configFiles[0] ?? '', content: `${JSON.stringify(baseSettings, null, 2)}\n` },
44
+ ...(0, render_skills_1.renderSkillFiles)(generation.context, agentLayout.skillsDir)
45
+ ];
46
+ return { ...agentLayout, id: 'gemini', projectDir: generation.context.projectRoot, files, context: generation.context };
47
+ }
48
+ exports.geminiAdapter = {
49
+ id: 'gemini',
50
+ displayName: 'Gemini',
51
+ capabilities: {
52
+ instructions: true,
53
+ skills: true,
54
+ mcp: true,
55
+ hooks: false,
56
+ subagents: true,
57
+ headless: true
58
+ },
59
+ wrapperOptions: { sandboxed: true, network: false },
60
+ layout,
61
+ generate,
62
+ prepare(runtime) {
63
+ const sharedGeminiDir = path.join(os.homedir(), '.gemini');
64
+ const privateGeminiDir = path.join(runtime.context.paths.geminiHomeDir, '.gemini');
65
+ for (const name of [
66
+ 'settings.json',
67
+ 'oauth_creds.json',
68
+ 'google_accounts.json',
69
+ 'trustedFolders.json',
70
+ 'mcp-oauth-tokens.json',
71
+ 'a2a-oauth-tokens.json',
72
+ 'keybindings.json',
73
+ 'installation_id',
74
+ 'skills',
75
+ 'commands'
76
+ ]) {
77
+ (0, shared_state_1.linkSharedEntry)(path.join(sharedGeminiDir, name), path.join(privateGeminiDir, name), `Gemini ${name}`);
78
+ }
79
+ },
80
+ spawn(runtime, options) {
81
+ (0, shared_1.assertRuntimeFile)('gemini', runtime.instructionFile, runtime.context.profileDir);
82
+ const modeArgs = options.wrapperArgs.sandboxMode === 'danger'
83
+ ? ['--yolo']
84
+ : options.wrapperArgs.sandboxMode === 'sandboxed'
85
+ ? ['--sandbox']
86
+ : [];
87
+ const sharedTrustedFolders = path.join(os.homedir(), '.gemini', 'trustedFolders.json');
88
+ return {
89
+ command: options.binary,
90
+ args: [...modeArgs, ...options.passthroughArgs],
91
+ cwd: runtime.projectDir,
92
+ env: {
93
+ ...(0, environment_1.buildAgentEnvironment)(runtime.context),
94
+ GEMINI_CLI_HOME: runtime.context.paths.geminiHomeDir,
95
+ GEMINI_CLI_SYSTEM_SETTINGS_PATH: runtime.configFiles[0],
96
+ GEMINI_CLI_TRUSTED_FOLDERS_PATH: sharedTrustedFolders
97
+ },
98
+ onExit: (0, shared_1.withPostflight)(runtime, options.wrapperArgs)
99
+ };
100
+ },
101
+ bypassArgs(wrapperArgs) {
102
+ if (wrapperArgs.sandboxMode === 'danger') {
103
+ return ['--yolo'];
104
+ }
105
+ return wrapperArgs.sandboxMode === 'sandboxed' ? ['--sandbox'] : [];
106
+ }
107
+ };
108
+ function asObject(value) {
109
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
110
+ ? value
111
+ : {};
112
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.grokAdapter = void 0;
4
+ const os = require("os");
5
+ const path = require("path");
6
+ const render_mcp_1 = require("../config/render-mcp");
7
+ const render_settings_1 = require("../config/render-settings");
8
+ const render_skills_1 = require("../config/render-skills");
9
+ const defaults_1 = require("../defaults");
10
+ const environment_1 = require("../runtime/environment");
11
+ const shared_state_1 = require("../runtime/shared-state");
12
+ const shared_1 = require("./shared");
13
+ function layout(context) {
14
+ return {
15
+ dir: context.paths.grokRuntimeDir,
16
+ instructionFile: path.join(context.paths.grokRuntimeDir, 'AGENTS.md'),
17
+ configFiles: [path.join(context.paths.grokRuntimeDir, 'config.toml')],
18
+ skillsDir: context.paths.grokSkillsDir,
19
+ requiredDirs: [context.paths.grokRuntimeDir, context.paths.grokSkillsDir]
20
+ };
21
+ }
22
+ function generate(generation) {
23
+ const agentLayout = layout(generation.context);
24
+ const baseConfig = (0, render_settings_1.renderProfileConfig)(generation.env, generation.configRoot, generation.context, 'grok-config.toml.njk', 'global/tool-templates/grok-config.toml.njk', () => (0, defaults_1.defaultGrokConfigContent)(), 'Grok config.toml', generation.trace);
25
+ const mcp = (0, render_mcp_1.renderGrokMcp)(generation.context);
26
+ const files = [
27
+ { path: agentLayout.instructionFile, content: generation.agentsMd },
28
+ { path: agentLayout.configFiles[0] ?? '', content: `${baseConfig.trimEnd()}${mcp ? `\n\n${mcp}` : '\n'}` },
29
+ ...(0, render_skills_1.renderSkillFiles)(generation.context, agentLayout.skillsDir)
30
+ ];
31
+ return { ...agentLayout, id: 'grok', projectDir: generation.context.projectRoot, files, context: generation.context };
32
+ }
33
+ exports.grokAdapter = {
34
+ id: 'grok',
35
+ displayName: 'Grok',
36
+ capabilities: {
37
+ instructions: true,
38
+ skills: true,
39
+ mcp: true,
40
+ hooks: true,
41
+ subagents: true,
42
+ headless: true
43
+ },
44
+ wrapperOptions: { sandboxed: true, network: false },
45
+ layout,
46
+ generate,
47
+ prepare(runtime) {
48
+ for (const name of ['auth.json', 'mcp_credentials.json']) {
49
+ (0, shared_state_1.linkSharedEntry)(path.join(os.homedir(), '.grok', name), path.join(runtime.dir, name), `Grok ${name}`);
50
+ }
51
+ },
52
+ spawn(runtime, options) {
53
+ (0, shared_1.assertRuntimeFile)('grok', runtime.instructionFile, runtime.context.profileDir);
54
+ const modeArgs = options.wrapperArgs.sandboxMode === 'danger'
55
+ ? ['--always-approve']
56
+ : options.wrapperArgs.sandboxMode === 'sandboxed'
57
+ ? ['--sandbox', 'workspace']
58
+ : [];
59
+ return {
60
+ command: options.binary,
61
+ args: [...modeArgs, ...options.passthroughArgs],
62
+ cwd: runtime.projectDir,
63
+ env: { ...(0, environment_1.buildAgentEnvironment)(runtime.context), GROK_HOME: runtime.dir },
64
+ onExit: (0, shared_1.withPostflight)(runtime, options.wrapperArgs)
65
+ };
66
+ },
67
+ bypassArgs(wrapperArgs) {
68
+ if (wrapperArgs.sandboxMode === 'danger') {
69
+ return ['--always-approve'];
70
+ }
71
+ return wrapperArgs.sandboxMode === 'sandboxed' ? ['--sandbox', 'workspace'] : [];
72
+ }
73
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.agentRegistry = void 0;
4
+ exports.getAgentAdapter = getAgentAdapter;
5
+ exports.listAgentAdapters = listAgentAdapters;
6
+ exports.enabledAgentAdapters = enabledAgentAdapters;
7
+ const claude_1 = require("./claude");
8
+ const codex_1 = require("./codex");
9
+ const gemini_1 = require("./gemini");
10
+ const grok_1 = require("./grok");
11
+ const types_1 = require("./types");
12
+ exports.agentRegistry = {
13
+ codex: codex_1.codexAdapter,
14
+ claude: claude_1.claudeAdapter,
15
+ gemini: gemini_1.geminiAdapter,
16
+ grok: grok_1.grokAdapter
17
+ };
18
+ function getAgentAdapter(id) {
19
+ return exports.agentRegistry[id];
20
+ }
21
+ function listAgentAdapters() {
22
+ return types_1.AGENT_IDS.map((id) => exports.agentRegistry[id]);
23
+ }
24
+ function enabledAgentAdapters(context) {
25
+ return listAgentAdapters().filter((adapter) => context.tools[adapter.id]);
26
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertRuntimeFile = assertRuntimeFile;
4
+ exports.withPostflight = withPostflight;
5
+ const fs = require("fs");
6
+ const postflight_1 = require("../runtime/postflight");
7
+ function assertRuntimeFile(tool, filePath, profileDir) {
8
+ if (fs.existsSync(filePath)) {
9
+ return;
10
+ }
11
+ process.stderr.write(`agent-run: no ${tool} config found for this project: ${profileDir}\n`);
12
+ process.stderr.write(`agent-run: run \`agent-run ${tool} --none\` to bypass agent setup, or \`agent-run ${tool} --create\` to create profile files.\n`);
13
+ process.exit(1);
14
+ }
15
+ function withPostflight(runtime, wrapperArgs) {
16
+ return (code) => (0, postflight_1.postflightProjectCheck)(runtime.context, wrapperArgs.local, code);
17
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AGENT_IDS = void 0;
4
+ exports.AGENT_IDS = ['codex', 'claude', 'gemini', 'grok'];