@technomoron/agent-run 0.99.28 → 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.
Files changed (43) hide show
  1. package/CHANGES +26 -0
  2. package/README.md +202 -26
  3. package/dist/agents/claude.js +93 -0
  4. package/dist/agents/codex.js +77 -0
  5. package/dist/agents/gemini.js +112 -0
  6. package/dist/agents/grok.js +73 -0
  7. package/dist/agents/registry.js +26 -0
  8. package/dist/agents/shared.js +17 -0
  9. package/dist/agents/types.js +4 -0
  10. package/dist/checks.js +4 -0
  11. package/dist/cli.js +45 -12
  12. package/dist/commands.js +72 -18
  13. package/dist/config/render-instructions.js +54 -0
  14. package/dist/config/render-mcp.js +88 -0
  15. package/dist/config/render-settings.js +35 -0
  16. package/dist/config/render-skills.js +51 -0
  17. package/dist/config-tree.js +249 -0
  18. package/dist/constants.js +5 -2
  19. package/dist/defaults.js +65 -8
  20. package/dist/manifest.js +39 -2
  21. package/dist/renderer.js +81 -227
  22. package/dist/runtime/environment.js +17 -0
  23. package/dist/runtime/postflight.js +40 -0
  24. package/dist/runtime/shared-state.js +44 -0
  25. package/dist/runtime/spawn-agent.js +7 -0
  26. package/dist/templates.js +12 -0
  27. package/examples/basic-config/README.md +2 -1
  28. package/examples/basic-config/agent-config/agent-run.defaults.jsonc +8 -2
  29. package/examples/basic-config/agent-config/global/tool-templates/AGENTS.md.njk +2 -0
  30. package/examples/basic-config/agent-config/global/tool-templates/CLAUDE.md.njk +1 -0
  31. package/examples/basic-config/agent-config/global/tool-templates/claude-settings.json.njk +2 -0
  32. package/examples/basic-config/agent-config/global/tool-templates/codex-config.toml.njk +2 -1
  33. package/examples/basic-config/agent-config/global/tool-templates/gemini-settings.json.njk +5 -0
  34. package/examples/basic-config/agent-config/global/tool-templates/grok-config.toml.njk +1 -0
  35. package/examples/basic-config/agent-config/starter/basic-project/agent-run.jsonc +20 -0
  36. package/examples/basic-config/agent-config/starter/basic-project/notes/memory/README.md +8 -0
  37. package/examples/basic-config/agent-config/starter/basic-project/overrides/claude-settings.json.njk +2 -0
  38. package/examples/basic-config/agent-config/starter/basic-project/overrides/codex-config.toml.njk +2 -1
  39. package/ops/systemd/ai-tools-update.service +1 -1
  40. package/package.json +1 -1
  41. package/scripts/install-systemd-jobs.sh +15 -5
  42. package/scripts/update-ai-tools.sh +27 -16
  43. package/dist/tools.js +0 -119
package/CHANGES CHANGED
@@ -1,6 +1,32 @@
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
+
17
+ Version 0.99.29 (2026-09-04)
18
+ ----------------------------
19
+ * Add tracked per-profile project memory under `notes/memory`, while keeping
20
+ native Codex memories in ignored machine-local runtime state.
21
+ * Detect older memory layouts before profile updates and agent launches, ask
22
+ before staging tracked moves with `git mv`, and support
23
+ `migrate-config --yes` for non-interactive migrations.
24
+ * Make copied systemd updater files portable, install the helper under
25
+ `/usr/local/libexec`, and remove stale AI tool launchers before global
26
+ package updates.
27
+ * Explain the shared configuration model for native coding agents in the
28
+ README.
29
+
4
30
  Version 0.99.28 (2026-08-30)
5
31
  ----------------------------
6
32
  * Add interactive `agent-run setup [org/repo]`, make `agent-run generate` the
package/README.md CHANGED
@@ -1,9 +1,46 @@
1
1
  # agent-run
2
2
 
3
- Small wrapper for AI coding CLIs like Codex and Claude.
3
+ **Config once. Run with any native coding agent.**
4
4
 
5
- It keeps agent files out of normal repos and stores them in a separate
6
- agent config tree. By default, that tree lives at `~/.agent-run`.
5
+ `agent-run` lets you manage Codex, Claude Code, Gemini CLI, and Grok Build from
6
+ one shared configuration system while continuing to use each vendor's native
7
+ agent.
8
+
9
+ Keep agent configuration in a separate Git repository instead of adding
10
+ agent-specific files to every codebase. Define project instructions, skills,
11
+ MCP servers, policies, and reusable configuration fragments once, then generate
12
+ the native configuration each agent expects.
13
+
14
+ Configuration is template-based using Nunjucks/Jinja-style templates, making it
15
+ easy to build hierarchical setups from global defaults, organization rules,
16
+ project-specific settings, reusable fragments, and local overrides.
17
+
18
+ `agent-run` generates isolated agent runtimes outside the source repository, so
19
+ application repositories remain clean and developers do not have to maintain
20
+ separate `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, skills, and tool configuration
21
+ for every agent.
22
+
23
+ The core idea is simple:
24
+
25
+ **One configuration repository. One set of skills. Multiple native agents.**
26
+
27
+ ```text
28
+ shared config repository
29
+ ↓
30
+ global + project + local templates
31
+ ↓
32
+ canonical instructions / skills / MCP
33
+ ↓
34
+ agent-specific generated runtime
35
+ ↓
36
+ Codex | Claude Code | Gemini CLI | Grok Build
37
+ ```
38
+
39
+ The native agents remain native. `agent-run` does not replace their execution
40
+ engines, authentication, models, or tooling. It provides the portable
41
+ configuration layer around them.
42
+
43
+ **Config once, run anywhere.**
7
44
 
8
45
  ## Model
9
46
 
@@ -23,15 +60,27 @@ Example:
23
60
  agent-run.jsonc
24
61
  local.md.njk # optional
25
62
  overrides/ # optional
63
+ notes/
64
+ memory/
65
+ README.md # durable project memory, normally tracked
26
66
  live/
27
67
  CLAUDE.md
28
- .claude/
68
+ .claude/ # Claude settings, MCP, and skills
29
69
  bin/
30
70
  memories/
31
71
  codex-home/
32
72
  AGENTS.md
33
73
  config.toml
74
+ memories/ # native Codex memory, local generated state
34
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/
35
84
  ~/source/org/my-api/
36
85
  ```
37
86
 
@@ -50,15 +99,43 @@ the agent config tree.
50
99
  - `agent-run.jsonc`: sparse profile manifest and profile-discovery marker
51
100
  - `local.md.njk`: optional project-specific instructions
52
101
  - `overrides/`: optional per-profile template overrides
102
+ - `notes/memory/`: durable project memory shared through the config repository
53
103
  - `live/memories/codex-home/AGENTS.md`: generated Codex instructions
54
104
  - `live/memories/codex-home/config.toml`: generated Codex config
55
105
  - `live/memories/codex-home/skills/`: generated Codex skills
56
106
  - `live/CLAUDE.md`: generated Claude instructions
57
- - `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
58
113
 
59
114
  Edit only the root defaults and profile overrides that differ. `agent-run` keeps
60
115
  generated files in sync.
61
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
+
62
139
  ## Manifest Defaults
63
140
 
64
141
  Manifest values are resolved in this order:
@@ -78,6 +155,48 @@ A profile with no differences from the root defaults needs only this marker:
78
155
  {}
79
156
  ```
80
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
+
81
200
  `local.md.njk` and `overrides/` are not created unless they contain actual
82
201
  profile-specific configuration.
83
202
 
@@ -136,11 +255,11 @@ Global flag:
136
255
  - `-v`, `--verbose`: print path resolution, file creation, include expansion,
137
256
  generated file writes, and spawned commands
138
257
 
139
- `agent-run codex --help` and `agent-run claude --help` still pass `--help`
140
- 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.
141
260
 
142
- For `codex` and `claude`, use `--generate` to generate profile files without
143
- launching the underlying tool.
261
+ For any native agent command, use `--generate` to generate profile files
262
+ without launching the underlying tool.
144
263
 
145
264
  Codex defaults to `-a on-request -s workspace-write`. `agent-run` sets
146
265
  `CODEX_HOME` under the private agent directory, where Codex discovers the
@@ -152,6 +271,26 @@ When `~/.codex/auth.json` exists, profile-specific Codex homes link their
152
271
  `auth.json` to that shared login cache so changing profiles does not require a
153
272
  new ChatGPT login.
154
273
 
274
+ ### Project Memory
275
+
276
+ Each profile has a durable `notes/memory/` directory outside the source repo.
277
+ `README.md` is a short index; agents read only the linked files relevant to the
278
+ current task. Agents may update project memory only when the user explicitly
279
+ asks them to remember or update something for that project.
280
+
281
+ Codex's native `$CODEX_HOME/memories/` remains under ignored `live/` state. It
282
+ is generated, machine-local recall data and is not copied into the tracked
283
+ project memory directory. Project memory is plain Markdown so it can be
284
+ reviewed and shared through the Git repository that normally holds the
285
+ `.agent-run` config tree.
286
+
287
+ When a profile still uses `memory/`, loose `memory*.md` files, or Markdown files
288
+ directly under the old `memories/` directory, agent-run detects the old layout
289
+ before updating or launching an agent. If those files are tracked, agent-run
290
+ shows the moves and asks before staging them with `git mv`. In a non-Git config
291
+ tree, or for untracked files, it uses ordinary filesystem moves. Non-interactive
292
+ runs stop with a command that can confirm the migration explicitly.
293
+
155
294
  Claude Code currently has no `--cd` equivalent. `agent-run` keeps Claude's
156
295
  process cwd at the project root, appends the generated `CLAUDE.md` with
157
296
  `--append-system-prompt-file`, passes generated settings with `--settings`, and
@@ -160,17 +299,38 @@ replace the user's normal `CLAUDE_CONFIG_DIR`. If Claude writes remembered
160
299
  permissions to `.claude/settings.local.json`, `agent-run` removes that file
161
300
  after the session unless `--local` was used.
162
301
 
163
- `--yolo` runs either tool unattended, with no approval prompts: Codex with
164
- `-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`.
165
319
  Only use it when the agent may change or delete anything it can reach. Claude
166
320
  refuses `--dangerously-skip-permissions` when it runs as root, so run it as a
167
- normal user. `--sandboxed` and `--network` stay Codex-only because Claude has no
168
- 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.
169
328
 
170
- By default, `agent-run codex` and `agent-run claude` fail when local AI files
171
- such as `AGENTS.md`, `CLAUDE.md`, `CLAUDE.local.md`, `.mcp.json`, `.agents`,
172
- `.claude`, or `.codex` are present inside the project repository. Use `--local`
173
- to warn and continue for a specific invocation.
329
+ Show the native capability matrix:
330
+
331
+ ```sh
332
+ agent-run status
333
+ ```
174
334
 
175
335
  Initialize mapped files for the current repo:
176
336
 
@@ -216,6 +376,8 @@ You can also generate from a tool command and stop before launch:
216
376
  ```sh
217
377
  agent-run codex --generate
218
378
  agent-run claude --generate
379
+ agent-run gemini --generate
380
+ agent-run grok --generate
219
381
  ```
220
382
 
221
383
  This reads the root defaults, sparse profile manifest, and Nunjucks templates,
@@ -226,12 +388,16 @@ then rewrites generated files:
226
388
  - `live/memories/codex-home/config.toml`
227
389
  - `live/memories/codex-home/skills/**`
228
390
  - `live/.claude/**`
391
+ - `live/gemini/**`
392
+ - `live/grok/**`
229
393
  - `live/bin/**`
230
394
 
231
395
  Per-profile override templates can be placed in:
232
396
 
233
397
  - `overrides/codex-config.toml.njk`
234
398
  - `overrides/claude-settings.json.njk`
399
+ - `overrides/gemini-settings.json.njk`
400
+ - `overrides/grok-config.toml.njk`
235
401
 
236
402
  ## Default Config Tree
237
403
 
@@ -274,8 +440,9 @@ This reports:
274
440
 
275
441
  - local AI files accidentally present in the source repo
276
442
  - missing mapped files
277
- - stale generated Codex instructions or config
278
- - 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
279
446
  - profile resolution problems
280
447
 
281
448
  Check every repo under a source tree:
@@ -287,14 +454,17 @@ agent-run check --all ~/source
287
454
  Migrate an existing config tree to the manifest/template layout:
288
455
 
289
456
  ```sh
290
- agent-run migrate-config ~/.agent-run
457
+ agent-run migrate-config --yes ~/.agent-run
291
458
  ```
292
459
 
293
460
  This preserves `AGENTS-MODS.md`, creates `local.md.njk` and a sparse
294
461
  `agent-run.jsonc` marker for legacy profiles, creates the root defaults and
295
462
  `global/` templates, moves loose review files into `reviews/`, moves loose
296
- `memory*.md` files into `memories/`, and moves old Codex runtime files into
297
- `live/memories/codex-home` without overwriting existing files.
463
+ project memory files into each profile's `notes/memory/`, and moves old Codex
464
+ runtime files into `live/memories/codex-home` without overwriting existing
465
+ files. Use `--yes` to confirm tracked `git mv` operations in a non-interactive
466
+ run. Omit `--yes` to review and confirm tracked moves interactively. The
467
+ command stages moves but never commits them.
298
468
 
299
469
  ## Systemd Jobs
300
470
 
@@ -307,14 +477,20 @@ sudo scripts/install-systemd-jobs.sh --ai-tools
307
477
  ```
308
478
 
309
479
  This installs and enables `ai-tools-update.timer`, which runs hourly. The
310
- 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:
311
484
 
312
485
  ```text
313
- 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"
314
- AI_TOOLS_PNPM_PACKAGE="pnpm@latest"
315
- 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
316
489
  ```
317
490
 
491
+ The optional apt package list still defaults to `gh` and can be changed with
492
+ `AI_TOOLS_APT_PACKAGES`.
493
+
318
494
  ## Login Warning
319
495
 
320
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
+ }