@cortexkit/opencode-antigravity-auth 3.0.29 → 3.0.31
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/dist/cli.js +783 -254
- package/dist/cli.js.map +4 -4
- package/dist/cli.meta.json +145 -77
- package/dist/index.js +842 -297
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +177 -85
- package/dist/server.js +842 -300
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/cli.d.ts +1 -0
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +22 -2
- package/dist/src/cli.js.map +1 -1
- package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +12 -0
- package/dist/src/common-auth-embedded/claustrum/consumer.js +36 -0
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +16 -4
- package/dist/src/common-auth-embedded/claustrum/custody.js +74 -9
- package/dist/src/common-auth-embedded/claustrum/hub.d.ts +3 -2
- package/dist/src/common-auth-embedded/claustrum/hub.js +8 -0
- package/dist/src/common-auth-embedded/claustrum/index.d.ts +1 -0
- package/dist/src/common-auth-embedded/claustrum/roster.d.ts +4 -0
- package/dist/src/common-auth-embedded/claustrum/roster.js +34 -8
- package/dist/src/common-auth-embedded/claustrum/usage.d.ts +41 -0
- package/dist/src/common-auth-embedded/claustrum/usage.js +145 -0
- package/dist/src/common-auth-embedded/commands/builtins.d.ts +5 -0
- package/dist/src/common-auth-embedded/commands/builtins.js +38 -0
- package/dist/src/common-auth-embedded/fs/file-read-cache.js +10 -5
- package/dist/src/common-auth-embedded/fs/private-files.d.ts +5 -0
- package/dist/src/common-auth-embedded/fs/private-files.js +7 -0
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +142 -47
- package/dist/src/common-auth-embedded/fs/with-lock.js +2 -5
- package/dist/src/common-auth-embedded/limits/activity.d.ts +26 -0
- package/dist/src/common-auth-embedded/limits/axes.d.ts +69 -0
- package/dist/src/common-auth-embedded/limits/decide.d.ts +146 -0
- package/dist/src/common-auth-embedded/limits/duration.d.ts +8 -0
- package/dist/src/common-auth-embedded/limits/families.d.ts +59 -0
- package/dist/src/common-auth-embedded/limits/marker.d.ts +69 -0
- package/dist/src/common-auth-embedded/limits/request-history.d.ts +79 -0
- package/dist/src/common-auth-embedded/limits/scope.d.ts +12 -0
- package/dist/src/common-auth-embedded/limits/signal.d.ts +41 -0
- package/dist/src/common-auth-embedded/limits/terminal.d.ts +52 -0
- package/dist/src/common-auth-embedded/limits/wake.d.ts +21 -0
- package/dist/src/common-auth-embedded/limits/wording.d.ts +25 -0
- package/dist/src/common-auth-embedded/opencode2/index.d.ts +1 -1
- package/dist/src/common-auth-embedded/opencode2/install.d.ts +4 -3
- package/dist/src/common-auth-embedded/opencode2/install.js +219 -27
- package/dist/src/common-auth-embedded/opencode2/types.d.ts +113 -11
- package/dist/src/common-auth-embedded/routing/admission.d.ts +7 -2
- package/dist/src/common-auth-embedded/routing/admission.js +17 -7
- package/dist/src/common-auth-embedded/routing-accessor/handle.js +10 -0
- package/dist/src/common-auth-embedded/routing-accessor/index.d.ts +13 -3
- package/dist/src/common-auth-embedded/routing-accessor/index.js +11 -10
- package/dist/src/common-auth-embedded/rpc/port-file.d.ts +12 -3
- package/dist/src/common-auth-embedded/rpc/port-file.js +46 -4
- package/dist/src/common-auth-embedded/setup/enroll.js +7 -1
- package/dist/src/common-auth-embedded/source-output.json +260 -124
- package/dist/src/common-auth-embedded/store/attribution.js +3 -2
- package/dist/src/common-auth-embedded/store/errors.d.ts +1 -1
- package/dist/src/common-auth-embedded/store/hooks.d.ts +5 -1
- package/dist/src/common-auth-embedded/store/hooks.js +20 -5
- package/dist/src/common-auth-embedded/store/index.d.ts +1 -0
- package/dist/src/common-auth-embedded/store/limits-namespace.d.ts +13 -0
- package/dist/src/common-auth-embedded/store/limits-namespace.js +46 -0
- package/dist/src/common-auth-embedded/store/pool.d.ts +10 -1
- package/dist/src/common-auth-embedded/store/pool.js +2 -0
- package/dist/src/common-auth-embedded/store/provider-state.js +5 -5
- package/dist/src/common-auth-embedded/store/refresh.js +1 -1
- package/dist/src/common-auth-embedded/store/schema.js +9 -4
- package/dist/src/common-auth-embedded/store/settings.d.ts +2 -0
- package/dist/src/common-auth-embedded/store/settings.js +11 -4
- package/dist/src/plugin/__fixtures__/release-model-ids.d.ts.map +1 -1
- package/dist/src/plugin/__fixtures__/release-model-ids.js +0 -1
- package/dist/src/plugin/__fixtures__/release-model-ids.js.map +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
- package/dist/src/plugin/account-access.js +1 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +3 -2
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/shared/request-services.d.ts +1 -1
- package/dist/src/plugin/shared/request-services.js +1 -1
- package/dist/src/runtime-layout.d.ts +9 -2
- package/dist/src/runtime-layout.d.ts.map +1 -1
- package/dist/src/runtime-layout.js +8 -8
- package/dist/src/runtime-layout.js.map +1 -1
- package/dist/src/setup.d.ts.map +1 -1
- package/dist/src/setup.js +29 -40
- package/dist/src/setup.js.map +1 -1
- package/dist/tui-build-map.json +9 -9
- package/dist/tui-ga-build-map.json +1 -1
- package/dist/types/src/cli.d.ts +1 -0
- package/dist/types/src/cli.d.ts.map +1 -1
- package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +12 -0
- package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +16 -4
- package/dist/types/src/common-auth-embedded/claustrum/hub.d.ts +3 -2
- package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +1 -0
- package/dist/types/src/common-auth-embedded/claustrum/roster.d.ts +4 -0
- package/dist/types/src/common-auth-embedded/claustrum/usage.d.ts +41 -0
- package/dist/types/src/common-auth-embedded/commands/builtins.d.ts +5 -0
- package/dist/types/src/common-auth-embedded/limits/activity.d.ts +26 -0
- package/dist/types/src/common-auth-embedded/limits/axes.d.ts +69 -0
- package/dist/types/src/common-auth-embedded/limits/decide.d.ts +146 -0
- package/dist/types/src/common-auth-embedded/limits/duration.d.ts +8 -0
- package/dist/types/src/common-auth-embedded/limits/families.d.ts +59 -0
- package/dist/types/src/common-auth-embedded/limits/marker.d.ts +69 -0
- package/dist/types/src/common-auth-embedded/limits/request-history.d.ts +79 -0
- package/dist/types/src/common-auth-embedded/limits/scope.d.ts +12 -0
- package/dist/types/src/common-auth-embedded/limits/signal.d.ts +41 -0
- package/dist/types/src/common-auth-embedded/limits/terminal.d.ts +52 -0
- package/dist/types/src/common-auth-embedded/limits/wake.d.ts +21 -0
- package/dist/types/src/common-auth-embedded/limits/wording.d.ts +25 -0
- package/dist/types/src/common-auth-embedded/opencode2/index.d.ts +1 -1
- package/dist/types/src/common-auth-embedded/opencode2/install.d.ts +4 -3
- package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +113 -11
- package/dist/types/src/common-auth-embedded/routing/admission.d.ts +7 -2
- package/dist/types/src/common-auth-embedded/routing-accessor/index.d.ts +13 -3
- package/dist/types/src/common-auth-embedded/store/errors.d.ts +1 -1
- package/dist/types/src/common-auth-embedded/store/hooks.d.ts +5 -1
- package/dist/types/src/common-auth-embedded/store/index.d.ts +1 -0
- package/dist/types/src/common-auth-embedded/store/limits-namespace.d.ts +13 -0
- package/dist/types/src/common-auth-embedded/store/pool.d.ts +10 -1
- package/dist/types/src/common-auth-embedded/store/settings.d.ts +2 -0
- package/dist/types/src/plugin/request.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/request-services.d.ts +1 -1
- package/dist/types/src/runtime-layout.d.ts +9 -2
- package/dist/types/src/runtime-layout.d.ts.map +1 -1
- package/dist/types/src/setup.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/common-auth-embedded/claustrum/consumer.d.ts +12 -0
- package/src/common-auth-embedded/claustrum/consumer.js +36 -0
- package/src/common-auth-embedded/claustrum/custody.d.ts +16 -4
- package/src/common-auth-embedded/claustrum/custody.js +74 -9
- package/src/common-auth-embedded/claustrum/hub.d.ts +3 -2
- package/src/common-auth-embedded/claustrum/hub.js +8 -0
- package/src/common-auth-embedded/claustrum/index.d.ts +1 -0
- package/src/common-auth-embedded/claustrum/roster.d.ts +4 -0
- package/src/common-auth-embedded/claustrum/roster.js +34 -8
- package/src/common-auth-embedded/claustrum/usage.d.ts +41 -0
- package/src/common-auth-embedded/claustrum/usage.js +145 -0
- package/src/common-auth-embedded/commands/builtins.d.ts +5 -0
- package/src/common-auth-embedded/commands/builtins.js +38 -0
- package/src/common-auth-embedded/fs/file-read-cache.js +10 -5
- package/src/common-auth-embedded/fs/private-files.d.ts +5 -0
- package/src/common-auth-embedded/fs/private-files.js +7 -0
- package/src/common-auth-embedded/fs/refresh-file-lock.js +142 -47
- package/src/common-auth-embedded/fs/with-lock.js +2 -5
- package/src/common-auth-embedded/limits/activity.d.ts +26 -0
- package/src/common-auth-embedded/limits/axes.d.ts +69 -0
- package/src/common-auth-embedded/limits/decide.d.ts +146 -0
- package/src/common-auth-embedded/limits/duration.d.ts +8 -0
- package/src/common-auth-embedded/limits/families.d.ts +59 -0
- package/src/common-auth-embedded/limits/marker.d.ts +69 -0
- package/src/common-auth-embedded/limits/request-history.d.ts +79 -0
- package/src/common-auth-embedded/limits/scope.d.ts +12 -0
- package/src/common-auth-embedded/limits/signal.d.ts +41 -0
- package/src/common-auth-embedded/limits/terminal.d.ts +52 -0
- package/src/common-auth-embedded/limits/wake.d.ts +21 -0
- package/src/common-auth-embedded/limits/wording.d.ts +25 -0
- package/src/common-auth-embedded/opencode2/index.d.ts +1 -1
- package/src/common-auth-embedded/opencode2/install.d.ts +4 -3
- package/src/common-auth-embedded/opencode2/install.js +219 -27
- package/src/common-auth-embedded/opencode2/types.d.ts +113 -11
- package/src/common-auth-embedded/routing/admission.d.ts +7 -2
- package/src/common-auth-embedded/routing/admission.js +17 -7
- package/src/common-auth-embedded/routing-accessor/handle.js +10 -0
- package/src/common-auth-embedded/routing-accessor/index.d.ts +13 -3
- package/src/common-auth-embedded/routing-accessor/index.js +11 -10
- package/src/common-auth-embedded/rpc/port-file.d.ts +12 -3
- package/src/common-auth-embedded/rpc/port-file.js +46 -4
- package/src/common-auth-embedded/setup/enroll.js +7 -1
- package/src/common-auth-embedded/source-output.json +260 -124
- package/src/common-auth-embedded/store/attribution.js +3 -2
- package/src/common-auth-embedded/store/errors.d.ts +1 -1
- package/src/common-auth-embedded/store/hooks.d.ts +5 -1
- package/src/common-auth-embedded/store/hooks.js +20 -5
- package/src/common-auth-embedded/store/index.d.ts +1 -0
- package/src/common-auth-embedded/store/limits-namespace.d.ts +13 -0
- package/src/common-auth-embedded/store/limits-namespace.js +46 -0
- package/src/common-auth-embedded/store/pool.d.ts +10 -1
- package/src/common-auth-embedded/store/pool.js +2 -0
- package/src/common-auth-embedded/store/provider-state.js +5 -5
- package/src/common-auth-embedded/store/refresh.js +1 -1
- package/src/common-auth-embedded/store/schema.js +9 -4
- package/src/common-auth-embedded/store/settings.d.ts +2 -0
- package/src/common-auth-embedded/store/settings.js +11 -4
- package/src/tui-compiled/common-auth-embedded/fs/private-files.js +7 -0
- package/src/tui-compiled/common-auth-embedded/rpc/port-file.js +46 -4
- package/src/tui-raw/common-auth-embedded/fs/private-files.js +7 -0
- package/src/tui-raw/common-auth-embedded/rpc/port-file.js +46 -4
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ResetFormatter } from './duration.js';
|
|
2
|
+
export declare function hasUnsafeWording(text: string): boolean;
|
|
3
|
+
export interface MessageParameters {
|
|
4
|
+
readonly labels: readonly string[];
|
|
5
|
+
readonly retryIn?: string;
|
|
6
|
+
readonly reset?: string;
|
|
7
|
+
}
|
|
8
|
+
/** Templates return text only; they cannot replace a family's wire envelope. */
|
|
9
|
+
export type MessageTemplate = (parameters: MessageParameters) => string;
|
|
10
|
+
export declare class UnsafeWordingError extends Error {
|
|
11
|
+
readonly messageKey: string;
|
|
12
|
+
readonly code = "unsafe-wording";
|
|
13
|
+
constructor(messageKey: string);
|
|
14
|
+
}
|
|
15
|
+
export interface LimitMessageOptions {
|
|
16
|
+
readonly refusals?: Readonly<Record<string, MessageTemplate>>;
|
|
17
|
+
readonly retryable?: Readonly<Record<string, MessageTemplate>>;
|
|
18
|
+
readonly formatReset?: ResetFormatter;
|
|
19
|
+
}
|
|
20
|
+
export interface LimitMessages {
|
|
21
|
+
readonly formatReset?: ResetFormatter;
|
|
22
|
+
readonly render: (messageKey: string, parameters: MessageParameters, nonRetryable: boolean) => string | undefined;
|
|
23
|
+
}
|
|
24
|
+
/** Registration rejects unsafe fixed text; actual substitutions are checked again. */
|
|
25
|
+
export declare function registerLimitMessages(options: LimitMessageOptions): LimitMessages;
|
|
@@ -5,4 +5,4 @@ export type { FormAnswer, LoginContext, PoolAuthorization, PoolLoginMethod, Regi
|
|
|
5
5
|
export { isPlaceholderCredential, PLACEHOLDER_LIFETIME_MS, PLACEHOLDER_METADATA_KEY, PLACEHOLDER_PREFIX, placeholderCredential, placeholderSecret, registerOpenCode2AuthMethods, VAULT_ACTIVATION_INSTRUCTIONS, } from './integration.js';
|
|
6
6
|
export type { ServerSentEvent } from './sse.js';
|
|
7
7
|
export { watchServerSentEvents } from './sse.js';
|
|
8
|
-
export type { AccountHeadersResult, AccountRequest, Attempt, AttemptEndReason, AttemptOutcome, ChooseAccountInput, ChooseAccountResult, EventVerdict, HeaderEdits, HostError, InstallOpenCode2AuthOptions, LimitSignal, OpenCode2AuthAdapter, OpenCode2AuthEventName, OpenCode2AuthEvents, OpenCode2AuthInstallation, OpenCode2AuthLogger, OpenCode2HookContext, RequestKind, RequestScope, ResponseAccount, RetryHold, RetryReason, SameAccountRetryInput, SameAccountRetryResult, SelectingHook, Transport, } from './types.js';
|
|
8
|
+
export type { AccountHeadersResult, AccountRequest, Attempt, AttemptEndReason, AttemptOutcome, ChooseAccountInput, ChooseAccountResult, EventVerdict, HeaderEdits, HostError, InstallOpenCode2AuthOptions, LimitSignal, OpenCode2AuthAdapter, OpenCode2AuthEventName, OpenCode2AuthEvents, OpenCode2AuthInstallation, OpenCode2AuthLogger, OpenCode2HookContext, RequestKind, RequestScope, ResponseAccount, RetryDisposition, RetryHold, RetryReason, RetryWaitThenReselect, RetryWake, SameAccountRetryInput, SameAccountRetryResult, SelectingHook, Transport, } from './types.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChooseAccountResult, HeaderEdits, InstallOpenCode2AuthOptions, OpenCode2AuthAdapter, OpenCode2AuthInstallation, OpenCode2HookContext } from './types.js';
|
|
2
2
|
export declare const DEFAULT_MAX_RECORDS = 512;
|
|
3
|
-
/**
|
|
4
|
-
export declare const MAX_RETRY_HOLD_MS
|
|
3
|
+
/** Allow a one-hour cache lifetime plus the maximum session jitter. */
|
|
4
|
+
export declare const MAX_RETRY_HOLD_MS = 3621000;
|
|
5
5
|
/**
|
|
6
6
|
* The request header `model.request` sets to the attempt it started. The
|
|
7
7
|
* host builds the HTTP request and the WebSocket handshake from the headers
|
|
@@ -30,7 +30,8 @@ export declare function applyHeaderEdits(target: Record<string, string>, edits:
|
|
|
30
30
|
* - `retry` asks the host to retry at once when an account was refused
|
|
31
31
|
* before any output and `chooseAccount` names another account for the
|
|
32
32
|
* next attempt, keeps the host's decision when the refused account was the
|
|
33
|
-
* last one that can serve
|
|
33
|
+
* last one that can serve. After output, only a witnessed HTTP read failure
|
|
34
|
+
* with adapter-approved same-account continuation can keep the host's retry.
|
|
34
35
|
*
|
|
35
36
|
* Attribution. A send belongs to the attempt named by the mark
|
|
36
37
|
* `model.request` left on it, so several attempts of one session and kind
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Plugin } from '@opencode/plugin';
|
|
2
2
|
import type { SessionRequestKind, SessionRetryDecision } from '@opencode/plugin/promise/session';
|
|
3
|
+
import type { WaitCheckpoint } from '../limits/decide.js';
|
|
3
4
|
/** The parts of the OpenCode 2 plugin context the installer uses. */
|
|
4
5
|
export type OpenCode2HookContext = {
|
|
5
6
|
readonly session: Pick<Plugin.Context['session'], 'hook'>;
|
|
@@ -35,6 +36,8 @@ export interface EventVerdict<Q> {
|
|
|
35
36
|
readonly outputStarted?: boolean;
|
|
36
37
|
readonly quota?: Q;
|
|
37
38
|
readonly limit?: LimitSignal;
|
|
39
|
+
/** Applies only to this attempt, after ownership and attribution checks. */
|
|
40
|
+
readonly hostRetry?: RetryDisposition['hostRetry'];
|
|
38
41
|
/**
|
|
39
42
|
* This is the last event of the response (completed or failed); the
|
|
40
43
|
* attempt ends here. On WebSocket this is the only way an attempt ends
|
|
@@ -55,6 +58,16 @@ export type HeaderEdits = Readonly<Record<string, string | null>>;
|
|
|
55
58
|
export interface ChooseAccountInput extends RequestScope {
|
|
56
59
|
/** The retry hook's advance choice (which may hold), or a request's own choice. */
|
|
57
60
|
readonly phase: 'retry' | 'request';
|
|
61
|
+
/** Retry hook draft's attempt count; also carried by a consumed hold's wake. */
|
|
62
|
+
readonly hostAttempt?: number;
|
|
63
|
+
/** Revalidate the held account before dispatch, even if the target is not due. */
|
|
64
|
+
readonly wake?: RetryWake;
|
|
65
|
+
/**
|
|
66
|
+
* Accounts refused by earlier reroutes of this logical request. Absent means
|
|
67
|
+
* empty. Holds and wakes do not exclude the held account. A snapshot, not a
|
|
68
|
+
* live set; supplied whether or not enforcement is enabled.
|
|
69
|
+
*/
|
|
70
|
+
readonly excluded?: readonly string[];
|
|
58
71
|
/**
|
|
59
72
|
* The account of the attempt this one retries, when the retry hook just
|
|
60
73
|
* asked the host to retry an attempt of this session and kind; otherwise
|
|
@@ -75,19 +88,43 @@ export interface ChooseAccountInput extends RequestScope {
|
|
|
75
88
|
export interface AccountRequest extends RequestScope {
|
|
76
89
|
readonly accountId: string;
|
|
77
90
|
}
|
|
91
|
+
/** The held account is ChooseAccountInput.previousAccountId. */
|
|
92
|
+
export interface RetryWake {
|
|
93
|
+
readonly target: number;
|
|
94
|
+
readonly checkpoint?: WaitCheckpoint;
|
|
95
|
+
/** Terminal quota waits do not require the session's provider prompt-cache TTL. */
|
|
96
|
+
readonly kind?: 'hold' | 'terminal';
|
|
97
|
+
}
|
|
78
98
|
/** An explicit retry on the refused account, without moving its routing pin. */
|
|
79
99
|
export interface RetryHold {
|
|
80
100
|
readonly hold: {
|
|
81
101
|
/**
|
|
82
102
|
* Adapter-computed wait in milliseconds, including per-session jitter.
|
|
83
|
-
* Finite, non-negative values
|
|
84
|
-
*
|
|
103
|
+
* Finite, non-negative values up to MAX_RETRY_HOLD_MS (3_621_000) are
|
|
104
|
+
* accepted. Larger or invalid values keep the host's decision and release
|
|
105
|
+
* the choice rather than dispatching before the requested wait has elapsed.
|
|
85
106
|
*/
|
|
86
107
|
readonly delayMs: number;
|
|
108
|
+
/** An absolute wake target; its presence forces a request-phase re-check. */
|
|
109
|
+
readonly target?: number;
|
|
110
|
+
readonly checkpoint?: WaitCheckpoint;
|
|
111
|
+
/** Forwarded to wake.kind so terminal quota waits omit the cache bound. */
|
|
112
|
+
readonly kind?: RetryWake['kind'];
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/** Leave the host's retry decision alone, or forbid replay of this attempt. */
|
|
116
|
+
export interface RetryDisposition {
|
|
117
|
+
readonly hostRetry: 'leave' | 'veto';
|
|
118
|
+
}
|
|
119
|
+
/** Wait through one host retry, then choose afresh without reserving an account. */
|
|
120
|
+
export interface RetryWaitThenReselect {
|
|
121
|
+
readonly waitThenReselect: {
|
|
122
|
+
/** Same finite, non-negative delay bound as RetryHold.hold.delayMs. */
|
|
123
|
+
readonly delayMs: number;
|
|
87
124
|
};
|
|
88
125
|
}
|
|
89
|
-
/**
|
|
90
|
-
export type ChooseAccountResult = string | RetryHold | undefined;
|
|
126
|
+
/** Non-string choices are valid only in phase `retry`, after an account limit. */
|
|
127
|
+
export type ChooseAccountResult = string | RetryHold | RetryDisposition | RetryWaitThenReselect | undefined;
|
|
91
128
|
/**
|
|
92
129
|
* One physical send: created when an account is chosen for a request, and
|
|
93
130
|
* handed back on every hook call and event that belongs to that send, so a
|
|
@@ -184,6 +221,14 @@ export interface SameAccountRetryInput extends AccountRequest {
|
|
|
184
221
|
* limitFromError is not called before this callback in a mixed session.
|
|
185
222
|
*/
|
|
186
223
|
readonly limit?: LimitSignal;
|
|
224
|
+
/**
|
|
225
|
+
* Set only when output had already started and our own HTTP body reader saw
|
|
226
|
+
* the read fail, so the host is offering to continue the step rather than
|
|
227
|
+
* retry it. The adapter approves by returning the same accountId when the
|
|
228
|
+
* account and identity are still usable; it has no prepared recovery state
|
|
229
|
+
* to consume, and `limit` is always absent here.
|
|
230
|
+
*/
|
|
231
|
+
readonly continuation?: 'interrupted-read';
|
|
187
232
|
}
|
|
188
233
|
/** Request an immediate retry; a different account ID is ignored. */
|
|
189
234
|
export interface SameAccountRetryResult {
|
|
@@ -194,7 +239,7 @@ export interface SameAccountRetryResult {
|
|
|
194
239
|
* quota reading type; the installer only carries it to the `quota` event.
|
|
195
240
|
* `A` is the plugin's per-attempt value (see `Attempt`).
|
|
196
241
|
* `Choice` defaults to the legacy ID-only result so existing adapters' direct
|
|
197
|
-
* callers still see IDs. Opt into
|
|
242
|
+
* callers still see IDs. Opt into retry directives with `ChooseAccountResult`.
|
|
198
243
|
*/
|
|
199
244
|
export interface OpenCode2AuthAdapter<Q = unknown, A = unknown, Choice extends ChooseAccountResult = string | undefined> {
|
|
200
245
|
/** Every hook is scoped to this provider; other providers are untouched. */
|
|
@@ -209,11 +254,24 @@ export interface OpenCode2AuthAdapter<Q = unknown, A = unknown, Choice extends C
|
|
|
209
254
|
* After a limit before any output, the retry hook makes this call itself,
|
|
210
255
|
* with `phase: 'retry'` and `rerouteFrom` set. Every returned account,
|
|
211
256
|
* including the refused one, is kept for the next attempt of that session
|
|
212
|
-
* and kind: it does not choose again
|
|
257
|
+
* and kind: it does not choose again, except for a hold with a target.
|
|
258
|
+
* Another account retries at once;
|
|
213
259
|
* the refused account keeps the host's decision and wait. `{ hold: { delayMs } }`
|
|
214
260
|
* commits the refused account without changing its pin and replaces the host's
|
|
215
261
|
* wait, even its no-retry decision, only for a recognised account limit before
|
|
216
|
-
* output in
|
|
262
|
+
* output in a session with no foreign transport. A hold with a target releases its queued
|
|
263
|
+
* choice and calls again in phase `request` with `wake` and `hostAttempt`
|
|
264
|
+
* before fetching account headers. The adapter must check that the account
|
|
265
|
+
* is still eligible, still represents the same login, is still available
|
|
266
|
+
* from the credential store and has any required provider prompt-cache TTL
|
|
267
|
+
* remaining, then choose normally if invalid.
|
|
268
|
+
* A hold without a target takes the queued account as before.
|
|
269
|
+
* `{ hostRetry: 'veto' }` forbids replay; `'leave'` preserves the host's decision
|
|
270
|
+
* without reserving an account. `{ waitThenReselect: { delayMs } }` asks for one
|
|
271
|
+
* delayed host retry, then chooses afresh. It commits no account or routing pin.
|
|
272
|
+
* Like holds, its delay must fit MAX_RETRY_HOLD_MS and the host retry budget.
|
|
273
|
+
* These directives obey the same ownership, attribution and output fences.
|
|
274
|
+
* Non-string choices returned in phase `request` cannot
|
|
217
275
|
* select an account and are treated as undefined. `undefined` or a
|
|
218
276
|
* throw commits nothing: the host decides, and the next attempt chooses
|
|
219
277
|
* with `phase: 'request'`, `previousAccountId` and no `rerouteFrom`.
|
|
@@ -222,7 +280,8 @@ export interface OpenCode2AuthAdapter<Q = unknown, A = unknown, Choice extends C
|
|
|
222
280
|
/**
|
|
223
281
|
* Releases a kept retry choice that will not be used: no retry, a changed
|
|
224
282
|
* model or agent, cancellation of a queued retry (session idle), session forgetting/deletion,
|
|
225
|
-
* disposal
|
|
283
|
+
* disposal, record eviction or a targeted hold's wake re-check. A hold
|
|
284
|
+
* releases the refused account's choice.
|
|
226
285
|
* Called once with the original choose input plus its returned accountId,
|
|
227
286
|
* never for a used choice. Awaited before any later chooseAccount for the
|
|
228
287
|
* same session; errors are logged and swallowed. A model/agent change
|
|
@@ -264,6 +323,21 @@ export interface OpenCode2AuthAdapter<Q = unknown, A = unknown, Choice extends C
|
|
|
264
323
|
readonly response: Response;
|
|
265
324
|
readonly attempt: Attempt<A>;
|
|
266
325
|
}): Promise<Response | undefined> | Response | undefined;
|
|
326
|
+
/**
|
|
327
|
+
* Optional retry policy for the final HTTP response. Runs immediately after
|
|
328
|
+
* `rewriteResponse` (or on the unchanged response when no rewrite is returned).
|
|
329
|
+
* Return `veto` to forbid host replay of a refusal the adapter formatted,
|
|
330
|
+
* even without a recognised limit. A veto is sticky for this attempt.
|
|
331
|
+
* Ownership and attribution checks still run first: a veto cannot affect a
|
|
332
|
+
* foreign request, a session with mixed ownership, or a retry whose attempt is
|
|
333
|
+
* ambiguous. `leave` or `undefined` preserves the existing retry policy,
|
|
334
|
+
* including an earlier veto.
|
|
335
|
+
*/
|
|
336
|
+
responseRetry?(input: AccountRequest & {
|
|
337
|
+
readonly request: Request;
|
|
338
|
+
readonly response: Response;
|
|
339
|
+
readonly attempt: Attempt<A>;
|
|
340
|
+
}): Promise<'leave' | 'veto' | undefined> | 'leave' | 'veto' | undefined;
|
|
267
341
|
/**
|
|
268
342
|
* Optional. For an adapter whose own sender can move a request to another
|
|
269
343
|
* account after `rewriteRequest` (a bridge that answers a 401 or 403 by
|
|
@@ -371,7 +445,7 @@ export interface OpenCode2AuthAdapter<Q = unknown, A = unknown, Choice extends C
|
|
|
371
445
|
* A different accountId is ignored. Never move a routing pin or select another
|
|
372
446
|
* account here: use chooseAccount for failover and holds.
|
|
373
447
|
*
|
|
374
|
-
* Runs
|
|
448
|
+
* Runs for an attributable attempt before output, and, when gated, only
|
|
375
449
|
* while the latest transport is owned. Unlike failover and holds, it also runs
|
|
376
450
|
* in mixed-ownership sessions. The next matching owned request skips selection
|
|
377
451
|
* and calls accountHeaders again for this account, so newer credentials or a
|
|
@@ -383,6 +457,12 @@ export interface OpenCode2AuthAdapter<Q = unknown, A = unknown, Choice extends C
|
|
|
383
457
|
* No choice was committed through chooseAccount; unused recovery state is
|
|
384
458
|
* released through dropSameAccountRetry instead of dropChoice.
|
|
385
459
|
* Errors are logged and treated as declining the retry.
|
|
460
|
+
* After output it also gates a host-approved continuation when the attributed
|
|
461
|
+
* HTTP body reader failed, no limit or veto exists, ownership is unmixed and
|
|
462
|
+
* the host retry budget remains. The host's decision and delay are preserved;
|
|
463
|
+
* the callback must decline if the account is no longer usable or its identity
|
|
464
|
+
* changed. Native WebSocket failures and clean but incomplete streams lack
|
|
465
|
+
* the structured host error fields needed to allow this exception.
|
|
386
466
|
*/
|
|
387
467
|
retrySameAccount?(input: SameAccountRetryInput): Promise<SameAccountRetryResult | undefined> | SameAccountRetryResult | undefined;
|
|
388
468
|
/**
|
|
@@ -435,6 +515,24 @@ export interface InstallOpenCode2AuthOptions {
|
|
|
435
515
|
readonly hostCredentials?: readonly string[];
|
|
436
516
|
/** Most attempts kept before the oldest is abandoned and dropped. */
|
|
437
517
|
readonly maxRecords?: number;
|
|
518
|
+
/**
|
|
519
|
+
* Host retry budget, default 10. When hostAttempt leaves no retry available,
|
|
520
|
+
* limit holds and reroutes keep the host's decision and release their choice.
|
|
521
|
+
*/
|
|
522
|
+
readonly hostRetryLimit?: number;
|
|
523
|
+
/**
|
|
524
|
+
* Reject chooser results naming a request-excluded account (default false).
|
|
525
|
+
* A rejected choice warns and acts like undefined: the host decides in retry,
|
|
526
|
+
* and request selection stops with no-account. Without this option, chooser
|
|
527
|
+
* results retain their existing meaning.
|
|
528
|
+
*
|
|
529
|
+
* The host supplies no logical request id. The first later attempt of the
|
|
530
|
+
* same session and kind consumes a queued retry's exclusions. If another
|
|
531
|
+
* attempt is in flight, that binding warns but keeps the exclusions. A new
|
|
532
|
+
* concurrent request can therefore inherit them; if it consumes the retry
|
|
533
|
+
* first, the actual retry instead starts a fresh token without them.
|
|
534
|
+
*/
|
|
535
|
+
readonly enforceRequestExclusion?: boolean;
|
|
438
536
|
readonly logger?: OpenCode2AuthLogger;
|
|
439
537
|
}
|
|
440
538
|
/**
|
|
@@ -442,20 +540,24 @@ export interface InstallOpenCode2AuthOptions {
|
|
|
442
540
|
*
|
|
443
541
|
* - `reroute`: refused for a limit before any output, and `chooseAccount`
|
|
444
542
|
* named another account for the next attempt, so the host retries at once;
|
|
445
|
-
* - `output-started`: output
|
|
543
|
+
* - `output-started`: output reached the user without a safe continuation, so no retry;
|
|
544
|
+
* - `continue-same-account`: a witnessed HTTP read failure after output, with
|
|
545
|
+
* adapter-approved identity preservation; keeps the host's continuation and delay;
|
|
446
546
|
* - `no-account`: the attempt had no account, so no retry;
|
|
447
547
|
* - `host-decides-last-account`: refused for a limit before any output, but
|
|
448
548
|
* no other account can serve the next attempt, so the host's own decision
|
|
449
549
|
* (its wait, or its refusal to retry) stands and the next attempt may go
|
|
450
550
|
* to the refused account again;
|
|
451
551
|
* - `hold`: an explicit adapter wait on the refused account, before output;
|
|
552
|
+
* - `wait-then-reselect`: wait without reserving the next account;
|
|
553
|
+
* - `adapter-veto`: the attributed adapter disposition forbids host replay;
|
|
452
554
|
* - `same-account`: the adapter requested immediate recovery on the same route,
|
|
453
555
|
* without account selection, before output;
|
|
454
556
|
* - `host-decides`: no limit was recognised, or the failing call cannot be
|
|
455
557
|
* attributed safely (ambiguous attempts or mixed ownership in a gated
|
|
456
558
|
* session), so the host's decision stands.
|
|
457
559
|
*/
|
|
458
|
-
export type RetryReason = 'reroute' | 'hold' | 'same-account' | 'output-started' | 'no-account' | 'host-decides-last-account' | 'host-decides';
|
|
560
|
+
export type RetryReason = 'reroute' | 'hold' | 'wait-then-reselect' | 'adapter-veto' | 'same-account' | 'continue-same-account' | 'output-started' | 'no-account' | 'host-decides-last-account' | 'host-decides';
|
|
459
561
|
/**
|
|
460
562
|
* The hook that picked an account. Normally `model.request`; a transport hook
|
|
461
563
|
* picks only when the host skipped `model.request` for that request, which a
|
|
@@ -23,11 +23,16 @@ export interface AdmissionInput extends ExclusionInputs {
|
|
|
23
23
|
scope?: string;
|
|
24
24
|
/** Labels the scope requires an entry for; defaults to `['primary']`. */
|
|
25
25
|
requiredLabels?: readonly string[];
|
|
26
|
+
/**
|
|
27
|
+
* One-dispatch exemptions keyed by row; waive only gate 4. The caller first
|
|
28
|
+
* validates the current account incarnation and checkpointed reset times.
|
|
29
|
+
*/
|
|
30
|
+
liftedWindows?: ReadonlyMap<string, readonly WindowRef[]>;
|
|
26
31
|
now: number;
|
|
27
32
|
/**
|
|
28
|
-
* Called synchronously
|
|
33
|
+
* Called synchronously once per row needing a pull, including lifted windows.
|
|
29
34
|
* Its return value is ignored and never awaited, so a pull the caller
|
|
30
|
-
* starts from here cannot delay
|
|
35
|
+
* starts from here cannot delay admission or a refusal.
|
|
31
36
|
*/
|
|
32
37
|
requestPull?: (rowId: string) => void;
|
|
33
38
|
}
|
|
@@ -12,6 +12,14 @@ export interface AskRoutingInput<Candidate extends RoutingCandidate = RoutingCan
|
|
|
12
12
|
candidates: readonly Candidate[];
|
|
13
13
|
/** Defaults to 500 ms, clamped to 1–2000 ms. */
|
|
14
14
|
deadlineMs?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Longest same-account hold, in seconds, that routing may advise. The
|
|
17
|
+
* holdWaitMaxS helper from `./limits` caps it by the setting and the current
|
|
18
|
+
* account's cache expiry, returning 0 when there is no accepted prompt cache
|
|
19
|
+
* worth waiting for. Fractions are floored and negatives become 0. Omit it to leave
|
|
20
|
+
* routing's default cap in force.
|
|
21
|
+
*/
|
|
22
|
+
holdWaitMaxS?: number;
|
|
15
23
|
}
|
|
16
24
|
export interface RoutingHold {
|
|
17
25
|
/** Uncapped advice from routing. The plugin must apply its own hold cap. */
|
|
@@ -39,9 +47,11 @@ export type ReportRoutingInput = RoutingReportIdentity & ({
|
|
|
39
47
|
/** The exhausted quota window; keep scoped quota groups in `pool`. */
|
|
40
48
|
window: '5h' | '7d';
|
|
41
49
|
/**
|
|
42
|
-
* Scoped quota group, such as `
|
|
43
|
-
* Must
|
|
44
|
-
*
|
|
50
|
+
* Scoped quota group, such as Antigravity's `3p` or `gemini`.
|
|
51
|
+
* Must match `^[a-z0-9._-]{1,64}$`. Routing compares names exactly, so
|
|
52
|
+
* callers must lowercase names from elsewhere (e.g. `Fable` to `fable`).
|
|
53
|
+
* Names are never rewritten here. Omit or pass `undefined` to block the
|
|
54
|
+
* whole account; include to block only this pool.
|
|
45
55
|
*/
|
|
46
56
|
pool?: string;
|
|
47
57
|
/** Optional reset time in epoch milliseconds. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StoredCredential } from './schema.js';
|
|
2
2
|
/** Every library operation that can fail, as named in the failure value. */
|
|
3
|
-
export type PoolOperation = 'initialize' | 'add' | 'replace' | 'rotate' | 'disable' | 'enable' | 'remove' | 'reorder' | 'updateSettings' | 'recordIdentity' | 'updateProviderState' | 'refresh' | 'pull' | 'publishRoster';
|
|
3
|
+
export type PoolOperation = 'initialize' | 'add' | 'replace' | 'rotate' | 'disable' | 'enable' | 'remove' | 'reorder' | 'updateSettings' | 'updateLimitsNamespace' | 'recordIdentity' | 'updateProviderState' | 'refresh' | 'pull' | 'publishRoster';
|
|
4
4
|
/**
|
|
5
5
|
* How far an operation got before it failed.
|
|
6
6
|
*
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type PoolOperation } from './errors.js';
|
|
2
2
|
/** Refuses a row operation or refresh called from inside a hook. */
|
|
3
3
|
export declare function assertNotInsideHook(operation: PoolOperation): void;
|
|
4
|
-
|
|
4
|
+
/** Namespace writes need only the store locks, not the row lock a hook may retain. */
|
|
5
|
+
export declare function assertLimitsWriteAllowed(): void;
|
|
6
|
+
/** Codecs may run under store locks even when no asynchronous hook is active. */
|
|
7
|
+
export declare function runInsideCodec<T>(fn: () => T): T;
|
|
8
|
+
export declare function runInsideHook<T>(operation: PoolOperation, fn: () => Promise<T> | T, storeLocksReleased?: boolean): Promise<T>;
|
|
5
9
|
export interface PoolLogger {
|
|
6
10
|
warn(message: string, data?: unknown): void;
|
|
7
11
|
}
|
|
@@ -3,6 +3,7 @@ export type { PoolFailureKind, PoolFailurePhase, PoolOperation, } from './errors
|
|
|
3
3
|
export { PoolOperationError, PoolReentryError } from './errors.js';
|
|
4
4
|
export type { PoolLogger } from './hooks.js';
|
|
5
5
|
export { countUnknownIdentityRows, DUPLICATE_IDENTITY_REASON, } from './identity.js';
|
|
6
|
+
export type { PoolLimitsMutator, PoolLimitsRow, PoolLimitsWriteOptions, } from './limits-namespace.js';
|
|
6
7
|
export type { HoldPoint, InitializeOutcome, WriteStep } from './mutate.js';
|
|
7
8
|
export type { OpenPoolStoreOptions, PoolLoad, PoolStore, } from './pool.js';
|
|
8
9
|
export { openPoolStore } from './pool.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StoreRuntime } from './runtime.js';
|
|
2
|
+
import type { PoolRow } from './schema.js';
|
|
3
|
+
/** Row IDs, credential epochs and identities only; mutators never receive credentials. */
|
|
4
|
+
export type PoolLimitsRow = Pick<PoolRow, 'id' | 'credentialEpoch' | 'identity'>;
|
|
5
|
+
export type PoolLimitsMutator = (envelope: unknown, rows: readonly PoolLimitsRow[]) => unknown | Promise<unknown>;
|
|
6
|
+
/** Publication bookkeeping runs under the same locks as the namespace merge. */
|
|
7
|
+
export interface PoolLimitsWriteOptions {
|
|
8
|
+
readonly beforePublish?: () => void;
|
|
9
|
+
/** Runs once publication happened, even if a later step fails. Must not throw. */
|
|
10
|
+
readonly onPublished?: () => void;
|
|
11
|
+
}
|
|
12
|
+
/** A namespace merge and its check of current row bindings share one locked config snapshot. */
|
|
13
|
+
export declare function updatePoolLimitsNamespace(rt: StoreRuntime, mutator: PoolLimitsMutator, options?: PoolLimitsWriteOptions): Promise<void>;
|
|
@@ -2,6 +2,7 @@ import type { QuotaCommitTimer } from '../quota/commit-interval.js';
|
|
|
2
2
|
import { type Attribution } from './attribution.js';
|
|
3
3
|
import type { PoolOperationError } from './errors.js';
|
|
4
4
|
import type { PoolLogger } from './hooks.js';
|
|
5
|
+
import { type PoolLimitsMutator } from './limits-namespace.js';
|
|
5
6
|
import { type HoldPoint, type InitializeOutcome, type StoreContext } from './mutate.js';
|
|
6
7
|
import { type ProviderStateMutator, type UpdateProviderStateResult } from './provider-state.js';
|
|
7
8
|
import { type PublicationReceipt, type PublishOptions, type PublishPlan, type PublishResult } from './publication.js';
|
|
@@ -191,9 +192,17 @@ export interface PoolStore {
|
|
|
191
192
|
/**
|
|
192
193
|
* One locked write of the plugin's settings (since 0.2.6) beside the pool,
|
|
193
194
|
* in the config file. Refuses a result that sets a pool-owned key
|
|
194
|
-
* (`invalid-input`).
|
|
195
|
+
* (`invalid-input`). Carries commonAuthLimits through unchanged and refuses
|
|
196
|
+
* an explicit alteration to it. Takes `extraLocks`, then the store locks.
|
|
195
197
|
*/
|
|
196
198
|
updateSettings(mutator: SettingsMutator, options?: UpdateSettingsOptions): Promise<UpdateSettingsResult>;
|
|
199
|
+
/**
|
|
200
|
+
* Merges commonAuthLimits with current row bindings in one config write.
|
|
201
|
+
* Requires a ready pool and takes only the store locks. May run in an
|
|
202
|
+
* onPersisted/onFailure hook or a pull, but not in a lock-held mutator.
|
|
203
|
+
* Optional so existing structural implementations remain compatible.
|
|
204
|
+
*/
|
|
205
|
+
updateLimitsNamespace?(mutator: PoolLimitsMutator, options?: import('./limits-namespace.js').PoolLimitsWriteOptions): Promise<void>;
|
|
197
206
|
/**
|
|
198
207
|
* Records the identity a lookup found for the row's credential. Since
|
|
199
208
|
* 0.3.1 it takes the credential epoch the lookup was issued for, and
|
|
@@ -59,5 +59,7 @@ export declare function readPoolSettings(rt: StoreRuntime): Promise<SettingsRead
|
|
|
59
59
|
* pool-owned key refuses (`invalid-input`) with nothing written; a result
|
|
60
60
|
* equal to the current settings writes nothing. The state file is never
|
|
61
61
|
* touched, and the pool-owned keys are written back exactly as read.
|
|
62
|
+
* commonAuthLimits is also carried through unchanged, even when omitted by
|
|
63
|
+
* the mutator; an explicit change to it refuses before writing anything.
|
|
62
64
|
*/
|
|
63
65
|
export declare function updatePoolSettings(rt: StoreRuntime, mutator: SettingsMutator, options?: UpdateSettingsOptions): Promise<UpdateSettingsResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/plugin/request.ts"],"names":[],"mappings":"AAsBA,OAAO,EACL,KAAK,wBAAwB,EAI9B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,SAAS,CAAA;AAEhB,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,KAAK,uBAAuB,EAG5B,KAAK,aAAa,EAGnB,MAAM,SAAS,CAAA;AAChB,OAAO,EAEL,KAAK,WAAW,EAGjB,MAAM,eAAe,CAAA;AACtB,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AAEpD,OAAO,EAwBL,KAAK,qBAAqB,EAE3B,MAAM,mBAAmB,CAAA;AAoB1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAyE3D,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,WAAW,EAClB,IAAI,CAAC,EAAE,WAAW,GACjB,MAAM,GAAG,SAAS,CA6BpB;
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../../src/plugin/request.ts"],"names":[],"mappings":"AAsBA,OAAO,EACL,KAAK,wBAAwB,EAI9B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,SAAS,CAAA;AAEhB,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,KAAK,uBAAuB,EAG5B,KAAK,aAAa,EAGnB,MAAM,SAAS,CAAA;AAChB,OAAO,EAEL,KAAK,WAAW,EAGjB,MAAM,eAAe,CAAA;AACtB,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAgB,KAAK,MAAM,E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CASA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;kCAYM,GAAG,cAAc,MAAM;4CAEb,GAAG,EAAE,cAAc,MAAM;4CAEzB,GAAG,EAAE,cAAc,MAAM;;;sDAIf,GAAG,EAAE,OAAO,MAAM;sDAElB,GAAG,EAAE,OAAO,MAAM;;;;;CAMrE,CAAA"}
|
|
@@ -338,7 +338,7 @@ export type RequestKind = 'primary' | 'compaction' | 'title' | 'generate';
|
|
|
338
338
|
* The model a title request is sent to when the host selected one this
|
|
339
339
|
* plugin does not serve as text: an unregistered model or an image model.
|
|
340
340
|
*/
|
|
341
|
-
export declare const TITLE_FALLBACK_MODEL = "gemini-3.
|
|
341
|
+
export declare const TITLE_FALLBACK_MODEL = "gemini-3.8-flash-low";
|
|
342
342
|
/**
|
|
343
343
|
* Routes a title request: a registered text model is kept; any other model
|
|
344
344
|
* (unregistered, or an image model) is replaced in the URL by
|
|
@@ -55,6 +55,11 @@ export interface RuntimeLayoutLogger {
|
|
|
55
55
|
info(message: string, meta?: Record<string, unknown>): unknown;
|
|
56
56
|
warn(message: string, meta?: Record<string, unknown>): unknown;
|
|
57
57
|
}
|
|
58
|
+
interface OldFileCleanupIO {
|
|
59
|
+
platform: NodeJS.Platform;
|
|
60
|
+
readFile(path: string): Promise<Buffer>;
|
|
61
|
+
unlink(path: string): Promise<void>;
|
|
62
|
+
}
|
|
58
63
|
export interface RuntimeLayoutOptions {
|
|
59
64
|
/** This build's version, for the version fence. */
|
|
60
65
|
version: string;
|
|
@@ -74,8 +79,8 @@ export interface RuntimeLayoutOptions {
|
|
|
74
79
|
*/
|
|
75
80
|
destinationPrivate?: (dir: string) => Promise<boolean>;
|
|
76
81
|
/**
|
|
77
|
-
* Test seams
|
|
78
|
-
*
|
|
82
|
+
* Test seams for the move. A step callback that throws stands in for a
|
|
83
|
+
* crash there: nothing after it runs.
|
|
79
84
|
*/
|
|
80
85
|
steps?: {
|
|
81
86
|
afterManifest?: () => void | Promise<void>;
|
|
@@ -87,6 +92,8 @@ export interface RuntimeLayoutOptions {
|
|
|
87
92
|
* check that guards it.
|
|
88
93
|
*/
|
|
89
94
|
beforeRemove?: (path: string) => void | Promise<void>;
|
|
95
|
+
/** Isolate old-copy comparison/removal from OS sharing races in tests. */
|
|
96
|
+
oldFileIO?: OldFileCleanupIO;
|
|
90
97
|
};
|
|
91
98
|
/** Test seam: how long to wait for the layout lock. */
|
|
92
99
|
layoutLockWaitMs?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-layout.d.ts","sourceRoot":"","sources":["../../../src/runtime-layout.ts"],"names":[],"mappings":"AAiJA,OAAO,EACL,KAAK,kBAAkB,EAUvB,KAAK,aAAa,EAQnB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,KAAK,kBAAkB,EAAoB,MAAM,iBAAiB,CAAA;AAE3E,YAAY,EAAE,aAAa,EAAE,CAAA;AAM7B,yEAAyE;AACzE,eAAO,MAAM,wBAAwB,mBAAmB,CAAA;AACxD,4EAA4E;AAC5E,eAAO,MAAM,4BAA4B,uBAAuB,CAAA;AAEhE;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,mCAAmC,CAAA;AAK3E;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,8IAMnB,CAAA;AA8CV,yEAAyE;AACzE,eAAO,MAAM,+BAA+B,4IAC+F,CAAA;AAE3I;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,8IACkG,CAAA;AAE7I;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,8MAC+J,CAAA;AAE7M;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAE3C,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM;gBADlB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAC3B,OAAO,SAAuC;CAKjD;AAiDD;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,CAA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AAiB,CACrC,IAAI,EAAE,eAAe,EACrB,eAAe,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACtC,UAAU,UAAQ,GACjB,OAAO,CAAC,WAAW,CAAC,CAoVtB;AAED,2FAA2F;AAC3F,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,EAAE,eAAe,EACrB,eAAe,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACtC,EAAE,GAAE,OAAY,GACf,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/opencode-antigravity-auth",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.31",
|
|
4
4
|
"description": "Google Antigravity OAuth auth plugin for OpenCode - access Gemini and Claude models using Google credentials",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -128,9 +128,9 @@
|
|
|
128
128
|
"zod-to-json-schema": "^3.25.1"
|
|
129
129
|
},
|
|
130
130
|
"dependencies": {
|
|
131
|
-
"@cortexkit/claustrum-client": "0.
|
|
131
|
+
"@cortexkit/claustrum-client": "0.15.0",
|
|
132
132
|
"@cortexkit/subc-client": "0.22.5",
|
|
133
|
-
"@cortexkit/antigravity-auth-core": "3.0.
|
|
133
|
+
"@cortexkit/antigravity-auth-core": "3.0.31",
|
|
134
134
|
"@cortexkit/private-files": "0.2.2",
|
|
135
135
|
"jsonc-parser": "^3.3.1",
|
|
136
136
|
"xdg-basedir": "^5.1.0",
|
|
@@ -6,6 +6,7 @@ import { type ClaustrumLogger } from './errors.js';
|
|
|
6
6
|
import type { CustodyLease } from './hub.js';
|
|
7
7
|
import { type InsulaQuotaOptions, type InsulaQuotaResult } from './insula.js';
|
|
8
8
|
import { type AccountMapper, type ProjectionOptions, type QuotaReceipt, type ReorderVaultRosterResult, type VaultRosterFile } from './roster.js';
|
|
9
|
+
import type { ClaustrumUsageReading, ClaustrumUsageReportState } from './usage.js';
|
|
9
10
|
import { type WatchMode } from './watch.js';
|
|
10
11
|
export interface ClaustrumConsumerOptions<Q = QuotaObservation> {
|
|
11
12
|
/**
|
|
@@ -229,6 +230,17 @@ export declare class ClaustrumConsumer<Q = QuotaObservation> {
|
|
|
229
230
|
* poll, and a route whose credential or account changed is refused.
|
|
230
231
|
*/
|
|
231
232
|
authorize(routeId: string, signal?: AbortSignal): Promise<ClaustrumScopedAttempt>;
|
|
233
|
+
/**
|
|
234
|
+
* Queue reply quota metadata without waiting or throwing. Pass rate-limit
|
|
235
|
+
* headers only, never tokens: the library does not filter header names.
|
|
236
|
+
* The credential must have been served by this host and still belong to the route.
|
|
237
|
+
*/
|
|
238
|
+
reportUsage(input: {
|
|
239
|
+
routeId: string;
|
|
240
|
+
credentialId: string;
|
|
241
|
+
reading: ClaustrumUsageReading;
|
|
242
|
+
}): void;
|
|
243
|
+
usageReportState(): ClaustrumUsageReportState;
|
|
232
244
|
reportFailure(attempt: ClaustrumScopedAttempt, status: number, source: ClaustrumReporterSource): Promise<void>;
|
|
233
245
|
/**
|
|
234
246
|
* Send on a vault route. `dispatch` builds and sends the request with the
|
|
@@ -738,6 +738,42 @@ export class ClaustrumConsumer {
|
|
|
738
738
|
combined.dispose();
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
+
/**
|
|
742
|
+
* Queue reply quota metadata without waiting or throwing. Pass rate-limit
|
|
743
|
+
* headers only, never tokens: the library does not filter header names.
|
|
744
|
+
* The credential must have been served by this host and still belong to the route.
|
|
745
|
+
*/
|
|
746
|
+
reportUsage(input) {
|
|
747
|
+
if (this.#shutdown.signal.aborted)
|
|
748
|
+
return;
|
|
749
|
+
try {
|
|
750
|
+
const row = this.#roster?.rows.find((row) => row.routeId === input.routeId);
|
|
751
|
+
if (!row?.enabled ||
|
|
752
|
+
row.state !== 'active' ||
|
|
753
|
+
(row.credentialId !== input.credentialId &&
|
|
754
|
+
!row.aliases?.includes(input.credentialId)))
|
|
755
|
+
return;
|
|
756
|
+
if (this.#hub) {
|
|
757
|
+
if (this.#lease && this.#hub.leaseLive(this.#lease))
|
|
758
|
+
this.#lease.custody.reportUsage(input);
|
|
759
|
+
}
|
|
760
|
+
else
|
|
761
|
+
this.#custody?.reportUsage(input);
|
|
762
|
+
}
|
|
763
|
+
catch {
|
|
764
|
+
// Quota bookkeeping must never reject a provider request.
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
usageReportState() {
|
|
768
|
+
try {
|
|
769
|
+
return ((this.#hub
|
|
770
|
+
? this.#lease?.custody
|
|
771
|
+
: this.#custody)?.usageReportState() ?? { pending: 0, inFlight: false, dropped: 0 });
|
|
772
|
+
}
|
|
773
|
+
catch {
|
|
774
|
+
return { pending: 0, inFlight: false, dropped: 0 };
|
|
775
|
+
}
|
|
776
|
+
}
|
|
741
777
|
async reportFailure(attempt, status, source) {
|
|
742
778
|
this.#assertOpen();
|
|
743
779
|
if (this.#hub) {
|