@cortexkit/pi-antigravity-auth 2.2.0 → 3.0.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 +44 -8
- package/dist/commands.d.ts +30 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/convert.d.ts +4 -2
- package/dist/convert.d.ts.map +1 -1
- package/dist/index.d.ts +31 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1066 -40
- package/dist/index.js.map +4 -4
- package/dist/paths.d.ts +11 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/stream.d.ts +25 -3
- package/dist/stream.d.ts.map +1 -1
- package/dist/vault-setup.d.ts +144 -0
- package/dist/vault-setup.d.ts.map +1 -0
- package/dist/vault-source.d.ts +60 -0
- package/dist/vault-source.d.ts.map +1 -0
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -17,16 +17,34 @@ pi install npm:@cortexkit/pi-antigravity-auth
|
|
|
17
17
|
## Login
|
|
18
18
|
|
|
19
19
|
```
|
|
20
|
-
/login google
|
|
20
|
+
/login google
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
A browser URL is shown. Complete the Google OAuth flow and paste the resulting
|
|
24
24
|
callback URL (or authorization code) back into the prompt.
|
|
25
25
|
|
|
26
|
+
The extension replaces Pi's built-in `google` catalog with Antigravity models.
|
|
27
|
+
Use Antigravity OAuth for this provider, not a Google AI Studio API key. If upgrading
|
|
28
|
+
from the old provider ID, change model selections to `google/antigravity-…` and
|
|
29
|
+
run `/login google`. Credentials saved under `google-antigravity` are not migrated
|
|
30
|
+
to `google` automatically.
|
|
31
|
+
|
|
32
|
+
Use `/antigravity` to request vault access and select a vault account. Local and
|
|
33
|
+
vault modes use the same `google/antigravity-…` model IDs. After the operator
|
|
34
|
+
approves access, the extension backs up Pi's native Google login and temporarily
|
|
35
|
+
replaces its slot with a non-secret marker before the first model request.
|
|
36
|
+
Requests then use only vault credentials; an empty or unreachable vault does not
|
|
37
|
+
fall back to the local login. Disconnecting vault enrollment attempts to restore
|
|
38
|
+
the saved Google login only when the native slot still matches the non-secret
|
|
39
|
+
marker installed for that enrollment.
|
|
40
|
+
If another process changed the slot, the extension keeps the backup and refuses
|
|
41
|
+
to overwrite that change; re-login may be needed. This is not a promise to restore
|
|
42
|
+
every native auth record when changing plugin versions.
|
|
43
|
+
|
|
26
44
|
## Models
|
|
27
45
|
|
|
28
46
|
The extension registers the Antigravity model catalog under the
|
|
29
|
-
`google
|
|
47
|
+
`google` provider, including:
|
|
30
48
|
|
|
31
49
|
- `antigravity-gemini-3.8-flash`
|
|
32
50
|
- `antigravity-gemini-3.7-flash`
|
|
@@ -40,22 +58,40 @@ The extension registers the Antigravity model catalog under the
|
|
|
40
58
|
The image-generation model is currently OpenCode-only because Pi's provider event
|
|
41
59
|
protocol does not expose image-output stream events.
|
|
42
60
|
|
|
43
|
-
Select a model with `/model` or `pi -m google
|
|
61
|
+
Select a model with `/model` or `pi -m google/antigravity-gemini-3.8-flash`.
|
|
44
62
|
|
|
45
63
|
## Configuration
|
|
46
64
|
|
|
47
65
|
| Environment variable | Description |
|
|
48
66
|
| --- | --- |
|
|
49
67
|
| `PI_AGENT_DIR` | Override the pi agent directory (default `~/.pi/agent`). |
|
|
50
|
-
| `PI_ANTIGRAVITY_AUTH_FILE` |
|
|
68
|
+
| `PI_ANTIGRAVITY_AUTH_FILE` | Relocate the base path used to place `antigravity-auth-vault/` beside it; does not relocate Pi's native `auth.json` Google slot or create an OpenCode pool. |
|
|
51
69
|
|
|
52
70
|
## Notes
|
|
53
71
|
|
|
54
72
|
This package shares its transport, OAuth, fingerprint, and request-transform
|
|
55
|
-
logic with the OpenCode plugin via
|
|
56
|
-
[`@cortexkit/antigravity-auth-core`](../core).
|
|
57
|
-
|
|
58
|
-
|
|
73
|
+
logic with the unified OpenCode V1/GA plugin via
|
|
74
|
+
[`@cortexkit/antigravity-auth-core`](../core). Local mode uses one account in Pi's
|
|
75
|
+
native `google` OAuth slot (`auth.json` in Pi's agent directory). Vault mode can
|
|
76
|
+
list/select approved vault accounts, but serves one at a time; Pi has no local
|
|
77
|
+
pool rotation, recorded quota gating, killswitch, or operator settings.
|
|
78
|
+
|
|
79
|
+
### Major upgrades and downgrade
|
|
80
|
+
|
|
81
|
+
Pi's native auth file is **not** the legacy OpenCode pool. Pi-only users must not
|
|
82
|
+
run `antigravity-auth migrate` or `rollback` against it. When upgrading from the
|
|
83
|
+
old `google-antigravity` provider, update model IDs to `google/antigravity-…` and
|
|
84
|
+
run `/login google`: credentials in the `google-antigravity` auth slot are not
|
|
85
|
+
automatically moved or overwritten.
|
|
86
|
+
|
|
87
|
+
Before changing builds while enrolled in a vault, disconnect via `/antigravity` →
|
|
88
|
+
Vault in the currently installed extension, then re-login if safe native-slot
|
|
89
|
+
restoration is not possible. An older build may expect a different provider slot;
|
|
90
|
+
do not copy tokens between slots or assume disconnect restores all native records.
|
|
91
|
+
If you also use an OpenCode legacy pool, follow its separate
|
|
92
|
+
[offline migration/rollback guide](../../README.md#major-upgrades-migration-and-rollback).
|
|
93
|
+
The provider and custody behavior is implemented in [`src/index.ts`](src/index.ts)
|
|
94
|
+
and [`src/vault-setup.ts`](src/vault-setup.ts).
|
|
59
95
|
|
|
60
96
|
## License
|
|
61
97
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pi's `/antigravity` command: the core's shared Antigravity menu in its
|
|
3
|
+
* host-sections mode, drawn with Pi's extension UI by the library's Pi
|
|
4
|
+
* renderer. Pi has one account at a time and no account rows, so it supplies
|
|
5
|
+
* all four account slots itself. The commands library loads on the first
|
|
6
|
+
* invocation, and every invocation builds a fresh menu.
|
|
7
|
+
*/
|
|
8
|
+
import { type AntigravityMenuSections, type CommonAuthCommandsModule } from '@cortexkit/antigravity-auth-core';
|
|
9
|
+
import type { PluginExtraSection } from '@cortexkit/antigravity-auth-core/common-auth/commands';
|
|
10
|
+
import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
11
|
+
import { type PiVaultAccountsPort, type PiVaultSetup } from './vault-setup.ts';
|
|
12
|
+
export interface PiAntigravityCommandOptions {
|
|
13
|
+
sections: AntigravityMenuSections;
|
|
14
|
+
extras: readonly PluginExtraSection[];
|
|
15
|
+
/** Loads the commands library; defaults to the core's lazy loader. */
|
|
16
|
+
loadCommands?: () => Promise<CommonAuthCommandsModule>;
|
|
17
|
+
}
|
|
18
|
+
export declare function registerPiAntigravityCommand(pi: Pick<ExtensionAPI, 'registerCommand'>, options: PiAntigravityCommandOptions): void;
|
|
19
|
+
/**
|
|
20
|
+
* The menu's four account slots, built from what Pi actually has: one
|
|
21
|
+
* account at a time (its own login, or one vault account), no pool, no
|
|
22
|
+
* rotation and no recorded quota. Nothing here pretends to be a pool row.
|
|
23
|
+
*/
|
|
24
|
+
export type PiAntigravityAccountSections = AntigravityMenuSections;
|
|
25
|
+
export interface PiAntigravityAccountSectionsOptions {
|
|
26
|
+
setup: () => Promise<PiVaultSetup>;
|
|
27
|
+
accounts: () => PiVaultAccountsPort;
|
|
28
|
+
}
|
|
29
|
+
export declare function createPiAntigravityAccountSections(options: PiAntigravityAccountSectionsOptions): PiAntigravityAccountSections;
|
|
30
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAG9B,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAEV,kBAAkB,EACnB,MAAM,uDAAuD,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAEnE,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAGlB,MAAM,kBAAkB,CAAA;AAEzB,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,uBAAuB,CAAA;IACjC,MAAM,EAAE,SAAS,kBAAkB,EAAE,CAAA;IACrC,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,wBAAwB,CAAC,CAAA;CACvD;AAED,wBAAgB,4BAA4B,CAC1C,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,iBAAiB,CAAC,EACzC,OAAO,EAAE,2BAA2B,GACnC,IAAI,CAkBN;AAMD;;;;GAIG;AACH,MAAM,MAAM,4BAA4B,GAAG,uBAAuB,CAAA;AAElE,MAAM,WAAW,mCAAmC;IAClD,KAAK,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAA;IAClC,QAAQ,EAAE,MAAM,mBAAmB,CAAA;CACpC;AA4CD,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,mCAAmC,GAC3C,4BAA4B,CAwF9B"}
|
package/dist/convert.d.ts
CHANGED
|
@@ -46,8 +46,10 @@ export interface BuildGeminiRequestOptions {
|
|
|
46
46
|
model?: string;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* Convert a pi
|
|
50
|
-
* (the inner `request` object of the Antigravity envelope).
|
|
49
|
+
* Convert a pi request context into a Gemini `generateContent` request body
|
|
50
|
+
* (the inner `request` object of the Antigravity envelope). Accepts both the
|
|
51
|
+
* transcript form Pi 0.86+ passes to providers and the flat `Context` of
|
|
52
|
+
* older runtimes.
|
|
51
53
|
*/
|
|
52
54
|
export declare function buildGeminiRequest(context: Context, options?: BuildGeminiRequestOptions): GeminiRequest;
|
|
53
55
|
export {};
|
package/dist/convert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,OAAO,EAMR,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,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;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,yBAAyB,GAClC,aAAa,CAiBf"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { PluginExtraSection } from '@cortexkit/antigravity-auth-core/common-auth/commands';
|
|
2
|
+
import { type ExtensionAPI } from '@earendil-works/pi-coding-agent';
|
|
3
|
+
import { type PiAntigravityAccountSections } from './commands.ts';
|
|
4
|
+
import { type PiVaultSeams } from './vault-source.ts';
|
|
5
|
+
/** Refresh value of the vault placeholder login; local mode must never refresh it. */
|
|
6
|
+
export declare const CUSTODY_PLACEHOLDER_REFRESH_PREFIX = "claustrum-tombstone:v1:";
|
|
7
|
+
/** Non-secret key that lets Pi list custody models without a login; never sent. */
|
|
8
|
+
export declare const CUSTODY_PROVIDER_KEY_MARKER = "antigravity-vault-custody";
|
|
9
|
+
/**
|
|
10
|
+
* The vault runtime Pi composes custody from: the public `./claustrum` entry
|
|
11
|
+
* of `@cortexkit/common-auth`, the setup-only enrollment connection, and the
|
|
12
|
+
* shared Antigravity vault account source for the `pi` host.
|
|
13
|
+
*/
|
|
14
|
+
export interface PiAntigravityExtension {
|
|
15
|
+
/**
|
|
16
|
+
* The Vault section for the shared command menu, where enrollment, mode
|
|
17
|
+
* switching and account choice happen.
|
|
18
|
+
*/
|
|
19
|
+
readonly vaultSection: PluginExtraSection;
|
|
20
|
+
/** Pi's own Accounts, Quota, Routing and Limits sections for the same menu. */
|
|
21
|
+
readonly accountSections: PiAntigravityAccountSections;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Register the Antigravity provider for the mode the user chose: Pi's own
|
|
25
|
+
* login (local, the default) or the vault (custody). Changing the mode in
|
|
26
|
+
* the Vault section re-registers the same provider id, so Pi never lists two.
|
|
27
|
+
* `seams` replaces only I/O (vault client transport, file paths, auth slot)
|
|
28
|
+
* for tests; Pi's default entry passes none.
|
|
29
|
+
*/
|
|
30
|
+
export declare function registerCortexKitPiAntigravity(pi: Pick<ExtensionAPI, 'registerProvider' | 'registerCommand'> & Partial<Pick<ExtensionAPI, 'on'>>, seams?: PiVaultSeams): Promise<PiAntigravityExtension>;
|
|
31
|
+
export default function cortexKitPiAntigravityAuth(pi: ExtensionAPI): Promise<void>;
|
|
3
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAA;AAK/F,OAAO,EACL,KAAK,YAAY,EAIlB,MAAM,iCAAiC,CAAA;AAExC,OAAO,EAEL,KAAK,4BAA4B,EAElC,MAAM,eAAe,CAAA;AActB,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAA;AAE1B,sFAAsF;AACtF,eAAO,MAAM,kCAAkC,4BAA4B,CAAA;AAE3E,mFAAmF;AACnF,eAAO,MAAM,2BAA2B,8BAA8B,CAAA;AAgKtE;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAA;IACzC,+EAA+E;IAC/E,QAAQ,CAAC,eAAe,EAAE,4BAA4B,CAAA;CACvD;AAED;;;;;;GAMG;AACH,wBAAsB,8BAA8B,CAClD,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,kBAAkB,GAAG,iBAAiB,CAAC,GAC5D,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,EACnC,KAAK,GAAE,YAAiB,GACvB,OAAO,CAAC,sBAAsB,CAAC,CAwIjC;AAED,wBAA8B,0BAA0B,CACtD,EAAE,EAAE,YAAY,GACf,OAAO,CAAC,IAAI,CAAC,CAEf"}
|