@cortexkit/opencode-antigravity-auth 3.0.41 → 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.
Files changed (113) hide show
  1. package/README.md +11 -0
  2. package/dist/cli.js +1316 -1124
  3. package/dist/cli.js.map +4 -4
  4. package/dist/cli.meta.json +116 -106
  5. package/dist/index.js +1257 -720
  6. package/dist/index.js.map +4 -4
  7. package/dist/index.meta.json +187 -169
  8. package/dist/server.js +1310 -773
  9. package/dist/server.js.map +4 -4
  10. package/dist/server.meta.json +1 -1
  11. package/dist/src/common-auth-embedded/claustrum/custody.d.ts +4 -0
  12. package/dist/src/common-auth-embedded/claustrum/custody.js +147 -2
  13. package/dist/src/common-auth-embedded/claustrum/hub.js +47 -1
  14. package/dist/src/common-auth-embedded/claustrum/index.d.ts +1 -1
  15. package/dist/src/common-auth-embedded/claustrum/index.js +1 -1
  16. package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +13 -9
  17. package/dist/src/common-auth-embedded/routing-accessor/index.d.ts +65 -12
  18. package/dist/src/common-auth-embedded/routing-accessor/index.js +114 -15
  19. package/dist/src/common-auth-embedded/settings/edit.d.ts +1 -0
  20. package/dist/src/common-auth-embedded/settings/edit.js +48 -2
  21. package/dist/src/common-auth-embedded/settings/handle.d.ts +2 -1
  22. package/dist/src/common-auth-embedded/settings/index.d.ts +1 -0
  23. package/dist/src/common-auth-embedded/settings/update.d.ts +14 -0
  24. package/dist/src/common-auth-embedded/settings/update.js +28 -9
  25. package/dist/src/common-auth-embedded/source-output.json +55 -46
  26. package/dist/src/plugin/__fixtures__/release-model-ids.d.ts.map +1 -1
  27. package/dist/src/plugin/__fixtures__/release-model-ids.js +1 -0
  28. package/dist/src/plugin/__fixtures__/release-model-ids.js.map +1 -1
  29. package/dist/src/plugin/__fixtures__/verified-store.d.ts +1 -1
  30. package/dist/src/plugin/__fixtures__/verified-store.js +4 -4
  31. package/dist/src/plugin/account-access.js +1 -1
  32. package/dist/src/plugin/account-access.js.map +1 -1
  33. package/dist/src/plugin/catalog.d.ts.map +1 -1
  34. package/dist/src/plugin/catalog.js +4 -2
  35. package/dist/src/plugin/catalog.js.map +1 -1
  36. package/dist/src/plugin/config/models.d.ts +9 -0
  37. package/dist/src/plugin/config/models.d.ts.map +1 -1
  38. package/dist/src/plugin/config/models.js +18 -0
  39. package/dist/src/plugin/config/models.js.map +1 -1
  40. package/dist/src/plugin/config/updater.js +2 -2
  41. package/dist/src/plugin/config/updater.js.map +1 -1
  42. package/dist/src/plugin/core/streaming/terminal-event.d.ts +14 -0
  43. package/dist/src/plugin/core/streaming/terminal-event.d.ts.map +1 -0
  44. package/dist/src/plugin/core/streaming/terminal-event.js +39 -0
  45. package/dist/src/plugin/core/streaming/terminal-event.js.map +1 -0
  46. package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -1
  47. package/dist/src/plugin/core/streaming/transformer.js +1 -13
  48. package/dist/src/plugin/core/streaming/transformer.js.map +1 -1
  49. package/dist/src/plugin/ga-location-services.js +1 -1
  50. package/dist/src/plugin/ga-location-services.js.map +1 -1
  51. package/dist/src/plugin/index.js +1 -1
  52. package/dist/src/plugin/index.js.map +1 -1
  53. package/dist/src/plugin/request-helpers.d.ts +10 -0
  54. package/dist/src/plugin/request-helpers.d.ts.map +1 -1
  55. package/dist/src/plugin/request-helpers.js +6 -0
  56. package/dist/src/plugin/request-helpers.js.map +1 -1
  57. package/dist/src/plugin/request.d.ts.map +1 -1
  58. package/dist/src/plugin/request.js +101 -47
  59. package/dist/src/plugin/request.js.map +1 -1
  60. package/dist/src/plugin/search.d.ts +7 -0
  61. package/dist/src/plugin/search.d.ts.map +1 -1
  62. package/dist/src/plugin/search.js +9 -15
  63. package/dist/src/plugin/search.js.map +1 -1
  64. package/dist/src/plugin/session-context.d.ts +1 -1
  65. package/dist/src/plugin/session-context.d.ts.map +1 -1
  66. package/dist/src/plugin/session-context.js +2 -5
  67. package/dist/src/plugin/session-context.js.map +1 -1
  68. package/dist/src/plugin/shared/request-services.d.ts +8 -1
  69. package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
  70. package/dist/src/plugin/shared/request-services.js +98 -11
  71. package/dist/src/plugin/shared/request-services.js.map +1 -1
  72. package/dist/src/plugin/shared/vault-routing.d.ts +9 -1
  73. package/dist/src/plugin/shared/vault-routing.d.ts.map +1 -1
  74. package/dist/src/plugin/shared/vault-routing.js +34 -12
  75. package/dist/src/plugin/shared/vault-routing.js.map +1 -1
  76. package/dist/tui-build-map.json +1 -1
  77. package/dist/tui-ga-build-map.json +1 -1
  78. package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +4 -0
  79. package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +1 -1
  80. package/dist/types/src/common-auth-embedded/routing-accessor/index.d.ts +65 -12
  81. package/dist/types/src/plugin/catalog.d.ts.map +1 -1
  82. package/dist/types/src/plugin/config/models.d.ts +9 -0
  83. package/dist/types/src/plugin/config/models.d.ts.map +1 -1
  84. package/dist/types/src/plugin/core/streaming/terminal-event.d.ts +14 -0
  85. package/dist/types/src/plugin/core/streaming/terminal-event.d.ts.map +1 -0
  86. package/dist/types/src/plugin/core/streaming/transformer.d.ts.map +1 -1
  87. package/dist/types/src/plugin/request-helpers.d.ts +10 -0
  88. package/dist/types/src/plugin/request-helpers.d.ts.map +1 -1
  89. package/dist/types/src/plugin/request.d.ts.map +1 -1
  90. package/dist/types/src/plugin/search.d.ts +7 -0
  91. package/dist/types/src/plugin/search.d.ts.map +1 -1
  92. package/dist/types/src/plugin/session-context.d.ts +1 -1
  93. package/dist/types/src/plugin/session-context.d.ts.map +1 -1
  94. package/dist/types/src/plugin/shared/request-services.d.ts +8 -1
  95. package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
  96. package/dist/types/src/plugin/shared/vault-routing.d.ts +9 -1
  97. package/dist/types/src/plugin/shared/vault-routing.d.ts.map +1 -1
  98. package/package.json +2 -2
  99. package/src/common-auth-embedded/claustrum/custody.d.ts +4 -0
  100. package/src/common-auth-embedded/claustrum/custody.js +147 -2
  101. package/src/common-auth-embedded/claustrum/hub.js +47 -1
  102. package/src/common-auth-embedded/claustrum/index.d.ts +1 -1
  103. package/src/common-auth-embedded/claustrum/index.js +1 -1
  104. package/src/common-auth-embedded/fs/refresh-file-lock.js +13 -9
  105. package/src/common-auth-embedded/routing-accessor/index.d.ts +65 -12
  106. package/src/common-auth-embedded/routing-accessor/index.js +114 -15
  107. package/src/common-auth-embedded/settings/edit.d.ts +1 -0
  108. package/src/common-auth-embedded/settings/edit.js +48 -2
  109. package/src/common-auth-embedded/settings/handle.d.ts +2 -1
  110. package/src/common-auth-embedded/settings/index.d.ts +1 -0
  111. package/src/common-auth-embedded/settings/update.d.ts +14 -0
  112. package/src/common-auth-embedded/settings/update.js +28 -9
  113. package/src/common-auth-embedded/source-output.json +55 -46
@@ -1,11 +1,21 @@
1
1
  /**
2
- * Optional THALAMUS routing for vault mode and advisory turn notes for request
3
- * shaping. Account ids are vault account ids, not local pool rows. Nothing is
4
- * persisted here; plugins on routes the runner does not serve get no turn notes.
2
+ * Optional THALAMUS routing for vault mode, plugin wait reports and advisory turn
3
+ * notes for request shaping. Account ids are vault account ids, not local pool
4
+ * rows. Nothing is persisted here; plugins on routes the runner does not serve
5
+ * get no turn notes.
5
6
  */
6
7
  import { isCacheWarmStopReason, } from './cache-policy.js';
7
8
  import { routingHandle } from './handle.js';
8
9
  export { CACHE_WARM_STOP_REASONS, isCacheWarmStopReason, reportCacheTouch, reportCacheWarmStopped, sessionCachePolicy, sessionToolWait, } from './cache-policy.js';
10
+ /** Keep this closed list aligned with the routing contract when adding a reason. */
11
+ export const PLUGIN_WAIT_REASONS = [
12
+ 'account_limit',
13
+ 'account_free',
14
+ 'rate_limited',
15
+ 'server_busy',
16
+ 'quota_reading',
17
+ 'routing_hold',
18
+ ];
9
19
  function isObject(value) {
10
20
  return typeof value === 'object' && value !== null;
11
21
  }
@@ -136,11 +146,35 @@ function selectionFor(answer, candidates) {
136
146
  }
137
147
  return { candidate };
138
148
  }
139
- /**
140
- * Ask routing for an eligible vault route. Any failure or unfamiliar answer
141
- * yields undefined so the plugin can keep its own choice. This does not admit
142
- * routes: callers must exclude vault refusals and killswitch-blocked accounts.
143
- */
149
+ function refusalFor(value) {
150
+ if (!isObject(value))
151
+ return undefined;
152
+ const code = value.code;
153
+ if (code !== 'account_limit_exhausted' &&
154
+ code !== 'account_selection_refused' &&
155
+ code !== 'account_selection_final') {
156
+ return undefined;
157
+ }
158
+ const refused = { code };
159
+ const routingCode = value.routing_code;
160
+ if (typeof routingCode === 'string' &&
161
+ /^[a-z0-9._-]{1,64}$/.test(routingCode)) {
162
+ refused.routingCode = routingCode;
163
+ }
164
+ const retryAfterSecs = value.retry_after_secs;
165
+ if (typeof retryAfterSecs === 'number' &&
166
+ Number.isFinite(retryAfterSecs) &&
167
+ retryAfterSecs >= 0) {
168
+ refused.retryAfterSecs = retryAfterSecs;
169
+ }
170
+ const resetsAtMs = value.resets_at_ms;
171
+ if (typeof resetsAtMs === 'number' &&
172
+ Number.isSafeInteger(resetsAtMs) &&
173
+ resetsAtMs > 0) {
174
+ refused.resetsAtMs = resetsAtMs;
175
+ }
176
+ return { refused };
177
+ }
144
178
  export async function askRouting(input) {
145
179
  let timer;
146
180
  try {
@@ -150,9 +184,9 @@ export async function askRouting(input) {
150
184
  const accountFor = handle.accountFor;
151
185
  if (typeof accountFor !== 'function')
152
186
  return undefined;
153
- const requested = input.deadlineMs ?? 500;
187
+ const requested = input.deadlineMs ?? 1500;
154
188
  const deadlineMs = Number.isNaN(requested)
155
- ? 500
189
+ ? 1500
156
190
  : Math.min(2000, Math.max(1, requested));
157
191
  const expired = new Promise((resolve) => {
158
192
  timer = setTimeout(() => resolve(undefined), deadlineMs);
@@ -166,10 +200,22 @@ export async function askRouting(input) {
166
200
  if (typeof cap === 'number' && Number.isFinite(cap)) {
167
201
  request.hold_wait_max_s = Math.max(0, Math.floor(cap));
168
202
  }
203
+ if (input.refusals === true)
204
+ request.refusals = true;
205
+ const warmCredentialId = input.warmCredentialId;
206
+ if (isNonEmptyString(warmCredentialId) &&
207
+ warmCredentialId.length <= 256 &&
208
+ !/\p{Cc}/u.test(warmCredentialId) &&
209
+ input.candidates.some((candidate) => candidate.credentialId === warmCredentialId)) {
210
+ request.warm_credential = warmCredentialId;
211
+ }
169
212
  const pending = accountFor.call(handle, request, { deadlineMs });
170
213
  if (!isObject(pending) || typeof pending.then !== 'function')
171
214
  return undefined;
172
215
  const answer = await Promise.race([pending, expired]);
216
+ if (input.refusals === true && isObject(answer) && 'refused' in answer) {
217
+ return refusalFor(answer.refused);
218
+ }
173
219
  return selectionFor(answer, input.candidates);
174
220
  }
175
221
  catch {
@@ -181,14 +227,15 @@ export async function askRouting(input) {
181
227
  }
182
228
  }
183
229
  /**
184
- * Report a vault request, billing result or turn-note event without waiting for
185
- * routing. Only contract fields are sent, and all accessor failures are ignored.
186
- * Headers must already be limited to rate-limit headers by the caller; values
187
- * are not filtered or redacted here.
230
+ * Report a vault request, billing result, plugin wait or turn-note event without
231
+ * waiting for routing. Only contract fields are sent, and all accessor failures
232
+ * are ignored. Headers must already be limited to rate-limit headers by the
233
+ * caller; values are not filtered or redacted here.
188
234
  */
189
235
  export function reportRouting(input) {
190
236
  try {
191
- const handle = routingHandle(input.sessionId);
237
+ const sessionId = input.sessionId;
238
+ const handle = routingHandle(sessionId);
192
239
  if (!handle)
193
240
  return;
194
241
  const report = handle.report;
@@ -197,6 +244,45 @@ export function reportRouting(input) {
197
244
  let payload;
198
245
  if ('kind' in input) {
199
246
  switch (input.kind) {
247
+ case 'wait': {
248
+ const { phase, waitId, reason, nextMs, attempt, message, outcome } = input;
249
+ if (!isNonEmptyString(sessionId) ||
250
+ (phase !== 'start' && phase !== 'end') ||
251
+ !isNonEmptyString(waitId) ||
252
+ waitId.length > 64 ||
253
+ /[^A-Za-z0-9._:-]/.test(waitId) ||
254
+ !PLUGIN_WAIT_REASONS.includes(reason))
255
+ return;
256
+ payload = {
257
+ kind: 'wait',
258
+ phase,
259
+ wait_id: waitId,
260
+ reason,
261
+ ...(typeof nextMs === 'number' &&
262
+ Number.isSafeInteger(nextMs) &&
263
+ nextMs > 0
264
+ ? { next_ms: nextMs }
265
+ : {}),
266
+ ...(typeof attempt === 'number' &&
267
+ Number.isInteger(attempt) &&
268
+ attempt >= 1
269
+ ? { attempt }
270
+ : {}),
271
+ ...(typeof message === 'string' &&
272
+ message.length >= 1 &&
273
+ message.length <= 160 &&
274
+ !/\p{Cc}/u.test(message)
275
+ ? { message }
276
+ : {}),
277
+ ...(phase === 'end' &&
278
+ (outcome === 'resumed' ||
279
+ outcome === 'cancelled' ||
280
+ outcome === 'abandoned')
281
+ ? { outcome }
282
+ : {}),
283
+ };
284
+ break;
285
+ }
200
286
  case 'billing': {
201
287
  const { attemptId, requestKind, credentialId, provider, model, outcome, accountId, providerRequestId, providerResponseId, userMessageId, status, attempt, chargeBasis, usage: inputUsage, usageByModel: inputUsageByModel, cache: inputCache, } = input;
202
288
  if (!isNonEmptyString(attemptId) ||
@@ -334,6 +420,19 @@ export function reportRouting(input) {
334
420
  };
335
421
  break;
336
422
  }
423
+ case 'credential_refused': {
424
+ const { credentialId, providerCode } = input;
425
+ if (!isNonEmptyString(credentialId) ||
426
+ typeof providerCode !== 'string' ||
427
+ !/^[a-z0-9._-]{1,64}$/.test(providerCode))
428
+ return;
429
+ payload = {
430
+ ...identity,
431
+ outcome: 'credential_refused',
432
+ provider_code: providerCode,
433
+ };
434
+ break;
435
+ }
337
436
  default:
338
437
  return;
339
438
  }
@@ -2,6 +2,7 @@ import type { SettingsDefinition } from './define.js';
2
2
  export type SettingsEdit = {
3
3
  setting: string;
4
4
  path?: readonly string[];
5
+ level?: 'default' | 'opencode' | 'pi';
5
6
  } & ({
6
7
  value: unknown;
7
8
  remove?: never;
@@ -37,7 +37,12 @@ function descriptorAtPath(descriptor, path) {
37
37
  }
38
38
  return current;
39
39
  }
40
- function destination(declaration, setting, value, { host, model }) {
40
+ function destination(declaration, setting, value, { host, model }, level) {
41
+ if (level !== undefined) {
42
+ return level === 'default' && !isJsonObject(value)
43
+ ? [setting]
44
+ : [setting, level];
45
+ }
41
46
  if (declaration.overrides !== undefined && isJsonObject(value)) {
42
47
  if (declaration.overrides.model &&
43
48
  model !== undefined &&
@@ -75,6 +80,20 @@ function checkPath(parsed, path) {
75
80
  invalid();
76
81
  }
77
82
  }
83
+ function preservePlainDefault(parsed, setting) {
84
+ const node = parsed.tree && findNodeAtLocation(parsed.tree, [setting]);
85
+ if (!node)
86
+ invalid();
87
+ // Keep the original value text so comments inside a list survive promotion.
88
+ const value = parsed.text.slice(node.offset, node.offset + node.length);
89
+ return parseForEdit(applyEdits(parsed.text, [
90
+ {
91
+ offset: node.offset,
92
+ length: node.length,
93
+ content: `{ "default": ${value} }`,
94
+ },
95
+ ]));
96
+ }
78
97
  /** Remove only the member's own tokens; intervening comment lines belong to neither neighbor. */
79
98
  function removeMember(text, tree, path) {
80
99
  const property = tree && findNodeAtLocation(tree, path)?.parent;
@@ -157,6 +176,18 @@ export function applySettingsEdits(definition, source, edits, context) {
157
176
  if (!Object.hasOwn(definition.settings, edit.setting))
158
177
  invalid();
159
178
  const declaration = definition.settings[edit.setting];
179
+ if (edit.level !== undefined) {
180
+ if (edit.path !== undefined)
181
+ invalid();
182
+ if (edit.level === 'default') {
183
+ if (declaration.overrides === undefined)
184
+ invalid();
185
+ }
186
+ else if ((edit.level !== 'opencode' && edit.level !== 'pi') ||
187
+ !declaration.overrides?.host) {
188
+ invalid();
189
+ }
190
+ }
160
191
  if (edit.path !== undefined &&
161
192
  declaration.value.kind !== 'object' &&
162
193
  declaration.value.kind !== 'record')
@@ -170,9 +201,24 @@ export function applySettingsEdits(definition, source, edits, context) {
170
201
  const units = [];
171
202
  for (const edit of edits) {
172
203
  const declaration = definition.settings[edit.setting];
204
+ if (edit.level !== undefined &&
205
+ edit.level !== 'default' &&
206
+ !isJsonObject(working.value[edit.setting])) {
207
+ if (edit.remove === true)
208
+ continue;
209
+ if (Object.hasOwn(working.value, edit.setting)) {
210
+ working = preservePlainDefault(working, edit.setting);
211
+ }
212
+ // Earlier root edits now refer to the override's default, if it exists.
213
+ for (const unit of units) {
214
+ if (unit.path.length === 1 && unit.path[0] === edit.setting) {
215
+ unit.path.push('default');
216
+ }
217
+ }
218
+ }
173
219
  const base = edit.path !== undefined
174
220
  ? [edit.setting]
175
- : destination(declaration, edit.setting, working.value[edit.setting], context);
221
+ : destination(declaration, edit.setting, working.value[edit.setting], context, edit.level);
176
222
  const path = [...base, ...(edit.path ?? [])];
177
223
  checkPath(working, path);
178
224
  units.push(resolutionUnit(declaration.value, base, edit.path ?? []));
@@ -4,6 +4,7 @@ import { type ValueOf } from './descriptors.js';
4
4
  import type { SettingsEdit, UpdateResult } from './edit.js';
5
5
  import { type GetOptions } from './resolve.js';
6
6
  import { type ReportEntry } from './snapshot.js';
7
+ import { type SettingsUpdatePlan } from './update.js';
7
8
  export interface LegacyProjectSource {
8
9
  readonly path: string;
9
10
  read(text: string): unknown;
@@ -22,7 +23,7 @@ export interface SettingsHandle<S extends Readonly<Record<string, SettingDeclara
22
23
  }): Promise<void>;
23
24
  get<K extends keyof S & string>(name: K, options: GetOptions): Promise<ValueOf<S[K]['value']>>;
24
25
  report(): ReportEntry[];
25
- update(edits: readonly SettingsEdit[], options: Pick<GetOptions, 'host' | 'model'>): Promise<UpdateResult>;
26
+ update(edits: readonly SettingsEdit[] | SettingsUpdatePlan, options: Pick<GetOptions, 'host' | 'model'>): Promise<UpdateResult>;
26
27
  watch(onChange: () => void): () => void;
27
28
  }
28
29
  /** Internal test hook; not part of the settings package exports. */
@@ -8,3 +8,4 @@ export { SETTINGS_REFUSAL_CODES, SettingsRefusal, type SettingsRefusalCode, } fr
8
8
  export type { GetOptions } from './resolve.js';
9
9
  export { settingsJsonSchema } from './schema.js';
10
10
  export type { ReportEntry, ReportReason } from './snapshot.js';
11
+ export type { SettingsCurrent, SettingsUpdatePlan } from './update.js';
@@ -0,0 +1,14 @@
1
+ import type { SettingsDefinition } from './define.js';
2
+ import { type SettingsEdit, type UpdateResult } from './edit.js';
3
+ import type { OpenSettingsOptions } from './handle.js';
4
+ import type { GetOptions } from './resolve.js';
5
+ export type SettingsCurrent = {
6
+ readonly status: 'missing';
7
+ } | {
8
+ readonly status: 'ready';
9
+ readonly document: Readonly<Record<string, unknown>>;
10
+ };
11
+ /** Compute edits synchronously from an immutable copy read under the write lock. */
12
+ export type SettingsUpdatePlan = (current: SettingsCurrent) => readonly SettingsEdit[];
13
+ /** Lock the canonical user file so symlink aliases serialize the same edits. */
14
+ export declare function updateSettings(definition: SettingsDefinition, options: OpenSettingsOptions, edits: readonly SettingsEdit[] | SettingsUpdatePlan, context: Pick<GetOptions, 'host' | 'model'>): Promise<UpdateResult>;
@@ -1,6 +1,7 @@
1
1
  import { basename, dirname, join } from 'node:path';
2
2
  import { ensurePrivateDirectory } from '../fs/private-files.js';
3
3
  import { withLock } from '../fs/with-lock.js';
4
+ import { deepFreeze } from './descriptors.js';
4
5
  import { applySettingsEdits, } from './edit.js';
5
6
  import { SettingsFs } from './fs.js';
6
7
  import { rethrowSettingsLockError } from './lock-errors.js';
@@ -23,21 +24,24 @@ async function writeTarget(file) {
23
24
  catch (error) {
24
25
  if (error.code !== 'ENOENT')
25
26
  unavailable(file, error);
27
+ let isSymlink = false;
26
28
  try {
27
- await SettingsFs.lstat(file);
29
+ isSymlink = (await SettingsFs.lstat(file)).isSymbolicLink();
28
30
  }
29
31
  catch (lstatError) {
30
32
  if (lstatError.code !== 'ENOENT')
31
33
  unavailable(file, lstatError);
32
- try {
33
- return join(await SettingsFs.realpath(dirname(file)), basename(file));
34
- }
35
- catch (parentError) {
36
- unavailable(file, parentError);
37
- }
38
34
  }
39
- // A directory entry whose realpath is missing is a dangling symlink.
40
- unavailable(file, error);
35
+ // Only a symlink whose realpath is missing is a dangling entry.
36
+ if (isSymlink)
37
+ unavailable(file, error);
38
+ // Bun 1.4 can fail realpath for regular files during a concurrent atomic replace.
39
+ try {
40
+ return join(await SettingsFs.realpath(dirname(file)), basename(file));
41
+ }
42
+ catch (parentError) {
43
+ unavailable(file, parentError);
44
+ }
41
45
  }
42
46
  }
43
47
  /** Lock the canonical user file so symlink aliases serialize the same edits. */
@@ -97,6 +101,21 @@ export async function updateSettings(definition, options, edits, context) {
97
101
  if (Number.isInteger(version) && version > 1) {
98
102
  throw new SettingsRefusal('settings-newer-version', 'Settings were written by a newer version');
99
103
  }
104
+ if (typeof edits === 'function') {
105
+ const planned = edits(deepFreeze(missing
106
+ ? { status: 'missing' }
107
+ : {
108
+ status: 'ready',
109
+ document: structuredClone(parsed.value),
110
+ }));
111
+ if (planned !== null &&
112
+ (typeof planned === 'object' || typeof planned === 'function') &&
113
+ 'then' in planned &&
114
+ typeof planned.then === 'function') {
115
+ throw new SettingsRefusal('settings-invalid-value', 'Settings update plans must be synchronous');
116
+ }
117
+ edits = planned;
118
+ }
100
119
  if (!parsed.tree) {
101
120
  source = `${parsed.hasBom ? '\uFEFF' : ''}// ${definition.plugin} settings\n{\n "schema_version": 1\n}\n`;
102
121
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "package": "@cortexkit/common-auth",
4
- "version": "0.45.0",
4
+ "version": "0.49.1",
5
5
  "artifactStatus": "published",
6
6
  "publicRoots": {
7
7
  "./rpc": {
@@ -73,15 +73,16 @@
73
73
  "import": "./src/quota-sidebar/index.tsx"
74
74
  }
75
75
  },
76
- "input": "tools/common-auth-build/inputs/cortexkit-common-auth-0.45.0.tgz",
77
- "tarballSha256": "acd923e2f5cc0e236c9be96491ffb9726848127b30d9a73e0172d3109b85ef6b",
78
- "sri": "sha512-bvf/ZMXqcDwIqLliUnSfTGH1waLo9p4TH5yRYDwI4Ux4ni16tNAeO6qYQuNVl9+rR8u/Ya7dgi0ZBA4xDnUCeg==",
79
- "canonicalFiles": 251,
80
- "canonicalBytes": 1484830,
76
+ "input": "tools/common-auth-build/inputs/cortexkit-common-auth-0.49.1.tgz",
77
+ "tarballSha256": "51f844a7cdc018ce795b642b8ac9bc3fb42e3fd5a5c23b6977bf097c854fe1ca",
78
+ "sri": "sha512-bN32JvabenbUQU0HeYFzrf2PhgH9p+YO5T7jIDspMSM6lOf/jRykdX0TZ154nUo95ZbhS/4f4b4BxU7kMt6+LQ==",
79
+ "shasum": "5e3e69e6aa76b884374dc816066f0c887c52d21b",
80
+ "canonicalFiles": 252,
81
+ "canonicalBytes": 1503837,
81
82
  "generator": {
82
83
  "path": "packages/opencode/scripts/embed-common-auth.ts",
83
84
  "version": 4,
84
- "sha256": "14338c2d3c7ff0817590a0a45bfe4af256edc0924c5660395dc89a93252174f6"
85
+ "sha256": "b4c837b90ca6f9266a0bfcd74a6412b64db0b98475aa40cef05c4be65d4a6770"
85
86
  },
86
87
  "files": [
87
88
  {
@@ -279,17 +280,17 @@
279
280
  {
280
281
  "source": "package/dist/claustrum/custody.d.ts",
281
282
  "output": "claustrum/custody.d.ts",
282
- "bytes": 17862,
283
- "sourceSha256": "ea33c127942652259ddf467d377da872cabfab1407339cc774c0e79ca5f83742",
284
- "outputSha256": "ea33c127942652259ddf467d377da872cabfab1407339cc774c0e79ca5f83742",
283
+ "bytes": 18127,
284
+ "sourceSha256": "8c4cb2f52551ae36a32c4e68201767df0d19ba396302ed6c2d723d0e066166f6",
285
+ "outputSha256": "8c4cb2f52551ae36a32c4e68201767df0d19ba396302ed6c2d723d0e066166f6",
285
286
  "transform": "verbatim"
286
287
  },
287
288
  {
288
289
  "source": "package/dist/claustrum/custody.js",
289
290
  "output": "claustrum/custody.js",
290
- "bytes": 37468,
291
- "sourceSha256": "e73ca575f9a97a20723e3371ff63be99a8cfea95bbe54ab694c298bebc30e853",
292
- "outputSha256": "e73ca575f9a97a20723e3371ff63be99a8cfea95bbe54ab694c298bebc30e853",
291
+ "bytes": 43691,
292
+ "sourceSha256": "65a376031c602bc4592fa6402c3cb5a14219245c10c134aed7239fdf11f1e88c",
293
+ "outputSha256": "65a376031c602bc4592fa6402c3cb5a14219245c10c134aed7239fdf11f1e88c",
293
294
  "transform": "verbatim"
294
295
  },
295
296
  {
@@ -367,25 +368,25 @@
367
368
  {
368
369
  "source": "package/dist/claustrum/hub.js",
369
370
  "output": "claustrum/hub.js",
370
- "bytes": 46503,
371
- "sourceSha256": "2b9aea632e082662a9b4e5341e926bd468467851cfb0fb2d4fabb9bed44a5544",
372
- "outputSha256": "2b9aea632e082662a9b4e5341e926bd468467851cfb0fb2d4fabb9bed44a5544",
371
+ "bytes": 48395,
372
+ "sourceSha256": "77bb04f1e6956eb2419b4d497fd2c478f59833f0a1bcc7650a090bd5c8a6ec23",
373
+ "outputSha256": "77bb04f1e6956eb2419b4d497fd2c478f59833f0a1bcc7650a090bd5c8a6ec23",
373
374
  "transform": "verbatim"
374
375
  },
375
376
  {
376
377
  "source": "package/dist/claustrum/index.d.ts",
377
378
  "output": "claustrum/index.d.ts",
378
- "bytes": 5027,
379
- "sourceSha256": "f0695ccb30745611029d2b82ec6ab4a88658872996b833032df2074cc745cb21",
380
- "outputSha256": "f0695ccb30745611029d2b82ec6ab4a88658872996b833032df2074cc745cb21",
379
+ "bytes": 5073,
380
+ "sourceSha256": "9e6722e2c38df279563804af98297aa6558efd8e50eb253e348a23b22e6e9785",
381
+ "outputSha256": "9e6722e2c38df279563804af98297aa6558efd8e50eb253e348a23b22e6e9785",
381
382
  "transform": "verbatim"
382
383
  },
383
384
  {
384
385
  "source": "package/dist/claustrum/index.js",
385
386
  "output": "claustrum/index.js",
386
- "bytes": 4122,
387
- "sourceSha256": "abdfa1bf0213459b9e0d76adefe1d6db09f730a328cff0acdcc51002565180da",
388
- "outputSha256": "abdfa1bf0213459b9e0d76adefe1d6db09f730a328cff0acdcc51002565180da",
387
+ "bytes": 4168,
388
+ "sourceSha256": "a770d6b8d5f8f50d1e4a4043f79c3660962add6fe2a6ec12552847ea0be04ca2",
389
+ "outputSha256": "a770d6b8d5f8f50d1e4a4043f79c3660962add6fe2a6ec12552847ea0be04ca2",
389
390
  "transform": "verbatim"
390
391
  },
391
392
  {
@@ -679,9 +680,9 @@
679
680
  {
680
681
  "source": "package/dist/fs/refresh-file-lock.js",
681
682
  "output": "fs/refresh-file-lock.js",
682
- "bytes": 53316,
683
- "sourceSha256": "6930a34883f8d795c4f64ceafb03ec42b49132e99dd1b0b0c32dce6273634dbd",
684
- "outputSha256": "6930a34883f8d795c4f64ceafb03ec42b49132e99dd1b0b0c32dce6273634dbd",
683
+ "bytes": 53498,
684
+ "sourceSha256": "0ba013556cedf94cd643de80d3a8383c0cbd0db425940c67bf516056fc6bba9d",
685
+ "outputSha256": "0ba013556cedf94cd643de80d3a8383c0cbd0db425940c67bf516056fc6bba9d",
685
686
  "transform": "verbatim"
686
687
  },
687
688
  {
@@ -1335,17 +1336,17 @@
1335
1336
  {
1336
1337
  "source": "package/dist/settings/edit.d.ts",
1337
1338
  "output": "settings/edit.d.ts",
1338
- "bytes": 662,
1339
- "sourceSha256": "abd44206e80335425293a51b7aa2a0d9392768ea817569d467dfd8e32184fb06",
1340
- "outputSha256": "abd44206e80335425293a51b7aa2a0d9392768ea817569d467dfd8e32184fb06",
1339
+ "bytes": 705,
1340
+ "sourceSha256": "12c877c921cdd0ba40948e558afedbcf2ee5f8ff8708908bed9b55a5c1e7800d",
1341
+ "outputSha256": "12c877c921cdd0ba40948e558afedbcf2ee5f8ff8708908bed9b55a5c1e7800d",
1341
1342
  "transform": "verbatim"
1342
1343
  },
1343
1344
  {
1344
1345
  "source": "package/dist/settings/edit.js",
1345
1346
  "output": "settings/edit.js",
1346
- "bytes": 8928,
1347
- "sourceSha256": "4e16333dd69be5fdccd0b65f2c96cc7a7766ece514f935a2d4faac7583e610c6",
1348
- "outputSha256": "4e16333dd69be5fdccd0b65f2c96cc7a7766ece514f935a2d4faac7583e610c6",
1347
+ "bytes": 10682,
1348
+ "sourceSha256": "bee8adcd3f244bfa8be32cbbe75e90707a1ffc8e622c70ca0e94471f39415911",
1349
+ "outputSha256": "bee8adcd3f244bfa8be32cbbe75e90707a1ffc8e622c70ca0e94471f39415911",
1349
1350
  "transform": "verbatim"
1350
1351
  },
1351
1352
  {
@@ -1359,9 +1360,9 @@
1359
1360
  {
1360
1361
  "source": "package/dist/settings/handle.d.ts",
1361
1362
  "output": "settings/handle.d.ts",
1362
- "bytes": 1576,
1363
- "sourceSha256": "e15a5e36534948bcba2487dd6631def42bef626f2cb8333f20e42ec4a6f0d7d3",
1364
- "outputSha256": "e15a5e36534948bcba2487dd6631def42bef626f2cb8333f20e42ec4a6f0d7d3",
1363
+ "bytes": 1652,
1364
+ "sourceSha256": "f6e23fd2f13b2f3d1942dee6db4f4e802d2763e3d4b4eb18ed6cca88974762ff",
1365
+ "outputSha256": "f6e23fd2f13b2f3d1942dee6db4f4e802d2763e3d4b4eb18ed6cca88974762ff",
1365
1366
  "transform": "verbatim"
1366
1367
  },
1367
1368
  {
@@ -1375,9 +1376,9 @@
1375
1376
  {
1376
1377
  "source": "package/dist/settings/index.d.ts",
1377
1378
  "output": "settings/index.d.ts",
1378
- "bytes": 915,
1379
- "sourceSha256": "998e3c0947ad044e8719a90c4f26e6e94f20b13d782ef84d0415d9d9bbfef3e5",
1380
- "outputSha256": "998e3c0947ad044e8719a90c4f26e6e94f20b13d782ef84d0415d9d9bbfef3e5",
1379
+ "bytes": 987,
1380
+ "sourceSha256": "23dff586898ffb2fa2f95597518e82ed9c19b1a6e5ed4187dc01675eff67f4fa",
1381
+ "outputSha256": "23dff586898ffb2fa2f95597518e82ed9c19b1a6e5ed4187dc01675eff67f4fa",
1381
1382
  "transform": "verbatim"
1382
1383
  },
1383
1384
  {
@@ -1508,12 +1509,20 @@
1508
1509
  "outputSha256": "353437b45c3b96f3df6d64de05765acb2e4da54b6ac9d293fcd5ccbb6517ad3b",
1509
1510
  "transform": "verbatim"
1510
1511
  },
1512
+ {
1513
+ "source": "package/dist/settings/update.d.ts",
1514
+ "output": "settings/update.d.ts",
1515
+ "bytes": 863,
1516
+ "sourceSha256": "4bb1820b65c2cdca47332d051a9f68aa88e1277ae97ae72f1679dc6baf615cb1",
1517
+ "outputSha256": "4bb1820b65c2cdca47332d051a9f68aa88e1277ae97ae72f1679dc6baf615cb1",
1518
+ "transform": "verbatim"
1519
+ },
1511
1520
  {
1512
1521
  "source": "package/dist/settings/update.js",
1513
1522
  "output": "settings/update.js",
1514
- "bytes": 5513,
1515
- "sourceSha256": "204a8d98f9eac4c90e8062e3d1e5f7e7cc336dd0ec791da4f97a20ea516eba3d",
1516
- "outputSha256": "204a8d98f9eac4c90e8062e3d1e5f7e7cc336dd0ec791da4f97a20ea516eba3d",
1523
+ "bytes": 6482,
1524
+ "sourceSha256": "f3d7446d74d22d59131563c2b915f46ea00973d89378bceceffd7bb757d26570",
1525
+ "outputSha256": "f3d7446d74d22d59131563c2b915f46ea00973d89378bceceffd7bb757d26570",
1517
1526
  "transform": "verbatim"
1518
1527
  },
1519
1528
  {
@@ -2079,17 +2088,17 @@
2079
2088
  {
2080
2089
  "source": "package/dist/routing-accessor/index.d.ts",
2081
2090
  "output": "routing-accessor/index.d.ts",
2082
- "bytes": 5573,
2083
- "sourceSha256": "2175d74fc07473fa02ddd401fc069938a89fdf6d22706afcd9d3ae5225f49708",
2084
- "outputSha256": "2175d74fc07473fa02ddd401fc069938a89fdf6d22706afcd9d3ae5225f49708",
2091
+ "bytes": 8159,
2092
+ "sourceSha256": "be4ee94f1f7ebcc587388df1c4c7744d2f15d6f1cabe08734fdec91012b0946f",
2093
+ "outputSha256": "be4ee94f1f7ebcc587388df1c4c7744d2f15d6f1cabe08734fdec91012b0946f",
2085
2094
  "transform": "verbatim"
2086
2095
  },
2087
2096
  {
2088
2097
  "source": "package/dist/routing-accessor/index.js",
2089
2098
  "output": "routing-accessor/index.js",
2090
- "bytes": 14506,
2091
- "sourceSha256": "f3adc02d9b528c4ea8345d61e4cc04d1ab43899056931cc57eae67ddcb601b80",
2092
- "outputSha256": "f3adc02d9b528c4ea8345d61e4cc04d1ab43899056931cc57eae67ddcb601b80",
2099
+ "bytes": 18496,
2100
+ "sourceSha256": "e4b90716dfc490aa2abca9062b46f2da30b49d8478d101888efbb6b93de63662",
2101
+ "outputSha256": "e4b90716dfc490aa2abca9062b46f2da30b49d8478d101888efbb6b93de63662",
2093
2102
  "transform": "verbatim"
2094
2103
  }
2095
2104
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"release-model-ids.d.ts","sourceRoot":"","sources":["../../../../src/plugin/__fixtures__/release-model-ids.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iBAAiB,UAQ7B,CAAA"}
1
+ {"version":3,"file":"release-model-ids.d.ts","sourceRoot":"","sources":["../../../../src/plugin/__fixtures__/release-model-ids.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iBAAiB,UAS7B,CAAA"}
@@ -6,6 +6,7 @@ export const RELEASE_MODEL_IDS = [
6
6
  'antigravity-gemini-3.8-flash',
7
7
  'antigravity-gemini-4-argon',
8
8
  'antigravity-gemini-4-carbon',
9
+ 'antigravity-gemini-4-hydrogen',
9
10
  'antigravity-gpt-oss-120b-medium',
10
11
  ];
11
12
  //# sourceMappingURL=release-model-ids.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"release-model-ids.js","sourceRoot":"","sources":["../../../../src/plugin/__fixtures__/release-model-ids.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,6BAA6B;IAC7B,+BAA+B;IAC/B,oCAAoC;IACpC,8BAA8B;IAC9B,4BAA4B;IAC5B,6BAA6B;IAC7B,iCAAiC;CAClC,CAAA"}
1
+ {"version":3,"file":"release-model-ids.js","sourceRoot":"","sources":["../../../../src/plugin/__fixtures__/release-model-ids.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,6BAA6B;IAC7B,+BAA+B;IAC/B,oCAAoC;IACpC,8BAA8B;IAC9B,4BAA4B;IAC5B,6BAA6B;IAC7B,+BAA+B;IAC/B,iCAAiC;CAClC,CAAA"}
@@ -1,3 +1,3 @@
1
- /** Verify the candidate archive identity and every store/fs member before loading executable code. */
1
+ /** Verify the published archive identity and every store/fs member before loading executable code. */
2
2
  export declare function loadVerifiedStoreModules(): Promise<import("@cortexkit/antigravity-auth-core").CommonAuthStoreModules>;
3
3
  //# sourceMappingURL=verified-store.d.ts.map
@@ -4,8 +4,8 @@ import { dirname, join } from 'node:path';
4
4
  import { loadCommonAuthStoreModules } from '@cortexkit/antigravity-auth-core';
5
5
  const PIN = {
6
6
  package: '@cortexkit/common-auth',
7
- version: '0.45.0',
8
- tarballSha256: 'acd923e2f5cc0e236c9be96491ffb9726848127b30d9a73e0172d3109b85ef6b',
7
+ version: '0.49.1',
8
+ tarballSha256: '51f844a7cdc018ce795b642b8ac9bc3fb42e3fd5a5c23b6977bf097c854fe1ca',
9
9
  };
10
10
  async function filesBelow(root, dir) {
11
11
  const out = [];
@@ -18,7 +18,7 @@ async function filesBelow(root, dir) {
18
18
  }
19
19
  return out;
20
20
  }
21
- /** Verify the candidate archive identity and every store/fs member before loading executable code. */
21
+ /** Verify the published archive identity and every store/fs member before loading executable code. */
22
22
  export async function loadVerifiedStoreModules() {
23
23
  const root = dirname(dirname(Bun.resolveSync('@cortexkit/antigravity-auth-core/common-auth/store', import.meta.dir)));
24
24
  const receipt = JSON.parse(await readFile(join(root, 'source-output.json'), 'utf8'));
@@ -27,7 +27,7 @@ export async function loadVerifiedStoreModules() {
27
27
  receipt.artifactStatus !== 'published' ||
28
28
  receipt.tarballSha256 !== PIN.tarballSha256 ||
29
29
  !Array.isArray(receipt.files)) {
30
- throw new Error(`the embedded common-auth receipt is not the pinned candidate ${PIN.version}`);
30
+ throw new Error(`the embedded common-auth receipt is not the pinned published ${PIN.version}`);
31
31
  }
32
32
  const recorded = receipt.files.filter((file) => /^(store|fs)\//.test(file.output));
33
33
  const present = [
@@ -151,7 +151,7 @@ export function buildAccountAccessProbeRequest(projectId) {
151
151
  contents: [{ role: 'user', parts: [{ text: 'ping' }] }],
152
152
  generationConfig: { maxOutputTokens: 1, temperature: 0 },
153
153
  };
154
- const requestMetadata = buildAgyAgentRequestMetadata(createAgyRequestSessionContext(''), request, wireModel);
154
+ const requestMetadata = buildAgyAgentRequestMetadata(createAgyRequestSessionContext(), request, wireModel);
155
155
  request.labels = requestMetadata.labels;
156
156
  request.sessionId = requestMetadata.sessionId;
157
157
  orderAgyRequestPayloadInPlace(request);