@cortexkit/opencode-antigravity-auth 3.0.42 → 3.1.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/README.md +11 -0
- package/dist/cli.js +191 -6
- package/dist/cli.js.map +3 -3
- package/dist/cli.meta.json +19 -19
- package/dist/index.js +725 -264
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +88 -80
- package/dist/server.js +778 -317
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +4 -0
- package/dist/src/common-auth-embedded/claustrum/custody.js +147 -2
- package/dist/src/common-auth-embedded/claustrum/hub.js +47 -1
- package/dist/src/common-auth-embedded/claustrum/index.d.ts +1 -1
- package/dist/src/common-auth-embedded/claustrum/index.js +1 -1
- package/dist/src/common-auth-embedded/routing-accessor/index.d.ts +34 -9
- package/dist/src/common-auth-embedded/routing-accessor/index.js +65 -8
- package/dist/src/common-auth-embedded/settings/edit.d.ts +1 -0
- package/dist/src/common-auth-embedded/settings/edit.js +48 -2
- package/dist/src/common-auth-embedded/settings/handle.d.ts +2 -1
- package/dist/src/common-auth-embedded/settings/index.d.ts +1 -0
- package/dist/src/common-auth-embedded/settings/update.d.ts +14 -0
- package/dist/src/common-auth-embedded/settings/update.js +28 -9
- package/dist/src/common-auth-embedded/source-output.json +52 -43
- package/dist/src/plugin/__fixtures__/release-model-ids.d.ts.map +1 -1
- package/dist/src/plugin/__fixtures__/release-model-ids.js +1 -0
- package/dist/src/plugin/__fixtures__/release-model-ids.js.map +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.d.ts +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.js +4 -4
- package/dist/src/plugin/account-access.js +1 -1
- package/dist/src/plugin/account-access.js.map +1 -1
- package/dist/src/plugin/catalog.d.ts.map +1 -1
- package/dist/src/plugin/catalog.js +4 -2
- package/dist/src/plugin/catalog.js.map +1 -1
- package/dist/src/plugin/config/models.d.ts +9 -0
- package/dist/src/plugin/config/models.d.ts.map +1 -1
- package/dist/src/plugin/config/models.js +18 -0
- package/dist/src/plugin/config/models.js.map +1 -1
- package/dist/src/plugin/config/updater.js +2 -2
- package/dist/src/plugin/config/updater.js.map +1 -1
- package/dist/src/plugin/core/streaming/terminal-event.d.ts +14 -0
- package/dist/src/plugin/core/streaming/terminal-event.d.ts.map +1 -0
- package/dist/src/plugin/core/streaming/terminal-event.js +39 -0
- package/dist/src/plugin/core/streaming/terminal-event.js.map +1 -0
- package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -1
- package/dist/src/plugin/core/streaming/transformer.js +1 -13
- package/dist/src/plugin/core/streaming/transformer.js.map +1 -1
- package/dist/src/plugin/ga-location-services.js +1 -1
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/index.js +1 -1
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +101 -47
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/search.d.ts +7 -0
- package/dist/src/plugin/search.d.ts.map +1 -1
- package/dist/src/plugin/search.js +9 -15
- package/dist/src/plugin/search.js.map +1 -1
- package/dist/src/plugin/session-context.d.ts +1 -1
- package/dist/src/plugin/session-context.d.ts.map +1 -1
- package/dist/src/plugin/session-context.js +2 -5
- package/dist/src/plugin/session-context.js.map +1 -1
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +59 -11
- package/dist/src/plugin/shared/request-services.js.map +1 -1
- package/dist/src/plugin/shared/vault-routing.d.ts +9 -1
- package/dist/src/plugin/shared/vault-routing.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-routing.js +34 -12
- package/dist/src/plugin/shared/vault-routing.js.map +1 -1
- package/dist/tui-build-map.json +1 -1
- package/dist/tui-ga-build-map.json +1 -1
- package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +4 -0
- package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +1 -1
- package/dist/types/src/common-auth-embedded/routing-accessor/index.d.ts +34 -9
- package/dist/types/src/plugin/catalog.d.ts.map +1 -1
- package/dist/types/src/plugin/config/models.d.ts +9 -0
- package/dist/types/src/plugin/config/models.d.ts.map +1 -1
- package/dist/types/src/plugin/core/streaming/terminal-event.d.ts +14 -0
- package/dist/types/src/plugin/core/streaming/terminal-event.d.ts.map +1 -0
- package/dist/types/src/plugin/core/streaming/transformer.d.ts.map +1 -1
- package/dist/types/src/plugin/request.d.ts.map +1 -1
- package/dist/types/src/plugin/search.d.ts +7 -0
- package/dist/types/src/plugin/search.d.ts.map +1 -1
- package/dist/types/src/plugin/session-context.d.ts +1 -1
- package/dist/types/src/plugin/session-context.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-routing.d.ts +9 -1
- package/dist/types/src/plugin/shared/vault-routing.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/common-auth-embedded/claustrum/custody.d.ts +4 -0
- package/src/common-auth-embedded/claustrum/custody.js +147 -2
- package/src/common-auth-embedded/claustrum/hub.js +47 -1
- package/src/common-auth-embedded/claustrum/index.d.ts +1 -1
- package/src/common-auth-embedded/claustrum/index.js +1 -1
- package/src/common-auth-embedded/routing-accessor/index.d.ts +34 -9
- package/src/common-auth-embedded/routing-accessor/index.js +65 -8
- package/src/common-auth-embedded/settings/edit.d.ts +1 -0
- package/src/common-auth-embedded/settings/edit.js +48 -2
- package/src/common-auth-embedded/settings/handle.d.ts +2 -1
- package/src/common-auth-embedded/settings/index.d.ts +1 -0
- package/src/common-auth-embedded/settings/update.d.ts +14 -0
- package/src/common-auth-embedded/settings/update.js +28 -9
- package/src/common-auth-embedded/source-output.json +52 -43
package/README.md
CHANGED
|
@@ -6,6 +6,17 @@ One package for OpenCode 1.x (V1) and OpenCode 2.x general availability (GA), wi
|
|
|
6
6
|
|
|
7
7
|
This guide describes the current source tree, not an announcement that an unreleased version is available on npm. See the [project overview](../../README.md) and [current models and evidence caveats](docs/MODEL-VARIANTS.md): Gemini 4 Carbon and Argon offer Low, Medium and High; their MEDIUM/HIGH thinking levels and toolConfig omission remain unverified live. Carbon defaults to 262,144 output tokens and uses the ordinary Gemini quota pool until a Carbon bucket is observed.
|
|
8
8
|
|
|
9
|
+
Gemini 4 Hydrogen adds Low, Medium and High (default) on OpenCode 1, and Low,
|
|
10
|
+
Medium, High (default) and XHigh on OpenCode 2 and Pi, requiring Pro or Ultra in
|
|
11
|
+
Antigravity. OpenCode 1 omits XHigh because its built-in Google library
|
|
12
|
+
(`@ai-sdk/google`) accepts only `minimal`/`low`/`medium`/`high` for `thinkingLevel`,
|
|
13
|
+
so XHigh would never reach the plugin. Hydrogen sends the native CLI's 262,144
|
|
14
|
+
output-token limit and numeric `100` for XHigh. A live probe on 13 November saw
|
|
15
|
+
all four levels accepted, each thinking longer than the one below; the server
|
|
16
|
+
does not name the level it served, so thinking depth is the evidence.
|
|
17
|
+
Hydrogen uses the ordinary Gemini quota pool; no Hydrogen-specific allowance has
|
|
18
|
+
been observed.
|
|
19
|
+
|
|
9
20
|
## Host requirements and entries
|
|
10
21
|
|
|
11
22
|
OpenCode 1 from 1.18.4 (the first release with OpenTUI 0.4.5), or OpenCode 2 from 2.0.22.
|
package/dist/cli.js
CHANGED
|
@@ -5825,8 +5825,8 @@ var AGY_CLI_VERSION, AGY_CLI_CHANGE_LIST;
|
|
|
5825
5825
|
var init_fingerprint = __esm({
|
|
5826
5826
|
"../core/dist/fingerprint.js"() {
|
|
5827
5827
|
"use strict";
|
|
5828
|
-
AGY_CLI_VERSION = "1.
|
|
5829
|
-
AGY_CLI_CHANGE_LIST = "
|
|
5828
|
+
AGY_CLI_VERSION = "1.5.8";
|
|
5829
|
+
AGY_CLI_CHANGE_LIST = "1020628950";
|
|
5830
5830
|
}
|
|
5831
5831
|
});
|
|
5832
5832
|
|
|
@@ -5851,6 +5851,8 @@ function getResolverAliasMap() {
|
|
|
5851
5851
|
}
|
|
5852
5852
|
function getQuotaGroupForModel(modelId, hasArgonPool = false) {
|
|
5853
5853
|
const normalized = modelId.toLowerCase();
|
|
5854
|
+
if (isGeminiHydrogenModel(normalized))
|
|
5855
|
+
return "gemini";
|
|
5854
5856
|
if (isGeminiCarbonModel(normalized))
|
|
5855
5857
|
return "gemini";
|
|
5856
5858
|
if (isGeminiArgonModel(normalized))
|
|
@@ -5868,6 +5870,9 @@ function isGeminiArgonModel(model) {
|
|
|
5868
5870
|
function isGeminiCarbonModel(model) {
|
|
5869
5871
|
return /^(?:antigravity-)?gemini-4-carbon(?:-(?:low|medium|high))?$/.test(model.toLowerCase());
|
|
5870
5872
|
}
|
|
5873
|
+
function isGeminiHydrogenModel(model) {
|
|
5874
|
+
return /^(?:antigravity-)?gemini-4-hydrogen(?:-(?:low|medium|high|xhigh))?$/.test(model.toLowerCase());
|
|
5875
|
+
}
|
|
5871
5876
|
var DEFAULT_MODALITIES, MODEL_RELEASE_DATE, DEFAULT_COST, DEFAULT_OPTIONS, ALL_MODEL_DEFINITIONS, RESOLVER_ALIASES, QUOTA_GROUP_BY_MODEL_ID, ANTIGRAVITY_OPENCODE_MODEL_IDS, OPENCODE_MODEL_DEFINITIONS;
|
|
5872
5877
|
var init_model_registry = __esm({
|
|
5873
5878
|
"../core/dist/model-registry.js"() {
|
|
@@ -5880,6 +5885,18 @@ var init_model_registry = __esm({
|
|
|
5880
5885
|
DEFAULT_COST = { input: 0, output: 0 };
|
|
5881
5886
|
DEFAULT_OPTIONS = {};
|
|
5882
5887
|
ALL_MODEL_DEFINITIONS = {
|
|
5888
|
+
"antigravity-gemini-4-hydrogen": defineModel("antigravity-gemini-4-hydrogen", {
|
|
5889
|
+
name: "Gemini 4 Hydrogen (Antigravity)",
|
|
5890
|
+
reasoning: true,
|
|
5891
|
+
limit: { context: 1048576, output: 262144 },
|
|
5892
|
+
modalities: DEFAULT_MODALITIES,
|
|
5893
|
+
variants: {
|
|
5894
|
+
low: { thinkingLevel: "low" },
|
|
5895
|
+
medium: { thinkingLevel: "medium" },
|
|
5896
|
+
high: { thinkingLevel: "high" },
|
|
5897
|
+
xhigh: { thinkingLevel: "xhigh" }
|
|
5898
|
+
}
|
|
5899
|
+
}),
|
|
5883
5900
|
"antigravity-gemini-4-argon": defineModel("antigravity-gemini-4-argon", {
|
|
5884
5901
|
name: "Gemini 4 Argon (Antigravity)",
|
|
5885
5902
|
reasoning: true,
|
|
@@ -6014,6 +6031,7 @@ var init_model_registry = __esm({
|
|
|
6014
6031
|
ANTIGRAVITY_OPENCODE_MODEL_IDS = [
|
|
6015
6032
|
"antigravity-gemini-4-argon",
|
|
6016
6033
|
"antigravity-gemini-4-carbon",
|
|
6034
|
+
"antigravity-gemini-4-hydrogen",
|
|
6017
6035
|
"antigravity-gemini-3.8-flash",
|
|
6018
6036
|
"antigravity-gemini-3.1-flash-image",
|
|
6019
6037
|
"antigravity-claude-sonnet-5-5",
|
|
@@ -7138,6 +7156,7 @@ Host: ${targetHost}:${targetPort}\r
|
|
|
7138
7156
|
const tlsOptions = {
|
|
7139
7157
|
socket: proxySocket,
|
|
7140
7158
|
servername: targetHost,
|
|
7159
|
+
ALPNProtocols: ["http/1.1"],
|
|
7141
7160
|
signal: signal ?? void 0
|
|
7142
7161
|
};
|
|
7143
7162
|
const tlsSocket = tls.connect(tlsOptions);
|
|
@@ -7163,6 +7182,7 @@ async function connectDirect(targetUrl, timeoutMs, signal, onDebug) {
|
|
|
7163
7182
|
host: targetUrl.hostname,
|
|
7164
7183
|
port: Number(targetUrl.port || DEFAULT_HTTPS_PORT),
|
|
7165
7184
|
servername: targetUrl.hostname,
|
|
7185
|
+
ALPNProtocols: ["http/1.1"],
|
|
7166
7186
|
signal: signal ?? void 0
|
|
7167
7187
|
};
|
|
7168
7188
|
const socket = tls.connect(tlsOptions);
|
|
@@ -18616,7 +18636,7 @@ function grantReachOf(listed) {
|
|
|
18616
18636
|
tuples: Object.freeze(grantTuples.map(({ selectorKind, selector, operation }) => Object.freeze({ selectorKind, selector, operation })))
|
|
18617
18637
|
});
|
|
18618
18638
|
}
|
|
18619
|
-
var defaultLogger, phaseDiagnostics, SERVING_MARGIN_MS, KEPT_RECEIPT_MARGIN_MS, ClaustrumScopedCustody;
|
|
18639
|
+
var defaultLogger, phaseDiagnostics, SERVING_MARGIN_MS, KEPT_RECEIPT_MARGIN_MS, VAULT_RECEIPT_WAIT_MS, VAULT_YOUNG_OUTAGE_MS, ClaustrumScopedCustody;
|
|
18620
18640
|
var init_custody = __esm({
|
|
18621
18641
|
"../core/dist/common-auth-embedded/claustrum/custody.js"() {
|
|
18622
18642
|
"use strict";
|
|
@@ -18633,6 +18653,8 @@ var init_custody = __esm({
|
|
|
18633
18653
|
phaseDiagnostics = channel("common-auth.claustrum.phases");
|
|
18634
18654
|
SERVING_MARGIN_MS = 3e5;
|
|
18635
18655
|
KEPT_RECEIPT_MARGIN_MS = 6e4;
|
|
18656
|
+
VAULT_RECEIPT_WAIT_MS = 1e4;
|
|
18657
|
+
VAULT_YOUNG_OUTAGE_MS = 6e4;
|
|
18636
18658
|
ClaustrumScopedCustody = class {
|
|
18637
18659
|
#client;
|
|
18638
18660
|
#readToken;
|
|
@@ -18650,7 +18672,10 @@ var init_custody = __esm({
|
|
|
18650
18672
|
#setTimeout;
|
|
18651
18673
|
#clearTimeout;
|
|
18652
18674
|
#outage = false;
|
|
18675
|
+
#outageSince = 0;
|
|
18676
|
+
#outageWaitSpent = false;
|
|
18653
18677
|
#outageError = new ClaustrumUnreachableError();
|
|
18678
|
+
#receiptWaits = /* @__PURE__ */ new Map();
|
|
18654
18679
|
#probeTimer;
|
|
18655
18680
|
#probing = false;
|
|
18656
18681
|
#lastProbeAt = -Infinity;
|
|
@@ -18726,6 +18751,8 @@ var init_custody = __esm({
|
|
|
18726
18751
|
if (this.#closed || this.#outage)
|
|
18727
18752
|
return;
|
|
18728
18753
|
this.#outage = true;
|
|
18754
|
+
this.#outageSince = this.#now();
|
|
18755
|
+
this.#outageWaitSpent = false;
|
|
18729
18756
|
this.#outageError = error instanceof ClaustrumCredentialError5 ? error : new ClaustrumUnreachableError(error instanceof ClaustrumUnreachableError ? error.reason : void 0);
|
|
18730
18757
|
this.#logger.warn("serving kept vault receipt", { reason: "unreachable" });
|
|
18731
18758
|
this.#scheduleProbe();
|
|
@@ -19000,9 +19027,10 @@ var init_custody = __esm({
|
|
|
19000
19027
|
/** Ask the vault while reachable; retain one validated receipt in memory only. */
|
|
19001
19028
|
async authorize(identity3, signal, routeId = "vault") {
|
|
19002
19029
|
this.#check(signal);
|
|
19030
|
+
const startedAt = this.#now();
|
|
19003
19031
|
const { credentialId, credentialType, accountIdentity } = identity3;
|
|
19004
19032
|
let kept = this.#kept.get(credentialId);
|
|
19005
|
-
if (kept && (kept.attempt.credentialType !== credentialType || kept.attempt.expectedAccountIdentity !== accountIdentity)) {
|
|
19033
|
+
if (kept && (kept.attempt.credentialType !== credentialType || kept.attempt.expectedAccountIdentity !== accountIdentity || !this.#usable(kept.attempt))) {
|
|
19006
19034
|
this.forget(credentialId);
|
|
19007
19035
|
kept = void 0;
|
|
19008
19036
|
}
|
|
@@ -19019,7 +19047,18 @@ var init_custody = __esm({
|
|
|
19019
19047
|
return this.#serveKept(credentialId, kept, token, routeId);
|
|
19020
19048
|
}
|
|
19021
19049
|
try {
|
|
19022
|
-
|
|
19050
|
+
let attempt;
|
|
19051
|
+
try {
|
|
19052
|
+
const recovering = this.#outage && this.#receiptWaits.has(this.#receiptWaitKey({ credentialId, credentialType, accountIdentity }, token));
|
|
19053
|
+
if (recovering)
|
|
19054
|
+
throw this.#outageError;
|
|
19055
|
+
attempt = await this.#authorizeFresh({ credentialId, credentialType, accountIdentity }, token, signal);
|
|
19056
|
+
} catch (error) {
|
|
19057
|
+
this.#check(signal);
|
|
19058
|
+
if (classifyVaultFailure(error) !== "unreachable" || kept)
|
|
19059
|
+
throw error;
|
|
19060
|
+
attempt = await this.#waitForReceipt({ credentialId, credentialType, accountIdentity }, token, startedAt, error, signal);
|
|
19061
|
+
}
|
|
19023
19062
|
this.#kept.set(credentialId, { attempt, routeId, since: null });
|
|
19024
19063
|
this.#usageServed.set(credentialId, { ...identity3 });
|
|
19025
19064
|
return attempt;
|
|
@@ -19032,6 +19071,109 @@ var init_custody = __esm({
|
|
|
19032
19071
|
return this.#serveKept(credentialId, kept, token, routeId, error);
|
|
19033
19072
|
}
|
|
19034
19073
|
}
|
|
19074
|
+
#receiptWaitKey(identity3, token) {
|
|
19075
|
+
return JSON.stringify([
|
|
19076
|
+
identity3.credentialId,
|
|
19077
|
+
identity3.credentialType,
|
|
19078
|
+
identity3.accountIdentity,
|
|
19079
|
+
token
|
|
19080
|
+
]);
|
|
19081
|
+
}
|
|
19082
|
+
async #waitForReceipt(identity3, token, startedAt, error, signal) {
|
|
19083
|
+
const remaining = VAULT_RECEIPT_WAIT_MS - (this.#now() - startedAt);
|
|
19084
|
+
if (remaining <= 0 || this.#outageWaitSpent || this.#now() - this.#outageSince >= VAULT_YOUNG_OUTAGE_MS)
|
|
19085
|
+
throw error;
|
|
19086
|
+
const key = this.#receiptWaitKey(identity3, token);
|
|
19087
|
+
let wait2 = this.#receiptWaits.get(key);
|
|
19088
|
+
if (!wait2) {
|
|
19089
|
+
const controller = new AbortController();
|
|
19090
|
+
const created = {
|
|
19091
|
+
controller,
|
|
19092
|
+
users: 0,
|
|
19093
|
+
error,
|
|
19094
|
+
pending: Promise.resolve().then(async () => {
|
|
19095
|
+
let delay3 = 250;
|
|
19096
|
+
for (; ; ) {
|
|
19097
|
+
await this.#receiptBackoff(delay3, controller.signal);
|
|
19098
|
+
try {
|
|
19099
|
+
return await this.#authorizeFresh(identity3, token, controller.signal);
|
|
19100
|
+
} catch (failure) {
|
|
19101
|
+
this.#check(controller.signal);
|
|
19102
|
+
if (classifyVaultFailure(failure) !== "unreachable")
|
|
19103
|
+
throw failure;
|
|
19104
|
+
created.error = failure;
|
|
19105
|
+
delay3 = Math.min(delay3 * 2, 1e3);
|
|
19106
|
+
}
|
|
19107
|
+
}
|
|
19108
|
+
})
|
|
19109
|
+
};
|
|
19110
|
+
wait2 = created;
|
|
19111
|
+
this.#receiptWaits.set(key, wait2);
|
|
19112
|
+
const remove2 = () => {
|
|
19113
|
+
if (this.#receiptWaits.get(key) === created)
|
|
19114
|
+
this.#receiptWaits.delete(key);
|
|
19115
|
+
};
|
|
19116
|
+
void wait2.pending.then(remove2, remove2);
|
|
19117
|
+
}
|
|
19118
|
+
const shared3 = wait2;
|
|
19119
|
+
shared3.users++;
|
|
19120
|
+
let timer;
|
|
19121
|
+
let abort;
|
|
19122
|
+
try {
|
|
19123
|
+
const attempt = await Promise.race([
|
|
19124
|
+
shared3.pending,
|
|
19125
|
+
new Promise((_resolve, reject) => {
|
|
19126
|
+
timer = this.#setTimeout(() => {
|
|
19127
|
+
if (this.#outage)
|
|
19128
|
+
this.#outageWaitSpent = true;
|
|
19129
|
+
reject(shared3.error);
|
|
19130
|
+
}, remaining);
|
|
19131
|
+
timer.unref?.();
|
|
19132
|
+
if (signal) {
|
|
19133
|
+
abort = () => reject(signal.reason);
|
|
19134
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
19135
|
+
if (signal.aborted)
|
|
19136
|
+
abort();
|
|
19137
|
+
}
|
|
19138
|
+
})
|
|
19139
|
+
]);
|
|
19140
|
+
this.#check(signal);
|
|
19141
|
+
const receipt2 = Object.freeze(Object.defineProperty({ ...attempt }, "accessToken", {
|
|
19142
|
+
value: attempt.accessToken,
|
|
19143
|
+
enumerable: false
|
|
19144
|
+
}));
|
|
19145
|
+
this.#provenance.set(receipt2, { token });
|
|
19146
|
+
return receipt2;
|
|
19147
|
+
} finally {
|
|
19148
|
+
if (timer)
|
|
19149
|
+
this.#clearTimeout(timer);
|
|
19150
|
+
if (abort)
|
|
19151
|
+
signal?.removeEventListener("abort", abort);
|
|
19152
|
+
if (--shared3.users === 0) {
|
|
19153
|
+
shared3.controller.abort();
|
|
19154
|
+
if (this.#receiptWaits.get(key) === shared3)
|
|
19155
|
+
this.#receiptWaits.delete(key);
|
|
19156
|
+
}
|
|
19157
|
+
}
|
|
19158
|
+
}
|
|
19159
|
+
#receiptBackoff(delay3, signal) {
|
|
19160
|
+
this.#check(signal);
|
|
19161
|
+
return new Promise((resolve24, reject) => {
|
|
19162
|
+
const abort = () => {
|
|
19163
|
+
this.#clearTimeout(timer);
|
|
19164
|
+
signal.removeEventListener("abort", abort);
|
|
19165
|
+
reject(signal.reason);
|
|
19166
|
+
};
|
|
19167
|
+
const timer = this.#setTimeout(() => {
|
|
19168
|
+
signal.removeEventListener("abort", abort);
|
|
19169
|
+
resolve24();
|
|
19170
|
+
}, delay3);
|
|
19171
|
+
timer.unref?.();
|
|
19172
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
19173
|
+
if (signal.aborted)
|
|
19174
|
+
abort();
|
|
19175
|
+
});
|
|
19176
|
+
}
|
|
19035
19177
|
#serveKept(credentialId, kept, token, routeId, error = this.#outageError) {
|
|
19036
19178
|
if (!kept || this.#kept.get(credentialId) !== kept || !this.#usable(kept.attempt)) {
|
|
19037
19179
|
this.forget(credentialId);
|
|
@@ -19257,6 +19399,9 @@ var init_custody = __esm({
|
|
|
19257
19399
|
if (this.#closed)
|
|
19258
19400
|
return;
|
|
19259
19401
|
this.#closed = true;
|
|
19402
|
+
for (const wait2 of this.#receiptWaits.values())
|
|
19403
|
+
wait2.controller.abort();
|
|
19404
|
+
this.#receiptWaits.clear();
|
|
19260
19405
|
if (this.#probeTimer)
|
|
19261
19406
|
this.#clearTimeout(this.#probeTimer);
|
|
19262
19407
|
this.#probeTimer = void 0;
|
|
@@ -21130,6 +21275,13 @@ var init_hub = __esm({
|
|
|
21130
21275
|
#own;
|
|
21131
21276
|
#watch;
|
|
21132
21277
|
#run;
|
|
21278
|
+
/**
|
|
21279
|
+
* Member commit fan-outs still running, each until every one of its
|
|
21280
|
+
* commits has settled. Only a run whose generation ended can leave one
|
|
21281
|
+
* behind while another run starts; `#discover` waits for them before it
|
|
21282
|
+
* reads the files it lists over.
|
|
21283
|
+
*/
|
|
21284
|
+
#fanOuts = /* @__PURE__ */ new Set();
|
|
21133
21285
|
/** The hub's last authority read; undefined before the first one. */
|
|
21134
21286
|
#active;
|
|
21135
21287
|
/** Counts inactive transitions, so local work started before one stops. */
|
|
@@ -21603,6 +21755,9 @@ var init_hub = __esm({
|
|
|
21603
21755
|
if (!this.#live(generation))
|
|
21604
21756
|
return void 0;
|
|
21605
21757
|
const folders = await this.#ensureRosterDirectories().then(() => void 0, (error) => error instanceof Error ? error : new Error(String(error)));
|
|
21758
|
+
await this.#settleFanOuts();
|
|
21759
|
+
if (!this.#live(generation))
|
|
21760
|
+
return void 0;
|
|
21606
21761
|
const bases = new Map(await Promise.all([...this.#members.values()].map(async (entry) => [
|
|
21607
21762
|
entry,
|
|
21608
21763
|
await readVaultRoster(entry.path).then((file) => file ? { file } : {}, (error) => error instanceof Error ? error : new Error(String(error)))
|
|
@@ -21623,7 +21778,14 @@ var init_hub = __esm({
|
|
|
21623
21778
|
if (!this.#live(generation))
|
|
21624
21779
|
return void 0;
|
|
21625
21780
|
const members = this.#open();
|
|
21626
|
-
const
|
|
21781
|
+
const fanOut = Promise.all(members.map((entry) => entry.hooks && !entry.closed ? this.#commit(entry, entry.hooks, inventory, folders ?? bases.get(entry), generation) : void 0));
|
|
21782
|
+
this.#fanOuts.add(fanOut);
|
|
21783
|
+
let commits;
|
|
21784
|
+
try {
|
|
21785
|
+
commits = await fanOut;
|
|
21786
|
+
} finally {
|
|
21787
|
+
this.#fanOuts.delete(fanOut);
|
|
21788
|
+
}
|
|
21627
21789
|
if (!this.#live(generation))
|
|
21628
21790
|
return void 0;
|
|
21629
21791
|
const errors = /* @__PURE__ */ new Map();
|
|
@@ -21724,6 +21886,27 @@ var init_hub = __esm({
|
|
|
21724
21886
|
return { error };
|
|
21725
21887
|
}
|
|
21726
21888
|
}
|
|
21889
|
+
/**
|
|
21890
|
+
* Wait until no member commit fan-out of an earlier run is still running.
|
|
21891
|
+
* Each of them belongs to a generation that ended, so its commits fail or
|
|
21892
|
+
* finish at their next generation check and this wait stays short.
|
|
21893
|
+
*/
|
|
21894
|
+
async #settleFanOuts() {
|
|
21895
|
+
if (!this.#fanOuts.size)
|
|
21896
|
+
return;
|
|
21897
|
+
const phaseDiagnostics2 = channel2("common-auth.claustrum.phases");
|
|
21898
|
+
const phase = (name) => {
|
|
21899
|
+
if (phaseDiagnostics2.hasSubscribers)
|
|
21900
|
+
phaseDiagnostics2.publish({ logger: this.#logger, phase: name });
|
|
21901
|
+
};
|
|
21902
|
+
phase("earlier fan-out drain begin");
|
|
21903
|
+
try {
|
|
21904
|
+
while (this.#fanOuts.size)
|
|
21905
|
+
await Promise.allSettled([...this.#fanOuts]);
|
|
21906
|
+
} finally {
|
|
21907
|
+
phase("earlier fan-out drain end");
|
|
21908
|
+
}
|
|
21909
|
+
}
|
|
21727
21910
|
/**
|
|
21728
21911
|
* Create the roster folders under the state folder (`rosters`, this host
|
|
21729
21912
|
* generation and this key) owner-only, as every other Claustrum private
|
|
@@ -22036,6 +22219,8 @@ __export(claustrum_exports, {
|
|
|
22036
22219
|
VAULT_FAILURE_CLASSES: () => VAULT_FAILURE_CLASSES,
|
|
22037
22220
|
VAULT_HOST_CONNECT_REFUSAL: () => VAULT_HOST_CONNECT_REFUSAL,
|
|
22038
22221
|
VAULT_HOST_STATUS: () => VAULT_HOST_STATUS,
|
|
22222
|
+
VAULT_RECEIPT_WAIT_MS: () => VAULT_RECEIPT_WAIT_MS,
|
|
22223
|
+
VAULT_YOUNG_OUTAGE_MS: () => VAULT_YOUNG_OUTAGE_MS,
|
|
22039
22224
|
WATCH_RETRY_MS: () => WATCH_RETRY_MS,
|
|
22040
22225
|
acceptAccount: () => acceptAccount,
|
|
22041
22226
|
acceptVaultRoute: () => acceptVaultRoute,
|