@oxagen/cli 5.5.1-243 → 5.5.1-249

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 (2) hide show
  1. package/oxagen.mjs +962 -451
  2. package/package.json +1 -1
package/oxagen.mjs CHANGED
@@ -418,26 +418,26 @@ var init_util = __esm({
418
418
  }
419
419
  util2.assertNever = assertNever3;
420
420
  util2.arrayToEnum = (items) => {
421
- const obj2 = {};
421
+ const obj3 = {};
422
422
  for (const item of items) {
423
- obj2[item] = item;
423
+ obj3[item] = item;
424
424
  }
425
- return obj2;
425
+ return obj3;
426
426
  };
427
- util2.getValidEnumValues = (obj2) => {
428
- const validKeys = util2.objectKeys(obj2).filter((k) => typeof obj2[obj2[k]] !== "number");
427
+ util2.getValidEnumValues = (obj3) => {
428
+ const validKeys = util2.objectKeys(obj3).filter((k) => typeof obj3[obj3[k]] !== "number");
429
429
  const filtered = {};
430
430
  for (const k of validKeys) {
431
- filtered[k] = obj2[k];
431
+ filtered[k] = obj3[k];
432
432
  }
433
433
  return util2.objectValues(filtered);
434
434
  };
435
- util2.objectValues = (obj2) => {
436
- return util2.objectKeys(obj2).map(function(e) {
437
- return obj2[e];
435
+ util2.objectValues = (obj3) => {
436
+ return util2.objectKeys(obj3).map(function(e) {
437
+ return obj3[e];
438
438
  });
439
439
  };
440
- util2.objectKeys = typeof Object.keys === "function" ? (obj2) => Object.keys(obj2) : (object3) => {
440
+ util2.objectKeys = typeof Object.keys === "function" ? (obj3) => Object.keys(obj3) : (object3) => {
441
441
  const keys = [];
442
442
  for (const key in object3) {
443
443
  if (Object.prototype.hasOwnProperty.call(object3, key)) {
@@ -563,8 +563,8 @@ var init_ZodError = __esm({
563
563
  "not_multiple_of",
564
564
  "not_finite"
565
565
  ]);
566
- quotelessJson = (obj2) => {
567
- const json3 = JSON.stringify(obj2, null, 2);
566
+ quotelessJson = (obj3) => {
567
+ const json3 = JSON.stringify(obj3, null, 2);
568
568
  return json3.replace(/"([^"]+)":/g, "$1:");
569
569
  };
570
570
  ZodError = class _ZodError extends Error {
@@ -5752,7 +5752,7 @@ function bundleSkillChars(skill) {
5752
5752
  chars += file2.path.length + file2.content.length;
5753
5753
  return chars;
5754
5754
  }
5755
- var protocolTimestampSchema, machineGroupSchema, TACHO_BATCH_SCHEMA, TACHO_BUNDLE_SCHEMA, TACHO_COMMANDS_SCHEMA, TACHO_ENROLLMENT_CLAIMS_SCHEMA, TACHO_ENROLLMENT_CERTIFICATE_DOMAIN, ENROLLMENT_KEY_SET_SCHEMA, ENROLLMENT_KEY_SET_DOMAIN, TACHO_ENFORCEMENT_TIER_ATTR, TACHO_GATEWAY_TIER, TACHO_GATEWAY_SESSION_HEADER, TACHO_GATEWAY_GENESIS_HEADER, TACHO_GATEWAY_HARNESS_HEADER, REFUSAL_META_KEY, DECISION_META_KEY, MCP_STREAMABLE_HTTP_ACCEPT, TACHO_METERING_ATTR, TACHO_METERING_OBSERVED, TACHO_MODEL_SESSION_HEADER, TACHO_CREDENTIAL_BASIS_ATTR, TACHO_CREDENTIAL_GATEWAY_BROKERED, TACHO_CREDENTIAL_HARNESS_HELD, TACHO_CREDENTIAL_BASES, TACHO_RUN_TOKEN_ATTR, BUNDLE_FEATURE_GATEWAY_TOOLS, BUNDLE_FEATURE_MODEL_PRICES, BUNDLE_FEATURE_MODEL_PRICES_LONG_CONTEXT, BUNDLE_FEATURE_MODEL_ALLOWLIST, BUNDLE_FEATURE_INDEPENDENT_MODELS, BUNDLE_FEATURE_HOOK_FAIL_OPEN, BUNDLE_FEATURE_STEERING_MANIFEST, BUNDLE_FEATURE_STEERING_INCOMPLETE, BUNDLE_FEATURE_STEERING_LOAD, BUNDLE_FEATURE_CONTAINMENT, BUNDLE_FEATURE_DAILY_BUDGET, BUNDLE_FEATURE_STEER_NEXT_STEP, BUNDLE_FEATURE_UNBOUND_REPO, BUNDLE_FEATURE_CEDAR, BUNDLE_FEATURE_CEDAR_TOOLBELT, BUNDLE_FEATURE_SKILLS, BUNDLE_FEATURE_CACHE_KEEP_ALIVE, BUNDLE_FEATURE_WORK_ORDERS, BUNDLE_FEATURE_WORK_ORDER_START, BUNDLE_FEATURE_WORK_ORDER_STAFFING, BUNDLE_FEATURE_CREDENTIAL_REAUTH, BUNDLE_FEATURE_MCP_RULE_SETS, BUNDLE_FEATURE_GATEWAY_POLICY, BUNDLE_FEATURE_TENANT_SCOPE, BUNDLE_FEATURE_MEMORY_SCOPE, MEMORY_SCOPE_DIGESTS_MAX, GATEWAY_MIN_TIERS, SENSITIVE_SCREEN_ACTIONS, PROMPT_REDACTION_PATTERNS_MAX, PROMPT_REDACTION_PATTERN_MAX, gatewayPolicySchema, BUNDLE_FEATURE_GATEWAY_HARNESS, TACHO_BUNDLE_FEATURES, bundleFeaturesSchema, hostEnrollmentIdSchema, MEMBER_PUBLIC_ID, tachoPlatformSchema, tachoHarnessSchema, TACHO_HARNESS_LABELS, TACHO_HARNESS_TIERS, WRAPPED_HARNESSES, CONNECTED_HARNESSES, HARNESS_BINARY, MODEL_HARNESS_ROUTES, MODEL_ROUTED_HARNESSES, BROKERABLE_HARNESSES, BROKERABLE_HARNESS_PROVIDER, TACHO_TIER_SUMMARY, CUSTOM_AGENT_NAME_PATTERN, RESERVED_AGENT_NAMES, tachoHostStatusSchema, tachoBundleModeSchema, tachoCommandSchema, tachoCommandStatusSchema, tachoCommandAckStatusSchema, tachoDeliveryModeSchema, denyGenerationSchema, deliveredCommandSchema, deliveredCommandResponseSchema, WORK_ORDER_ID_PATTERN, WORK_ORDER_TOKEN_PATTERN, WORK_ITEM_ID_PATTERN, workOrderCommandPayloadSchema, hostConnectionStateSchema, hostConnectionSchema, HOST_CONNECTION_PATH, hostConnectionRequestSchema, hostConnectionChangeResponseSchema, HOST_WORK_ORDERS_PATH, WORK_ORDER_CLAIM_PATH, CERTIFICATE_RENEW_PATH, ENROLLMENT_KEYS_PATH, WORK_ORDER_REJECT_PATH, HOST_MODEL_CREDENTIALS_PATH, HOST_MODEL_CREDENTIAL_STATE_PATH, VAULT_CREDENTIAL_ID_PATTERN, hostModelCredentialSchema, hostModelCredentialsResponseSchema, hostModelCredentialStateResponseSchema, reauthCommandPayloadSchema, connectWorkspaceCommandPayloadSchema, workspaceConnectionRedeemRequestSchema, workspaceConnectionRedeemResponseSchema, REAUTH_PROOF_DOMAIN, workOrderClaimResponseSchema, workOrderRejectResponseSchema, WORK_CRITERION_CLAIM_PATH, WORK_CRITERION_ID_PATTERN, WORK_HEAD_SHA_PATTERN, WORK_CRITERION_CLAIM_TEXT_MAX, workCriterionClaimResponseSchema, WORK_ORDER_PROGRESS_PATH, WORK_PROGRESS_TEXT_MAX, WORK_PROGRESS_STEP_MAX, workProgressResponseSchema, WORK_ORDER_ENV, WORK_ORDER_TOKEN_ENV, WORK_ORDER_TOKEN_HEADER, WORK_ORDER_ATTR, steeringForceSchema, steeringItemKindSchema, steeringCutReasonSchema, steeringHeldLoadSchema, steeringManifestItemSchema, STEERING_MANIFEST_SCHEMA, steeringManifestSchema, steeringManifestFrameSchema, workOrderSteeringReasonSchema, workOrderSteeringItemSchema, workOrderSteeringManifestSchema, cedarIdSchema, cedarPrincipalSchema, cedarToolSchema, cedarBundleSchema, BUNDLE_SKILLS_MAX, BUNDLE_SKILL_FILES_MAX, BUNDLE_SKILLS_CHARS_MAX, BASE64_PATTERN, bundleSkillFileSchema, bundleSkillSchema, policyBundleSchema, enrollmentClaimsSchema, ed25519SignatureSchema, enrollmentCertificateSchema, enrollmentKeySchema, enrollmentKeySetSchema, tachoEventWireSchema, TACHO_MAX_HELD_SESSIONS, daemonHealthSchema, TACHO_MAX_BATCH, TACHO_MAX_BODY_BYTES, TACHO_MAX_REQUEST_BYTES, TACHO_REQUEST_ENVELOPE_BYTES, SANDBOX_GIT_RELAY_PATH, SANDBOX_GITLAB_RELAY_PATH, SANDBOX_GIT_RELAY_MAX_REQUEST_BYTES, SANDBOX_GIT_RELAY_TIMEOUT_MS, tachoBodySchema, tachoBatchSchema, agentDaySpendSchema, controlEnvelopeSchema, ingestResponseSchema, bundleResponseSchema, commandAcknowledgementSchema, commandsResponseSchema, certificateRenewalResponseSchema, enrollmentKeysResponseSchema, enrollmentResponseSchema, tokenEnrollmentResponseSchema;
5755
+ var protocolTimestampSchema, machineGroupSchema, TACHO_BATCH_SCHEMA, TACHO_BUNDLE_SCHEMA, TACHO_COMMANDS_SCHEMA, TACHO_ENROLLMENT_CLAIMS_SCHEMA, TACHO_ENROLLMENT_CERTIFICATE_DOMAIN, ENROLLMENT_KEY_SET_SCHEMA, ENROLLMENT_KEY_SET_DOMAIN, TACHO_ENFORCEMENT_TIER_ATTR, TACHO_GATEWAY_TIER, TACHO_GATEWAY_SESSION_HEADER, TACHO_GATEWAY_GENESIS_HEADER, TACHO_GATEWAY_HARNESS_HEADER, REFUSAL_META_KEY, DECISION_META_KEY, MCP_STREAMABLE_HTTP_ACCEPT, TACHO_METERING_ATTR, TACHO_METERING_OBSERVED, TACHO_SPAWNED_BY_ATTR, TACHO_MODEL_SESSION_HEADER, TACHO_CREDENTIAL_BASIS_ATTR, TACHO_CREDENTIAL_GATEWAY_BROKERED, TACHO_CREDENTIAL_HARNESS_HELD, TACHO_CREDENTIAL_BASES, TACHO_RUN_TOKEN_ATTR, BUNDLE_FEATURE_GATEWAY_TOOLS, BUNDLE_FEATURE_MODEL_PRICES, BUNDLE_FEATURE_MODEL_PRICES_LONG_CONTEXT, BUNDLE_FEATURE_MODEL_ALLOWLIST, BUNDLE_FEATURE_INDEPENDENT_MODELS, BUNDLE_FEATURE_HOOK_FAIL_OPEN, BUNDLE_FEATURE_STEERING_MANIFEST, BUNDLE_FEATURE_STEERING_INCOMPLETE, BUNDLE_FEATURE_STEERING_LOAD, BUNDLE_FEATURE_CONTAINMENT, BUNDLE_FEATURE_DAILY_BUDGET, BUNDLE_FEATURE_STEER_NEXT_STEP, BUNDLE_FEATURE_UNBOUND_REPO, BUNDLE_FEATURE_CEDAR, BUNDLE_FEATURE_CEDAR_TOOLBELT, BUNDLE_FEATURE_SKILLS, BUNDLE_FEATURE_CACHE_KEEP_ALIVE, BUNDLE_FEATURE_WORK_ORDERS, BUNDLE_FEATURE_WORK_ORDER_START, BUNDLE_FEATURE_WORK_ORDER_STAFFING, BUNDLE_FEATURE_CREDENTIAL_REAUTH, BUNDLE_FEATURE_MCP_RULE_SETS, BUNDLE_FEATURE_GATEWAY_POLICY, BUNDLE_FEATURE_TENANT_SCOPE, BUNDLE_FEATURE_MEMORY_SCOPE, MEMORY_SCOPE_DIGESTS_MAX, GATEWAY_MIN_TIERS, SENSITIVE_SCREEN_ACTIONS, PROMPT_REDACTION_PATTERNS_MAX, PROMPT_REDACTION_PATTERN_MAX, gatewayPolicySchema, BUNDLE_FEATURE_GATEWAY_HARNESS, TACHO_BUNDLE_FEATURES, bundleFeaturesSchema, hostEnrollmentIdSchema, MEMBER_PUBLIC_ID, tachoPlatformSchema, tachoHarnessSchema, TACHO_HARNESS_LABELS, TACHO_HARNESS_TIERS, WRAPPED_HARNESSES, CONNECTED_HARNESSES, HARNESS_BINARY, MODEL_HARNESS_ROUTES, MODEL_ROUTED_HARNESSES, BROKERABLE_HARNESSES, BROKERABLE_HARNESS_PROVIDER, TACHO_TIER_SUMMARY, CUSTOM_AGENT_NAME_PATTERN, RESERVED_AGENT_NAMES, tachoHostStatusSchema, tachoBundleModeSchema, tachoCommandSchema, tachoCommandStatusSchema, tachoCommandAckStatusSchema, tachoDeliveryModeSchema, denyGenerationSchema, deliveredCommandSchema, deliveredCommandResponseSchema, WORK_ORDER_ID_PATTERN, WORK_ORDER_TOKEN_PATTERN, WORK_ITEM_ID_PATTERN, workOrderCommandPayloadSchema, hostConnectionStateSchema, hostConnectionSchema, HOST_CONNECTION_PATH, hostConnectionRequestSchema, hostConnectionChangeResponseSchema, HOST_WORK_ORDERS_PATH, WORK_ORDER_CLAIM_PATH, CERTIFICATE_RENEW_PATH, ENROLLMENT_KEYS_PATH, WORK_ORDER_REJECT_PATH, HOST_MODEL_CREDENTIALS_PATH, HOST_MODEL_CREDENTIAL_STATE_PATH, VAULT_CREDENTIAL_ID_PATTERN, hostModelCredentialSchema, hostModelCredentialsResponseSchema, hostModelCredentialStateResponseSchema, reauthCommandPayloadSchema, connectWorkspaceCommandPayloadSchema, workspaceConnectionRedeemRequestSchema, workspaceConnectionRedeemResponseSchema, REAUTH_PROOF_DOMAIN, workOrderClaimResponseSchema, workOrderRejectResponseSchema, WORK_CRITERION_CLAIM_PATH, WORK_CRITERION_ID_PATTERN, WORK_HEAD_SHA_PATTERN, WORK_CRITERION_CLAIM_TEXT_MAX, workCriterionClaimResponseSchema, WORK_ORDER_PROGRESS_PATH, WORK_PROGRESS_TEXT_MAX, WORK_PROGRESS_STEP_MAX, workProgressResponseSchema, WORK_ORDER_ENV, WORK_ORDER_TOKEN_ENV, WORK_ORDER_TOKEN_HEADER, WORK_ORDER_ATTR, steeringForceSchema, steeringItemKindSchema, steeringCutReasonSchema, steeringHeldLoadSchema, steeringManifestItemSchema, STEERING_MANIFEST_SCHEMA, steeringManifestSchema, steeringManifestFrameSchema, workOrderSteeringReasonSchema, workOrderSteeringItemSchema, workOrderSteeringManifestSchema, cedarIdSchema, cedarPrincipalSchema, cedarToolSchema, cedarBundleSchema, BUNDLE_SKILLS_MAX, BUNDLE_SKILL_FILES_MAX, BUNDLE_SKILLS_CHARS_MAX, BASE64_PATTERN, bundleSkillFileSchema, bundleSkillSchema, policyBundleSchema, enrollmentClaimsSchema, ed25519SignatureSchema, enrollmentCertificateSchema, enrollmentKeySchema, enrollmentKeySetSchema, tachoEventWireSchema, TACHO_MAX_HELD_SESSIONS, daemonHealthSchema, TACHO_MAX_BATCH, TACHO_MAX_BODY_BYTES, TACHO_MAX_REQUEST_BYTES, TACHO_REQUEST_ENVELOPE_BYTES, SANDBOX_GIT_RELAY_PATH, SANDBOX_GITLAB_RELAY_PATH, SANDBOX_GIT_RELAY_MAX_REQUEST_BYTES, SANDBOX_GIT_RELAY_TIMEOUT_MS, tachoBodySchema, tachoBatchSchema, agentDaySpendSchema, controlEnvelopeSchema, ingestResponseSchema, bundleResponseSchema, commandAcknowledgementSchema, commandsResponseSchema, certificateRenewalResponseSchema, enrollmentKeysResponseSchema, enrollmentResponseSchema, tokenEnrollmentResponseSchema;
5756
5756
  var init_wire = __esm({
5757
5757
  "../../packages/tacho/src/wire.ts"() {
5758
5758
  "use strict";
@@ -5786,6 +5786,7 @@ var init_wire = __esm({
5786
5786
  MCP_STREAMABLE_HTTP_ACCEPT = "application/json, text/event-stream";
5787
5787
  TACHO_METERING_ATTR = "oxagen.metering";
5788
5788
  TACHO_METERING_OBSERVED = "observed";
5789
+ TACHO_SPAWNED_BY_ATTR = "oxagen.spawned_by";
5789
5790
  TACHO_MODEL_SESSION_HEADER = "x-oxagen-session";
5790
5791
  TACHO_CREDENTIAL_BASIS_ATTR = "oxagen.credential_basis";
5791
5792
  TACHO_CREDENTIAL_GATEWAY_BROKERED = "gateway_brokered";
@@ -8245,6 +8246,40 @@ var init_redaction = __esm({
8245
8246
  reason: "oxagen_work_order_token",
8246
8247
  pattern: new RegExp(`(?<!${B64URL})oxwo_${B64URL}{43}(?!${B64URL})`, "g")
8247
8248
  },
8249
+ {
8250
+ // `oxe_1time_` and 26 Crockford base32 characters: the single-use token
8251
+ // a machine presents to `enroll_host` to become an agent's host. The
8252
+ // length is exact, as for an API key. It is spendable until a machine
8253
+ // presents it or its 30 minutes run out.
8254
+ reason: "oxagen_enrollment_token",
8255
+ pattern: new RegExp(
8256
+ `(?<!${B64URL})oxe_1time_[0-9a-hjkmnp-tv-z]{26}(?!${B64URL})`,
8257
+ "g"
8258
+ )
8259
+ },
8260
+ {
8261
+ // A Modal token secret where its name says what it is: the
8262
+ // `MODAL_TOKEN_SECRET` variable, `token_secret` in `~/.modal.toml`,
8263
+ // `tokenSecret` in JSON, or the `--token-secret` flag. Only the secret
8264
+ // is removed, so the name beside it stays readable.
8265
+ reason: "modal_token",
8266
+ pattern: new RegExp(
8267
+ `(?:MODAL_TOKEN_SECRET|token[-_]?secret)(?:${JSON_QUOTE}|')?(?:\\s*[:=]\\s*|\\s+)(?:${JSON_QUOTE}|')?(as-${B64URL}{13,256})(?!${B64URL})`,
8268
+ "gi"
8269
+ ),
8270
+ group: 1
8271
+ },
8272
+ {
8273
+ // A Modal token secret with no name beside it: `as-` and 20 or more
8274
+ // letters and digits. Modal issues 22 of them. English writes `as-` too
8275
+ // ("infrastructure-as-a-service-provider"), and its words are joined by
8276
+ // hyphens, so the first 20 characters after the prefix may hold none.
8277
+ reason: "modal_token",
8278
+ pattern: new RegExp(
8279
+ `(?<!${B64URL})as-(?=[A-Za-z0-9]{20})${B64URL}{20,256}`,
8280
+ "g"
8281
+ )
8282
+ },
8248
8283
  {
8249
8284
  // The scheme is case-insensitive (RFC 9110 §11.1), and RFC 6750's
8250
8285
  // b64token includes `_`: without it a token was cut at its first `_`
@@ -14145,8 +14180,8 @@ function __wbg_get_imports() {
14145
14180
  return ret;
14146
14181
  },
14147
14182
  __wbg___wbindgen_string_get_914df97fcfa788f2: function(arg0, arg1) {
14148
- const obj2 = arg1;
14149
- const ret = typeof obj2 === "string" ? obj2 : void 0;
14183
+ const obj3 = arg1;
14184
+ const ret = typeof obj3 === "string" ? obj3 : void 0;
14150
14185
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
14151
14186
  var len1 = WASM_VECTOR_LEN;
14152
14187
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
@@ -14182,9 +14217,9 @@ function __wbg_get_imports() {
14182
14217
  "./cedar_wasm_bg.js": import0
14183
14218
  };
14184
14219
  }
14185
- function addToExternrefTable0(obj2) {
14220
+ function addToExternrefTable0(obj3) {
14186
14221
  const idx = wasm.__externref_table_alloc();
14187
- wasm.__wbindgen_externrefs.set(idx, obj2);
14222
+ wasm.__wbindgen_externrefs.set(idx, obj3);
14188
14223
  return idx;
14189
14224
  }
14190
14225
  function getDataViewMemory0() {
@@ -33126,7 +33161,7 @@ import { readFileSync as readFileSync12 } from "node:fs";
33126
33161
  import { dirname as dirname14, resolve as resolve3 } from "node:path";
33127
33162
  import { fileURLToPath } from "node:url";
33128
33163
  function readVersion() {
33129
- if (true) return "5.5.1-243";
33164
+ if (true) return "5.5.1-249";
33130
33165
  try {
33131
33166
  const here = dirname14(fileURLToPath(import.meta.url));
33132
33167
  const pkg = JSON.parse(
@@ -62834,8 +62869,266 @@ var init_context_window = __esm({
62834
62869
  }
62835
62870
  });
62836
62871
 
62837
- // ../../packages/tacho/src/collector/cache-keep-alive.ts
62872
+ // ../../packages/tacho/src/collector/spawn-attribution.ts
62838
62873
  import { createHash as createHash17 } from "node:crypto";
62874
+ function obj(value) {
62875
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
62876
+ }
62877
+ function promptDigest(text6) {
62878
+ return `sha256:${createHash17("sha256").update(text6, "utf8").digest("hex")}`;
62879
+ }
62880
+ function openingDigests(request4) {
62881
+ const messages = request4?.["messages"];
62882
+ if (!Array.isArray(messages)) return [];
62883
+ const first = messages.map(obj).find((message2) => message2?.["role"] === "user");
62884
+ if (first === void 0) return [];
62885
+ const content = first["content"];
62886
+ const texts = [];
62887
+ if (typeof content === "string") texts.push(content);
62888
+ else if (Array.isArray(content)) {
62889
+ for (const block of content) {
62890
+ if (texts.length >= OPENING_BLOCKS_MAX) break;
62891
+ const text6 = obj(block);
62892
+ if (text6?.["type"] === "text" && typeof text6["text"] === "string")
62893
+ texts.push(text6["text"]);
62894
+ }
62895
+ }
62896
+ return [...new Set(texts.filter((text6) => text6 !== "").map(promptDigest))];
62897
+ }
62898
+ function spawnOf(name2, id2, input2) {
62899
+ if (typeof name2 !== "string" || !SPAWN_TOOL_NAMES.has(name2)) return void 0;
62900
+ if (typeof id2 !== "string" || id2 === "") return void 0;
62901
+ const prompt = obj(input2)?.["prompt"];
62902
+ if (typeof prompt !== "string" || prompt === "") return void 0;
62903
+ return { toolUseId: id2, promptDigest: promptDigest(prompt) };
62904
+ }
62905
+ var SPAWN_TOOL_NAMES, OPENING_BLOCKS_MAX, SPAWN_INPUT_BYTES_MAX, SPAWN_LINE_BYTES_MAX, SPAWN_DOCUMENT_BYTES_MAX, SESSION_SPAWNS_MAX, SESSION_OPENINGS_MAX, DATA_PREFIX, BLOCK_START_MARKER, BLOCK_STOP_MARKER, INPUT_DELTA_MARKER, TOOL_USE_MARKER, SpawnObserver, SpawnLedger;
62906
+ var init_spawn_attribution = __esm({
62907
+ "../../packages/tacho/src/collector/spawn-attribution.ts"() {
62908
+ "use strict";
62909
+ SPAWN_TOOL_NAMES = /* @__PURE__ */ new Set(["Agent", "Task"]);
62910
+ OPENING_BLOCKS_MAX = 32;
62911
+ SPAWN_INPUT_BYTES_MAX = 1024 * 1024;
62912
+ SPAWN_LINE_BYTES_MAX = 2 * 1024 * 1024;
62913
+ SPAWN_DOCUMENT_BYTES_MAX = 8 * 1024 * 1024;
62914
+ SESSION_SPAWNS_MAX = 2048;
62915
+ SESSION_OPENINGS_MAX = 8192;
62916
+ DATA_PREFIX = Buffer.from("data:");
62917
+ BLOCK_START_MARKER = Buffer.from('"content_block_start"');
62918
+ BLOCK_STOP_MARKER = Buffer.from('"content_block_stop"');
62919
+ INPUT_DELTA_MARKER = Buffer.from('"input_json_delta"');
62920
+ TOOL_USE_MARKER = Buffer.from('"tool_use"');
62921
+ SpawnObserver = class {
62922
+ onSpawn;
62923
+ streaming;
62924
+ sniffed;
62925
+ line = [];
62926
+ lineBytes = 0;
62927
+ lineOverflow = false;
62928
+ document = [];
62929
+ documentBytes = 0;
62930
+ documentOverflow = false;
62931
+ open = /* @__PURE__ */ new Map();
62932
+ constructor(contentType, onSpawn) {
62933
+ this.onSpawn = onSpawn;
62934
+ this.streaming = (contentType ?? "").includes("text/event-stream");
62935
+ this.sniffed = this.streaming;
62936
+ }
62937
+ write(chunk) {
62938
+ if (!this.sniffed && chunk.length > 0) {
62939
+ this.sniffed = true;
62940
+ const head3 = chunk.subarray(0, 64).toString("latin1").trimStart();
62941
+ if (/^(event|data|id|retry)?:/.test(head3)) this.streaming = true;
62942
+ }
62943
+ if (!this.streaming) {
62944
+ if (this.documentOverflow) return;
62945
+ this.documentBytes += chunk.length;
62946
+ if (this.documentBytes > SPAWN_DOCUMENT_BYTES_MAX) {
62947
+ this.documentOverflow = true;
62948
+ this.document = [];
62949
+ return;
62950
+ }
62951
+ this.document.push(chunk);
62952
+ return;
62953
+ }
62954
+ let start = 0;
62955
+ for (; ; ) {
62956
+ const newline2 = chunk.indexOf(10, start);
62957
+ if (newline2 === -1) {
62958
+ this.holdLine(chunk.subarray(start));
62959
+ return;
62960
+ }
62961
+ this.holdLine(chunk.subarray(start, newline2));
62962
+ this.finishLine();
62963
+ start = newline2 + 1;
62964
+ }
62965
+ }
62966
+ /** Read a response that was not streamed. A stream needs no ending. */
62967
+ end() {
62968
+ if (this.streaming) {
62969
+ if (this.lineBytes > 0) this.finishLine();
62970
+ return;
62971
+ }
62972
+ if (this.documentOverflow || this.documentBytes === 0) return;
62973
+ const bytes = Buffer.concat(this.document);
62974
+ this.document = [];
62975
+ this.documentBytes = 0;
62976
+ if (bytes.indexOf(TOOL_USE_MARKER) === -1) return;
62977
+ let content;
62978
+ try {
62979
+ content = obj(JSON.parse(bytes.toString("utf8")))?.["content"];
62980
+ } catch {
62981
+ return;
62982
+ }
62983
+ if (!Array.isArray(content)) return;
62984
+ for (const entry2 of content) {
62985
+ const block = obj(entry2);
62986
+ if (block?.["type"] !== "tool_use") continue;
62987
+ const spawn10 = spawnOf(block["name"], block["id"], block["input"]);
62988
+ if (spawn10 !== void 0) this.onSpawn(spawn10);
62989
+ }
62990
+ }
62991
+ holdLine(part) {
62992
+ if (part.length === 0 || this.lineOverflow) return;
62993
+ this.lineBytes += part.length;
62994
+ if (this.lineBytes > SPAWN_LINE_BYTES_MAX) {
62995
+ this.lineOverflow = true;
62996
+ this.line = [];
62997
+ return;
62998
+ }
62999
+ this.line.push(part);
63000
+ }
63001
+ finishLine() {
63002
+ const overflow = this.lineOverflow;
63003
+ const line = this.line.length === 1 ? this.line[0] : Buffer.concat(this.line);
63004
+ this.line = [];
63005
+ this.lineBytes = 0;
63006
+ this.lineOverflow = false;
63007
+ if (overflow) {
63008
+ this.open.clear();
63009
+ return;
63010
+ }
63011
+ if (line === void 0 || line.length < 6) return;
63012
+ if (!line.subarray(0, 5).equals(DATA_PREFIX)) return;
63013
+ const opens = line.indexOf(BLOCK_START_MARKER) !== -1 && line.indexOf(TOOL_USE_MARKER) !== -1;
63014
+ const continues = this.open.size > 0 && (line.indexOf(INPUT_DELTA_MARKER) !== -1 || line.indexOf(BLOCK_STOP_MARKER) !== -1);
63015
+ if (!opens && !continues) return;
63016
+ let event;
63017
+ try {
63018
+ event = obj(JSON.parse(line.subarray(5).toString("utf8")));
63019
+ } catch {
63020
+ return;
63021
+ }
63022
+ if (event === void 0) return;
63023
+ const index = event["index"];
63024
+ if (typeof index !== "number") return;
63025
+ const type = event["type"];
63026
+ if (type === "content_block_start") {
63027
+ const block2 = obj(event["content_block"]);
63028
+ if (block2?.["type"] !== "tool_use") return;
63029
+ const name2 = block2["name"];
63030
+ const id2 = block2["id"];
63031
+ if (typeof name2 !== "string" || !SPAWN_TOOL_NAMES.has(name2)) return;
63032
+ if (typeof id2 !== "string" || id2 === "") return;
63033
+ this.open.set(index, {
63034
+ id: id2,
63035
+ name: name2,
63036
+ initial: block2["input"],
63037
+ parts: [],
63038
+ bytes: 0
63039
+ });
63040
+ return;
63041
+ }
63042
+ const block = this.open.get(index);
63043
+ if (block === void 0) return;
63044
+ if (type === "content_block_delta") {
63045
+ const delta = obj(event["delta"]);
63046
+ const part = delta?.["partial_json"];
63047
+ if (delta?.["type"] !== "input_json_delta" || typeof part !== "string")
63048
+ return;
63049
+ block.bytes += Buffer.byteLength(part, "utf8");
63050
+ if (block.bytes > SPAWN_INPUT_BYTES_MAX) {
63051
+ this.open.delete(index);
63052
+ return;
63053
+ }
63054
+ block.parts.push(part);
63055
+ return;
63056
+ }
63057
+ if (type !== "content_block_stop") return;
63058
+ this.open.delete(index);
63059
+ let input2 = block.initial;
63060
+ if (block.parts.length > 0) {
63061
+ try {
63062
+ input2 = JSON.parse(block.parts.join(""));
63063
+ } catch {
63064
+ return;
63065
+ }
63066
+ }
63067
+ const spawn10 = spawnOf(block.name, block.id, input2);
63068
+ if (spawn10 !== void 0) this.onSpawn(spawn10);
63069
+ }
63070
+ };
63071
+ SpawnLedger = class {
63072
+ sessions = /* @__PURE__ */ new Map();
63073
+ of(sessionKey) {
63074
+ let session = this.sessions.get(sessionKey);
63075
+ if (session === void 0) {
63076
+ session = { spawns: /* @__PURE__ */ new Map(), openings: /* @__PURE__ */ new Set(), full: false };
63077
+ this.sessions.set(sessionKey, session);
63078
+ }
63079
+ return session;
63080
+ }
63081
+ /**
63082
+ * Record a spawn the proxy read off a vendor's answer on `sessionKey`.
63083
+ * Ignored when the prompt's text already opened a conversation there, and
63084
+ * when the session is at a memory limit. The first tool call to carry a
63085
+ * prompt keeps it.
63086
+ */
63087
+ noteSpawn(sessionKey, spawn10) {
63088
+ const session = this.of(sessionKey);
63089
+ if (session.full) return;
63090
+ if (session.openings.has(spawn10.promptDigest)) return;
63091
+ if (session.spawns.has(spawn10.promptDigest)) return;
63092
+ if (session.spawns.size >= SESSION_SPAWNS_MAX) {
63093
+ session.full = true;
63094
+ return;
63095
+ }
63096
+ session.spawns.set(spawn10.promptDigest, spawn10.toolUseId);
63097
+ }
63098
+ /**
63099
+ * The tool call that spawned the conversation a request on `sessionKey`
63100
+ * belongs to, by its `openingDigests`, or undefined when the proxy saw no
63101
+ * such spawn. A request with no spawn has its opening hashes remembered,
63102
+ * so no later tool call can claim them.
63103
+ */
63104
+ attribute(sessionKey, openings) {
63105
+ if (openings.length === 0) return void 0;
63106
+ const session = this.of(sessionKey);
63107
+ for (const digest6 of openings) {
63108
+ const toolUseId = session.spawns.get(digest6);
63109
+ if (toolUseId !== void 0) return toolUseId;
63110
+ }
63111
+ for (const digest6 of openings) {
63112
+ if (session.openings.size >= SESSION_OPENINGS_MAX) {
63113
+ session.full = true;
63114
+ break;
63115
+ }
63116
+ session.openings.add(digest6);
63117
+ }
63118
+ return void 0;
63119
+ }
63120
+ /** Drop every session `held` does not name. */
63121
+ keepOnly(held) {
63122
+ for (const sessionKey of this.sessions.keys()) {
63123
+ if (!held.has(sessionKey)) this.sessions.delete(sessionKey);
63124
+ }
63125
+ }
63126
+ };
63127
+ }
63128
+ });
63129
+
63130
+ // ../../packages/tacho/src/collector/cache-keep-alive.ts
63131
+ import { createHash as createHash18 } from "node:crypto";
62839
63132
  function isObject2(value) {
62840
63133
  return typeof value === "object" && value !== null && !Array.isArray(value);
62841
63134
  }
@@ -62872,7 +63165,7 @@ function conversationOf2(request4, model) {
62872
63165
  withoutCacheMarkers(request4["tools"] ?? null),
62873
63166
  withoutCacheMarkers(first ?? null)
62874
63167
  ]);
62875
- return `sha256:${createHash17("sha256").update(text6).digest("hex")}`;
63168
+ return `sha256:${createHash18("sha256").update(text6).digest("hex")}`;
62876
63169
  }
62877
63170
  function ttlOf(usage3, previous) {
62878
63171
  const oneHour = usage3.cacheCreation1hTokens ?? 0;
@@ -63291,7 +63584,7 @@ var init_model_pricing = __esm({
63291
63584
  });
63292
63585
 
63293
63586
  // ../../packages/tacho/src/model-steering.ts
63294
- import { createHash as createHash18 } from "node:crypto";
63587
+ import { createHash as createHash19 } from "node:crypto";
63295
63588
  function withSteeringDelivery(manifest, request4, transformations) {
63296
63589
  return {
63297
63590
  ...manifest,
@@ -63302,7 +63595,7 @@ function withSteeringDelivery(manifest, request4, transformations) {
63302
63595
  };
63303
63596
  }
63304
63597
  function steeringTextHash(text6) {
63305
- return `sha256:${createHash18("sha256").update(text6.trim(), "utf8").digest("hex")}`;
63598
+ return `sha256:${createHash19("sha256").update(text6.trim(), "utf8").digest("hex")}`;
63306
63599
  }
63307
63600
  function* instructionParts2(text6, boundary) {
63308
63601
  let start = 0;
@@ -63653,7 +63946,7 @@ import {
63653
63946
  function hasTokenCounts(usage3) {
63654
63947
  return usage3.inputTokens !== void 0 || usage3.outputTokens !== void 0 || usage3.cacheReadTokens !== void 0 || usage3.cacheCreationTokens !== void 0;
63655
63948
  }
63656
- function obj(value) {
63949
+ function obj2(value) {
63657
63950
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
63658
63951
  }
63659
63952
  function count6(value) {
@@ -63674,7 +63967,7 @@ function foldAnthropicUsage(into, usage3) {
63674
63967
  "cacheCreationTokens",
63675
63968
  count6(usage3["cache_creation_input_tokens"])
63676
63969
  );
63677
- const creation = obj(usage3["cache_creation"]);
63970
+ const creation = obj2(usage3["cache_creation"]);
63678
63971
  if (creation !== void 0) {
63679
63972
  assign(
63680
63973
  into,
@@ -63692,8 +63985,8 @@ function foldAnthropicUsage(into, usage3) {
63692
63985
  function foldOpenAiUsage(into, usage3) {
63693
63986
  const input2 = count6(usage3["input_tokens"]) ?? count6(usage3["prompt_tokens"]);
63694
63987
  const output2 = count6(usage3["output_tokens"]) ?? count6(usage3["completion_tokens"]);
63695
- const inputDetails = obj(usage3["input_tokens_details"]) ?? obj(usage3["prompt_tokens_details"]);
63696
- const outputDetails = obj(usage3["output_tokens_details"]) ?? obj(usage3["completion_tokens_details"]);
63988
+ const inputDetails = obj2(usage3["input_tokens_details"]) ?? obj2(usage3["prompt_tokens_details"]);
63989
+ const outputDetails = obj2(usage3["output_tokens_details"]) ?? obj2(usage3["completion_tokens_details"]);
63697
63990
  const cached4 = count6(inputDetails?.["cached_tokens"]);
63698
63991
  if (input2 !== void 0)
63699
63992
  into.inputTokens = Math.max(0, input2 - (cached4 ?? 0));
@@ -63705,34 +63998,34 @@ function errorKind(value) {
63705
63998
  return typeof value === "string" && value.length > 0 ? value.replace(/[^A-Za-z0-9_.-]/g, "_").slice(0, 64) : void 0;
63706
63999
  }
63707
64000
  function foldUsageDocument(into, api, doc) {
63708
- const root = obj(doc);
64001
+ const root = obj2(doc);
63709
64002
  if (root === void 0) return false;
63710
64003
  if (api === "anthropic.messages") {
63711
64004
  const type = root["type"];
63712
64005
  if (type === "error") {
63713
- into.streamError = errorKind(obj(root["error"])?.["type"]) ?? "error";
64006
+ into.streamError = errorKind(obj2(root["error"])?.["type"]) ?? "error";
63714
64007
  return true;
63715
64008
  }
63716
64009
  if (type === "message_start") {
63717
- const message2 = obj(root["message"]);
64010
+ const message2 = obj2(root["message"]);
63718
64011
  if (message2 === void 0) return false;
63719
64012
  assign(into, "model", text3(message2["model"]));
63720
64013
  assign(into, "responseId", text3(message2["id"]));
63721
- const usage3 = obj(message2["usage"]);
64014
+ const usage3 = obj2(message2["usage"]);
63722
64015
  if (usage3 !== void 0) foldAnthropicUsage(into, usage3);
63723
64016
  return false;
63724
64017
  }
63725
64018
  if (type === "message_delta") {
63726
- const usage3 = obj(root["usage"]);
64019
+ const usage3 = obj2(root["usage"]);
63727
64020
  if (usage3 !== void 0) foldAnthropicUsage(into, usage3);
63728
- assign(into, "stopReason", text3(obj(root["delta"])?.["stop_reason"]));
64021
+ assign(into, "stopReason", text3(obj2(root["delta"])?.["stop_reason"]));
63729
64022
  return true;
63730
64023
  }
63731
64024
  if (type === "message" || type === void 0) {
63732
64025
  assign(into, "model", text3(root["model"]));
63733
64026
  assign(into, "responseId", text3(root["id"]));
63734
64027
  assign(into, "stopReason", text3(root["stop_reason"]));
63735
- const usage3 = obj(root["usage"]);
64028
+ const usage3 = obj2(root["usage"]);
63736
64029
  if (usage3 !== void 0) foldAnthropicUsage(into, usage3);
63737
64030
  return true;
63738
64031
  }
@@ -63741,23 +64034,23 @@ function foldUsageDocument(into, api, doc) {
63741
64034
  if (api === "openai.responses") {
63742
64035
  const type = root["type"];
63743
64036
  if (type === "error") {
63744
- const error2 = obj(root["error"]);
64037
+ const error2 = obj2(root["error"]);
63745
64038
  into.streamError = errorKind(root["code"]) ?? errorKind(error2?.["code"]) ?? errorKind(error2?.["type"]) ?? "error";
63746
64039
  return true;
63747
64040
  }
63748
- const response = obj(root["response"]) ?? root;
64041
+ const response = obj2(root["response"]) ?? root;
63749
64042
  assign(into, "model", text3(response["model"]));
63750
64043
  assign(into, "responseId", text3(response["id"]));
63751
64044
  assign(into, "stopReason", text3(response["status"]));
63752
64045
  assign(into, "serviceTier", text3(response["service_tier"]));
63753
64046
  if (type === "response.failed")
63754
- into.streamError = errorKind(obj(response["error"])?.["code"]) ?? "response_failed";
63755
- const usage3 = obj(response["usage"]);
64047
+ into.streamError = errorKind(obj2(response["error"])?.["code"]) ?? "response_failed";
64048
+ const usage3 = obj2(response["usage"]);
63756
64049
  if (usage3 !== void 0) foldOpenAiUsage(into, usage3);
63757
64050
  return typeof type === "string" ? RESPONSES_ENDINGS.has(type) : usage3 !== void 0;
63758
64051
  }
63759
64052
  if (api === "openai.chat") {
63760
- const usage3 = obj(root["usage"]);
64053
+ const usage3 = obj2(root["usage"]);
63761
64054
  if (usage3 === void 0) return false;
63762
64055
  foldOpenAiUsage(into, usage3);
63763
64056
  assign(into, "model", text3(root["model"]));
@@ -63793,7 +64086,7 @@ function decoderFor(encoding) {
63793
64086
  if (name2 === "zstd") return createZstdDecompress();
63794
64087
  return void 0;
63795
64088
  }
63796
- var RESPONSES_ENDINGS, MAX_LINE_BYTES2, MAX_DOCUMENT_BYTES, USAGE_MARKER, ERROR_MARKERS, DATA_PREFIX, DONE_MARKER, DELTA_MARKERS, BYTES_PER_TOKEN, UsageMeter;
64089
+ var RESPONSES_ENDINGS, MAX_LINE_BYTES2, MAX_DOCUMENT_BYTES, USAGE_MARKER, ERROR_MARKERS, DATA_PREFIX2, DONE_MARKER, DELTA_MARKERS, BYTES_PER_TOKEN, UsageMeter;
63797
64090
  var init_model_usage = __esm({
63798
64091
  "../../packages/tacho/src/collector/model-usage.ts"() {
63799
64092
  "use strict";
@@ -63809,7 +64102,7 @@ var init_model_usage = __esm({
63809
64102
  Buffer.from('"type":"error"'),
63810
64103
  Buffer.from('"response.failed"')
63811
64104
  ];
63812
- DATA_PREFIX = Buffer.from("data:");
64105
+ DATA_PREFIX2 = Buffer.from("data:");
63813
64106
  DONE_MARKER = Buffer.from("[DONE]");
63814
64107
  DELTA_MARKERS = {
63815
64108
  "anthropic.messages": ['"text":"', '"partial_json":"', '"thinking":"'].map(
@@ -63911,7 +64204,7 @@ var init_model_usage = __esm({
63911
64204
  this.lineOverflow = false;
63912
64205
  if (overflow || line === void 0) return;
63913
64206
  if (line.length < 6 || line[0] !== 100) return;
63914
- if (!line.subarray(0, 5).equals(DATA_PREFIX)) return;
64207
+ if (!line.subarray(0, 5).equals(DATA_PREFIX2)) return;
63915
64208
  for (const marker of DELTA_MARKERS[this.api]) {
63916
64209
  const at2 = line.indexOf(marker);
63917
64210
  if (at2 !== -1) this.deltaBytes += stringBytes(line, at2 + marker.length);
@@ -63959,7 +64252,7 @@ var init_model_usage = __esm({
63959
64252
  });
63960
64253
 
63961
64254
  // ../../packages/tacho/src/collector/model-proxy.ts
63962
- import { createHash as createHash19 } from "node:crypto";
64255
+ import { createHash as createHash20 } from "node:crypto";
63963
64256
  import {
63964
64257
  request as httpRequest2,
63965
64258
  Agent as HttpAgent
@@ -64250,6 +64543,7 @@ function createModelProxy(deps) {
64250
64543
  });
64251
64544
  const observed = /* @__PURE__ */ new Map();
64252
64545
  const priors = new RequestPrefixMemory();
64546
+ const spawns = new SpawnLedger();
64253
64547
  let callsObserved = 0;
64254
64548
  let refused3 = 0;
64255
64549
  const handoffs = /* @__PURE__ */ new WeakMap();
@@ -64293,6 +64587,7 @@ function createModelProxy(deps) {
64293
64587
  map2.delete(sessionUuid2);
64294
64588
  }
64295
64589
  }
64590
+ spawns.keepOnly(held2);
64296
64591
  }
64297
64592
  function spendFor(sessionUuid2) {
64298
64593
  let value = spent.get(sessionUuid2);
@@ -64955,7 +65250,7 @@ function createModelProxy(deps) {
64955
65250
  const status2 = response.statusCode ?? 502;
64956
65251
  const firstByteAt = deps.now();
64957
65252
  const chunks = [];
64958
- const hash5 = createHash19("sha256");
65253
+ const hash5 = createHash20("sha256");
64959
65254
  let bytes = 0;
64960
65255
  let over = false;
64961
65256
  response.on("data", (chunk) => {
@@ -65541,6 +65836,7 @@ function createModelProxy(deps) {
65541
65836
  return void 0;
65542
65837
  return keepAliveCandidateOf(request4, conversation);
65543
65838
  })();
65839
+ const spawnedBy = metered && route.api === "anthropic.messages" && record2 !== void 0 ? spawns.attribute(sessionKey, openingDigests(json3())) : void 0;
65544
65840
  decoded = void 0;
65545
65841
  parsed2 = void 0;
65546
65842
  const target = upstreamUrlFor(
@@ -65564,9 +65860,21 @@ function createModelProxy(deps) {
65564
65860
  let requestId;
65565
65861
  let responseType;
65566
65862
  let responseBytes = 0;
65567
- const responseHash = createHash19("sha256");
65863
+ const responseHash = createHash20("sha256");
65568
65864
  const responseBody = new BodyCapture();
65569
65865
  let meter;
65866
+ let spawnObserver;
65867
+ const observeSpawns = (step) => {
65868
+ if (spawnObserver === void 0) return;
65869
+ try {
65870
+ step(spawnObserver);
65871
+ } catch (error2) {
65872
+ spawnObserver = void 0;
65873
+ deps.log(
65874
+ `model proxy: reading subagent spawns off the answer failed: ${error2 instanceof Error ? error2.message : String(error2)} session=${sessionKey}`
65875
+ );
65876
+ }
65877
+ };
65570
65878
  let settledUsage;
65571
65879
  let currentAttach = credential.attach;
65572
65880
  let currentMember = credential.member;
@@ -65592,6 +65900,7 @@ function createModelProxy(deps) {
65592
65900
  attempt.done = true;
65593
65901
  set2.delete(entry2);
65594
65902
  if (set2.size === 0) inFlight.delete(sessionKey);
65903
+ observeSpawns((observer) => observer.end());
65595
65904
  let metering;
65596
65905
  try {
65597
65906
  metering = meterCall(errorClass2);
@@ -65779,6 +66088,7 @@ function createModelProxy(deps) {
65779
66088
  } : {},
65780
66089
  ...sessionSighting?.attrs,
65781
66090
  [TACHO_METERING_ATTR]: TACHO_METERING_OBSERVED,
66091
+ ...spawnedBy !== void 0 ? { [TACHO_SPAWNED_BY_ATTR]: spawnedBy } : {},
65782
66092
  "oxagen.request_digest": requestDigest,
65783
66093
  "oxagen.request_bytes": String(requestBytes),
65784
66094
  ...requestWindow !== null ? { [CONTEXT_WINDOW_ATTR]: encodeWindowAttr(requestWindow) } : {},
@@ -65847,6 +66157,10 @@ function createModelProxy(deps) {
65847
66157
  metered && status2 < 400 ? route.api : "other",
65848
66158
  typeof contentType === "string" ? contentType : void 0
65849
66159
  );
66160
+ spawnObserver = metered && status2 < 400 && route.api === "anthropic.messages" && record2 !== void 0 ? new SpawnObserver(
66161
+ typeof contentType === "string" ? contentType : void 0,
66162
+ (spawn10) => spawns.noteSpawn(sessionKey, spawn10)
66163
+ ) : void 0;
65850
66164
  const contentEncoding = upstream.headers["content-encoding"];
65851
66165
  const decoder4 = decoderFor(
65852
66166
  typeof contentEncoding === "string" ? contentEncoding : void 0
@@ -65855,6 +66169,7 @@ function createModelProxy(deps) {
65855
66169
  decoder4?.on("data", (chunk) => {
65856
66170
  if (settled2) return;
65857
66171
  meter?.write(chunk);
66172
+ observeSpawns((observer) => observer.write(chunk));
65858
66173
  responseBody.write(chunk);
65859
66174
  });
65860
66175
  decoder4?.on("error", () => {
@@ -65884,6 +66199,7 @@ function createModelProxy(deps) {
65884
66199
  if (decoder4 !== void 0) decoder4.write(chunk);
65885
66200
  else if (!compressed) {
65886
66201
  meter?.write(chunk);
66202
+ observeSpawns((observer) => observer.write(chunk));
65887
66203
  responseBody.write(chunk);
65888
66204
  }
65889
66205
  });
@@ -66309,6 +66625,7 @@ var init_model_proxy = __esm({
66309
66625
  init_model_failure();
66310
66626
  init_run_token();
66311
66627
  init_wire();
66628
+ init_spawn_attribution();
66312
66629
  init_cache_keep_alive();
66313
66630
  init_loopback_guard();
66314
66631
  init_day_spend();
@@ -80552,7 +80869,7 @@ var init_package = __esm({
80552
80869
  "package.json"() {
80553
80870
  package_default = {
80554
80871
  name: "@oxagen/cli",
80555
- version: "5.5.1-243",
80872
+ version: "5.5.1-249",
80556
80873
  description: "Oxagen governance CLI: spend, source tracking, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
80557
80874
  type: "module",
80558
80875
  main: "./dist/index.js",
@@ -83366,9 +83683,9 @@ var init_status2 = __esm({
83366
83683
  });
83367
83684
 
83368
83685
  // ../../packages/codegraph/src/hash.ts
83369
- import { createHash as createHash20 } from "node:crypto";
83686
+ import { createHash as createHash21 } from "node:crypto";
83370
83687
  function sha256Hex2(input2) {
83371
- return createHash20("sha256").update(input2).digest("hex");
83688
+ return createHash21("sha256").update(input2).digest("hex");
83372
83689
  }
83373
83690
  var init_hash = __esm({
83374
83691
  "../../packages/codegraph/src/hash.ts"() {
@@ -86051,7 +86368,7 @@ var require_anchors = __commonJS({
86051
86368
  var require_applyReviver = __commonJS({
86052
86369
  "../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/doc/applyReviver.js"(exports) {
86053
86370
  "use strict";
86054
- function applyReviver(reviver, obj2, key, val) {
86371
+ function applyReviver(reviver, obj3, key, val) {
86055
86372
  if (val && typeof val === "object") {
86056
86373
  if (Array.isArray(val)) {
86057
86374
  for (let i2 = 0, len = val.length; i2 < len; ++i2) {
@@ -86091,7 +86408,7 @@ var require_applyReviver = __commonJS({
86091
86408
  }
86092
86409
  }
86093
86410
  }
86094
- return reviver.call(obj2, key, val);
86411
+ return reviver.call(obj3, key, val);
86095
86412
  }
86096
86413
  exports.applyReviver = applyReviver;
86097
86414
  }
@@ -87027,10 +87344,10 @@ var require_stringify = __commonJS({
87027
87344
  return match.find((t) => t.format === item.format) ?? match[0];
87028
87345
  }
87029
87346
  let tagObj = void 0;
87030
- let obj2;
87347
+ let obj3;
87031
87348
  if (identity.isScalar(item)) {
87032
- obj2 = item.value;
87033
- let match = tags.filter((t) => t.identify?.(obj2));
87349
+ obj3 = item.value;
87350
+ let match = tags.filter((t) => t.identify?.(obj3));
87034
87351
  if (match.length > 1) {
87035
87352
  const testMatch = match.filter((t) => t.test);
87036
87353
  if (testMatch.length > 0)
@@ -87038,11 +87355,11 @@ var require_stringify = __commonJS({
87038
87355
  }
87039
87356
  tagObj = match.find((t) => t.format === item.format) ?? match.find((t) => !t.format);
87040
87357
  } else {
87041
- obj2 = item;
87042
- tagObj = tags.find((t) => t.nodeClass && obj2 instanceof t.nodeClass);
87358
+ obj3 = item;
87359
+ tagObj = tags.find((t) => t.nodeClass && obj3 instanceof t.nodeClass);
87043
87360
  }
87044
87361
  if (!tagObj) {
87045
- const name2 = obj2?.constructor?.name ?? (obj2 === null ? "null" : typeof obj2);
87362
+ const name2 = obj3?.constructor?.name ?? (obj3 === null ? "null" : typeof obj3);
87046
87363
  throw new Error(`Tag not resolved for ${name2} value`);
87047
87364
  }
87048
87365
  return tagObj;
@@ -87598,23 +87915,23 @@ var require_YAMLMap = __commonJS({
87598
87915
  * A generic collection parsing method that can be extended
87599
87916
  * to other node classes that inherit from YAMLMap
87600
87917
  */
87601
- static from(schema, obj2, ctx2) {
87918
+ static from(schema, obj3, ctx2) {
87602
87919
  const { keepUndefined, replacer } = ctx2;
87603
87920
  const map2 = new this(schema);
87604
87921
  const add2 = (key, value) => {
87605
87922
  if (typeof replacer === "function")
87606
- value = replacer.call(obj2, key, value);
87923
+ value = replacer.call(obj3, key, value);
87607
87924
  else if (Array.isArray(replacer) && !replacer.includes(key))
87608
87925
  return;
87609
87926
  if (value !== void 0 || keepUndefined)
87610
87927
  map2.items.push(Pair.createPair(key, value, ctx2));
87611
87928
  };
87612
- if (obj2 instanceof Map) {
87613
- for (const [key, value] of obj2)
87929
+ if (obj3 instanceof Map) {
87930
+ for (const [key, value] of obj3)
87614
87931
  add2(key, value);
87615
- } else if (obj2 && typeof obj2 === "object") {
87616
- for (const key of Object.keys(obj2))
87617
- add2(key, obj2[key]);
87932
+ } else if (obj3 && typeof obj3 === "object") {
87933
+ for (const key of Object.keys(obj3))
87934
+ add2(key, obj3[key]);
87618
87935
  }
87619
87936
  if (typeof schema.sortMapEntries === "function") {
87620
87937
  map2.items.sort(schema.sortMapEntries);
@@ -87724,7 +88041,7 @@ var require_map = __commonJS({
87724
88041
  onError("Expected a mapping for this tag");
87725
88042
  return map3;
87726
88043
  },
87727
- createNode: (schema, obj2, ctx2) => YAMLMap.YAMLMap.from(schema, obj2, ctx2)
88044
+ createNode: (schema, obj3, ctx2) => YAMLMap.YAMLMap.from(schema, obj3, ctx2)
87728
88045
  };
87729
88046
  exports.map = map2;
87730
88047
  }
@@ -87820,15 +88137,15 @@ var require_YAMLSeq = __commonJS({
87820
88137
  onComment
87821
88138
  });
87822
88139
  }
87823
- static from(schema, obj2, ctx2) {
88140
+ static from(schema, obj3, ctx2) {
87824
88141
  const { replacer } = ctx2;
87825
88142
  const seq2 = new this(schema);
87826
- if (obj2 && Symbol.iterator in Object(obj2)) {
88143
+ if (obj3 && Symbol.iterator in Object(obj3)) {
87827
88144
  let i2 = 0;
87828
- for (let it of obj2) {
88145
+ for (let it of obj3) {
87829
88146
  if (typeof replacer === "function") {
87830
- const key = obj2 instanceof Set ? it : String(i2++);
87831
- it = replacer.call(obj2, key, it);
88147
+ const key = obj3 instanceof Set ? it : String(i2++);
88148
+ it = replacer.call(obj3, key, it);
87832
88149
  }
87833
88150
  seq2.items.push(createNode.createNode(it, void 0, ctx2));
87834
88151
  }
@@ -87862,7 +88179,7 @@ var require_seq = __commonJS({
87862
88179
  onError("Expected a sequence for this tag");
87863
88180
  return seq3;
87864
88181
  },
87865
- createNode: (schema, obj2, ctx2) => YAMLSeq.YAMLSeq.from(schema, obj2, ctx2)
88182
+ createNode: (schema, obj3, ctx2) => YAMLSeq.YAMLSeq.from(schema, obj3, ctx2)
87866
88183
  };
87867
88184
  exports.seq = seq2;
87868
88185
  }
@@ -93969,6 +94286,190 @@ var init_codegraph_catalogue = __esm({
93969
94286
  }
93970
94287
  });
93971
94288
 
94289
+ // ../../packages/oxagen/src/secret-fields.ts
94290
+ function defOf(schema) {
94291
+ if (typeof schema !== "object" || schema === null) return null;
94292
+ const def = schema._def;
94293
+ return typeof def === "object" && def !== null ? def : null;
94294
+ }
94295
+ function secretField(schema) {
94296
+ const def = defOf(schema);
94297
+ if (def === null) {
94298
+ throw new TypeError("secretField() marks a zod schema, and got none");
94299
+ }
94300
+ const Schema = schema.constructor;
94301
+ return new Schema({ ...def, [SECRET_MARK]: true });
94302
+ }
94303
+ function callDefFunction(value) {
94304
+ if (typeof value !== "function") return void 0;
94305
+ return value();
94306
+ }
94307
+ function isMarked(def) {
94308
+ return def[SECRET_MARK] === true;
94309
+ }
94310
+ function isRecord8(value) {
94311
+ return typeof value === "object" && value !== null && !Array.isArray(value);
94312
+ }
94313
+ function childrenOf(def) {
94314
+ const same = (schema) => ({ step: SAME, schema });
94315
+ switch (def["typeName"]) {
94316
+ case "ZodObject": {
94317
+ const shape = callDefFunction(def["shape"]);
94318
+ const children = isRecord8(shape) ? Object.entries(shape).map(
94319
+ ([key, schema]) => ({ step: { kind: "key", key }, schema })
94320
+ ) : [];
94321
+ const named2 = new Set(isRecord8(shape) ? Object.keys(shape) : []);
94322
+ children.push({
94323
+ step: { kind: "entry", skip: named2 },
94324
+ schema: def["catchall"]
94325
+ });
94326
+ return children;
94327
+ }
94328
+ case "ZodOptional":
94329
+ case "ZodNullable":
94330
+ case "ZodDefault":
94331
+ case "ZodCatch":
94332
+ case "ZodReadonly":
94333
+ return [same(def["innerType"])];
94334
+ case "ZodEffects":
94335
+ return [same(def["schema"])];
94336
+ case "ZodBranded":
94337
+ case "ZodPromise":
94338
+ return [same(def["type"])];
94339
+ case "ZodPipeline":
94340
+ return [same(def["in"]), same(def["out"])];
94341
+ case "ZodLazy":
94342
+ return [same(callDefFunction(def["getter"]))];
94343
+ case "ZodUnion":
94344
+ case "ZodDiscriminatedUnion": {
94345
+ const options = def["options"];
94346
+ return Array.isArray(options) ? options.map((option) => same(option)) : [];
94347
+ }
94348
+ case "ZodIntersection":
94349
+ return [same(def["left"]), same(def["right"])];
94350
+ case "ZodArray":
94351
+ return [{ step: ELEMENT, schema: def["type"] }];
94352
+ case "ZodSet":
94353
+ return [{ step: ELEMENT, schema: def["valueType"] }];
94354
+ case "ZodTuple": {
94355
+ const items = def["items"];
94356
+ const children = Array.isArray(items) ? items.map(
94357
+ (schema, index) => ({
94358
+ step: { kind: "index", index },
94359
+ schema
94360
+ })
94361
+ ) : [];
94362
+ children.push({ step: ELEMENT, schema: def["rest"] });
94363
+ return children;
94364
+ }
94365
+ case "ZodRecord":
94366
+ case "ZodMap":
94367
+ return [{ step: { kind: "entry" }, schema: def["valueType"] }];
94368
+ default:
94369
+ return [];
94370
+ }
94371
+ }
94372
+ function pathStep(path2, step) {
94373
+ switch (step.kind) {
94374
+ case "same":
94375
+ return path2;
94376
+ case "key":
94377
+ return path2 === "" ? step.key : `${path2}.${step.key}`;
94378
+ case "index":
94379
+ return `${path2}[${step.index}]`;
94380
+ case "element":
94381
+ return `${path2}[]`;
94382
+ case "entry":
94383
+ return path2 === "" ? "*" : `${path2}.*`;
94384
+ }
94385
+ }
94386
+ function walkSchema(schema, enter) {
94387
+ const open8 = /* @__PURE__ */ new Set();
94388
+ const walk2 = (node3, path2, step) => {
94389
+ const def = defOf(node3);
94390
+ if (def === null || open8.has(node3)) return;
94391
+ if (open8.size >= MAX_DEPTH) {
94392
+ throw new Error(
94393
+ `A schema nests deeper than ${MAX_DEPTH} levels at "${path2}", so its secret fields cannot be read`
94394
+ );
94395
+ }
94396
+ if (!enter(def, path2, step)) return;
94397
+ open8.add(node3);
94398
+ for (const child of childrenOf(def)) {
94399
+ walk2(child.schema, pathStep(path2, child.step), child.step);
94400
+ }
94401
+ open8.delete(node3);
94402
+ };
94403
+ walk2(schema, "", null);
94404
+ }
94405
+ function secretFieldPaths(schema) {
94406
+ const found = /* @__PURE__ */ new Set();
94407
+ walkSchema(schema, (def, path2) => {
94408
+ if (!isMarked(def)) return true;
94409
+ found.add(path2 === "" ? "(the whole value)" : path2);
94410
+ return false;
94411
+ });
94412
+ return [...found].sort();
94413
+ }
94414
+ function hasSecretField(schema) {
94415
+ if (typeof schema !== "object" || schema === null) return false;
94416
+ const known = HAS_SECRET.get(schema);
94417
+ if (known !== void 0) return known;
94418
+ const seen = /* @__PURE__ */ new Set();
94419
+ const reaches2 = (node3, depth) => {
94420
+ const def = defOf(node3);
94421
+ if (def === null || seen.has(node3)) return false;
94422
+ if (depth >= MAX_DEPTH) {
94423
+ throw new Error(
94424
+ `A schema nests deeper than ${MAX_DEPTH} levels, so its secret fields cannot be read`
94425
+ );
94426
+ }
94427
+ seen.add(node3);
94428
+ return isMarked(def) || childrenOf(def).some((child) => reaches2(child.schema, depth + 1));
94429
+ };
94430
+ const answer = reaches2(schema, 0);
94431
+ HAS_SECRET.set(schema, answer);
94432
+ return answer;
94433
+ }
94434
+ function isModelSurface(surface) {
94435
+ return MODEL_SURFACES.some((modelSurface) => modelSurface === surface);
94436
+ }
94437
+ function secretSurfaceProblem(cap) {
94438
+ const surfaces = getSurfaces(cap).filter(isModelSurface);
94439
+ if (surfaces.length === 0) return null;
94440
+ const on = surfaces.map((surface) => `"${surface}"`).join(" and ");
94441
+ if (hasSecretField(cap.output)) {
94442
+ return `"${cap.name}" returns a secret (${secretFieldPaths(cap.output).join(", ")}) and is on the ${on} surface. A tool result lands in the model's transcript. Take the capability off that surface: a secret is read through the API or the CLI.`;
94443
+ }
94444
+ if (cap.modelInput === void 0) {
94445
+ if (!hasSecretField(cap.input)) return null;
94446
+ return `"${cap.name}" takes a secret (${secretFieldPaths(cap.input).join(", ")}) and is on the ${on} surface with no modelInput. A tool argument lands in the model's transcript. Declare a modelInput that leaves the secret out, or take the capability off that surface.`;
94447
+ }
94448
+ if (hasSecretField(cap.modelInput)) {
94449
+ return `"${cap.name}" declares a modelInput that still takes a secret (${secretFieldPaths(cap.modelInput).join(", ")}). A modelInput is the input with every secret left out.`;
94450
+ }
94451
+ if (!hasSecretField(cap.input)) {
94452
+ return `"${cap.name}" declares a modelInput, and its input marks no secret. Mark the secret with secretField(), or remove the modelInput.`;
94453
+ }
94454
+ return null;
94455
+ }
94456
+ var SECRET_MARK, SAME, ELEMENT, MAX_DEPTH, HAS_SECRET, MODEL_SURFACES;
94457
+ var init_secret_fields = __esm({
94458
+ "../../packages/oxagen/src/secret-fields.ts"() {
94459
+ "use strict";
94460
+ init_types4();
94461
+ SECRET_MARK = /* @__PURE__ */ Symbol.for("@oxagen/oxagen.secretField");
94462
+ SAME = { kind: "same" };
94463
+ ELEMENT = { kind: "element" };
94464
+ MAX_DEPTH = 200;
94465
+ HAS_SECRET = /* @__PURE__ */ new WeakMap();
94466
+ MODEL_SURFACES = [
94467
+ "mcp",
94468
+ "agent"
94469
+ ];
94470
+ }
94471
+ });
94472
+
93972
94473
  // ../../packages/oxagen/src/registry.ts
93973
94474
  function capabilitySignature(cap) {
93974
94475
  return JSON.stringify(cap, (_key, value) => {
@@ -93983,6 +94484,10 @@ function registerCapability(cap) {
93983
94484
  if (surfaceProblem !== null) {
93984
94485
  throw new Error(`code_graph_surface_mismatch: ${surfaceProblem}`);
93985
94486
  }
94487
+ const secretProblem = secretSurfaceProblem(cap);
94488
+ if (secretProblem !== null) {
94489
+ throw new Error(`secret_on_model_surface: ${secretProblem}`);
94490
+ }
93986
94491
  const existing = registry.get(cap.name);
93987
94492
  if (existing) {
93988
94493
  if (capabilitySignature(existing) === capabilitySignature(cap)) {
@@ -94003,6 +94508,7 @@ var init_registry4 = __esm({
94003
94508
  "../../packages/oxagen/src/registry.ts"() {
94004
94509
  "use strict";
94005
94510
  init_codegraph_catalogue();
94511
+ init_secret_fields();
94006
94512
  REGISTRY_KEY = /* @__PURE__ */ Symbol.for("@oxagen/oxagen.capabilityRegistry");
94007
94513
  globalRef = globalThis;
94008
94514
  registry = globalRef[REGISTRY_KEY] ?? (globalRef[REGISTRY_KEY] = /* @__PURE__ */ new Map());
@@ -95541,9 +96047,12 @@ var init_work_order_shared = __esm({
95541
96047
  "../../packages/oxagen/src/contracts/work.order.shared.ts"() {
95542
96048
  "use strict";
95543
96049
  init_zod();
96050
+ init_secret_fields();
95544
96051
  init_work_intake_shared();
95545
96052
  workOrderIdSchema = external_exports.string().regex(/^wo_[0-9a-z]+$/, "a work order id starts with wo_");
95546
- workOrderTokenSchema = external_exports.string().regex(/^oxwo_[A-Za-z0-9_-]{43}$/, "a work order token starts with oxwo_");
96053
+ workOrderTokenSchema = secretField(
96054
+ external_exports.string().regex(/^oxwo_[A-Za-z0-9_-]{43}$/, "a work order token starts with oxwo_")
96055
+ );
95547
96056
  workAgentIdSchema = external_exports.string().regex(/^agt_[0-9a-z]+$/, "an agent id starts with agt_");
95548
96057
  workItemVersionSchema = external_exports.number().int().nonnegative();
95549
96058
  workDodKeySchema = external_exports.string().regex(/^c[1-9][0-9]{0,5}$/, "a key is c and a number, such as c1");
@@ -97353,7 +97862,7 @@ var init_remote_digests = __esm({
97353
97862
  });
97354
97863
 
97355
97864
  // ../../packages/tacho/src/evidence/merkle.ts
97356
- import { createHash as createHash21 } from "node:crypto";
97865
+ import { createHash as createHash22 } from "node:crypto";
97357
97866
  function digestToBytes(digest6) {
97358
97867
  if (!SHA256_DIGEST_PATTERN.test(digest6)) {
97359
97868
  throw new TypeError(`not a sha256 hash: ${digest6}`);
@@ -97361,7 +97870,7 @@ function digestToBytes(digest6) {
97361
97870
  return Buffer.from(digest6.slice("sha256:".length), "hex");
97362
97871
  }
97363
97872
  function hash2(...parts) {
97364
- const h = createHash21("sha256");
97873
+ const h = createHash22("sha256");
97365
97874
  for (const part of parts) h.update(part);
97366
97875
  return h.digest();
97367
97876
  }
@@ -98299,7 +98808,7 @@ function encodeCbor(value) {
98299
98808
  function member3(value, key) {
98300
98809
  return value instanceof Map ? value.get(key) : void 0;
98301
98810
  }
98302
- var CborTag, CborError, MAX_DEPTH, Reader;
98811
+ var CborTag, CborError, MAX_DEPTH2, Reader;
98303
98812
  var init_cbor = __esm({
98304
98813
  "../../packages/tacho/src/evidence/claim/cbor.ts"() {
98305
98814
  "use strict";
@@ -98313,7 +98822,7 @@ var init_cbor = __esm({
98313
98822
  };
98314
98823
  CborError = class extends Error {
98315
98824
  };
98316
- MAX_DEPTH = 32;
98825
+ MAX_DEPTH2 = 32;
98317
98826
  Reader = class {
98318
98827
  constructor(bytes) {
98319
98828
  this.bytes = bytes;
@@ -98358,7 +98867,7 @@ var init_cbor = __esm({
98358
98867
  return n2;
98359
98868
  }
98360
98869
  item(depth) {
98361
- if (depth > MAX_DEPTH) throw new CborError("CBOR nests too deep");
98870
+ if (depth > MAX_DEPTH2) throw new CborError("CBOR nests too deep");
98362
98871
  const initial = this.byte();
98363
98872
  const major = initial >> 5;
98364
98873
  const info = initial & 31;
@@ -98413,7 +98922,7 @@ var init_cbor = __esm({
98413
98922
 
98414
98923
  // ../../packages/tacho/src/evidence/claim/cose.ts
98415
98924
  import {
98416
- createHash as createHash22,
98925
+ createHash as createHash23,
98417
98926
  createPublicKey as createPublicKey6,
98418
98927
  sign as sign5,
98419
98928
  verify as verify7
@@ -98534,7 +99043,7 @@ function coseKeyOf(key) {
98534
99043
  }
98535
99044
  function coseKeyThumbprint(key) {
98536
99045
  const publicKey = key.type === "private" ? createPublicKey6(key) : key;
98537
- const digest6 = createHash22("sha256").update(encodeCbor(coseKeyOf(publicKey))).digest("hex");
99046
+ const digest6 = createHash23("sha256").update(encodeCbor(coseKeyOf(publicKey))).digest("hex");
98538
99047
  return `sha256:${digest6}`;
98539
99048
  }
98540
99049
  function kidBytes(thumbprint) {
@@ -98590,9 +99099,9 @@ var init_cose = __esm({
98590
99099
  });
98591
99100
 
98592
99101
  // ../../packages/tacho/src/evidence/claim/inclusion.ts
98593
- import { createHash as createHash23 } from "node:crypto";
99102
+ import { createHash as createHash24 } from "node:crypto";
98594
99103
  function sha256(...parts) {
98595
- const h = createHash23("sha256");
99104
+ const h = createHash24("sha256");
98596
99105
  for (const part of parts) h.update(part);
98597
99106
  return new Uint8Array(h.digest());
98598
99107
  }
@@ -98789,7 +99298,7 @@ function parseDer(bytes) {
98789
99298
  return node3;
98790
99299
  }
98791
99300
  function parseAt(bytes, start, depth) {
98792
- if (depth > MAX_DEPTH2) throw new DerError("DER nests too deep");
99301
+ if (depth > MAX_DEPTH3) throw new DerError("DER nests too deep");
98793
99302
  const tag = bytes[start];
98794
99303
  if (tag === void 0) throw new DerError("DER ends early");
98795
99304
  if ((tag & 31) === 31)
@@ -98939,13 +99448,13 @@ function utcTime(date5) {
98939
99448
  const text6 = `${digits(date5.getUTCFullYear() % 100, 2)}${digits(date5.getUTCMonth() + 1, 2)}${digits(date5.getUTCDate(), 2)}${digits(date5.getUTCHours(), 2)}${digits(date5.getUTCMinutes(), 2)}${digits(date5.getUTCSeconds(), 2)}Z`;
98940
99449
  return der(TAG.UTC_TIME, new TextEncoder().encode(text6));
98941
99450
  }
98942
- var DerError, MAX_DEPTH2, TAG, seq, setOf, ctx, octets, nullValue, bool3, utf8, bitString;
99451
+ var DerError, MAX_DEPTH3, TAG, seq, setOf, ctx, octets, nullValue, bool3, utf8, bitString;
98943
99452
  var init_der = __esm({
98944
99453
  "../../packages/tacho/src/evidence/claim/der.ts"() {
98945
99454
  "use strict";
98946
99455
  DerError = class extends Error {
98947
99456
  };
98948
- MAX_DEPTH2 = 24;
99457
+ MAX_DEPTH3 = 24;
98949
99458
  TAG = {
98950
99459
  BOOLEAN: 1,
98951
99460
  INTEGER: 2,
@@ -98984,7 +99493,7 @@ var init_der = __esm({
98984
99493
  });
98985
99494
 
98986
99495
  // ../../packages/tacho/src/evidence/claim/timestamp-token.ts
98987
- import { createHash as createHash24, verify as verify8, X509Certificate } from "node:crypto";
99496
+ import { createHash as createHash25, verify as verify8, X509Certificate } from "node:crypto";
98988
99497
  function signatureHash(sigOid, digestHash) {
98989
99498
  switch (sigOid) {
98990
99499
  case OID.RSA:
@@ -99005,10 +99514,10 @@ function equalBytes(a, b3) {
99005
99514
  return a.length === b3.length && a.every((v, i2) => v === b3[i2]);
99006
99515
  }
99007
99516
  function hash3(name2, bytes) {
99008
- return new Uint8Array(createHash24(name2).update(bytes).digest());
99517
+ return new Uint8Array(createHash25(name2).update(bytes).digest());
99009
99518
  }
99010
99519
  function certificateFingerprint(cert) {
99011
- return `sha256:${createHash24("sha256").update(cert.raw).digest("hex")}`;
99520
+ return `sha256:${createHash25("sha256").update(cert.raw).digest("hex")}`;
99012
99521
  }
99013
99522
  function certificatesFromPem(text6) {
99014
99523
  const blocks = text6.match(
@@ -99305,7 +99814,7 @@ var init_timestamp_token = __esm({
99305
99814
 
99306
99815
  // ../../packages/tacho/src/evidence/claim/sample-pki.ts
99307
99816
  import {
99308
- createHash as createHash25,
99817
+ createHash as createHash26,
99309
99818
  generateKeyPairSync as generateKeyPairSync2,
99310
99819
  randomBytes as randomBytes13,
99311
99820
  sign as sign6,
@@ -99401,7 +99910,7 @@ function samplePki(at2) {
99401
99910
  };
99402
99911
  }
99403
99912
  function sha2562(bytes) {
99404
- return new Uint8Array(createHash25("sha256").update(bytes).digest());
99913
+ return new Uint8Array(createHash26("sha256").update(bytes).digest());
99405
99914
  }
99406
99915
  function issueTimestampToken(input2) {
99407
99916
  const tstInfo = seq(
@@ -99470,7 +99979,7 @@ var init_sample_pki = __esm({
99470
99979
 
99471
99980
  // ../../packages/tacho/src/evidence/claim/sample.ts
99472
99981
  import {
99473
- createHash as createHash26,
99982
+ createHash as createHash27,
99474
99983
  createPublicKey as createPublicKey7,
99475
99984
  generateKeyPairSync as generateKeyPairSync3
99476
99985
  } from "node:crypto";
@@ -99658,7 +100167,7 @@ function buildClaimBundle(record2, keys, tamper = (_, b3) => b3) {
99658
100167
  gaps: notReceived
99659
100168
  })
99660
100169
  );
99661
- const imprint = createHash26("sha256").update(files2.get(`${base2}.json`)).digest();
100170
+ const imprint = createHash27("sha256").update(files2.get(`${base2}.json`)).digest();
99662
100171
  put(
99663
100172
  `${base2}.tst`,
99664
100173
  issueTimestampToken({
@@ -99808,7 +100317,7 @@ function agentEvent(session, seq2, ts2, kind, path2, body2 = {}, extra = {}) {
99808
100317
  return {
99809
100318
  v: "tacho/1.0",
99810
100319
  event_id: `evt_${session.slice(0, 8)}_${seq2}`,
99811
- event_id_idem: `evt_${createHash26("sha256").update(`${session}:${seq2}`).digest("hex")}`,
100320
+ event_id_idem: `evt_${createHash27("sha256").update(`${session}:${seq2}`).digest("hex")}`,
99812
100321
  session_id: `ses_${session.slice(0, 8)}`,
99813
100322
  session_uuid: session,
99814
100323
  root_session_uuid: SESSION,
@@ -99919,7 +100428,7 @@ function sampleClaimInput() {
99919
100428
  agentEvent(SUBAGENT, 3, t(19, 58), "agent_stop", "ambient/hook")
99920
100429
  ]);
99921
100430
  const cti = new Uint8Array(
99922
- createHash26("sha256").update("sample scope token").digest().subarray(0, 16)
100431
+ createHash27("sha256").update("sample scope token").digest().subarray(0, 16)
99923
100432
  );
99924
100433
  const scope = { cti: Buffer.from(cti).toString("base64url"), token_hash: "" };
99925
100434
  const actor = { principal: "insurer:northwind-mutual", key_thumbprint: null };
@@ -100118,7 +100627,7 @@ var init_sample = __esm({
100118
100627
  init_inclusion();
100119
100628
  init_sample_pki();
100120
100629
  encoder6 = new TextEncoder();
100121
- sha256Hex4 = (bytes) => `sha256:${createHash26("sha256").update(bytes).digest("hex")}`;
100630
+ sha256Hex4 = (bytes) => `sha256:${createHash27("sha256").update(bytes).digest("hex")}`;
100122
100631
  pem = (key) => createPublicKey7(key).export({ type: "spki", format: "pem" }).toString();
100123
100632
  certPem = (der2) => `-----BEGIN CERTIFICATE-----
100124
100633
  ${Buffer.from(der2).toString("base64").replace(/(.{64})/g, "$1\n").replace(/\n$/, "")}
@@ -100145,7 +100654,7 @@ var init_verifier_script_generated = __esm({
100145
100654
 
100146
100655
  // ../../packages/tacho/src/evidence/claim/verify.ts
100147
100656
  import {
100148
- createHash as createHash27,
100657
+ createHash as createHash28,
100149
100658
  createPublicKey as createPublicKey8,
100150
100659
  X509Certificate as X509Certificate3
100151
100660
  } from "node:crypto";
@@ -100173,7 +100682,7 @@ function isObj(value) {
100173
100682
  return value !== null && typeof value === "object" && !Array.isArray(value);
100174
100683
  }
100175
100684
  function sha256Hex5(bytes) {
100176
- return `sha256:${createHash27("sha256").update(bytes).digest("hex")}`;
100685
+ return `sha256:${createHash28("sha256").update(bytes).digest("hex")}`;
100177
100686
  }
100178
100687
  function text5(bytes) {
100179
100688
  if (!bytes) return null;
@@ -100697,7 +101206,7 @@ function verifyClaimBundle(files2, pins = {}) {
100697
101206
  "the export carries no frame at or before this head to date it by"
100698
101207
  );
100699
101208
  } else {
100700
- const imprint = createHash27("sha256").update(stamped2).digest();
101209
+ const imprint = createHash28("sha256").update(stamped2).digest();
100701
101210
  const result2 = verifyTimestampToken({
100702
101211
  token,
100703
101212
  imprint: new Uint8Array(imprint),
@@ -101746,7 +102255,7 @@ var init_harnesses = __esm({
101746
102255
 
101747
102256
  // src/lib/working-copy.ts
101748
102257
  import { execFile as execFile6 } from "node:child_process";
101749
- import { createHash as createHash28, randomBytes as randomBytes14 } from "node:crypto";
102258
+ import { createHash as createHash29, randomBytes as randomBytes14 } from "node:crypto";
101750
102259
  import {
101751
102260
  existsSync as existsSync32,
101752
102261
  lstatSync as lstatSync13,
@@ -101854,7 +102363,7 @@ function machineId(configDir = getConfigDir()) {
101854
102363
  } catch {
101855
102364
  secret = `fallback:${osHostname3()}:${homedir13()}`;
101856
102365
  }
101857
- return createHash28("sha256").update(secret).digest("hex");
102366
+ return createHash29("sha256").update(secret).digest("hex");
101858
102367
  }
101859
102368
  function cliVersion() {
101860
102369
  const v = package_default.version;
@@ -108241,7 +108750,7 @@ __export(steering_findings_exports, {
108241
108750
  steeringFindings: () => steeringFindings,
108242
108751
  usageError: () => usageError
108243
108752
  });
108244
- function isRecord8(value) {
108753
+ function isRecord9(value) {
108245
108754
  return typeof value === "object" && value !== null && !Array.isArray(value);
108246
108755
  }
108247
108756
  function textOrNull(value) {
@@ -108254,7 +108763,7 @@ function apiRefusal(err2) {
108254
108763
  if (start >= 0 && end > start) {
108255
108764
  try {
108256
108765
  const body2 = JSON.parse(message2.slice(start, end + 1));
108257
- const error2 = isRecord8(body2) && isRecord8(body2.error) ? body2.error : null;
108766
+ const error2 = isRecord9(body2) && isRecord9(body2.error) ? body2.error : null;
108258
108767
  const said = error2 === null ? null : textOrNull(error2.message);
108259
108768
  if (error2 !== null && said !== null) {
108260
108769
  return {
@@ -112687,7 +113196,7 @@ var init_json_text = __esm({
112687
113196
  });
112688
113197
 
112689
113198
  // ../../packages/run-evidence/src/digest.ts
112690
- import { createHash as createHash29 } from "node:crypto";
113199
+ import { createHash as createHash30 } from "node:crypto";
112691
113200
  function intrinsicHashMethod(name2) {
112692
113201
  const method = Object.getOwnPropertyDescriptor(
112693
113202
  intrinsicHashPrototype,
@@ -112710,7 +113219,7 @@ function sha256Digest(bytes) {
112710
113219
  if (!(bytes instanceof intrinsicUint8ArrayConstructor)) {
112711
113220
  throw new TypeError("sha256Digest requires exact bytes");
112712
113221
  }
112713
- const hash5 = createHash29("sha256");
113222
+ const hash5 = createHash30("sha256");
112714
113223
  Reflect.apply(intrinsicHashUpdate, hash5, [bytes]);
112715
113224
  const hex3 = Reflect.apply(intrinsicHashDigest, hash5, ["hex"]);
112716
113225
  return `sha256:${hex3}`;
@@ -112728,7 +113237,7 @@ var init_digest3 = __esm({
112728
113237
  intrinsicTextEncoderEncode = TextEncoder.prototype.encode;
112729
113238
  intrinsicUint8ArrayConstructor = Uint8Array;
112730
113239
  intrinsicHashPrototype = Object.getPrototypeOf(
112731
- createHash29("sha256")
113240
+ createHash30("sha256")
112732
113241
  );
112733
113242
  intrinsicHashUpdate = intrinsicHashMethod("update");
112734
113243
  intrinsicHashDigest = intrinsicHashMethod("digest");
@@ -116131,7 +116640,7 @@ var init_steering_repo = __esm({
116131
116640
  });
116132
116641
 
116133
116642
  // ../../packages/steering-check/src/repo.ts
116134
- function isRecord9(value) {
116643
+ function isRecord10(value) {
116135
116644
  return typeof value === "object" && value !== null && !Array.isArray(value);
116136
116645
  }
116137
116646
  function isString(value) {
@@ -116269,7 +116778,7 @@ function parseTomlLoose(text6) {
116269
116778
  if (text6 === void 0) return null;
116270
116779
  try {
116271
116780
  const value = parse(text6);
116272
- return isRecord9(value) ? value : null;
116781
+ return isRecord10(value) ? value : null;
116273
116782
  } catch {
116274
116783
  return null;
116275
116784
  }
@@ -116277,7 +116786,7 @@ function parseTomlLoose(text6) {
116277
116786
  function canonicalJson(value) {
116278
116787
  if (Array.isArray(value))
116279
116788
  return `[${value.map(canonicalJson).join(",")}]`;
116280
- if (isRecord9(value)) {
116789
+ if (isRecord10(value)) {
116281
116790
  const keys = Object.keys(value).sort();
116282
116791
  return `{${keys.map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key])}`).join(",")}}`;
116283
116792
  }
@@ -116287,7 +116796,7 @@ function parseJsonLoose(text6) {
116287
116796
  if (text6 === void 0) return null;
116288
116797
  try {
116289
116798
  const value = JSON.parse(text6);
116290
- return isRecord9(value) ? value : null;
116799
+ return isRecord10(value) ? value : null;
116291
116800
  } catch {
116292
116801
  return null;
116293
116802
  }
@@ -116301,9 +116810,9 @@ function workspaceRepositories(tree) {
116301
116810
  }
116302
116811
  function entries(value) {
116303
116812
  const found = /* @__PURE__ */ new Map();
116304
- if (!isRecord9(value)) return found;
116813
+ if (!isRecord10(value)) return found;
116305
116814
  for (const [key, entry2] of Object.entries(value)) {
116306
- if (isRecord9(entry2)) found.set(key, entry2);
116815
+ if (isRecord10(entry2)) found.set(key, entry2);
116307
116816
  }
116308
116817
  return found;
116309
116818
  }
@@ -116463,7 +116972,7 @@ function alwaysOnBlocks(tree, files2 = recordFiles(tree), options = {}) {
116463
116972
  for (const [name2, folder] of folders) {
116464
116973
  for (const key of folder.tools.keys()) imported.push(toolName3(name2, key));
116465
116974
  const exposure = folder.server?.exposure;
116466
- if (isRecord9(exposure) && (exposure.mode === "search" || exposure.mode === "direct")) {
116975
+ if (isRecord10(exposure) && (exposure.mode === "search" || exposure.mode === "direct")) {
116467
116976
  modes.set(name2, exposure.mode);
116468
116977
  }
116469
116978
  }
@@ -116493,7 +117002,7 @@ function isPositiveInteger(value) {
116493
117002
  }
116494
117003
  function alwaysOnBudget(tree) {
116495
117004
  const steering = parseTomlLoose(tree?.get(GOVERNANCE_TOML_PATH))?.steering;
116496
- const value = isRecord9(steering) ? steering.always_on_tokens : void 0;
117005
+ const value = isRecord10(steering) ? steering.always_on_tokens : void 0;
116497
117006
  if (value === "off") return "off";
116498
117007
  if (isPositiveInteger(value))
116499
117008
  return { tokens: value, source: "governance.toml" };
@@ -116501,7 +117010,7 @@ function alwaysOnBudget(tree) {
116501
117010
  }
116502
117011
  function definitionBudget(tree) {
116503
117012
  const tools = parseTomlLoose(tree?.get(WORKSPACE_TOML_PATH))?.tools;
116504
- const value = isRecord9(tools) ? tools.definition_budget : void 0;
117013
+ const value = isRecord10(tools) ? tools.definition_budget : void 0;
116505
117014
  return isPositiveInteger(value) ? { tokens: value, source: "workspace.toml" } : {
116506
117015
  tokens: DEFAULT_WORKSPACE_DEFINITION_BUDGET,
116507
117016
  source: "Oxagen's default"
@@ -116656,12 +117165,12 @@ function directDefinitions(tree) {
116656
117165
  const servers = [];
116657
117166
  for (const [name2, folder] of serverFolders(tree)) {
116658
117167
  const exposure = folder.server?.exposure;
116659
- if (!isRecord9(exposure) || exposure.mode !== "direct") continue;
117168
+ if (!isRecord10(exposure) || exposure.mode !== "direct") continue;
116660
117169
  let tokens = 0;
116661
117170
  let tools = 0;
116662
117171
  for (const [key, entry2] of folder.tools) {
116663
117172
  const upstream = folder.locked.get(key)?.upstream;
116664
- if (!isRecord9(upstream)) continue;
117173
+ if (!isRecord10(upstream)) continue;
116665
117174
  const description = isString(entry2.description) ? entry2.description : upstream.description;
116666
117175
  const definition = {
116667
117176
  name: `${name2}__${key}`,
@@ -117489,7 +117998,7 @@ function credentialFields(value, prefix = "") {
117489
117998
  (item, n2) => credentialFields(item, prefix === "" ? String(n2) : `${prefix}.${n2}`)
117490
117999
  );
117491
118000
  }
117492
- if (!isRecord9(value)) return [];
118001
+ if (!isRecord10(value)) return [];
117493
118002
  return Object.entries(value).flatMap(
117494
118003
  ([key, item]) => credentialFields(item, prefix === "" ? key : `${prefix}.${key}`)
117495
118004
  );
@@ -117531,7 +118040,7 @@ function groupFindings(tree, context) {
117531
118040
  const lineOf = tomlLocator(text6);
117532
118041
  const findings = [];
117533
118042
  reviewers.forEach((entry2, n2) => {
117534
- if (!isRecord9(entry2) || !isString(entry2.group) || context.groups.includes(entry2.group))
118043
+ if (!isRecord10(entry2) || !isString(entry2.group) || context.groups.includes(entry2.group))
117535
118044
  return;
117536
118045
  const field = `reviewers.${n2}.group`;
117537
118046
  findings.push(
@@ -120523,7 +121032,7 @@ __export(run_exports, {
120523
121032
  runTurns: () => runTurns,
120524
121033
  writeColumns: () => writeColumns
120525
121034
  });
120526
- import { createHash as createHash30 } from "node:crypto";
121035
+ import { createHash as createHash31 } from "node:crypto";
120527
121036
  import { createWriteStream, renameSync as renameSync8, rmSync as rmSync14 } from "node:fs";
120528
121037
  import { resolve as resolve26 } from "node:path";
120529
121038
  import { Readable as Readable2 } from "node:stream";
@@ -120625,7 +121134,7 @@ async function runDownload(exportId, opts = {}, writer = stdoutWriter) {
120625
121134
  const url2 = resolveDownloadUrl(status2.download.url, getApiUrl());
120626
121135
  const path2 = resolve26(opts.out ?? `${status2.runId}-${exportId}.zip`);
120627
121136
  const partial2 = `${path2}.${process.pid}.partial`;
120628
- const hash5 = createHash30("sha256");
121137
+ const hash5 = createHash31("sha256");
120629
121138
  let size = 0;
120630
121139
  let headerDigest;
120631
121140
  const controller = new AbortController();
@@ -124600,8 +125109,8 @@ function defineLazy(object3, key, getter) {
124600
125109
  configurable: true
124601
125110
  });
124602
125111
  }
124603
- function objectClone(obj2) {
124604
- return Object.create(Object.getPrototypeOf(obj2), Object.getOwnPropertyDescriptors(obj2));
125112
+ function objectClone(obj3) {
125113
+ return Object.create(Object.getPrototypeOf(obj3), Object.getOwnPropertyDescriptors(obj3));
124605
125114
  }
124606
125115
  function assignProp(target, prop, value) {
124607
125116
  Object.defineProperty(target, prop, {
@@ -124672,10 +125181,10 @@ function mergeDefs(...defs) {
124672
125181
  function cloneDef(schema) {
124673
125182
  return mergeDefs(schema._zod.def);
124674
125183
  }
124675
- function getElementAtPath(obj2, path2) {
125184
+ function getElementAtPath(obj3, path2) {
124676
125185
  if (!path2)
124677
- return obj2;
124678
- return path2.reduce((acc, key) => acc?.[key], obj2);
125186
+ return obj3;
125187
+ return path2.reduce((acc, key) => acc?.[key], obj3);
124679
125188
  }
124680
125189
  function promiseAllObject(promisesObj) {
124681
125190
  const keys = Object.keys(promisesObj);
@@ -125017,9 +125526,9 @@ function parsedType(data) {
125017
125526
  if (Array.isArray(data)) {
125018
125527
  return "array";
125019
125528
  }
125020
- const obj2 = data;
125021
- if (obj2 && Object.getPrototypeOf(obj2) !== Object.prototype && "constructor" in obj2 && obj2.constructor) {
125022
- return obj2.constructor.name;
125529
+ const obj3 = data;
125530
+ if (obj3 && Object.getPrototypeOf(obj3) !== Object.prototype && "constructor" in obj3 && obj3.constructor) {
125531
+ return obj3.constructor.name;
125023
125532
  }
125024
125533
  }
125025
125534
  }
@@ -125037,8 +125546,8 @@ function issue(...args) {
125037
125546
  }
125038
125547
  return { ...iss };
125039
125548
  }
125040
- function cleanEnum(obj2) {
125041
- return Object.entries(obj2).filter(([k, _]) => {
125549
+ function cleanEnum(obj3) {
125550
+ return Object.entries(obj3).filter(([k, _]) => {
125042
125551
  return Number.isNaN(Number.parseInt(k, 10));
125043
125552
  }).map((el) => el[1]);
125044
125553
  }
@@ -125434,15 +125943,15 @@ function _getMessage() {
125434
125943
  function _setMessage(value) {
125435
125944
  this._zod.message = value;
125436
125945
  }
125437
- function node(obj2, key, make) {
125438
- if (!Object.prototype.hasOwnProperty.call(obj2, key)) {
125946
+ function node(obj3, key, make) {
125947
+ if (!Object.prototype.hasOwnProperty.call(obj3, key)) {
125439
125948
  if (key === "__proto__") {
125440
- Object.defineProperty(obj2, key, { value: make(), writable: true, enumerable: true, configurable: true });
125949
+ Object.defineProperty(obj3, key, { value: make(), writable: true, enumerable: true, configurable: true });
125441
125950
  } else {
125442
- obj2[key] = make();
125951
+ obj3[key] = make();
125443
125952
  }
125444
125953
  }
125445
- return obj2[key];
125954
+ return obj3[key];
125446
125955
  }
125447
125956
  function flattenError(error2, mapper = (issue2) => issue2.message) {
125448
125957
  const fieldErrors = {};
@@ -139658,7 +140167,7 @@ var init_src_CeKsbNLO = __esm({
139658
140167
  var index = header2.indexOf(";");
139659
140168
  var type = index !== -1 ? header2.slice(0, index).trim() : header2.trim();
139660
140169
  if (!TYPE_REGEXP.test(type)) throw new TypeError("invalid media type");
139661
- var obj2 = new ContentType(type.toLowerCase());
140170
+ var obj3 = new ContentType(type.toLowerCase());
139662
140171
  if (index !== -1) {
139663
140172
  var key;
139664
140173
  var match;
@@ -139673,16 +140182,16 @@ var init_src_CeKsbNLO = __esm({
139673
140182
  value = value.slice(1, -1);
139674
140183
  if (value.indexOf("\\") !== -1) value = value.replace(QESC_REGEXP, "$1");
139675
140184
  }
139676
- obj2.parameters[key] = value;
140185
+ obj3.parameters[key] = value;
139677
140186
  }
139678
140187
  if (index !== header2.length) throw new TypeError("invalid parameter format");
139679
140188
  }
139680
- return obj2;
140189
+ return obj3;
139681
140190
  }
139682
- function getcontenttype(obj2) {
140191
+ function getcontenttype(obj3) {
139683
140192
  var header2;
139684
- if (typeof obj2.getHeader === "function") header2 = obj2.getHeader("content-type");
139685
- else if (typeof obj2.headers === "object") header2 = obj2.headers && obj2.headers["content-type"];
140193
+ if (typeof obj3.getHeader === "function") header2 = obj3.getHeader("content-type");
140194
+ else if (typeof obj3.headers === "object") header2 = obj3.headers && obj3.headers["content-type"];
139686
140195
  if (typeof header2 !== "string") throw new TypeError("content-type header is missing from object");
139687
140196
  return header2;
139688
140197
  }
@@ -140508,10 +141017,10 @@ var init_ajvProvider_BIwGVY6G = __esm({
140508
141017
  }
140509
141018
  return this._for(new ForIter("of", varKind, name2, iterable), () => forBody(name2));
140510
141019
  }
140511
- forIn(nameOrPrefix, obj2, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) {
140512
- if (this.opts.ownProperties) return this.forOf(nameOrPrefix, (0, code_1._)`Object.keys(${obj2})`, forBody);
141020
+ forIn(nameOrPrefix, obj3, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) {
141021
+ if (this.opts.ownProperties) return this.forOf(nameOrPrefix, (0, code_1._)`Object.keys(${obj3})`, forBody);
140513
141022
  const name2 = this._scope.toName(nameOrPrefix);
140514
- return this._for(new ForIter("in", varKind, name2, obj2), () => forBody(name2));
141023
+ return this._for(new ForIter("in", varKind, name2, obj3), () => forBody(name2));
140515
141024
  }
140516
141025
  endFor() {
140517
141026
  return this._endBlockNode(For);
@@ -142039,9 +142548,9 @@ var init_ajvProvider_BIwGVY6G = __esm({
142039
142548
  ok(cond) {
142040
142549
  if (!this.allErrors) this.gen.if(cond);
142041
142550
  }
142042
- setParams(obj2, assign2) {
142043
- if (assign2) Object.assign(this.params, obj2);
142044
- else this.params = obj2;
142551
+ setParams(obj3, assign2) {
142552
+ if (assign2) Object.assign(this.params, obj3);
142553
+ else this.params = obj3;
142045
142554
  }
142046
142555
  block$data(valid, codeBlock, $dataValid = codegen_1.nil) {
142047
142556
  this.gen.block(() => {
@@ -148213,12 +148722,12 @@ function serverInfoFromDiscover(discover2) {
148213
148722
  function applyElicitationDefaults(schema, data) {
148214
148723
  if (!schema || data === null || typeof data !== "object") return;
148215
148724
  if (schema.type === "object" && schema.properties && typeof schema.properties === "object") {
148216
- const obj2 = data;
148725
+ const obj3 = data;
148217
148726
  const props = schema.properties;
148218
148727
  for (const key of Object.keys(props)) {
148219
148728
  const propSchema = props[key];
148220
- if (obj2[key] === void 0 && Object.prototype.hasOwnProperty.call(propSchema, "default")) obj2[key] = propSchema.default;
148221
- if (obj2[key] !== void 0) applyElicitationDefaults(propSchema, obj2[key]);
148729
+ if (obj3[key] === void 0 && Object.prototype.hasOwnProperty.call(propSchema, "default")) obj3[key] = propSchema.default;
148730
+ if (obj3[key] !== void 0) applyElicitationDefaults(propSchema, obj3[key]);
148222
148731
  }
148223
148732
  }
148224
148733
  if (Array.isArray(schema.anyOf)) {
@@ -155176,7 +155685,7 @@ var init_local_discovery_envelope = __esm({
155176
155685
  function messageOf6(error2) {
155177
155686
  return error2 instanceof Error ? error2.message : String(error2);
155178
155687
  }
155179
- function isRecord10(value) {
155688
+ function isRecord11(value) {
155180
155689
  return typeof value === "object" && value !== null && !Array.isArray(value);
155181
155690
  }
155182
155691
  function isList(value) {
@@ -155190,7 +155699,7 @@ function jsonEqual2(a, b3) {
155190
155699
  if (Array.isArray(a)) {
155191
155700
  return Array.isArray(b3) && a.length === b3.length && a.every((item, index) => jsonEqual2(item, b3[index]));
155192
155701
  }
155193
- if (isRecord10(a) && isRecord10(b3)) {
155702
+ if (isRecord11(a) && isRecord11(b3)) {
155194
155703
  const keys = definedKeys(a);
155195
155704
  return keys.length === definedKeys(b3).length && keys.every((key) => Object.hasOwn(b3, key) && jsonEqual2(a[key], b3[key]));
155196
155705
  }
@@ -155202,7 +155711,7 @@ function utf8Length(text6) {
155202
155711
  function valueAt2(value, path2) {
155203
155712
  let current = value;
155204
155713
  for (const step of path2.split(".")) {
155205
- if (step.endsWith("[]") || !isRecord10(current) || !Object.hasOwn(current, step))
155714
+ if (step.endsWith("[]") || !isRecord11(current) || !Object.hasOwn(current, step))
155206
155715
  return void 0;
155207
155716
  current = current[step];
155208
155717
  }
@@ -155210,9 +155719,9 @@ function valueAt2(value, path2) {
155210
155719
  }
155211
155720
  function withValueAt(value, path2, replacement) {
155212
155721
  const [step, ...rest] = path2.split(".");
155213
- if (step === void 0 || !isRecord10(value)) return value;
155722
+ if (step === void 0 || !isRecord11(value)) return value;
155214
155723
  const inner = Object.hasOwn(value, step) ? value[step] : void 0;
155215
- if (rest.length > 0 && !isRecord10(inner)) return value;
155724
+ if (rest.length > 0 && !isRecord11(inner)) return value;
155216
155725
  const next = rest.length === 0 ? replacement : withValueAt(inner, rest.join("."), replacement);
155217
155726
  return { ...value, [step]: next };
155218
155727
  }
@@ -157132,9 +157641,9 @@ function toMessage(field, value) {
157132
157641
  function toU8Arr(value) {
157133
157642
  return Array.isArray(value) ? new Uint8Array(value) : value;
157134
157643
  }
157135
- function convertObjectValues(obj2, fn) {
157644
+ function convertObjectValues(obj3, fn) {
157136
157645
  const ret = {};
157137
- for (const entry2 of Object.entries(obj2)) {
157646
+ for (const entry2 of Object.entries(obj3)) {
157138
157647
  ret[entry2[0]] = fn(entry2[1]);
157139
157648
  }
157140
157649
  return ret;
@@ -162683,8 +163192,8 @@ var require_umd = __commonJS({
162683
163192
  Object.defineProperty(Long.prototype, "__isLong__", {
162684
163193
  value: true
162685
163194
  });
162686
- function isLong2(obj2) {
162687
- return (obj2 && obj2["__isLong__"]) === true;
163195
+ function isLong2(obj3) {
163196
+ return (obj3 && obj3["__isLong__"]) === true;
162688
163197
  }
162689
163198
  function ctz32(value) {
162690
163199
  var c = Math.clz32(value & -value);
@@ -162694,25 +163203,25 @@ var require_umd = __commonJS({
162694
163203
  var INT_CACHE = {};
162695
163204
  var UINT_CACHE = {};
162696
163205
  function fromInt(value, unsigned) {
162697
- var obj2, cachedObj, cache;
163206
+ var obj3, cachedObj, cache;
162698
163207
  if (unsigned) {
162699
163208
  value >>>= 0;
162700
163209
  if (cache = 0 <= value && value < 256) {
162701
163210
  cachedObj = UINT_CACHE[value];
162702
163211
  if (cachedObj) return cachedObj;
162703
163212
  }
162704
- obj2 = fromBits(value, 0, true);
162705
- if (cache) UINT_CACHE[value] = obj2;
162706
- return obj2;
163213
+ obj3 = fromBits(value, 0, true);
163214
+ if (cache) UINT_CACHE[value] = obj3;
163215
+ return obj3;
162707
163216
  } else {
162708
163217
  value |= 0;
162709
163218
  if (cache = -128 <= value && value < 128) {
162710
163219
  cachedObj = INT_CACHE[value];
162711
163220
  if (cachedObj) return cachedObj;
162712
163221
  }
162713
- obj2 = fromBits(value, value < 0 ? -1 : 0, false);
162714
- if (cache) INT_CACHE[value] = obj2;
162715
- return obj2;
163222
+ obj3 = fromBits(value, value < 0 ? -1 : 0, false);
163223
+ if (cache) INT_CACHE[value] = obj3;
163224
+ return obj3;
162716
163225
  }
162717
163226
  }
162718
163227
  Long.fromInt = fromInt;
@@ -163338,9 +163847,9 @@ var require_minimal = __commonJS({
163338
163847
  * @param {string} prop Property name
163339
163848
  * @returns {boolean} `true` if considered to be present, otherwise `false`
163340
163849
  */
163341
- util2.isSet = function isSet(obj2, prop) {
163342
- var value = obj2[prop];
163343
- if (value != null && Object.hasOwnProperty.call(obj2, prop))
163850
+ util2.isSet = function isSet(obj3, prop) {
163851
+ var value = obj3[prop];
163852
+ if (value != null && Object.hasOwnProperty.call(obj3, prop))
163344
163853
  return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
163345
163854
  return false;
163346
163855
  };
@@ -163400,8 +163909,8 @@ var require_minimal = __commonJS({
163400
163909
  util2.merge = merge2;
163401
163910
  util2.nestingLimit = 32;
163402
163911
  util2.recursionLimit = 100;
163403
- util2.makeProp = function makeProp(obj2, key) {
163404
- Object.defineProperty(obj2, key, {
163912
+ util2.makeProp = function makeProp(obj3, key) {
163913
+ Object.defineProperty(obj3, key, {
163405
163914
  enumerable: true,
163406
163915
  configurable: true,
163407
163916
  writable: true
@@ -164349,10 +164858,10 @@ var require_namespace = __commonJS({
164349
164858
  function arrayToJSON(array2, toJSONOptions) {
164350
164859
  if (!(array2 && array2.length))
164351
164860
  return void 0;
164352
- var obj2 = {};
164861
+ var obj3 = {};
164353
164862
  for (var i2 = 0; i2 < array2.length; ++i2)
164354
- obj2[array2[i2].name] = array2[i2].toJSON(toJSONOptions);
164355
- return obj2;
164863
+ obj3[array2[i2].name] = array2[i2].toJSON(toJSONOptions);
164864
+ return obj3;
164356
164865
  }
164357
164866
  Namespace.arrayToJSON = arrayToJSON;
164358
164867
  Namespace.isReservedId = function isReservedId(reserved, id2) {
@@ -165486,8 +165995,8 @@ var require_type = __commonJS({
165486
165995
  "oneofs",
165487
165996
  Namespace.arrayToJSON(this.oneofsArray, toJSONOptions),
165488
165997
  "fields",
165489
- Namespace.arrayToJSON(this.fieldsArray.filter(function(obj2) {
165490
- return !obj2.declaringField;
165998
+ Namespace.arrayToJSON(this.fieldsArray.filter(function(obj3) {
165999
+ return !obj3.declaringField;
165491
166000
  }), toJSONOptions) || {},
165492
166001
  "extensions",
165493
166002
  this.extensions && this.extensions.length ? this.extensions : void 0,
@@ -167229,11 +167738,11 @@ var require_parse = __commonJS({
167229
167738
  return name2;
167230
167739
  } : util2.camelCase;
167231
167740
  function resolveFileFeatures() {
167232
- topLevelObjects.forEach((obj2) => {
167233
- obj2._edition = edition;
167741
+ topLevelObjects.forEach((obj3) => {
167742
+ obj3._edition = edition;
167234
167743
  Object.keys(topLevelOptions).forEach((opt) => {
167235
- if (obj2.getOption(opt) !== void 0) return;
167236
- obj2.setOption(opt, topLevelOptions[opt], true);
167744
+ if (obj3.getOption(opt) !== void 0) return;
167745
+ obj3.setOption(opt, topLevelOptions[opt], true);
167237
167746
  });
167238
167747
  });
167239
167748
  }
@@ -167434,13 +167943,13 @@ var require_parse = __commonJS({
167434
167943
  }
167435
167944
  return false;
167436
167945
  }
167437
- function ifBlock(obj2, fnIf, fnElse) {
167946
+ function ifBlock(obj3, fnIf, fnElse) {
167438
167947
  var trailingLine = tn.line;
167439
- if (obj2) {
167440
- if (typeof obj2.comment !== "string") {
167441
- obj2.comment = cmnt();
167948
+ if (obj3) {
167949
+ if (typeof obj3.comment !== "string") {
167950
+ obj3.comment = cmnt();
167442
167951
  }
167443
- obj2.filename = parse4.filename;
167952
+ obj3.filename = parse4.filename;
167444
167953
  }
167445
167954
  if (skip2("{", true)) {
167446
167955
  var token2;
@@ -167451,8 +167960,8 @@ var require_parse = __commonJS({
167451
167960
  if (fnElse)
167452
167961
  fnElse();
167453
167962
  skip2(";");
167454
- if (obj2 && (typeof obj2.comment !== "string" || preferTrailingComment))
167455
- obj2.comment = cmnt(trailingLine) || obj2.comment;
167963
+ if (obj3 && (typeof obj3.comment !== "string" || preferTrailingComment))
167964
+ obj3.comment = cmnt(trailingLine) || obj3.comment;
167456
167965
  }
167457
167966
  }
167458
167967
  function parseType(parent, token2, depth) {
@@ -171094,7 +171603,7 @@ var init_lock2 = __esm({
171094
171603
 
171095
171604
  // ../../packages/mcp-studio/src/compile/json-schema.ts
171096
171605
  function propertiesOf(schema) {
171097
- return isRecord10(schema.properties) ? schema.properties : {};
171606
+ return isRecord11(schema.properties) ? schema.properties : {};
171098
171607
  }
171099
171608
  function requiredOf(schema) {
171100
171609
  if (!Array.isArray(schema.required)) return [];
@@ -171255,7 +171764,7 @@ function shapeInput(key, entry2, upstream, supplied, issues) {
171255
171764
  for (const [name2, value] of defaults) {
171256
171765
  if (!usable("defaults", name2)) continue;
171257
171766
  const property = shaped[name2];
171258
- shaped[name2] = { ...isRecord10(property) ? property : {}, default: value };
171767
+ shaped[name2] = { ...isRecord11(property) ? property : {}, default: value };
171259
171768
  required2 = required2.filter((other) => other !== name2);
171260
171769
  }
171261
171770
  const renamed = /* @__PURE__ */ new Map();
@@ -171308,7 +171817,7 @@ function selectTree(paths) {
171308
171817
  return root;
171309
171818
  }
171310
171819
  function trimObject(schema, children) {
171311
- if (!isRecord10(schema.properties)) return schema;
171820
+ if (!isRecord11(schema.properties)) return schema;
171312
171821
  const properties = schema.properties;
171313
171822
  const kept = {};
171314
171823
  for (const [name2, node3] of children) {
@@ -171323,9 +171832,9 @@ function trimObject(schema, children) {
171323
171832
  return out;
171324
171833
  }
171325
171834
  function trimNode(schema, node3) {
171326
- if (node3.whole || !isRecord10(schema)) return schema;
171835
+ if (node3.whole || !isRecord11(schema)) return schema;
171327
171836
  if (!node3.array) return trimObject(schema, node3.children);
171328
- return isRecord10(schema.items) ? { ...schema, items: trimObject(schema.items, node3.children) } : schema;
171837
+ return isRecord11(schema.items) ? { ...schema, items: trimObject(schema.items, node3.children) } : schema;
171329
171838
  }
171330
171839
  function selectOutput(outputSchema, select) {
171331
171840
  if (select.length === 0) return outputSchema;
@@ -172134,17 +172643,17 @@ var init_server3 = __esm({
172134
172643
  function walkSchemas(root, at2, visit3) {
172135
172644
  const above = /* @__PURE__ */ new Set();
172136
172645
  const walk2 = (node3, path2, depth) => {
172137
- if (depth > MAX_DEPTH3) return;
172646
+ if (depth > MAX_DEPTH4) return;
172138
172647
  if (Array.isArray(node3)) {
172139
172648
  node3.forEach((item, index) => walk2(item, `${path2}[${index}]`, depth + 1));
172140
172649
  return;
172141
172650
  }
172142
- if (!isRecord10(node3) || above.has(node3)) return;
172651
+ if (!isRecord11(node3) || above.has(node3)) return;
172143
172652
  visit3(node3, path2);
172144
172653
  above.add(node3);
172145
172654
  for (const [key, value] of Object.entries(node3)) {
172146
172655
  if (DATA.has(key)) continue;
172147
- if (SCHEMA_MAPS.has(key) && isRecord10(value)) {
172656
+ if (SCHEMA_MAPS.has(key) && isRecord11(value)) {
172148
172657
  for (const [name2, child] of Object.entries(value))
172149
172658
  walk2(child, `${path2}.${key}.${name2}`, depth + 1);
172150
172659
  } else {
@@ -172156,7 +172665,7 @@ function walkSchemas(root, at2, visit3) {
172156
172665
  walk2(root, at2, 0);
172157
172666
  }
172158
172667
  function tagOf(schema) {
172159
- if (!isRecord10(schema)) return void 0;
172668
+ if (!isRecord11(schema)) return void 0;
172160
172669
  if (Object.hasOwn(schema, "const")) return JSON.stringify(schema.const);
172161
172670
  if (Array.isArray(schema.enum) && schema.enum.length === 1)
172162
172671
  return JSON.stringify(schema.enum[0]);
@@ -172164,7 +172673,7 @@ function tagOf(schema) {
172164
172673
  }
172165
172674
  function distinguishable(branches) {
172166
172675
  if (branches.length < 2) return true;
172167
- const records = branches.filter(isRecord10);
172676
+ const records = branches.filter(isRecord11);
172168
172677
  const [first] = records;
172169
172678
  if (first === void 0 || records.length < branches.length) return false;
172170
172679
  const types = records.map((branch) => branch.type);
@@ -172201,7 +172710,7 @@ function selectionDepth(selection) {
172201
172710
  }
172202
172711
  return deepest;
172203
172712
  }
172204
- var SCHEMA_MAPS, DATA, MAX_DEPTH3, SELECTION_TOKEN;
172713
+ var SCHEMA_MAPS, DATA, MAX_DEPTH4, SELECTION_TOKEN;
172205
172714
  var init_schema5 = __esm({
172206
172715
  "../../packages/mcp-studio/src/lint/schema.ts"() {
172207
172716
  "use strict";
@@ -172215,7 +172724,7 @@ var init_schema5 = __esm({
172215
172724
  "dependentSchemas"
172216
172725
  ]);
172217
172726
  DATA = /* @__PURE__ */ new Set(["enum", "const", "default", "examples", "example"]);
172218
- MAX_DEPTH3 = 64;
172727
+ MAX_DEPTH4 = 64;
172219
172728
  SELECTION_TOKEN = /"(?:[^"\\]|\\.)*"|\.\.\.|[_A-Za-z][_0-9A-Za-z]*|[{}()@]/g;
172220
172729
  }
172221
172730
  });
@@ -172274,11 +172783,11 @@ function quoted2(values) {
172274
172783
  return orList2(values.map((value) => JSON.stringify(value)));
172275
172784
  }
172276
172785
  function isArraySchema(schema) {
172277
- if (!isRecord10(schema)) return false;
172786
+ if (!isRecord11(schema)) return false;
172278
172787
  return schema.type === "array" || Array.isArray(schema.type) && schema.type.includes("array");
172279
172788
  }
172280
172789
  function hasDescription(schema) {
172281
- return isRecord10(schema) && typeof schema.description === "string" && schema.description.trim() !== "";
172790
+ return isRecord11(schema) && typeof schema.description === "string" && schema.description.trim() !== "";
172282
172791
  }
172283
172792
  function refTarget(root, ref) {
172284
172793
  if (ref === "#") return root;
@@ -172291,7 +172800,7 @@ function refTarget(root, ref) {
172291
172800
  } catch {
172292
172801
  return void 0;
172293
172802
  }
172294
- if (!isRecord10(node3) || !Object.hasOwn(node3, name2)) return void 0;
172803
+ if (!isRecord11(node3) || !Object.hasOwn(node3, name2)) return void 0;
172295
172804
  node3 = node3[name2];
172296
172805
  }
172297
172806
  return node3;
@@ -172300,7 +172809,7 @@ function isDescribed(schema, root) {
172300
172809
  const seen = /* @__PURE__ */ new Set();
172301
172810
  let node3 = schema;
172302
172811
  while (!hasDescription(node3)) {
172303
- const ref = isRecord10(node3) ? node3.$ref : void 0;
172812
+ const ref = isRecord11(node3) ? node3.$ref : void 0;
172304
172813
  if (typeof ref !== "string") return false;
172305
172814
  if (seen.has(ref)) return true;
172306
172815
  seen.add(ref);
@@ -172590,7 +173099,7 @@ function lintUpstream(folder, context, key, entry2, upstream, apply, report) {
172590
173099
  });
172591
173100
  }
172592
173101
  const oneOf4 = (node3, at2) => {
172593
- if (!Array.isArray(node3.oneOf) || isRecord10(node3.discriminator) || distinguishable(node3.oneOf))
173102
+ if (!Array.isArray(node3.oneOf) || isRecord11(node3.discriminator) || distinguishable(node3.oneOf))
172594
173103
  return;
172595
173104
  report("undiscriminated_one_of", {
172596
173105
  tool: key,
@@ -173441,7 +173950,7 @@ function upstreamError(response, bytes) {
173441
173950
  let problem2;
173442
173951
  if (text6 !== "" && isJsonMediaType(headerValue(response.headers, "content-type"))) {
173443
173952
  const parsed2 = parseJson4(text6);
173444
- if (parsed2.ok && isRecord10(parsed2.value)) problem2 = parsed2.value;
173953
+ if (parsed2.ok && isRecord11(parsed2.value)) problem2 = parsed2.value;
173445
173954
  }
173446
173955
  const title = problem2 === void 0 ? void 0 : firstText(problem2, ["title"]);
173447
173956
  const detail = problem2 === void 0 ? text6.trim() === "" ? void 0 : text6 : firstText(problem2, ["detail", "message", "error_description", "error"]);
@@ -173628,7 +174137,7 @@ function isModernVersion2(version3) {
173628
174137
  function modernRequest(message2, options) {
173629
174138
  const version3 = options.version ?? MCP_MODERN_PROTOCOL_VERSION2;
173630
174139
  const params = message2.params ?? {};
173631
- const meta3 = isRecord10(params._meta) ? params._meta : {};
174140
+ const meta3 = isRecord11(params._meta) ? params._meta : {};
173632
174141
  const body2 = {
173633
174142
  ...message2,
173634
174143
  params: {
@@ -173672,7 +174181,7 @@ function encodeHeaderValue(text6) {
173672
174181
  function valueAt4(root, path2) {
173673
174182
  let node3 = root;
173674
174183
  for (const key of path2) {
173675
- if (!isRecord10(node3) || !Object.hasOwn(node3, key)) return void 0;
174184
+ if (!isRecord11(node3) || !Object.hasOwn(node3, key)) return void 0;
173676
174185
  node3 = node3[key];
173677
174186
  }
173678
174187
  return node3;
@@ -173701,9 +174210,9 @@ function paramHeaderEntries(headers, args) {
173701
174210
  function rpcErrorIn(bytes) {
173702
174211
  if (bytes.byteLength === 0) return void 0;
173703
174212
  const parsed2 = parseJson4(decodeText2(bytes));
173704
- if (!parsed2.ok || !isRecord10(parsed2.value)) return void 0;
174213
+ if (!parsed2.ok || !isRecord11(parsed2.value)) return void 0;
173705
174214
  const error2 = parsed2.value.error;
173706
- if (!isRecord10(error2) || !Number.isInteger(error2.code)) return void 0;
174215
+ if (!isRecord11(error2) || !Number.isInteger(error2.code)) return void 0;
173707
174216
  return {
173708
174217
  code: error2.code,
173709
174218
  message: typeof error2.message === "string" ? error2.message : void 0,
@@ -173711,7 +174220,7 @@ function rpcErrorIn(bytes) {
173711
174220
  };
173712
174221
  }
173713
174222
  function supportedVersionsIn(data) {
173714
- if (!isRecord10(data) || !isList(data.supported)) return void 0;
174223
+ if (!isRecord11(data) || !isList(data.supported)) return void 0;
173715
174224
  const versions = data.supported.filter(
173716
174225
  (version3) => typeof version3 === "string"
173717
174226
  );
@@ -173752,20 +174261,20 @@ function inputRequiredOf(result2) {
173752
174261
  const state = result2.requestState;
173753
174262
  let input_requests;
173754
174263
  if (requests !== void 0) {
173755
- if (!isRecord10(requests))
174264
+ if (!isRecord11(requests))
173756
174265
  return {
173757
174266
  ok: false,
173758
174267
  detail: "The input_required result's inputRequests is not an object."
173759
174268
  };
173760
174269
  input_requests = {};
173761
174270
  for (const [key, request4] of Object.entries(requests)) {
173762
- if (!isRecord10(request4) || typeof request4.method !== "string")
174271
+ if (!isRecord11(request4) || typeof request4.method !== "string")
173763
174272
  return {
173764
174273
  ok: false,
173765
174274
  detail: `The input_required result's request ${JSON.stringify(key)} has no method.`
173766
174275
  };
173767
174276
  const entry2 = { method: request4.method };
173768
- if (isRecord10(request4.params)) entry2.params = request4.params;
174277
+ if (isRecord11(request4.params)) entry2.params = request4.params;
173769
174278
  input_requests[key] = entry2;
173770
174279
  }
173771
174280
  }
@@ -173822,13 +174331,13 @@ var init_mcp_modern = __esm({
173822
174331
 
173823
174332
  // ../../packages/mcp-studio/src/execute/mcp.ts
173824
174333
  function toolResult(value) {
173825
- if (!isRecord10(value))
174334
+ if (!isRecord11(value))
173826
174335
  return { ok: false, detail: "The tools/call result is not an object." };
173827
174336
  if (!isList(value.content))
173828
174337
  return { ok: false, detail: "The tools/call result has no content list." };
173829
174338
  const content = [];
173830
174339
  for (const [index, item] of value.content.entries()) {
173831
- if (!isRecord10(item) || typeof item.type !== "string") {
174340
+ if (!isRecord11(item) || typeof item.type !== "string") {
173832
174341
  return {
173833
174342
  ok: false,
173834
174343
  detail: `Content item ${index} is not an object with a string type.`
@@ -173839,7 +174348,7 @@ function toolResult(value) {
173839
174348
  const result2 = { content };
173840
174349
  const structured = value.structuredContent;
173841
174350
  if (structured !== void 0 && structured !== null) {
173842
- if (!isRecord10(structured))
174351
+ if (!isRecord11(structured))
173843
174352
  return {
173844
174353
  ok: false,
173845
174354
  detail: "The tools/call result's structuredContent is not an object."
@@ -173865,7 +174374,7 @@ function carriesJson2(content, value) {
173865
174374
  });
173866
174375
  }
173867
174376
  function modernToolResult(value) {
173868
- if (!isRecord10(value) || !Object.hasOwn(value, "structuredContent") || isRecord10(value.structuredContent))
174377
+ if (!isRecord11(value) || !Object.hasOwn(value, "structuredContent") || isRecord11(value.structuredContent))
173869
174378
  return toolResult(value);
173870
174379
  const { structuredContent: structured, ...rest } = value;
173871
174380
  const checked2 = toolResult(rest);
@@ -174015,7 +174524,7 @@ function rejectedAttempt(response, failure5) {
174015
174524
  function findResponse(value, id2) {
174016
174525
  const messages = isList(value) ? value : [value];
174017
174526
  for (const message2 of messages) {
174018
- if (isRecord10(message2) && message2.id === id2 && !Object.hasOwn(message2, "method"))
174527
+ if (isRecord11(message2) && message2.id === id2 && !Object.hasOwn(message2, "method"))
174019
174528
  return message2;
174020
174529
  }
174021
174530
  return void 0;
@@ -174088,8 +174597,8 @@ async function readReply(session, response, id2, what) {
174088
174597
  return { ok: true, value: message2 };
174089
174598
  }
174090
174599
  function rpcError2(error2) {
174091
- const message2 = isRecord10(error2) && typeof error2.message === "string" ? error2.message : JSON.stringify(error2);
174092
- const code = isRecord10(error2) && typeof error2.code === "number" ? ` (code ${error2.code})` : "";
174600
+ const message2 = isRecord11(error2) && typeof error2.message === "string" ? error2.message : JSON.stringify(error2);
174601
+ const code = isRecord11(error2) && typeof error2.code === "number" ? ` (code ${error2.code})` : "";
174093
174602
  return {
174094
174603
  title: "MCP error",
174095
174604
  detail: cutDetail(`${message2}${code}`),
@@ -174135,7 +174644,7 @@ async function initialize(session) {
174135
174644
  if (Object.hasOwn(reply3.value, "error"))
174136
174645
  return { ok: false, error: rpcError2(reply3.value.error) };
174137
174646
  const result2 = reply3.value.result;
174138
- if (!isRecord10(result2))
174647
+ if (!isRecord11(result2))
174139
174648
  return invalidResponse(
174140
174649
  "The MCP server's initialize result is not an object.",
174141
174650
  response.status
@@ -174281,8 +174790,8 @@ async function modernCall(session, version3) {
174281
174790
  }
174282
174791
  };
174283
174792
  const value = reply3.value.result;
174284
- const type = isRecord10(value) ? resultTypeOf(value) : "complete";
174285
- if (type === "input_required" && isRecord10(value)) {
174793
+ const type = isRecord11(value) ? resultTypeOf(value) : "complete";
174794
+ if (type === "input_required" && isRecord11(value)) {
174286
174795
  const input2 = inputRequiredOf(value);
174287
174796
  return {
174288
174797
  legacy: false,
@@ -174541,8 +175050,8 @@ function firstPosition(paging, args, options) {
174541
175050
  if (paging.style === "offset") return 0;
174542
175051
  const properties = options.inputSchema.properties;
174543
175052
  const name2 = options.agentName(paging.input);
174544
- const property = isRecord10(properties) && Object.hasOwn(properties, name2) ? properties[name2] : void 0;
174545
- if (isRecord10(property)) {
175053
+ const property = isRecord11(properties) && Object.hasOwn(properties, name2) ? properties[name2] : void 0;
175054
+ if (isRecord11(property)) {
174546
175055
  const fallback = wholeNumber2(property.default) ?? wholeNumber2(property.minimum);
174547
175056
  if (fallback !== void 0) return fallback;
174548
175057
  }
@@ -174725,7 +175234,7 @@ function graphqlDocument(template, args) {
174725
175234
  }
174726
175235
  function errorMessages(errors) {
174727
175236
  return errors.map(
174728
- (entry2) => isRecord10(entry2) && typeof entry2.message === "string" ? entry2.message : JSON.stringify(entry2)
175237
+ (entry2) => isRecord11(entry2) && typeof entry2.message === "string" ? entry2.message : JSON.stringify(entry2)
174729
175238
  ).join("; ");
174730
175239
  }
174731
175240
  function invalidResponse2(detail, status2) {
@@ -174737,7 +175246,7 @@ function interpret(template) {
174737
175246
  const status2 = response.status;
174738
175247
  const parsed2 = bytes.byteLength === 0 ? void 0 : parseJson4(decodeText2(bytes));
174739
175248
  const body2 = parsed2?.ok === true ? parsed2.value : void 0;
174740
- if (isRecord10(body2) && isList(body2.errors) && body2.errors.length > 0) {
175249
+ if (isRecord11(body2) && isList(body2.errors) && body2.errors.length > 0) {
174741
175250
  return {
174742
175251
  ok: false,
174743
175252
  error: {
@@ -174759,8 +175268,8 @@ function interpret(template) {
174759
175268
  `The upstream answered ${status2} with JSON that does not parse: ${parsed2.message}`,
174760
175269
  status2
174761
175270
  );
174762
- const data = isRecord10(body2) ? body2.data : void 0;
174763
- if (!isRecord10(data))
175271
+ const data = isRecord11(body2) ? body2.data : void 0;
175272
+ if (!isRecord11(data))
174764
175273
  return invalidResponse2(
174765
175274
  `The upstream answered ${status2} with no data object.`,
174766
175275
  status2
@@ -175433,7 +175942,7 @@ function exchangesFor(call2, ending) {
175433
175942
  ];
175434
175943
  }
175435
175944
  function isJsonObject2(value) {
175436
- return isRecord10(value);
175945
+ return isRecord11(value);
175437
175946
  }
175438
175947
  var DEFAULT_MAX_STREAM_BYTES, RETRIED_LEVELS, CANCELLED2, grpcSender, TRANSPORT_TITLES2;
175439
175948
  var init_sender = __esm({
@@ -175497,7 +176006,7 @@ function scalarText(value, name2) {
175497
176006
  function shapeOf(value, name2) {
175498
176007
  if (isList(value))
175499
176008
  return { kind: "list", items: value.map((item) => scalarText(item, name2)) };
175500
- if (isRecord10(value)) {
176009
+ if (isRecord11(value)) {
175501
176010
  return {
175502
176011
  kind: "object",
175503
176012
  entries: Object.entries(value).filter(([, item]) => item !== void 0).map(([key, item]) => [key, scalarText(item, name2)])
@@ -175690,7 +176199,7 @@ function formText(value) {
175690
176199
  throw invalidArguments(`A form body cannot carry a ${typeof value} value.`);
175691
176200
  }
175692
176201
  function formBody(value) {
175693
- if (!isRecord10(value)) throw invalidArguments("A form body takes an object.");
176202
+ if (!isRecord11(value)) throw invalidArguments("A form body takes an object.");
175694
176203
  const form = new URLSearchParams();
175695
176204
  for (const [key, item] of Object.entries(value)) {
175696
176205
  const items = (isList(item) ? item : [item]).filter(
@@ -175958,7 +176467,7 @@ function project(value, at2) {
175958
176467
  const each = at2.each;
175959
176468
  return value.map((item) => project(item, each)).filter((item) => item !== ABSENT);
175960
176469
  }
175961
- if (isRecord10(value) && at2.fields.size > 0) {
176470
+ if (isRecord11(value) && at2.fields.size > 0) {
175962
176471
  const kept = [];
175963
176472
  for (const [name2, child] of at2.fields) {
175964
176473
  if (!Object.hasOwn(value, name2)) continue;
@@ -175975,7 +176484,7 @@ function remove(value, at2) {
175975
176484
  const each = at2.each;
175976
176485
  return value.map((item) => remove(item, each)).filter((item) => item !== ABSENT);
175977
176486
  }
175978
- if (isRecord10(value) && at2.fields.size > 0) {
176487
+ if (isRecord11(value) && at2.fields.size > 0) {
175979
176488
  const kept = [];
175980
176489
  for (const [name2, item] of Object.entries(value)) {
175981
176490
  const child = at2.fields.get(name2);
@@ -176011,14 +176520,14 @@ function shapeRecord(value, rules, isError) {
176011
176520
  let out = value;
176012
176521
  if (rules.select !== void 0 && !isError) out = project(out, rules.select);
176013
176522
  if (rules.redact !== void 0) out = remove(out, rules.redact);
176014
- return isRecord10(out) ? out : {};
176523
+ return isRecord11(out) ? out : {};
176015
176524
  }
176016
176525
  function redactReachesList(redact) {
176017
176526
  const items = redact.fields.get(LIST_FIELD);
176018
176527
  return items !== void 0 && (items.end || items.each !== void 0);
176019
176528
  }
176020
176529
  function shapeAny(value, rules) {
176021
- if (isRecord10(value)) return shapeRecord(value, rules, false);
176530
+ if (isRecord11(value)) return shapeRecord(value, rules, false);
176022
176531
  if (!isList(value)) return value;
176023
176532
  if (rules.redact !== void 0 && !redactReachesList(rules.redact))
176024
176533
  return WITHHELD;
@@ -176051,12 +176560,12 @@ function resultBytes(content, structured) {
176051
176560
  }
176052
176561
  function jsonResult(value, text6) {
176053
176562
  const result2 = { content: [textItem(text6)] };
176054
- if (isRecord10(value)) result2.structuredContent = value;
176563
+ if (isRecord11(value)) result2.structuredContent = value;
176055
176564
  return result2;
176056
176565
  }
176057
176566
  function jsonResultBytes(value, text6) {
176058
176567
  const bytes = utf8Length(text6);
176059
- return isRecord10(value) ? 2 * bytes : bytes;
176568
+ return isRecord11(value) ? 2 * bytes : bytes;
176060
176569
  }
176061
176570
  function cutList(value, rules) {
176062
176571
  const list2 = valueAt2(value, rules.list);
@@ -176121,7 +176630,7 @@ function shapeText(text6, rules, isError, structured) {
176121
176630
  if (typeof text6 !== "string") return void 0;
176122
176631
  const parsed2 = parseJson4(text6);
176123
176632
  if (!parsed2.ok) return void 0;
176124
- if (isRecord10(parsed2.value))
176633
+ if (isRecord11(parsed2.value))
176125
176634
  return JSON.stringify(shapeRecord(parsed2.value, rules, isError));
176126
176635
  if (!isList(parsed2.value) || rules.redact === void 0) return void 0;
176127
176636
  if (redactReachesList(rules.redact)) {
@@ -176135,7 +176644,7 @@ function shapeItem(item, rules, isError, structured) {
176135
176644
  const text6 = shapeText(item.text, rules, isError, structured);
176136
176645
  return text6 === void 0 ? item : { ...item, text: text6 };
176137
176646
  }
176138
- if (item.type === "resource" && isRecord10(item.resource)) {
176647
+ if (item.type === "resource" && isRecord11(item.resource)) {
176139
176648
  const text6 = shapeText(item.resource.text, rules, isError, structured);
176140
176649
  return text6 === void 0 ? item : { ...item, resource: { ...item.resource, text: text6 } };
176141
176650
  }
@@ -176253,7 +176762,7 @@ function hasType(type, value) {
176253
176762
  case "boolean":
176254
176763
  return typeof value === "boolean";
176255
176764
  case "object":
176256
- return isRecord10(value);
176765
+ return isRecord11(value);
176257
176766
  case "array":
176258
176767
  return isList(value);
176259
176768
  default:
@@ -176329,7 +176838,7 @@ function resolveRef(root, ref) {
176329
176838
  if (!Number.isInteger(index) || index < 0 || index >= current.length)
176330
176839
  return void 0;
176331
176840
  current = current[index];
176332
- } else if (isRecord10(current) && Object.hasOwn(current, token)) {
176841
+ } else if (isRecord11(current) && Object.hasOwn(current, token)) {
176333
176842
  current = current[token];
176334
176843
  } else {
176335
176844
  return void 0;
@@ -176339,7 +176848,7 @@ function resolveRef(root, ref) {
176339
176848
  }
176340
176849
  function canonical2(value) {
176341
176850
  if (isList(value)) return `[${value.map(canonical2).join(",")}]`;
176342
- if (isRecord10(value)) {
176851
+ if (isRecord11(value)) {
176343
176852
  const keys = Object.keys(value).sort();
176344
176853
  return `{${keys.map((key) => `${JSON.stringify(key)}:${canonical2(value[key])}`).join(",")}}`;
176345
176854
  }
@@ -176356,12 +176865,12 @@ function listOf3(values) {
176356
176865
  function plural8(count15, one, many = `${one}s`) {
176357
176866
  return count15 === 1 ? one : many;
176358
176867
  }
176359
- var MAX_DEPTH4, MAX_STEPS, MAX_ISSUES, REJECTED_INPUT_MAX, ROOT, PATTERNS, PATH_STEP, SURROGATE, TYPE_NAMES, Checker;
176868
+ var MAX_DEPTH5, MAX_STEPS, MAX_ISSUES, REJECTED_INPUT_MAX, ROOT, PATTERNS, PATH_STEP, SURROGATE, TYPE_NAMES, Checker;
176360
176869
  var init_validate = __esm({
176361
176870
  "../../packages/mcp-studio/src/execute/validate.ts"() {
176362
176871
  "use strict";
176363
176872
  init_util5();
176364
- MAX_DEPTH4 = 64;
176873
+ MAX_DEPTH5 = 64;
176365
176874
  MAX_STEPS = 1e5;
176366
176875
  MAX_ISSUES = 10;
176367
176876
  REJECTED_INPUT_MAX = 200;
@@ -176415,12 +176924,12 @@ var init_validate = __esm({
176415
176924
  }
176416
176925
  check(schema, value, path2, depth) {
176417
176926
  this.steps += 1;
176418
- if (depth > MAX_DEPTH4 || this.steps > MAX_STEPS) {
176927
+ if (depth > MAX_DEPTH5 || this.steps > MAX_STEPS) {
176419
176928
  this.gaveUp = true;
176420
176929
  return [];
176421
176930
  }
176422
176931
  if (schema === false) return [{ path: path2, message: `${path2} is not allowed.` }];
176423
- if (!isRecord10(schema)) return [];
176932
+ if (!isRecord11(schema)) return [];
176424
176933
  if (value === null && schema.nullable === true) return [];
176425
176934
  const issues = [];
176426
176935
  if (typeof schema.$ref === "string") {
@@ -176448,7 +176957,7 @@ var init_validate = __esm({
176448
176957
  issues.push(...checkNumber2(schema, value, path2));
176449
176958
  else if (isList(value))
176450
176959
  issues.push(...this.checkArray(schema, value, path2, depth));
176451
- else if (isRecord10(value))
176960
+ else if (isRecord11(value))
176452
176961
  issues.push(...this.checkObject(schema, value, path2, depth));
176453
176962
  issues.push(...this.checkCombinators(schema, value, path2, depth));
176454
176963
  return issues;
@@ -176574,8 +177083,8 @@ var init_validate = __esm({
176574
177083
  message: `${path2} must have at most ${schema.maxProperties} ${plural8(schema.maxProperties, "property", "properties")}.`
176575
177084
  });
176576
177085
  }
176577
- const properties = isRecord10(schema.properties) ? schema.properties : {};
176578
- const patterns = isRecord10(schema.patternProperties) ? Object.entries(schema.patternProperties) : [];
177086
+ const properties = isRecord11(schema.properties) ? schema.properties : {};
177087
+ const patterns = isRecord11(schema.patternProperties) ? Object.entries(schema.patternProperties) : [];
176579
177088
  for (const key of present) {
176580
177089
  const at2 = propertyPath(path2, key);
176581
177090
  let known = false;
@@ -177668,8 +178177,8 @@ var require_channel_credentials = __commonJS({
177668
178177
  var resolver_1 = require_resolver();
177669
178178
  var logging_1 = require_logging();
177670
178179
  var constants_1 = require_constants();
177671
- function verifyIsBufferOrNull(obj2, friendlyName) {
177672
- if (obj2 && !(obj2 instanceof Buffer)) {
178180
+ function verifyIsBufferOrNull(obj3, friendlyName) {
178181
+ if (obj3 && !(obj3 instanceof Buffer)) {
177673
178182
  throw new TypeError(`${friendlyName}, if provided, must be a Buffer.`);
177674
178183
  }
177675
178184
  }
@@ -178153,51 +178662,51 @@ var require_service_config = __commonJS({
178153
178662
  var constants_1 = require_constants();
178154
178663
  var DURATION_REGEX = /^\d+(\.\d{1,9})?s$/;
178155
178664
  var CLIENT_LANGUAGE_STRING = "node";
178156
- function validateName(obj2) {
178157
- if ("service" in obj2 && obj2.service !== "") {
178158
- if (typeof obj2.service !== "string") {
178159
- throw new Error(`Invalid method config name: invalid service: expected type string, got ${typeof obj2.service}`);
178665
+ function validateName(obj3) {
178666
+ if ("service" in obj3 && obj3.service !== "") {
178667
+ if (typeof obj3.service !== "string") {
178668
+ throw new Error(`Invalid method config name: invalid service: expected type string, got ${typeof obj3.service}`);
178160
178669
  }
178161
- if ("method" in obj2 && obj2.method !== "") {
178162
- if (typeof obj2.method !== "string") {
178163
- throw new Error(`Invalid method config name: invalid method: expected type string, got ${typeof obj2.service}`);
178670
+ if ("method" in obj3 && obj3.method !== "") {
178671
+ if (typeof obj3.method !== "string") {
178672
+ throw new Error(`Invalid method config name: invalid method: expected type string, got ${typeof obj3.service}`);
178164
178673
  }
178165
178674
  return {
178166
- service: obj2.service,
178167
- method: obj2.method
178675
+ service: obj3.service,
178676
+ method: obj3.method
178168
178677
  };
178169
178678
  } else {
178170
178679
  return {
178171
- service: obj2.service
178680
+ service: obj3.service
178172
178681
  };
178173
178682
  }
178174
178683
  } else {
178175
- if ("method" in obj2 && obj2.method !== void 0) {
178684
+ if ("method" in obj3 && obj3.method !== void 0) {
178176
178685
  throw new Error(`Invalid method config name: method set with empty or unset service`);
178177
178686
  }
178178
178687
  return {};
178179
178688
  }
178180
178689
  }
178181
- function validateRetryPolicy(obj2) {
178182
- if (!("maxAttempts" in obj2) || !Number.isInteger(obj2.maxAttempts) || obj2.maxAttempts < 2) {
178690
+ function validateRetryPolicy(obj3) {
178691
+ if (!("maxAttempts" in obj3) || !Number.isInteger(obj3.maxAttempts) || obj3.maxAttempts < 2) {
178183
178692
  throw new Error("Invalid method config retry policy: maxAttempts must be an integer at least 2");
178184
178693
  }
178185
- if (!("initialBackoff" in obj2) || typeof obj2.initialBackoff !== "string" || !DURATION_REGEX.test(obj2.initialBackoff)) {
178694
+ if (!("initialBackoff" in obj3) || typeof obj3.initialBackoff !== "string" || !DURATION_REGEX.test(obj3.initialBackoff)) {
178186
178695
  throw new Error("Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s");
178187
178696
  }
178188
- if (!("maxBackoff" in obj2) || typeof obj2.maxBackoff !== "string" || !DURATION_REGEX.test(obj2.maxBackoff)) {
178697
+ if (!("maxBackoff" in obj3) || typeof obj3.maxBackoff !== "string" || !DURATION_REGEX.test(obj3.maxBackoff)) {
178189
178698
  throw new Error("Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s");
178190
178699
  }
178191
- if (!("backoffMultiplier" in obj2) || typeof obj2.backoffMultiplier !== "number" || obj2.backoffMultiplier <= 0) {
178700
+ if (!("backoffMultiplier" in obj3) || typeof obj3.backoffMultiplier !== "number" || obj3.backoffMultiplier <= 0) {
178192
178701
  throw new Error("Invalid method config retry policy: backoffMultiplier must be a number greater than 0");
178193
178702
  }
178194
- if (!("retryableStatusCodes" in obj2 && Array.isArray(obj2.retryableStatusCodes))) {
178703
+ if (!("retryableStatusCodes" in obj3 && Array.isArray(obj3.retryableStatusCodes))) {
178195
178704
  throw new Error("Invalid method config retry policy: retryableStatusCodes is required");
178196
178705
  }
178197
- if (obj2.retryableStatusCodes.length === 0) {
178706
+ if (obj3.retryableStatusCodes.length === 0) {
178198
178707
  throw new Error("Invalid method config retry policy: retryableStatusCodes must be non-empty");
178199
178708
  }
178200
- for (const value of obj2.retryableStatusCodes) {
178709
+ for (const value of obj3.retryableStatusCodes) {
178201
178710
  if (typeof value === "number") {
178202
178711
  if (!Object.values(constants_1.Status).includes(value)) {
178203
178712
  throw new Error("Invalid method config retry policy: retryableStatusCodes value not in status code range");
@@ -178211,22 +178720,22 @@ var require_service_config = __commonJS({
178211
178720
  }
178212
178721
  }
178213
178722
  return {
178214
- maxAttempts: obj2.maxAttempts,
178215
- initialBackoff: obj2.initialBackoff,
178216
- maxBackoff: obj2.maxBackoff,
178217
- backoffMultiplier: obj2.backoffMultiplier,
178218
- retryableStatusCodes: obj2.retryableStatusCodes
178723
+ maxAttempts: obj3.maxAttempts,
178724
+ initialBackoff: obj3.initialBackoff,
178725
+ maxBackoff: obj3.maxBackoff,
178726
+ backoffMultiplier: obj3.backoffMultiplier,
178727
+ retryableStatusCodes: obj3.retryableStatusCodes
178219
178728
  };
178220
178729
  }
178221
- function validateHedgingPolicy(obj2) {
178222
- if (!("maxAttempts" in obj2) || !Number.isInteger(obj2.maxAttempts) || obj2.maxAttempts < 2) {
178730
+ function validateHedgingPolicy(obj3) {
178731
+ if (!("maxAttempts" in obj3) || !Number.isInteger(obj3.maxAttempts) || obj3.maxAttempts < 2) {
178223
178732
  throw new Error("Invalid method config hedging policy: maxAttempts must be an integer at least 2");
178224
178733
  }
178225
- if ("hedgingDelay" in obj2 && (typeof obj2.hedgingDelay !== "string" || !DURATION_REGEX.test(obj2.hedgingDelay))) {
178734
+ if ("hedgingDelay" in obj3 && (typeof obj3.hedgingDelay !== "string" || !DURATION_REGEX.test(obj3.hedgingDelay))) {
178226
178735
  throw new Error("Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s");
178227
178736
  }
178228
- if ("nonFatalStatusCodes" in obj2 && Array.isArray(obj2.nonFatalStatusCodes)) {
178229
- for (const value of obj2.nonFatalStatusCodes) {
178737
+ if ("nonFatalStatusCodes" in obj3 && Array.isArray(obj3.nonFatalStatusCodes)) {
178738
+ for (const value of obj3.nonFatalStatusCodes) {
178230
178739
  if (typeof value === "number") {
178231
178740
  if (!Object.values(constants_1.Status).includes(value)) {
178232
178741
  throw new Error("Invalid method config hedging policy: nonFatalStatusCodes value not in status code range");
@@ -178241,44 +178750,44 @@ var require_service_config = __commonJS({
178241
178750
  }
178242
178751
  }
178243
178752
  const result2 = {
178244
- maxAttempts: obj2.maxAttempts
178753
+ maxAttempts: obj3.maxAttempts
178245
178754
  };
178246
- if (obj2.hedgingDelay) {
178247
- result2.hedgingDelay = obj2.hedgingDelay;
178755
+ if (obj3.hedgingDelay) {
178756
+ result2.hedgingDelay = obj3.hedgingDelay;
178248
178757
  }
178249
- if (obj2.nonFatalStatusCodes) {
178250
- result2.nonFatalStatusCodes = obj2.nonFatalStatusCodes;
178758
+ if (obj3.nonFatalStatusCodes) {
178759
+ result2.nonFatalStatusCodes = obj3.nonFatalStatusCodes;
178251
178760
  }
178252
178761
  return result2;
178253
178762
  }
178254
- function validateMethodConfig(obj2) {
178763
+ function validateMethodConfig(obj3) {
178255
178764
  var _a4;
178256
178765
  const result2 = {
178257
178766
  name: []
178258
178767
  };
178259
- if (!("name" in obj2) || !Array.isArray(obj2.name)) {
178768
+ if (!("name" in obj3) || !Array.isArray(obj3.name)) {
178260
178769
  throw new Error("Invalid method config: invalid name array");
178261
178770
  }
178262
- for (const name2 of obj2.name) {
178771
+ for (const name2 of obj3.name) {
178263
178772
  result2.name.push(validateName(name2));
178264
178773
  }
178265
- if ("waitForReady" in obj2) {
178266
- if (typeof obj2.waitForReady !== "boolean") {
178774
+ if ("waitForReady" in obj3) {
178775
+ if (typeof obj3.waitForReady !== "boolean") {
178267
178776
  throw new Error("Invalid method config: invalid waitForReady");
178268
178777
  }
178269
- result2.waitForReady = obj2.waitForReady;
178778
+ result2.waitForReady = obj3.waitForReady;
178270
178779
  }
178271
- if ("timeout" in obj2) {
178272
- if (typeof obj2.timeout === "object") {
178273
- if (!("seconds" in obj2.timeout) || !(typeof obj2.timeout.seconds === "number")) {
178780
+ if ("timeout" in obj3) {
178781
+ if (typeof obj3.timeout === "object") {
178782
+ if (!("seconds" in obj3.timeout) || !(typeof obj3.timeout.seconds === "number")) {
178274
178783
  throw new Error("Invalid method config: invalid timeout.seconds");
178275
178784
  }
178276
- if (!("nanos" in obj2.timeout) || !(typeof obj2.timeout.nanos === "number")) {
178785
+ if (!("nanos" in obj3.timeout) || !(typeof obj3.timeout.nanos === "number")) {
178277
178786
  throw new Error("Invalid method config: invalid timeout.nanos");
178278
178787
  }
178279
- result2.timeout = obj2.timeout;
178280
- } else if (typeof obj2.timeout === "string" && DURATION_REGEX.test(obj2.timeout)) {
178281
- const timeoutParts = obj2.timeout.substring(0, obj2.timeout.length - 1).split(".");
178788
+ result2.timeout = obj3.timeout;
178789
+ } else if (typeof obj3.timeout === "string" && DURATION_REGEX.test(obj3.timeout)) {
178790
+ const timeoutParts = obj3.timeout.substring(0, obj3.timeout.length - 1).split(".");
178282
178791
  result2.timeout = {
178283
178792
  seconds: timeoutParts[0] | 0,
178284
178793
  nanos: ((_a4 = timeoutParts[1]) !== null && _a4 !== void 0 ? _a4 : 0) | 0
@@ -178287,46 +178796,46 @@ var require_service_config = __commonJS({
178287
178796
  throw new Error("Invalid method config: invalid timeout");
178288
178797
  }
178289
178798
  }
178290
- if ("maxRequestBytes" in obj2) {
178291
- if (typeof obj2.maxRequestBytes !== "number") {
178799
+ if ("maxRequestBytes" in obj3) {
178800
+ if (typeof obj3.maxRequestBytes !== "number") {
178292
178801
  throw new Error("Invalid method config: invalid maxRequestBytes");
178293
178802
  }
178294
- result2.maxRequestBytes = obj2.maxRequestBytes;
178803
+ result2.maxRequestBytes = obj3.maxRequestBytes;
178295
178804
  }
178296
- if ("maxResponseBytes" in obj2) {
178297
- if (typeof obj2.maxResponseBytes !== "number") {
178805
+ if ("maxResponseBytes" in obj3) {
178806
+ if (typeof obj3.maxResponseBytes !== "number") {
178298
178807
  throw new Error("Invalid method config: invalid maxRequestBytes");
178299
178808
  }
178300
- result2.maxResponseBytes = obj2.maxResponseBytes;
178809
+ result2.maxResponseBytes = obj3.maxResponseBytes;
178301
178810
  }
178302
- if ("retryPolicy" in obj2) {
178303
- if ("hedgingPolicy" in obj2) {
178811
+ if ("retryPolicy" in obj3) {
178812
+ if ("hedgingPolicy" in obj3) {
178304
178813
  throw new Error("Invalid method config: retryPolicy and hedgingPolicy cannot both be specified");
178305
178814
  } else {
178306
- result2.retryPolicy = validateRetryPolicy(obj2.retryPolicy);
178815
+ result2.retryPolicy = validateRetryPolicy(obj3.retryPolicy);
178307
178816
  }
178308
- } else if ("hedgingPolicy" in obj2) {
178309
- result2.hedgingPolicy = validateHedgingPolicy(obj2.hedgingPolicy);
178817
+ } else if ("hedgingPolicy" in obj3) {
178818
+ result2.hedgingPolicy = validateHedgingPolicy(obj3.hedgingPolicy);
178310
178819
  }
178311
178820
  return result2;
178312
178821
  }
178313
- function validateRetryThrottling(obj2) {
178314
- if (!("maxTokens" in obj2) || typeof obj2.maxTokens !== "number" || obj2.maxTokens <= 0 || obj2.maxTokens > 1e3) {
178822
+ function validateRetryThrottling(obj3) {
178823
+ if (!("maxTokens" in obj3) || typeof obj3.maxTokens !== "number" || obj3.maxTokens <= 0 || obj3.maxTokens > 1e3) {
178315
178824
  throw new Error("Invalid retryThrottling: maxTokens must be a number in (0, 1000]");
178316
178825
  }
178317
- if (!("tokenRatio" in obj2) || typeof obj2.tokenRatio !== "number" || obj2.tokenRatio <= 0) {
178826
+ if (!("tokenRatio" in obj3) || typeof obj3.tokenRatio !== "number" || obj3.tokenRatio <= 0) {
178318
178827
  throw new Error("Invalid retryThrottling: tokenRatio must be a number greater than 0");
178319
178828
  }
178320
178829
  return {
178321
- maxTokens: +obj2.maxTokens.toFixed(3),
178322
- tokenRatio: +obj2.tokenRatio.toFixed(3)
178830
+ maxTokens: +obj3.maxTokens.toFixed(3),
178831
+ tokenRatio: +obj3.tokenRatio.toFixed(3)
178323
178832
  };
178324
178833
  }
178325
- function validateLoadBalancingConfig(obj2) {
178326
- if (!(typeof obj2 === "object" && obj2 !== null)) {
178327
- throw new Error(`Invalid loadBalancingConfig: unexpected type ${typeof obj2}`);
178834
+ function validateLoadBalancingConfig(obj3) {
178835
+ if (!(typeof obj3 === "object" && obj3 !== null)) {
178836
+ throw new Error(`Invalid loadBalancingConfig: unexpected type ${typeof obj3}`);
178328
178837
  }
178329
- const keys = Object.keys(obj2);
178838
+ const keys = Object.keys(obj3);
178330
178839
  if (keys.length > 1) {
178331
178840
  throw new Error(`Invalid loadBalancingConfig: unexpected multiple keys ${keys}`);
178332
178841
  }
@@ -178334,39 +178843,39 @@ var require_service_config = __commonJS({
178334
178843
  throw new Error("Invalid loadBalancingConfig: load balancing policy name required");
178335
178844
  }
178336
178845
  return {
178337
- [keys[0]]: obj2[keys[0]]
178846
+ [keys[0]]: obj3[keys[0]]
178338
178847
  };
178339
178848
  }
178340
- function validateServiceConfig(obj2) {
178849
+ function validateServiceConfig(obj3) {
178341
178850
  const result2 = {
178342
178851
  loadBalancingConfig: [],
178343
178852
  methodConfig: []
178344
178853
  };
178345
- if ("loadBalancingPolicy" in obj2) {
178346
- if (typeof obj2.loadBalancingPolicy === "string") {
178347
- result2.loadBalancingPolicy = obj2.loadBalancingPolicy;
178854
+ if ("loadBalancingPolicy" in obj3) {
178855
+ if (typeof obj3.loadBalancingPolicy === "string") {
178856
+ result2.loadBalancingPolicy = obj3.loadBalancingPolicy;
178348
178857
  } else {
178349
178858
  throw new Error("Invalid service config: invalid loadBalancingPolicy");
178350
178859
  }
178351
178860
  }
178352
- if ("loadBalancingConfig" in obj2) {
178353
- if (Array.isArray(obj2.loadBalancingConfig)) {
178354
- for (const config2 of obj2.loadBalancingConfig) {
178861
+ if ("loadBalancingConfig" in obj3) {
178862
+ if (Array.isArray(obj3.loadBalancingConfig)) {
178863
+ for (const config2 of obj3.loadBalancingConfig) {
178355
178864
  result2.loadBalancingConfig.push(validateLoadBalancingConfig(config2));
178356
178865
  }
178357
178866
  } else {
178358
178867
  throw new Error("Invalid service config: invalid loadBalancingConfig");
178359
178868
  }
178360
178869
  }
178361
- if ("methodConfig" in obj2) {
178362
- if (Array.isArray(obj2.methodConfig)) {
178363
- for (const methodConfig of obj2.methodConfig) {
178870
+ if ("methodConfig" in obj3) {
178871
+ if (Array.isArray(obj3.methodConfig)) {
178872
+ for (const methodConfig of obj3.methodConfig) {
178364
178873
  result2.methodConfig.push(validateMethodConfig(methodConfig));
178365
178874
  }
178366
178875
  }
178367
178876
  }
178368
- if ("retryThrottling" in obj2) {
178369
- result2.retryThrottling = validateRetryThrottling(obj2.retryThrottling);
178877
+ if ("retryThrottling" in obj3) {
178878
+ result2.retryThrottling = validateRetryThrottling(obj3.retryThrottling);
178370
178879
  }
178371
178880
  const seenMethodNames = [];
178372
178881
  for (const methodConfig of result2.methodConfig) {
@@ -178381,17 +178890,17 @@ var require_service_config = __commonJS({
178381
178890
  }
178382
178891
  return result2;
178383
178892
  }
178384
- function validateCanaryConfig(obj2) {
178385
- if (!("serviceConfig" in obj2)) {
178893
+ function validateCanaryConfig(obj3) {
178894
+ if (!("serviceConfig" in obj3)) {
178386
178895
  throw new Error("Invalid service config choice: missing service config");
178387
178896
  }
178388
178897
  const result2 = {
178389
- serviceConfig: validateServiceConfig(obj2.serviceConfig)
178898
+ serviceConfig: validateServiceConfig(obj3.serviceConfig)
178390
178899
  };
178391
- if ("clientLanguage" in obj2) {
178392
- if (Array.isArray(obj2.clientLanguage)) {
178900
+ if ("clientLanguage" in obj3) {
178901
+ if (Array.isArray(obj3.clientLanguage)) {
178393
178902
  result2.clientLanguage = [];
178394
- for (const lang of obj2.clientLanguage) {
178903
+ for (const lang of obj3.clientLanguage) {
178395
178904
  if (typeof lang === "string") {
178396
178905
  result2.clientLanguage.push(lang);
178397
178906
  } else {
@@ -178402,10 +178911,10 @@ var require_service_config = __commonJS({
178402
178911
  throw new Error("Invalid service config choice: invalid clientLanguage");
178403
178912
  }
178404
178913
  }
178405
- if ("clientHostname" in obj2) {
178406
- if (Array.isArray(obj2.clientHostname)) {
178914
+ if ("clientHostname" in obj3) {
178915
+ if (Array.isArray(obj3.clientHostname)) {
178407
178916
  result2.clientHostname = [];
178408
- for (const lang of obj2.clientHostname) {
178917
+ for (const lang of obj3.clientHostname) {
178409
178918
  if (typeof lang === "string") {
178410
178919
  result2.clientHostname.push(lang);
178411
178920
  } else {
@@ -178416,9 +178925,9 @@ var require_service_config = __commonJS({
178416
178925
  throw new Error("Invalid service config choice: invalid clientHostname");
178417
178926
  }
178418
178927
  }
178419
- if ("percentage" in obj2) {
178420
- if (typeof obj2.percentage === "number" && 0 <= obj2.percentage && obj2.percentage <= 100) {
178421
- result2.percentage = obj2.percentage;
178928
+ if ("percentage" in obj3) {
178929
+ if (typeof obj3.percentage === "number" && 0 <= obj3.percentage && obj3.percentage <= 100) {
178930
+ result2.percentage = obj3.percentage;
178422
178931
  } else {
178423
178932
  throw new Error("Invalid service config choice: invalid percentage");
178424
178933
  }
@@ -178429,18 +178938,18 @@ var require_service_config = __commonJS({
178429
178938
  "clientHostname",
178430
178939
  "serviceConfig"
178431
178940
  ];
178432
- for (const field in obj2) {
178941
+ for (const field in obj3) {
178433
178942
  if (!allowedFields.includes(field)) {
178434
178943
  throw new Error(`Invalid service config choice: unexpected field ${field}`);
178435
178944
  }
178436
178945
  }
178437
178946
  return result2;
178438
178947
  }
178439
- function validateAndSelectCanaryConfig(obj2, percentage) {
178440
- if (!Array.isArray(obj2)) {
178948
+ function validateAndSelectCanaryConfig(obj3, percentage) {
178949
+ if (!Array.isArray(obj3)) {
178441
178950
  throw new Error("Invalid service config list");
178442
178951
  }
178443
- for (const config2 of obj2) {
178952
+ for (const config2 of obj3) {
178444
178953
  const validatedConfig = validateCanaryConfig(config2);
178445
178954
  if (typeof validatedConfig.percentage === "number" && percentage > validatedConfig.percentage) {
178446
178955
  continue;
@@ -181165,8 +181674,8 @@ var require_make_client = __commonJS({
181165
181674
  return fn.call(this, path2, serialize2, deserialize, ...args);
181166
181675
  };
181167
181676
  }
181168
- function isProtobufTypeDefinition(obj2) {
181169
- return "format" in obj2;
181677
+ function isProtobufTypeDefinition(obj3) {
181678
+ return "format" in obj3;
181170
181679
  }
181171
181680
  function loadPackageDefinition(packageDef) {
181172
181681
  const result2 = {};
@@ -183456,18 +183965,18 @@ var require_descriptor2 = __commonJS({
183456
183965
  return delimited ? 10 : 11;
183457
183966
  throw Error("illegal type: " + type);
183458
183967
  }
183459
- function fromDescriptorOptionsRecursive(obj2, type) {
183968
+ function fromDescriptorOptionsRecursive(obj3, type) {
183460
183969
  var val = {};
183461
183970
  for (var i2 = 0, field, key; i2 < type.fieldsArray.length; ++i2) {
183462
183971
  if ((key = (field = type._fieldsArray[i2]).name) === "uninterpretedOption") continue;
183463
- if (!Object.prototype.hasOwnProperty.call(obj2, key)) continue;
183972
+ if (!Object.prototype.hasOwnProperty.call(obj3, key)) continue;
183464
183973
  var newKey = underScore(key);
183465
183974
  if (field.resolvedType instanceof Type) {
183466
- val[newKey] = fromDescriptorOptionsRecursive(obj2[key], field.resolvedType);
183975
+ val[newKey] = fromDescriptorOptionsRecursive(obj3[key], field.resolvedType);
183467
183976
  } else if (field.resolvedType instanceof Enum) {
183468
- val[newKey] = field.resolvedType.valuesById[obj2[key]];
183977
+ val[newKey] = field.resolvedType.valuesById[obj3[key]];
183469
183978
  } else {
183470
- val[newKey] = obj2[key];
183979
+ val[newKey] = obj3[key];
183471
183980
  }
183472
183981
  }
183473
183982
  return val;
@@ -183477,18 +183986,18 @@ var require_descriptor2 = __commonJS({
183477
183986
  return void 0;
183478
183987
  return fromDescriptorOptionsRecursive(type.toObject(options), type);
183479
183988
  }
183480
- function toDescriptorOptionsRecursive(obj2, type) {
183989
+ function toDescriptorOptionsRecursive(obj3, type) {
183481
183990
  var val = {};
183482
- var keys = Object.keys(obj2);
183991
+ var keys = Object.keys(obj3);
183483
183992
  for (var i2 = 0; i2 < keys.length; ++i2) {
183484
183993
  var key = keys[i2];
183485
183994
  var newKey = $protobuf.util.camelCase(key);
183486
183995
  if (!Object.prototype.hasOwnProperty.call(type.fields, newKey)) continue;
183487
183996
  var field = type.fields[newKey];
183488
183997
  if (field.resolvedType instanceof Type) {
183489
- val[newKey] = toDescriptorOptionsRecursive(obj2[key], field.resolvedType);
183998
+ val[newKey] = toDescriptorOptionsRecursive(obj3[key], field.resolvedType);
183490
183999
  } else {
183491
- val[newKey] = obj2[key];
184000
+ val[newKey] = obj3[key];
183492
184001
  }
183493
184002
  if (field.repeated && !Array.isArray(val[newKey])) {
183494
184003
  val[newKey] = [val[newKey]];
@@ -183991,8 +184500,8 @@ var require_src2 = __commonJS({
183991
184500
  var util_1 = require_util3();
183992
184501
  var Long = require_umd();
183993
184502
  exports.Long = Long;
183994
- function isAnyExtension(obj2) {
183995
- return "@type" in obj2 && typeof obj2["@type"] === "string";
184503
+ function isAnyExtension(obj3) {
184504
+ return "@type" in obj3 && typeof obj3["@type"] === "string";
183996
184505
  }
183997
184506
  exports.isAnyExtension = isAnyExtension;
183998
184507
  var IdempotencyLevel;
@@ -184016,20 +184525,20 @@ var require_src2 = __commonJS({
184016
184525
  return baseName + "." + name2;
184017
184526
  }
184018
184527
  }
184019
- function isHandledReflectionObject(obj2) {
184020
- return obj2 instanceof Protobuf.Service || obj2 instanceof Protobuf.Type || obj2 instanceof Protobuf.Enum;
184528
+ function isHandledReflectionObject(obj3) {
184529
+ return obj3 instanceof Protobuf.Service || obj3 instanceof Protobuf.Type || obj3 instanceof Protobuf.Enum;
184021
184530
  }
184022
- function isNamespaceBase(obj2) {
184023
- return obj2 instanceof Protobuf.Namespace || obj2 instanceof Protobuf.Root;
184531
+ function isNamespaceBase(obj3) {
184532
+ return obj3 instanceof Protobuf.Namespace || obj3 instanceof Protobuf.Root;
184024
184533
  }
184025
- function getAllHandledReflectionObjects(obj2, parentName) {
184026
- const objName = joinName(parentName, obj2.name);
184027
- if (isHandledReflectionObject(obj2)) {
184028
- return [[objName, obj2]];
184534
+ function getAllHandledReflectionObjects(obj3, parentName) {
184535
+ const objName = joinName(parentName, obj3.name);
184536
+ if (isHandledReflectionObject(obj3)) {
184537
+ return [[objName, obj3]];
184029
184538
  } else {
184030
- if (isNamespaceBase(obj2) && typeof obj2.nested !== "undefined") {
184031
- return Object.keys(obj2.nested).map((name2) => {
184032
- return getAllHandledReflectionObjects(obj2.nested[name2], objName);
184539
+ if (isNamespaceBase(obj3) && typeof obj3.nested !== "undefined") {
184540
+ return Object.keys(obj3.nested).map((name2) => {
184541
+ return getAllHandledReflectionObjects(obj3.nested[name2], objName);
184033
184542
  }).reduce((accumulator, currentValue2) => accumulator.concat(currentValue2), []);
184034
184543
  }
184035
184544
  }
@@ -184050,17 +184559,17 @@ var require_src2 = __commonJS({
184050
184559
  };
184051
184560
  }
184052
184561
  function mapMethodOptions(options) {
184053
- return (options || []).reduce((obj2, item) => {
184562
+ return (options || []).reduce((obj3, item) => {
184054
184563
  for (const [key, value] of Object.entries(item)) {
184055
184564
  switch (key) {
184056
184565
  case "uninterpreted_option":
184057
- obj2.uninterpreted_option.push(item.uninterpreted_option);
184566
+ obj3.uninterpreted_option.push(item.uninterpreted_option);
184058
184567
  break;
184059
184568
  default:
184060
- obj2[key] = value;
184569
+ obj3[key] = value;
184061
184570
  }
184062
184571
  }
184063
- return obj2;
184572
+ return obj3;
184064
184573
  }, {
184065
184574
  deprecated: false,
184066
184575
  idempotency_level: IdempotencyLevel.IDEMPOTENCY_UNKNOWN,
@@ -184110,13 +184619,13 @@ var require_src2 = __commonJS({
184110
184619
  fileDescriptorProtos: fileDescriptors
184111
184620
  };
184112
184621
  }
184113
- function createDefinition(obj2, name2, options, fileDescriptors) {
184114
- if (obj2 instanceof Protobuf.Service) {
184115
- return createServiceDefinition(obj2, name2, options, fileDescriptors);
184116
- } else if (obj2 instanceof Protobuf.Type) {
184117
- return createMessageDefinition(obj2, options, fileDescriptors);
184118
- } else if (obj2 instanceof Protobuf.Enum) {
184119
- return createEnumDefinition(obj2, fileDescriptors);
184622
+ function createDefinition(obj3, name2, options, fileDescriptors) {
184623
+ if (obj3 instanceof Protobuf.Service) {
184624
+ return createServiceDefinition(obj3, name2, options, fileDescriptors);
184625
+ } else if (obj3 instanceof Protobuf.Type) {
184626
+ return createMessageDefinition(obj3, options, fileDescriptors);
184627
+ } else if (obj3 instanceof Protobuf.Enum) {
184628
+ return createEnumDefinition(obj3, fileDescriptors);
184120
184629
  } else {
184121
184630
  throw new Error("Type mismatch in reflection object handling");
184122
184631
  }
@@ -184126,8 +184635,8 @@ var require_src2 = __commonJS({
184126
184635
  root.resolveAll();
184127
184636
  const descriptorList = root.toDescriptor("proto3").file;
184128
184637
  const bufferList = descriptorList.map((value) => Buffer.from(descriptor.FileDescriptorProto.encode(value).finish()));
184129
- for (const [name2, obj2] of getAllHandledReflectionObjects(root, "")) {
184130
- def[name2] = createDefinition(obj2, name2, options, bufferList);
184638
+ for (const [name2, obj3] of getAllHandledReflectionObjects(root, "")) {
184639
+ def[name2] = createDefinition(obj3, name2, options, bufferList);
184131
184640
  }
184132
184641
  return def;
184133
184642
  }
@@ -192327,7 +192836,7 @@ var require_server = __commonJS({
192327
192836
  }, (() => {
192328
192837
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? /* @__PURE__ */ Object.create(null) : void 0;
192329
192838
  _start_decorators = [deprecate("Calling start() is no longer necessary. It can be safely omitted.")];
192330
- __esDecorate(_a4, null, _start_decorators, { kind: "method", name: "start", static: false, private: false, access: { has: (obj2) => "start" in obj2, get: (obj2) => obj2.start }, metadata: _metadata }, null, _instanceExtraInitializers);
192839
+ __esDecorate(_a4, null, _start_decorators, { kind: "method", name: "start", static: false, private: false, access: { has: (obj3) => "start" in obj3, get: (obj3) => obj3.start }, metadata: _metadata }, null, _instanceExtraInitializers);
192331
192840
  if (_metadata) Object.defineProperty(_a4, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
192332
192841
  })(), _a4;
192333
192842
  })();
@@ -192639,11 +193148,11 @@ var require_load_balancer_pick_first = __commonJS({
192639
193148
  return this.shuffleAddressList;
192640
193149
  }
192641
193150
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
192642
- static createFromJson(obj2) {
192643
- if ("shuffleAddressList" in obj2 && !(typeof obj2.shuffleAddressList === "boolean")) {
193151
+ static createFromJson(obj3) {
193152
+ if ("shuffleAddressList" in obj3 && !(typeof obj3.shuffleAddressList === "boolean")) {
192644
193153
  throw new Error("pick_first config field shuffleAddressList must be a boolean if provided");
192645
193154
  }
192646
- return new _PickFirstLoadBalancingConfig(obj2.shuffleAddressList === true);
193155
+ return new _PickFirstLoadBalancingConfig(obj3.shuffleAddressList === true);
192647
193156
  }
192648
193157
  };
192649
193158
  exports.PickFirstLoadBalancingConfig = PickFirstLoadBalancingConfig;
@@ -193435,7 +193944,7 @@ var require_load_balancer_round_robin = __commonJS({
193435
193944
  };
193436
193945
  }
193437
193946
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
193438
- static createFromJson(obj2) {
193947
+ static createFromJson(obj3) {
193439
193948
  return new _RoundRobinLoadBalancingConfig();
193440
193949
  }
193441
193950
  };
@@ -193615,27 +194124,27 @@ var require_load_balancer_outlier_detection = __commonJS({
193615
194124
  minimum_hosts: 5,
193616
194125
  request_volume: 50
193617
194126
  };
193618
- function validateFieldType(obj2, fieldName2, expectedType, objectName) {
193619
- if (fieldName2 in obj2 && obj2[fieldName2] !== void 0 && typeof obj2[fieldName2] !== expectedType) {
194127
+ function validateFieldType(obj3, fieldName2, expectedType, objectName) {
194128
+ if (fieldName2 in obj3 && obj3[fieldName2] !== void 0 && typeof obj3[fieldName2] !== expectedType) {
193620
194129
  const fullFieldName = objectName ? `${objectName}.${fieldName2}` : fieldName2;
193621
- throw new Error(`outlier detection config ${fullFieldName} parse error: expected ${expectedType}, got ${typeof obj2[fieldName2]}`);
194130
+ throw new Error(`outlier detection config ${fullFieldName} parse error: expected ${expectedType}, got ${typeof obj3[fieldName2]}`);
193622
194131
  }
193623
194132
  }
193624
- function validatePositiveDuration(obj2, fieldName2, objectName) {
194133
+ function validatePositiveDuration(obj3, fieldName2, objectName) {
193625
194134
  const fullFieldName = objectName ? `${objectName}.${fieldName2}` : fieldName2;
193626
- if (fieldName2 in obj2 && obj2[fieldName2] !== void 0) {
193627
- if (!(0, duration_1.isDuration)(obj2[fieldName2])) {
193628
- throw new Error(`outlier detection config ${fullFieldName} parse error: expected Duration, got ${typeof obj2[fieldName2]}`);
194135
+ if (fieldName2 in obj3 && obj3[fieldName2] !== void 0) {
194136
+ if (!(0, duration_1.isDuration)(obj3[fieldName2])) {
194137
+ throw new Error(`outlier detection config ${fullFieldName} parse error: expected Duration, got ${typeof obj3[fieldName2]}`);
193629
194138
  }
193630
- if (!(obj2[fieldName2].seconds >= 0 && obj2[fieldName2].seconds <= 315576e6 && obj2[fieldName2].nanos >= 0 && obj2[fieldName2].nanos <= 999999999)) {
194139
+ if (!(obj3[fieldName2].seconds >= 0 && obj3[fieldName2].seconds <= 315576e6 && obj3[fieldName2].nanos >= 0 && obj3[fieldName2].nanos <= 999999999)) {
193631
194140
  throw new Error(`outlier detection config ${fullFieldName} parse error: values out of range for non-negative Duaration`);
193632
194141
  }
193633
194142
  }
193634
194143
  }
193635
- function validatePercentage(obj2, fieldName2, objectName) {
194144
+ function validatePercentage(obj3, fieldName2, objectName) {
193636
194145
  const fullFieldName = objectName ? `${objectName}.${fieldName2}` : fieldName2;
193637
- validateFieldType(obj2, fieldName2, "number", objectName);
193638
- if (fieldName2 in obj2 && obj2[fieldName2] !== void 0 && !(obj2[fieldName2] >= 0 && obj2[fieldName2] <= 100)) {
194146
+ validateFieldType(obj3, fieldName2, "number", objectName);
194147
+ if (fieldName2 in obj3 && obj3[fieldName2] !== void 0 && !(obj3[fieldName2] >= 0 && obj3[fieldName2] <= 100)) {
193639
194148
  throw new Error(`outlier detection config ${fullFieldName} parse error: value out of range for percentage (0-100)`);
193640
194149
  }
193641
194150
  }
@@ -193690,38 +194199,38 @@ var require_load_balancer_outlier_detection = __commonJS({
193690
194199
  getChildPolicy() {
193691
194200
  return this.childPolicy;
193692
194201
  }
193693
- static createFromJson(obj2) {
194202
+ static createFromJson(obj3) {
193694
194203
  var _a5;
193695
- validatePositiveDuration(obj2, "interval");
193696
- validatePositiveDuration(obj2, "base_ejection_time");
193697
- validatePositiveDuration(obj2, "max_ejection_time");
193698
- validatePercentage(obj2, "max_ejection_percent");
193699
- if ("success_rate_ejection" in obj2 && obj2.success_rate_ejection !== void 0) {
193700
- if (typeof obj2.success_rate_ejection !== "object") {
194204
+ validatePositiveDuration(obj3, "interval");
194205
+ validatePositiveDuration(obj3, "base_ejection_time");
194206
+ validatePositiveDuration(obj3, "max_ejection_time");
194207
+ validatePercentage(obj3, "max_ejection_percent");
194208
+ if ("success_rate_ejection" in obj3 && obj3.success_rate_ejection !== void 0) {
194209
+ if (typeof obj3.success_rate_ejection !== "object") {
193701
194210
  throw new Error("outlier detection config success_rate_ejection must be an object");
193702
194211
  }
193703
- validateFieldType(obj2.success_rate_ejection, "stdev_factor", "number", "success_rate_ejection");
193704
- validatePercentage(obj2.success_rate_ejection, "enforcement_percentage", "success_rate_ejection");
193705
- validateFieldType(obj2.success_rate_ejection, "minimum_hosts", "number", "success_rate_ejection");
193706
- validateFieldType(obj2.success_rate_ejection, "request_volume", "number", "success_rate_ejection");
194212
+ validateFieldType(obj3.success_rate_ejection, "stdev_factor", "number", "success_rate_ejection");
194213
+ validatePercentage(obj3.success_rate_ejection, "enforcement_percentage", "success_rate_ejection");
194214
+ validateFieldType(obj3.success_rate_ejection, "minimum_hosts", "number", "success_rate_ejection");
194215
+ validateFieldType(obj3.success_rate_ejection, "request_volume", "number", "success_rate_ejection");
193707
194216
  }
193708
- if ("failure_percentage_ejection" in obj2 && obj2.failure_percentage_ejection !== void 0) {
193709
- if (typeof obj2.failure_percentage_ejection !== "object") {
194217
+ if ("failure_percentage_ejection" in obj3 && obj3.failure_percentage_ejection !== void 0) {
194218
+ if (typeof obj3.failure_percentage_ejection !== "object") {
193710
194219
  throw new Error("outlier detection config failure_percentage_ejection must be an object");
193711
194220
  }
193712
- validatePercentage(obj2.failure_percentage_ejection, "threshold", "failure_percentage_ejection");
193713
- validatePercentage(obj2.failure_percentage_ejection, "enforcement_percentage", "failure_percentage_ejection");
193714
- validateFieldType(obj2.failure_percentage_ejection, "minimum_hosts", "number", "failure_percentage_ejection");
193715
- validateFieldType(obj2.failure_percentage_ejection, "request_volume", "number", "failure_percentage_ejection");
194221
+ validatePercentage(obj3.failure_percentage_ejection, "threshold", "failure_percentage_ejection");
194222
+ validatePercentage(obj3.failure_percentage_ejection, "enforcement_percentage", "failure_percentage_ejection");
194223
+ validateFieldType(obj3.failure_percentage_ejection, "minimum_hosts", "number", "failure_percentage_ejection");
194224
+ validateFieldType(obj3.failure_percentage_ejection, "request_volume", "number", "failure_percentage_ejection");
193716
194225
  }
193717
- if (!("child_policy" in obj2) || !Array.isArray(obj2.child_policy)) {
194226
+ if (!("child_policy" in obj3) || !Array.isArray(obj3.child_policy)) {
193718
194227
  throw new Error("outlier detection config child_policy must be an array");
193719
194228
  }
193720
- const childPolicy = (0, load_balancer_1.selectLbConfigFromList)(obj2.child_policy);
194229
+ const childPolicy = (0, load_balancer_1.selectLbConfigFromList)(obj3.child_policy);
193721
194230
  if (!childPolicy) {
193722
194231
  throw new Error("outlier detection config child_policy: no valid recognized policy found");
193723
194232
  }
193724
- return new _OutlierDetectionLoadBalancingConfig(obj2.interval ? (0, duration_1.durationToMs)(obj2.interval) : null, obj2.base_ejection_time ? (0, duration_1.durationToMs)(obj2.base_ejection_time) : null, obj2.max_ejection_time ? (0, duration_1.durationToMs)(obj2.max_ejection_time) : null, (_a5 = obj2.max_ejection_percent) !== null && _a5 !== void 0 ? _a5 : null, obj2.success_rate_ejection, obj2.failure_percentage_ejection, childPolicy);
194233
+ return new _OutlierDetectionLoadBalancingConfig(obj3.interval ? (0, duration_1.durationToMs)(obj3.interval) : null, obj3.base_ejection_time ? (0, duration_1.durationToMs)(obj3.base_ejection_time) : null, obj3.max_ejection_time ? (0, duration_1.durationToMs)(obj3.max_ejection_time) : null, (_a5 = obj3.max_ejection_percent) !== null && _a5 !== void 0 ? _a5 : null, obj3.success_rate_ejection, obj3.failure_percentage_ejection, childPolicy);
193725
194234
  }
193726
194235
  };
193727
194236
  exports.OutlierDetectionLoadBalancingConfig = OutlierDetectionLoadBalancingConfig;
@@ -194207,26 +194716,26 @@ var require_load_balancer_weighted_round_robin = __commonJS({
194207
194716
  var DEFAULT_WEIGHT_EXPIRATION_PERIOD_MS = 3 * 6e4;
194208
194717
  var DEFAULT_WEIGHT_UPDATE_PERIOD_MS = 1e3;
194209
194718
  var DEFAULT_ERROR_UTILIZATION_PENALTY = 1;
194210
- function validateFieldType(obj2, fieldName2, expectedType) {
194211
- if (fieldName2 in obj2 && obj2[fieldName2] !== void 0 && typeof obj2[fieldName2] !== expectedType) {
194212
- throw new Error(`weighted round robin config ${fieldName2} parse error: expected ${expectedType}, got ${typeof obj2[fieldName2]}`);
194719
+ function validateFieldType(obj3, fieldName2, expectedType) {
194720
+ if (fieldName2 in obj3 && obj3[fieldName2] !== void 0 && typeof obj3[fieldName2] !== expectedType) {
194721
+ throw new Error(`weighted round robin config ${fieldName2} parse error: expected ${expectedType}, got ${typeof obj3[fieldName2]}`);
194213
194722
  }
194214
194723
  }
194215
- function parseDurationField(obj2, fieldName2) {
194216
- if (fieldName2 in obj2 && obj2[fieldName2] !== void 0 && obj2[fieldName2] !== null) {
194724
+ function parseDurationField(obj3, fieldName2) {
194725
+ if (fieldName2 in obj3 && obj3[fieldName2] !== void 0 && obj3[fieldName2] !== null) {
194217
194726
  let durationObject;
194218
- if ((0, duration_1.isDuration)(obj2[fieldName2])) {
194219
- durationObject = obj2[fieldName2];
194220
- } else if ((0, duration_1.isDurationMessage)(obj2[fieldName2])) {
194221
- durationObject = (0, duration_1.durationMessageToDuration)(obj2[fieldName2]);
194222
- } else if (typeof obj2[fieldName2] === "string") {
194223
- const parsedDuration = (0, duration_1.parseDuration)(obj2[fieldName2]);
194727
+ if ((0, duration_1.isDuration)(obj3[fieldName2])) {
194728
+ durationObject = obj3[fieldName2];
194729
+ } else if ((0, duration_1.isDurationMessage)(obj3[fieldName2])) {
194730
+ durationObject = (0, duration_1.durationMessageToDuration)(obj3[fieldName2]);
194731
+ } else if (typeof obj3[fieldName2] === "string") {
194732
+ const parsedDuration = (0, duration_1.parseDuration)(obj3[fieldName2]);
194224
194733
  if (!parsedDuration) {
194225
- throw new Error(`weighted round robin config ${fieldName2}: failed to parse duration string ${obj2[fieldName2]}`);
194734
+ throw new Error(`weighted round robin config ${fieldName2}: failed to parse duration string ${obj3[fieldName2]}`);
194226
194735
  }
194227
194736
  durationObject = parsedDuration;
194228
194737
  } else {
194229
- throw new Error(`weighted round robin config ${fieldName2}: expected duration, got ${typeof obj2[fieldName2]}`);
194738
+ throw new Error(`weighted round robin config ${fieldName2}: expected duration, got ${typeof obj3[fieldName2]}`);
194230
194739
  }
194231
194740
  return (0, duration_1.durationToMs)(durationObject);
194232
194741
  }
@@ -194254,13 +194763,13 @@ var require_load_balancer_weighted_round_robin = __commonJS({
194254
194763
  error_utilization_penalty: this.errorUtilizationPenalty
194255
194764
  };
194256
194765
  }
194257
- static createFromJson(obj2) {
194258
- validateFieldType(obj2, "enable_oob_load_report", "boolean");
194259
- validateFieldType(obj2, "error_utilization_penalty", "number");
194260
- if (obj2.error_utilization_penalty < 0) {
194766
+ static createFromJson(obj3) {
194767
+ validateFieldType(obj3, "enable_oob_load_report", "boolean");
194768
+ validateFieldType(obj3, "error_utilization_penalty", "number");
194769
+ if (obj3.error_utilization_penalty < 0) {
194261
194770
  throw new Error("weighted round robin config error_utilization_penalty < 0");
194262
194771
  }
194263
- return new _WeightedRoundRobinLoadBalancingConfig(obj2.enable_oob_load_report, parseDurationField(obj2, "oob_load_reporting_period"), parseDurationField(obj2, "blackout_period"), parseDurationField(obj2, "weight_expiration_period"), parseDurationField(obj2, "weight_update_period"), obj2.error_utilization_penalty);
194772
+ return new _WeightedRoundRobinLoadBalancingConfig(obj3.enable_oob_load_report, parseDurationField(obj3, "oob_load_reporting_period"), parseDurationField(obj3, "blackout_period"), parseDurationField(obj3, "weight_expiration_period"), parseDurationField(obj3, "weight_update_period"), obj3.error_utilization_penalty);
194264
194773
  }
194265
194774
  getEnableOobLoadReport() {
194266
194775
  return this.enableOobLoadReport;
@@ -194873,7 +195382,7 @@ function differenceAt(path2, expected, actual) {
194873
195382
  actual: actual[shared]
194874
195383
  };
194875
195384
  }
194876
- if (isRecord10(expected) && isRecord10(actual)) {
195385
+ if (isRecord11(expected) && isRecord11(actual)) {
194877
195386
  for (const key of Object.keys(expected)) {
194878
195387
  const found = differenceAt(
194879
195388
  keyPath(path2, key),
@@ -194968,7 +195477,7 @@ function rpcMessage(request4) {
194968
195477
  const parsed2 = parseJson4(decodeText2(request4.body));
194969
195478
  if (!parsed2.ok) return void 0;
194970
195479
  const value = isList(parsed2.value) ? parsed2.value[0] : parsed2.value;
194971
- return isRecord10(value) ? value : void 0;
195480
+ return isRecord11(value) ? value : void 0;
194972
195481
  }
194973
195482
  function replayTransport(exchanges, route) {
194974
195483
  let next = 0;
@@ -195831,7 +196340,7 @@ function importedEntries(tree) {
195831
196340
  for (const [server, folder] of serverFolders(tree)) {
195832
196341
  for (const [key, entry2] of folder.tools) {
195833
196342
  const upstream = folder.locked.get(key)?.upstream;
195834
- const pinned2 = isRecord9(upstream) ? upstream.description : void 0;
196343
+ const pinned2 = isRecord10(upstream) ? upstream.description : void 0;
195835
196344
  const own2 = entry2.description;
195836
196345
  imported.push({
195837
196346
  server,
@@ -197391,12 +197900,12 @@ var init_src8 = __esm({
197391
197900
  });
197392
197901
 
197393
197902
  // ../../packages/steering-bundle/src/tree.ts
197394
- import { createHash as createHash31 } from "node:crypto";
197903
+ import { createHash as createHash32 } from "node:crypto";
197395
197904
  function gitBlobId(text6) {
197396
197905
  return gitBlobIdOfBytes(Buffer.from(text6, "utf8"));
197397
197906
  }
197398
197907
  function gitBlobIdOfBytes(bytes) {
197399
- return createHash31("sha1").update(`blob ${bytes.length}\0`).update(bytes).digest("hex");
197908
+ return createHash32("sha1").update(`blob ${bytes.length}\0`).update(bytes).digest("hex");
197400
197909
  }
197401
197910
  function treeFromFiles(files2) {
197402
197911
  return {
@@ -197936,7 +198445,7 @@ __export(check_exports, {
197936
198445
  readHead: () => readHead2
197937
198446
  });
197938
198447
  import { execFileSync } from "node:child_process";
197939
- import { createHash as createHash32 } from "node:crypto";
198448
+ import { createHash as createHash33 } from "node:crypto";
197940
198449
  import {
197941
198450
  lstatSync as lstatSync14,
197942
198451
  mkdirSync as mkdirSync15,
@@ -198155,9 +198664,9 @@ function cacheFile(cacheDir, root) {
198155
198664
  const identity = {
198156
198665
  api: getApiUrl(),
198157
198666
  ...targetOf(root),
198158
- key: token === void 0 ? null : createHash32("sha256").update(token).digest("hex").slice(0, 16)
198667
+ key: token === void 0 ? null : createHash33("sha256").update(token).digest("hex").slice(0, 16)
198159
198668
  };
198160
- const key = createHash32("sha256").update(JSON.stringify([root, identity])).digest("hex").slice(0, 32);
198669
+ const key = createHash33("sha256").update(JSON.stringify([root, identity])).digest("hex").slice(0, 32);
198161
198670
  return join75(cacheDir, `${key}.json`);
198162
198671
  }
198163
198672
  function readCache(file2, now) {
@@ -198847,12 +199356,12 @@ var init_telemetry = __esm({
198847
199356
  });
198848
199357
 
198849
199358
  // src/auth/pkce.ts
198850
- import { createHash as createHash33, randomBytes as randomBytes15 } from "node:crypto";
199359
+ import { createHash as createHash34, randomBytes as randomBytes15 } from "node:crypto";
198851
199360
  function generateCodeVerifier() {
198852
199361
  return randomBytes15(32).toString("base64url");
198853
199362
  }
198854
199363
  function codeChallengeS256(codeVerifier) {
198855
- return createHash33("sha256").update(codeVerifier, "ascii").digest("base64url");
199364
+ return createHash34("sha256").update(codeVerifier, "ascii").digest("base64url");
198856
199365
  }
198857
199366
  function generateState() {
198858
199367
  return randomBytes15(16).toString("base64url");
@@ -199576,6 +200085,7 @@ var init_agent_register = __esm({
199576
200085
  "use strict";
199577
200086
  init_zod();
199578
200087
  init_registry4();
200088
+ init_secret_fields();
199579
200089
  init_agent_list();
199580
200090
  init_runtime_shared();
199581
200091
  init_toolbelt_shared();
@@ -199588,10 +200098,11 @@ var init_agent_register = __esm({
199588
200098
  description: "Register an agent in this workspace: one operator on one runtime with one harness, carrying a toolbelt. Mints its principal, default role, first version and a long-lived credential shown once.",
199589
200099
  mode: "sync",
199590
200100
  // The handler acts as the signed-in user or the API key's creator
199591
- // (resolveActingUserId, assertOrgRole, INV-29). It ships on the API, CLI,
199592
- // and MCP. It stays off the agent surface because it returns a credential.
199593
- surfaces: ["api", "cli", "mcp"],
199594
- layers: ["schema", "api", "unit", "docs", "app", "mcp"],
200101
+ // (resolveActingUserId, assertOrgRole, INV-29). It ships on the API and the
200102
+ // CLI. It stays off the mcp and agent surfaces because it returns a
200103
+ // credential, and a tool result lands in a model's transcript (ADR-9277).
200104
+ surfaces: ["api", "cli"],
200105
+ layers: ["schema", "api", "unit", "docs", "app"],
199595
200106
  scoped: true,
199596
200107
  noBillingGate: true,
199597
200108
  mutates: true,
@@ -199627,7 +200138,7 @@ var init_agent_register = __esm({
199627
200138
  credential: external_exports.object({
199628
200139
  id: external_exports.string().regex(/^aky_[0-9a-z]+$/),
199629
200140
  /** Shown once. Never recoverable. */
199630
- secret: external_exports.string().min(1),
200141
+ secret: secretField(external_exports.string().min(1)),
199631
200142
  expiresAt: external_exports.string().datetime({ offset: true })
199632
200143
  }).strict()
199633
200144
  }).strict()