@cortexkit/opencode-antigravity-auth 3.1.10 → 3.1.12
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 +357 -58
- package/dist/cli.js.map +3 -3
- package/dist/cli.meta.json +42 -32
- package/dist/index.js +1115 -493
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +98 -65
- package/dist/server.js +1266 -616
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/cli.d.ts +3 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +19 -6
- package/dist/src/cli.js.map +1 -1
- package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +20 -1
- package/dist/src/common-auth-embedded/claustrum/consumer.js +32 -0
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +39 -1
- package/dist/src/common-auth-embedded/claustrum/custody.js +145 -8
- package/dist/src/common-auth-embedded/claustrum/host.js +8 -0
- package/dist/src/common-auth-embedded/claustrum/hub.d.ts +3 -2
- package/dist/src/common-auth-embedded/claustrum/hub.js +10 -0
- package/dist/src/common-auth-embedded/claustrum/index.d.ts +1 -1
- package/dist/src/common-auth-embedded/routing-accessor/index.js +5 -3
- package/dist/src/common-auth-embedded/source-output.json +35 -35
- package/dist/src/ga/rpc/protocol.d.ts +11 -5
- package/dist/src/ga/rpc/protocol.d.ts.map +1 -1
- package/dist/src/ga/rpc/protocol.js +11 -3
- package/dist/src/ga/rpc/protocol.js.map +1 -1
- package/dist/src/ga/server/index.d.ts.map +1 -1
- package/dist/src/ga/server/index.js +30 -14
- package/dist/src/ga/server/index.js.map +1 -1
- package/dist/src/ga/tui/host-ga.d.ts +2 -1
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
- package/dist/src/ga/tui/host-ga.js +9 -4
- package/dist/src/ga/tui/host-ga.js.map +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
- package/dist/src/plugin/account-access.d.ts +1 -0
- package/dist/src/plugin/account-access.d.ts.map +1 -1
- package/dist/src/plugin/account-access.js +28 -0
- package/dist/src/plugin/account-access.js.map +1 -1
- package/dist/src/plugin/auth-loader.d.ts.map +1 -1
- package/dist/src/plugin/auth-loader.js +21 -12
- package/dist/src/plugin/auth-loader.js.map +1 -1
- package/dist/src/plugin/background-quota-refresh.d.ts +11 -24
- package/dist/src/plugin/background-quota-refresh.d.ts.map +1 -1
- package/dist/src/plugin/background-quota-refresh.js +54 -60
- package/dist/src/plugin/background-quota-refresh.js.map +1 -1
- package/dist/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
- package/dist/src/plugin/background-vault-quota-refresh.js +6 -3
- package/dist/src/plugin/background-vault-quota-refresh.js.map +1 -1
- package/dist/src/plugin/cache/signature-cache.d.ts +3 -0
- package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -1
- package/dist/src/plugin/cache/signature-cache.js +73 -46
- package/dist/src/plugin/cache/signature-cache.js.map +1 -1
- package/dist/src/plugin/cache.d.ts.map +1 -1
- package/dist/src/plugin/cache.js +17 -7
- package/dist/src/plugin/cache.js.map +1 -1
- package/dist/src/plugin/core/streaming/displayed-thinking.d.ts +23 -0
- package/dist/src/plugin/core/streaming/displayed-thinking.d.ts.map +1 -0
- package/dist/src/plugin/core/streaming/displayed-thinking.js +58 -0
- package/dist/src/plugin/core/streaming/displayed-thinking.js.map +1 -0
- package/dist/src/plugin/fetch/warmup.d.ts +9 -2
- package/dist/src/plugin/fetch/warmup.d.ts.map +1 -1
- package/dist/src/plugin/fetch/warmup.js +22 -14
- package/dist/src/plugin/fetch/warmup.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts +1 -0
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +2 -0
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/ga-shared-vault-custody.d.ts.map +1 -1
- package/dist/src/plugin/ga-shared-vault-custody.js +7 -1
- package/dist/src/plugin/ga-shared-vault-custody.js.map +1 -1
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +6 -1
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/quota.d.ts +10 -2
- package/dist/src/plugin/quota.d.ts.map +1 -1
- package/dist/src/plugin/quota.js +38 -10
- package/dist/src/plugin/quota.js.map +1 -1
- package/dist/src/plugin/request-helpers.d.ts.map +1 -1
- package/dist/src/plugin/request-helpers.js +51 -19
- package/dist/src/plugin/request-helpers.js.map +1 -1
- package/dist/src/plugin/request.d.ts +12 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +27 -42
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/shared/request-services.d.ts +4 -1
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +142 -24
- package/dist/src/plugin/shared/request-services.js.map +1 -1
- package/dist/src/plugin/shared/runtime.d.ts +3 -4
- package/dist/src/plugin/shared/runtime.d.ts.map +1 -1
- package/dist/src/plugin/shared/runtime.js +2 -2
- package/dist/src/plugin/shared/runtime.js.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +25 -15
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js +141 -68
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
- package/dist/src/plugin/vault-sidebar-projection.d.ts.map +1 -1
- package/dist/src/setup.d.ts +3 -0
- package/dist/src/setup.d.ts.map +1 -1
- package/dist/src/setup.js +18 -6
- package/dist/src/setup.js.map +1 -1
- package/dist/src/sidebar-state.d.ts +20 -7
- package/dist/src/sidebar-state.d.ts.map +1 -1
- package/dist/src/sidebar-state.js +57 -8
- package/dist/src/sidebar-state.js.map +1 -1
- package/dist/src/tui.d.ts.map +1 -1
- package/dist/src/tui.js +43 -23
- package/dist/src/tui.js.map +1 -1
- package/dist/tui-build-map.json +9 -9
- package/dist/tui-ga-build-map.json +5 -5
- package/dist/types/src/cli.d.ts +3 -1
- package/dist/types/src/cli.d.ts.map +1 -1
- package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +20 -1
- package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +39 -1
- 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 -1
- package/dist/types/src/ga/rpc/protocol.d.ts +11 -5
- package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -1
- package/dist/types/src/ga/server/index.d.ts.map +1 -1
- package/dist/types/src/plugin/account-access.d.ts +1 -0
- package/dist/types/src/plugin/account-access.d.ts.map +1 -1
- package/dist/types/src/plugin/auth-loader.d.ts.map +1 -1
- package/dist/types/src/plugin/background-quota-refresh.d.ts +11 -24
- package/dist/types/src/plugin/background-quota-refresh.d.ts.map +1 -1
- package/dist/types/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
- package/dist/types/src/plugin/cache/signature-cache.d.ts +3 -0
- package/dist/types/src/plugin/cache/signature-cache.d.ts.map +1 -1
- package/dist/types/src/plugin/cache.d.ts.map +1 -1
- package/dist/types/src/plugin/core/streaming/displayed-thinking.d.ts +23 -0
- package/dist/types/src/plugin/core/streaming/displayed-thinking.d.ts.map +1 -0
- package/dist/types/src/plugin/fetch/warmup.d.ts +9 -2
- package/dist/types/src/plugin/fetch/warmup.d.ts.map +1 -1
- package/dist/types/src/plugin/ga-location-services.d.ts +1 -0
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/ga-shared-vault-custody.d.ts.map +1 -1
- package/dist/types/src/plugin/index.d.ts.map +1 -1
- package/dist/types/src/plugin/quota.d.ts +10 -2
- package/dist/types/src/plugin/quota.d.ts.map +1 -1
- package/dist/types/src/plugin/request-helpers.d.ts.map +1 -1
- package/dist/types/src/plugin/request.d.ts +12 -1
- package/dist/types/src/plugin/request.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/request-services.d.ts +4 -1
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/runtime.d.ts +3 -4
- package/dist/types/src/plugin/shared/runtime.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +25 -15
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/types/src/plugin/vault-sidebar-projection.d.ts.map +1 -1
- package/dist/types/src/setup.d.ts +3 -0
- package/dist/types/src/setup.d.ts.map +1 -1
- package/dist/types/src/sidebar-state.d.ts +20 -7
- package/dist/types/src/sidebar-state.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/common-auth-embedded/claustrum/consumer.d.ts +20 -1
- package/src/common-auth-embedded/claustrum/consumer.js +32 -0
- package/src/common-auth-embedded/claustrum/custody.d.ts +39 -1
- package/src/common-auth-embedded/claustrum/custody.js +145 -8
- package/src/common-auth-embedded/claustrum/host.js +8 -0
- package/src/common-auth-embedded/claustrum/hub.d.ts +3 -2
- package/src/common-auth-embedded/claustrum/hub.js +10 -0
- package/src/common-auth-embedded/claustrum/index.d.ts +1 -1
- package/src/common-auth-embedded/routing-accessor/index.js +5 -3
- package/src/common-auth-embedded/source-output.json +35 -35
- package/src/sidebar-state.ts +77 -8
- package/src/tui-compiled/sidebar-state.js +40 -1
- package/src/tui-compiled/tui.js +49 -24
- package/src/tui-ga-compiled/host-ga.js +11 -5
- package/src/tui-ga-raw/host-ga.tsx +17 -6
- package/src/tui-raw/sidebar-state.js +40 -1
- package/src/tui-raw/tui.tsx +40 -24
- package/src/tui.tsx +40 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-state.d.ts","sourceRoot":"","sources":["../../../src/sidebar-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;
|
|
1
|
+
{"version":3,"file":"sidebar-state.d.ts","sourceRoot":"","s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|
2
2
|
"name": "@cortexkit/opencode-antigravity-auth",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.12",
|
|
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",
|
|
@@ -130,9 +130,9 @@
|
|
|
130
130
|
"zod-to-json-schema": "^3.25.1"
|
|
131
131
|
},
|
|
132
132
|
"dependencies": {
|
|
133
|
-
"@cortexkit/claustrum-client": "0.
|
|
133
|
+
"@cortexkit/claustrum-client": "0.21.0",
|
|
134
134
|
"@cortexkit/subc-client": "0.24.0",
|
|
135
|
-
"@cortexkit/antigravity-auth-core": "3.1.
|
|
135
|
+
"@cortexkit/antigravity-auth-core": "3.1.12",
|
|
136
136
|
"@cortexkit/private-files": "0.2.2",
|
|
137
137
|
"jsonc-parser": "^3.3.1",
|
|
138
138
|
"xdg-basedir": "^5.1.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ClaustrumReporterSource } from '@cortexkit/claustrum-client';
|
|
2
2
|
import type { QuotaObservation } from '../quota/index.js';
|
|
3
3
|
import type { RoutingRow } from '../routing/index.js';
|
|
4
|
-
import { type ClaustrumFamily, type ClaustrumScopedAttempt, type ClaustrumScopedClient, type IdentityParser, type KeptReceiptState, type VaultGrantReach } from './custody.js';
|
|
4
|
+
import { type ClaustrumFamily, type ClaustrumScopedAttempt, type ClaustrumScopedClient, type IdentityParser, type KeptReceiptState, type VaultConditionOutcome, type VaultConditionReason, type VaultGrantReach } from './custody.js';
|
|
5
5
|
import { type ClaustrumLogger } from './errors.js';
|
|
6
6
|
import type { CustodyLease } from './hub.js';
|
|
7
7
|
import { type InsulaQuotaOptions, type InsulaQuotaResult } from './insula.js';
|
|
@@ -246,6 +246,25 @@ export declare class ClaustrumConsumer<Q = QuotaObservation> {
|
|
|
246
246
|
}): void;
|
|
247
247
|
usageReportState(): ClaustrumUsageReportState;
|
|
248
248
|
reportFailure(attempt: ClaustrumScopedAttempt, status: number, source: ClaustrumReporterSource): Promise<void>;
|
|
249
|
+
/**
|
|
250
|
+
* Report a provider login condition through the custody that issued the
|
|
251
|
+
* receipt; see `ClaustrumScopedCustody.reportCondition`. Bookkeeping: call it
|
|
252
|
+
* after handing back the reply, never on the request path. It resolves
|
|
253
|
+
* `skipped` after shutdown and rejects only with `no-receipt` for a receipt
|
|
254
|
+
* no live custody of this consumer issued.
|
|
255
|
+
*/
|
|
256
|
+
reportCondition(attempt: ClaustrumScopedAttempt, input: {
|
|
257
|
+
reason: VaultConditionReason;
|
|
258
|
+
providerStatus: number;
|
|
259
|
+
actionUrl?: string;
|
|
260
|
+
}): Promise<VaultConditionOutcome>;
|
|
261
|
+
/**
|
|
262
|
+
* Clear a listed login condition through the custody that issued the
|
|
263
|
+
* receipt; see `ClaustrumScopedCustody.clearCondition`. Safe to call after
|
|
264
|
+
* every successful reply: it sends nothing unless the login is marked.
|
|
265
|
+
* Same `skipped` and `no-receipt` rules as `reportCondition`.
|
|
266
|
+
*/
|
|
267
|
+
clearCondition(attempt: ClaustrumScopedAttempt): Promise<VaultConditionOutcome>;
|
|
249
268
|
/**
|
|
250
269
|
* Send on a vault route. `dispatch` builds and sends the request with the
|
|
251
270
|
* receipt's token and may be called twice, so it must be able to rebuild
|
|
@@ -798,6 +798,38 @@ export class ClaustrumConsumer {
|
|
|
798
798
|
throw new ClaustrumConsumerError('no-receipt', 'Claustrum dispatch receipt has no active owner');
|
|
799
799
|
await this.#custody.reportFailure(attempt, status, source);
|
|
800
800
|
}
|
|
801
|
+
/** The custody (or hub lease) that issued `attempt`, or a `no-receipt` refusal. */
|
|
802
|
+
#issuingCustody(attempt) {
|
|
803
|
+
const custody = this.#hub
|
|
804
|
+
? this.#issuedBy.get(attempt)?.custody
|
|
805
|
+
: this.#custody;
|
|
806
|
+
if (!custody)
|
|
807
|
+
throw new ClaustrumConsumerError('no-receipt', 'Claustrum dispatch receipt has no active owner');
|
|
808
|
+
return custody;
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Report a provider login condition through the custody that issued the
|
|
812
|
+
* receipt; see `ClaustrumScopedCustody.reportCondition`. Bookkeeping: call it
|
|
813
|
+
* after handing back the reply, never on the request path. It resolves
|
|
814
|
+
* `skipped` after shutdown and rejects only with `no-receipt` for a receipt
|
|
815
|
+
* no live custody of this consumer issued.
|
|
816
|
+
*/
|
|
817
|
+
async reportCondition(attempt, input) {
|
|
818
|
+
if (this.#shutdown.signal.aborted)
|
|
819
|
+
return 'skipped';
|
|
820
|
+
return this.#issuingCustody(attempt).reportCondition(attempt, input);
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Clear a listed login condition through the custody that issued the
|
|
824
|
+
* receipt; see `ClaustrumScopedCustody.clearCondition`. Safe to call after
|
|
825
|
+
* every successful reply: it sends nothing unless the login is marked.
|
|
826
|
+
* Same `skipped` and `no-receipt` rules as `reportCondition`.
|
|
827
|
+
*/
|
|
828
|
+
async clearCondition(attempt) {
|
|
829
|
+
if (this.#shutdown.signal.aborted)
|
|
830
|
+
return 'skipped';
|
|
831
|
+
return this.#issuingCustody(attempt).clearCondition(attempt);
|
|
832
|
+
}
|
|
801
833
|
/**
|
|
802
834
|
* Send on a vault route. `dispatch` builds and sends the request with the
|
|
803
835
|
* receipt's token and may be called twice, so it must be able to rebuild
|
|
@@ -3,8 +3,12 @@ import { type ClaustrumLogger } from './errors.js';
|
|
|
3
3
|
import type { InsulaUsageTransport } from './insula.js';
|
|
4
4
|
import { type ClaustrumUsageReading, type ClaustrumUsageReportState, type ScopedUsageSource } from './usage.js';
|
|
5
5
|
import { type ScopedWatchSource, type WatchMode } from './watch.js';
|
|
6
|
-
type ScopedRow = Omit<ScopedInventoryRow, 'authMethod'> & {
|
|
6
|
+
type ScopedRow = Omit<ScopedInventoryRow, 'authMethod' | 'condition'> & {
|
|
7
7
|
readonly authMethod?: string;
|
|
8
|
+
readonly condition?: {
|
|
9
|
+
readonly reason: string;
|
|
10
|
+
readonly sinceMs: number;
|
|
11
|
+
};
|
|
8
12
|
};
|
|
9
13
|
type ScopedInventory = Omit<Awaited<ReturnType<ClaustrumClient['listScoped']>>, 'rows'> & {
|
|
10
14
|
readonly rows: readonly ScopedRow[];
|
|
@@ -12,13 +16,29 @@ type ScopedInventory = Omit<Awaited<ReturnType<ClaustrumClient['listScoped']>>,
|
|
|
12
16
|
/**
|
|
13
17
|
* claustrum-client adds watchScoped in 0.12.0 and reportUsageScoped in 0.14.0.
|
|
14
18
|
* Older clients keep polling and simply do not send reply quota readings.
|
|
19
|
+
* The optional login condition methods match 0.21.0 without requiring it.
|
|
15
20
|
*/
|
|
16
21
|
export type ClaustrumScopedClient = Pick<ClaustrumClient, 'getScoped' | 'reportAuthFailureScoped' | 'close'> & {
|
|
17
22
|
listScoped(enrollmentToken?: string): Promise<ScopedInventory>;
|
|
23
|
+
reportCondition?(input: {
|
|
24
|
+
credentialId: string;
|
|
25
|
+
recordVersion: number;
|
|
26
|
+
reason: string;
|
|
27
|
+
providerStatus: number;
|
|
28
|
+
actionUrl?: string;
|
|
29
|
+
enrollmentToken?: string;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
clearCondition?(input: {
|
|
32
|
+
credentialId: string;
|
|
33
|
+
recordVersion: number;
|
|
34
|
+
enrollmentToken?: string;
|
|
35
|
+
}): Promise<boolean>;
|
|
18
36
|
insula?: InsulaUsageTransport;
|
|
19
37
|
} & ScopedWatchSource & ScopedUsageSource;
|
|
20
38
|
/** The two credential types a plugin's family can hold; routing differs by type. */
|
|
21
39
|
export type VaultCredentialType = 'oauth' | 'api_key';
|
|
40
|
+
export type VaultConditionReason = 'provider_verification_required' | 'provider_ineligible';
|
|
41
|
+
export type VaultConditionOutcome = 'reported' | 'skipped' | 'unsupported' | 'failed';
|
|
22
42
|
/**
|
|
23
43
|
* Which vault rows belong to this plugin. `refreshAdapter` classifies an OAuth
|
|
24
44
|
* row by the protocol it speaks; `category` is the grant that authorizes this
|
|
@@ -69,6 +89,10 @@ export interface VaultCredential {
|
|
|
69
89
|
readonly state: string;
|
|
70
90
|
readonly email?: string;
|
|
71
91
|
readonly orgName?: string;
|
|
92
|
+
readonly condition?: {
|
|
93
|
+
readonly reason: VaultConditionReason;
|
|
94
|
+
readonly sinceMs: number;
|
|
95
|
+
};
|
|
72
96
|
}
|
|
73
97
|
/**
|
|
74
98
|
* Why a listed vault record could not be used. A closed set of fixed codes, so
|
|
@@ -339,6 +363,20 @@ export declare class ClaustrumScopedCustody {
|
|
|
339
363
|
* it. A receipt this custody did not issue is refused rather than reported.
|
|
340
364
|
*/
|
|
341
365
|
reportFailure(attempt: ClaustrumScopedAttempt, status: number, reporterSource: ClaustrumReporterSource): Promise<void>;
|
|
366
|
+
/**
|
|
367
|
+
* Report a provider login condition as bookkeeping after handing back the
|
|
368
|
+
* reply, never on the request path. Pass the receipt actually sent with it.
|
|
369
|
+
*/
|
|
370
|
+
reportCondition(attempt: ClaustrumScopedAttempt, input: {
|
|
371
|
+
reason: VaultConditionReason;
|
|
372
|
+
providerStatus: number;
|
|
373
|
+
actionUrl?: string;
|
|
374
|
+
}): Promise<VaultConditionOutcome>;
|
|
375
|
+
/**
|
|
376
|
+
* Clear a listed condition as bookkeeping after handing back a successful
|
|
377
|
+
* reply, never on the request path. Pass the receipt actually sent with it.
|
|
378
|
+
*/
|
|
379
|
+
clearCondition(attempt: ClaustrumScopedAttempt): Promise<VaultConditionOutcome>;
|
|
342
380
|
/**
|
|
343
381
|
* Watch this consumer's visible vault accounts instead of listing them on a
|
|
344
382
|
* short timer. Opens one `watchScoped` on this custody's client and calls
|
|
@@ -178,6 +178,34 @@ function rowFactsOf(row, { includeProviderIds = true } = {}) {
|
|
|
178
178
|
authMethod: metadata.authMethod,
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
+
function isVaultConditionReason(reason) {
|
|
182
|
+
return (reason === 'provider_verification_required' ||
|
|
183
|
+
reason === 'provider_ineligible');
|
|
184
|
+
}
|
|
185
|
+
function vaultConditionOf(row) {
|
|
186
|
+
const condition = row.condition;
|
|
187
|
+
if (!condition)
|
|
188
|
+
return undefined;
|
|
189
|
+
const { reason, sinceMs } = condition;
|
|
190
|
+
if (isVaultConditionReason(reason) &&
|
|
191
|
+
Number.isSafeInteger(sinceMs) &&
|
|
192
|
+
sinceMs > 0)
|
|
193
|
+
return Object.freeze({ reason, sinceMs });
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
function httpsActionUrl(actionUrl) {
|
|
197
|
+
if (typeof actionUrl !== 'string')
|
|
198
|
+
return undefined;
|
|
199
|
+
try {
|
|
200
|
+
// Keep the original spelling so the vault can enforce its own link rules.
|
|
201
|
+
if (new URL(actionUrl).protocol === 'https:')
|
|
202
|
+
return actionUrl;
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
// An unparseable link does not invalidate the condition itself.
|
|
206
|
+
}
|
|
207
|
+
return undefined;
|
|
208
|
+
}
|
|
181
209
|
/**
|
|
182
210
|
* The grants named in the vault's list reply, or undefined when it names none.
|
|
183
211
|
* Both fields must be present: a reply carrying only one of them is treated as
|
|
@@ -211,6 +239,10 @@ export class ClaustrumScopedCustody {
|
|
|
211
239
|
#logger;
|
|
212
240
|
#provenance = new WeakMap();
|
|
213
241
|
#reports = new WeakMap();
|
|
242
|
+
#conditionReports = new Map();
|
|
243
|
+
#conditionClears = new Map();
|
|
244
|
+
#conditionsUnsupported = false;
|
|
245
|
+
#pendingConditionCalls = 0;
|
|
214
246
|
#kept = new Map();
|
|
215
247
|
#keptAttempts = new WeakMap();
|
|
216
248
|
#usage;
|
|
@@ -229,8 +261,9 @@ export class ClaustrumScopedCustody {
|
|
|
229
261
|
#closed = false;
|
|
230
262
|
/** The view of the last successful `discover()`, for `watchRoster`. */
|
|
231
263
|
#discoveredView;
|
|
264
|
+
#discoveredConditions = new Map();
|
|
232
265
|
#watches = new Set();
|
|
233
|
-
#
|
|
266
|
+
#shutdownWork = new Set();
|
|
234
267
|
#warnShutdown;
|
|
235
268
|
#onDrainTimeout;
|
|
236
269
|
#disposing;
|
|
@@ -292,6 +325,7 @@ export class ClaustrumScopedCustody {
|
|
|
292
325
|
if (hasVaultHost() && !isVaultHostClient(next))
|
|
293
326
|
throw new ClaustrumUnreachableError();
|
|
294
327
|
this.#client = next;
|
|
328
|
+
this.#conditionsUnsupported = false;
|
|
295
329
|
for (const watch of this.#watches)
|
|
296
330
|
watch.restart();
|
|
297
331
|
}
|
|
@@ -372,13 +406,13 @@ export class ClaustrumScopedCustody {
|
|
|
372
406
|
phase: 'token read begin',
|
|
373
407
|
});
|
|
374
408
|
const pending = this.#readToken();
|
|
375
|
-
this.#
|
|
409
|
+
this.#shutdownWork.add(pending);
|
|
376
410
|
let value;
|
|
377
411
|
try {
|
|
378
412
|
value = await pending;
|
|
379
413
|
}
|
|
380
414
|
finally {
|
|
381
|
-
this.#
|
|
415
|
+
this.#shutdownWork.delete(pending);
|
|
382
416
|
if (phaseDiagnostics.hasSubscribers)
|
|
383
417
|
phaseDiagnostics.publish({
|
|
384
418
|
logger: this.#logger,
|
|
@@ -438,6 +472,11 @@ export class ClaustrumScopedCustody {
|
|
|
438
472
|
async discover(signal) {
|
|
439
473
|
const inventory = await this.#list(signal);
|
|
440
474
|
this.#discoveredView = inventory.view;
|
|
475
|
+
this.#discoveredConditions.clear();
|
|
476
|
+
for (const { credentialId, condition } of inventory.credentials) {
|
|
477
|
+
if (condition)
|
|
478
|
+
this.#discoveredConditions.set(credentialId, condition);
|
|
479
|
+
}
|
|
441
480
|
return inventory;
|
|
442
481
|
}
|
|
443
482
|
async #list(signal) {
|
|
@@ -514,6 +553,7 @@ export class ClaustrumScopedCustody {
|
|
|
514
553
|
});
|
|
515
554
|
continue;
|
|
516
555
|
}
|
|
556
|
+
const condition = vaultConditionOf(row);
|
|
517
557
|
credentials.push(Object.freeze({
|
|
518
558
|
credentialId: row.id,
|
|
519
559
|
credentialType: type,
|
|
@@ -524,6 +564,7 @@ export class ClaustrumScopedCustody {
|
|
|
524
564
|
state: row.state,
|
|
525
565
|
...(row.email !== undefined && { email: row.email }),
|
|
526
566
|
...(row.orgName !== undefined && { orgName: row.orgName }),
|
|
567
|
+
...(condition && { condition }),
|
|
527
568
|
}));
|
|
528
569
|
}
|
|
529
570
|
for (const record of skipped)
|
|
@@ -926,6 +967,101 @@ export class ClaustrumScopedCustody {
|
|
|
926
967
|
throw error;
|
|
927
968
|
}
|
|
928
969
|
}
|
|
970
|
+
/**
|
|
971
|
+
* Report a provider login condition as bookkeeping after handing back the
|
|
972
|
+
* reply, never on the request path. Pass the receipt actually sent with it.
|
|
973
|
+
*/
|
|
974
|
+
reportCondition(attempt, input) {
|
|
975
|
+
const provenance = this.#provenance.get(attempt);
|
|
976
|
+
if (!provenance)
|
|
977
|
+
return Promise.reject(new ClaustrumConsumerError('no-receipt', 'Claustrum condition report requires an original dispatch receipt'));
|
|
978
|
+
const { reason, providerStatus } = input ?? {};
|
|
979
|
+
if (this.#closed ||
|
|
980
|
+
this.#keptAttempts.has(attempt) ||
|
|
981
|
+
providerStatus !== 403 ||
|
|
982
|
+
!isVaultConditionReason(reason))
|
|
983
|
+
return Promise.resolve('skipped');
|
|
984
|
+
const { credentialId, recordVersion } = attempt;
|
|
985
|
+
const actionUrl = reason === 'provider_verification_required'
|
|
986
|
+
? httpsActionUrl(input.actionUrl)
|
|
987
|
+
: undefined;
|
|
988
|
+
return this.#conditionOnce(this.#conditionReports, JSON.stringify([credentialId, recordVersion, reason]), { credentialId, recordVersion, reason }, (client) => client.reportCondition?.({
|
|
989
|
+
credentialId,
|
|
990
|
+
recordVersion,
|
|
991
|
+
reason,
|
|
992
|
+
providerStatus,
|
|
993
|
+
...(actionUrl !== undefined && { actionUrl }),
|
|
994
|
+
enrollmentToken: provenance.token,
|
|
995
|
+
}));
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* Clear a listed condition as bookkeeping after handing back a successful
|
|
999
|
+
* reply, never on the request path. Pass the receipt actually sent with it.
|
|
1000
|
+
*/
|
|
1001
|
+
clearCondition(attempt) {
|
|
1002
|
+
const provenance = this.#provenance.get(attempt);
|
|
1003
|
+
if (!provenance)
|
|
1004
|
+
return Promise.reject(new ClaustrumConsumerError('no-receipt', 'Claustrum condition clear requires an original dispatch receipt'));
|
|
1005
|
+
if (this.#closed || this.#keptAttempts.has(attempt))
|
|
1006
|
+
return Promise.resolve('skipped');
|
|
1007
|
+
const { credentialId, recordVersion } = attempt;
|
|
1008
|
+
const condition = this.#discoveredConditions.get(credentialId);
|
|
1009
|
+
if (!condition)
|
|
1010
|
+
return Promise.resolve('skipped');
|
|
1011
|
+
return this.#conditionOnce(this.#conditionClears, JSON.stringify([credentialId, condition.sinceMs]), { credentialId, recordVersion, reason: condition.reason }, (client) => client.clearCondition?.({
|
|
1012
|
+
credentialId,
|
|
1013
|
+
recordVersion,
|
|
1014
|
+
enrollmentToken: provenance.token,
|
|
1015
|
+
}));
|
|
1016
|
+
}
|
|
1017
|
+
#conditionOnce(outcomes, key, details, send) {
|
|
1018
|
+
const previous = outcomes.get(key);
|
|
1019
|
+
if (previous)
|
|
1020
|
+
return previous;
|
|
1021
|
+
if (this.#conditionsUnsupported)
|
|
1022
|
+
return Promise.resolve('unsupported');
|
|
1023
|
+
// A lost reply may already have committed. Keep the result so a later call
|
|
1024
|
+
// for the same key does not retry it, even after client replacement.
|
|
1025
|
+
const pending = Promise.resolve().then(async () => {
|
|
1026
|
+
const client = this.#client;
|
|
1027
|
+
if (this.#conditionsUnsupported)
|
|
1028
|
+
return 'unsupported';
|
|
1029
|
+
try {
|
|
1030
|
+
const sent = send(client);
|
|
1031
|
+
if (!sent)
|
|
1032
|
+
return 'unsupported';
|
|
1033
|
+
if ((await sent) === false)
|
|
1034
|
+
this.#debugCondition('scoped login condition not cleared', details);
|
|
1035
|
+
return 'reported';
|
|
1036
|
+
}
|
|
1037
|
+
catch (error) {
|
|
1038
|
+
if (error instanceof ClaustrumCredentialError &&
|
|
1039
|
+
error.code === 'unknown_method') {
|
|
1040
|
+
if (client === this.#client)
|
|
1041
|
+
this.#conditionsUnsupported = true;
|
|
1042
|
+
return 'unsupported';
|
|
1043
|
+
}
|
|
1044
|
+
this.#debugCondition('scoped login condition update failed', details);
|
|
1045
|
+
return 'failed';
|
|
1046
|
+
}
|
|
1047
|
+
});
|
|
1048
|
+
outcomes.set(key, pending);
|
|
1049
|
+
this.#pendingConditionCalls++;
|
|
1050
|
+
this.#shutdownWork.add(pending);
|
|
1051
|
+
void pending.then(() => {
|
|
1052
|
+
this.#pendingConditionCalls--;
|
|
1053
|
+
this.#shutdownWork.delete(pending);
|
|
1054
|
+
});
|
|
1055
|
+
return pending;
|
|
1056
|
+
}
|
|
1057
|
+
#debugCondition(message, details) {
|
|
1058
|
+
try {
|
|
1059
|
+
this.#logger.debug(message, details);
|
|
1060
|
+
}
|
|
1061
|
+
catch {
|
|
1062
|
+
// A caller's logger must not turn bookkeeping into a rejection.
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
929
1065
|
/**
|
|
930
1066
|
* Watch this consumer's visible vault accounts instead of listing them on a
|
|
931
1067
|
* short timer. Opens one `watchScoped` on this custody's client and calls
|
|
@@ -1046,16 +1182,17 @@ export class ClaustrumScopedCustody {
|
|
|
1046
1182
|
this.#watches.clear();
|
|
1047
1183
|
this.#kept.clear();
|
|
1048
1184
|
const usage = this.#usage.close();
|
|
1185
|
+
const keepClientOpen = usage !== undefined || this.#pendingConditionCalls > 0;
|
|
1049
1186
|
if (usage) {
|
|
1050
|
-
this.#
|
|
1051
|
-
void usage.then(() => this.#
|
|
1187
|
+
this.#shutdownWork.add(usage);
|
|
1188
|
+
void usage.then(() => this.#shutdownWork.delete(usage));
|
|
1052
1189
|
}
|
|
1053
|
-
|
|
1190
|
+
if (!keepClientOpen)
|
|
1054
1191
|
this.#client.close();
|
|
1055
|
-
this.#disposing = drainShutdown(this.#
|
|
1192
|
+
this.#disposing = drainShutdown(this.#shutdownWork, (count) => (this.#onDrainTimeout ?? this.#warnShutdown)(count)).finally(() => {
|
|
1056
1193
|
this.#usage.drop();
|
|
1057
1194
|
this.#usageServed.clear();
|
|
1058
|
-
if (
|
|
1195
|
+
if (keepClientOpen)
|
|
1059
1196
|
this.#client.close();
|
|
1060
1197
|
});
|
|
1061
1198
|
}
|
|
@@ -55,6 +55,8 @@ async function request(operation) {
|
|
|
55
55
|
function wrapHostClient(client) {
|
|
56
56
|
const watchScoped = client.watchScoped?.bind(client);
|
|
57
57
|
const reportUsageScoped = client.reportUsageScoped?.bind(client);
|
|
58
|
+
const reportCondition = client.reportCondition?.bind(client);
|
|
59
|
+
const clearCondition = client.clearCondition?.bind(client);
|
|
58
60
|
return {
|
|
59
61
|
listScoped: (...args) => request(() => client.listScoped(...args)),
|
|
60
62
|
getScoped: (...args) => request(() => client.getScoped(...args)),
|
|
@@ -77,6 +79,12 @@ function wrapHostClient(client) {
|
|
|
77
79
|
...(reportUsageScoped && {
|
|
78
80
|
reportUsageScoped: (...args) => request(() => reportUsageScoped(...args)),
|
|
79
81
|
}),
|
|
82
|
+
...(reportCondition && {
|
|
83
|
+
reportCondition: (...args) => request(() => reportCondition(...args)),
|
|
84
|
+
}),
|
|
85
|
+
...(clearCondition && {
|
|
86
|
+
clearCondition: (...args) => request(() => clearCondition(...args)),
|
|
87
|
+
}),
|
|
80
88
|
...(client.insula && {
|
|
81
89
|
insula: wrapInsula(client.insula),
|
|
82
90
|
}),
|
|
@@ -111,12 +111,13 @@ export interface ClaustrumHubMemberOptions<_Q = QuotaObservation> {
|
|
|
111
111
|
logger?: ClaustrumLogger;
|
|
112
112
|
}
|
|
113
113
|
/** What a lease may do with the shared custody. */
|
|
114
|
-
export type ClaustrumLeasedCustody = Pick<ClaustrumScopedCustody, 'authorize' | 'reportFailure' | 'reportUsage' | 'usageReportState' | 'forget' | 'keptReceiptState'>;
|
|
114
|
+
export type ClaustrumLeasedCustody = Pick<ClaustrumScopedCustody, 'authorize' | 'reportFailure' | 'reportCondition' | 'clearCondition' | 'reportUsage' | 'usageReportState' | 'forget' | 'keptReceiptState'>;
|
|
115
115
|
/**
|
|
116
116
|
* One acquisition of the hub's shared custody. `custody` throws `closed`
|
|
117
117
|
* after `release()`, and once the connection it belongs to ended for any
|
|
118
118
|
* reason, vault mode going off included. Best-effort `reportUsage` instead
|
|
119
|
-
* ignores reports through an ended lease
|
|
119
|
+
* ignores reports through an ended lease, and the condition calls resolve
|
|
120
|
+
* `skipped` through one. `release()` is idempotent.
|
|
120
121
|
*/
|
|
121
122
|
export interface CustodyLease {
|
|
122
123
|
readonly custody: ClaustrumLeasedCustody;
|
|
@@ -533,6 +533,16 @@ export class ClaustrumDiscoveryHub {
|
|
|
533
533
|
check();
|
|
534
534
|
return custody.reportFailure(attempt, status, source);
|
|
535
535
|
},
|
|
536
|
+
reportCondition: async (attempt, input) => {
|
|
537
|
+
if (state.released || generation.ended)
|
|
538
|
+
return 'skipped';
|
|
539
|
+
return custody.reportCondition(attempt, input);
|
|
540
|
+
},
|
|
541
|
+
clearCondition: async (attempt) => {
|
|
542
|
+
if (state.released || generation.ended)
|
|
543
|
+
return 'skipped';
|
|
544
|
+
return custody.clearCondition(attempt);
|
|
545
|
+
},
|
|
536
546
|
reportUsage: (input) => {
|
|
537
547
|
if (!state.released && !generation.ended)
|
|
538
548
|
custody.reportUsage(input);
|
|
@@ -3,7 +3,7 @@ import type { ClaustrumScopedClient } from './custody.js';
|
|
|
3
3
|
export { ClaustrumCredentialError, type ClaustrumReporterSource, type EnrollmentTokenFile, } from '@cortexkit/claustrum-client';
|
|
4
4
|
export { ClaustrumUnreachableError, classifyVaultFailure, VAULT_FAILURE_CLASSES, type VaultFailureClass, } from './availability.js';
|
|
5
5
|
export { ClaustrumConsumer, type ClaustrumConsumerOptions, type ClaustrumWatchState, DEFAULT_CONNECT_TIMEOUT_MS, type SendOptions, } from './consumer.js';
|
|
6
|
-
export { type AccountIdentitySource, type ClassifyingClaustrumFamily, type ClaustrumFamily, type ClaustrumFamilyInput, type ClaustrumRosterWatch, type ClaustrumRosterWatchOptions, type ClaustrumScopedAttempt, type ClaustrumScopedClient, ClaustrumScopedCustody, type ClaustrumScopedIdentity, decideScopedRetryAfter401, type IdentityParser, isScopedCredentialRotation, KEPT_RECEIPT_MARGIN_MS, type KeptReceiptState, type ScopedRetryReason, SERVING_MARGIN_MS, type SkippedVaultReason, type SkippedVaultRecord, VAULT_RECEIPT_WAIT_MS, VAULT_YOUNG_OUTAGE_MS, type VaultCredential, type VaultCredentialType, type VaultGrantReach, type VaultGrantTuple, type VaultInventory, type VaultRowFacts, } from './custody.js';
|
|
6
|
+
export { type AccountIdentitySource, type ClassifyingClaustrumFamily, type ClaustrumFamily, type ClaustrumFamilyInput, type ClaustrumRosterWatch, type ClaustrumRosterWatchOptions, type ClaustrumScopedAttempt, type ClaustrumScopedClient, ClaustrumScopedCustody, type ClaustrumScopedIdentity, decideScopedRetryAfter401, type IdentityParser, isScopedCredentialRotation, KEPT_RECEIPT_MARGIN_MS, type KeptReceiptState, type ScopedRetryReason, SERVING_MARGIN_MS, type SkippedVaultReason, type SkippedVaultRecord, VAULT_RECEIPT_WAIT_MS, VAULT_YOUNG_OUTAGE_MS, type VaultConditionOutcome, type VaultConditionReason, type VaultCredential, type VaultCredentialType, type VaultGrantReach, type VaultGrantTuple, type VaultInventory, type VaultRowFacts, } from './custody.js';
|
|
7
7
|
export { type ClaustrumEnrollmentClient, type ClaustrumEnrollmentConnection, type ClaustrumEnrollmentDisconnectResult, ClaustrumEnrollmentManager, type ClaustrumEnrollmentPaths, type ClaustrumEnrollmentResetResult, type ClaustrumEnrollmentStatus, type ClaustrumRequestedGrant, classifyEnrollmentError, connectClaustrumEnrollmentClient, disconnectClaustrumEnrollment, type EnrollmentDisposition, enrollmentAuthority, enrollmentName, getClaustrumEnrollmentPaths, hostEnrollmentPaths, RETRYABLE_ENROLLMENT_CODES, readClaustrumEnrollmentStatus, readClaustrumEnrollmentToken, resetClaustrumEnrollmentState, TERMINAL_ENROLLMENT_CODES, validEnrollmentDisplayName, validEnrollmentRequestedGrants, vaultAuthority, } from './enrollment.js';
|
|
8
8
|
export { ClaustrumConsumerError, type ClaustrumConsumerFailureKind, type ClaustrumLogger, } from './errors.js';
|
|
9
9
|
export { connectVaultHost, hasVaultHost, VAULT_HOST_CONNECT_REFUSAL, VAULT_HOST_STATUS, } from './host.js';
|
|
@@ -184,8 +184,6 @@ function candidateView(candidates) {
|
|
|
184
184
|
accounts.push({ account_id: accountId, credential_id: credentialId });
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
if (accounts.length === 0)
|
|
188
|
-
return undefined;
|
|
189
187
|
const lines = accounts
|
|
190
188
|
.map(({ account_id, credential_id }) => Buffer.from(`${account_id}\t${credential_id}\n`, 'utf8'))
|
|
191
189
|
.sort(Buffer.compare);
|
|
@@ -290,7 +288,11 @@ export async function askRouting(input) {
|
|
|
290
288
|
request.warm_credential = warmCredentialId;
|
|
291
289
|
}
|
|
292
290
|
const candidates = candidateView(input.candidates);
|
|
293
|
-
|
|
291
|
+
// A first ask with nothing usable sends no view, so routing is unrestricted
|
|
292
|
+
// as before. A continue ask always sends one: an empty view after the only
|
|
293
|
+
// account was refused tells routing nothing is left to offer, where a
|
|
294
|
+
// missing view would let it hand back the refused account.
|
|
295
|
+
if (candidates.accounts.length > 0 || request.mode === 'continue')
|
|
294
296
|
request.candidates = candidates;
|
|
295
297
|
const pending = accountFor.call(handle, request, { deadlineMs });
|
|
296
298
|
if (!isObject(pending) || typeof pending.then !== 'function')
|