@anthonyhaussman/opencode-agy-auth 1.5.18-alpha.0 → 1.5.20-test.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 (66) hide show
  1. package/README.md +22 -134
  2. package/dist/index.d.ts +4 -4
  3. package/dist/index.js +237 -21666
  4. package/dist/index.js.map +1 -1
  5. package/dist/src/acp/errors.d.ts +1 -1
  6. package/dist/src/acp/live-session.d.ts +11 -0
  7. package/dist/src/acp/mcp-bridge.d.ts +6 -0
  8. package/dist/src/acp/plugin.d.ts +9 -0
  9. package/dist/src/acp/process.d.ts +6 -0
  10. package/dist/src/acp/register-auth.d.ts +1 -1
  11. package/dist/src/acp/register.d.ts +1 -1
  12. package/dist/src/acp/stream-map.d.ts +2 -0
  13. package/dist/src/{plugin → acp}/types.d.ts +15 -26
  14. package/package.json +1 -7
  15. package/dist/src/constants.d.ts +0 -9
  16. package/dist/src/fetch.d.ts +0 -1
  17. package/dist/src/plugin/auth.d.ts +0 -14
  18. package/dist/src/plugin/cache.d.ts +0 -35
  19. package/dist/src/plugin/headers.d.ts +0 -7
  20. package/dist/src/plugin/notify.d.ts +0 -9
  21. package/dist/src/plugin/oauth-authorize.d.ts +0 -24
  22. package/dist/src/plugin/pricing.d.ts +0 -5
  23. package/dist/src/plugin/project/context.d.ts +0 -13
  24. package/dist/src/plugin/project/index.d.ts +0 -2
  25. package/dist/src/plugin/project/types.d.ts +0 -84
  26. package/dist/src/plugin/project/utils.d.ts +0 -35
  27. package/dist/src/plugin/provider.d.ts +0 -12
  28. package/dist/src/plugin/quota-summary.d.ts +0 -16
  29. package/dist/src/plugin/quota-utils.d.ts +0 -5
  30. package/dist/src/plugin/quota.d.ts +0 -16
  31. package/dist/src/plugin/tier.d.ts +0 -29
  32. package/dist/src/plugin/token.d.ts +0 -2
  33. package/dist/src/plugin/tos-warning.d.ts +0 -16
  34. package/dist/src/plugin/traffic.d.ts +0 -47
  35. package/dist/src/plugin/v2-fetch.d.ts +0 -1
  36. package/dist/src/plugin/v2-session.d.ts +0 -8
  37. package/dist/src/plugin/v2-storage.d.ts +0 -3
  38. package/dist/src/plugin/v2.d.ts +0 -15
  39. package/dist/src/sdk/activity-request-id.d.ts +0 -5
  40. package/dist/src/sdk/agy-cli-version.d.ts +0 -1
  41. package/dist/src/sdk/cache/signature-cache.d.ts +0 -130
  42. package/dist/src/sdk/chat-logger.d.ts +0 -8
  43. package/dist/src/sdk/fetch_models.d.ts +0 -48
  44. package/dist/src/sdk/fetch_project.d.ts +0 -9
  45. package/dist/src/sdk/fetch_quota.d.ts +0 -9
  46. package/dist/src/sdk/oauth.d.ts +0 -26
  47. package/dist/src/sdk/request/identifiers.d.ts +0 -16
  48. package/dist/src/sdk/request/index.d.ts +0 -12
  49. package/dist/src/sdk/request/openai.d.ts +0 -17
  50. package/dist/src/sdk/request/prepare.d.ts +0 -19
  51. package/dist/src/sdk/request/response.d.ts +0 -5
  52. package/dist/src/sdk/request/shared.d.ts +0 -20
  53. package/dist/src/sdk/request/thinking.d.ts +0 -129
  54. package/dist/src/sdk/request/tool-mapper.d.ts +0 -47
  55. package/dist/src/sdk/request/turn-state-tracker.d.ts +0 -21
  56. package/dist/src/sdk/request-helpers/errors.d.ts +0 -9
  57. package/dist/src/sdk/request-helpers/index.d.ts +0 -4
  58. package/dist/src/sdk/request-helpers/parsing.d.ts +0 -9
  59. package/dist/src/sdk/request-helpers/thinking.d.ts +0 -5
  60. package/dist/src/sdk/request-helpers/types.d.ts +0 -65
  61. package/dist/src/sdk/retry/cooldown-store.d.ts +0 -14
  62. package/dist/src/sdk/retry/helpers.d.ts +0 -19
  63. package/dist/src/sdk/retry/index.d.ts +0 -9
  64. package/dist/src/sdk/retry/quota.d.ts +0 -37
  65. package/dist/src/sdk/terminal-hyperlink.d.ts +0 -3
  66. package/dist/src/sdk/user-agent.d.ts +0 -5
package/README.md CHANGED
@@ -6,27 +6,20 @@
6
6
  [![License](https://img.shields.io/github/license/anthonyhaussman/opencode-agy-auth)](https://github.com/anthonyhaussman/opencode-agy-auth/blob/main/LICENSE)
7
7
  [![GitHub stars](https://img.shields.io/github/stars/anthonyhaussman/opencode-agy-auth?style=social)](https://github.com/anthonyhaussman/opencode-agy-auth)
8
8
 
9
- > [!WARNING]
10
- > **Using this plugin can get your Google account disabled.**
11
- >
12
- > Google's current Antigravity terms prohibit using third-party software, tools, or services (explicitly including OpenCode) to access an Antigravity/Gemini CLI login. Accounts detected doing so are blocked with:
13
- >
14
- > `This service has been disabled in this account for violation of Terms of Service. Please submit an appeal to continue using this product.`
15
- >
16
- > A disabled account can only be restored through [Google's appeal form](https://docs.google.com/forms/d/e/1FAIpQLScOJWibQ_-hYuVv63kJTgEqlgAaOwRLGFTbXm-QY1gz8U0CGA/viewform). The plugin prints this warning on every startup.
17
- >
18
- > Supported alternatives that do not rely on an Antigravity login:
19
- >
20
- > - The `google-agy-acp` provider of this plugin with the **Gemini API key** or **Vertex** method (see below).
21
- > - OpenCode's native `google` provider with a Gemini API key (`GOOGLE_GENERATIVE_AI_API_KEY`, from Google AI Studio).
22
- > - OpenCode's native `google-vertex` provider with your own Google Cloud project.
23
- >
24
- > Use this plugin at your own risk. The maintainer takes no responsibility for any action Google takes against your account.
25
-
26
- An [OpenCode](https://opencode.ai/) plugin for the Antigravity CLI (`agy`). It ships two providers:
27
-
28
- - **`google-agy-acp`** (recommended): drives your local `agy` binary over the Agent Client Protocol (`agy acp`).
29
- - **`google-agy`** (deprecated): the original direct Code Assist API provider with OAuth. It is kept for existing users and will not receive new features.
9
+ An [OpenCode](https://opencode.ai/) plugin for the Antigravity CLI (`agy`). It ships one provider, **`google-agy-acp`**, which drives your local `agy` binary over the Agent Client Protocol (`agy acp`).
10
+
11
+ ## Installation
12
+
13
+ Add the plugin to your OpenCode configuration (`opencode.json` in your project, or `~/.config/opencode/opencode.json`):
14
+
15
+ ```json
16
+ {
17
+ "$schema": "https://opencode.ai/config.json",
18
+ "plugin": ["@anthonyhaussman/opencode-agy-auth"]
19
+ }
20
+ ```
21
+
22
+ Then connect the `google-agy-acp` provider in OpenCode and pick an authentication method (see below).
30
23
 
31
24
  ## Requirements
32
25
 
@@ -45,10 +38,6 @@ Pick a method when connecting the `google-agy-acp` provider:
45
38
  - **Vertex AI / Agent Platform** (recommended): uses your Application Default Credentials. Nothing is stored by OpenCode.
46
39
  - **Google login (personal or Gemini Enterprise / Workspace)**: you sign in with `agy` itself; the plugin never reads, refreshes or forwards agy's OAuth tokens and never reads the OS keyring.
47
40
 
48
- ### Disclaimer
49
-
50
- Google's policy names OpenCode as a third-party tool. Using the Google-login method through this plugin may still get your account disabled. This project makes no claim of Terms of Service compliance for any method. The API key and Vertex methods are the recommended ones.
51
-
52
41
  ### What this provider changes on your machine
53
42
 
54
43
  - **Global agy plugin.** On first use the provider runs `agy plugin install` and adds the `opencode-bridge` plugin to agy's global plugins in `~/.gemini/config/plugins/`. A one-time notice is shown. Remove it at any time with `agy plugin uninstall opencode-bridge`. The plugin never edits `~/.gemini/config/*` by hand.
@@ -64,119 +53,18 @@ Google's policy names OpenCode as a third-party tool. Using the Google-login met
64
53
  - `AGY_ACP_DEBUG=1`: write a debug log of each agy child process (spawn, ACP JSON-RPC traffic, stderr, exit). The bridge token and the Gemini API key are redacted; prompts and tool output are logged as-is. Off by default.
65
54
  - `AGY_ACP_DEBUG_FILE`: debug log path (default: `$XDG_DATA_HOME/opencode/agy-acp/debug.log`, or `~/.local/share/opencode/agy-acp/debug.log`). Created with mode 0600.
66
55
 
67
- ## Legacy `google-agy` provider (deprecated)
68
-
69
- ### Features
70
-
71
- - **OAuth 2.0 Integration**: Uses Antigravity's OAuth flows for authentication.
72
- - **Dynamic Model Retrieval**: Fetches available models based on user tier and current allocations.
73
- - **Quota Tracking**: Injects the `agy_quota` tool into OpenCode to check usage limits directly.
74
- - **Background Session Requests**: Sends the session-level requests the Antigravity backend expects alongside model calls.
75
-
76
- ### Installation
77
-
78
- Install the plugin from npm (or directly using local file configurations if developing):
79
-
80
- ```bash
81
- npm install @anthonyhaussman/opencode-agy-auth
82
- ```
83
-
84
- ### Configuration
85
-
86
- Update your OpenCode configuration file (typically `opencode.json` at the root of your project or globally at `~/.config/opencode/opencode.json`) to register the plugin and specify your Google Cloud Project ID.
87
-
88
- ```json
89
- {
90
- "$schema": "https://opencode.ai/config.json",
91
- "plugin": ["@anthonyhaussman/opencode-agy-auth"],
92
- "provider": {
93
- "google-agy": {
94
- "options": {
95
- "projectId": "your-google-cloud-project-id"
96
- }
97
- }
98
- }
99
- }
100
- ```
101
-
102
- By default, the plugin registers a specialized provider ID to interface with `agy`.
103
- You can switch your active OpenCode provider to `agy` or let the plugin inject authentication into your existing sessions.
56
+ ## Migrating from the `google-agy` provider
104
57
 
105
- #### Environment Variables
58
+ The direct Code Assist provider `google-agy`, its `agy_quota` and `agy_quota_summary` tools and the `/agyquota` and `/agyquotasummary` commands were removed. To migrate:
106
59
 
107
- If you are running OpenCode in environments with specific requirements for Antigravity, you can use the following environment variables:
108
-
109
- - `OPENCODE_AGY_PROJECT_ID`: Specify your Google Cloud Project ID manually.
110
- - `OPENCODE_AGY_AUTH_PROXY`: Define a proxy if accessing authentication endpoints behind a corporate firewall.
111
- - `OPENCODE_AGY_ENDPOINT`: Override the default internal `daily-cloudcode-pa.googleapis.com` API endpoint.
112
- - `OPENCODE_AGY_VERBOSE_LOGS`: Set to `"1"` to enable verbose diagnostic logs for API calls and responses.
113
-
114
- ### Usage
115
-
116
- Once installed and configured, OpenCode will automatically authenticate against Antigravity CLI when interacting with eligible models. If no active session exists, you will be prompted to complete an OAuth login.
117
-
118
- Additionally, you can check your quota using slash commands directly in your OpenCode prompt:
119
-
120
- - `/agyquota` - Per-model detail view. Shows remaining tokens, progress bars, and reset timers for every model variant. Use when you need the full breakdown of individual buckets.
121
- - `/agyquotasummary` - High-level grouped view. Shows weekly and 5-hour limits aggregated by model family. Use when you want a quick overview of your allowance across all models.
122
-
123
- You can also ask naturally:
124
- > "What is my current agy quota?"
125
- > "Show me my quota summary"
126
-
127
- ### Companion Plugin: `opencode-quota`
128
-
129
- This repository is compatible with [`opencode-quota`](https://github.com/slkiser/opencode-quota), an OpenCode plugin for displaying quota information directly in your status bar or interface.
130
-
131
- Follow the [Google AGY Quick Setup Guide](https://github.com/slkiser/opencode-quota/blob/main/docs/readme/providers.md#google-agy-quick-setup) to set them up together.
132
-
133
- To use both plugins side by side, register them in your `opencode.json`:
134
-
135
- ```json
136
- {
137
- "$schema": "https://opencode.ai/config.json",
138
- "plugin": [
139
- "@anthonyhaussman/opencode-agy-auth",
140
- "opencode-quota"
141
- ],
142
- "provider": {
143
- "google-agy": {
144
- "options": {
145
- "projectId": "your-google-cloud-project-id"
146
- }
147
- }
148
- }
149
- }
150
- ```
151
-
152
- When used together, `opencode-quota` seamlessly visualizes rate limits and quotas for models authenticated through `google-agy`.
153
-
154
- ### Disk Persistence
155
-
156
- The plugin persists turn-state and retry-cooldown data to disk so that it survives OpenCode restarts. Files are stored under `~/.config/opencode/` (or `%APPDATA%\opencode\` on Windows):
157
-
158
- - `antigravity-turn-states.json` - tracks thinking/reasoning state across request turns, with a 24-hour TTL and 5-second throttled writes using atomic tmp+rename.
159
- - Retry cooldowns are persisted via `CooldownStore` with the same atomic-write pattern.
160
-
161
- Both stores initialize lazily at runtime - no filesystem reads occur at import time.
162
-
163
- #### `diskEnabled` Parameter
164
-
165
- `TurnStateTracker` accepts a `diskEnabled` constructor parameter (defaults to `true`):
166
-
167
- ```ts
168
- import { TurnStateTracker } from "@anthonyhaussman/opencode-agy-auth/sdk/request/turn-state-tracker";
169
-
170
- // Disk persistence enabled (default)
171
- const tracker = new TurnStateTracker(true);
172
-
173
- // Memory-only mode - no filesystem reads or writes
174
- const tracker = new TurnStateTracker(false);
175
- ```
60
+ - Switch your models from `google-agy/<model>` to `google-agy-acp/<model>`.
61
+ - Delete any `provider.google-agy` block (for example `options.projectId`) from `opencode.json`. `OPENCODE_AGY_PROJECT_ID`, `OPENCODE_AGY_AUTH_PROXY`, `OPENCODE_AGY_ENDPOINT` and `OPENCODE_AGY_VERBOSE_LOGS` are no longer read.
62
+ - The `google-agy` entry in `~/.local/share/opencode/auth.json` is no longer used and can be deleted.
63
+ - The `antigravity-turn-states.json` file under `~/.config/opencode/` is no longer written and can be deleted.
176
64
 
177
- When `diskEnabled` is `false`, the tracker operates entirely in memory. All state is lost when the process exits. This is useful in restricted environments (containers, read-only filesystems) where disk access is unavailable or undesirable.
65
+ ### Quota
178
66
 
179
- If disk initialization fails at runtime (permission error, corrupt file, etc.), the plugin automatically falls back to memory-only mode and logs a warning. No configuration is needed for normal use - disk persistence works out of the box.
67
+ For quota in OpenCode, a `google-agy-acp` provider for [`opencode-quota`](https://github.com/slkiser/opencode-quota) is proposed in [anthonyhaussman/opencode-quota#2](https://github.com/anthonyhaussman/opencode-quota/pull/2). It reads `agy -p /usage --output-format json` and shows the weekly and five-hour windows for each model family. You can also run `/usage` in `agy` directly.
180
68
 
181
69
  ## Local Testing
182
70
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { setupOpenCodeV2, v2PluginDefinition } from "./src/plugin/v2";
2
- import type { OpenCodeV2PluginDefinition } from "./src/plugin/types";
3
- export { setupOpenCodeV2, v2PluginDefinition };
4
- export * from "./src/plugin/types";
1
+ import { agyPluginDefinition, setupAgyPlugin } from "./src/acp/plugin";
2
+ import type { OpenCodeV2PluginDefinition } from "./src/acp/types";
3
+ export { agyPluginDefinition, setupAgyPlugin };
4
+ export type * from "./src/acp/types";
5
5
  declare const plugin: OpenCodeV2PluginDefinition;
6
6
  export default plugin;