@cortexkit/antigravity-auth-core 3.0.20 → 3.0.21

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.
@@ -1,3 +1,4 @@
1
+ import { channel } from 'node:diagnostics_channel';
1
2
  import { ClaustrumCredentialError, } from '@cortexkit/claustrum-client';
2
3
  import { createLogger } from '../logger/index.js';
3
4
  import { ClaustrumUnreachableError, classifyVaultFailure, } from './availability.js';
@@ -27,6 +28,8 @@ function scopedRetryReason(served, current) {
27
28
  return 'rotated';
28
29
  }
29
30
  const defaultLogger = createLogger('claustrum');
31
+ // Opt-in diagnostics let tests retain wait phases without logging each vault read.
32
+ const phaseDiagnostics = channel('common-auth.claustrum.phases');
30
33
  /**
31
34
  * Decide whether a request that got a 401 should retry with the freshly
32
35
  * re-authorized receipt, and log the decision. The vault can refresh a
@@ -280,6 +283,11 @@ export class ClaustrumScopedCustody {
280
283
  }
281
284
  async #token(signal) {
282
285
  this.#check(signal);
286
+ if (phaseDiagnostics.hasSubscribers)
287
+ phaseDiagnostics.publish({
288
+ logger: this.#logger,
289
+ phase: 'token read begin',
290
+ });
283
291
  const pending = this.#readToken();
284
292
  this.#tokenReads.add(pending);
285
293
  let value;
@@ -288,6 +296,11 @@ export class ClaustrumScopedCustody {
288
296
  }
289
297
  finally {
290
298
  this.#tokenReads.delete(pending);
299
+ if (phaseDiagnostics.hasSubscribers)
300
+ phaseDiagnostics.publish({
301
+ logger: this.#logger,
302
+ phase: 'token read end',
303
+ });
291
304
  }
292
305
  this.#check(signal);
293
306
  if (!/^[0-9a-f]{64}$/.test(value.token) ||
@@ -359,6 +372,11 @@ export class ClaustrumScopedCustody {
359
372
  this.#kept.clear();
360
373
  throw error;
361
374
  }
375
+ if (phaseDiagnostics.hasSubscribers)
376
+ phaseDiagnostics.publish({
377
+ logger: this.#logger,
378
+ phase: 'list scoped begin',
379
+ });
362
380
  try {
363
381
  inventory = await this.#call(() => this.#client.listScoped(token), signal);
364
382
  }
@@ -366,6 +384,13 @@ export class ClaustrumScopedCustody {
366
384
  this.listFailed(error);
367
385
  throw error;
368
386
  }
387
+ finally {
388
+ if (phaseDiagnostics.hasSubscribers)
389
+ phaseDiagnostics.publish({
390
+ logger: this.#logger,
391
+ phase: 'list scoped end',
392
+ });
393
+ }
369
394
  const skipped = [];
370
395
  const refused = [];
371
396
  let notMine = 0;
@@ -11,6 +11,7 @@
11
11
  // different processes already share, plus the base-view rule, so a commit
12
12
  // never replaces a view another process committed after this hub listed.
13
13
  import { createHash } from 'node:crypto';
14
+ import { channel } from 'node:diagnostics_channel';
14
15
  import { readdir, stat } from 'node:fs/promises';
15
16
  import { dirname, join, resolve } from 'node:path';
16
17
  import { createLogger } from '../logger/index.js';
@@ -766,7 +767,25 @@ export class ClaustrumDiscoveryHub {
766
767
  throw base;
767
768
  // A member's first roster under this key carries the declines and
768
769
  // order of its newest roster under an older key.
769
- const seed = base.file ? undefined : await this.#seed(entry);
770
+ let seed;
771
+ if (!base.file) {
772
+ const phaseDiagnostics = channel('common-auth.claustrum.phases');
773
+ if (phaseDiagnostics.hasSubscribers)
774
+ phaseDiagnostics.publish({
775
+ logger: this.#logger,
776
+ phase: `seed read ${entry.provider} begin`,
777
+ });
778
+ try {
779
+ seed = await this.#seed(entry);
780
+ }
781
+ finally {
782
+ if (phaseDiagnostics.hasSubscribers)
783
+ phaseDiagnostics.publish({
784
+ logger: this.#logger,
785
+ phase: `seed read ${entry.provider} end`,
786
+ });
787
+ }
788
+ }
770
789
  const roster = await refreshVaultRoster({
771
790
  path: entry.path,
772
791
  custody: { discover: async () => share },
@@ -443,6 +443,12 @@ export class InsulaQuotaSource {
443
443
  ...(typeof entry.source === 'string' && { source: entry.source }),
444
444
  },
445
445
  };
446
+ // Kept usage must not trigger a provider poll after a non-local failure.
447
+ // Only an explicitly local failure permits fallback; unknown causes do not.
448
+ if (entry.stale !== undefined &&
449
+ (!record(entry.stale) ||
450
+ entry.stale.class !== 'local_source_unavailable'))
451
+ return { miss: 'upstream-failed', reading };
446
452
  return now >= fetchedAt + MAX_AGE || entry.stale !== undefined
447
453
  ? { miss: 'stale', reading }
448
454
  : { reading };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "package": "@cortexkit/common-auth",
4
- "version": "0.31.0",
4
+ "version": "0.32.1",
5
5
  "artifactStatus": "published",
6
6
  "publicRoots": {
7
7
  "./store": {
@@ -37,15 +37,15 @@
37
37
  "import": "./dist/pi-slot/index.js"
38
38
  }
39
39
  },
40
- "input": "tools/common-auth-build/inputs/cortexkit-common-auth-0.31.0.tgz",
41
- "tarballSha256": "7fd3ca6766e40af0f79edc65f282f251f3d57bd614254a5df11921635cd1d548",
42
- "sri": "sha512-An0i6ywuMISocrZKZvYkVhExhg0/v0uUR7PU3QpDqko0+mTq4GA9zCJY2q74TK6fwF0w2Xw0mqxTNIUW8+4Apw==",
40
+ "input": "tools/common-auth-build/inputs/cortexkit-common-auth-0.32.1.tgz",
41
+ "tarballSha256": "d25d2eb670bc5ac48e75bf31cd633bb8b56fd807bf4467d69dbf62a00e1e6717",
42
+ "sri": "sha512-Y3SmHTnkDjdvo8d6MsQTVr+GlR3q6Ro8HYDqEFuotSUbrv8GwJvjRkYraN8ahEAT8uRHFmfyWGuogfYLzz65DA==",
43
43
  "canonicalFiles": 147,
44
- "canonicalBytes": 998822,
44
+ "canonicalBytes": 1000963,
45
45
  "generator": {
46
46
  "path": "packages/opencode/scripts/embed-common-auth.ts",
47
- "version": 3,
48
- "sha256": "87413753f873de0e5cad4701d142da0ffcfd4969cb52712cf99a19af689eb2a5"
47
+ "version": 4,
48
+ "sha256": "d0920ba672e4d2a4ab37cd827d0a8098e9253d23678b88d051750373787af65d"
49
49
  },
50
50
  "files": [
51
51
  {
@@ -251,9 +251,9 @@
251
251
  {
252
252
  "source": "package/dist/claustrum/custody.js",
253
253
  "output": "claustrum/custody.js",
254
- "bytes": 30624,
255
- "sourceSha256": "23c666b3d65b26b8f9aac6926c535f67d0ba7db4de1cf3591e95306aa0f8c5dd",
256
- "outputSha256": "23c666b3d65b26b8f9aac6926c535f67d0ba7db4de1cf3591e95306aa0f8c5dd",
254
+ "bytes": 31616,
255
+ "sourceSha256": "5ed70e65b78a04ceec3b3430908f46c860ea768b779b6af0f925681fd786593d",
256
+ "outputSha256": "5ed70e65b78a04ceec3b3430908f46c860ea768b779b6af0f925681fd786593d",
257
257
  "transform": "verbatim"
258
258
  },
259
259
  {
@@ -315,9 +315,9 @@
315
315
  {
316
316
  "source": "package/dist/claustrum/hub.js",
317
317
  "output": "claustrum/hub.js",
318
- "bytes": 45237,
319
- "sourceSha256": "48f0889818545735a6e6315bfa2517a84544abb9237ec9f698581ba6628c1ae5",
320
- "outputSha256": "48f0889818545735a6e6315bfa2517a84544abb9237ec9f698581ba6628c1ae5",
318
+ "bytes": 45993,
319
+ "sourceSha256": "e50ebf6bcf840f8a4229d219ecb20fc1422c74b5b3aa2034dff0b73852380b79",
320
+ "outputSha256": "e50ebf6bcf840f8a4229d219ecb20fc1422c74b5b3aa2034dff0b73852380b79",
321
321
  "transform": "verbatim"
322
322
  },
323
323
  {
@@ -347,9 +347,9 @@
347
347
  {
348
348
  "source": "package/dist/claustrum/insula.js",
349
349
  "output": "claustrum/insula.js",
350
- "bytes": 19744,
351
- "sourceSha256": "506b549f26a741599bfee04bf334cf7b29fde4077a79f65bc2dad78e03bafee0",
352
- "outputSha256": "506b549f26a741599bfee04bf334cf7b29fde4077a79f65bc2dad78e03bafee0",
350
+ "bytes": 20137,
351
+ "sourceSha256": "e2a2625cdad490cf24aa0badf66c842becd806738f8b137ebcf2b01e296eb0d2",
352
+ "outputSha256": "e2a2625cdad490cf24aa0badf66c842becd806738f8b137ebcf2b01e296eb0d2",
353
353
  "transform": "verbatim"
354
354
  },
355
355
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/antigravity-auth-core",
3
- "version": "3.0.20",
3
+ "version": "3.0.21",
4
4
  "description": "Harness-agnostic core for Google Antigravity OAuth: transport, fingerprint, request transforms, accounts, quota",
5
5
  "type": "module",
6
6
  "license": "MIT",