pi-agy-acp 0.2.2 → 0.2.3
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/CHANGELOG.md +7 -0
- package/README.md +11 -7
- package/docs/architecture.md +262 -0
- package/docs/development.md +68 -165
- package/docs/reference.md +150 -134
- package/docs/releasing.md +56 -0
- package/index.ts +76 -20
- package/package.json +1 -1
- package/src/catalog.ts +37 -29
- package/src/config.ts +1 -1
- package/src/runtime.ts +252 -148
package/docs/reference.md
CHANGED
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
# Reference
|
|
2
2
|
|
|
3
|
-
For installation and your first request, start with the
|
|
3
|
+
For installation and your first request, start with the
|
|
4
|
+
[installation guide](../README.md#install). For internal protocol and runtime
|
|
5
|
+
details, see [architecture](architecture.md).
|
|
4
6
|
|
|
5
7
|
## Commands
|
|
6
8
|
|
|
7
9
|
| Command | Behavior |
|
|
8
10
|
| --- | --- |
|
|
9
|
-
| `/agy-acp` or `/agy-acp status` | Show a status panel with runtime state, paths, sessions, model reasoning levels, and the last turn. |
|
|
10
|
-
| `/agy-acp quota [used\|remaining]` | Show account details, grouped quota bars, and reset countdowns, optionally switching and
|
|
11
|
-
| `/agy-acp
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
| `/agy-acp` or `/agy-acp status` | Show a status panel with runtime state, paths, account details, sessions, model reasoning levels, and the last turn. |
|
|
12
|
+
| `/agy-acp quota [used\|remaining]` | Show account details, grouped quota bars, and reset countdowns, optionally switching and saving the display mode. |
|
|
13
|
+
| `/agy-acp refresh` | Force a live model catalog refresh from `agy` and update `catalog.json`. |
|
|
14
|
+
| `/agy-acp reset` | Dispose the ACP runtime (stopping `agy`), clear sessions, status indicator, quota cache, and warning history; the next request rebuilds from Pi's history. |
|
|
15
|
+
|
|
16
|
+
Subcommands support Tab completion (`status`, `quota`, `quota used`,
|
|
17
|
+
`quota remaining`, `refresh`, `reset`). Unknown arguments show
|
|
18
|
+
`Usage: /agy-acp [status|quota [used|remaining]|refresh|reset]` as a warning.
|
|
19
|
+
|
|
20
|
+
In interactive TUI mode, `/agy-acp quota` (`Fetching Antigravity quota...`) and
|
|
21
|
+
`/agy-acp refresh` (`Refreshing Antigravity models...`) display a cancellable
|
|
22
|
+
loader. Pressing Escape returns to the editor: `/agy-acp refresh` cancels the
|
|
23
|
+
caller's wait, while `/agy-acp quota` hides the pending panel even if the
|
|
24
|
+
underlying `/usage` query finishes updating the cache. Non-TUI modes run
|
|
25
|
+
directly without a loader.
|
|
15
26
|
|
|
16
27
|
### Status panel
|
|
17
28
|
|
|
18
|
-
The panel
|
|
19
|
-
|
|
20
|
-
|
|
29
|
+
The panel reports the runtime as `idle`, `starting`, `ready`, or `error`.
|
|
30
|
+
Viewing status never starts `agy`; before `agy` has been probed (by a turn,
|
|
31
|
+
`/agy-acp refresh`, or plan discovery), it shows the isolated home and notes
|
|
32
|
+
that `agy` starts lazily. Models list their supported reasoning levels,
|
|
21
33
|
including a fixed level where applicable.
|
|
22
34
|
|
|
23
35
|
Once a turn finishes, its summary shows the model, effort, outcome (`completed`,
|
|
@@ -29,18 +41,9 @@ healthy runtime uses a warning.
|
|
|
29
41
|
|
|
30
42
|
### Quota panel
|
|
31
43
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
will not appear after cancellation. Non-TUI modes query directly without a loader.
|
|
36
|
-
|
|
37
|
-
Quota is read through `agy -p /usage --output-format json`. Each model group has
|
|
38
|
-
one row per quota window, with a 12-cell bar, a rounded percentage, and a relative
|
|
39
|
-
reset time (omitted for untouched rolling windows at `0%` used / `100%` remaining
|
|
40
|
-
whose reset time is still a full window away). By default (`used` mode), bars and
|
|
41
|
-
percentages count up from `0%`; pass `remaining` (`/agy-acp quota remaining`) to
|
|
42
|
-
count down from `100%`. The last selected mode is saved in `settings.json` inside
|
|
43
|
-
`PI_AGY_HOME`. For example:
|
|
44
|
+
Quota is read through `agy -p /usage --output-format json`. Disabled quota
|
|
45
|
+
buckets are excluded. Each model group renders one row per usable quota window
|
|
46
|
+
with a 12-cell bar, a rounded percentage, and a relative reset countdown:
|
|
44
47
|
|
|
45
48
|
```text
|
|
46
49
|
Antigravity Quota
|
|
@@ -52,68 +55,84 @@ Antigravity Quota
|
|
|
52
55
|
weekly [█░░░░░░░░░░░] 9% · resets in 6d 7h
|
|
53
56
|
```
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
- **Display mode:** Default is `used` (bars and percentages count up from `0%`).
|
|
59
|
+
Pass `remaining` (`/agy-acp quota remaining`) to count down from `100%`. When
|
|
60
|
+
a mode is passed, it is saved to `<PI_AGY_HOME>/settings.json` immediately,
|
|
61
|
+
even if the quota query is cancelled or fails.
|
|
62
|
+
- **Reset labels:** Untouched rolling windows at `0%` used (`100%` remaining)
|
|
63
|
+
whose reset time is still a full window away omit the countdown. Otherwise,
|
|
64
|
+
missing values show `n/a`, elapsed resets show `resetting soon`, unparseable
|
|
65
|
+
timestamps show `reset time unavailable`, and sub-minute windows show
|
|
66
|
+
`resets in <1m`.
|
|
67
|
+
- **Empty and stale responses:** A group with no usable windows shows
|
|
68
|
+
`No quota windows available.`, and an empty successful response shows
|
|
69
|
+
`No quota data available.`. Failed queries include the reason; if cached
|
|
70
|
+
groups exist, the title marks them `(stale)` and still renders their bars.
|
|
71
|
+
|
|
72
|
+
Notification severity uses the actual remaining fraction rather than the rounded
|
|
73
|
+
percentage:
|
|
57
74
|
|
|
58
75
|
| Condition | Notification |
|
|
59
76
|
| --- | --- |
|
|
60
77
|
| All known windows above 20% remaining (<80% used) | Info |
|
|
61
|
-
| Any window at or below 20% remaining (≥80% used),
|
|
78
|
+
| Any window at or below 20% remaining (≥80% used), none at or below 5% remaining | Warning |
|
|
62
79
|
| Any window at or below 5% remaining (≥95% used), or a failed quota query | Error |
|
|
63
80
|
|
|
64
|
-
Errors include the reason. If cached groups are available after a failed query,
|
|
65
|
-
the title marks them as `(stale)` and still displays their bars. An empty
|
|
66
|
-
successful response displays `No quota data available.`.
|
|
67
|
-
|
|
68
81
|
### Account details
|
|
69
82
|
|
|
70
|
-
Both panels
|
|
71
|
-
fields
|
|
72
|
-
it. This may start ACP but sends no model prompt; failure does not prevent quota
|
|
73
|
-
from appearing. Use `/agy-acp reset` to retry discovery. Viewing status never starts it.
|
|
83
|
+
Both panels display the email and subscription plan when known and omit
|
|
84
|
+
unavailable fields:
|
|
74
85
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
- **Plan:** If no plan is cached, the first `/agy-acp quota` query attempts
|
|
87
|
+
discovery using a temporary tool-less ACP session (stopped afterward if the
|
|
88
|
+
runtime was idle) without sending a model prompt. Failure does not block quota
|
|
89
|
+
display; use `/agy-acp reset` to retry discovery. Viewing status never probes
|
|
90
|
+
`agy`.
|
|
91
|
+
- **Email:** Read from `agy` login logs. With the default `PI_AGY_HOME`, the
|
|
92
|
+
extension also checks `ANTIGRAVITY_CLI_HOME`, `AGY_HOME`, and
|
|
93
|
+
`~/.gemini/antigravity-cli`; a custom `PI_AGY_HOME` stays isolated. Cached
|
|
94
|
+
plans and login logs can be stale after an account change.
|
|
81
95
|
|
|
82
96
|
### Quota status and warnings
|
|
83
97
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
per group,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
After an `antigravity-acp` run settles, the extension refreshes `/usage` in the
|
|
99
|
+
background (sharing any in-flight request and respecting the 2-minute TTL) and
|
|
100
|
+
displays a compact status bar indicator such as `AGY 20%` (or `AGY 80%` in
|
|
101
|
+
`remaining` mode):
|
|
102
|
+
|
|
103
|
+
- The percentage reflects the lowest known remaining window across the active
|
|
104
|
+
model's matching quota group(s). When group ownership is unknown or ambiguous
|
|
105
|
+
(including effort-capped pools without a known effort), the indicator and
|
|
106
|
+
low-quota warning are omitted.
|
|
107
|
+
- Background query failures stay silent and also respect the 2-minute TTL.
|
|
108
|
+
- Low-quota warnings fire once per group, window, reset time, and threshold at
|
|
109
|
+
or below 20% remaining (≥80% used) and 5% remaining (≥95% used).
|
|
110
|
+
- `/agy-acp quota` refreshes quota and updates the indicator; `/agy-acp status`
|
|
111
|
+
uses fresh cached quota only. Neither session start nor model selection starts
|
|
112
|
+
a quota command (switching between `antigravity-acp` models while a post-turn
|
|
113
|
+
check is already in flight retargets that check to the newly selected model).
|
|
114
|
+
- Selecting another provider hides the indicator; returning to Antigravity uses
|
|
115
|
+
only a fresh in-memory snapshot. `/agy-acp reset` clears the indicator and
|
|
116
|
+
warning history; shutdown clears the indicator.
|
|
117
|
+
|
|
118
|
+
Two automatic Pi safeguards also apply when `antigravity-acp` is the active
|
|
119
|
+
provider (other providers are untouched):
|
|
120
|
+
|
|
121
|
+
- **Prompt-cache warming veto:** Cancels Pi's automatic prompt-cache warming so
|
|
122
|
+
background warming requests do not consume Antigravity quota.
|
|
123
|
+
- **Auto-compaction threshold guard:** Cancels threshold-triggered compaction
|
|
124
|
+
while a model's context window is still unknown (`0`).
|
|
104
125
|
|
|
105
126
|
## Configuration
|
|
106
127
|
|
|
107
|
-
Set
|
|
128
|
+
Set environment variables before starting Pi:
|
|
108
129
|
|
|
109
130
|
| Variable | Purpose | Default |
|
|
110
131
|
| --- | --- | --- |
|
|
111
132
|
| `PI_AGY_COMMAND` | Absolute path to the `agy` executable. | Automatic discovery. |
|
|
112
|
-
| `PI_AGY_HOME` | Dedicated directory for this extension's
|
|
133
|
+
| `PI_AGY_HOME` | Dedicated directory for this extension's state. | `~/.pi/agent/cache/antigravity-acp` |
|
|
113
134
|
| `PI_AGY_QUOTA_DISPLAY` | Startup quota display mode (`used` or `remaining`), overriding `settings.json` for startup. Invalid values are ignored; `/agy-acp quota <mode>` overrides it for the active session. | `settings.json`, then `used` |
|
|
114
|
-
| `PI_AGY_DEBUG` | Set to `1` to
|
|
115
|
-
|
|
116
|
-
For example:
|
|
135
|
+
| `PI_AGY_DEBUG` | Set to `1` to print runtime warnings on `stderr` (silent by default to protect the TUI). | Unset (silent) |
|
|
117
136
|
|
|
118
137
|
```sh
|
|
119
138
|
PI_AGY_COMMAND=/absolute/path/to/agy pi -e ./index.ts
|
|
@@ -121,86 +140,83 @@ PI_AGY_COMMAND=/absolute/path/to/agy pi -e ./index.ts
|
|
|
121
140
|
|
|
122
141
|
### Stored data and authentication
|
|
123
142
|
|
|
124
|
-
|
|
125
|
-
plugins. It
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
`
|
|
140
|
-
|
|
143
|
+
`PI_AGY_HOME` isolates the bridge agent from your normal `agy` tools and
|
|
144
|
+
plugins. It stores the extension's `catalog.json`, `settings.json` (quota
|
|
145
|
+
display preference), ACP logs, and `agy/` (isolated `agy` state, settings, and
|
|
146
|
+
session databases).
|
|
147
|
+
|
|
148
|
+
- **Cleanup:** Temporary session artifacts and old logs are removed
|
|
149
|
+
automatically (best-effort if locked). Current logs, `catalog.json`,
|
|
150
|
+
`settings.json`, and authentication files are retained; sessions rebuild from
|
|
151
|
+
Pi's history. Use a separate `PI_AGY_HOME` for each concurrently running Pi
|
|
152
|
+
instance because startup cleanup assumes exclusive directory ownership.
|
|
153
|
+
- **OAuth sync:** With the default `PI_AGY_HOME` and file-backed auth, the
|
|
154
|
+
extension atomically syncs `antigravity-oauth-token` from your normal `agy`
|
|
155
|
+
directory (`ANTIGRAVITY_CLI_HOME`, `AGY_HOME`, or `~/.gemini/antigravity-cli`)
|
|
156
|
+
with `0600` permissions when the isolated copy is missing, empty, or older,
|
|
157
|
+
refusing symlinked paths. Sync failures warn rather than aborting startup. A
|
|
158
|
+
custom `PI_AGY_HOME` stays isolated and never copies tokens from default `agy`
|
|
159
|
+
directories.
|
|
160
|
+
- **Global quota scope:** `agy -p /usage` does not accept `--gemini-dir`, so
|
|
161
|
+
quota queries always reflect the global `agy` CLI account. Do not commit or
|
|
162
|
+
share `PI_AGY_HOME`; authentication and token refresh remain `agy`'s
|
|
163
|
+
responsibility.
|
|
141
164
|
|
|
142
165
|
## Models and context
|
|
143
166
|
|
|
144
|
-
Loading the extension restores
|
|
145
|
-
empty on a fresh install) without starting agy
|
|
146
|
-
`/model`)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
167
|
+
- **Discovery and caching:** Loading the extension restores `catalog.json` (or
|
|
168
|
+
starts empty on a fresh install) without starting `agy`. Non-forced refreshes
|
|
169
|
+
(Pi startup or opening `/model`) reuse `catalog.json` without spawning `agy`
|
|
170
|
+
whenever cached models match the current `agy` binary fingerprint. Live ACP
|
|
171
|
+
discovery runs when no matching cache exists, on `/agy-acp refresh`, on the
|
|
172
|
+
first live request, or after an `agy` binary upgrade once refreshed or
|
|
173
|
+
restarted. Standalone discovery stops its temporary ACP process afterward,
|
|
174
|
+
and idle ACP processes shut down automatically after sessions expire.
|
|
175
|
+
- **Reasoning levels:** The `/model` selector exposes only the levels offered
|
|
176
|
+
for each model (`low`, `medium`, `high`, `xhigh`, `max`). Direct requests map
|
|
177
|
+
`minimal` to `low`, clamp requested levels to the nearest offered effort, and
|
|
178
|
+
treat `off` as the runtime default (`high`).
|
|
179
|
+
- **Context windows and replay:** Context windows start at `0` until learned
|
|
180
|
+
dynamically from session metadata and cached per model in `catalog.json`
|
|
181
|
+
against the `agy` binary fingerprint; upgrading `agy` invalidates cached
|
|
182
|
+
context windows. History replay uses a 160,000-byte budget—older turns can be
|
|
183
|
+
omitted to fit, and historical images become `[image]` placeholders.
|
|
160
184
|
|
|
161
185
|
## Usage and costs
|
|
162
186
|
|
|
163
|
-
Usage comes from the ACP session rather than per-step
|
|
164
|
-
steps emit zero usage; statistics arrive on the final step when the
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
`usage_update` (and same-turn `estimated_tokens_used` metadata when `usage_update`
|
|
168
|
-
is absent) supplies live token occupancy.
|
|
187
|
+
Usage comes from the ACP session rather than per-step HTTP headers. Parked
|
|
188
|
+
`toolUse` steps emit zero usage; statistics arrive on the final step when the
|
|
189
|
+
ACP turn completes (accumulated across any automatic `max_tokens` continuations)
|
|
190
|
+
whenever `session/prompt` reports usage.
|
|
169
191
|
|
|
170
|
-
The extension separates cumulative
|
|
192
|
+
The extension separates cumulative turn consumption from final-call context
|
|
171
193
|
occupancy:
|
|
172
194
|
|
|
173
|
-
- `input`, `output`, `cacheRead`, and `
|
|
174
|
-
turn totals
|
|
195
|
+
- `input`, `output`, `cacheRead`, `cacheWrite`, and `reasoning` preserve
|
|
196
|
+
unscaled cumulative turn totals, so Pi session totals and flat pricing
|
|
175
197
|
overrides reflect full multi-step consumption.
|
|
176
|
-
- `totalTokens` (
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
it never inspects your global `agy` databases or invokes or distributes binary patch
|
|
192
|
-
scripts.
|
|
198
|
+
- `totalTokens` (feeding Pi's context meter and auto-compaction threshold) uses
|
|
199
|
+
the final call's live token occupancy when reported by `agy`, falling back to
|
|
200
|
+
the same turn's session metadata estimate and then a final-segment average
|
|
201
|
+
estimate.
|
|
202
|
+
|
|
203
|
+
Default model prices are zero because upstream pricing is unavailable. With Pi
|
|
204
|
+
pricing overrides, flat per-million rates price cumulative turn buckets
|
|
205
|
+
accurately; tiered `inputTokensAbove` rules evaluate against cumulative turn
|
|
206
|
+
prompt tokens rather than per-call prompt sizes. These numbers are estimates,
|
|
207
|
+
not an invoice or a promise of free access.
|
|
208
|
+
|
|
209
|
+
Read-only SQLite inspection is restricted strictly to session-scoped databases
|
|
210
|
+
inside `PI_AGY_HOME` (for context windows, occupancy estimates, and hidden
|
|
211
|
+
terminal API error detection); the extension never reads global `agy` databases
|
|
212
|
+
or invokes/distributes binary patches.
|
|
193
213
|
|
|
194
214
|
## Compatibility limits
|
|
195
215
|
|
|
196
|
-
|
|
197
|
-
Pi
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
Sampling parameters, output limits, forced `toolChoice`, and provider-scoped
|
|
205
|
-
environment overrides are not mapped to ACP. See
|
|
206
|
-
[development checks](development.md#verification) for the scope of automated validation.
|
|
216
|
+
- Requires Node.js >= 22.19.0, Pi (`@earendil-works/*`) 1.5.x, and `agy` >=
|
|
217
|
+
1.5.10. Older `@mariozechner/*` Pi interfaces are not supported.
|
|
218
|
+
- Sampling parameters, output limits, forced `toolChoice`, and provider-scoped
|
|
219
|
+
environment overrides are not mapped to ACP.
|
|
220
|
+
|
|
221
|
+
See [verification](development.md#verification) for the automated test and
|
|
222
|
+
compatibility scope.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Releasing
|
|
2
|
+
|
|
3
|
+
Maintainer guide for automated releases and publishing recovery. For everyday
|
|
4
|
+
CI checks and pull request rules, see
|
|
5
|
+
[CI and pull requests](development.md#ci-and-pull-requests).
|
|
6
|
+
|
|
7
|
+
## Automated release flow
|
|
8
|
+
|
|
9
|
+
Releases are managed by `release-please` (`release-please-config.json` and
|
|
10
|
+
`.release-please-manifest.json`) via `.github/workflows/release.yml` on Node.js
|
|
11
|
+
24:
|
|
12
|
+
|
|
13
|
+
1. Merging Conventional Commits (`feat:`, `fix:`, etc.) to `main` runs the
|
|
14
|
+
`release-please` job, which opens or updates a release PR updating
|
|
15
|
+
`package.json`, `CHANGELOG.md`, and `.release-please-manifest.json`.
|
|
16
|
+
2. Squash-merging that release PR (preserving its `chore(main): release X.Y.Z`
|
|
17
|
+
title) creates the `vX.Y.Z` tag and GitHub Release, then triggers the
|
|
18
|
+
`publish` job to run `npm run check`, `npm test`, `npm pack --dry-run`, and
|
|
19
|
+
`npm publish --access public --provenance`.
|
|
20
|
+
|
|
21
|
+
Ordinary commits to `main` run `release-please` only and do not trigger
|
|
22
|
+
`publish`.
|
|
23
|
+
|
|
24
|
+
## Repository settings and credentials
|
|
25
|
+
|
|
26
|
+
- **GitHub Actions PR permissions:** Enable **Allow GitHub Actions to create and
|
|
27
|
+
approve pull requests** in Settings → Actions → General. Without a
|
|
28
|
+
`RELEASE_PLEASE_TOKEN` PAT (`contents: write` and `pull-requests: write`) in
|
|
29
|
+
repository secrets, `GITHUB_TOKEN` is used; close and reopen the release PR
|
|
30
|
+
after its final update to trigger `ci.yml` when branch protection requires it.
|
|
31
|
+
- **npm Trusted Publishing (OIDC):** Configure Trusted Publishing on npm for
|
|
32
|
+
owner `fdkevin0`, repository `pi-agy-acp`, and workflow `release.yml`. The
|
|
33
|
+
`publish` job grants `id-token: write` and updates npm to `^11.5.1`.
|
|
34
|
+
- **Token fallback:** An optional `NPM_TOKEN` repository secret supplies
|
|
35
|
+
`NODE_AUTH_TOKEN` (use a granular write token with 2FA bypass if needed).
|
|
36
|
+
|
|
37
|
+
## Guardrails and recovery
|
|
38
|
+
|
|
39
|
+
- The `publish` job accepts stable semver tags (`vX.Y.Z`) matching
|
|
40
|
+
`package.json` only, publishes one version at a time, and never moves an
|
|
41
|
+
existing tag. Branch-based `workflow_dispatch` runs are rejected.
|
|
42
|
+
- Only an npm registry HTTP `404` is treated as unpublished; HTTP `200` skips
|
|
43
|
+
republishing, and network, auth, or server errors stop the job.
|
|
44
|
+
- **Recovering a failed `publish` job** (or missing GitHub Release after npm
|
|
45
|
+
publication succeeded): choose **Re-run failed jobs** on that workflow run
|
|
46
|
+
(re-running all jobs on a `main` run skips `publish` once the tag exists), or
|
|
47
|
+
run:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
gh workflow run release.yml --ref vX.Y.Z
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
GitHub Releases are created only for existing tags via
|
|
54
|
+
`gh release create --verify-tag`. Manual tag pushes (`vX.Y.Z`) also trigger
|
|
55
|
+
`publish` but bypass `release-please`, leaving `CHANGELOG.md` and
|
|
56
|
+
`.release-please-manifest.json` out of sync.
|
package/index.ts
CHANGED
|
@@ -285,8 +285,49 @@ export default function (
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
+
type RefreshOutcome =
|
|
289
|
+
| { status: 'ok'; count: number }
|
|
290
|
+
| { status: 'cancelled' }
|
|
291
|
+
| { status: 'error'; error: string }
|
|
292
|
+
const refreshModelsSafe = async (
|
|
293
|
+
signal?: AbortSignal,
|
|
294
|
+
): Promise<RefreshOutcome> => {
|
|
295
|
+
const current = activeRuntime
|
|
296
|
+
if (!current) {
|
|
297
|
+
return {
|
|
298
|
+
status: 'error',
|
|
299
|
+
error: 'Antigravity ACP runtime is disposed.',
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
try {
|
|
303
|
+
await current.warmup({ force: true, signal })
|
|
304
|
+
return { status: 'ok', count: current.catalog.list().length }
|
|
305
|
+
} catch (err) {
|
|
306
|
+
if (signal?.aborted) return { status: 'cancelled' }
|
|
307
|
+
return {
|
|
308
|
+
status: 'error',
|
|
309
|
+
error: err instanceof Error ? err.message : String(err),
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
const withLoader = <T>(
|
|
314
|
+
ctx: ExtensionContext,
|
|
315
|
+
label: string,
|
|
316
|
+
cancelled: T,
|
|
317
|
+
run: (signal?: AbortSignal) => Promise<T>,
|
|
318
|
+
): Promise<T> =>
|
|
319
|
+
ctx.mode === 'tui' && typeof ctx.ui.custom === 'function'
|
|
320
|
+
? ctx.ui.custom<T>((tui, theme, _kb, done) => {
|
|
321
|
+
const loader = new BorderedLoader(tui, theme, label)
|
|
322
|
+
loader.onAbort = () => done(cancelled)
|
|
323
|
+
void run(loader.signal).then((result) => {
|
|
324
|
+
if (!loader.signal.aborted) done(result)
|
|
325
|
+
})
|
|
326
|
+
return loader
|
|
327
|
+
})
|
|
328
|
+
: run()
|
|
288
329
|
pi.registerCommand('agy-acp', {
|
|
289
|
-
description: 'Antigravity ACP status, quota, or reset',
|
|
330
|
+
description: 'Antigravity ACP status, quota, refresh, or reset',
|
|
290
331
|
getArgumentCompletions: (prefix) => {
|
|
291
332
|
const normalized = prefix.trimStart()
|
|
292
333
|
const items = [
|
|
@@ -294,6 +335,7 @@ export default function (
|
|
|
294
335
|
'quota',
|
|
295
336
|
'quota used',
|
|
296
337
|
'quota remaining',
|
|
338
|
+
'refresh',
|
|
297
339
|
'reset',
|
|
298
340
|
]
|
|
299
341
|
.filter((command) => command.startsWith(normalized))
|
|
@@ -308,6 +350,31 @@ export default function (
|
|
|
308
350
|
command === 'quota' && tokens.length === 2
|
|
309
351
|
? asQuotaDisplay(tokens[1])
|
|
310
352
|
: undefined
|
|
353
|
+
if (command === 'refresh' && tokens.length === 1) {
|
|
354
|
+
const outcome = await withLoader<RefreshOutcome>(
|
|
355
|
+
ctx,
|
|
356
|
+
'Refreshing Antigravity models...',
|
|
357
|
+
{ status: 'cancelled' },
|
|
358
|
+
refreshModelsSafe,
|
|
359
|
+
)
|
|
360
|
+
if (shutDown) return
|
|
361
|
+
if (outcome.status === 'cancelled') {
|
|
362
|
+
ctx.ui.notify('Model refresh cancelled', 'info')
|
|
363
|
+
return
|
|
364
|
+
}
|
|
365
|
+
if (outcome.status === 'error') {
|
|
366
|
+
ctx.ui.notify(
|
|
367
|
+
`Antigravity model refresh failed: ${outcome.error}`,
|
|
368
|
+
'error',
|
|
369
|
+
)
|
|
370
|
+
return
|
|
371
|
+
}
|
|
372
|
+
ctx.ui.notify(
|
|
373
|
+
`Refreshed Antigravity catalog (${outcome.count} model${outcome.count === 1 ? '' : 's'})`,
|
|
374
|
+
'info',
|
|
375
|
+
)
|
|
376
|
+
return
|
|
377
|
+
}
|
|
311
378
|
if (command === 'reset' && tokens.length === 1) {
|
|
312
379
|
clearStatus(ctx)
|
|
313
380
|
await reset()
|
|
@@ -321,7 +388,7 @@ export default function (
|
|
|
321
388
|
(tokens.length === 1 || requestedDisplay !== undefined)
|
|
322
389
|
if (!isStatus && !isQuota) {
|
|
323
390
|
ctx.ui.notify(
|
|
324
|
-
'Usage: /agy-acp [status|quota [used|remaining]|reset]',
|
|
391
|
+
'Usage: /agy-acp [status|quota [used|remaining]|refresh|reset]',
|
|
325
392
|
'warning',
|
|
326
393
|
)
|
|
327
394
|
return
|
|
@@ -333,24 +400,13 @@ export default function (
|
|
|
333
400
|
let snapshot: QuotaSnapshot | null = null
|
|
334
401
|
const epoch = uiEpoch
|
|
335
402
|
if (command === 'quota') {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
'Fetching Antigravity quota...',
|
|
344
|
-
)
|
|
345
|
-
loader.onAbort = () => done(null)
|
|
346
|
-
// readQuotaSafe converts runtime errors into snapshots so loaders always close cleanly.
|
|
347
|
-
void readQuotaSafe().then((result) => {
|
|
348
|
-
if (!loader.signal.aborted) done(result)
|
|
349
|
-
})
|
|
350
|
-
return loader
|
|
351
|
-
},
|
|
352
|
-
)
|
|
353
|
-
: await readQuotaSafe()
|
|
403
|
+
// readQuotaSafe converts runtime errors into snapshots so loaders always close cleanly.
|
|
404
|
+
snapshot = await withLoader<QuotaSnapshot | null>(
|
|
405
|
+
ctx,
|
|
406
|
+
'Fetching Antigravity quota...',
|
|
407
|
+
null,
|
|
408
|
+
() => readQuotaSafe(),
|
|
409
|
+
)
|
|
354
410
|
if (shutDown) return
|
|
355
411
|
if (snapshot === null) {
|
|
356
412
|
if (epoch === uiEpoch) updateStatus(ctx, activeRuntime?.quota.peek())
|