@eddyskywalker/dsh-chatgpt-subscription 0.69.0 → 0.70.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/CHANGELOG.md +24 -0
- package/README.md +3 -5
- package/lib/client.js +337 -1356
- package/lib/client.js.map +1 -1
- package/lib/index.js +2852 -7174
- package/lib/types/client/CodexImageToolView.d.ts.map +1 -1
- package/lib/types/client/claude/locales.d.ts +2 -2
- package/lib/types/client/command-code/locales.d.ts +2 -2
- package/lib/types/client/common/ContextWindowEditor.d.ts.map +1 -1
- package/lib/types/client/common/account-pool-labels.d.ts +1 -1
- package/lib/types/client/common/account-pool-labels.d.ts.map +1 -1
- package/lib/types/client/common/format.d.ts +1 -1
- package/lib/types/client/glm-coding-plan/locales.d.ts +2 -2
- package/lib/types/client/hub/brand-icons.d.ts +1 -1
- package/lib/types/client/hub/brand-icons.d.ts.map +1 -1
- package/lib/types/client/hub/providers.d.ts.map +1 -1
- package/lib/types/client/index.d.ts +0 -2
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/kimi-code/locales.d.ts +2 -2
- package/lib/types/client/locales-ru/hub.d.ts.map +1 -1
- package/lib/types/client/locales-ru/index.d.ts.map +1 -1
- package/lib/types/client/locales.d.ts +1 -3
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/minimax-code/locales.d.ts +2 -2
- package/lib/types/client/progress-updates/locales.d.ts +3 -3
- package/lib/types/client/progress-updates/styles.d.ts +1 -1
- package/lib/types/client/qoder/locales.d.ts +1 -1
- package/lib/types/client/step-code/StepCodeComposerQuota.d.ts +3 -5
- package/lib/types/client/step-code/StepCodeComposerQuota.d.ts.map +1 -1
- package/lib/types/client/step-code/locales.d.ts +2 -2
- package/lib/types/compat.d.ts +1 -10
- package/lib/types/compat.d.ts.map +1 -1
- package/lib/types/host/agent-preset.d.ts +5 -3
- package/lib/types/host/agent-preset.d.ts.map +1 -1
- package/lib/types/host/common/capabilities.d.ts.map +1 -1
- package/lib/types/host/common/i18n/en.d.ts.map +1 -1
- package/lib/types/host/common/i18n/ru.d.ts.map +1 -1
- package/lib/types/host/common/i18n/zh.d.ts +0 -2
- package/lib/types/host/common/i18n/zh.d.ts.map +1 -1
- package/lib/types/host/common/model-request-control.d.ts +1 -1
- package/lib/types/host/common/model-request-control.d.ts.map +1 -1
- package/lib/types/host/common/prompt-cache-policy.d.ts.map +1 -1
- package/lib/types/host/common/request-diagnostics.d.ts +1 -1
- package/lib/types/host/common/request-diagnostics.d.ts.map +1 -1
- package/lib/types/host/credential-store-secret-service.d.ts +3 -5
- package/lib/types/host/credential-store-secret-service.d.ts.map +1 -1
- package/lib/types/host/glm-coding-plan/oauth.d.ts +1 -1
- package/lib/types/host/kimi-code/adapter.d.ts +6 -2
- package/lib/types/host/kimi-code/adapter.d.ts.map +1 -1
- package/lib/types/host/kimi-code/types.d.ts +14 -0
- package/lib/types/host/kimi-code/types.d.ts.map +1 -1
- package/lib/types/host/opendesign/types.d.ts +1 -2
- package/lib/types/host/opendesign/types.d.ts.map +1 -1
- package/lib/types/host/preset-sync.d.ts +2 -2
- package/lib/types/host/preset-sync.d.ts.map +1 -1
- package/lib/types/host/proxy-manager.d.ts +10 -10
- package/lib/types/host/proxy-manager.d.ts.map +1 -1
- package/lib/types/host/widget-board/line-contracts.d.ts +1 -1
- package/lib/types/host/widget-board/line-quota.d.ts +1 -16
- package/lib/types/host/widget-board/line-quota.d.ts.map +1 -1
- package/lib/types/host/widget-board/line-registry.d.ts.map +1 -1
- package/lib/types/index.d.ts +2 -31
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/minimax-code-contracts.d.ts +1 -1
- package/package.json +8 -6
- package/widgets/line-flip/widget.json +2 -7
- package/bin/antigravity-login.mjs +0 -47
- package/lib/types/client/antigravity/AntigravityComposerQuota.d.ts +0 -32
- package/lib/types/client/antigravity/AntigravityComposerQuota.d.ts.map +0 -1
- package/lib/types/client/antigravity/AntigravitySection.d.ts +0 -8
- package/lib/types/client/antigravity/AntigravitySection.d.ts.map +0 -1
- package/lib/types/client/antigravity/locales.d.ts +0 -290
- package/lib/types/client/antigravity/locales.d.ts.map +0 -1
- package/lib/types/client/antigravity/styles.d.ts +0 -3
- package/lib/types/client/antigravity/styles.d.ts.map +0 -1
- package/lib/types/client/locales-ru/antigravity.d.ts +0 -10
- package/lib/types/client/locales-ru/antigravity.d.ts.map +0 -1
- package/lib/types/host/antigravity/account-pool.d.ts +0 -158
- package/lib/types/host/antigravity/account-pool.d.ts.map +0 -1
- package/lib/types/host/antigravity/adapter.d.ts +0 -73
- package/lib/types/host/antigravity/adapter.d.ts.map +0 -1
- package/lib/types/host/antigravity/cache-stats.d.ts +0 -166
- package/lib/types/host/antigravity/cache-stats.d.ts.map +0 -1
- package/lib/types/host/antigravity/catalog-limits.d.ts +0 -23
- package/lib/types/host/antigravity/catalog-limits.d.ts.map +0 -1
- package/lib/types/host/antigravity/client-version.d.ts +0 -55
- package/lib/types/host/antigravity/client-version.d.ts.map +0 -1
- package/lib/types/host/antigravity/client.d.ts +0 -74
- package/lib/types/host/antigravity/client.d.ts.map +0 -1
- package/lib/types/host/antigravity/image-tool.d.ts +0 -73
- package/lib/types/host/antigravity/image-tool.d.ts.map +0 -1
- package/lib/types/host/antigravity/mapper.d.ts +0 -165
- package/lib/types/host/antigravity/mapper.d.ts.map +0 -1
- package/lib/types/host/antigravity/oauth.d.ts +0 -98
- package/lib/types/host/antigravity/oauth.d.ts.map +0 -1
- package/lib/types/host/antigravity/port-constants.d.ts +0 -33
- package/lib/types/host/antigravity/port-constants.d.ts.map +0 -1
- package/lib/types/host/antigravity/routes.d.ts +0 -7
- package/lib/types/host/antigravity/routes.d.ts.map +0 -1
- package/lib/types/host/antigravity/token-store.d.ts +0 -76
- package/lib/types/host/antigravity/token-store.d.ts.map +0 -1
- package/lib/types/host/antigravity/tool-schema.d.ts +0 -14
- package/lib/types/host/antigravity/tool-schema.d.ts.map +0 -1
- package/lib/types/host/antigravity/types.d.ts +0 -140
- package/lib/types/host/antigravity/types.d.ts.map +0 -1
- package/lib/types/shared/antigravity-contracts.d.ts +0 -175
- package/lib/types/shared/antigravity-contracts.d.ts.map +0 -1
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-session cache accounting for the Antigravity line.
|
|
3
|
-
*
|
|
4
|
-
* Antigravity's prompt cache is implicit and server-side: the client sets no
|
|
5
|
-
* cache-control field, and the only evidence that a prefix was reused is the
|
|
6
|
-
* pair `usageMetadata.cachedContentTokenCount` / `promptTokenCount` on each
|
|
7
|
-
* response. A ratio on its own cannot explain itself, so every request also
|
|
8
|
-
* fingerprints the three parts of its body that decide the prefix the service is
|
|
9
|
-
* able to reuse — `request.contents`, `request.systemInstruction` and
|
|
10
|
-
* `request.tools` — and diffs them against the previous request of the same
|
|
11
|
-
* session.
|
|
12
|
-
*
|
|
13
|
-
* Everything here is process-local, scoped by session, and never written to
|
|
14
|
-
* disk: the numbers describe the conversations this host served, and one
|
|
15
|
-
* session's misses must never be blended into another's ratio.
|
|
16
|
-
*
|
|
17
|
-
* KNOWN LIMITATION — the two halves read the request at different scopes.
|
|
18
|
-
*
|
|
19
|
-
* This is a measured fact about this module, not a theory: the prefix snapshots
|
|
20
|
-
* that produce a drift cause are keyed by SESSION alone ({@link
|
|
21
|
-
* sessionScopeKey}), while the token totals are keyed by SESSION AND ACCOUNT
|
|
22
|
-
* ({@link statsScopeKey}). The account is deliberately absent from the snapshot
|
|
23
|
-
* because the account that will answer a request is not known when the body is
|
|
24
|
-
* assembled — the adapter resolves it at the pool, after the fingerprint is
|
|
25
|
-
* taken.
|
|
26
|
-
*
|
|
27
|
-
* What follows from that: when one conversation is served by more than one
|
|
28
|
-
* pooled account (a 429 falls through to the next account mid-session), the
|
|
29
|
-
* three prefix segments and the raw session id are all byte-for-byte unchanged,
|
|
30
|
-
* so the drift comparator reports 'none'. A reader must NOT read that as "the
|
|
31
|
-
* client sent nothing different, so the chill came from the service" — the
|
|
32
|
-
* account did change. The request that reached the service was not the same
|
|
33
|
-
* request, even though every field this module fingerprints is identical.
|
|
34
|
-
*
|
|
35
|
-
* Whether the serving account actually partitions the server-side cache is
|
|
36
|
-
* INFERRED, not measured — the same unverified assumption the account-scoped
|
|
37
|
-
* totals rest on, and the reason no 'account' drift cause exists yet: promoting
|
|
38
|
-
* it to the contract before the assumption is checked would state it as fact.
|
|
39
|
-
* The honest reading of a 'none' beside a rising fresh-token count is "the client
|
|
40
|
-
* prefix held; look at which account served the turn".
|
|
41
|
-
*/
|
|
42
|
-
/**
|
|
43
|
-
* The part of a request that changed since that session's previous request.
|
|
44
|
-
*
|
|
45
|
-
* `'none'` means the prefix held, so a cold turn is not explained by anything the
|
|
46
|
-
* client sent IN THE SEGMENTS THIS MODULE FINGERPRINTS — it points at the service
|
|
47
|
-
* or at something the fingerprints cannot see (see the file header's known
|
|
48
|
-
* limitation: the serving account is one such thing). Every other value names the
|
|
49
|
-
* input that broke the prefix, which is the half of the diagnostic a bare hit
|
|
50
|
-
* ratio cannot supply.
|
|
51
|
-
*/
|
|
52
|
-
export type AntigravityPrefixDriftCause =
|
|
53
|
-
/** The prefix is unchanged. */
|
|
54
|
-
'none'
|
|
55
|
-
/** The conversation itself changed. */
|
|
56
|
-
| 'contents'
|
|
57
|
-
/** The system instruction changed. */
|
|
58
|
-
| 'systemInstruction'
|
|
59
|
-
/** The tool list changed. */
|
|
60
|
-
| 'tools'
|
|
61
|
-
/**
|
|
62
|
-
* The session identifier the request carries changed inside one session scope.
|
|
63
|
-
*
|
|
64
|
-
* It names the CLIENT-SIDE string, and deliberately promises nothing about the
|
|
65
|
-
* service's cache: whether that identifier partitions anything server-side is
|
|
66
|
-
* inferred, not measured. In practice this branch is close to unreachable — the
|
|
67
|
-
* scope key trims, so it takes two spellings of one session (a trailing space)
|
|
68
|
-
* to trigger it within a single conversation.
|
|
69
|
-
*/
|
|
70
|
-
| 'session-id'
|
|
71
|
-
/** Nothing to compare against: this scope's first request. */
|
|
72
|
-
| 'new-session';
|
|
73
|
-
/** One request's token counts, as the service reported them. */
|
|
74
|
-
export interface AntigravityUsageSample {
|
|
75
|
-
/** Prompt tokens served from the service's cache (`cachedContentTokenCount`). */
|
|
76
|
-
cachedTokens: number;
|
|
77
|
-
/** Prompt tokens it had to process (`promptTokenCount` minus the cached part). */
|
|
78
|
-
freshTokens: number;
|
|
79
|
-
}
|
|
80
|
-
/** Rolling cache totals for one scope. */
|
|
81
|
-
export interface AntigravityCacheStats {
|
|
82
|
-
/** Requests that reported usage. */
|
|
83
|
-
requests: number;
|
|
84
|
-
/** Prompt tokens served from cache across those requests. */
|
|
85
|
-
cachedTokens: number;
|
|
86
|
-
/** Prompt tokens processed afresh across those requests. */
|
|
87
|
-
freshTokens: number;
|
|
88
|
-
/** cachedTokens / (cachedTokens + freshTokens); null until a request reports usage. */
|
|
89
|
-
hitRatio: number | null;
|
|
90
|
-
}
|
|
91
|
-
/** The shape the settings route publishes, and the browser card renders. */
|
|
92
|
-
export interface AntigravityCacheStatsDto extends AntigravityCacheStats {
|
|
93
|
-
/**
|
|
94
|
-
* The most recent request that came back with nothing cached.
|
|
95
|
-
*
|
|
96
|
-
* Only misses are published. A prefix change on its own says nothing: a new
|
|
97
|
-
* user turn always changes `contents`, and that turn still hits the cache for
|
|
98
|
-
* everything before it. Publishing every change made the card read "contents
|
|
99
|
-
* changed" on every single turn — it named the one input that is SUPPOSED to
|
|
100
|
-
* change and hid the one that actually costs: an idle gap that outlived the
|
|
101
|
-
* service's cache.
|
|
102
|
-
*/
|
|
103
|
-
lastMiss?: AntigravityCacheMiss;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* One total miss, and the two facts that explain it.
|
|
107
|
-
*
|
|
108
|
-
* A miss here means the response reported zero cached tokens — the whole prefix
|
|
109
|
-
* was reprocessed. That is the event worth naming; a partial hit is the normal
|
|
110
|
-
* state of a growing conversation.
|
|
111
|
-
*/
|
|
112
|
-
export interface AntigravityCacheMiss {
|
|
113
|
-
/** The segment that changed since this session's previous request. */
|
|
114
|
-
cause: AntigravityPrefixDriftCause;
|
|
115
|
-
/**
|
|
116
|
-
* Milliseconds since this session's previous request, or undefined when this
|
|
117
|
-
* was the session's first. The service's cache expires on idle time it does
|
|
118
|
-
* not disclose, so this is the reading that separates "the conversation
|
|
119
|
-
* restarted" from "the cache timed out while the user was away".
|
|
120
|
-
*/
|
|
121
|
-
idleMs?: number;
|
|
122
|
-
/** When the miss was recorded. */
|
|
123
|
-
at: number;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Fingerprint the prefix of a request about to be sent, and attribute whatever
|
|
127
|
-
* changed since this session's previous request.
|
|
128
|
-
*
|
|
129
|
-
* Called once per turn, before the request goes out, so the answer describes the
|
|
130
|
-
* prefix the service will actually see. The reason is remembered for the session
|
|
131
|
-
* as well, so the route can publish the attribution beside the ratio it explains.
|
|
132
|
-
*
|
|
133
|
-
* @param body - The serialized request body, exactly as it will be sent.
|
|
134
|
-
* @param sessionId - Conversation the request belongs to, when it has one.
|
|
135
|
-
* @returns The change attributed to this request.
|
|
136
|
-
*/
|
|
137
|
-
export declare function recordCacheRequest(body: string, sessionId?: unknown): AntigravityPrefixDriftCause;
|
|
138
|
-
/**
|
|
139
|
-
* Add one request's reported counts to its session's totals.
|
|
140
|
-
*
|
|
141
|
-
* The scope carries the account as well as the session, because a pooled line
|
|
142
|
-
* can answer one conversation from several accounts and each of those keeps its
|
|
143
|
-
* own cache server-side: one account's cold misses must not be averaged into
|
|
144
|
-
* another's warm hits.
|
|
145
|
-
*
|
|
146
|
-
* @param sample - Token counts the response reported.
|
|
147
|
-
* @param sessionId - Conversation the request belonged to.
|
|
148
|
-
* @param accountId - Pooled account that served it, when the pool is in use.
|
|
149
|
-
*/
|
|
150
|
-
export declare function recordCacheUsage(sample: AntigravityUsageSample, sessionId?: unknown, accountId?: string): void;
|
|
151
|
-
/**
|
|
152
|
-
* Cache totals for one account's share of a session, one whole session, or every
|
|
153
|
-
* tracked session.
|
|
154
|
-
*
|
|
155
|
-
* A missing session is not an error: the settings card has no conversation in
|
|
156
|
-
* hand, and the process aggregate is the honest answer there.
|
|
157
|
-
*/
|
|
158
|
-
export declare function getCacheStats(sessionId?: string, accountId?: string): AntigravityCacheStatsDto;
|
|
159
|
-
/**
|
|
160
|
-
* Forget one session's numbers, or all of them.
|
|
161
|
-
*
|
|
162
|
-
* Session teardown and test seam: a conversation that ended must not leave its
|
|
163
|
-
* ratio behind to be read as another's.
|
|
164
|
-
*/
|
|
165
|
-
export declare function resetCacheStats(sessionId?: string): void;
|
|
166
|
-
//# sourceMappingURL=cache-stats.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache-stats.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity/cache-stats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH;;;;;;;;;GASG;AACH,MAAM,MAAM,2BAA2B;AACrC,+BAA+B;AAC7B,MAAM;AACR,uCAAuC;GACrC,UAAU;AACZ,sCAAsC;GACpC,mBAAmB;AACrB,6BAA6B;GAC3B,OAAO;AACT;;;;;;;;GAQG;GACD,YAAY;AACd,8DAA8D;GAC5D,aAAa,CAAA;AAEjB,gEAAgE;AAChE,MAAM,WAAW,sBAAsB;IACrC,iFAAiF;IACjF,YAAY,EAAE,MAAM,CAAA;IACpB,kFAAkF;IAClF,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,0CAA0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB,6DAA6D;IAC7D,YAAY,EAAE,MAAM,CAAA;IACpB,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAA;IACnB,uFAAuF;IACvF,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;AAED,4EAA4E;AAC5E,MAAM,WAAW,wBAAyB,SAAQ,qBAAqB;IACrE;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,oBAAoB,CAAA;CAChC;AAiBD;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,sEAAsE;IACtE,KAAK,EAAE,2BAA2B,CAAA;IAClC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAA;CACX;AA0ID;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,GAAG,2BAA2B,CAyBjG;AAOD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CA2B9G;AAmDD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,wBAAwB,CAS9F;AAUD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAcxD"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type AntigravityModelDef } from './types.ts';
|
|
2
|
-
import type { AntigravityCatalogModel } from './token-store.ts';
|
|
3
|
-
/** Every runtime id one selectable model can send, in routing order. */
|
|
4
|
-
export declare function runtimeIdsFor(modelId: string): string[];
|
|
5
|
-
export interface AntigravityModelLimits {
|
|
6
|
-
contextWindow: number;
|
|
7
|
-
maxTokens: number;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* The limits one selectable model advertises, preferring what
|
|
11
|
-
* `fetchAvailableModels` reported over the built-in table.
|
|
12
|
-
*
|
|
13
|
-
* One selectable model fans out to several runtime ids (one per effort), and
|
|
14
|
-
* the harness sizes a conversation once for all of them, so the smallest
|
|
15
|
-
* reported value wins: a conversation sized for the largest would overflow the
|
|
16
|
-
* moment the user drops to an effort whose runtime is smaller. A runtime the
|
|
17
|
-
* catalog is silent about leaves the built-in value in force, which is also all
|
|
18
|
-
* there is before the first catalog refresh.
|
|
19
|
-
*/
|
|
20
|
-
export declare function effectiveModelLimits(model: Pick<AntigravityModelDef, 'id' | 'contextWindow' | 'maxTokens'>, catalog: readonly AntigravityCatalogModel[] | undefined): AntigravityModelLimits;
|
|
21
|
-
/** The output ceiling the catalog reported for one runtime id, if it did. */
|
|
22
|
-
export declare function catalogMaxOutputFor(runtimeId: string, catalog: readonly AntigravityCatalogModel[] | undefined): number | undefined;
|
|
23
|
-
//# sourceMappingURL=catalog-limits.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog-limits.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity/catalog-limits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAS/D,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAIvD;AAED,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,eAAe,GAAG,WAAW,CAAC,EACtE,OAAO,EAAE,SAAS,uBAAuB,EAAE,GAAG,SAAS,GACtD,sBAAsB,CAcxB;AAED,6EAA6E;AAC7E,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,SAAS,uBAAuB,EAAE,GAAG,SAAS,GACtD,MAAM,GAAG,SAAS,CAGpB"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Hub release this process reports to Cloud Code.
|
|
3
|
-
*
|
|
4
|
-
* The service gates its model catalogue and its Gemini quota buckets on the
|
|
5
|
-
* client version in `User-Agent`, so a pinned constant silently ages into a
|
|
6
|
-
* worse client: the same account sees fewer models and fewer quota buckets than
|
|
7
|
-
* the official app on the same day. The Hub publishes the release it currently
|
|
8
|
-
* ships in its updater manifest, which is what this module reads.
|
|
9
|
-
*
|
|
10
|
-
* The read is deliberately non-blocking. `defaultUserAgent()` is synchronous
|
|
11
|
-
* and is called while a request is being built, so the process always has a
|
|
12
|
-
* usable version to report: the built-in one until a manifest has been read,
|
|
13
|
-
* the last known release after that. A manifest that cannot be read is not a
|
|
14
|
-
* failure -- the reference reimplementations treat it the same way, because a
|
|
15
|
-
* release that is one version old still serves requests.
|
|
16
|
-
*
|
|
17
|
-
* @see https://github.com/router-for-me/CLIProxyAPI — `internal/misc/antigravity_version.go`
|
|
18
|
-
*/
|
|
19
|
-
/** The Hub updater manifest for the arm64 macOS build. */
|
|
20
|
-
export declare const HUB_MANIFEST_URL = "https://antigravity-hub-auto-updater-974169037036.us-central1.run.app/manifest/latest-arm64-mac.yml";
|
|
21
|
-
/**
|
|
22
|
-
* Build changelists of known Hub releases: the `cl=` field of the User-Agent.
|
|
23
|
-
*
|
|
24
|
-
* A release with no entry here omits `cl=` instead of claiming another build's
|
|
25
|
-
* changelist, which is what the official app does for a build it does not know.
|
|
26
|
-
* `2.24.0` was read out of the official darwin-arm archive's build metadata; keep
|
|
27
|
-
* the newest entry and {@link DEFAULT_ANTIGRAVITY_VERSION} in step.
|
|
28
|
-
*/
|
|
29
|
-
export declare const HUB_RELEASE_CHANGELISTS: Readonly<Record<string, string>>;
|
|
30
|
-
/**
|
|
31
|
-
* The Hub release to report right now.
|
|
32
|
-
*
|
|
33
|
-
* `DSH_ANTIGRAVITY_VERSION` still wins: pinning a version is how a user works
|
|
34
|
-
* around a Hub release that misbehaves, and discovery must not override it.
|
|
35
|
-
*/
|
|
36
|
-
export declare function currentHubVersion(): string;
|
|
37
|
-
/**
|
|
38
|
-
* The changelist that belongs to a release, or undefined when it is unknown.
|
|
39
|
-
*
|
|
40
|
-
* `DSH_ANTIGRAVITY_CL` wins for the same reason the version pin does.
|
|
41
|
-
*/
|
|
42
|
-
export declare function hubChangelist(version?: string): string | undefined;
|
|
43
|
-
/** The release an electron-builder manifest declares, e.g. `version: 2.24.0`. */
|
|
44
|
-
export declare function parseHubManifestVersion(text: string): string | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Read the Hub release the updater manifest currently publishes.
|
|
47
|
-
*
|
|
48
|
-
* Single-flight and TTL-gated, so calling it on every request costs a `Date.now()`
|
|
49
|
-
* most of the time. Never throws: the caller is a request path, and a manifest
|
|
50
|
-
* that does not answer must not turn into a failed request.
|
|
51
|
-
*/
|
|
52
|
-
export declare function refreshHubVersion(fetchFn?: typeof fetch, now?: number): Promise<void>;
|
|
53
|
-
/** Drops the cached release. Tests only; production has one process-lifetime read. */
|
|
54
|
-
export declare function resetHubVersionCache(): void;
|
|
55
|
-
//# sourceMappingURL=client-version.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-version.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity/client-version.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,0DAA0D;AAC1D,eAAO,MAAM,gBAAgB,wGAC0E,CAAA;AAQvG;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKpE,CAAA;AAYD;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAG1C;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,MAA4B,GAAG,MAAM,GAAG,SAAS,CAGvF;AAED,iFAAiF;AACjF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGxE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,OAAO,KAAa,EAAE,GAAG,SAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBhG;AAED,sFAAsF;AACtF,wBAAgB,oBAAoB,IAAI,IAAI,CAI3C"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { FileCredentialStore, FileModelSettingsStore, type AntigravityCatalogModel } from './token-store.ts';
|
|
2
|
-
import type { AntigravityAccountQuota, AntigravityQuotaGroup } from '../../shared/antigravity-contracts.ts';
|
|
3
|
-
export declare const ANTIGRAVITY_QUOTA_CACHE_TTL_MS: number;
|
|
4
|
-
export declare function defaultUserAgent(): string;
|
|
5
|
-
export declare function legacyIdentityHeadersEnabled(): boolean;
|
|
6
|
-
export declare function antigravityHeaders(token: string): Record<string, string>;
|
|
7
|
-
export declare function jsonHeaders(token: string): Record<string, string>;
|
|
8
|
-
/**
|
|
9
|
-
* The identity the Hub presents on `onboardUser` control-plane calls.
|
|
10
|
-
*
|
|
11
|
-
* Onboarding is the one surface where the native client is visibly a Node API
|
|
12
|
-
* client: it appends `google-api-nodejs-client/<version>` to its User-Agent and
|
|
13
|
-
* states `X-Goog-Api-Client`. Content requests carry neither, which is why this
|
|
14
|
-
* is a separate builder rather than another field on {@link antigravityHeaders}.
|
|
15
|
-
*/
|
|
16
|
-
export declare function antigravityControlPlaneHeaders(token: string): Record<string, string>;
|
|
17
|
-
export declare function endpointCandidates(): string[];
|
|
18
|
-
export interface AntigravityTierInfo {
|
|
19
|
-
id?: string;
|
|
20
|
-
name?: string;
|
|
21
|
-
description?: string;
|
|
22
|
-
/** The tier the Hub itself onboards a new account into. */
|
|
23
|
-
isDefault?: boolean;
|
|
24
|
-
}
|
|
25
|
-
export interface AntigravityIneligibleTier {
|
|
26
|
-
tierId?: string;
|
|
27
|
-
reasonMessage?: string;
|
|
28
|
-
validationUrl?: string;
|
|
29
|
-
}
|
|
30
|
-
export interface LoadCodeAssistDetailResult {
|
|
31
|
-
currentTier?: AntigravityTierInfo | null;
|
|
32
|
-
paidTier?: AntigravityTierInfo | null;
|
|
33
|
-
allowedTiers?: AntigravityTierInfo[];
|
|
34
|
-
ineligibleTiers?: AntigravityIneligibleTier[];
|
|
35
|
-
projectId?: string;
|
|
36
|
-
raw?: Record<string, unknown>;
|
|
37
|
-
}
|
|
38
|
-
export declare function loadCodeAssistDetail(token: string, fetchFn?: typeof fetch, signal?: AbortSignal): Promise<LoadCodeAssistDetailResult | undefined>;
|
|
39
|
-
export declare function onboardUser(token: string, fetchFn?: typeof fetch, signal?: AbortSignal, tierId?: string): Promise<void>;
|
|
40
|
-
export declare function listCloudAICompanionProjects(token: string, fetchFn?: typeof fetch): Promise<string | undefined>;
|
|
41
|
-
export declare function loadCodeAssist(token: string, fetchFn?: typeof fetch): Promise<string | undefined>;
|
|
42
|
-
export declare function postJson(path: string, token: string, body: Record<string, unknown>, fetchFn?: typeof fetch): Promise<{
|
|
43
|
-
endpoint: string;
|
|
44
|
-
status: number;
|
|
45
|
-
data: unknown;
|
|
46
|
-
}>;
|
|
47
|
-
export declare function parseQuotaSummary(data: unknown): {
|
|
48
|
-
groups: AntigravityQuotaGroup[];
|
|
49
|
-
description?: string;
|
|
50
|
-
};
|
|
51
|
-
export declare function parseCatalogModels(data: unknown): AntigravityCatalogModel[];
|
|
52
|
-
/**
|
|
53
|
-
* Merge a freshly discovered API catalog into the stored model selection.
|
|
54
|
-
*
|
|
55
|
-
* The API catalog is a *request-level* listing: its ids are runtime names
|
|
56
|
-
* (`gemini-3.8-flash-tiered`, `claude-opus-4-6-thinking`, `gemini-3.1-pro-high`)
|
|
57
|
-
* that share no vocabulary with the selectable plugin ids (`gemini-3.8-flash`,
|
|
58
|
-
* `claude-opus-4-6`, `gemini-3.1-pro`). The picker and the adapter both iterate
|
|
59
|
-
* the plugin table, so pruning the selection against the API ids kept nothing:
|
|
60
|
-
* the first refresh after the shipped defaults were written dropped every
|
|
61
|
-
* stored id, which left the card rendering every model unchecked and made a
|
|
62
|
-
* deliberate pick look like it did not persist. Prune against the table the
|
|
63
|
-
* selection actually indexes, and keep the API catalog as display metadata
|
|
64
|
-
* only.
|
|
65
|
-
*
|
|
66
|
-
* @param stored - The selection currently persisted for the picker.
|
|
67
|
-
* @param storedCatalog - The API catalog the previous refresh recorded.
|
|
68
|
-
* @returns The selection to persist, drawn from the plugin model table.
|
|
69
|
-
*/
|
|
70
|
-
export declare function mergeCatalogSelection(stored: readonly string[], storedCatalog: readonly AntigravityCatalogModel[]): string[];
|
|
71
|
-
export declare function fetchAccountQuota(store?: FileCredentialStore, modelSettings?: FileModelSettingsStore, fetchFn?: typeof fetch, force?: boolean): Promise<AntigravityAccountQuota>;
|
|
72
|
-
export declare function getCachedQuota(): AntigravityAccountQuota | undefined;
|
|
73
|
-
export declare function clearCachedQuota(): void;
|
|
74
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity/client.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAA;AAGzB,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,uCAAuC,CAAA;AAG9C,eAAO,MAAM,8BAA8B,QAAgB,CAAA;AAQ3D,wBAAgB,gBAAgB,IAAI,MAAM,CASzC;AAwBD,wBAAgB,4BAA4B,IAAI,OAAO,CAGtD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQxE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKjE;AAED;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,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KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,OAAO,KAAa,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAmB9G;AAED,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,GAAE,OAAO,KAAa,GAC5B,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CAoB9D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG;IAChD,MAAM,EAAE,qBAAqB,EAAE,CAAA;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CA6CA;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,uBAAuB,EAAE,CA0B3E;AAaD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,aAAa,EAAE,SAAS,uBAAuB,EAAE,GAChD,MAAM,EAAE,CAOV;AAED,wBAAsB,iBAAiB,CACrC,KAAK,sBAA4B,EACjC,aAAa,CAAC,EAAE,sBAAsB,EACtC,OAAO,GAAE,OAAO,KAAa,EAC7B,KAAK,UAAQ,GACZ,OAAO,CAAC,uBAAuB,CAAC,CA2ElC;AAED,wBAAgB,cAAc,IAAI,uBAAuB,GAAG,SAAS,CAEpE;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAIvC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { AttachmentStore, ImageMediaType } from '@deepseek-ai/dsh-attachment';
|
|
2
|
-
import { AccountPoolStore } from './account-pool.ts';
|
|
3
|
-
import { FileCredentialStore } from './token-store.ts';
|
|
4
|
-
type FetchLike = typeof fetch;
|
|
5
|
-
/**
|
|
6
|
-
* Aspect ratios Gemini image models accept in `imageConfig.aspectRatio`.
|
|
7
|
-
* Omitted, the model picks one itself, which is what the request then does.
|
|
8
|
-
*
|
|
9
|
-
* The last four are the extreme strips: a wider or taller frame than the square
|
|
10
|
-
* family covers, useful for banners, headers and phone wallpapers.
|
|
11
|
-
*/
|
|
12
|
-
export declare const ANTIGRAVITY_IMAGE_ASPECT_RATIOS: readonly ["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9", "1:4", "4:1", "1:8", "8:1"];
|
|
13
|
-
/**
|
|
14
|
-
* Image sizes Gemini image models accept in `imageConfig.imageSize`.
|
|
15
|
-
* Omitted, the model picks one itself, which is what the request then does.
|
|
16
|
-
*/
|
|
17
|
-
export declare const ANTIGRAVITY_IMAGE_SIZES: readonly ["0.5K", "1K", "2K", "4K"];
|
|
18
|
-
export interface AntigravityImageToolOptions {
|
|
19
|
-
fetchFn?: FetchLike;
|
|
20
|
-
/** Whether the Antigravity line is switched on; a switched-off line serves no images. */
|
|
21
|
-
isEnabled?: () => boolean;
|
|
22
|
-
}
|
|
23
|
-
/** One image part the model returned, still base64. */
|
|
24
|
-
export interface InlineImage {
|
|
25
|
-
mimeType: string;
|
|
26
|
-
data: string;
|
|
27
|
-
}
|
|
28
|
-
/** What one image response carried, gathered across every SSE frame. */
|
|
29
|
-
export interface ImageResponse {
|
|
30
|
-
images: InlineImage[];
|
|
31
|
-
text: string;
|
|
32
|
-
finishReason?: string;
|
|
33
|
-
finishMessage?: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* The `v1internal` envelope for one image generation.
|
|
37
|
-
*
|
|
38
|
-
* Deliberately bare next to the chat request: no system instruction, no tools
|
|
39
|
-
* and no thinking config. An image runtime has nothing to do with the coding
|
|
40
|
-
* agent persona or tool declarations, and `responseModalities` is what asks it
|
|
41
|
-
* for pixels at all. `requestType: 'image_gen'` follows what community
|
|
42
|
-
* Antigravity clients send for image runtimes; it has not been captured from
|
|
43
|
-
* the official client.
|
|
44
|
-
*/
|
|
45
|
-
export declare function buildImageRequest(prompt: string, projectId: string, aspectRatio?: string, imageSize?: string): Record<string, unknown>;
|
|
46
|
-
/**
|
|
47
|
-
* Collect the images and visible text of one SSE image response.
|
|
48
|
-
*
|
|
49
|
-
* Parts marked `thought: true` are skipped, images included: an image model can
|
|
50
|
-
* stream interim drafts as thoughts, and only the final picture is the answer.
|
|
51
|
-
*
|
|
52
|
-
* @throws HarnessError when a frame carries an upstream error.
|
|
53
|
-
*/
|
|
54
|
-
export declare function parseImageResponse(body: string): ImageResponse;
|
|
55
|
-
/**
|
|
56
|
-
* Decode one returned image after checking it is the type it claims and fits
|
|
57
|
-
* the attachment limits. A claim the bytes contradict is refused rather than
|
|
58
|
-
* stored under the wrong type.
|
|
59
|
-
*/
|
|
60
|
-
export declare function decodeInlineImage(image: InlineImage, attachments: Pick<AttachmentStore, 'imageLimits'>): {
|
|
61
|
-
mediaType: ImageMediaType;
|
|
62
|
-
data: Uint8Array;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Generate an image through the signed-in Antigravity account pool.
|
|
66
|
-
*
|
|
67
|
-
* Shares the chat route's account rotation: the call draws on the Gemini
|
|
68
|
-
* allowance, so an account whose Gemini allowance is cooling down is skipped and
|
|
69
|
-
* a 429 cools that allowance alone (see AccountPoolStore.markFamilyCooldown).
|
|
70
|
-
*/
|
|
71
|
-
export declare function createAntigravityImageTool(accountPool: AccountPoolStore, store: FileCredentialStore, attachments: AttachmentStore, options?: AntigravityImageToolOptions): import("@deepseek-ai/dsh-tools").ToolDefinition;
|
|
72
|
-
export {};
|
|
73
|
-
//# sourceMappingURL=image-tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-tool.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity/image-tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAsB,cAAc,EAAE,MAAM,6BAA6B,CA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B,EAC7B,KAAK,EAAE,mBAAmB,EAC1B,WAAW,EAAE,eAAe,EAC5B,OAAO,GAAE,2BAAgC,mDA+H1C"}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { type OutboundContentBlock, type GenerateOptions, type StreamChunk } from '../common/llm-compat.ts';
|
|
2
|
-
import type { AttachmentStore, ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
|
|
3
|
-
import { type AntigravityModelDef } from './types.ts';
|
|
4
|
-
import { type AntigravityToolSchemaOptions } from './tool-schema.ts';
|
|
5
|
-
export declare function sanitizeToolCallId(id: string, fallbackName: string): string;
|
|
6
|
-
/**
|
|
7
|
-
* Attachment seam this route needs: verified bytes for one durable image, and a
|
|
8
|
-
* downscaled request version of one that is larger than the wire wants.
|
|
9
|
-
*
|
|
10
|
-
* Every harness generation in the peer range declares readImageRequest; a
|
|
11
|
-
* backend that cannot derive request versions rejects the call, and that
|
|
12
|
-
* rejection is handled like any other unreadable image. Matching the Claude
|
|
13
|
-
* route's declaration keeps the two scaled routes on one contract.
|
|
14
|
-
*/
|
|
15
|
-
export type AttachmentImageReader = Pick<AttachmentStore, 'readImage' | 'readImageRequest'>;
|
|
16
|
-
/** One durable user image resolved for an in-flight request, or proven unreadable. */
|
|
17
|
-
export type ResolvedRequestImage = {
|
|
18
|
-
readonly kind: 'inline';
|
|
19
|
-
readonly mediaType: string;
|
|
20
|
-
readonly data: string;
|
|
21
|
-
} | {
|
|
22
|
-
readonly kind: 'unavailable';
|
|
23
|
-
};
|
|
24
|
-
/** Resolved images keyed by durable attachment id; consumed by one request build. */
|
|
25
|
-
export type ResolvedRequestImages = ReadonlyMap<string, ResolvedRequestImage>;
|
|
26
|
-
/**
|
|
27
|
-
* Base64 image payload one Antigravity request may carry. Google caps a request
|
|
28
|
-
* carrying inline data at 20 MB, and the same body also holds the system
|
|
29
|
-
* instruction, the conversation text, and the tool declarations.
|
|
30
|
-
*/
|
|
31
|
-
export declare const MAX_REQUEST_IMAGE_BYTES: number;
|
|
32
|
-
/**
|
|
33
|
-
* Longest edge, in pixels, one image of this request may keep.
|
|
34
|
-
*
|
|
35
|
-
* CHOICE: 1024 px matches the long edge the other scaled routes send, and it is
|
|
36
|
-
* what makes the scaling in {@link resolveRequestImages} effective rather than
|
|
37
|
-
* nominal: the target is computed from the stored image's own dimensions, so the
|
|
38
|
-
* same image yields the same request bytes in every later turn and the prefix
|
|
39
|
-
* Google's implicit cache matches stays byte-stable.
|
|
40
|
-
*
|
|
41
|
-
* The budget stays Antigravity's own 12 MB. The 1.5 MB in
|
|
42
|
-
* host/common/request-images.ts is Kimi's, and that file warns in the same
|
|
43
|
-
* breath that importing one route's number into another refuses the other
|
|
44
|
-
* route's own legal images; Google accepts a request of up to 20 MB.
|
|
45
|
-
*/
|
|
46
|
-
export declare const REQUEST_IMAGE_MAX_EDGE = 1024;
|
|
47
|
-
/**
|
|
48
|
-
* Request-version target for one stored image whose long edge is over the
|
|
49
|
-
* ceiling, or undefined when it already fits and is sent as stored.
|
|
50
|
-
*
|
|
51
|
-
* A reference without usable dimensions is sent as stored: there is no basis for
|
|
52
|
-
* choosing a target; the shared request-image budget still applies after the
|
|
53
|
-
* attachment service has resolved the bytes that will actually be sent.
|
|
54
|
-
*/
|
|
55
|
-
export declare function requestImageTarget(ref: ImageAttachmentRef, edge?: number): {
|
|
56
|
-
width: number;
|
|
57
|
-
height: number;
|
|
58
|
-
maxPixels: number;
|
|
59
|
-
maxBytes: number;
|
|
60
|
-
} | undefined;
|
|
61
|
-
/**
|
|
62
|
-
* Read every durable `{ type: 'image', attachment }` block one request carries.
|
|
63
|
-
*
|
|
64
|
-
* This provider declares image input, so DSH hands those blocks to the adapter
|
|
65
|
-
* unchanged instead of projecting them to text, and Gemini can only receive them
|
|
66
|
-
* as `inlineData` bytes. An image that cannot be read resolves to
|
|
67
|
-
* `unavailable` rather than disappearing: `contentToUserParts` then leaves the
|
|
68
|
-
* model a text marker, because a turn that silently loses its image is far
|
|
69
|
-
* harder to diagnose than one that says so.
|
|
70
|
-
*
|
|
71
|
-
* WHY SCALE INSTEAD OF DROP. The shared request-image offload pass has to
|
|
72
|
-
* replace an image with placeholder text once the request exceeds
|
|
73
|
-
* {@link MAX_REQUEST_IMAGE_BYTES}, and the count it replaces grows with every
|
|
74
|
-
* image added afterwards. Each change rewrites the retained prefix, so Google's
|
|
75
|
-
* implicit cache misses again on the very next turn. An image whose long edge is
|
|
76
|
-
* over {@link REQUEST_IMAGE_MAX_EDGE} is therefore sent as the harness's
|
|
77
|
-
* downscaled request version, which keeps the image COUNT steady and with it the
|
|
78
|
-
* prefix. The stored image and durable history do not change, and an image that
|
|
79
|
-
* already fits is sent byte-for-byte as stored. The drop path stays as the last
|
|
80
|
-
* resort for a request that is over budget even after scaling.
|
|
81
|
-
*
|
|
82
|
-
* @param options - the exact request about to be built.
|
|
83
|
-
* @param attachments - durable attachment store; absent when the host wired none.
|
|
84
|
-
* @param signal - cancellation, forwarded to every attachment read.
|
|
85
|
-
* @returns one resolution per distinct attachment id, empty when there is no image.
|
|
86
|
-
*/
|
|
87
|
-
export declare function resolveRequestImages(options: GenerateOptions, attachments: AttachmentImageReader | undefined, signal?: AbortSignal): Promise<ResolvedRequestImages>;
|
|
88
|
-
/**
|
|
89
|
-
* Collapse each run of adjacent pure-text parts into a single part.
|
|
90
|
-
*
|
|
91
|
-
* SSE transport chunks are not semantic content blocks. One answer arrives as
|
|
92
|
-
* hundreds of text deltas, and replaying each delta as its own part adds one
|
|
93
|
-
* part per delta to the request prefix on every later turn of the conversation.
|
|
94
|
-
* Antigravity relies on Google's implicit cache, which matches a byte-stable
|
|
95
|
-
* prefix: the moment the prefix gains a part the previous request did not have,
|
|
96
|
-
* everything after it misses. The Claude route lost 68.84% cache hits to exactly
|
|
97
|
-
* that growth before its deltas were merged; the Gemini route sends the same
|
|
98
|
-
* deltas and needs the same treatment.
|
|
99
|
-
*
|
|
100
|
-
* Merging is restricted to pure text, so signed, opaque, thinking, and tool
|
|
101
|
-
* parts keep their boundaries exactly where the model produced them.
|
|
102
|
-
*
|
|
103
|
-
* @param parts - replay parts in model order; the input is never mutated.
|
|
104
|
-
* @returns parts with every adjacent pure-text run merged into its first member.
|
|
105
|
-
*/
|
|
106
|
-
export declare function mergeAdjacentTextParts(parts: ReadonlyArray<Record<string, unknown>>): Array<Record<string, unknown>>;
|
|
107
|
-
export declare function convertMessages(options: GenerateOptions, model: AntigravityModelDef, runtimeModel: string, images?: ResolvedRequestImages): Array<{
|
|
108
|
-
role: string;
|
|
109
|
-
parts: Array<Record<string, unknown>>;
|
|
110
|
-
}>;
|
|
111
|
-
export declare function stripMetaSchema(schema: unknown, options?: AntigravityToolSchemaOptions): unknown;
|
|
112
|
-
export declare function convertTools(tools: GenerateOptions['tools'], modelId?: string, runtimeModel?: string): Array<Record<string, unknown>> | undefined;
|
|
113
|
-
export declare function mapToolChoiceMode(toolChoice: unknown): string;
|
|
114
|
-
export declare function getMaxOutputTokens(modelId: string, runtimeModel: string): number;
|
|
115
|
-
/**
|
|
116
|
-
* `thinkingBudget` for one Gemini 2.5 runtime at one effort, inside the range
|
|
117
|
-
* that runtime accepts.
|
|
118
|
-
*
|
|
119
|
-
* The ranges are the published Gemini API ones: 2.5 Pro takes 128-32768 and
|
|
120
|
-
* cannot turn thinking off, 2.5 Flash and Flash-Lite take 0-24576. One table of
|
|
121
|
-
* 4096 / 16384 / 32768 for every 2.5 model asked Flash for more than its
|
|
122
|
-
* ceiling at `high`, and asked Pro for an impossible 0 when thinking was off.
|
|
123
|
-
* Off on Pro is therefore its floor, with the thought summary suppressed by the
|
|
124
|
-
* caller's `includeThoughts: false`.
|
|
125
|
-
*/
|
|
126
|
-
export declare function gemini25ThinkingBudget(runtimeModel: string, effort: string): number;
|
|
127
|
-
/** Wire-level choices the adapter makes per request, outside the caller's options. */
|
|
128
|
-
export interface BuildRequestWireOptions {
|
|
129
|
-
/**
|
|
130
|
-
* Send `functionCallingConfig.mode: VALIDATED` for Claude runtimes that carry
|
|
131
|
-
* tools and no explicit tool choice. Default on; the adapter turns it off for
|
|
132
|
-
* the rest of the process once the service rejects the mode.
|
|
133
|
-
*/
|
|
134
|
-
claudeValidatedToolCalling?: boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Output ceiling `fetchAvailableModels` reported for this runtime. When
|
|
137
|
-
* known it replaces the built-in RUNTIME_MAX_OUTPUT_TOKENS entry, which is
|
|
138
|
-
* only a guess kept for when the catalog is missing or silent.
|
|
139
|
-
*/
|
|
140
|
-
maxOutputTokens?: number;
|
|
141
|
-
}
|
|
142
|
-
export declare function buildRequest(options: GenerateOptions, model: AntigravityModelDef, projectId: string, runtimeModel: string, effort?: string, images?: ResolvedRequestImages, wire?: BuildRequestWireOptions): Record<string, unknown>;
|
|
143
|
-
export interface StreamState {
|
|
144
|
-
blocks: OutboundContentBlock[];
|
|
145
|
-
replayBlocks: Array<{
|
|
146
|
-
parts: Array<Record<string, unknown>>;
|
|
147
|
-
}>;
|
|
148
|
-
currentBlock: {
|
|
149
|
-
index: number;
|
|
150
|
-
type: 'text' | 'reasoning';
|
|
151
|
-
text: string;
|
|
152
|
-
} | null;
|
|
153
|
-
hasContent: boolean;
|
|
154
|
-
hasToolCall: boolean;
|
|
155
|
-
usageMetadata: Record<string, number> | null;
|
|
156
|
-
finishReason?: string;
|
|
157
|
-
/** Gemini's own explanation beside a non-STOP finish, when it sent one. */
|
|
158
|
-
finishMessage?: string;
|
|
159
|
-
done: boolean;
|
|
160
|
-
finished: boolean;
|
|
161
|
-
}
|
|
162
|
-
export declare function createStreamState(): StreamState;
|
|
163
|
-
export declare function processStreamLine(line: string, state: StreamState): StreamChunk[];
|
|
164
|
-
export declare function closeStream(state: StreamState): StreamChunk[];
|
|
165
|
-
//# sourceMappingURL=mapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mapper.d.ts","sourceRoot":"","sources":["../../../../src/host/antigravity/mapper.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KA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