dsh-agy-link 0.6.34 → 0.6.35

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/docs/AUTH.md CHANGED
@@ -1,19 +1,24 @@
1
- # Authentication notes
1
+ # Authentication & Credential Isolation
2
2
 
3
- The plugin never stores credentials. Login is the official agy CLI flow:
3
+ `dsh-agy-link` supports both the system-wide primary Google Antigravity sign-in and isolated multi-account pool slots (`PoolAuthFlow`). See [`.spec/credential-lifecycle.md`](../.spec/credential-lifecycle.md) for the authoritative state machine.
4
4
 
5
- 1. `/agy auth` spawns an agy probe that prints the Google consent URL.
6
- 2. You open the URL, approve, and get an authorization code.
7
- 3. `/agy auth-code <code>` (or the GUI paste box) feeds the code to the
8
- still-running probe on stdin; agy completes the exchange itself.
5
+ ## Flows
9
6
 
10
- The token lands wherever agy itself puts it
11
- (`~/.gemini/antigravity-cli/antigravity-oauth-token`). The plugin:
7
+ 1. **In-GUI / `/agy auth` PKCE OAuth (`PoolAuthFlow`)**:
8
+ - Generates a standard PKCE (`S256`) Google OAuth consent URL using the public Antigravity desktop OAuth client and starts a loopback listener on `127.0.0.1:51121` (with manual code/URL paste fallback).
9
+ - Exchanges the code directly with `oauth2.googleapis.com/token` (sending `agyUserAgent()` and honoring per-account proxy overrides).
10
+ - Writes the token atomically (`0600` permissions + `.bak` recovery snapshot) in `agy`'s native JSON format (`~/.dsh/agy-accounts/<id>/.gemini/antigravity-cli/antigravity-oauth-token` for isolated pool accounts, or system `HOME` + OS keyring for the primary account).
11
+ 2. **Refresh Token Import (`/agy import` / GUI Import Tab)**:
12
+ - Exchanges an existing `refresh_token` or token JSON document, verifies account identity via `userinfo`, updates matching accounts in place (or commits a new isolated slot), and lifts stale `authRequired` / cooldown flags.
12
13
 
13
- - never reads, copies, moves, or deletes that file;
14
- - never logs authorization codes (the `/agy doctor` report redacts auth
15
- URLs, `4/...` codes, and bearer tokens before writing);
16
- - kills the login probe (process group) on cancel/dispose.
14
+ ## Platform Keyring Isolation
17
15
 
18
- Expiry: when the token expires mid-session, calls fail fast with an
19
- `AUTH` error pointing at `/agy auth`; no retries burn your quota.
16
+ - **macOS / Linux**: Secondary pool accounts run with isolated `HOME` directories and silent per-account login keychains (`ensureIsolatedKeychain`) so `go-keyring` never prompts or touches the user's primary login keychain.
17
+ - **Windows**: `agy` reads one machine-wide Credential Manager entry (`gemini:antigravity`). `acquireCredentialSlot` serializes cross-identity handoffs (with in-process refcounting + cross-process lockfile), verifies grant fingerprints (`sameCredentialGrant`), and restores the verified primary credential (`.primary-credential.json`) after startup read.
18
+
19
+ ## Hygiene & Anti-False-Quarantine
20
+
21
+ - Network/proxy/HTTP2/keyring-timeout blips (`looksLikeNetworkError`, `looksLikeAuthVerificationJitter`) are classified as `NETWORK`, never `AUTH`.
22
+ - Non-authoritative CLI sign-out banners require `AUTH_CONFIRM_STRIKES = 2` consecutive confirmations before setting `authRequired`.
23
+ - Terminal `TOS_VIOLATION` suspensions quarantine only the affected account and halt automatic failover to prevent IP-correlated ban sweeps.
24
+ - `/agy doctor` redacts OAuth URLs, `4/...` authorization codes, `ya29.*` access tokens, `1//...` refresh tokens, JWTs, API keys, and proxy credentials before writing to disk.
@@ -36,9 +36,7 @@ Deliberate v1 boundaries and upstream-behavior notes.
36
36
  the hand-off logs when it fires so that case is visible instead of silent.
37
37
  - `SlotUnavailableError` aborts a run instead of letting it silently spend
38
38
  the wrong account when the primary cannot be verified.
39
- - Remaining boundary: the mutex is **per process**, so two DSH hosts (web +
40
- headless) running agy at the same moment can still interleave slot writes;
41
- avoid driving two hosts at once.
39
+ - Cross-process coordination uses an atomic lockfile (`acquireCrossProcessSlotLock`) alongside the in-process mutex so concurrent local hosts (`dsh web` + `dsh-agy-image` CLI) serialize slot transitions cleanly.
42
40
 
43
41
  ## Credential injection: what agy actually supports (verified 2026-10-17)
44
42
 
@@ -1,60 +1,21 @@
1
- # Security notes
1
+ # Security Notes
2
2
 
3
- Threat model and boundaries for dsh-agy-link.
3
+ Threat model and security boundaries for `dsh-agy-link`. Authoritative specifications live in [`.spec/security-hardening.md`](../.spec/security-hardening.md) and [`.spec/quota-and-risk-control.md`](../.spec/quota-and-risk-control.md).
4
4
 
5
- ## What the plugin executes
5
+ ## Process Execution & Risk Control
6
6
 
7
- - Only the agy binary resolved from config (`agyBin`) or `PATH` /
8
- `~/.local/bin`. No shell interpolation: argv is passed as an array.
9
- - Prompt text is passed as a single `-p` argument, never through a shell.
10
- - Every spawn is its own detached process group; watchdog + abort signal
11
- kill the whole tree (no orphaned agy processes).
7
+ - Only the official `agy` binary resolved from config (`agyBin`) or `PATH` / `~/.local/bin` is executed for model inference and quota warmup probes. No shell interpolation is used (`spawn` with explicit `argv` array, NUL-byte stripping, and detached process-group cleanup).
8
+ - Node.js never sends spoofed inference requests (`streamGenerateContent` / `generateContent`) or chimeric headers to Google endpoints; Node HTTP (`undici` via per-account proxy dispatchers) is restricted strictly to OAuth token refresh/userinfo and consumer quota summary reads (`daily-cloudcode-pa.googleapis.com` / `daily-cloudcode-pa.sandbox.googleapis.com`).
9
+ - `skip` (`--dangerously-skip-permissions`) auto-approves ordinary AGY tool prompts inside the session workspace while preserving AGY's built-in system protections. In `plan` or `accept-edits` print mode, interactive prompts are denied by `agy` with an actionable hint (`#121`).
12
10
 
13
- ## What it can do to your machine
11
+ ## Credential & Secret Protection
14
12
 
15
- Whatever agy itself may do under the configured permission mode. **skip**
16
- (`--dangerously-skip-permissions`) auto-approves ordinary AGY permission
17
- prompts for unattended file writes and shell execution inside agy's workspace
18
- — treat it like giving any other agent skip-permissions. It does **not** bypass
19
- AGY hardcoded system protections. The GUI marks this mode red for a reason.
13
+ - Per-account OAuth token files and `.bak` backups are written atomically with `0600` permissions; Windows Credential Manager handoffs verify refresh-token fingerprints (`sameCredentialGrant`) so foreign tokens can never overwrite an account file.
14
+ - DSH-side API keys and other providers' credentials are never read or modified.
15
+ - `/agy doctor` strips Google auth URLs, `4/...` codes, `ya29.*` access tokens, `1//...` refresh tokens, JWTs, API keys, and proxy credentials before writing diagnostics.
20
16
 
21
- ## Headless permission behavior
17
+ ## Local HTTP Surface & Confinement
22
18
 
23
- The bridge forwards the configured `plan` or `accept-edits` mode to the
24
- official `agy` process; it does not answer permission prompts or bypass them.
25
- In a headless/print invocation, agy may automatically deny a tool request.
26
- The bridge preserves that raw tool error in run status. Such an automatic
27
- denial is **not** evidence that a person approved or denied a prompt.
28
- Missing-file failures are reported as `missing_file`, not as approval outcomes;
29
- hardcoded-system-protection failures remain distinct. Raw AGY tool error text
30
- and its error result are preserved for replay.
31
-
32
- Do not rely on undocumented wildcard behavior for `plan` or `accept-edits`.
33
- Use a deliberately scoped workspace and test the exact commands and agy
34
- version you intend to operate. `skip` remains an explicit unattended-execution
35
- choice, not a fallback applied by this plugin.
36
-
37
- ## What it never touches
38
-
39
- - The OAuth token file (see [AUTH.md](AUTH.md)).
40
- - DSH-side secrets, API keys, or other providers' configuration.
41
-
42
- ## Report hygiene
43
-
44
- `/agy doctor` writes its report with redaction: Google auth URLs,
45
- `4/...` authorization codes, `ya29.*` access tokens, `1//0…` refresh tokens,
46
- OIDC/JWT `id_token`s, `AIza…`/`sk-…`/`GOCSPX-…` API keys, credentialed proxy
47
- URLs, and `Bearer` headers are stripped before the file hits disk. Still read it
48
- before attaching.
49
-
50
- ## HTTP surfaces and request-body caps
51
-
52
- - The plugin's web routes (`/plugins/agy-link/*`) and the experimental loopback
53
- MCP bridge (`/call`) share one bounded JSON body reader
54
- (`src/host/read-json-body.ts`): bodies are capped (1 MiB for plugin routes,
55
- 8 MiB for `/call`) and oversized bodies are discarded rather than buffered, so
56
- a local client — including a prompt-injected agy child holding the bridge token
57
- — cannot exhaust host memory by streaming a huge POST body.
58
- - The MCP bridge binds to `127.0.0.1` only, requires a per-process random bearer
59
- token compared in constant time, enforces `mcpToolAllowlist` at execution time,
60
- and never exposes the internal `run_code`/`agy_ask`/`agy_tool` tools.
19
+ - Loopback Origin enforcement: browser requests carrying a non-loopback `Origin` header are rejected (`403`), and no wildcard `Access-Control-Allow-Origin: *` header is emitted on `/media`, `/open`, or `/assets`.
20
+ - `/plugins/agy-link/open` is strictly `POST`-only (`405` on `GET`, preventing auto-trigger via markdown image tags), confined via `realpathSync` to active workspace/media/brain directories, blocks sensitive credential paths (`.ssh`, `.aws`, `.gnupg`, `.kube`, `.dsh`, `.gemini/antigravity-cli`, `.env`, private keys), refuses executable extensions, and passes Windows targets via environment variable (`-LiteralPath`) without PowerShell string interpolation.
21
+ - Request bodies are capped (`1 MiB` for plugin routes, `8 MiB` for loopback MCP `/call`), and the loopback MCP bridge requires a constant-time random bearer token plus `mcpToolAllowlist` enforcement while excluding internal tools (`run_code`, `agy_ask`, `agy_tool`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.6.34",
3
+ "version": "0.6.35",
4
4
  "description": "Google Antigravity (agy CLI) models for DeepSeek Harness — stream Gemini/Claude/GPT-OSS subscriptions into DSH with thinking, tool activity, token usage and in-GUI Google OAuth login.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -28,7 +28,7 @@
28
28
  "./package.json": "./package.json",
29
29
  "./locale/*.json": "./locale/*.json",
30
30
  "./icon": "./assets/icon.svg",
31
- "./icon.svg": "./icon.svg"
31
+ "./icon.svg": "./assets/icon.svg"
32
32
  },
33
33
  "dependencies": {
34
34
  "qrcode": "^1.5.4"
@@ -92,7 +92,6 @@
92
92
  "dist",
93
93
  "assets",
94
94
  "locale",
95
- "icon.svg",
96
95
  "cordis.patch.yml",
97
96
  "README.md",
98
97
  "LICENSE",
@@ -1,54 +0,0 @@
1
- <svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <defs>
3
- <!-- Core Orb Gradient -->
4
- <linearGradient id="agy-orb-gradient" x1="12" y1="11" x2="25" y2="25" gradientUnits="userSpaceOnUse">
5
- <stop offset="0%" stop-color="#38BDF8"/>
6
- <stop offset="45%" stop-color="#6366F1"/>
7
- <stop offset="85%" stop-color="#9333EA"/>
8
- <stop offset="100%" stop-color="#C026D3"/>
9
- </linearGradient>
10
-
11
- <!-- Front Orbit Ring Gradient (Glowing Vibrant Gradient) -->
12
- <linearGradient id="agy-ring-front" x1="6" y1="24" x2="31" y2="12" gradientUnits="userSpaceOnUse">
13
- <stop offset="0%" stop-color="#00D2FF"/>
14
- <stop offset="40%" stop-color="#38BDF8"/>
15
- <stop offset="70%" stop-color="#818CF8"/>
16
- <stop offset="100%" stop-color="#F43F5E"/>
17
- </linearGradient>
18
-
19
- <!-- Back Orbit Ring Gradient (Subtle Occluded Depth) -->
20
- <linearGradient id="agy-ring-back" x1="7" y1="12" x2="29" y2="24" gradientUnits="userSpaceOnUse">
21
- <stop offset="0%" stop-color="#38BDF8" stop-opacity="0.35"/>
22
- <stop offset="100%" stop-color="#A855F7" stop-opacity="0.35"/>
23
- </linearGradient>
24
-
25
- <!-- Specular Highlight Curve -->
26
- <linearGradient id="agy-highlight-grad" x1="14" y1="12" x2="19" y2="18" gradientUnits="userSpaceOnUse">
27
- <stop offset="0%" stop-color="#FFFFFF" stop-opacity="0.6"/>
28
- <stop offset="100%" stop-color="#FFFFFF" stop-opacity="0.05"/>
29
- </linearGradient>
30
- </defs>
31
-
32
- <!-- Back Segment of Orbit Ring (passes behind central sphere) -->
33
- <path d="M 6.8 14.2 C 8.2 9.6 17.8 7.2 26.2 10.8 C 28.0 11.6 29.3 12.6 30.2 13.8"
34
- stroke="url(#agy-ring-back)" stroke-width="2.4" stroke-linecap="round"/>
35
-
36
- <!-- Central Antigravity Sphere -->
37
- <circle cx="18" cy="18" r="7.5" fill="url(#agy-orb-gradient)"/>
38
-
39
- <!-- Elegant Crescent Specular Highlight (adds glass/liquid depth) -->
40
- <path d="M 13.2 15.2 A 5.5 5.5 0 0 1 21.0 13.0 A 6.2 6.2 0 0 0 14.0 18.0 Z"
41
- fill="url(#agy-highlight-grad)"/>
42
-
43
- <!-- Front Segment of Orbit Ring (sweeps in front with vibrant glow) -->
44
- <path d="M 30.2 13.8 C 31.4 18.2 21.8 26.2 12.8 24.2 C 9.4 23.4 7.4 21.8 6.6 19.6"
45
- stroke="url(#agy-ring-front)" stroke-width="2.6" stroke-linecap="round"/>
46
-
47
- <!-- Left Satellite Node (DSH Cyan Anchor) -->
48
- <circle cx="8.2" cy="18.2" r="2.2" fill="#00D2FF"/>
49
- <circle cx="8.2" cy="18.2" r="1.0" fill="#FFFFFF"/>
50
-
51
- <!-- Right Satellite Node (Antigravity Magenta Particle) -->
52
- <circle cx="28.4" cy="20.4" r="1.8" fill="#F43F5E"/>
53
- <circle cx="28.4" cy="20.4" r="0.8" fill="#FFFFFF"/>
54
- </svg>