@warlock.js/ai-cli 0.0.0-stage → 5.31.0

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 (139) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LICENSE +21 -0
  3. package/README.md +69 -2
  4. package/cjs/index.cjs +4576 -0
  5. package/cjs/index.cjs.map +1 -0
  6. package/esm/adapters/aider.d.mts +41 -0
  7. package/esm/adapters/aider.d.mts.map +1 -0
  8. package/esm/adapters/aider.mjs +294 -0
  9. package/esm/adapters/aider.mjs.map +1 -0
  10. package/esm/adapters/amp.d.mts +33 -0
  11. package/esm/adapters/amp.d.mts.map +1 -0
  12. package/esm/adapters/amp.mjs +119 -0
  13. package/esm/adapters/amp.mjs.map +1 -0
  14. package/esm/adapters/antigravity.d.mts +37 -0
  15. package/esm/adapters/antigravity.d.mts.map +1 -0
  16. package/esm/adapters/antigravity.mjs +235 -0
  17. package/esm/adapters/antigravity.mjs.map +1 -0
  18. package/esm/adapters/claude-code.d.mts +30 -0
  19. package/esm/adapters/claude-code.d.mts.map +1 -0
  20. package/esm/adapters/claude-code.mjs +121 -0
  21. package/esm/adapters/claude-code.mjs.map +1 -0
  22. package/esm/adapters/claude-stream.d.mts +32 -0
  23. package/esm/adapters/claude-stream.d.mts.map +1 -0
  24. package/esm/adapters/claude-stream.mjs +140 -0
  25. package/esm/adapters/claude-stream.mjs.map +1 -0
  26. package/esm/adapters/codex.d.mts +37 -0
  27. package/esm/adapters/codex.d.mts.map +1 -0
  28. package/esm/adapters/codex.mjs +320 -0
  29. package/esm/adapters/codex.mjs.map +1 -0
  30. package/esm/adapters/copilot.d.mts +35 -0
  31. package/esm/adapters/copilot.d.mts.map +1 -0
  32. package/esm/adapters/copilot.mjs +244 -0
  33. package/esm/adapters/copilot.mjs.map +1 -0
  34. package/esm/adapters/cursor.d.mts +35 -0
  35. package/esm/adapters/cursor.d.mts.map +1 -0
  36. package/esm/adapters/cursor.mjs +203 -0
  37. package/esm/adapters/cursor.mjs.map +1 -0
  38. package/esm/adapters/droid.d.mts +32 -0
  39. package/esm/adapters/droid.d.mts.map +1 -0
  40. package/esm/adapters/droid.mjs +183 -0
  41. package/esm/adapters/droid.mjs.map +1 -0
  42. package/esm/adapters/grok.d.mts +32 -0
  43. package/esm/adapters/grok.d.mts.map +1 -0
  44. package/esm/adapters/grok.mjs +199 -0
  45. package/esm/adapters/grok.mjs.map +1 -0
  46. package/esm/adapters/index.d.mts +16 -0
  47. package/esm/adapters/index.mjs +18 -0
  48. package/esm/adapters/kimi.d.mts +34 -0
  49. package/esm/adapters/kimi.d.mts.map +1 -0
  50. package/esm/adapters/kimi.mjs +162 -0
  51. package/esm/adapters/kimi.mjs.map +1 -0
  52. package/esm/adapters/mistral-vibe.d.mts +32 -0
  53. package/esm/adapters/mistral-vibe.d.mts.map +1 -0
  54. package/esm/adapters/mistral-vibe.mjs +252 -0
  55. package/esm/adapters/mistral-vibe.mjs.map +1 -0
  56. package/esm/adapters/opencode.d.mts +36 -0
  57. package/esm/adapters/opencode.d.mts.map +1 -0
  58. package/esm/adapters/opencode.mjs +219 -0
  59. package/esm/adapters/opencode.mjs.map +1 -0
  60. package/esm/adapters/qwen-code.d.mts +30 -0
  61. package/esm/adapters/qwen-code.d.mts.map +1 -0
  62. package/esm/adapters/qwen-code.mjs +94 -0
  63. package/esm/adapters/qwen-code.mjs.map +1 -0
  64. package/esm/adapters/reasonix.d.mts +31 -0
  65. package/esm/adapters/reasonix.d.mts.map +1 -0
  66. package/esm/adapters/reasonix.mjs +250 -0
  67. package/esm/adapters/reasonix.mjs.map +1 -0
  68. package/esm/adapters/shared.d.mts +78 -0
  69. package/esm/adapters/shared.d.mts.map +1 -0
  70. package/esm/adapters/shared.mjs +161 -0
  71. package/esm/adapters/shared.mjs.map +1 -0
  72. package/esm/cli-agent.d.mts +40 -0
  73. package/esm/cli-agent.d.mts.map +1 -0
  74. package/esm/cli-agent.mjs +207 -0
  75. package/esm/cli-agent.mjs.map +1 -0
  76. package/esm/cli.d.mts +53 -0
  77. package/esm/cli.d.mts.map +1 -0
  78. package/esm/cli.mjs +61 -0
  79. package/esm/cli.mjs.map +1 -0
  80. package/esm/contracts/adapter.contract.d.mts +154 -0
  81. package/esm/contracts/adapter.contract.d.mts.map +1 -0
  82. package/esm/contracts/events.type.d.mts +111 -0
  83. package/esm/contracts/events.type.d.mts.map +1 -0
  84. package/esm/contracts/index.d.mts +4 -0
  85. package/esm/contracts/mcp.type.d.mts +29 -0
  86. package/esm/contracts/mcp.type.d.mts.map +1 -0
  87. package/esm/contracts/options.type.d.mts +87 -0
  88. package/esm/contracts/options.type.d.mts.map +1 -0
  89. package/esm/errors.d.mts +46 -0
  90. package/esm/errors.d.mts.map +1 -0
  91. package/esm/errors.mjs +32 -0
  92. package/esm/errors.mjs.map +1 -0
  93. package/esm/index.d.mts +31 -0
  94. package/esm/index.mjs +28 -0
  95. package/esm/model/cli-model.d.mts +48 -0
  96. package/esm/model/cli-model.d.mts.map +1 -0
  97. package/esm/model/cli-model.mjs +133 -0
  98. package/esm/model/cli-model.mjs.map +1 -0
  99. package/esm/probe/probe.d.mts +18 -0
  100. package/esm/probe/probe.d.mts.map +1 -0
  101. package/esm/probe/probe.mjs +148 -0
  102. package/esm/probe/probe.mjs.map +1 -0
  103. package/esm/session/aggregate.mjs +86 -0
  104. package/esm/session/aggregate.mjs.map +1 -0
  105. package/esm/session/environment.mjs +71 -0
  106. package/esm/session/environment.mjs.map +1 -0
  107. package/esm/session/run-directory.mjs +74 -0
  108. package/esm/session/run-directory.mjs.map +1 -0
  109. package/esm/session/session.mjs +188 -0
  110. package/esm/session/session.mjs.map +1 -0
  111. package/esm/spawn/invocation.d.mts +35 -0
  112. package/esm/spawn/invocation.d.mts.map +1 -0
  113. package/esm/spawn/invocation.mjs +76 -0
  114. package/esm/spawn/invocation.mjs.map +1 -0
  115. package/esm/spawn/process-tree.mjs +57 -0
  116. package/esm/spawn/process-tree.mjs.map +1 -0
  117. package/esm/spawn/resolve-command.d.mts +73 -0
  118. package/esm/spawn/resolve-command.d.mts.map +1 -0
  119. package/esm/spawn/resolve-command.mjs +109 -0
  120. package/esm/spawn/resolve-command.mjs.map +1 -0
  121. package/esm/stream/event-log.mjs +52 -0
  122. package/esm/stream/event-log.mjs.map +1 -0
  123. package/esm/stream/json-lines.d.mts +33 -0
  124. package/esm/stream/json-lines.d.mts.map +1 -0
  125. package/esm/stream/json-lines.mjs +65 -0
  126. package/esm/stream/json-lines.mjs.map +1 -0
  127. package/esm/stream/line-splitter.mjs +53 -0
  128. package/esm/stream/line-splitter.mjs.map +1 -0
  129. package/esm/utils/toml.d.mts +22 -0
  130. package/esm/utils/toml.d.mts.map +1 -0
  131. package/esm/utils/toml.mjs +53 -0
  132. package/esm/utils/toml.mjs.map +1 -0
  133. package/llms-full.txt +373 -0
  134. package/llms.txt +10 -0
  135. package/package.json +39 -4
  136. package/skills/README.md +13 -0
  137. package/skills/index.md +22 -0
  138. package/skills/run-cli-agents/SKILL.md +186 -0
  139. package/skills/write-a-cli-adapter/SKILL.md +173 -0
@@ -0,0 +1,41 @@
1
+ import { CliAdapter, CliLaunchContext, CliStreamParser } from "../contracts/adapter.contract.mjs";
2
+ //#region ../../packages/ai-cli/src/adapters/aider.d.ts
3
+ /**
4
+ * Aider (`aider`, PyPI `aider-chat`).
5
+ *
6
+ * Verified against the official docs (`aider.chat/docs/scripting.html`,
7
+ * `/docs/config/options.html`, `/docs/config/reasoning.html`) and the
8
+ * source at tag v0.86.2 (`aider/main.py`, `aider/args.py`,
9
+ * `aider/coders/base_coder.py`, `aider/analytics.py`); Aider needs Python
10
+ * 3.10+, so no real `--help` was run, 2026-10-17. The capability probe
11
+ * checks every flag against the installed `--help`.
12
+ *
13
+ * - Headless: `aider --message <text>` (or `--message-file`). Aider has **no
14
+ * machine-readable output**: the parser reads the plain-text stdout —
15
+ * startup banner (`Main model: …`), the reply, the usage line
16
+ * (`Tokens: 2.4k sent, 61 received. Cost: $0.0081 message, …`),
17
+ * `Applied edit to <path>` (reported as an `edit` tool call) and
18
+ * `Commit <hash> <message>`. Exact token counts and cost come from the
19
+ * local `--analytics-log` file (`message_send` events), read when the
20
+ * stream ends.
21
+ * - Aider exits 0 even when the model call fails, so `litellm.*Error` lines
22
+ * and the "not able to authenticate you" notice are reported as fatal.
23
+ * - Permissions: Aider applies edits without approval and, headless with
24
+ * `--yes-always`, never runs the shell commands it suggests; there is no
25
+ * stricter or looser mode, so `standard` and `bypass` behave the same.
26
+ * Auto-commits are turned off (`--no-auto-commits`); pass
27
+ * `args: ["--auto-commits"]` to keep them.
28
+ * - No session ids (`resume` is refused) and no MCP. Chat and input
29
+ * history are written to the run directory, not the repository.
30
+ * - Home: Aider uses `HOME`; provider keys use their own variables
31
+ * (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, …) via `env`. Always pass
32
+ * `model` — without one Aider may start an interactive OAuth flow.
33
+ */
34
+ declare const aiderAdapter: CliAdapter;
35
+ /** `2.4k` → 2400, `12k` → 12000, `61` → 61. */
36
+ declare function parseAiderCount(value: string | undefined): number | undefined;
37
+ /** Parser for Aider's plain-text stdout (plus its analytics log). */
38
+ declare function createAiderParser(context?: CliLaunchContext): CliStreamParser;
39
+ //#endregion
40
+ export { aiderAdapter, createAiderParser, parseAiderCount };
41
+ //# sourceMappingURL=aider.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aider.d.mts","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/aider.ts"],"mappings":";;;;;AA8CA;;;;AA+FC;AAGD;;;;AAAyD;AA8EzD;;;;;;;;AAA8E;;;;;;;;;;cAhLjE,YAAA,EAAc,UA+F1B;;iBAGe,eAAA,CAAgB,KAAyB;;iBA8EzC,iBAAA,CAAkB,OAAA,GAAU,gBAAA,GAAmB,eAAe"}
@@ -0,0 +1,294 @@
1
+ import { numberField, parseJsonLine, recordField, stringField } from "../stream/json-lines.mjs";
2
+ import { argvPrompt, mapEffort, promptFile, unsupportedOption, usageOf } from "./shared.mjs";
3
+ import { readFileSync } from "node:fs";
4
+ import path from "node:path";
5
+
6
+ //#region ../../packages/ai-cli/src/adapters/aider.ts
7
+ /** Local analytics log the adapter asks Aider to write (exact token counts). */
8
+ const ANALYTICS_LOG = "aider-analytics.jsonl";
9
+ /**
10
+ * Aider (`aider`, PyPI `aider-chat`).
11
+ *
12
+ * Verified against the official docs (`aider.chat/docs/scripting.html`,
13
+ * `/docs/config/options.html`, `/docs/config/reasoning.html`) and the
14
+ * source at tag v0.86.2 (`aider/main.py`, `aider/args.py`,
15
+ * `aider/coders/base_coder.py`, `aider/analytics.py`); Aider needs Python
16
+ * 3.10+, so no real `--help` was run, 2026-10-17. The capability probe
17
+ * checks every flag against the installed `--help`.
18
+ *
19
+ * - Headless: `aider --message <text>` (or `--message-file`). Aider has **no
20
+ * machine-readable output**: the parser reads the plain-text stdout —
21
+ * startup banner (`Main model: …`), the reply, the usage line
22
+ * (`Tokens: 2.4k sent, 61 received. Cost: $0.0081 message, …`),
23
+ * `Applied edit to <path>` (reported as an `edit` tool call) and
24
+ * `Commit <hash> <message>`. Exact token counts and cost come from the
25
+ * local `--analytics-log` file (`message_send` events), read when the
26
+ * stream ends.
27
+ * - Aider exits 0 even when the model call fails, so `litellm.*Error` lines
28
+ * and the "not able to authenticate you" notice are reported as fatal.
29
+ * - Permissions: Aider applies edits without approval and, headless with
30
+ * `--yes-always`, never runs the shell commands it suggests; there is no
31
+ * stricter or looser mode, so `standard` and `bypass` behave the same.
32
+ * Auto-commits are turned off (`--no-auto-commits`); pass
33
+ * `args: ["--auto-commits"]` to keep them.
34
+ * - No session ids (`resume` is refused) and no MCP. Chat and input
35
+ * history are written to the run directory, not the repository.
36
+ * - Home: Aider uses `HOME`; provider keys use their own variables
37
+ * (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, …) via `env`. Always pass
38
+ * `model` — without one Aider may start an interactive OAuth flow.
39
+ */
40
+ const aiderAdapter = {
41
+ name: "aider",
42
+ title: "Aider",
43
+ command: "aider",
44
+ apiKeyEnv: [],
45
+ homeEnv: ["HOME", "USERPROFILE"],
46
+ transports: ["argv", "file"],
47
+ effort: true,
48
+ mcp: false,
49
+ probe: {
50
+ help: [["--help"]],
51
+ version: ["--version"]
52
+ },
53
+ verification: {
54
+ version: "0.86.2",
55
+ verifiedBy: "docs",
56
+ sources: [
57
+ "https://aider.chat/docs/scripting.html",
58
+ "https://aider.chat/docs/config/options.html",
59
+ "https://aider.chat/docs/config/reasoning.html",
60
+ "https://github.com/Aider-AI/aider/tree/v0.86.2"
61
+ ],
62
+ checkedAt: "2026-10-17"
63
+ },
64
+ plan(context) {
65
+ if (context.resume !== void 0) throw unsupportedOption(aiderAdapter, "Aider has no session ids, so `resume` is not supported.");
66
+ const args = [
67
+ "--yes-always",
68
+ "--no-pretty",
69
+ "--no-stream",
70
+ "--no-fancy-input",
71
+ "--no-auto-commits",
72
+ "--no-check-update",
73
+ "--no-show-release-notes",
74
+ "--no-analytics",
75
+ "--no-show-model-warnings",
76
+ "--no-gitignore",
77
+ "--analytics-log",
78
+ path.join(context.runDir, ANALYTICS_LOG),
79
+ "--chat-history-file",
80
+ path.join(context.runDir, "chat-history.md"),
81
+ "--input-history-file",
82
+ path.join(context.runDir, "input-history")
83
+ ];
84
+ const requires = [
85
+ "--yes-always",
86
+ "--no-pretty",
87
+ "--no-stream",
88
+ "--no-auto-commits",
89
+ "--analytics-log",
90
+ "--chat-history-file",
91
+ "--input-history-file"
92
+ ];
93
+ const files = [];
94
+ let tail;
95
+ if (context.model !== void 0) {
96
+ args.push("--model", context.model);
97
+ requires.push("--model");
98
+ }
99
+ if (context.effort !== void 0) {
100
+ args.push("--reasoning-effort", mapEffort(context.effort, {
101
+ low: "low",
102
+ medium: "medium",
103
+ high: "high"
104
+ }));
105
+ requires.push("--reasoning-effort");
106
+ }
107
+ if (context.transport === "file") {
108
+ const prompt = promptFile(context);
109
+ files.push(prompt);
110
+ tail = ["--message-file", prompt.path];
111
+ requires.push("--message-file");
112
+ } else {
113
+ tail = ["--message", argvPrompt(context.prompt)];
114
+ requires.push("--message");
115
+ }
116
+ return {
117
+ args,
118
+ tail,
119
+ env: {
120
+ ...context.home !== void 0 ? {
121
+ HOME: context.home,
122
+ USERPROFILE: context.home
123
+ } : {},
124
+ TERM: "dumb"
125
+ },
126
+ files,
127
+ requires
128
+ };
129
+ },
130
+ parser: createAiderParser
131
+ };
132
+ /** `2.4k` → 2400, `12k` → 12000, `61` → 61. */
133
+ function parseAiderCount(value) {
134
+ if (value === void 0) return;
135
+ const match = /^([\d.]+)(k|M)?$/.exec(value.trim());
136
+ if (!match) return;
137
+ const number = Number(match[1]);
138
+ const scale = match[2] === "k" ? 1e3 : match[2] === "M" ? 1e6 : 1;
139
+ return Number.isFinite(number) ? Math.round(number * scale) : void 0;
140
+ }
141
+ const TOKENS_LINE = /^Tokens: ([\d.]+[kM]?) sent(?:, ([\d.]+[kM]?) cache write)?(?:, ([\d.]+[kM]?) cache hit)?, ([\d.]+[kM]?) received\.(?:\s+Cost: \$([\d.]+) message, \$([\d.]+) session\.)?/;
142
+ const BANNER = [
143
+ /^Aider v\d/,
144
+ /^Main model: /,
145
+ /^Weak model: /,
146
+ /^Editor model: /,
147
+ /^Model: /,
148
+ /^Git repo: /,
149
+ /^Repo-map: /,
150
+ /^Added .+ to the chat\.$/,
151
+ /^Cost: \$[\d.]+ message, \$[\d.]+ session\.$/,
152
+ /^Use \/help /
153
+ ];
154
+ /** Usage from the analytics log (`message_send` events), summed. */
155
+ function analyticsUsage(context) {
156
+ if (context === void 0) return;
157
+ let content;
158
+ try {
159
+ content = readFileSync(path.join(context.runDir, ANALYTICS_LOG), "utf8");
160
+ } catch {
161
+ return;
162
+ }
163
+ let input = 0;
164
+ let output = 0;
165
+ let cost;
166
+ let seen = false;
167
+ for (const line of content.split(/\r?\n/)) {
168
+ const record = parseJsonLine(line);
169
+ if (stringField(record, "event") !== "message_send") continue;
170
+ const properties = recordField(record, "properties");
171
+ seen = true;
172
+ input += numberField(properties, "prompt_tokens") ?? 0;
173
+ output += numberField(properties, "completion_tokens") ?? 0;
174
+ const messageCost = numberField(properties, "cost");
175
+ if (messageCost !== void 0) cost = (cost ?? 0) + messageCost;
176
+ }
177
+ return seen ? {
178
+ type: "usage",
179
+ cumulative: true,
180
+ usage: usageOf({
181
+ input,
182
+ output,
183
+ costUSD: cost
184
+ })
185
+ } : void 0;
186
+ }
187
+ /** Parser for Aider's plain-text stdout (plus its analytics log). */
188
+ function createAiderParser(context) {
189
+ let started = false;
190
+ let body = [];
191
+ const flush = () => {
192
+ const text = body.join("\n").trim();
193
+ body = [];
194
+ return text.length > 0 ? [{
195
+ type: "message",
196
+ text,
197
+ delta: false
198
+ }] : [];
199
+ };
200
+ return {
201
+ line(line) {
202
+ const events = [];
203
+ const model = /^Main model: (\S+)/.exec(line);
204
+ if (!started && (model || line.trim().length > 0 && !BANNER.some((pattern) => pattern.test(line)))) {
205
+ started = true;
206
+ events.push({
207
+ type: "session.started",
208
+ model: model?.[1]
209
+ });
210
+ }
211
+ if (BANNER.some((pattern) => pattern.test(line))) return events;
212
+ const tokens = TOKENS_LINE.exec(line);
213
+ if (tokens) {
214
+ const cacheWrite = parseAiderCount(tokens[2]);
215
+ const cacheHit = parseAiderCount(tokens[3]);
216
+ const sent = parseAiderCount(tokens[1]) ?? 0;
217
+ events.push(...flush(), {
218
+ type: "usage",
219
+ cumulative: false,
220
+ usage: usageOf({
221
+ input: sent,
222
+ output: parseAiderCount(tokens[4]),
223
+ cachedTokens: cacheHit,
224
+ cacheWriteTokens: cacheWrite,
225
+ costUSD: tokens[5] !== void 0 ? Number(tokens[5]) : void 0
226
+ })
227
+ });
228
+ return events;
229
+ }
230
+ const applied = /^Applied edit to (.+)$/.exec(line);
231
+ if (applied) {
232
+ const file = applied[1] ?? "";
233
+ const id = `edit-${file}`;
234
+ events.push(...flush(), {
235
+ type: "tool.call",
236
+ id,
237
+ name: "edit",
238
+ input: { path: file }
239
+ }, {
240
+ type: "tool.result",
241
+ id,
242
+ output: line,
243
+ isError: false
244
+ });
245
+ return events;
246
+ }
247
+ const commit = /^Commit ([0-9a-f]{7,40}) (.*)$/.exec(line);
248
+ if (commit) {
249
+ const id = `commit-${commit[1] ?? ""}`;
250
+ events.push({
251
+ type: "tool.call",
252
+ id,
253
+ name: "commit",
254
+ input: {
255
+ hash: commit[1],
256
+ message: commit[2]
257
+ }
258
+ }, {
259
+ type: "tool.result",
260
+ id,
261
+ output: line,
262
+ isError: false
263
+ });
264
+ return events;
265
+ }
266
+ if (/^litellm\.\w+Error:/.test(line) || line.startsWith("The API provider is not able to authenticate you")) {
267
+ events.push({
268
+ type: "error",
269
+ message: line,
270
+ fatal: true
271
+ });
272
+ return events;
273
+ }
274
+ if (/^Retrying in [\d.]+ seconds/.test(line)) {
275
+ events.push({
276
+ type: "error",
277
+ message: line
278
+ });
279
+ return events;
280
+ }
281
+ body.push(line);
282
+ return events;
283
+ },
284
+ end() {
285
+ const events = flush();
286
+ const usage = analyticsUsage(context);
287
+ return usage !== void 0 ? [...events, usage] : events;
288
+ }
289
+ };
290
+ }
291
+
292
+ //#endregion
293
+ export { aiderAdapter, createAiderParser, parseAiderCount };
294
+ //# sourceMappingURL=aider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aider.mjs","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/aider.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type {\n CliAdapter,\n CliLaunchContext,\n CliLaunchFile,\n CliParsedEvent,\n CliStreamParser,\n} from \"../contracts\";\nimport { numberField, parseJsonLine, recordField, stringField } from \"../stream/json-lines\";\nimport { argvPrompt, mapEffort, promptFile, unsupportedOption, usageOf } from \"./shared\";\n\n/** Local analytics log the adapter asks Aider to write (exact token counts). */\nconst ANALYTICS_LOG = \"aider-analytics.jsonl\";\n\n/**\n * Aider (`aider`, PyPI `aider-chat`).\n *\n * Verified against the official docs (`aider.chat/docs/scripting.html`,\n * `/docs/config/options.html`, `/docs/config/reasoning.html`) and the\n * source at tag v0.86.2 (`aider/main.py`, `aider/args.py`,\n * `aider/coders/base_coder.py`, `aider/analytics.py`); Aider needs Python\n * 3.10+, so no real `--help` was run, 2026-10-17. The capability probe\n * checks every flag against the installed `--help`.\n *\n * - Headless: `aider --message <text>` (or `--message-file`). Aider has **no\n * machine-readable output**: the parser reads the plain-text stdout —\n * startup banner (`Main model: …`), the reply, the usage line\n * (`Tokens: 2.4k sent, 61 received. Cost: $0.0081 message, …`),\n * `Applied edit to <path>` (reported as an `edit` tool call) and\n * `Commit <hash> <message>`. Exact token counts and cost come from the\n * local `--analytics-log` file (`message_send` events), read when the\n * stream ends.\n * - Aider exits 0 even when the model call fails, so `litellm.*Error` lines\n * and the \"not able to authenticate you\" notice are reported as fatal.\n * - Permissions: Aider applies edits without approval and, headless with\n * `--yes-always`, never runs the shell commands it suggests; there is no\n * stricter or looser mode, so `standard` and `bypass` behave the same.\n * Auto-commits are turned off (`--no-auto-commits`); pass\n * `args: [\"--auto-commits\"]` to keep them.\n * - No session ids (`resume` is refused) and no MCP. Chat and input\n * history are written to the run directory, not the repository.\n * - Home: Aider uses `HOME`; provider keys use their own variables\n * (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, …) via `env`. Always pass\n * `model` — without one Aider may start an interactive OAuth flow.\n */\nexport const aiderAdapter: CliAdapter = {\n name: \"aider\",\n title: \"Aider\",\n command: \"aider\",\n apiKeyEnv: [],\n homeEnv: [\"HOME\", \"USERPROFILE\"],\n transports: [\"argv\", \"file\"],\n effort: true,\n mcp: false,\n probe: { help: [[\"--help\"]], version: [\"--version\"] },\n verification: {\n version: \"0.86.2\",\n verifiedBy: \"docs\",\n sources: [\n \"https://aider.chat/docs/scripting.html\",\n \"https://aider.chat/docs/config/options.html\",\n \"https://aider.chat/docs/config/reasoning.html\",\n \"https://github.com/Aider-AI/aider/tree/v0.86.2\",\n ],\n checkedAt: \"2026-10-17\",\n },\n plan(context) {\n if (context.resume !== undefined) {\n throw unsupportedOption(\n aiderAdapter,\n \"Aider has no session ids, so `resume` is not supported.\",\n );\n }\n\n const args = [\n \"--yes-always\",\n \"--no-pretty\",\n \"--no-stream\",\n \"--no-fancy-input\",\n \"--no-auto-commits\",\n \"--no-check-update\",\n \"--no-show-release-notes\",\n \"--no-analytics\",\n \"--no-show-model-warnings\",\n \"--no-gitignore\",\n \"--analytics-log\",\n path.join(context.runDir, ANALYTICS_LOG),\n \"--chat-history-file\",\n path.join(context.runDir, \"chat-history.md\"),\n \"--input-history-file\",\n path.join(context.runDir, \"input-history\"),\n ];\n const requires = [\n \"--yes-always\",\n \"--no-pretty\",\n \"--no-stream\",\n \"--no-auto-commits\",\n \"--analytics-log\",\n \"--chat-history-file\",\n \"--input-history-file\",\n ];\n const files: CliLaunchFile[] = [];\n let tail: string[];\n\n if (context.model !== undefined) {\n args.push(\"--model\", context.model);\n requires.push(\"--model\");\n }\n\n if (context.effort !== undefined) {\n args.push(\n \"--reasoning-effort\",\n mapEffort(context.effort, { low: \"low\", medium: \"medium\", high: \"high\" }),\n );\n requires.push(\"--reasoning-effort\");\n }\n\n if (context.transport === \"file\") {\n const prompt = promptFile(context);\n\n files.push(prompt);\n tail = [\"--message-file\", prompt.path];\n requires.push(\"--message-file\");\n } else {\n tail = [\"--message\", argvPrompt(context.prompt)];\n requires.push(\"--message\");\n }\n\n return {\n args,\n tail,\n env: {\n ...(context.home !== undefined ? { HOME: context.home, USERPROFILE: context.home } : {}),\n TERM: \"dumb\",\n },\n files,\n requires,\n };\n },\n parser: createAiderParser,\n};\n\n/** `2.4k` → 2400, `12k` → 12000, `61` → 61. */\nexport function parseAiderCount(value: string | undefined): number | undefined {\n if (value === undefined) {\n return undefined;\n }\n\n const match = /^([\\d.]+)(k|M)?$/.exec(value.trim());\n\n if (!match) {\n return undefined;\n }\n\n const number = Number(match[1]);\n const scale = match[2] === \"k\" ? 1_000 : match[2] === \"M\" ? 1_000_000 : 1;\n\n return Number.isFinite(number) ? Math.round(number * scale) : undefined;\n}\n\nconst TOKENS_LINE =\n /^Tokens: ([\\d.]+[kM]?) sent(?:, ([\\d.]+[kM]?) cache write)?(?:, ([\\d.]+[kM]?) cache hit)?, ([\\d.]+[kM]?) received\\.(?:\\s+Cost: \\$([\\d.]+) message, \\$([\\d.]+) session\\.)?/;\n\nconst BANNER = [\n /^Aider v\\d/,\n /^Main model: /,\n /^Weak model: /,\n /^Editor model: /,\n /^Model: /,\n /^Git repo: /,\n /^Repo-map: /,\n /^Added .+ to the chat\\.$/,\n /^Cost: \\$[\\d.]+ message, \\$[\\d.]+ session\\.$/,\n /^Use \\/help /,\n];\n\n/** Usage from the analytics log (`message_send` events), summed. */\nfunction analyticsUsage(context: CliLaunchContext | undefined): CliParsedEvent | undefined {\n if (context === undefined) {\n return undefined;\n }\n\n let content: string;\n\n try {\n content = readFileSync(path.join(context.runDir, ANALYTICS_LOG), \"utf8\");\n } catch {\n return undefined;\n }\n\n let input = 0;\n let output = 0;\n let cost: number | undefined;\n let seen = false;\n\n for (const line of content.split(/\\r?\\n/)) {\n const record = parseJsonLine(line);\n\n if (stringField(record, \"event\") !== \"message_send\") {\n continue;\n }\n\n const properties = recordField(record, \"properties\");\n\n seen = true;\n input += numberField(properties, \"prompt_tokens\") ?? 0;\n output += numberField(properties, \"completion_tokens\") ?? 0;\n\n const messageCost = numberField(properties, \"cost\");\n\n if (messageCost !== undefined) {\n cost = (cost ?? 0) + messageCost;\n }\n }\n\n return seen\n ? { type: \"usage\", cumulative: true, usage: usageOf({ input, output, costUSD: cost }) }\n : undefined;\n}\n\n/** Parser for Aider's plain-text stdout (plus its analytics log). */\nexport function createAiderParser(context?: CliLaunchContext): CliStreamParser {\n let started = false;\n let body: string[] = [];\n\n const flush = (): CliParsedEvent[] => {\n const text = body.join(\"\\n\").trim();\n\n body = [];\n\n return text.length > 0 ? [{ type: \"message\", text, delta: false }] : [];\n };\n\n return {\n line(line: string): CliParsedEvent[] {\n const events: CliParsedEvent[] = [];\n const model = /^Main model: (\\S+)/.exec(line);\n\n // One `session.started`: on the model line of the banner, or on the\n // first line of output when the banner has none.\n if (\n !started &&\n (model || (line.trim().length > 0 && !BANNER.some((pattern) => pattern.test(line))))\n ) {\n started = true;\n events.push({ type: \"session.started\", model: model?.[1] });\n }\n\n if (BANNER.some((pattern) => pattern.test(line))) {\n return events;\n }\n\n const tokens = TOKENS_LINE.exec(line);\n\n if (tokens) {\n const cacheWrite = parseAiderCount(tokens[2]);\n const cacheHit = parseAiderCount(tokens[3]);\n const sent = parseAiderCount(tokens[1]) ?? 0;\n\n events.push(...flush(), {\n type: \"usage\",\n cumulative: false,\n usage: usageOf({\n input: sent,\n output: parseAiderCount(tokens[4]),\n cachedTokens: cacheHit,\n cacheWriteTokens: cacheWrite,\n costUSD: tokens[5] !== undefined ? Number(tokens[5]) : undefined,\n }),\n });\n\n return events;\n }\n\n const applied = /^Applied edit to (.+)$/.exec(line);\n\n if (applied) {\n const file = applied[1] ?? \"\";\n const id = `edit-${file}`;\n\n events.push(\n ...flush(),\n { type: \"tool.call\", id, name: \"edit\", input: { path: file } },\n { type: \"tool.result\", id, output: line, isError: false },\n );\n\n return events;\n }\n\n const commit = /^Commit ([0-9a-f]{7,40}) (.*)$/.exec(line);\n\n if (commit) {\n const id = `commit-${commit[1] ?? \"\"}`;\n\n events.push(\n { type: \"tool.call\", id, name: \"commit\", input: { hash: commit[1], message: commit[2] } },\n { type: \"tool.result\", id, output: line, isError: false },\n );\n\n return events;\n }\n\n if (\n /^litellm\\.\\w+Error:/.test(line) ||\n line.startsWith(\"The API provider is not able to authenticate you\")\n ) {\n events.push({ type: \"error\", message: line, fatal: true });\n\n return events;\n }\n\n if (/^Retrying in [\\d.]+ seconds/.test(line)) {\n events.push({ type: \"error\", message: line });\n\n return events;\n }\n\n body.push(line);\n\n return events;\n },\n end(): CliParsedEvent[] {\n const events = flush();\n const usage = analyticsUsage(context);\n\n return usage !== undefined ? [...events, us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K,QAAQ;IAEnB,OAAO,KACL,GAAG,MAAM,GACT;KAAE,MAAM;KAAa;KAAI,MAAM;KAAQ,OAAO,EAAE,MAAM,KAAK;IAAE,GAC7D;KAAE,MAAM;KAAe;KAAI,QAAQ;KAAM,SAAS;IAAM,CAC1D;IAEA,OAAO;GACT;GAEA,MAAM,SAAS,iCAAiC,KAAK,IAAI;GAEzD,IAAI,QAAQ;IACV,MAAM,KAAK,UAAU,OAAO,MAAM;IAElC,OAAO,KACL;KAAE,MAAM;KAAa;KAAI,MAAM;KAAU,OAAO;MAAE,MAAM,OAAO;MAAI,SAAS,OAAO;KAAG;IAAE,GACxF;KAAE,MAAM;KAAe;KAAI,QAAQ;KAAM,SAAS;IAAM,CAC1D;IAEA,OAAO;GACT;GAEA,IACE,sBAAsB,KAAK,IAAI,KAC/B,KAAK,WAAW,kDAAkD,GAClE;IACA,OAAO,KAAK;KAAE,MAAM;KAAS,SAAS;KAAM,OAAO;IAAK,CAAC;IAEzD,OAAO;GACT;GAEA,IAAI,8BAA8B,KAAK,IAAI,GAAG;IAC5C,OAAO,KAAK;KAAE,MAAM;KAAS,SAAS;IAAK,CAAC;IAE5C,OAAO;GACT;GAEA,KAAK,KAAK,IAAI;GAEd,OAAO;EACT;EACA,MAAwB;GACtB,MAAM,SAAS,MAAM;GACrB,MAAM,QAAQ,eAAe,OAAO;GAEpC,OAAO,UAAU,SAAY,CAAC,GAAG,QAAQ,KAAK,IAAI;EACpD;CACF;AACF"}
@@ -0,0 +1,33 @@
1
+ import { CliAdapter } from "../contracts/adapter.contract.mjs";
2
+ //#region ../../packages/ai-cli/src/adapters/amp.d.ts
3
+ /**
4
+ * Amp (`amp`, npm `@ampcode/cli`; `@sourcegraph/amp` is a shim to it).
5
+ *
6
+ * Verified against the real `amp --help` of 0.0.1792254886-g14d018 and the
7
+ * docs (`ampcode.com/docs/cli/{streaming-json,execute-mode,settings}`,
8
+ * `/docs/tools`), 2026-10-17.
9
+ *
10
+ * - Headless: `amp -x <prompt> --stream-json` (with `-x` and no message,
11
+ * stdin is the prompt); resume is `amp threads continue <T-id> -x …`.
12
+ * Threads are kept unarchived (`--no-archive-after-execute`) so they can
13
+ * be continued.
14
+ * - Stream: Claude Code-compatible (`system/init` with `session_id`
15
+ * `T-…`, `assistant` text/`tool_use`, `user` `tool_result`, `result`),
16
+ * no deltas and no cost.
17
+ * - Model: Amp has no model flag; the mode (`-m low|medium|high|ultra`)
18
+ * picks model and effort, so `effort` maps to the mode and `model` is
19
+ * refused.
20
+ * - Permissions: Amp's own rules (tools run without approval by default;
21
+ * anything that needs approval is rejected in execute mode). Bypass passes
22
+ * `--dangerously-allow-all`, which the CLI accepts but no longer lists in
23
+ * `--help`, so it is not part of the capability probe — a CLI that drops
24
+ * it rejects the run as an unknown option.
25
+ * - MCP: `--mcp-config <file>` holding the server map itself (no
26
+ * `mcpServers` wrapper), written to the run directory.
27
+ * - Home: Amp follows XDG (`$XDG_CONFIG_HOME/amp/settings.json`); auth
28
+ * `AMP_API_KEY`; update checks off with `AMP_SKIP_UPDATE_CHECK=1`.
29
+ */
30
+ declare const ampAdapter: CliAdapter;
31
+ //#endregion
32
+ export { ampAdapter };
33
+ //# sourceMappingURL=amp.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amp.d.mts","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/amp.ts"],"mappings":";;;;;AAgCA;;;;AA+EC;;;;;;;;;;;;;;;;;;;;cA/EY,UAAA,EAAY,UA+ExB"}
@@ -0,0 +1,119 @@
1
+ import { argvPrompt, jsonFile, mapEffort, mcpServersJson, unsupportedOption } from "./shared.mjs";
2
+ import { createClaudeStreamParser } from "./claude-stream.mjs";
3
+ import path from "node:path";
4
+
5
+ //#region ../../packages/ai-cli/src/adapters/amp.ts
6
+ /**
7
+ * Amp (`amp`, npm `@ampcode/cli`; `@sourcegraph/amp` is a shim to it).
8
+ *
9
+ * Verified against the real `amp --help` of 0.0.1792254886-g14d018 and the
10
+ * docs (`ampcode.com/docs/cli/{streaming-json,execute-mode,settings}`,
11
+ * `/docs/tools`), 2026-10-17.
12
+ *
13
+ * - Headless: `amp -x <prompt> --stream-json` (with `-x` and no message,
14
+ * stdin is the prompt); resume is `amp threads continue <T-id> -x …`.
15
+ * Threads are kept unarchived (`--no-archive-after-execute`) so they can
16
+ * be continued.
17
+ * - Stream: Claude Code-compatible (`system/init` with `session_id`
18
+ * `T-…`, `assistant` text/`tool_use`, `user` `tool_result`, `result`),
19
+ * no deltas and no cost.
20
+ * - Model: Amp has no model flag; the mode (`-m low|medium|high|ultra`)
21
+ * picks model and effort, so `effort` maps to the mode and `model` is
22
+ * refused.
23
+ * - Permissions: Amp's own rules (tools run without approval by default;
24
+ * anything that needs approval is rejected in execute mode). Bypass passes
25
+ * `--dangerously-allow-all`, which the CLI accepts but no longer lists in
26
+ * `--help`, so it is not part of the capability probe — a CLI that drops
27
+ * it rejects the run as an unknown option.
28
+ * - MCP: `--mcp-config <file>` holding the server map itself (no
29
+ * `mcpServers` wrapper), written to the run directory.
30
+ * - Home: Amp follows XDG (`$XDG_CONFIG_HOME/amp/settings.json`); auth
31
+ * `AMP_API_KEY`; update checks off with `AMP_SKIP_UPDATE_CHECK=1`.
32
+ */
33
+ const ampAdapter = {
34
+ name: "amp",
35
+ title: "Amp",
36
+ command: "amp",
37
+ apiKeyEnv: ["AMP_API_KEY"],
38
+ homeEnv: [
39
+ "XDG_CONFIG_HOME",
40
+ "XDG_DATA_HOME",
41
+ "XDG_STATE_HOME",
42
+ "XDG_CACHE_HOME"
43
+ ],
44
+ transports: ["argv", "stdin"],
45
+ effort: true,
46
+ mcp: true,
47
+ probe: {
48
+ help: [["--help"]],
49
+ version: ["--version"]
50
+ },
51
+ verification: {
52
+ version: "0.0.1792254886-g14d018",
53
+ verifiedBy: "help",
54
+ sources: [
55
+ "https://ampcode.com/docs/cli/streaming-json",
56
+ "https://ampcode.com/docs/cli/execute-mode",
57
+ "https://ampcode.com/docs/cli/settings"
58
+ ],
59
+ checkedAt: "2026-10-17"
60
+ },
61
+ plan(context) {
62
+ if (context.model !== void 0) throw unsupportedOption(ampAdapter, "Amp has no model flag; its mode picks the model — use `effort` instead of `model`.");
63
+ const args = context.resume !== void 0 ? [
64
+ "threads",
65
+ "continue",
66
+ context.resume
67
+ ] : [];
68
+ const requires = [
69
+ "--execute",
70
+ "--stream-json",
71
+ "--no-archive-after-execute"
72
+ ];
73
+ const files = [];
74
+ if (context.resume !== void 0) requires.push("threads");
75
+ args.push("--stream-json", "--no-archive-after-execute");
76
+ if (context.effort !== void 0) {
77
+ args.push("--mode", mapEffort(context.effort, {
78
+ low: "low",
79
+ medium: "medium",
80
+ high: "high",
81
+ max: "ultra"
82
+ }));
83
+ requires.push("--mode");
84
+ }
85
+ if (context.permission === "bypass") args.push("--dangerously-allow-all");
86
+ if (context.mcp !== void 0) {
87
+ const file = path.join(context.runDir, "amp-mcp.json");
88
+ files.push({
89
+ path: file,
90
+ content: jsonFile(mcpServersJson(context.mcp))
91
+ });
92
+ args.push("--mcp-config", file);
93
+ requires.push("--mcp-config");
94
+ }
95
+ const env = { AMP_SKIP_UPDATE_CHECK: "1" };
96
+ if (context.home !== void 0) {
97
+ env.XDG_CONFIG_HOME = path.join(context.home, "config");
98
+ env.XDG_DATA_HOME = path.join(context.home, "data");
99
+ env.XDG_STATE_HOME = path.join(context.home, "state");
100
+ env.XDG_CACHE_HOME = path.join(context.home, "cache");
101
+ }
102
+ return {
103
+ args,
104
+ tail: context.transport === "argv" ? ["--execute", argvPrompt(context.prompt)] : ["--execute"],
105
+ stdin: context.transport === "stdin" ? context.prompt : void 0,
106
+ env,
107
+ files,
108
+ requires
109
+ };
110
+ },
111
+ parser: () => createClaudeStreamParser({
112
+ usage: "anthropic",
113
+ vendor: "Amp"
114
+ })
115
+ };
116
+
117
+ //#endregion
118
+ export { ampAdapter };
119
+ //# sourceMappingURL=amp.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amp.mjs","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/amp.ts"],"sourcesContent":["import path from \"node:path\";\nimport type { CliAdapter, CliLaunchFile } from \"../contracts\";\nimport { createClaudeStreamParser } from \"./claude-stream\";\nimport { argvPrompt, jsonFile, mapEffort, mcpServersJson, unsupportedOption } from \"./shared\";\n\n/**\n * Amp (`amp`, npm `@ampcode/cli`; `@sourcegraph/amp` is a shim to it).\n *\n * Verified against the real `amp --help` of 0.0.1792254886-g14d018 and the\n * docs (`ampcode.com/docs/cli/{streaming-json,execute-mode,settings}`,\n * `/docs/tools`), 2026-10-17.\n *\n * - Headless: `amp -x <prompt> --stream-json` (with `-x` and no message,\n * stdin is the prompt); resume is `amp threads continue <T-id> -x …`.\n * Threads are kept unarchived (`--no-archive-after-execute`) so they can\n * be continued.\n * - Stream: Claude Code-compatible (`system/init` with `session_id`\n * `T-…`, `assistant` text/`tool_use`, `user` `tool_result`, `result`),\n * no deltas and no cost.\n * - Model: Amp has no model flag; the mode (`-m low|medium|high|ultra`)\n * picks model and effort, so `effort` maps to the mode and `model` is\n * refused.\n * - Permissions: Amp's own rules (tools run without approval by default;\n * anything that needs approval is rejected in execute mode). Bypass passes\n * `--dangerously-allow-all`, which the CLI accepts but no longer lists in\n * `--help`, so it is not part of the capability probe — a CLI that drops\n * it rejects the run as an unknown option.\n * - MCP: `--mcp-config <file>` holding the server map itself (no\n * `mcpServers` wrapper), written to the run directory.\n * - Home: Amp follows XDG (`$XDG_CONFIG_HOME/amp/settings.json`); auth\n * `AMP_API_KEY`; update checks off with `AMP_SKIP_UPDATE_CHECK=1`.\n */\nexport const ampAdapter: CliAdapter = {\n name: \"amp\",\n title: \"Amp\",\n command: \"amp\",\n apiKeyEnv: [\"AMP_API_KEY\"],\n homeEnv: [\"XDG_CONFIG_HOME\", \"XDG_DATA_HOME\", \"XDG_STATE_HOME\", \"XDG_CACHE_HOME\"],\n transports: [\"argv\", \"stdin\"],\n effort: true,\n mcp: true,\n probe: { help: [[\"--help\"]], version: [\"--version\"] },\n verification: {\n version: \"0.0.1792254886-g14d018\",\n verifiedBy: \"help\",\n sources: [\n \"https://ampcode.com/docs/cli/streaming-json\",\n \"https://ampcode.com/docs/cli/execute-mode\",\n \"https://ampcode.com/docs/cli/settings\",\n ],\n checkedAt: \"2026-10-17\",\n },\n plan(context) {\n if (context.model !== undefined) {\n throw unsupportedOption(\n ampAdapter,\n \"Amp has no model flag; its mode picks the model — use `effort` instead of `model`.\",\n );\n }\n\n const args: string[] =\n context.resume !== undefined ? [\"threads\", \"continue\", context.resume] : [];\n const requires = [\"--execute\", \"--stream-json\", \"--no-archive-after-execute\"];\n const files: CliLaunchFile[] = [];\n\n if (context.resume !== undefined) {\n requires.push(\"threads\");\n }\n\n args.push(\"--stream-json\", \"--no-archive-after-execute\");\n\n if (context.effort !== undefined) {\n args.push(\n \"--mode\",\n mapEffort(context.effort, { low: \"low\", medium: \"medium\", high: \"high\", max: \"ultra\" }),\n );\n requires.push(\"--mode\");\n }\n\n if (context.permission === \"bypass\") {\n args.push(\"--dangerously-allow-all\");\n }\n\n if (context.mcp !== undefined) {\n const file = path.join(context.runDir, \"amp-mcp.json\");\n\n files.push({ path: file, content: jsonFile(mcpServersJson(context.mcp)) });\n args.push(\"--mcp-config\", file);\n requires.push(\"--mcp-config\");\n }\n\n const env: Record<string, string> = { AMP_SKIP_UPDATE_CHECK: \"1\" };\n\n if (context.home !== undefined) {\n env.XDG_CONFIG_HOME = path.join(context.home, \"config\");\n env.XDG_DATA_HOME = path.join(context.home, \"data\");\n env.XDG_STATE_HOME = path.join(context.home, \"state\");\n env.XDG_CACHE_HOME = path.join(context.home, \"cache\");\n }\n\n return {\n args,\n tail:\n context.transport === \"argv\" ? [\"--execute\", argvPrompt(context.prompt)] : [\"--execute\"],\n stdin: context.transport === \"stdin\" ? context.prompt : undefined,\n env,\n files,\n requires,\n };\n },\n parser: () => createClaudeStreamParser({ usage: \"anthropic\", vendor: \"Amp\" }),\n};\n"],"mappings":";;;;;;;;;;;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,KAAK,KAAK,QAAQ,MAAM,QAAQ;GACtD,IAAI,gBAAgB,KAAK,KAAK,QAAQ,MAAM,MAAM;GAClD,IAAI,iBAAiB,KAAK,KAAK,QAAQ,MAAM,OAAO;GACpD,IAAI,iBAAiB,KAAK,KAAK,QAAQ,MAAM,OAAO;EACtD;EAEA,OAAO;GACL;GACA,MACE,QAAQ,cAAc,SAAS,CAAC,aAAa,WAAW,QAAQ,MAAM,CAAC,IAAI,CAAC,WAAW;GACzF,OAAO,QAAQ,cAAc,UAAU,QAAQ,SAAS;GACxD;GACA;GACA;EACF;CACF;CACA,cAAc,yBAAyB;EAAE,OAAO;EAAa,QAAQ;CAAM,CAAC;AAC9E"}
@@ -0,0 +1,37 @@
1
+ import { CliAdapter, CliStreamParser } from "../contracts/adapter.contract.mjs";
2
+ //#region ../../packages/ai-cli/src/adapters/antigravity.d.ts
3
+ /**
4
+ * Google Antigravity CLI (`agy`), installed by the
5
+ * `antigravity.google/cli/install.sh` script (no npm package). Not Gemini
6
+ * CLI, which it succeeds.
7
+ *
8
+ * Verified against the official docs only (the binary is distributed by a
9
+ * curl installer, which was not run): `antigravity.google/docs/cli/headless`,
10
+ * `/docs/cli/reference`, `/docs/mcp`, `/docs/permissions`, `/docs/settings`,
11
+ * `/docs/install`, and the 1.4.0 release notes, 2026-10-17. The capability
12
+ * probe checks every flag against the installed binary's `--help`.
13
+ *
14
+ * - Headless: `agy -p <prompt> --output-format stream-json`. For long
15
+ * prompts the adapter uses the documented stdin protocol instead:
16
+ * `--input-format stream-json` with one `{"event":"user","message":
17
+ * {"content":…}}` line, then stdin is closed.
18
+ * - Stream: `{"event":X, X:{…}}` lines — `init` (with `conversation_id`),
19
+ * `step_update` (`agent_response` steps carry `text_delta` fragments;
20
+ * `tool` steps carry `tool_info{name,parameters,output,error}` with call
21
+ * and result together, correlated by `step_index`) and a final `result`
22
+ * (`status`, `response`, `error`, cumulative `usage`). No cost field.
23
+ * - Permissions: headless soft-denies tools that need approval (the run
24
+ * continues and exits 0); bypass is `--dangerously-skip-permissions`.
25
+ * - Home: no variable relocates `~/.gemini`, so a private/owned home sets
26
+ * `HOME` (and `USERPROFILE`). MCP goes to
27
+ * `$HOME/.gemini/config/mcp_config.json` (remote servers use `serverUrl`).
28
+ * - Auth: `GEMINI_API_KEY` only works with `"modelProvider": "gemini"` in
29
+ * `$HOME/.gemini/antigravity-cli/settings.json`; the adapter writes that
30
+ * file when `apiKey` is set on a private home.
31
+ */
32
+ declare const antigravityAdapter: CliAdapter;
33
+ /** Parser for `agy -p … --output-format stream-json`. */
34
+ declare function createAntigravityParser(): CliStreamParser;
35
+ //#endregion
36
+ export { antigravityAdapter, createAntigravityParser };
37
+ //# sourceMappingURL=antigravity.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"antigravity.d.mts","names":[],"sources":["../../../../../../../../packages/ai-cli/src/adapters/antigravity.ts"],"mappings":";;;;;AA8CA;;;;AAyFC;AAoCD;;;;AAA0D;;;;;;;;;;;;;;;;;cA7H7C,kBAAA,EAAoB,UAyFhC;;iBAoCe,uBAAA,IAA2B,eAAe"}