ai-task-board-bridge 1.0.1 → 1.5.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.
- package/README.md +165 -33
- package/dist/account-quota.d.ts +68 -0
- package/dist/account-quota.d.ts.map +1 -0
- package/dist/account-quota.js +147 -0
- package/dist/account-quota.js.map +1 -0
- package/dist/antigravity-runtime/agy-client.d.ts +117 -0
- package/dist/antigravity-runtime/agy-client.d.ts.map +1 -0
- package/dist/antigravity-runtime/agy-client.js +437 -0
- package/dist/antigravity-runtime/agy-client.js.map +1 -0
- package/dist/antigravity-runtime/board-client.d.ts +121 -0
- package/dist/antigravity-runtime/board-client.d.ts.map +1 -0
- package/dist/antigravity-runtime/board-client.js +334 -0
- package/dist/antigravity-runtime/board-client.js.map +1 -0
- package/dist/antigravity-runtime/bridge.d.ts +87 -0
- package/dist/antigravity-runtime/bridge.d.ts.map +1 -0
- package/dist/antigravity-runtime/bridge.js +1013 -0
- package/dist/antigravity-runtime/bridge.js.map +1 -0
- package/dist/antigravity-runtime/cli.d.ts +3 -0
- package/dist/antigravity-runtime/cli.d.ts.map +1 -0
- package/dist/antigravity-runtime/cli.js +85 -0
- package/dist/antigravity-runtime/cli.js.map +1 -0
- package/dist/antigravity-runtime/config.d.ts +57 -0
- package/dist/antigravity-runtime/config.d.ts.map +1 -0
- package/dist/antigravity-runtime/config.js +265 -0
- package/dist/antigravity-runtime/config.js.map +1 -0
- package/dist/antigravity-runtime/device-file-access.d.ts +54 -0
- package/dist/antigravity-runtime/device-file-access.d.ts.map +1 -0
- package/dist/antigravity-runtime/device-file-access.js +389 -0
- package/dist/antigravity-runtime/device-file-access.js.map +1 -0
- package/dist/antigravity-runtime/device-identity.d.ts +16 -0
- package/dist/antigravity-runtime/device-identity.d.ts.map +1 -0
- package/dist/antigravity-runtime/device-identity.js +67 -0
- package/dist/antigravity-runtime/device-identity.js.map +1 -0
- package/dist/antigravity-runtime/index.d.ts +9 -0
- package/dist/antigravity-runtime/index.d.ts.map +1 -0
- package/dist/antigravity-runtime/index.js +9 -0
- package/dist/antigravity-runtime/index.js.map +1 -0
- package/dist/antigravity-runtime/quota.d.ts +39 -0
- package/dist/antigravity-runtime/quota.d.ts.map +1 -0
- package/dist/antigravity-runtime/quota.js +282 -0
- package/dist/antigravity-runtime/quota.js.map +1 -0
- package/dist/antigravity-runtime/registry.d.ts +27 -0
- package/dist/antigravity-runtime/registry.d.ts.map +1 -0
- package/dist/antigravity-runtime/registry.js +115 -0
- package/dist/antigravity-runtime/registry.js.map +1 -0
- package/dist/antigravity-runtime/setup.d.ts +27 -0
- package/dist/antigravity-runtime/setup.d.ts.map +1 -0
- package/dist/antigravity-runtime/setup.js +600 -0
- package/dist/antigravity-runtime/setup.js.map +1 -0
- package/dist/antigravity-runtime/update-manager.d.ts +21 -0
- package/dist/antigravity-runtime/update-manager.d.ts.map +1 -0
- package/dist/antigravity-runtime/update-manager.js +323 -0
- package/dist/antigravity-runtime/update-manager.js.map +1 -0
- package/dist/antigravity-runtime/utils.d.ts +14 -0
- package/dist/antigravity-runtime/utils.d.ts.map +1 -0
- package/dist/antigravity-runtime/utils.js +118 -0
- package/dist/antigravity-runtime/utils.js.map +1 -0
- package/dist/app-server-client.d.ts +50 -0
- package/dist/app-server-client.d.ts.map +1 -1
- package/dist/app-server-client.js +13 -1
- package/dist/app-server-client.js.map +1 -1
- package/dist/bridge.d.ts +1 -0
- package/dist/bridge.d.ts.map +1 -1
- package/dist/bridge.js +146 -7
- package/dist/bridge.js.map +1 -1
- package/dist/cli.js +34 -6
- package/dist/cli.js.map +1 -1
- package/dist/device-file-access.d.ts +54 -0
- package/dist/device-file-access.d.ts.map +1 -0
- package/dist/device-file-access.js +389 -0
- package/dist/device-file-access.js.map +1 -0
- package/dist/device-identity.d.ts +16 -0
- package/dist/device-identity.d.ts.map +1 -0
- package/dist/device-identity.js +67 -0
- package/dist/device-identity.js.map +1 -0
- package/dist/history-sync.d.ts.map +1 -1
- package/dist/history-sync.js +28 -1
- package/dist/history-sync.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/installer.d.ts +4 -3
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +64 -17
- package/dist/installer.js.map +1 -1
- package/dist/kimi-runtime/board-client.d.ts +37 -3
- package/dist/kimi-runtime/board-client.d.ts.map +1 -1
- package/dist/kimi-runtime/board-client.js +72 -12
- package/dist/kimi-runtime/board-client.js.map +1 -1
- package/dist/kimi-runtime/bridge.d.ts +26 -2
- package/dist/kimi-runtime/bridge.d.ts.map +1 -1
- package/dist/kimi-runtime/bridge.js +334 -18
- package/dist/kimi-runtime/bridge.js.map +1 -1
- package/dist/kimi-runtime/cli.js +4 -2
- package/dist/kimi-runtime/cli.js.map +1 -1
- package/dist/kimi-runtime/config.d.ts +27 -0
- package/dist/kimi-runtime/config.d.ts.map +1 -1
- package/dist/kimi-runtime/config.js +119 -3
- package/dist/kimi-runtime/config.js.map +1 -1
- package/dist/kimi-runtime/device-file-access.d.ts +54 -0
- package/dist/kimi-runtime/device-file-access.d.ts.map +1 -0
- package/dist/kimi-runtime/device-file-access.js +389 -0
- package/dist/kimi-runtime/device-file-access.js.map +1 -0
- package/dist/kimi-runtime/device-identity.d.ts +16 -0
- package/dist/kimi-runtime/device-identity.d.ts.map +1 -0
- package/dist/kimi-runtime/device-identity.js +67 -0
- package/dist/kimi-runtime/device-identity.js.map +1 -0
- package/dist/kimi-runtime/index.d.ts +5 -4
- package/dist/kimi-runtime/index.d.ts.map +1 -1
- package/dist/kimi-runtime/index.js +4 -3
- package/dist/kimi-runtime/index.js.map +1 -1
- package/dist/kimi-runtime/quota.d.ts +39 -0
- package/dist/kimi-runtime/quota.d.ts.map +1 -0
- package/dist/kimi-runtime/quota.js +252 -0
- package/dist/kimi-runtime/quota.js.map +1 -0
- package/dist/kimi-runtime/setup.d.ts +4 -0
- package/dist/kimi-runtime/setup.d.ts.map +1 -1
- package/dist/kimi-runtime/setup.js +102 -19
- package/dist/kimi-runtime/setup.js.map +1 -1
- package/dist/kimi-runtime/update-manager.d.ts +21 -0
- package/dist/kimi-runtime/update-manager.d.ts.map +1 -0
- package/dist/kimi-runtime/update-manager.js +323 -0
- package/dist/kimi-runtime/update-manager.js.map +1 -0
- package/dist/kimi-runtime/web-goal-client.d.ts +32 -0
- package/dist/kimi-runtime/web-goal-client.d.ts.map +1 -0
- package/dist/kimi-runtime/web-goal-client.js +142 -0
- package/dist/kimi-runtime/web-goal-client.js.map +1 -0
- package/dist/setup.d.ts +28 -0
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +328 -117
- package/dist/setup.js.map +1 -1
- package/dist/update-manager.d.ts +21 -0
- package/dist/update-manager.d.ts.map +1 -0
- package/dist/update-manager.js +329 -0
- package/dist/update-manager.js.map +1 -0
- package/dist/working-directories.d.ts.map +1 -1
- package/dist/working-directories.js +22 -2
- package/dist/working-directories.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,51 +2,89 @@
|
|
|
2
2
|
|
|
3
3
|
`ai-task-board-bridge` is the single public npm package for AI Task Board's
|
|
4
4
|
device companions. Its interactive installer asks whether to install Codex
|
|
5
|
-
Bridge, Kimi Bridge, or
|
|
6
|
-
separate Board Connections, tokens,
|
|
7
|
-
services.
|
|
5
|
+
Bridge, Kimi Bridge, Antigravity Bridge, or a combination. The three runtimes
|
|
6
|
+
remain separate processes with separate Board Connections, tokens,
|
|
7
|
+
working-directory allowlists, and systemd services.
|
|
8
8
|
|
|
9
9
|
Codex Bridge starts the local `codex app-server` over stdio, discovers
|
|
10
10
|
non-archived top-level Codex threads, maps each thread to a Board Session,
|
|
11
11
|
receives reserved work, and streams supported progress back to the Board. Kimi
|
|
12
12
|
Bridge starts the logged-in Kimi Code ACP server and manages real Kimi Sessions;
|
|
13
|
-
it does not expose Kimi as a fake Codex model.
|
|
13
|
+
it does not expose Kimi as a fake Codex model. Antigravity Bridge drives the
|
|
14
|
+
logged-in Google Antigravity CLI (`agy`) through its official headless
|
|
15
|
+
`stream-json` interface and keeps per-Thread conversation continuity; it never
|
|
16
|
+
reads Google's private conversation databases.
|
|
14
17
|
|
|
15
18
|
The Bridge uses the Board REST API and authenticated SSE directly. The Board
|
|
16
19
|
MCP server is optional and is not required for Bridge operation.
|
|
17
20
|
|
|
18
|
-
## Unified
|
|
21
|
+
## Unified Linux setup
|
|
19
22
|
|
|
20
23
|
Node.js 18 or newer is required. Run setup as the same OS user that owns the
|
|
21
24
|
selected agent login and workspaces:
|
|
22
25
|
|
|
23
26
|
```bash
|
|
24
|
-
npx --yes ai-task-board-bridge@1.0
|
|
27
|
+
npx --yes ai-task-board-bridge@1.4.0 setup
|
|
25
28
|
```
|
|
26
29
|
|
|
27
|
-
The first prompt offers `Codex Bridge`, `Kimi Bridge`,
|
|
28
|
-
repeat installs can bypass that first prompt:
|
|
30
|
+
The first prompt offers `Codex Bridge`, `Kimi Bridge`, `Antigravity Bridge`,
|
|
31
|
+
`both`, and `all`. Automation or repeat installs can bypass that first prompt:
|
|
29
32
|
|
|
30
33
|
```bash
|
|
31
|
-
npx --yes ai-task-board-bridge@1.0
|
|
32
|
-
npx --yes ai-task-board-bridge@1.0
|
|
33
|
-
npx --yes ai-task-board-bridge@1.0
|
|
34
|
+
npx --yes ai-task-board-bridge@1.4.0 setup codex
|
|
35
|
+
npx --yes ai-task-board-bridge@1.4.0 setup kimi
|
|
36
|
+
npx --yes ai-task-board-bridge@1.4.0 setup antigravity
|
|
37
|
+
npx --yes ai-task-board-bridge@1.4.0 setup both
|
|
38
|
+
npx --yes ai-task-board-bridge@1.4.0 setup all
|
|
34
39
|
```
|
|
35
40
|
|
|
36
|
-
Installing
|
|
37
|
-
Connection with the matching platform for each runtime; a
|
|
38
|
-
be reused for
|
|
39
|
-
|
|
41
|
+
Installing a combination runs the selected setup flows in sequence. Create a
|
|
42
|
+
separate Board Connection with the matching platform for each runtime; a token
|
|
43
|
+
for one runtime must not be reused for another. The public tarball embeds the
|
|
44
|
+
private Kimi and Antigravity runtimes, so no second npm package needs to be
|
|
45
|
+
published or installed.
|
|
46
|
+
|
|
47
|
+
`setup` always finishes by installing and starting a systemd user service; it
|
|
48
|
+
never leaves a Bridge running inside the `npx` process. When stdin/stdout is
|
|
49
|
+
not a TTY (for example an SSH command or CI script), `setup codex`,
|
|
50
|
+
`setup kimi`, and `setup antigravity` install the same services from
|
|
51
|
+
environment variables without prompting. The `both`/`all` targets remain
|
|
52
|
+
interactive because each runtime needs its own Connection Token.
|
|
40
53
|
|
|
41
54
|
### Codex setup
|
|
42
55
|
|
|
43
|
-
The Codex setup wizard asks for the Board URL
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
The Codex setup wizard asks for the Board URL and hidden Connection Token.
|
|
57
|
+
Working directories are optional: new installs default to Web-side management,
|
|
58
|
+
so project directories are added later in the Board's "AI 连接 → Bridge
|
|
59
|
+
设置 / 新建项目" instead of being typed during setup. Choosing the local mode
|
|
60
|
+
instead fixes a device allowlist at install time. The wizard also collects the
|
|
61
|
+
Codex home and executable, custom-provider credential environment variables,
|
|
62
|
+
thread limits, and permission/approval modes. It then installs and starts
|
|
63
|
+
`ai-task-board-bridge.service` in the effective user's systemd user manager.
|
|
64
|
+
Running with no command also enters setup in a TTY when either required Board
|
|
65
|
+
setting is missing.
|
|
66
|
+
|
|
67
|
+
Choosing Web-side directory management enables both
|
|
68
|
+
`CODEX_BRIDGE_WEB_CONFIG=true` and
|
|
69
|
+
`CODEX_BRIDGE_ALLOW_REMOTE_WORKING_DIRECTORIES=true` in the installed
|
|
70
|
+
environment file. The generated unit still needs an existing
|
|
71
|
+
`WorkingDirectory=` for the App Server startup fallback, so setup uses the
|
|
72
|
+
user's home directory for that unit field only; it is not registered as a
|
|
73
|
+
managed project directory and no `CODEX_WORKING_DIRECTORY` or
|
|
74
|
+
`CODEX_WORKING_DIRECTORIES` is written.
|
|
75
|
+
|
|
76
|
+
Non-interactive Codex service install uses the same safe defaults as the
|
|
77
|
+
wizard:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
AI_TASK_BOARD_URL='https://board.example.com' \
|
|
81
|
+
AI_TASK_BOARD_CONNECTION_TOKEN='atb_REPLACE_ME' \
|
|
82
|
+
npx --yes ai-task-board-bridge@1.4.0 setup codex
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Without `CODEX_WORKING_DIRECTORY` or `CODEX_WORKING_DIRECTORIES` the
|
|
86
|
+
non-interactive install also defaults to Web-side directory management. Pass
|
|
87
|
+
either variable to fix a local allowlist instead.
|
|
50
88
|
|
|
51
89
|
The generated unit has no `User=` directive: a systemd user manager already
|
|
52
90
|
runs as its owning UID. Setup explicitly binds that user's `HOME` and
|
|
@@ -66,16 +104,17 @@ updates the configuration and restarts the service. Upgrades disable the legacy
|
|
|
66
104
|
`ai-task-board-codex-bridge.service` before starting
|
|
67
105
|
`ai-task-board-bridge.service`, with rollback if the new service fails to start.
|
|
68
106
|
|
|
69
|
-
## Foreground
|
|
107
|
+
## Foreground run mode
|
|
70
108
|
|
|
71
|
-
The original environment-variable interface remains available
|
|
72
|
-
install a
|
|
109
|
+
The original environment-variable interface remains available for other
|
|
110
|
+
process managers and temporary runs. Unlike `setup`, it does not install a
|
|
111
|
+
service, so a terminated `npx` process takes the Bridge down with it:
|
|
73
112
|
|
|
74
113
|
```bash
|
|
75
114
|
AI_TASK_BOARD_URL='https://board.example.com' \
|
|
76
115
|
AI_TASK_BOARD_CONNECTION_TOKEN='atb_REPLACE_ME' \
|
|
77
116
|
CODEX_WORKING_DIRECTORY='/path/to/a/safe/start-directory' \
|
|
78
|
-
npx --yes ai-task-board-bridge@1.0
|
|
117
|
+
npx --yes ai-task-board-bridge@1.4.0 run codex
|
|
79
118
|
```
|
|
80
119
|
|
|
81
120
|
> **High-risk foreground defaults:** when these values are omitted, the Bridge uses
|
|
@@ -93,7 +132,7 @@ scope with one exact existing-thread compatibility filter:
|
|
|
93
132
|
|
|
94
133
|
```bash
|
|
95
134
|
CODEX_THREAD_ID='REPLACE_WITH_LOCAL_THREAD_ID' \
|
|
96
|
-
npx --yes ai-task-board-bridge@1.0
|
|
135
|
+
npx --yes ai-task-board-bridge@1.4.0
|
|
97
136
|
```
|
|
98
137
|
|
|
99
138
|
Bridge 0.7 and later can manage several exact working directories in one process:
|
|
@@ -101,7 +140,7 @@ Bridge 0.7 and later can manage several exact working directories in one process
|
|
|
101
140
|
```bash
|
|
102
141
|
CODEX_WORKING_DIRECTORIES='[{"key":"main","name":"Main App","path":"/srv/main"},{"key":"docs","name":"Docs","path":"/srv/docs"}]' \
|
|
103
142
|
CODEX_THREAD_SCOPE='cwd' \
|
|
104
|
-
npx --yes ai-task-board-bridge@1.0
|
|
143
|
+
npx --yes ai-task-board-bridge@1.4.0
|
|
105
144
|
```
|
|
106
145
|
|
|
107
146
|
The JSON array accepts 1 to 100 unique `{key,name?,path}` entries. Its first
|
|
@@ -151,8 +190,11 @@ The device environment remains the immutable security boundary:
|
|
|
151
190
|
- Web working-directory configuration is denied unless the device explicitly
|
|
152
191
|
sets `CODEX_BRIDGE_ALLOW_REMOTE_WORKING_DIRECTORIES=true`. A remote list must
|
|
153
192
|
contain 1 to 100 unique entries with absolute paths that already exist and are
|
|
154
|
-
directories.
|
|
155
|
-
|
|
193
|
+
directories. An entry may carry `create_if_missing: true`, which authorizes
|
|
194
|
+
the device to create the path with `mkdir -p` before validating it; without
|
|
195
|
+
the flag the check stays fail-closed. Missing, null, or locally denied
|
|
196
|
+
remote values retain the immutable `CODEX_WORKING_DIRECTORIES` /
|
|
197
|
+
`CODEX_WORKING_DIRECTORY` startup list.
|
|
156
198
|
- The Board cannot change the URL/token, Codex executable, thread scope/fixed
|
|
157
199
|
thread, permission mode, approval mode, or the immutable local fallback list.
|
|
158
200
|
|
|
@@ -172,6 +214,63 @@ at least every 10 seconds, and a local safety deadline stops workers before a
|
|
|
172
214
|
lease can expire during a prolonged Board outage. The deprecated-Board 404
|
|
173
215
|
fallback cannot provide this single-runtime fence.
|
|
174
216
|
|
|
217
|
+
## Web-triggered Bridge upgrades
|
|
218
|
+
|
|
219
|
+
The Board can ask a device to move its Bridge to a newer npm release: each
|
|
220
|
+
configuration exchange response may carry `desired_bridge_version`, and a
|
|
221
|
+
Bridge that sees a newer, valid semver target upgrades itself. The Board only
|
|
222
|
+
transports the version string; the code is always downloaded from the npm
|
|
223
|
+
registry with `npm pack`, which verifies the registry integrity metadata
|
|
224
|
+
before anything is installed.
|
|
225
|
+
|
|
226
|
+
Remote upgrades are disabled by default and require two local gates:
|
|
227
|
+
|
|
228
|
+
- `AI_TASK_BOARD_ALLOW_REMOTE_UPDATE=true` in the Bridge environment (for a
|
|
229
|
+
systemd install, add it to the `0600` environment file and restart the
|
|
230
|
+
service), and
|
|
231
|
+
- the Bridge process must run under systemd (`INVOCATION_ID` is set). A
|
|
232
|
+
foreground Bridge logs a one-time stderr hint per target version and keeps
|
|
233
|
+
running the old code; upgrade it manually by rerunning
|
|
234
|
+
`npx --yes ai-task-board-bridge@1.4.0 setup` for the same runtime.
|
|
235
|
+
|
|
236
|
+
With both gates satisfied, the Bridge downloads
|
|
237
|
+
`ai-task-board-bridge@<version>` (120-second timeout), extracts the tarball
|
|
238
|
+
into a staging directory, installs this runtime's `dist` subtree into
|
|
239
|
+
`versions/<version>/` next to the current one, smoke-tests
|
|
240
|
+
`node versions/<version>/dist/cli.js --version` (10-second timeout; the output
|
|
241
|
+
must contain the target version), rewrites the systemd unit `ExecStart` to the
|
|
242
|
+
new runtime while preserving the existing `HOME`, `CODEX_HOME`,
|
|
243
|
+
`WorkingDirectory`, and `EnvironmentFile` settings, runs
|
|
244
|
+
`systemctl --user daemon-reload`, and exits with code 75 so
|
|
245
|
+
`Restart=on-failure` starts the new version about five seconds later.
|
|
246
|
+
|
|
247
|
+
A failed attempt cleans up staging, keeps the old version running, and reports
|
|
248
|
+
the error in the next configuration exchange's `error` field, which the Board
|
|
249
|
+
surfaces in the Bridge settings dialog. The same target version is not retried
|
|
250
|
+
until the Board changes it or the Bridge process restarts, so a broken release
|
|
251
|
+
cannot cause a retry storm.
|
|
252
|
+
|
|
253
|
+
Old version directories are kept for manual rollback. To roll back, point the
|
|
254
|
+
unit's `ExecStart` back at the previous runtime and restart the service:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
$EDITOR ~/.config/systemd/user/ai-task-board-bridge.service
|
|
258
|
+
# ExecStart="…/node" "…/.local/share/ai-task-board/codex-bridge/versions/<previous>/dist/cli.js" "run"
|
|
259
|
+
systemctl --user daemon-reload
|
|
260
|
+
systemctl --user restart ai-task-board-bridge.service
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Device identity
|
|
264
|
+
|
|
265
|
+
Every session-inventory sync (`POST /api/ai/sessions/sync`) carries two flat
|
|
266
|
+
fields: `device_id` and `device_label` (the OS hostname). The device ID is a
|
|
267
|
+
UUID generated on first Bridge start and persisted to
|
|
268
|
+
`$XDG_CONFIG_HOME/ai-task-board/device-id` (default
|
|
269
|
+
`~/.config/ai-task-board/device-id`) with `0600` permissions. All AI Task
|
|
270
|
+
Board bridges on the same host share that file, so the Board can group the
|
|
271
|
+
Codex, Kimi, and Antigravity runtimes of one device. If the file cannot be
|
|
272
|
+
written, the Bridge logs a warning and runs with an ephemeral ID.
|
|
273
|
+
|
|
175
274
|
## Web Thread management
|
|
176
275
|
|
|
177
276
|
Bridge 0.5 lets a Workspace owner create, rename, and delete Codex Threads from
|
|
@@ -266,12 +365,12 @@ strong token-isolation boundary. Use a separate UID and/or a token proxy when
|
|
|
266
365
|
strong isolation is required. Board schema and `/api/ai/sessions/sync` must be
|
|
267
366
|
upgraded before starting 0.8; there is no 404 fallback to the old registration
|
|
268
367
|
API. On Linux, use `setup` for a pinned local runtime and systemd user service.
|
|
269
|
-
On other platforms, pin version `1.0
|
|
368
|
+
On other platforms, pin version `1.2.0` in launchd or another process manager.
|
|
270
369
|
Run only one Bridge for the same device/Connection, and
|
|
271
370
|
do not let another TUI, IDE, or automation writer submit turns to a managed
|
|
272
371
|
thread at the same time.
|
|
273
372
|
|
|
274
|
-
Use `npx --yes ai-task-board-bridge@1.0
|
|
373
|
+
Use `npx --yes ai-task-board-bridge@1.4.0 --help` for the complete
|
|
275
374
|
environment-variable list.
|
|
276
375
|
|
|
277
376
|
## Kimi Bridge
|
|
@@ -290,7 +389,7 @@ AI_TASK_BOARD_CONNECTION_TOKEN='atb_REPLACE_ME' \
|
|
|
290
389
|
KIMI_WORKING_DIRECTORY='/absolute/path/to/project' \
|
|
291
390
|
KIMI_BRIDGE_MODE='auto' \
|
|
292
391
|
KIMI_BRIDGE_APPROVAL_MODE='accept' \
|
|
293
|
-
npx --yes ai-task-board-bridge@1.0
|
|
392
|
+
npx --yes ai-task-board-bridge@1.4.0 run kimi
|
|
294
393
|
```
|
|
295
394
|
|
|
296
395
|
`KIMI_WORKING_DIRECTORIES` accepts 1 to 100 unique exact
|
|
@@ -302,3 +401,36 @@ environment, and only final replies plus bounded completion metadata are
|
|
|
302
401
|
uploaded. Interactive setup defaults to declining extra ACP permissions;
|
|
303
402
|
`KIMI_BRIDGE_MODE=yolo` and `KIMI_BRIDGE_APPROVAL_MODE=accept` are explicit
|
|
304
403
|
high-risk opt-ins.
|
|
404
|
+
|
|
405
|
+
## Antigravity Bridge
|
|
406
|
+
|
|
407
|
+
Antigravity Bridge requires Google Antigravity CLI 1.1.8 or newer with an active
|
|
408
|
+
login (`agy update` upgrades; the interactive installer verifies the version) and
|
|
409
|
+
a dedicated Board Connection whose platform is `Antigravity`. Interactive setup
|
|
410
|
+
installs the separate `ai-task-board-antigravity-bridge.service`, stores its
|
|
411
|
+
token in a `0600` environment file, and stages the embedded Antigravity runtime
|
|
412
|
+
under the current user's XDG data directory.
|
|
413
|
+
|
|
414
|
+
Foreground or non-systemd operation uses the same public npm package:
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
AI_TASK_BOARD_URL='https://board.example.com' \
|
|
418
|
+
AI_TASK_BOARD_CONNECTION_TOKEN='atb_REPLACE_ME' \
|
|
419
|
+
ANTIGRAVITY_WORKING_DIRECTORY='/absolute/path/to/project' \
|
|
420
|
+
ANTIGRAVITY_BRIDGE_MODE='auto' \
|
|
421
|
+
ANTIGRAVITY_BRIDGE_APPROVAL_MODE='accept' \
|
|
422
|
+
npx --yes ai-task-board-bridge@1.4.0 run antigravity
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
`ANTIGRAVITY_WORKING_DIRECTORIES` accepts 1 to 100 unique exact
|
|
426
|
+
`{key,name?,path}` entries. The Bridge dynamically reports the `agy models`
|
|
427
|
+
catalog with `low`/`medium`/`high` reasoning efforts. Each Web Thread is a
|
|
428
|
+
stable local binding; the first claimed task creates the real agy conversation
|
|
429
|
+
and later turns resume it with `--conversation`. Web creation and deletion are
|
|
430
|
+
supported, rename stays hidden (no public headless rename API), and deleting a
|
|
431
|
+
Thread removes only the Bridge binding so local history is preserved. The Board
|
|
432
|
+
token is removed from the `agy` child environment, and only final replies plus
|
|
433
|
+
bounded completion metadata are uploaded.
|
|
434
|
+
`ANTIGRAVITY_BRIDGE_APPROVAL_MODE=accept` adds
|
|
435
|
+
`--dangerously-skip-permissions` and is a high-risk opt-in;
|
|
436
|
+
`ANTIGRAVITY_BRIDGE_SANDBOX=true` enables agy's terminal sandbox.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** Provider-neutral quota snapshot understood by the Board sync API. */
|
|
2
|
+
export type SyncedQuota = {
|
|
3
|
+
provider: "codex" | "kimi" | "antigravity";
|
|
4
|
+
status: "ok" | "unavailable" | "error";
|
|
5
|
+
message: string | null;
|
|
6
|
+
account: string | null;
|
|
7
|
+
plan: string | null;
|
|
8
|
+
fetched_at: string;
|
|
9
|
+
buckets: SyncedQuotaBucket[];
|
|
10
|
+
credits: SyncedQuotaCredits | null;
|
|
11
|
+
};
|
|
12
|
+
export type SyncedQuotaBucket = {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
remaining_percent: number | null;
|
|
16
|
+
used_percent: number | null;
|
|
17
|
+
limit: number | null;
|
|
18
|
+
used: number | null;
|
|
19
|
+
remaining: number | null;
|
|
20
|
+
resets_at: string | null;
|
|
21
|
+
unlimited: boolean;
|
|
22
|
+
description: string | null;
|
|
23
|
+
};
|
|
24
|
+
export type SyncedQuotaCredits = {
|
|
25
|
+
balance: string | null;
|
|
26
|
+
has_credits: boolean;
|
|
27
|
+
unlimited: boolean;
|
|
28
|
+
available_resets: number | null;
|
|
29
|
+
description: string | null;
|
|
30
|
+
};
|
|
31
|
+
type RateLimitSnapshot = {
|
|
32
|
+
limitId?: string | null;
|
|
33
|
+
limitName?: string | null;
|
|
34
|
+
planType?: string | null;
|
|
35
|
+
primary?: {
|
|
36
|
+
resetsAt?: number | null;
|
|
37
|
+
usedPercent?: number | null;
|
|
38
|
+
windowDurationMins?: number | null;
|
|
39
|
+
} | null;
|
|
40
|
+
secondary?: {
|
|
41
|
+
resetsAt?: number | null;
|
|
42
|
+
usedPercent?: number | null;
|
|
43
|
+
windowDurationMins?: number | null;
|
|
44
|
+
} | null;
|
|
45
|
+
credits?: {
|
|
46
|
+
balance?: string | null;
|
|
47
|
+
hasCredits?: boolean;
|
|
48
|
+
unlimited?: boolean;
|
|
49
|
+
} | null;
|
|
50
|
+
individualLimit?: {
|
|
51
|
+
limit?: string | null;
|
|
52
|
+
remainingPercent?: number | null;
|
|
53
|
+
resetsAt?: number | null;
|
|
54
|
+
used?: string | null;
|
|
55
|
+
} | null;
|
|
56
|
+
};
|
|
57
|
+
export type CodexAccountRateLimits = {
|
|
58
|
+
rateLimits: RateLimitSnapshot;
|
|
59
|
+
rateLimitsByLimitId?: Record<string, RateLimitSnapshot> | null;
|
|
60
|
+
rateLimitResetCredits?: {
|
|
61
|
+
availableCount?: number | null;
|
|
62
|
+
} | null;
|
|
63
|
+
};
|
|
64
|
+
export declare function normalizeCodexQuota(value: unknown, now?: Date): SyncedQuota;
|
|
65
|
+
export declare function unavailableQuota(now: Date, message: string): SyncedQuota;
|
|
66
|
+
export declare function quotaError(now: Date, message: string): SyncedQuota;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=account-quota.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-quota.d.ts","sourceRoot":"","sources":["../src/account-quota.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,aAAa,CAAC;IAC3C,MAAM,EAAE,IAAI,GAAG,aAAa,GAAG,OAAO,CAAC;IACvC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB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MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,IAAI,CAAC;IAC/D,qBAAqB,CAAC,EAAE;QACtB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAChC,GAAG,IAAI,CAAC;CACV,CAAC;AAyFF,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,GAAG,OAAa,GACf,WAAW,CAmDb;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,MAAM,GACd,WAAW,CAWb;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,CAWlE"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
function isRecord(value) {
|
|
2
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
function finiteNumber(value) {
|
|
5
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
6
|
+
}
|
|
7
|
+
function percent(value) {
|
|
8
|
+
const number = finiteNumber(value);
|
|
9
|
+
if (number === null || number < 0 || number > 100)
|
|
10
|
+
return null;
|
|
11
|
+
return number;
|
|
12
|
+
}
|
|
13
|
+
function epochToIso(value) {
|
|
14
|
+
const seconds = finiteNumber(value);
|
|
15
|
+
if (seconds === null || !Number.isFinite(seconds * 1_000))
|
|
16
|
+
return null;
|
|
17
|
+
const date = new Date(seconds * 1_000);
|
|
18
|
+
return Number.isNaN(date.getTime()) ? null : date.toISOString();
|
|
19
|
+
}
|
|
20
|
+
function windowLabel(minutes, fallback) {
|
|
21
|
+
const value = finiteNumber(minutes);
|
|
22
|
+
if (value === null || value < 1)
|
|
23
|
+
return fallback;
|
|
24
|
+
if (value >= 1_440 && value % 1_440 === 0) {
|
|
25
|
+
return `${Math.round(value / 1_440)} 天`;
|
|
26
|
+
}
|
|
27
|
+
if (value >= 60 && value % 60 === 0) {
|
|
28
|
+
return `${Math.round(value / 60)} 小时`;
|
|
29
|
+
}
|
|
30
|
+
return `${Math.round(value)} 分钟`;
|
|
31
|
+
}
|
|
32
|
+
function windowBucket(window, id, fallbackLabel) {
|
|
33
|
+
const usedPercent = percent(window?.usedPercent);
|
|
34
|
+
return {
|
|
35
|
+
id,
|
|
36
|
+
label: windowLabel(window?.windowDurationMins, fallbackLabel),
|
|
37
|
+
remaining_percent: usedPercent === null ? null : Math.round((100 - usedPercent) * 10) / 10,
|
|
38
|
+
used_percent: usedPercent,
|
|
39
|
+
limit: null,
|
|
40
|
+
used: null,
|
|
41
|
+
remaining: null,
|
|
42
|
+
resets_at: epochToIso(window?.resetsAt),
|
|
43
|
+
unlimited: false,
|
|
44
|
+
description: null,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function snapshotToBuckets(snapshot, key) {
|
|
48
|
+
const buckets = [];
|
|
49
|
+
if (snapshot.primary) {
|
|
50
|
+
buckets.push(windowBucket(snapshot.primary, `${key}:primary`, "短周期额度"));
|
|
51
|
+
}
|
|
52
|
+
if (snapshot.secondary) {
|
|
53
|
+
buckets.push(windowBucket(snapshot.secondary, `${key}:secondary`, "长周期额度"));
|
|
54
|
+
}
|
|
55
|
+
if (snapshot.individualLimit) {
|
|
56
|
+
buckets.push({
|
|
57
|
+
id: `${key}:individual`,
|
|
58
|
+
label: "个人消费限额",
|
|
59
|
+
remaining_percent: percent(snapshot.individualLimit.remainingPercent),
|
|
60
|
+
used_percent: null,
|
|
61
|
+
limit: null,
|
|
62
|
+
used: null,
|
|
63
|
+
remaining: null,
|
|
64
|
+
resets_at: epochToIso(snapshot.individualLimit.resetsAt),
|
|
65
|
+
unlimited: false,
|
|
66
|
+
description: typeof snapshot.individualLimit.limit === "string"
|
|
67
|
+
? snapshot.individualLimit.limit
|
|
68
|
+
: null,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return buckets;
|
|
72
|
+
}
|
|
73
|
+
export function normalizeCodexQuota(value, now = new Date()) {
|
|
74
|
+
if (!isRecord(value)) {
|
|
75
|
+
return unavailableQuota(now, "Codex 未返回额度数据");
|
|
76
|
+
}
|
|
77
|
+
const rateLimits = isRecord(value.rateLimits)
|
|
78
|
+
? value.rateLimits
|
|
79
|
+
: null;
|
|
80
|
+
if (!rateLimits) {
|
|
81
|
+
return unavailableQuota(now, "Codex 未返回额度数据");
|
|
82
|
+
}
|
|
83
|
+
const byLimitId = isRecord(value.rateLimitsByLimitId)
|
|
84
|
+
? value.rateLimitsByLimitId
|
|
85
|
+
: null;
|
|
86
|
+
const buckets = snapshotToBuckets(rateLimits, "account");
|
|
87
|
+
for (const [limitId, snapshot] of Object.entries(byLimitId ?? {})) {
|
|
88
|
+
if (!isRecord(snapshot))
|
|
89
|
+
continue;
|
|
90
|
+
const typed = snapshot;
|
|
91
|
+
if (limitId && limitId === rateLimits.limitId)
|
|
92
|
+
continue;
|
|
93
|
+
buckets.push(...snapshotToBuckets(typed, limitId || "account"));
|
|
94
|
+
}
|
|
95
|
+
const credits = isRecord(rateLimits.credits)
|
|
96
|
+
? rateLimits.credits
|
|
97
|
+
: null;
|
|
98
|
+
const resetCredits = isRecord(value.rateLimitResetCredits)
|
|
99
|
+
? value.rateLimitResetCredits
|
|
100
|
+
: null;
|
|
101
|
+
const availableResets = finiteNumber(resetCredits?.availableCount);
|
|
102
|
+
return {
|
|
103
|
+
provider: "codex",
|
|
104
|
+
status: "ok",
|
|
105
|
+
message: null,
|
|
106
|
+
account: null,
|
|
107
|
+
plan: typeof rateLimits.planType === "string" ? rateLimits.planType : null,
|
|
108
|
+
fetched_at: now.toISOString(),
|
|
109
|
+
buckets,
|
|
110
|
+
credits: {
|
|
111
|
+
balance: typeof credits?.balance === "string" ? credits.balance : null,
|
|
112
|
+
has_credits: credits?.hasCredits === true,
|
|
113
|
+
unlimited: credits?.unlimited === true,
|
|
114
|
+
available_resets: availableResets !== null &&
|
|
115
|
+
Number.isInteger(availableResets) &&
|
|
116
|
+
availableResets >= 0
|
|
117
|
+
? availableResets
|
|
118
|
+
: null,
|
|
119
|
+
description: null,
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
export function unavailableQuota(now, message) {
|
|
124
|
+
return {
|
|
125
|
+
provider: "codex",
|
|
126
|
+
status: "unavailable",
|
|
127
|
+
message,
|
|
128
|
+
account: null,
|
|
129
|
+
plan: null,
|
|
130
|
+
fetched_at: now.toISOString(),
|
|
131
|
+
buckets: [],
|
|
132
|
+
credits: null,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
export function quotaError(now, message) {
|
|
136
|
+
return {
|
|
137
|
+
provider: "codex",
|
|
138
|
+
status: "error",
|
|
139
|
+
message,
|
|
140
|
+
account: null,
|
|
141
|
+
plan: null,
|
|
142
|
+
fetched_at: now.toISOString(),
|
|
143
|
+
buckets: [],
|
|
144
|
+
credits: null,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=account-quota.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-quota.js","sourceRoot":"","sources":["../src/account-quota.ts"],"names":[],"mappings":"AAoEA,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5E,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,GAAG;QAAE,OAAO,IAAI,CAAC;IAC/D,OAAO,MAAM,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E,EAAE;QACX,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAS,EAAE,OAAe;IACnD,OAAO;QACL,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,OAAO;QACf,OAAO;QACP,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,GAAG,CAAC,WAAW,EAAE;QAC7B,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { AntigravityBridgeConfiguration } from "./config.js";
|
|
2
|
+
export declare const ANTIGRAVITY_MINIMUM_VERSION = "1.1.8";
|
|
3
|
+
export declare const AGY_STREAM_PROTOCOL = "agy-stream-json/v1";
|
|
4
|
+
export type InventoryModel = {
|
|
5
|
+
id: string;
|
|
6
|
+
model: string;
|
|
7
|
+
display_name: string;
|
|
8
|
+
description: string | null;
|
|
9
|
+
default_reasoning_effort: string | null;
|
|
10
|
+
supported_reasoning_efforts: Array<{
|
|
11
|
+
reasoning_effort: string;
|
|
12
|
+
description: string | null;
|
|
13
|
+
}>;
|
|
14
|
+
input_modalities: string[];
|
|
15
|
+
is_default: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const ANTIGRAVITY_FALLBACK_MODEL_CATALOG: readonly InventoryModel[];
|
|
18
|
+
export type AgyUsage = {
|
|
19
|
+
input_tokens?: number;
|
|
20
|
+
output_tokens?: number;
|
|
21
|
+
thinking_tokens?: number;
|
|
22
|
+
cache_read_tokens?: number;
|
|
23
|
+
total_tokens?: number;
|
|
24
|
+
};
|
|
25
|
+
export type AgyInitEvent = {
|
|
26
|
+
conversation_id?: string;
|
|
27
|
+
cwd?: string;
|
|
28
|
+
tools?: string[];
|
|
29
|
+
permission_mode?: string;
|
|
30
|
+
model?: string;
|
|
31
|
+
agent?: string;
|
|
32
|
+
};
|
|
33
|
+
export type AgyStepUpdateEvent = {
|
|
34
|
+
conversation_id?: string;
|
|
35
|
+
step_index?: number;
|
|
36
|
+
state?: string;
|
|
37
|
+
step_type?: string;
|
|
38
|
+
text_delta?: string;
|
|
39
|
+
tool_name?: string;
|
|
40
|
+
duration_seconds?: number;
|
|
41
|
+
usage?: AgyUsage;
|
|
42
|
+
tool_info?: {
|
|
43
|
+
name?: string;
|
|
44
|
+
error?: unknown;
|
|
45
|
+
} | null;
|
|
46
|
+
};
|
|
47
|
+
export type AgyResultEvent = {
|
|
48
|
+
conversation_id?: string;
|
|
49
|
+
status?: string;
|
|
50
|
+
response?: string;
|
|
51
|
+
error?: string;
|
|
52
|
+
duration_seconds?: number;
|
|
53
|
+
num_turns?: number;
|
|
54
|
+
usage?: AgyUsage;
|
|
55
|
+
};
|
|
56
|
+
export type AgyPromptResult = {
|
|
57
|
+
conversationId: string | null;
|
|
58
|
+
response: string;
|
|
59
|
+
status: string;
|
|
60
|
+
model: string | null;
|
|
61
|
+
usage: AgyUsage | null;
|
|
62
|
+
durationSeconds: number | null;
|
|
63
|
+
numTurns: number | null;
|
|
64
|
+
toolCallCount: number;
|
|
65
|
+
failedToolCallCount: number;
|
|
66
|
+
checkpointCount: number;
|
|
67
|
+
};
|
|
68
|
+
export type AgyPromptOptions = {
|
|
69
|
+
cwd: string;
|
|
70
|
+
prompt: string;
|
|
71
|
+
conversationId?: string | null;
|
|
72
|
+
model?: string | null;
|
|
73
|
+
reasoningEffort?: string | null;
|
|
74
|
+
signal: AbortSignal;
|
|
75
|
+
onTextDelta?: (text: string) => void;
|
|
76
|
+
onConversationId?: (conversationId: string) => void;
|
|
77
|
+
};
|
|
78
|
+
export type AgyStreamState = {
|
|
79
|
+
conversationId: string | null;
|
|
80
|
+
initModel: string | null;
|
|
81
|
+
response: string;
|
|
82
|
+
status: string;
|
|
83
|
+
usage: AgyUsage | null;
|
|
84
|
+
durationSeconds: number | null;
|
|
85
|
+
numTurns: number | null;
|
|
86
|
+
toolCallCount: number;
|
|
87
|
+
failedToolCallCount: number;
|
|
88
|
+
checkpointCount: number;
|
|
89
|
+
sawResult: boolean;
|
|
90
|
+
};
|
|
91
|
+
export declare function initialAgyStreamState(conversationId: string | null): AgyStreamState;
|
|
92
|
+
/**
|
|
93
|
+
* Pure NDJSON event reducer for agy's documented stream-json output. Kept
|
|
94
|
+
* separate from the spawn plumbing so parsing stays unit-testable.
|
|
95
|
+
*/
|
|
96
|
+
export declare function reduceAgyStreamEvent(state: AgyStreamState, event: Record<string, unknown>, hooks?: {
|
|
97
|
+
onTextDelta?: (text: string) => void;
|
|
98
|
+
onConversationId?: (conversationId: string) => void;
|
|
99
|
+
}): void;
|
|
100
|
+
type ModelListItem = {
|
|
101
|
+
id: string;
|
|
102
|
+
name: string;
|
|
103
|
+
isDefault?: boolean;
|
|
104
|
+
};
|
|
105
|
+
export declare function parseModelListText(raw: string): ModelListItem[];
|
|
106
|
+
export declare function inventoryModelFromListItem(item: ModelListItem, index: number): InventoryModel;
|
|
107
|
+
export declare class AgyClient {
|
|
108
|
+
private readonly configuration;
|
|
109
|
+
private versionValue;
|
|
110
|
+
constructor(configuration: Pick<AntigravityBridgeConfiguration, "agyBinary" | "agentMode" | "approvalMode" | "sandbox" | "printTimeoutMs">);
|
|
111
|
+
version(): Promise<string>;
|
|
112
|
+
ensureSupportedVersion(): Promise<void>;
|
|
113
|
+
modelCatalog(): Promise<InventoryModel[]>;
|
|
114
|
+
prompt(options: AgyPromptOptions): Promise<AgyPromptResult>;
|
|
115
|
+
}
|
|
116
|
+
export {};
|
|
117
|
+
//# sourceMappingURL=agy-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agy-client.d.ts","sourceRoot":"","sources":["../src/agy-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAQlE,eAAO,MAAM,2BAA2B,UAAU,CAAC;AACnD,eAAO,MAAM,mBAAmB,uBAAuB,CAAC;AAExD,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