@eddyskywalker/dsh-chatgpt-subscription 0.71.0 → 0.72.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 (83) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +4 -2
  3. package/lib/client.js +1188 -226
  4. package/lib/client.js.map +1 -1
  5. package/lib/{entry-progress-updates-DmA1u3Wy.js → entry-progress-updates-DMLVID9V.js} +10 -22
  6. package/lib/index.js +6512 -3202
  7. package/lib/plan-mode-pipeline.js +1 -1
  8. package/lib/progress-updates.js +1 -1
  9. package/lib/types/client/antigravity-acp/AntigravityAcpComposerBadge.d.ts +35 -0
  10. package/lib/types/client/antigravity-acp/AntigravityAcpComposerBadge.d.ts.map +1 -0
  11. package/lib/types/client/antigravity-acp/AntigravityAcpSection.d.ts +20 -0
  12. package/lib/types/client/antigravity-acp/AntigravityAcpSection.d.ts.map +1 -0
  13. package/lib/types/client/antigravity-acp/api.d.ts +36 -0
  14. package/lib/types/client/antigravity-acp/api.d.ts.map +1 -0
  15. package/lib/types/client/antigravity-acp/locales.d.ts +521 -0
  16. package/lib/types/client/antigravity-acp/locales.d.ts.map +1 -0
  17. package/lib/types/client/antigravity-acp/route.d.ts +3 -0
  18. package/lib/types/client/antigravity-acp/route.d.ts.map +1 -0
  19. package/lib/types/client/antigravity-acp/styles.d.ts +15 -0
  20. package/lib/types/client/antigravity-acp/styles.d.ts.map +1 -0
  21. package/lib/types/client/command-code/locales.d.ts +2 -2
  22. package/lib/types/client/hub/brand-icons.d.ts +1 -1
  23. package/lib/types/client/hub/brand-icons.d.ts.map +1 -1
  24. package/lib/types/client/hub/providers.d.ts.map +1 -1
  25. package/lib/types/client/index.d.ts +2 -0
  26. package/lib/types/client/index.d.ts.map +1 -1
  27. package/lib/types/client/locales-ru/antigravity-acp.d.ts +10 -0
  28. package/lib/types/client/locales-ru/antigravity-acp.d.ts.map +1 -0
  29. package/lib/types/client/locales-ru/hub.d.ts.map +1 -1
  30. package/lib/types/client/locales-ru/index.d.ts.map +1 -1
  31. package/lib/types/client/locales.d.ts +3 -1
  32. package/lib/types/client/locales.d.ts.map +1 -1
  33. package/lib/types/compat.d.ts +1 -1
  34. package/lib/types/host/agent-preset.d.ts.map +1 -1
  35. package/lib/types/host/antigravity-acp/acp-client.d.ts +136 -0
  36. package/lib/types/host/antigravity-acp/acp-client.d.ts.map +1 -0
  37. package/lib/types/host/antigravity-acp/adapter.d.ts +191 -0
  38. package/lib/types/host/antigravity-acp/adapter.d.ts.map +1 -0
  39. package/lib/types/host/antigravity-acp/auth-cache.d.ts +50 -0
  40. package/lib/types/host/antigravity-acp/auth-cache.d.ts.map +1 -0
  41. package/lib/types/host/antigravity-acp/binary.d.ts +122 -0
  42. package/lib/types/host/antigravity-acp/binary.d.ts.map +1 -0
  43. package/lib/types/host/antigravity-acp/catalog.d.ts +95 -0
  44. package/lib/types/host/antigravity-acp/catalog.d.ts.map +1 -0
  45. package/lib/types/host/antigravity-acp/doctor.d.ts +73 -0
  46. package/lib/types/host/antigravity-acp/doctor.d.ts.map +1 -0
  47. package/lib/types/host/antigravity-acp/errors.d.ts +59 -0
  48. package/lib/types/host/antigravity-acp/errors.d.ts.map +1 -0
  49. package/lib/types/host/antigravity-acp/history.d.ts +76 -0
  50. package/lib/types/host/antigravity-acp/history.d.ts.map +1 -0
  51. package/lib/types/host/antigravity-acp/login.d.ts +59 -0
  52. package/lib/types/host/antigravity-acp/login.d.ts.map +1 -0
  53. package/lib/types/host/antigravity-acp/mcp-bridge.d.ts +115 -0
  54. package/lib/types/host/antigravity-acp/mcp-bridge.d.ts.map +1 -0
  55. package/lib/types/host/antigravity-acp/routes.d.ts +81 -0
  56. package/lib/types/host/antigravity-acp/routes.d.ts.map +1 -0
  57. package/lib/types/host/antigravity-acp/settings.d.ts +70 -0
  58. package/lib/types/host/antigravity-acp/settings.d.ts.map +1 -0
  59. package/lib/types/host/antigravity-acp/subagent.d.ts +96 -0
  60. package/lib/types/host/antigravity-acp/subagent.d.ts.map +1 -0
  61. package/lib/types/host/antigravity-acp/types.d.ts +113 -0
  62. package/lib/types/host/antigravity-acp/types.d.ts.map +1 -0
  63. package/lib/types/host/common/i18n/en.d.ts.map +1 -1
  64. package/lib/types/host/common/i18n/provider-name.d.ts.map +1 -1
  65. package/lib/types/host/common/i18n/ru.d.ts.map +1 -1
  66. package/lib/types/host/common/i18n/zh.d.ts +3 -0
  67. package/lib/types/host/common/i18n/zh.d.ts.map +1 -1
  68. package/lib/types/host/common/model-request-control.d.ts +1 -1
  69. package/lib/types/host/common/model-request-control.d.ts.map +1 -1
  70. package/lib/types/host/common/request-diagnostics.d.ts +2 -2
  71. package/lib/types/host/common/request-diagnostics.d.ts.map +1 -1
  72. package/lib/types/host/dispatch-ledger/protocol.d.ts.map +1 -1
  73. package/lib/types/host/progress-updates/prompt.d.ts +2 -1
  74. package/lib/types/host/progress-updates/prompt.d.ts.map +1 -1
  75. package/lib/types/host/widget-board/line-quota.d.ts +10 -0
  76. package/lib/types/host/widget-board/line-quota.d.ts.map +1 -1
  77. package/lib/types/host/widget-board/line-registry.d.ts.map +1 -1
  78. package/lib/types/index.d.ts.map +1 -1
  79. package/lib/types/shared/antigravity-acp-contracts.d.ts +132 -0
  80. package/lib/types/shared/antigravity-acp-contracts.d.ts.map +1 -0
  81. package/package.json +1 -1
  82. package/presets/dispatch/README.md +11 -11
  83. package/presets/dispatch/agent.cordis.yml +57 -68
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Finding, and when necessary fetching, the official Antigravity CLI executable.
3
+ *
4
+ * Three rules shape this module:
5
+ *
6
+ * 1. **A usable local CLI wins.** Most people who want this line already have
7
+ * Antigravity installed, and running their own signed binary is both more
8
+ * honest and more current than a copy this plugin fetched. The download is a
9
+ * fallback, not the default.
10
+ * 2. **The published archive is verified, never trusted.** The `sha256` comes
11
+ * from the official ACP Registry entry and is pinned in this file; a byte that
12
+ * does not match is deleted, not executed. Redirects are refused so a moved
13
+ * archive cannot redirect the fetch somewhere else.
14
+ * 3. **Nothing is installed system-wide.** The extracted files live under
15
+ * `<DSH_HOME>/cache/antigravity-acp/<version>/`, are never copied into PATH,
16
+ * and are removed by name on failure - this repository forbids recursive
17
+ * deletion, and a cache directory is exactly where a stray recursive delete
18
+ * would do the most damage.
19
+ *
20
+ * @module dsh-chatgpt-subscription/host/antigravity-acp/binary
21
+ */
22
+ /** One downloadable archive for one platform, transcribed from the official ACP Registry. */
23
+ export interface AcpBinaryRelease {
24
+ /** Registry version this entry describes. */
25
+ version: string;
26
+ /** Archive URL. */
27
+ url: string;
28
+ /** sha256 of the archive, as the registry publishes it. */
29
+ sha256: string;
30
+ /** Executable inside the extracted archive, relative to the extraction root. */
31
+ executable: string;
32
+ }
33
+ /**
34
+ * The registry entry this build was verified against.
35
+ *
36
+ * Source: `https://github.com/agentclientprotocol/registry` →
37
+ * `antigravity-acp/agent.json`, fetched 2026-11-12. `license: proprietary`;
38
+ * the archive is fetched from `dl.google.com` at install time and is never
39
+ * redistributed with this package.
40
+ */
41
+ export declare const ACP_BINARY_VERSION = "1.5.0";
42
+ /** Platform archives, keyed by `process.platform` + `process.arch`. */
43
+ export declare const ACP_BINARY_RELEASES: Readonly<Record<string, AcpBinaryRelease>>;
44
+ /** Largest archive this line will download; the Windows build is ~80 MB. */
45
+ export declare const ACP_MAX_ARCHIVE_BYTES: number;
46
+ /** A resolved executable. */
47
+ export interface ResolvedAcpBinary {
48
+ /** Absolute path to the executable. */
49
+ path: string;
50
+ /** How it was found. */
51
+ kind: 'configured' | 'local-cli' | 'downloaded';
52
+ /** The CLI version when it could be read. */
53
+ version?: string;
54
+ }
55
+ /** Where a resolution attempt looked and what it found, for the status card. */
56
+ export interface AcpBinaryDiagnostics {
57
+ /** Every candidate path tried, in order. */
58
+ tried: string[];
59
+ /** The failure that ended the search, when nothing usable was found. */
60
+ error?: string;
61
+ }
62
+ /** Test seams so this module can be exercised with no network and no home directory. */
63
+ export interface AcpBinaryOptions {
64
+ /** Platform key; defaults to the running platform. */
65
+ platform?: string;
66
+ /** Directory the download cache lives in. */
67
+ cacheRoot?(): string;
68
+ /** `fetch` implementation. */
69
+ fetchFn?: typeof fetch;
70
+ /** Environment the `DSH_ANTIGRAVITY_ACP_BIN` override is read from. */
71
+ env?: NodeJS.ProcessEnv;
72
+ /** Home directory used to find `~/.gemini/bin/agy`. */
73
+ home?(): string;
74
+ /** Reads the CLI version; returns undefined when the binary does not answer. */
75
+ readVersion?(command: string): Promise<string | undefined>;
76
+ }
77
+ /** Candidate paths the local CLI may live at, most specific first. */
78
+ export declare function localCliCandidates(home: string, platform: string): string[];
79
+ /** Absolute path of the cached executable for one release. */
80
+ export declare function cachedExecutablePath(root: string, release: AcpBinaryRelease): string;
81
+ /**
82
+ * Resolve the executable this line should run.
83
+ *
84
+ * Order: an explicit setting, the environment override, the local Antigravity
85
+ * CLI, then the verified download. A candidate that exists but does not answer
86
+ * `--version` is skipped rather than reported as usable - a broken shim on PATH
87
+ * is the commonest way this goes wrong, and failing at resolution is a far better
88
+ * error than failing mid-turn.
89
+ *
90
+ * @param configured - An absolute path the user set, or `null`.
91
+ * @param options - Test seams.
92
+ * @returns The executable and how it was found, plus what was tried.
93
+ */
94
+ export declare function resolveAcpBinary(configured: string | null, options?: AcpBinaryOptions): Promise<{
95
+ binary?: ResolvedAcpBinary;
96
+ diagnostics: AcpBinaryDiagnostics;
97
+ }>;
98
+ /**
99
+ * Download and extract one release.
100
+ *
101
+ * The archive is fetched whole (bounded), hashed, and only then extracted; an
102
+ * entry whose path escapes the extraction root is skipped, and a mismatched hash
103
+ * deletes the archive by name and throws.
104
+ *
105
+ * @param release - Registry entry to fetch.
106
+ * @param root - Cache root.
107
+ * @param fetchFn - `fetch` implementation.
108
+ * @returns Absolute path of the extracted executable.
109
+ */
110
+ export declare function downloadRelease(release: AcpBinaryRelease, root: string, fetchFn: typeof fetch): Promise<string>;
111
+ /**
112
+ * Extract the entries of a ZIP this line downloaded itself.
113
+ *
114
+ * Deliberately narrow: stored or deflated entries only, no encryption, no path
115
+ * outside the destination. The archive comes from a pinned URL with a verified
116
+ * hash, so this is defence in depth rather than the only barrier.
117
+ *
118
+ * @param archivePath - The verified archive.
119
+ * @param destination - Extraction root.
120
+ */
121
+ export declare function extractZipEntries(archivePath: string, destination: string): Promise<void>;
122
+ //# sourceMappingURL=binary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity-acp/binary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AASH,6FAA6F;AAC7F,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAA;IACf,mBAAmB;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAA;IACd,gFAAgF;IAChF,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,UAAU,CAAA;AAEzC,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAqC1E,CAAA;AAED,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,QAAoB,CAAA;AAEtD,6BAA6B;AAC7B,MAAM,WAAW,iBAAiB;IAChC,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,wBAAwB;IACxB,IAAI,EAAE,YAAY,GAAG,WAAW,GAAG,YAAY,CAAA;IAC/C,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,gFAAgF;AAChF,MAAM,WAAW,oBAAoB;IACnC,4CAA4C;IAC5C,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wFAAwF;AACxF,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6CAA6C;IAC7C,SAAS,CAAC,IAAI,MAAM,CAAA;IACpB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,OAAO,KAAK,CAAA;IACtB,uEAAuE;IACvE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;IACvB,uDAAuD;IACvD,IAAI,CAAC,IAAI,MAAM,CAAA;IACf,gFAAgF;IAChF,WAAW,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CAC3D;AAED,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAG3E;AAED,8DAA8D;AAC9D,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAEpF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC;IAAE,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAAC,WAAW,EAAE,oBAAoB,CAAA;CAAE,CAAC,CA+C5E;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAgCrH;AA2BD;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiC/F"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * The live model catalogue: one ACP session, read once, then cached.
3
+ *
4
+ * The catalogue is not a property of this plugin - it is a property of the
5
+ * account signed in to the official CLI, and it changes when Google changes a
6
+ * plan. So it is read from the server, never shipped as a table, and the read
7
+ * itself is cheap: `initialize` + `session/new` on a throwaway process, then the
8
+ * process is closed.
9
+ *
10
+ * Two rules follow from that, and both matter more than they look:
11
+ *
12
+ * - **A cold start must not wait on the network.** The last successful listing is
13
+ * persisted and rehydrated first; the refresh runs behind it. A picker that
14
+ * blocks for twenty seconds because Google is slow is a picker that looks
15
+ * broken.
16
+ * - **A failed refresh is not a failed line.** If the agent cannot be reached,
17
+ * the cached listing still answers, and the card says the listing is stale
18
+ * rather than pretending the account has no models.
19
+ *
20
+ * @module dsh-chatgpt-subscription/host/antigravity-acp/catalog
21
+ */
22
+ import type { AcpClient } from './acp-client.ts';
23
+ import { AcpClient as Client } from './acp-client.ts';
24
+ import type { AntigravityAcpModelDto } from '../../shared/antigravity-acp-contracts.ts';
25
+ import type { AcpLaunch } from './adapter.ts';
26
+ /** How long a live listing is trusted before a background refresh replaces it. */
27
+ export declare const CATALOG_TTL_MS = 60000;
28
+ /** Budget for one catalogue read; a hung agent must not hold the picker. */
29
+ export declare const CATALOG_TIMEOUT_MS = 20000;
30
+ /** One read's result. */
31
+ export interface AcpCatalogRead {
32
+ models: AntigravityAcpModelDto[];
33
+ /** Subscription tier the server reported, when it reported one. */
34
+ tier?: {
35
+ id: string;
36
+ name: string;
37
+ };
38
+ /** Whether this came from the persisted snapshot rather than a live session. */
39
+ fromSnapshot: boolean;
40
+ /** Unix milliseconds this listing was produced. */
41
+ fetchedAt: number;
42
+ }
43
+ /** The reader, with the cache it maintains. */
44
+ export declare class AcpCatalog {
45
+ private readonly resolveLaunch;
46
+ private readonly spawnClient;
47
+ private readonly scope;
48
+ private readonly now;
49
+ private cached;
50
+ private inflight;
51
+ private readonly snapshotName;
52
+ /**
53
+ * @param resolveLaunch - Resolves the executable for a read.
54
+ * @param spawnClient - Test seam for the protocol client.
55
+ * @param scope - Credential/plan scope folded into the snapshot file name.
56
+ * @param now - Clock seam.
57
+ */
58
+ constructor(resolveLaunch: () => Promise<AcpLaunch>, spawnClient: (launch: AcpLaunch) => AcpClient, scope?: string, now?: () => number);
59
+ /** The listing without touching the network: what the picker renders first. */
60
+ rehydrate(): Promise<AcpCatalogRead | undefined>;
61
+ /**
62
+ * Read the live listing, or answer from cache while a refresh runs.
63
+ *
64
+ * @param options - `force` bypasses the TTL; `signal` cancels the read.
65
+ * @returns The best listing available, or undefined when nothing has ever been read.
66
+ */
67
+ read(options?: {
68
+ force?: boolean;
69
+ signal?: AbortSignal;
70
+ }): Promise<AcpCatalogRead | undefined>;
71
+ /** Discard the in-memory listing; the next read rehydrates from disk. */
72
+ invalidate(): void;
73
+ private refresh;
74
+ }
75
+ /**
76
+ * Read one catalogue from a connected agent.
77
+ *
78
+ * ACP publishes the model list twice - as `availableModels` (tier ids) and as a
79
+ * `model` config option (base ids) - and the thinking ladder as a separate
80
+ * `thought_level` option. The three are reconciled here rather than in three
81
+ * call sites; see {@link collapseModels}.
82
+ *
83
+ * @param client - A freshly spawned client.
84
+ * @param signal - Cancellation.
85
+ * @returns Collapsed models and the tier the server reported.
86
+ */
87
+ export declare function readCatalogFrom(client: AcpClient, signal?: AbortSignal): Promise<{
88
+ models: AntigravityAcpModelDto[];
89
+ tier?: {
90
+ id: string;
91
+ name: string;
92
+ };
93
+ }>;
94
+ export { Client };
95
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity-acp/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,SAAS,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAOrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAA;AACvF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAG7C,kFAAkF;AAClF,eAAO,MAAM,cAAc,QAAS,CAAA;AAEpC,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,QAAS,CAAA;AAExC,yBAAyB;AACzB,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,sBAAsB,EAAE,CAAA;IAChC,mEAAmE;IACnE,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACnC,gFAAgF;IAChF,YAAY,EAAE,OAAO,CAAA;IACrB,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,+CAA+C;AAC/C,qBAAa,UAAU;IAYnB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAdtB,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,QAAQ,CAAiD;IACjE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAQ;IAErC;;;;;OAKG;gBAEgB,aAAa,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,EACvC,WAAW,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,SAAS,EAC7C,KAAK,GAAE,MAAkB,EACzB,GAAG,GAAE,MAAM,MAAiB;IAK/C,+EAA+E;IACzE,SAAS,IAAI,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAQtD;;;;;OAKG;IACG,IAAI,CAAC,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAO,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAcxG,yEAAyE;IACzE,UAAU,IAAI,IAAI;YAIJ,OAAO;CAkBtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,SAAS,EACjB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC;IAAE,MAAM,EAAE,sBAAsB,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC,CAqCpF;AA8ED,OAAO,EAAE,MAAM,EAAE,CAAA"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The line's self-check: one command that answers "why is this line not working?"
3
+ *
4
+ * Every other diagnostic in this repository is either a unit test (needs a
5
+ * checkout) or a route (needs a running host and a browser). Neither helps the
6
+ * person who just installed the plugin and sees no models. This module runs the
7
+ * same probes the adapter runs, in the same order, and prints one line per stage:
8
+ * executable, protocol, sign-in, catalogue, and (when a session is available) one
9
+ * real prompt.
10
+ *
11
+ * It is deliberately a pure function over injected probes so it can be tested
12
+ * without a live agent, and it never prints a credential or a raw protocol frame.
13
+ *
14
+ * @module dsh-chatgpt-subscription/host/antigravity-acp/doctor
15
+ */
16
+ import type { AcpLaunch } from './adapter.ts';
17
+ import type { AcpClient } from './acp-client.ts';
18
+ import type { AntigravityAcpModelDto } from '../../shared/antigravity-acp-contracts.ts';
19
+ /** One stage's outcome. */
20
+ export interface DoctorStep {
21
+ /** Stable stage id, e.g. `binary`, `protocol`, `auth`, `catalog`, `prompt`. */
22
+ id: string;
23
+ ok: boolean;
24
+ /** One line a human can act on. */
25
+ detail: string;
26
+ }
27
+ /** Everything the check needs, injected. */
28
+ export interface DoctorProbes {
29
+ resolveBinary(): Promise<{
30
+ path?: string;
31
+ version?: string;
32
+ kind?: string;
33
+ error?: string;
34
+ }>;
35
+ resolveLaunch(): Promise<AcpLaunch>;
36
+ spawnClient(launch: AcpLaunch): AcpClient;
37
+ readCatalog(client: AcpClient): Promise<{
38
+ models: AntigravityAcpModelDto[];
39
+ tier?: {
40
+ id: string;
41
+ name: string;
42
+ };
43
+ }>;
44
+ probeAuth(client: AcpClient): Promise<{
45
+ authenticated: boolean;
46
+ tier?: {
47
+ id: string;
48
+ name: string;
49
+ };
50
+ }>;
51
+ /** Optional: run one real prompt and return the assistant text. */
52
+ probePrompt?(client: AcpClient, model: string): Promise<string>;
53
+ }
54
+ /** Result of one full self-check. */
55
+ export interface DoctorReport {
56
+ ok: boolean;
57
+ steps: DoctorStep[];
58
+ }
59
+ /**
60
+ * Run every stage, in order, stopping where the next stage would be meaningless.
61
+ *
62
+ * @param probes - The line's own probes.
63
+ * @returns One step per stage plus an overall verdict.
64
+ */
65
+ export declare function runDoctor(probes: DoctorProbes): Promise<DoctorReport>;
66
+ /**
67
+ * Render one report as the lines a CLI prints.
68
+ *
69
+ * @param report - The report from {@link runDoctor}.
70
+ * @returns One line per stage, plus a verdict line.
71
+ */
72
+ export declare function formatDoctorReport(report: DoctorReport): string[];
73
+ //# sourceMappingURL=doctor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity-acp/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAA;AAEvF,2BAA2B;AAC3B,MAAM,WAAW,UAAU;IACzB,+EAA+E;IAC/E,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,OAAO,CAAA;IACX,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAA;CACf;AAED,4CAA4C;AAC5C,MAAM,WAAW,YAAY;IAC3B,aAAa,IAAI,OAAO,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC5F,aAAa,IAAI,OAAO,CAAC,SAAS,CAAC,CAAA;IACnC,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAA;IACzC,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,sBAAsB,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC,CAAA;IAClH,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;QAAE,aAAa,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC,CAAA;IACtG,mEAAmE;IACnE,WAAW,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CAChE;AAED,qCAAqC;AACrC,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,OAAO,CAAA;IACX,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAwD3E;AAeD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,EAAE,CAIjE"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * This line's own failure vocabulary.
3
+ *
4
+ * ACP failures used to come back as the harness's generic codes (`TRANSPORT`,
5
+ * `UNSUPPORTED_OPTION`, `ACCOUNT_SIGN_IN_REQUIRED`). That reads fine in a
6
+ * sentence and badly everywhere else: a user reporting "it says TRANSPORT" cannot
7
+ * be helped, a log search cannot find "the agent exited", and the card cannot
8
+ * branch on which of six very different things went wrong.
9
+ *
10
+ * Each code below names exactly one actionable condition, and each carries the
11
+ * sentence that tells the user what to do. The table is duplicated in
12
+ * `docs/antigravity-acp-line-plan.md` §8 so a support conversation and the
13
+ * codebase use the same words.
14
+ *
15
+ * @module dsh-chatgpt-subscription/host/antigravity-acp/errors
16
+ */
17
+ import { LlmError } from '@deepseek-ai/dsh-llm';
18
+ /** Every failure code this line raises. */
19
+ export declare const ACP_ERROR_CODES: {
20
+ /** No cached credentials; the official process asked for a sign-in. */
21
+ readonly ACP_AUTH_REQUIRED: "The Antigravity CLI is not signed in. Run `agy acp --login` or use the sign-in button in this card.";
22
+ /** The executable is missing or cannot be started. */
23
+ readonly ACP_BINARY_UNAVAILABLE: "No usable Antigravity CLI (agy) was found. Install it, or let this line download the official ACP server.";
24
+ /** The agent process exited mid-turn. */
25
+ readonly ACP_DISCONNECTED: "The Antigravity agent process ended mid-turn. Retry to reconnect.";
26
+ /** A JSON-RPC error the line has no specific handling for. */
27
+ readonly ACP_RPC_ERROR: "The Antigravity ACP server returned a JSON-RPC error.";
28
+ /** The server rejected the request parameters or the model id. */
29
+ readonly ACP_INVALID_PARAMS: "The Antigravity ACP server rejected the request parameters or the model id.";
30
+ /** The server does not implement the method this client called. */
31
+ readonly ACP_METHOD_UNSUPPORTED: "The installed Antigravity version does not support a method this line needs. Update the Antigravity CLI.";
32
+ /** The agent ran one of its own tools instead of the DSH bridge. */
33
+ readonly ACP_NATIVE_TOOLS_UNSUPPORTED: "Antigravity ran its own tool outside this harness. The turn was cancelled because that action did not pass through DSH permissions.";
34
+ /** The agent refused the prompt. */
35
+ readonly ACP_REFUSAL: "The Antigravity agent refused this prompt.";
36
+ /** The server stopped for a reason this line does not recognise. */
37
+ readonly ACP_UNKNOWN_STOP: "The Antigravity agent stopped for an unrecognised reason.";
38
+ /** A tool result the harness produced could not be matched to its call. */
39
+ readonly ACP_TOOL_RESULTS_MISSING: "A tool result was missing or duplicated when resuming this turn. Retry from the saved history.";
40
+ /** Too many turns in flight at once. */
41
+ readonly ACP_SESSION_LIMIT: "Too many Antigravity turns are running at once. Finish or cancel one and retry.";
42
+ /** The caller asked for a sampling control ACP cannot express. */
43
+ readonly ACP_UNSUPPORTED_OPTION: "ACP cannot express this sampling control. This line rejects it rather than silently ignoring it.";
44
+ /** Cleanup could not be verified. */
45
+ readonly ACP_TEARDOWN_FAILED: "The Antigravity process could not be cleaned up. Restart the profile.";
46
+ };
47
+ /** One code from {@link ACP_ERROR_CODES}. */
48
+ export type AcpErrorCode = keyof typeof ACP_ERROR_CODES;
49
+ /**
50
+ * Build one line-specific failure.
51
+ *
52
+ * @param code - The condition being reported.
53
+ * @param detail - Optional extra fact appended after the standard sentence.
54
+ * @returns An {@link LlmError} carrying that code.
55
+ */
56
+ export declare function acpError(code: AcpErrorCode, detail?: string): LlmError;
57
+ /** Whether a string is one of this line's codes. */
58
+ export declare function isAcpErrorCode(value: string): value is AcpErrorCode;
59
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity-acp/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE/C,2CAA2C;AAC3C,eAAO,MAAM,eAAe;IAC1B,uEAAuE;;IAEvE,sDAAsD;;IAEtD,yCAAyC;;IAEzC,8DAA8D;;IAE9D,kEAAkE;;IAElE,mEAAmE;;IAEnE,oEAAoE;;IAEpE,oCAAoC;;IAEpC,oEAAoE;;IAEpE,2EAA2E;;IAE3E,wCAAwC;;IAExC,kEAAkE;;IAElE,qCAAqC;;CAE7B,CAAA;AAEV,6CAA6C;AAC7C,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,eAAe,CAAA;AAEvD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAOtE;AAED,oDAAoD;AACpD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,YAAY,CAEnE"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Projection of this harness's conversation onto ACP prompt content, plus the
3
+ * fingerprint that decides whether an existing ACP session may be reused.
4
+ *
5
+ * ACP has no message list: a session is created once, prompted, and then keeps
6
+ * its own transcript. DSH, on the other hand, re-sends the whole assembled
7
+ * history on every model call - including the calls that only exist because a
8
+ * tool just ran. Both facts have to be reconciled, and this module is the seam:
9
+ *
10
+ * - **A new ACP session** is fed the entire DSH history as one prompt, because
11
+ * that history is the only transcript the model may rely on.
12
+ * - **An existing ACP session** is fed only the messages DSH added since the
13
+ * last prompt, because the agent already has the rest.
14
+ * - A mismatch (compaction, an edited turn, a different model) means the ACP
15
+ * transcript can no longer be trusted as a prefix of DSH's: the session is
16
+ * abandoned and replayed in full.
17
+ *
18
+ * The fingerprint is an HMAC-style digest rather than a stored transcript: it
19
+ * costs one hash per message and never keeps a second copy of user content.
20
+ *
21
+ * @module dsh-chatgpt-subscription/host/antigravity-acp/history
22
+ */
23
+ import type { GenerateOptions, Message } from '../common/llm-compat.ts';
24
+ import type { ResolvedRequestImages } from '../common/request-images.ts';
25
+ /** One ACP prompt content block. */
26
+ export type AcpPromptBlock = {
27
+ type: 'text';
28
+ text: string;
29
+ } | {
30
+ type: 'image';
31
+ mimeType: string;
32
+ data: string;
33
+ };
34
+ /** ACP's own image ceiling per content block. */
35
+ export declare const ACP_MAX_INLINE_IMAGE_BYTES: number;
36
+ /** Content handed to `session/prompt` for one generation. */
37
+ export interface AcpPrompt {
38
+ blocks: AcpPromptBlock[];
39
+ /** Number of DSH messages this prompt covers, counted from the start of the history. */
40
+ coveredMessages: number;
41
+ /** Digest over the covered messages, used to recognise a matching prefix later. */
42
+ fingerprint: string;
43
+ }
44
+ /**
45
+ * Build the prompt for one generation.
46
+ *
47
+ * @param options - Normalized request options.
48
+ * @param images - Images resolved for this request, keyed by attachment id.
49
+ * @param fromMessage - Index of the first DSH message this prompt must carry; 0 replays everything.
50
+ * @returns The blocks to send, plus what they cover.
51
+ */
52
+ export declare function buildPrompt(options: GenerateOptions, images: ResolvedRequestImages, fromMessage: number): AcpPrompt;
53
+ /**
54
+ * Digest over a message range.
55
+ *
56
+ * Only the parts the model can see take part: role, block type and payload. Ids
57
+ * and sources are deliberately excluded, because DSH re-stamps them between
58
+ * generations and a fingerprint that changed on every turn would force a cold
59
+ * replay every time.
60
+ *
61
+ * @param messages - Normalized history.
62
+ * @param from - First index covered.
63
+ * @param to - One past the last index covered.
64
+ * @returns Hex digest.
65
+ */
66
+ export declare function fingerprintMessages(messages: readonly Message[], from: number, to: number): string;
67
+ /**
68
+ * Whether `messages` still begins with everything a live ACP session has seen.
69
+ *
70
+ * @param messages - The history about to be sent.
71
+ * @param covered - How many messages the session was last told about.
72
+ * @param fingerprint - Digest that covered range produced at the time.
73
+ * @returns whether the prefix is unchanged and at least one new message follows.
74
+ */
75
+ export declare function canContinue(messages: readonly Message[], covered: number, fingerprint: string): boolean;
76
+ //# sourceMappingURL=history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity-acp/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,EAAgB,eAAe,EAAE,OAAO,EAAmB,MAAM,yBAAyB,CAAA;AACtG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAGxE,oCAAoC;AACpC,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD,iDAAiD;AACjD,eAAO,MAAM,0BAA0B,QAAmB,CAAA;AAE1D,6DAA6D;AAC7D,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,wFAAwF;IACxF,eAAe,EAAE,MAAM,CAAA;IACvB,mFAAmF;IACnF,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,qBAAqB,EAC7B,WAAW,EAAE,MAAM,GAClB,SAAS,CAkBX;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAWlG;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,SAAS,OAAO,EAAE,EAC5B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAClB,OAAO,CAGT"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Sign-in for the Antigravity (ACP) line.
3
+ *
4
+ * This line owns no credentials. The official `agy` process signs itself in,
5
+ * stores its own token in its own store, and refreshes it on its own schedule;
6
+ * what this module can do is *start* that sign-in and *ask* whether it worked.
7
+ *
8
+ * Two consequences follow, and they are the whole design:
9
+ *
10
+ * - **The browser is opened exactly once.** `agy acp --login` opens it. A host
11
+ * that also opened the authorize URL would show two identical Google pages for
12
+ * one click - the bug this repository has already paid for once on three other
13
+ * lines. So nothing here calls `openBrowser`.
14
+ * - **"Signed in" is a probe, not a flag.** There is no local state to read: the
15
+ * only truthful answer comes from asking the agent to create a session, which
16
+ * is what {@link probeAuth} does. A failed probe is reported as "not signed in",
17
+ * never as a stale cached "yes".
18
+ *
19
+ * @module dsh-chatgpt-subscription/host/antigravity-acp/login
20
+ */
21
+ import type { AcpClient } from './acp-client.ts';
22
+ import type { AcpLaunch } from './adapter.ts';
23
+ import type { AntigravityAcpAuthDto } from '../../shared/antigravity-acp-contracts.ts';
24
+ /** How long the login launcher may run before it is considered detached. */
25
+ export declare const LOGIN_LAUNCH_BUDGET_MS = 10000;
26
+ /** Budget for one auth probe. */
27
+ export declare const AUTH_PROBE_BUDGET_MS = 30000;
28
+ /** What starting a sign-in produced. */
29
+ export interface LoginStartResult {
30
+ /** True when a sign-in process was started. */
31
+ started: boolean;
32
+ /** Why it could not start, when it could not. */
33
+ error?: string;
34
+ }
35
+ /**
36
+ * Start the official sign-in.
37
+ *
38
+ * The process is spawned detached and its stdout/stderr are drained: on a desktop
39
+ * it opens the browser and exits once the callback lands, on a headless host it
40
+ * prints the URL it would have opened. Either way this call returns as soon as
41
+ * the process exists - it never waits for the user.
42
+ *
43
+ * @param launch - The resolved executable.
44
+ * @returns whether a process was started.
45
+ */
46
+ export declare function startLogin(launch: AcpLaunch): LoginStartResult;
47
+ /**
48
+ * Ask the agent whether it currently holds usable credentials.
49
+ *
50
+ * A session is created and immediately abandoned: that is the smallest request
51
+ * that exercises the whole credential path (the server needs the account to build
52
+ * a session, including its model list and tier).
53
+ *
54
+ * @param client - A freshly spawned client.
55
+ * @param signal - Cancellation.
56
+ * @returns The auth state and, when signed in, the tier the server reported.
57
+ */
58
+ export declare function probeAuth(client: AcpClient, signal?: AbortSignal): Promise<AntigravityAcpAuthDto>;
59
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity-acp/login.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAA;AAEtF,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,QAAS,CAAA;AAE5C,iCAAiC;AACjC,eAAO,MAAM,oBAAoB,QAAS,CAAA;AAE1C,wCAAwC;AACxC,MAAM,WAAW,gBAAgB;IAC/B,+CAA+C;IAC/C,OAAO,EAAE,OAAO,CAAA;IAChB,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,GAAG,gBAAgB,CAa9D;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA4BvG"}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * The local MCP bridge: the one place where the ACP agent's tool calls become
3
+ * this harness's tool calls.
4
+ *
5
+ * WHY A BRIDGE AT ALL
6
+ *
7
+ * ACP gives an agent its own tools. That is fine for an editor, and wrong for a
8
+ * subscription line inside DSH: a `write_file` performed by the agent process
9
+ * would bypass this harness's permission presets, its sandbox policy, its tool
10
+ * wrappers and its durable tool-result records. So the session is created with a
11
+ * loopback MCP server descriptor whose catalogue is *this request's* tool
12
+ * schemas; the agent asks the bridge to call one, the bridge parks that request
13
+ * and surfaces it to the adapter as an ordinary DSH tool call, and the harness
14
+ * executes it. When the next generation arrives with the result, the parked MCP
15
+ * request is answered with the real bytes (or `isError` for a denial).
16
+ *
17
+ * TRUST BOUNDARY
18
+ *
19
+ * The bridge is reachable by anything on this machine that learns its port and
20
+ * token, so both are minted per session: a fresh 256-bit bearer token, bound to
21
+ * 127.0.0.1 only, `Host` validated, browser `Origin` refused, `POST /mcp` only,
22
+ * and a 1 MiB body cap. A caller that fails any of those is answered 403/413 and
23
+ * never reaches a tool.
24
+ *
25
+ * @module dsh-chatgpt-subscription/host/antigravity-acp/mcp-bridge
26
+ */
27
+ import type { ToolSchema } from '@deepseek-ai/dsh-llm';
28
+ /** One tool call the agent asked the bridge to perform, parked until DSH answers. */
29
+ export interface ParkedToolCall {
30
+ /** Bridge-internal id, also the MCP request id that must be answered. */
31
+ callId: string;
32
+ /** The DSH tool name (unmapped). */
33
+ name: string;
34
+ /** Raw JSON argument text exactly as the agent produced it. */
35
+ argumentsText: string;
36
+ }
37
+ /** What DSH produced for one parked call. */
38
+ export interface ToolCallOutcome {
39
+ /** Text handed back to the agent. */
40
+ text: string;
41
+ /** True when the harness refused or the tool failed; the agent must see an error, not a blank success. */
42
+ isError: boolean;
43
+ }
44
+ /** MCP descriptor the ACP session receives. */
45
+ export interface BridgeDescriptor {
46
+ name: string;
47
+ type: 'http';
48
+ url: string;
49
+ headers: {
50
+ name: string;
51
+ value: string;
52
+ }[];
53
+ }
54
+ /** Largest body the bridge accepts; a tool result is bounded by the harness, an argument object is small. */
55
+ export declare const BRIDGE_MAX_BODY_BYTES = 1048576;
56
+ /** Largest tool catalogue the bridge exposes. */
57
+ export declare const BRIDGE_MAX_TOOLS = 256;
58
+ /** Largest single tool definition the bridge accepts. */
59
+ export declare const BRIDGE_MAX_TOOL_BYTES = 131072;
60
+ /** Largest number of calls that may be parked at once. */
61
+ export declare const BRIDGE_MAX_PENDING = 64;
62
+ /** MCP server name advertised to the agent; the reference implementation's own clients key on it. */
63
+ export declare const BRIDGE_SERVER_NAME = "dsh-bridge";
64
+ /**
65
+ * One bridge, valid for exactly one ACP session and one tool catalogue.
66
+ *
67
+ * A bridge is not reusable across sessions: the catalogue is captured here, and
68
+ * reusing it would let a stale schema reach the agent after the harness's tool
69
+ * set changed.
70
+ */
71
+ export declare class McpBridge {
72
+ private server;
73
+ private descriptor;
74
+ private readonly token;
75
+ private readonly exposed;
76
+ private readonly withdrawn;
77
+ private readonly parked;
78
+ private readonly waiters;
79
+ private closed;
80
+ /**
81
+ * @param tools - The exact tool schemas this DSH request carries.
82
+ */
83
+ constructor(tools: readonly ToolSchema[]);
84
+ /** Bind the loopback listener and return the descriptor an ACP session accepts. */
85
+ start(): Promise<BridgeDescriptor>;
86
+ /** Calls parked since the last read, in arrival order. */
87
+ takeParked(): ParkedToolCall[];
88
+ /** How many calls are currently waiting for an answer. */
89
+ get pendingCount(): number;
90
+ /**
91
+ * Resolve one parked call with what the harness produced.
92
+ *
93
+ * @param callId - The id {@link takeParked} handed out.
94
+ * @param outcome - Result text and whether it is an error.
95
+ * @returns whether a parked call answered this id.
96
+ */
97
+ settle(callId: string, outcome: ToolCallOutcome): boolean;
98
+ /**
99
+ * Wait until at least one call is parked or the bridge closes.
100
+ *
101
+ * @param signal - Caller cancellation.
102
+ * @returns true when work is available, false when the wait ended without any.
103
+ */
104
+ waitForWork(signal?: AbortSignal): Promise<boolean>;
105
+ /** Close the listener and refuse every outstanding call. */
106
+ close(): Promise<void>;
107
+ /** Responses parked on their MCP request, keyed by call id. */
108
+ private readonly pendingResponses;
109
+ private handle;
110
+ /** Answer the methods the agent asks before it can call anything. */
111
+ private answer;
112
+ private handleToolCall;
113
+ private authorized;
114
+ }
115
+ //# sourceMappingURL=mcp-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-bridge.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity-acp/mcp-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEtD,qFAAqF;AACrF,MAAM,WAAW,cAAc;IAC7B,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAA;IACd,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,+DAA+D;IAC/D,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,0GAA0G;IAC1G,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,+CAA+C;AAC/C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAC3C;AAED,6GAA6G;AAC7G,eAAO,MAAM,qBAAqB,UAAY,CAAA;AAE9C,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,MAAM,CAAA;AAEnC,yDAAyD;AACzD,eAAO,MAAM,qBAAqB,SAAU,CAAA;AAE5C,0DAA0D;AAC1D,eAAO,MAAM,kBAAkB,KAAK,CAAA;AAEpC,qGAAqG;AACrG,eAAO,MAAM,kBAAkB,eAAe,CAAA;AAE9C;;;;;;GAMG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,UAAU,CAA8B;IAChD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwC;IAC9D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiC;IAC3D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAC3D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAChD,OAAO,CAAC,MAAM,CAAQ;IAEtB;;OAEG;gBACS,KAAK,EAAE,SAAS,UAAU,EAAE;IAIxC,mFAAmF;IAC7E,KAAK,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAuBxC,0DAA0D;IAC1D,UAAU,IAAI,cAAc,EAAE;IAO9B,0DAA0D;IAC1D,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO;IAQzD;;;;;OAKG;IACH,WAAW,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAqBnD,4DAA4D;IACtD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAc5B,+DAA+D;IAC/D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAwD;YAE3E,MAAM;IAyDpB,qEAAqE;IACrE,OAAO,CAAC,MAAM;YA6BA,cAAc;IAwC5B,OAAO,CAAC,UAAU;CAiBnB"}