@coda-console/antigravity 1.3.1 → 1.3.2
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/README.md +4 -1
- package/agent/entry.mjs +8 -0
- package/agent/retry.mjs +13 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
把 [Google Antigravity](https://antigravity.google/cli) 的 Agent 接进 Coda。清单经一个薄转发入口(`agent/entry.mjs`)启动运行机上的 `agy acp`(Antigravity CLI 的 ACP 服务),
|
|
4
4
|
先找 `~/.local/bin/agy`,没有再用 PATH。每个会话一个进程,不登记等待项。
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
入口改四处,其余消息原样双向转发。第一处:把 `initialize` 答复里的 `additionalDirectories` 能力去掉,Coda 就不再给它传附加目录;
|
|
7
7
|
`session/new`、`session/load`、`session/resume` 里若仍带 `additionalDirectories` 也删掉。原因:agy 1.5.9 收到附加目录后,
|
|
8
8
|
没给 Cwd 的命令默认跑在**字典序最前的附加根**,而不是会话的工作副本(实测规律,不是上游的保证;数组顺序、`session/load` 都不改变它);
|
|
9
9
|
不传附加目录时命令就在工作副本里跑。
|
|
10
10
|
|
|
11
11
|
第二处是虚拟模式 `full`(「全部放行」),见下面「全部放行」一节。第三处是配置探测:入口在 `initialize` 声明 `_meta.coda.probe`,
|
|
12
12
|
带探测标记的 `session/new` 由入口用本机的目录缓存应答,不转给 agy,见「已知限制」的「配置探测」。
|
|
13
|
+
第四处:agy 内部重试模型请求时会发一条 `agent_message_chunk`,整段文本形如 `⚠ API error (attempt 1): request failed: stream idle timeout (5m0s): context deadline exceeded`,
|
|
14
|
+
Coda 会把它存成回复正文,像答到一半出错,其实这一轮还在跑。入口不转发这一种(整段去掉首尾空白后恰为单行此格式),原文写到插件自己的 stderr;
|
|
15
|
+
多行或夹在正文里的同样字样照常转发。最终失败怎样结束这一轮未查到实例,入口不改它(不改报 `session/prompt` 错误)。
|
|
13
16
|
|
|
14
17
|
需要带会话指令兜底的 Coda(2026-11-13 部署版,coda#2500)或更新版本;旧版 Coda 不会给 Antigravity 送入会话指令。
|
|
15
18
|
|
package/agent/entry.mjs
CHANGED
|
@@ -12,11 +12,14 @@
|
|
|
12
12
|
// the catalog, which one that differs marks to be collected again.
|
|
13
13
|
// 4. When agy ends on its own (not as Coda's input closing or a signal to this process stops it) with a non-zero exit code, a
|
|
14
14
|
// signal or a prompt unanswered, the log and the prompts still waiting say how (exit.mjs).
|
|
15
|
+
// 5. agy's notice that it retries a model request ("⚠ API error (attempt N): ...", an agent_message_chunk) is not passed on: Coda
|
|
16
|
+
// would keep it as the reply's text, while the turn goes on. The entry writes it to its own stderr instead (retry.mjs).
|
|
15
17
|
import { spawn } from 'node:child_process';
|
|
16
18
|
import { agyBinary } from '../scripts/agy.mjs';
|
|
17
19
|
import { createCatalog } from './catalog.mjs';
|
|
18
20
|
import { PREFIX, Probes, probeMark } from './probe.mjs';
|
|
19
21
|
import { describeExit, endedError } from './exit.mjs';
|
|
22
|
+
import { retryNotice } from './retry.mjs';
|
|
20
23
|
|
|
21
24
|
const binary = agyBinary() ?? 'agy';
|
|
22
25
|
const agy = spawn(binary, ['acp'], { stdio: ['pipe', 'pipe', 'pipe'] });
|
|
@@ -123,6 +126,11 @@ relay(agy.stdout, process.stdout, message => {
|
|
|
123
126
|
return;
|
|
124
127
|
}
|
|
125
128
|
const update = params?.update;
|
|
129
|
+
const notice = retryNotice(message);
|
|
130
|
+
if (notice !== null) {
|
|
131
|
+
process.stderr.write(`agy 重试模型请求,提示不转给 Coda:${notice.trim()}\n`);
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
126
134
|
if (method === 'session/update' && update?.sessionUpdate === 'current_mode_update') {
|
|
127
135
|
if (!full.has(params.sessionId)) return;
|
|
128
136
|
if (update.currentModeId === 'default') update.currentModeId = 'full'; else full.delete(params.sessionId);
|
package/agent/retry.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// agy retries a failed model request inside the turn and says so with an agent_message_chunk, "\n⚠ API error (attempt N): <why>\n"
|
|
2
|
+
// (agy 1.5.9: the ACP layer writes "\n⚠ %s\n" around the Go format "API error (attempt %d): %v"). Coda would keep it as the
|
|
3
|
+
// reply's text, which then looks like an answer that broke off, while the turn goes on. Only a chunk that is exactly that one line
|
|
4
|
+
// is the notice; text with anything else in it (more lines, or around other text) is the answer's and goes on.
|
|
5
|
+
const NOTICE = /^⚠ API error \(attempt [1-9]\d*\): [^\r\n\u2028\u2029]+$/;
|
|
6
|
+
|
|
7
|
+
// The text of an agent message that is agy's retry notice, or null for any other message.
|
|
8
|
+
export function retryNotice(message) {
|
|
9
|
+
const update = message?.params?.update;
|
|
10
|
+
if (message?.method !== 'session/update' || update?.sessionUpdate !== 'agent_message_chunk' || update.content?.type !== 'text') return null;
|
|
11
|
+
const text = update.content.text;
|
|
12
|
+
return typeof text === 'string' && NOTICE.test(text.trim()) ? text : null;
|
|
13
|
+
}
|