@oxagen/cli 2.1.4-381 → 2.1.4-384

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 +303 -138
  2. package/package.json +1 -1
package/oxagen.mjs CHANGED
@@ -11122,17 +11122,93 @@ var init_frame_body = __esm({
11122
11122
  }
11123
11123
  });
11124
11124
 
11125
- // ../../packages/tacho/src/claude-code/hooks.ts
11125
+ // ../../packages/tacho/src/claude-code/payload-members.ts
11126
11126
  function isRecord4(value) {
11127
11127
  return value !== null && typeof value === "object" && !Array.isArray(value);
11128
11128
  }
11129
+ function scalar(value) {
11130
+ if (typeof value === "string") {
11131
+ const redacted = redactText(value);
11132
+ return redacted.length > MEMBER_MAX ? cutAt(redacted, MEMBER_MAX) : redacted;
11133
+ }
11134
+ if (typeof value === "number")
11135
+ return Number.isFinite(value) ? value : void 0;
11136
+ if (typeof value === "boolean") return value;
11137
+ return void 0;
11138
+ }
11139
+ function pick2(value, members2) {
11140
+ const out = {};
11141
+ for (const member2 of members2) {
11142
+ const kept = scalar(value[member2]);
11143
+ if (kept !== void 0) out[member2] = kept;
11144
+ }
11145
+ return out;
11146
+ }
11147
+ function pickEach(value, members2) {
11148
+ if (!Array.isArray(value)) return void 0;
11149
+ return value.map((entry2) => isRecord4(entry2) ? pick2(entry2, members2) : {});
11150
+ }
11151
+ function promptOriginOf(value) {
11152
+ if (!isRecord4(value)) return void 0;
11153
+ const kind = value["kind"];
11154
+ if (typeof kind !== "string" || kind.length === 0) return void 0;
11155
+ const origin = pick2(value, ORIGIN_MEMBERS);
11156
+ const hops = value[ORIGIN_HOP_CHAIN];
11157
+ if (Array.isArray(hops)) {
11158
+ origin[ORIGIN_HOP_CHAIN] = hops.slice(0, HOP_CHAIN_MAX).map(scalar).filter((hop) => typeof hop === "string");
11159
+ }
11160
+ return origin;
11161
+ }
11162
+ function backgroundTasksOf(value) {
11163
+ return pickEach(value, BACKGROUND_TASK_MEMBERS);
11164
+ }
11165
+ function sessionCronsOf(value) {
11166
+ return pickEach(value, SESSION_CRON_MEMBERS);
11167
+ }
11168
+ var ORIGIN_MEMBERS, ORIGIN_HOP_CHAIN, BACKGROUND_TASK_MEMBERS, SESSION_CRON_MEMBERS, MEMBER_MAX, HOP_CHAIN_MAX;
11169
+ var init_payload_members = __esm({
11170
+ "../../packages/tacho/src/claude-code/payload-members.ts"() {
11171
+ "use strict";
11172
+ init_redaction();
11173
+ init_tools();
11174
+ ORIGIN_MEMBERS = [
11175
+ "kind",
11176
+ "producer",
11177
+ "from",
11178
+ "name",
11179
+ "msg_id",
11180
+ "fromSession",
11181
+ "fromMode",
11182
+ "senderTaskId",
11183
+ "verifiedPeerPid"
11184
+ ];
11185
+ ORIGIN_HOP_CHAIN = "hopChain";
11186
+ BACKGROUND_TASK_MEMBERS = [
11187
+ "id",
11188
+ "type",
11189
+ "status",
11190
+ "agent_type",
11191
+ "server",
11192
+ "tool",
11193
+ "name"
11194
+ ];
11195
+ SESSION_CRON_MEMBERS = ["id", "schedule", "recurring"];
11196
+ MEMBER_MAX = 512;
11197
+ HOP_CHAIN_MAX = 32;
11198
+ }
11199
+ });
11200
+
11201
+ // ../../packages/tacho/src/claude-code/hooks.ts
11202
+ function isRecord5(value) {
11203
+ return value !== null && typeof value === "object" && !Array.isArray(value);
11204
+ }
11129
11205
  function kindOf(value) {
11130
11206
  if (value === null) return "null";
11131
11207
  if (Array.isArray(value)) return "a list";
11132
11208
  return typeof value === "object" ? "an object" : `a ${typeof value}`;
11133
11209
  }
11134
11210
  function payloadRepairs(raw) {
11135
- if (!isRecord4(raw)) return void 0;
11211
+ if (!isRecord5(raw)) return void 0;
11136
11212
  const notes = [];
11137
11213
  const setAside = (key, value) => `${key}: ${kindOf(value)}, left out: ${JSON.stringify(value)}`;
11138
11214
  for (const [key, type] of TYPED_MEMBERS) {
@@ -11146,7 +11222,7 @@ function payloadRepairs(raw) {
11146
11222
  }
11147
11223
  const input = raw["tool_input"];
11148
11224
  if (input === null) notes.push("tool_input: null, read as absent");
11149
- else if (input !== void 0 && !isRecord4(input))
11225
+ else if (input !== void 0 && !isRecord5(input))
11150
11226
  notes.push(`tool_input: ${kindOf(input)}, kept as {"value": ...}`);
11151
11227
  const duration = raw["duration_ms"];
11152
11228
  if (duration !== void 0 && !(typeof duration === "number" && Number.isFinite(duration)))
@@ -11323,11 +11399,11 @@ function normalizeHook(raw, env, options) {
11323
11399
  case "UserPromptExpansion": {
11324
11400
  const prompt = str3(input["prompt"]) ?? str3(input["user_input"]);
11325
11401
  const promptSource = str3(input["prompt_source"]);
11326
- const promptOrigin = input["prompt_origin"];
11402
+ const promptOrigin = promptOriginOf(input["prompt_origin"]);
11327
11403
  const body2 = {
11328
11404
  ...prompt !== void 0 ? { prompt_digest: digestText(prompt), prompt_length: prompt.length } : {},
11329
11405
  ...promptSource !== void 0 && promptSource.length <= 512 ? { prompt_source: promptSource } : {},
11330
- ...isRecord4(promptOrigin) ? { prompt_origin: promptOrigin } : {},
11406
+ ...promptOrigin !== void 0 ? { prompt_origin: promptOrigin } : {},
11331
11407
  ...str3(input["command_name"]) !== void 0 ? { command_name: str3(input["command_name"]) } : {},
11332
11408
  ...str3(input["command_input"]) !== void 0 ? {
11333
11409
  command_input_digest: digestText(
@@ -11463,11 +11539,13 @@ function normalizeHook(raw, env, options) {
11463
11539
  case "Stop":
11464
11540
  case "SubagentStop": {
11465
11541
  const last = str3(input["last_assistant_message"]);
11542
+ const backgroundTasks = backgroundTasksOf(input["background_tasks"]);
11543
+ const sessionCrons = sessionCronsOf(input["session_crons"]);
11466
11544
  const common = {
11467
11545
  ...last !== void 0 ? { last_assistant_message_digest: digestText(last) } : {},
11468
11546
  ...bool2(input["stop_hook_active"]) !== void 0 ? { stop_hook_active: bool2(input["stop_hook_active"]) } : {},
11469
- ...input["background_tasks"] !== void 0 ? { background_tasks: input["background_tasks"] } : {},
11470
- ...input["session_crons"] !== void 0 ? { session_crons: input["session_crons"] } : {}
11547
+ ...backgroundTasks !== void 0 ? { background_tasks: backgroundTasks } : {},
11548
+ ...sessionCrons !== void 0 ? { session_crons: sessionCrons } : {}
11471
11549
  };
11472
11550
  if (input.hook_event_name === "Stop") {
11473
11551
  return [
@@ -11706,6 +11784,7 @@ var init_hooks = __esm({
11706
11784
  init_redaction();
11707
11785
  init_wire();
11708
11786
  init_context2();
11787
+ init_payload_members();
11709
11788
  init_tools();
11710
11789
  textMember = external_exports.preprocess((value) => {
11711
11790
  if (typeof value === "number" || typeof value === "boolean")
@@ -11730,7 +11809,7 @@ var init_hooks = __esm({
11730
11809
  // A string or a list is kept whole under `value`, the way the Cursor and
11731
11810
  // Stella adapters already keep one.
11732
11811
  tool_input: external_exports.preprocess(
11733
- (value) => value === null || value === void 0 ? void 0 : isRecord4(value) ? value : { value },
11812
+ (value) => value === null || value === void 0 ? void 0 : isRecord5(value) ? value : { value },
11734
11813
  external_exports.record(external_exports.unknown()).optional()
11735
11814
  ),
11736
11815
  tool_use_id: textMember,
@@ -15267,7 +15346,7 @@ import { readFileSync as readFileSync10 } from "node:fs";
15267
15346
  import { dirname as dirname7, resolve as resolve2 } from "node:path";
15268
15347
  import { fileURLToPath } from "node:url";
15269
15348
  function readVersion() {
15270
- if (true) return "2.1.4-381";
15349
+ if (true) return "2.1.4-384";
15271
15350
  try {
15272
15351
  const here = dirname7(fileURLToPath(import.meta.url));
15273
15352
  const pkg = JSON.parse(
@@ -15314,14 +15393,14 @@ function configPicker(env, home) {
15314
15393
  return (flag, envKey, configKey) => flag ?? env[envKey] ?? (typeof config[configKey] === "string" ? config[configKey] : void 0);
15315
15394
  }
15316
15395
  function resolveApiUrl(options, env, home) {
15317
- const pick2 = configPicker(env, home);
15318
- return (pick2(options.apiUrl, "OXAGEN_API_URL", "apiUrl") ?? "https://api.oxagen.sh").replace(/\/+$/, "");
15396
+ const pick3 = configPicker(env, home);
15397
+ return (pick3(options.apiUrl, "OXAGEN_API_URL", "apiUrl") ?? "https://api.oxagen.sh").replace(/\/+$/, "");
15319
15398
  }
15320
15399
  function resolveCredentials(options, env, home) {
15321
- const pick2 = configPicker(env, home);
15322
- const token = pick2(options.token, "OXAGEN_API_TOKEN", "token");
15323
- const org = pick2(options.org, "OXAGEN_ORG_ID", "orgSlug");
15324
- const workspace = pick2(
15400
+ const pick3 = configPicker(env, home);
15401
+ const token = pick3(options.token, "OXAGEN_API_TOKEN", "token");
15402
+ const org = pick3(options.org, "OXAGEN_ORG_ID", "orgSlug");
15403
+ const workspace = pick3(
15325
15404
  options.workspace,
15326
15405
  "OXAGEN_WORKSPACE_ID",
15327
15406
  "workspaceSlug"
@@ -23541,12 +23620,13 @@ function normalizeTranscriptLine(line, fallbackTs) {
23541
23620
  const content = message?.["content"];
23542
23621
  const drafts = [];
23543
23622
  if (typeof content === "string") {
23623
+ const origin = promptOriginOf(record["origin"]);
23544
23624
  drafts.push({
23545
23625
  ...draft("oxagen:message", {
23546
23626
  prompt_digest: digestText(content),
23547
23627
  prompt_length: content.length,
23548
23628
  ...s3(record["promptSource"]) !== void 0 ? { prompt_source: s3(record["promptSource"]) } : {},
23549
- ...record["origin"] !== void 0 ? { prompt_origin: record["origin"] } : {},
23629
+ ...origin !== void 0 ? { prompt_origin: origin } : {},
23550
23630
  ...b3(record["isMeta"]) !== void 0 ? { is_meta: b3(record["isMeta"]) } : {},
23551
23631
  ...b3(record["isSidechain"]) !== void 0 ? { is_sidechain: b3(record["isSidechain"]) } : {},
23552
23632
  ...s3(record["interruptedMessageId"]) !== void 0 ? { interrupted_message_id: s3(record["interruptedMessageId"]) } : {},
@@ -23753,6 +23833,7 @@ var init_transcript = __esm({
23753
23833
  init_frame_body();
23754
23834
  init_redaction();
23755
23835
  init_context2();
23836
+ init_payload_members();
23756
23837
  init_tools();
23757
23838
  SESSION_TITLE_MAX = 512;
23758
23839
  INTERRUPT_MARKER = "[Request interrupted by user";
@@ -25428,8 +25509,8 @@ function optionalFacts(facts) {
25428
25509
  ...facts.baselineRoot !== void 0 ? { baselineRoot: facts.baselineRoot } : {},
25429
25510
  ...facts.baselines !== void 0 ? { baselines: { ...facts.baselines } } : {},
25430
25511
  ...typeof facts.gitFirstReadAt === "number" && Number.isFinite(facts.gitFirstReadAt) ? { gitFirstReadAt: facts.gitFirstReadAt } : {},
25431
- ...isRecord5(facts.preexistingPaths) ? { preexistingPaths: { ...facts.preexistingPaths } } : {},
25432
- ...isRecord5(facts.sessionCommits) ? { sessionCommits: { ...facts.sessionCommits } } : {},
25512
+ ...isRecord6(facts.preexistingPaths) ? { preexistingPaths: { ...facts.preexistingPaths } } : {},
25513
+ ...isRecord6(facts.sessionCommits) ? { sessionCommits: { ...facts.sessionCommits } } : {},
25433
25514
  ...facts.workDir !== void 0 ? { workDir: facts.workDir } : {},
25434
25515
  ...facts.closedIdle === true ? { closedIdle: true } : {}
25435
25516
  };
@@ -25468,7 +25549,7 @@ function isTombstone(value) {
25468
25549
  function earlierOf(seenAt, now) {
25469
25550
  return seenAt !== void 0 && Date.parse(seenAt) < Date.parse(now) ? seenAt : now;
25470
25551
  }
25471
- function isRecord5(value) {
25552
+ function isRecord6(value) {
25472
25553
  return typeof value === "object" && value !== null && !Array.isArray(value);
25473
25554
  }
25474
25555
  function rememberForRoot(map, root, value) {
@@ -37559,8 +37640,8 @@ function pickPypiFile(urls) {
37559
37640
  if (file?.yanked === true) return [];
37560
37641
  return [{ name, url, type: file?.packagetype }];
37561
37642
  });
37562
- const pick2 = files2.find((file) => file.type === "bdist_wheel" && UNIVERSAL_WHEEL.test(file.name)) ?? files2.find((file) => file.type === "sdist");
37563
- return pick2 === void 0 ? void 0 : { name: pick2.name, url: pick2.url };
37643
+ const pick3 = files2.find((file) => file.type === "bdist_wheel" && UNIVERSAL_WHEEL.test(file.name)) ?? files2.find((file) => file.type === "sdist");
37644
+ return pick3 === void 0 ? void 0 : { name: pick3.name, url: pick3.url };
37564
37645
  }
37565
37646
  function pypiFromUrl(args) {
37566
37647
  const at = args.indexOf("--from");
@@ -40347,12 +40428,75 @@ function createModelProxy(deps) {
40347
40428
  [TACHO_ENFORCEMENT_TIER_ATTR]: TACHO_GATEWAY_TIER,
40348
40429
  "oxagen.model_api": route.api,
40349
40430
  "oxagen.correlation": how,
40350
- [TACHO_CREDENTIAL_BASIS_ATTR]: credential.basis,
40431
+ ...credential !== void 0 ? { [TACHO_CREDENTIAL_BASIS_ATTR]: credential.basis } : {},
40351
40432
  // The id names the token on the record; the token itself is never
40352
40433
  // written anywhere, and a refused token's id is read off it unverified.
40353
- ...credential.claims !== void 0 ? { [TACHO_RUN_TOKEN_ATTR]: credential.claims.tid } : {}
40434
+ ...credential?.claims !== void 0 ? { [TACHO_RUN_TOKEN_ATTR]: credential.claims.tid } : {}
40354
40435
  };
40355
40436
  }
40437
+ function attributeByHeaders(req, route) {
40438
+ let found;
40439
+ try {
40440
+ found = correlate(req, route, () => void 0);
40441
+ } catch {
40442
+ found = { how: "unattributed" };
40443
+ }
40444
+ return {
40445
+ recorder: found.record?.recorder ?? deps.hostRecorder(),
40446
+ how: found.how,
40447
+ attrs: attrsFor(route, found.how)
40448
+ };
40449
+ }
40450
+ function sealNotForwarded(req, route, attempt, reason3, status2) {
40451
+ if (attempt.done) return;
40452
+ attempt.done = true;
40453
+ if (route.api === "other") return;
40454
+ let recorder;
40455
+ let mark;
40456
+ try {
40457
+ const attribution2 = attempt.attribution ?? attributeByHeaders(req, route);
40458
+ const chain = attribution2.recorder;
40459
+ recorder = chain;
40460
+ mark = chain.markChain();
40461
+ const at = deps.now();
40462
+ deps.record([
40463
+ chain.sealCollectorEvent(
40464
+ "error",
40465
+ {
40466
+ provider: route.provider,
40467
+ ...attempt.model !== void 0 ? { model: attempt.model.slice(0, 512) } : {},
40468
+ ...status2 !== void 0 ? { api_status_code: status2 } : {},
40469
+ api_error_class: reason3,
40470
+ api_duration_ms: Math.max(0, at - attempt.startedAt)
40471
+ },
40472
+ {
40473
+ ts: toProtocolTimestamp(at),
40474
+ fidelity: "proxy",
40475
+ attrs: {
40476
+ ...attribution2.attrs,
40477
+ [NOT_FORWARDED_ATTR]: reason3,
40478
+ "oxagen.provider": route.provider,
40479
+ "oxagen.request_bytes_read": String(attempt.bytesRead),
40480
+ ...attempt.request !== void 0 ? { "oxagen.request_digest": digestBytes(attempt.request) } : {}
40481
+ }
40482
+ }
40483
+ )
40484
+ ]);
40485
+ } catch (error) {
40486
+ if (recorder !== void 0 && mark !== void 0) {
40487
+ try {
40488
+ recorder.rollbackChain(mark);
40489
+ } catch (rollbackError) {
40490
+ deps.log(
40491
+ `model proxy: rolling the chain back after a failed frame failed too: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`
40492
+ );
40493
+ }
40494
+ }
40495
+ deps.log(
40496
+ `model proxy: sealing the frame of a call it did not forward (${reason3}) failed: ${error instanceof Error ? error.message : String(error)}`
40497
+ );
40498
+ }
40499
+ }
40356
40500
  function sendProviderError(res, route, status2, code, message, retryable = false) {
40357
40501
  if (res.headersSent) {
40358
40502
  res.destroy();
@@ -40372,7 +40516,7 @@ function createModelProxy(deps) {
40372
40516
  });
40373
40517
  res.end(error.body);
40374
40518
  }
40375
- function readBody3(req) {
40519
+ function readBody3(req, attempt) {
40376
40520
  return new Promise((resolve19, reject) => {
40377
40521
  const chunks = [];
40378
40522
  let size = 0;
@@ -40380,6 +40524,7 @@ function createModelProxy(deps) {
40380
40524
  req.on("data", (chunk2) => {
40381
40525
  if (over) return;
40382
40526
  size += chunk2.length;
40527
+ attempt.bytesRead = size;
40383
40528
  if (size > maxRequestBytes) {
40384
40529
  over = true;
40385
40530
  chunks.length = 0;
@@ -40674,10 +40819,17 @@ function createModelProxy(deps) {
40674
40819
  }
40675
40820
  return usage3.cacheReadTokens ?? 0;
40676
40821
  }
40677
- async function forward(req, res, route, admitted) {
40822
+ async function forward(req, res, route, admitted, attempt) {
40678
40823
  const startedAt = deps.now();
40679
- const received = await readBody3(req);
40824
+ let received;
40825
+ try {
40826
+ received = await readBody3(req, attempt);
40827
+ } catch (error) {
40828
+ sealNotForwarded(req, route, attempt, "client_aborted");
40829
+ throw error;
40830
+ }
40680
40831
  if (received === "too_large") {
40832
+ sealNotForwarded(req, route, attempt, "request_too_large", 413);
40681
40833
  sendProviderError(
40682
40834
  res,
40683
40835
  route,
@@ -40688,6 +40840,7 @@ function createModelProxy(deps) {
40688
40840
  return;
40689
40841
  }
40690
40842
  let body2 = received;
40843
+ attempt.request = received;
40691
40844
  const encoding = header(req, "content-encoding");
40692
40845
  let decoded = null;
40693
40846
  const readable = () => {
@@ -40705,11 +40858,13 @@ function createModelProxy(deps) {
40705
40858
  const sessionKey = record?.recorder.sessionUuid ?? HOST_KEY;
40706
40859
  const credential = resolveCredential(req, route);
40707
40860
  const attrs2 = attrsFor(route, how, credential);
40861
+ attempt.attribution = { recorder, how, attrs: attrs2 };
40708
40862
  const metered = route.api !== "other";
40709
40863
  const { model: askedModel, ambiguous: modelAmbiguous } = modelOf(
40710
40864
  readable,
40711
40865
  json2
40712
40866
  );
40867
+ if (askedModel !== void 0) attempt.model = askedModel;
40713
40868
  const refusal = refusalFor(record, askedModel, modelAmbiguous, metered) ?? (credential.refusal !== void 0 ? {
40714
40869
  ...credential.refusal,
40715
40870
  source: "bundle",
@@ -40757,6 +40912,7 @@ function createModelProxy(deps) {
40757
40912
  recorder.rollbackChain(mark);
40758
40913
  throw error;
40759
40914
  }
40915
+ attempt.done = true;
40760
40916
  deps.log(
40761
40917
  `model proxy: refused ${route.provider} ${route.api} (${refusal.code})`
40762
40918
  );
@@ -40902,6 +41058,7 @@ function createModelProxy(deps) {
40902
41058
  const settle3 = (errorClass) => {
40903
41059
  if (settled2) return;
40904
41060
  settled2 = true;
41061
+ attempt.done = true;
40905
41062
  set.delete(entry2);
40906
41063
  if (set.size === 0) inFlight.delete(sessionKey);
40907
41064
  const mark = recorder.markChain();
@@ -41246,6 +41403,7 @@ function createModelProxy(deps) {
41246
41403
  return;
41247
41404
  }
41248
41405
  upstreamReq = openUpstream(false);
41406
+ attempt.done = true;
41249
41407
  }
41250
41408
  return {
41251
41409
  handle: (req, res) => {
@@ -41309,13 +41467,19 @@ function createModelProxy(deps) {
41309
41467
  return;
41310
41468
  }
41311
41469
  const admitted = {};
41470
+ const attempt = {
41471
+ startedAt: deps.now(),
41472
+ bytesRead: 0,
41473
+ done: false
41474
+ };
41312
41475
  try {
41313
- await forward(req, res, route, admitted);
41476
+ await forward(req, res, route, admitted, attempt);
41314
41477
  } catch (error) {
41315
41478
  admitted.release?.();
41316
41479
  deps.log(
41317
41480
  `model proxy: ${req.method ?? "?"} ${route.provider} ${route.api} failed: ${error instanceof Error ? error.message : String(error)}`
41318
41481
  );
41482
+ sealNotForwarded(req, route, attempt, "gateway_error", 502);
41319
41483
  sendProviderError(
41320
41484
  res,
41321
41485
  route,
@@ -41355,7 +41519,7 @@ function createModelProxy(deps) {
41355
41519
  }
41356
41520
  };
41357
41521
  }
41358
- var DEFAULT_MAX_REQUEST_BYTES, DEFAULT_UPSTREAM_IDLE_MS, DEFAULT_BEFORE_FORWARD_TIMEOUT_MS, DEFAULT_UPSTREAM_CONNECT_MS, FREE_SOCKET_TIMEOUT_MS, KEEP_ALIVE_TIMEOUT_MS, KEEP_ALIVE_MAX_RESPONSE_BYTES, BodyCapture, REQUEST_EFFORT_MAX, CREDENTIAL_MESSAGES;
41522
+ var DEFAULT_MAX_REQUEST_BYTES, NOT_FORWARDED_ATTR, DEFAULT_UPSTREAM_IDLE_MS, DEFAULT_BEFORE_FORWARD_TIMEOUT_MS, DEFAULT_UPSTREAM_CONNECT_MS, FREE_SOCKET_TIMEOUT_MS, KEEP_ALIVE_TIMEOUT_MS, KEEP_ALIVE_MAX_RESPONSE_BYTES, BodyCapture, REQUEST_EFFORT_MAX, CREDENTIAL_MESSAGES;
41359
41523
  var init_model_proxy = __esm({
41360
41524
  "../../packages/tacho/src/collector/model-proxy.ts"() {
41361
41525
  "use strict";
@@ -41379,6 +41543,7 @@ var init_model_proxy = __esm({
41379
41543
  init_model_usage();
41380
41544
  init_registry();
41381
41545
  DEFAULT_MAX_REQUEST_BYTES = 64 * 1024 * 1024;
41546
+ NOT_FORWARDED_ATTR = "oxagen.not_forwarded";
41382
41547
  DEFAULT_UPSTREAM_IDLE_MS = 10 * 6e4;
41383
41548
  DEFAULT_BEFORE_FORWARD_TIMEOUT_MS = 250;
41384
41549
  DEFAULT_UPSTREAM_CONNECT_MS = 3e4;
@@ -48070,7 +48235,7 @@ var init_package = __esm({
48070
48235
  "package.json"() {
48071
48236
  package_default = {
48072
48237
  name: "@oxagen/cli",
48073
- version: "2.1.4-381",
48238
+ version: "2.1.4-384",
48074
48239
  description: "Oxagen governance CLI \u2014 spend, lineage, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
48075
48240
  type: "module",
48076
48241
  main: "./dist/index.js",
@@ -51369,23 +51534,23 @@ function hookConfigPath(projectRoot, harness, env = process.env, home = homedir1
51369
51534
  function stellaJsonPath(env, home) {
51370
51535
  return join38(env["STELLA_HOME"] ?? join38(home, ".stella"), "settings.json");
51371
51536
  }
51372
- function isRecord6(v) {
51537
+ function isRecord7(v) {
51373
51538
  return v !== null && typeof v === "object" && !Array.isArray(v);
51374
51539
  }
51375
51540
  function readConfig2(text4) {
51376
51541
  try {
51377
51542
  const parsed = JSON.parse(text4);
51378
- if (!isRecord6(parsed)) return null;
51543
+ if (!isRecord7(parsed)) return null;
51379
51544
  if (parsed["hooks"] === void 0) return parsed;
51380
51545
  const hooks = parsed["hooks"];
51381
- if (!isRecord6(hooks)) return null;
51546
+ if (!isRecord7(hooks)) return null;
51382
51547
  for (const groups of Object.values(hooks)) {
51383
51548
  if (!Array.isArray(groups)) return null;
51384
51549
  for (const group of groups) {
51385
- if (!isRecord6(group)) return null;
51550
+ if (!isRecord7(group)) return null;
51386
51551
  if (group["hooks"] === void 0) continue;
51387
51552
  if (!Array.isArray(group["hooks"])) return null;
51388
- if (!group["hooks"].every(isRecord6)) return null;
51553
+ if (!group["hooks"].every(isRecord7)) return null;
51389
51554
  }
51390
51555
  }
51391
51556
  return parsed;
@@ -51517,12 +51682,12 @@ async function groupHookInstalled(path2, io) {
51517
51682
  function readCursorConfig(text4) {
51518
51683
  try {
51519
51684
  const parsed = JSON.parse(text4);
51520
- if (!isRecord6(parsed)) return null;
51685
+ if (!isRecord7(parsed)) return null;
51521
51686
  if (parsed["hooks"] === void 0) return parsed;
51522
51687
  const hooks = parsed["hooks"];
51523
- if (!isRecord6(hooks)) return null;
51688
+ if (!isRecord7(hooks)) return null;
51524
51689
  for (const entries2 of Object.values(hooks)) {
51525
- if (!Array.isArray(entries2) || !entries2.every(isRecord6)) return null;
51690
+ if (!Array.isArray(entries2) || !entries2.every(isRecord7)) return null;
51526
51691
  }
51527
51692
  return parsed;
51528
51693
  } catch {
@@ -59387,13 +59552,13 @@ var require_resolve_block_scalar = __commonJS({
59387
59552
  "../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-block-scalar.js"(exports) {
59388
59553
  "use strict";
59389
59554
  var Scalar = require_Scalar();
59390
- function resolveBlockScalar(ctx, scalar, onError) {
59391
- const start = scalar.offset;
59392
- const header2 = parseBlockScalarHeader(scalar, ctx.options.strict, onError);
59555
+ function resolveBlockScalar(ctx, scalar2, onError) {
59556
+ const start = scalar2.offset;
59557
+ const header2 = parseBlockScalarHeader(scalar2, ctx.options.strict, onError);
59393
59558
  if (!header2)
59394
59559
  return { value: "", type: null, comment: "", range: [start, start, start] };
59395
59560
  const type = header2.mode === ">" ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL;
59396
- const lines = scalar.source ? splitLines2(scalar.source) : [];
59561
+ const lines = scalar2.source ? splitLines2(scalar2.source) : [];
59397
59562
  let chompStart = lines.length;
59398
59563
  for (let i2 = lines.length - 1; i2 >= 0; --i2) {
59399
59564
  const content = lines[i2][1];
@@ -59405,12 +59570,12 @@ var require_resolve_block_scalar = __commonJS({
59405
59570
  if (chompStart === 0) {
59406
59571
  const value2 = header2.chomp === "+" && lines.length > 0 ? "\n".repeat(Math.max(1, lines.length - 1)) : "";
59407
59572
  let end2 = start + header2.length;
59408
- if (scalar.source)
59409
- end2 += scalar.source.length;
59573
+ if (scalar2.source)
59574
+ end2 += scalar2.source.length;
59410
59575
  return { value: value2, type, comment: header2.comment, range: [start, end2, end2] };
59411
59576
  }
59412
- let trimIndent = scalar.indent + header2.indent;
59413
- let offset = scalar.offset + header2.length;
59577
+ let trimIndent = scalar2.indent + header2.indent;
59578
+ let offset = scalar2.offset + header2.length;
59414
59579
  let contentStart = 0;
59415
59580
  for (let i2 = 0; i2 < chompStart; ++i2) {
59416
59581
  const [indent, content] = lines[i2];
@@ -59488,7 +59653,7 @@ var require_resolve_block_scalar = __commonJS({
59488
59653
  default:
59489
59654
  value += "\n";
59490
59655
  }
59491
- const end = start + header2.length + scalar.source.length;
59656
+ const end = start + header2.length + scalar2.source.length;
59492
59657
  return { value, type, comment: header2.comment, range: [start, end, end] };
59493
59658
  }
59494
59659
  function parseBlockScalarHeader({ offset, props }, strict, onError) {
@@ -59571,8 +59736,8 @@ var require_resolve_flow_scalar = __commonJS({
59571
59736
  "use strict";
59572
59737
  var Scalar = require_Scalar();
59573
59738
  var resolveEnd = require_resolve_end();
59574
- function resolveFlowScalar(scalar, strict, onError) {
59575
- const { offset, type, source, end } = scalar;
59739
+ function resolveFlowScalar(scalar2, strict, onError) {
59740
+ const { offset, type, source, end } = scalar2;
59576
59741
  let _type;
59577
59742
  let value;
59578
59743
  const _onError = (rel, code, msg) => onError(offset + rel, code, msg);
@@ -59591,7 +59756,7 @@ var require_resolve_flow_scalar = __commonJS({
59591
59756
  break;
59592
59757
  /* istanbul ignore next should not happen */
59593
59758
  default:
59594
- onError(scalar, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${type}`);
59759
+ onError(scalar2, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${type}`);
59595
59760
  return {
59596
59761
  value: "",
59597
59762
  type: null,
@@ -59806,26 +59971,26 @@ var require_compose_scalar = __commonJS({
59806
59971
  tag = findScalarTagByTest(ctx, value, token, onError);
59807
59972
  else
59808
59973
  tag = ctx.schema[identity.SCALAR];
59809
- let scalar;
59974
+ let scalar2;
59810
59975
  try {
59811
59976
  const res = tag.resolve(value, (msg) => onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg), ctx.options);
59812
- scalar = identity.isScalar(res) ? res : new Scalar.Scalar(res);
59977
+ scalar2 = identity.isScalar(res) ? res : new Scalar.Scalar(res);
59813
59978
  } catch (error) {
59814
59979
  const msg = error instanceof Error ? error.message : String(error);
59815
59980
  onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg);
59816
- scalar = new Scalar.Scalar(value);
59981
+ scalar2 = new Scalar.Scalar(value);
59817
59982
  }
59818
- scalar.range = range;
59819
- scalar.source = value;
59983
+ scalar2.range = range;
59984
+ scalar2.source = value;
59820
59985
  if (type)
59821
- scalar.type = type;
59986
+ scalar2.type = type;
59822
59987
  if (tagName)
59823
- scalar.tag = tagName;
59988
+ scalar2.tag = tagName;
59824
59989
  if (tag.format)
59825
- scalar.format = tag.format;
59990
+ scalar2.format = tag.format;
59826
59991
  if (comment)
59827
- scalar.comment = comment;
59828
- return scalar;
59992
+ scalar2.comment = comment;
59993
+ return scalar2;
59829
59994
  }
59830
59995
  function findScalarTagByName(schema, value, tagName, tagToken, onError) {
59831
59996
  if (tagName === "!")
@@ -61653,37 +61818,37 @@ var require_parser = __commonJS({
61653
61818
  };
61654
61819
  }
61655
61820
  }
61656
- *scalar(scalar) {
61821
+ *scalar(scalar2) {
61657
61822
  if (this.type === "map-value-ind") {
61658
61823
  const prev = getPrevProps(this.peek(2));
61659
61824
  const start = getFirstKeyStartProps(prev);
61660
61825
  let sep8;
61661
- if (scalar.end) {
61662
- sep8 = scalar.end;
61826
+ if (scalar2.end) {
61827
+ sep8 = scalar2.end;
61663
61828
  sep8.push(this.sourceToken);
61664
- delete scalar.end;
61829
+ delete scalar2.end;
61665
61830
  } else
61666
61831
  sep8 = [this.sourceToken];
61667
61832
  const map = {
61668
61833
  type: "block-map",
61669
- offset: scalar.offset,
61670
- indent: scalar.indent,
61671
- items: [{ start, key: scalar, sep: sep8 }]
61834
+ offset: scalar2.offset,
61835
+ indent: scalar2.indent,
61836
+ items: [{ start, key: scalar2, sep: sep8 }]
61672
61837
  };
61673
61838
  this.onKeyLine = true;
61674
61839
  this.stack[this.stack.length - 1] = map;
61675
61840
  } else
61676
- yield* this.lineEnd(scalar);
61841
+ yield* this.lineEnd(scalar2);
61677
61842
  }
61678
- *blockScalar(scalar) {
61843
+ *blockScalar(scalar2) {
61679
61844
  switch (this.type) {
61680
61845
  case "space":
61681
61846
  case "comment":
61682
61847
  case "newline":
61683
- scalar.props.push(this.sourceToken);
61848
+ scalar2.props.push(this.sourceToken);
61684
61849
  return;
61685
61850
  case "scalar":
61686
- scalar.source = this.source;
61851
+ scalar2.source = this.source;
61687
61852
  this.atNewLine = true;
61688
61853
  this.indent = 0;
61689
61854
  if (this.onNewLine) {
@@ -66334,7 +66499,7 @@ var init_steering_repo = __esm({
66334
66499
  });
66335
66500
 
66336
66501
  // ../../packages/steering-check/src/repo.ts
66337
- function isRecord7(value) {
66502
+ function isRecord8(value) {
66338
66503
  return typeof value === "object" && value !== null && !Array.isArray(value);
66339
66504
  }
66340
66505
  function isString(value) {
@@ -66459,14 +66624,14 @@ function parseTomlLoose(text4) {
66459
66624
  if (text4 === void 0) return null;
66460
66625
  try {
66461
66626
  const value = parse(text4);
66462
- return isRecord7(value) ? value : null;
66627
+ return isRecord8(value) ? value : null;
66463
66628
  } catch {
66464
66629
  return null;
66465
66630
  }
66466
66631
  }
66467
66632
  function canonicalJson(value) {
66468
66633
  if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
66469
- if (isRecord7(value)) {
66634
+ if (isRecord8(value)) {
66470
66635
  const keys = Object.keys(value).sort();
66471
66636
  return `{${keys.map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key])}`).join(",")}}`;
66472
66637
  }
@@ -66476,7 +66641,7 @@ function parseJsonLoose(text4) {
66476
66641
  if (text4 === void 0) return null;
66477
66642
  try {
66478
66643
  const value = JSON.parse(text4);
66479
- return isRecord7(value) ? value : null;
66644
+ return isRecord8(value) ? value : null;
66480
66645
  } catch {
66481
66646
  return null;
66482
66647
  }
@@ -66490,9 +66655,9 @@ function workspaceRepositories(tree) {
66490
66655
  }
66491
66656
  function entries(value) {
66492
66657
  const found = /* @__PURE__ */ new Map();
66493
- if (!isRecord7(value)) return found;
66658
+ if (!isRecord8(value)) return found;
66494
66659
  for (const [key, entry2] of Object.entries(value)) {
66495
- if (isRecord7(entry2)) found.set(key, entry2);
66660
+ if (isRecord8(entry2)) found.set(key, entry2);
66496
66661
  }
66497
66662
  return found;
66498
66663
  }
@@ -66656,14 +66821,14 @@ function isPositiveInteger(value) {
66656
66821
  }
66657
66822
  function alwaysOnBudget(tree) {
66658
66823
  const steering = parseTomlLoose(tree?.get(GOVERNANCE_TOML_PATH))?.steering;
66659
- const value = isRecord7(steering) ? steering.always_on_tokens : void 0;
66824
+ const value = isRecord8(steering) ? steering.always_on_tokens : void 0;
66660
66825
  if (value === "off") return "off";
66661
66826
  if (isPositiveInteger(value)) return { tokens: value, source: "governance.toml" };
66662
66827
  return { tokens: DEFAULT_ALWAYS_ON_TOKENS, source: "Oxagen's default" };
66663
66828
  }
66664
66829
  function definitionBudget(tree) {
66665
66830
  const tools = parseTomlLoose(tree?.get(WORKSPACE_TOML_PATH))?.tools;
66666
- const value = isRecord7(tools) ? tools.definition_budget : void 0;
66831
+ const value = isRecord8(tools) ? tools.definition_budget : void 0;
66667
66832
  return isPositiveInteger(value) ? { tokens: value, source: "workspace.toml" } : { tokens: DEFAULT_WORKSPACE_DEFINITION_BUDGET, source: "Oxagen's default" };
66668
66833
  }
66669
66834
  function repositoryName(repository) {
@@ -66753,12 +66918,12 @@ function directDefinitions(tree) {
66753
66918
  const servers = [];
66754
66919
  for (const [name, folder] of serverFolders(tree)) {
66755
66920
  const exposure = folder.server?.exposure;
66756
- if (!isRecord7(exposure) || exposure.mode !== "direct") continue;
66921
+ if (!isRecord8(exposure) || exposure.mode !== "direct") continue;
66757
66922
  let tokens = 0;
66758
66923
  let tools = 0;
66759
66924
  for (const [key, entry2] of folder.tools) {
66760
66925
  const upstream = folder.locked.get(key)?.upstream;
66761
- if (!isRecord7(upstream)) continue;
66926
+ if (!isRecord8(upstream)) continue;
66762
66927
  const description = isString(entry2.description) ? entry2.description : upstream.description;
66763
66928
  const definition = {
66764
66929
  name: `${name}__${key}`,
@@ -67408,7 +67573,7 @@ function credentialFields(value, prefix = "") {
67408
67573
  (item, n4) => credentialFields(item, prefix === "" ? String(n4) : `${prefix}.${n4}`)
67409
67574
  );
67410
67575
  }
67411
- if (!isRecord7(value)) return [];
67576
+ if (!isRecord8(value)) return [];
67412
67577
  return Object.entries(value).flatMap(
67413
67578
  ([key, item]) => credentialFields(item, prefix === "" ? key : `${prefix}.${key}`)
67414
67579
  );
@@ -67443,7 +67608,7 @@ function groupFindings(tree, context) {
67443
67608
  const reviewers = parsed.reviewers;
67444
67609
  const findings = [];
67445
67610
  reviewers.forEach((entry2, n4) => {
67446
- if (!isRecord7(entry2) || !isString(entry2.group) || context.groups.includes(entry2.group)) return;
67611
+ if (!isRecord8(entry2) || !isString(entry2.group) || context.groups.includes(entry2.group)) return;
67447
67612
  const field = `reviewers.${n4}.group`;
67448
67613
  findings.push(
67449
67614
  find8({
@@ -74127,7 +74292,7 @@ var init_registry_launch = __esm({
74127
74292
  function messageOf2(error) {
74128
74293
  return error instanceof Error ? error.message : String(error);
74129
74294
  }
74130
- function isRecord8(value) {
74295
+ function isRecord9(value) {
74131
74296
  return typeof value === "object" && value !== null && !Array.isArray(value);
74132
74297
  }
74133
74298
  function isList(value) {
@@ -74138,7 +74303,7 @@ function jsonEqual(a, b5) {
74138
74303
  if (Array.isArray(a)) {
74139
74304
  return Array.isArray(b5) && a.length === b5.length && a.every((item, index) => jsonEqual(item, b5[index]));
74140
74305
  }
74141
- if (isRecord8(a) && isRecord8(b5)) {
74306
+ if (isRecord9(a) && isRecord9(b5)) {
74142
74307
  const keys = Object.keys(a);
74143
74308
  return keys.length === Object.keys(b5).length && keys.every((key) => Object.hasOwn(b5, key) && jsonEqual(a[key], b5[key]));
74144
74309
  }
@@ -74147,16 +74312,16 @@ function jsonEqual(a, b5) {
74147
74312
  function valueAt2(value, path2) {
74148
74313
  let current = value;
74149
74314
  for (const step of path2.split(".")) {
74150
- if (step.endsWith("[]") || !isRecord8(current) || !Object.hasOwn(current, step)) return void 0;
74315
+ if (step.endsWith("[]") || !isRecord9(current) || !Object.hasOwn(current, step)) return void 0;
74151
74316
  current = current[step];
74152
74317
  }
74153
74318
  return current;
74154
74319
  }
74155
74320
  function withValueAt(value, path2, replacement) {
74156
74321
  const [step, ...rest] = path2.split(".");
74157
- if (step === void 0 || !isRecord8(value)) return value;
74322
+ if (step === void 0 || !isRecord9(value)) return value;
74158
74323
  const inner = Object.hasOwn(value, step) ? value[step] : void 0;
74159
- if (rest.length > 0 && !isRecord8(inner)) return value;
74324
+ if (rest.length > 0 && !isRecord9(inner)) return value;
74160
74325
  const next = rest.length === 0 ? replacement : withValueAt(inner, rest.join("."), replacement);
74161
74326
  return { ...value, [step]: next };
74162
74327
  }
@@ -74831,11 +74996,11 @@ var init_openapi = __esm({
74831
74996
  });
74832
74997
 
74833
74998
  // ../../packages/mcp-studio/src/compile/json-schema.ts
74834
- function isRecord10(value) {
74999
+ function isRecord11(value) {
74835
75000
  return typeof value === "object" && value !== null && !Array.isArray(value);
74836
75001
  }
74837
75002
  function propertiesOf(schema) {
74838
- return isRecord10(schema.properties) ? schema.properties : {};
75003
+ return isRecord11(schema.properties) ? schema.properties : {};
74839
75004
  }
74840
75005
  function requiredOf(schema) {
74841
75006
  if (!Array.isArray(schema.required)) return [];
@@ -76201,8 +76366,8 @@ function checkSingular(field, value) {
76201
76366
  }
76202
76367
  return isReflectMessage(value, field.message);
76203
76368
  }
76204
- function checkScalarValue(value, scalar) {
76205
- switch (scalar) {
76369
+ function checkScalarValue(value, scalar2) {
76370
+ switch (scalar2) {
76206
76371
  case ScalarType.DOUBLE:
76207
76372
  return typeof value == "number";
76208
76373
  case ScalarType.FLOAT:
@@ -76339,8 +76504,8 @@ function formatReflectMap(field) {
76339
76504
  return `ReflectMap (${ScalarType[field.mapKey]}, ${ScalarType[field.scalar]})`;
76340
76505
  }
76341
76506
  }
76342
- function scalarTypeDescription(scalar) {
76343
- switch (scalar) {
76507
+ function scalarTypeDescription(scalar2) {
76508
+ switch (scalar2) {
76344
76509
  case ScalarType.STRING:
76345
76510
  return "string";
76346
76511
  case ScalarType.BOOL:
@@ -86761,7 +86926,7 @@ function shapeInput(key, entry2, upstream, supplied, issues) {
86761
86926
  for (const [name, value] of defaults) {
86762
86927
  if (!usable("defaults", name)) continue;
86763
86928
  const property = shaped[name];
86764
- shaped[name] = { ...isRecord10(property) ? property : {}, default: value };
86929
+ shaped[name] = { ...isRecord11(property) ? property : {}, default: value };
86765
86930
  required = required.filter((other) => other !== name);
86766
86931
  }
86767
86932
  const renamed = /* @__PURE__ */ new Map();
@@ -86807,7 +86972,7 @@ function selectTree(paths) {
86807
86972
  return root;
86808
86973
  }
86809
86974
  function trimObject(schema, children) {
86810
- if (!isRecord10(schema.properties)) return schema;
86975
+ if (!isRecord11(schema.properties)) return schema;
86811
86976
  const properties = schema.properties;
86812
86977
  const kept = {};
86813
86978
  for (const [name, node2] of children) {
@@ -86821,9 +86986,9 @@ function trimObject(schema, children) {
86821
86986
  return out;
86822
86987
  }
86823
86988
  function trimNode(schema, node2) {
86824
- if (node2.whole || !isRecord10(schema)) return schema;
86989
+ if (node2.whole || !isRecord11(schema)) return schema;
86825
86990
  if (!node2.array) return trimObject(schema, node2.children);
86826
- return isRecord10(schema.items) ? { ...schema, items: trimObject(schema.items, node2.children) } : schema;
86991
+ return isRecord11(schema.items) ? { ...schema, items: trimObject(schema.items, node2.children) } : schema;
86827
86992
  }
86828
86993
  function selectOutput(outputSchema, select) {
86829
86994
  if (select.length === 0) return outputSchema;
@@ -87495,12 +87660,12 @@ function walkSchemas(root, at, visit2) {
87495
87660
  node2.forEach((item, index) => walk(item, `${path2}[${index}]`, depth + 1));
87496
87661
  return;
87497
87662
  }
87498
- if (!isRecord10(node2) || above.has(node2)) return;
87663
+ if (!isRecord11(node2) || above.has(node2)) return;
87499
87664
  visit2(node2, path2);
87500
87665
  above.add(node2);
87501
87666
  for (const [key, value] of Object.entries(node2)) {
87502
87667
  if (DATA.has(key)) continue;
87503
- if (SCHEMA_MAPS.has(key) && isRecord10(value)) {
87668
+ if (SCHEMA_MAPS.has(key) && isRecord11(value)) {
87504
87669
  for (const [name, child] of Object.entries(value)) walk(child, `${path2}.${key}.${name}`, depth + 1);
87505
87670
  } else {
87506
87671
  walk(value, `${path2}.${key}`, depth + 1);
@@ -87511,14 +87676,14 @@ function walkSchemas(root, at, visit2) {
87511
87676
  walk(root, at, 0);
87512
87677
  }
87513
87678
  function tagOf(schema) {
87514
- if (!isRecord10(schema)) return void 0;
87679
+ if (!isRecord11(schema)) return void 0;
87515
87680
  if (Object.hasOwn(schema, "const")) return JSON.stringify(schema.const);
87516
87681
  if (Array.isArray(schema.enum) && schema.enum.length === 1) return JSON.stringify(schema.enum[0]);
87517
87682
  return void 0;
87518
87683
  }
87519
87684
  function distinguishable(branches) {
87520
87685
  if (branches.length < 2) return true;
87521
- const records = branches.filter(isRecord10);
87686
+ const records = branches.filter(isRecord11);
87522
87687
  const [first] = records;
87523
87688
  if (first === void 0 || records.length < branches.length) return false;
87524
87689
  const types = records.map((branch) => branch.type);
@@ -87609,7 +87774,7 @@ function shapedInput(entry2, upstream) {
87609
87774
  for (const [name, value] of defaults) {
87610
87775
  if (!Object.hasOwn(shaped, name)) continue;
87611
87776
  const property = shaped[name];
87612
- shaped[name] = { ...isRecord10(property) ? property : {}, default: value };
87777
+ shaped[name] = { ...isRecord11(property) ? property : {}, default: value };
87613
87778
  required = required.filter((other) => other !== name);
87614
87779
  }
87615
87780
  const renamed = new Map(rename3.filter(([from]) => Object.hasOwn(shaped, from)));
@@ -87639,7 +87804,7 @@ function selectTree2(paths) {
87639
87804
  return root;
87640
87805
  }
87641
87806
  function trimObject2(schema, children) {
87642
- if (!isRecord10(schema.properties)) return schema;
87807
+ if (!isRecord11(schema.properties)) return schema;
87643
87808
  const properties = schema.properties;
87644
87809
  const kept = {};
87645
87810
  for (const [name, node2] of children) {
@@ -87653,9 +87818,9 @@ function trimObject2(schema, children) {
87653
87818
  return out;
87654
87819
  }
87655
87820
  function trimNode2(schema, node2) {
87656
- if (node2.whole || !isRecord10(schema)) return schema;
87821
+ if (node2.whole || !isRecord11(schema)) return schema;
87657
87822
  if (!node2.array) return trimObject2(schema, node2.children);
87658
- return isRecord10(schema.items) ? { ...schema, items: trimObject2(schema.items, node2.children) } : schema;
87823
+ return isRecord11(schema.items) ? { ...schema, items: trimObject2(schema.items, node2.children) } : schema;
87659
87824
  }
87660
87825
  function servedOutput(outputSchema, select) {
87661
87826
  if (select.length === 0) return outputSchema;
@@ -87705,7 +87870,7 @@ function quoted(values) {
87705
87870
  return orList2(values.map((value) => JSON.stringify(value)));
87706
87871
  }
87707
87872
  function isArraySchema(schema) {
87708
- if (!isRecord10(schema)) return false;
87873
+ if (!isRecord11(schema)) return false;
87709
87874
  return schema.type === "array" || Array.isArray(schema.type) && schema.type.includes("array");
87710
87875
  }
87711
87876
  function lintTools(folder, context, report) {
@@ -87882,7 +88047,7 @@ function lintUpstream(folder, context, key, entry2, upstream, report) {
87882
88047
  });
87883
88048
  }
87884
88049
  const oneOf2 = (node2, at) => {
87885
- if (!Array.isArray(node2.oneOf) || isRecord10(node2.discriminator) || distinguishable(node2.oneOf)) return;
88050
+ if (!Array.isArray(node2.oneOf) || isRecord11(node2.discriminator) || distinguishable(node2.oneOf)) return;
87886
88051
  report("undiscriminated_one_of", {
87887
88052
  tool: key,
87888
88053
  field: `${at}.oneOf`,
@@ -88492,7 +88657,7 @@ function upstreamError(response, bytes) {
88492
88657
  let problem;
88493
88658
  if (text4 !== "" && isJsonMediaType(headerValue(response.headers, "content-type"))) {
88494
88659
  const parsed = parseJson3(text4);
88495
- if (parsed.ok && isRecord8(parsed.value)) problem = parsed.value;
88660
+ if (parsed.ok && isRecord9(parsed.value)) problem = parsed.value;
88496
88661
  }
88497
88662
  const title = problem === void 0 ? void 0 : firstText(problem, ["title"]);
88498
88663
  const detail = problem === void 0 ? text4.trim() === "" ? void 0 : text4 : firstText(problem, ["detail", "message", "error_description", "error"]);
@@ -88676,11 +88841,11 @@ var init_apply_credential = __esm({
88676
88841
 
88677
88842
  // ../../packages/mcp-studio/src/execute/mcp.ts
88678
88843
  function toolResult(value) {
88679
- if (!isRecord8(value)) return { ok: false, detail: "The tools/call result is not an object." };
88844
+ if (!isRecord9(value)) return { ok: false, detail: "The tools/call result is not an object." };
88680
88845
  if (!isList(value.content)) return { ok: false, detail: "The tools/call result has no content list." };
88681
88846
  const content = [];
88682
88847
  for (const [index, item] of value.content.entries()) {
88683
- if (!isRecord8(item) || typeof item.type !== "string") {
88848
+ if (!isRecord9(item) || typeof item.type !== "string") {
88684
88849
  return { ok: false, detail: `Content item ${index} is not an object with a string type.` };
88685
88850
  }
88686
88851
  content.push({ ...item, type: item.type });
@@ -88688,7 +88853,7 @@ function toolResult(value) {
88688
88853
  const result2 = { content };
88689
88854
  const structured = value.structuredContent;
88690
88855
  if (structured !== void 0 && structured !== null) {
88691
- if (!isRecord8(structured)) return { ok: false, detail: "The tools/call result's structuredContent is not an object." };
88856
+ if (!isRecord9(structured)) return { ok: false, detail: "The tools/call result's structuredContent is not an object." };
88692
88857
  result2.structuredContent = structured;
88693
88858
  }
88694
88859
  const isError = value.isError;
@@ -88807,7 +88972,7 @@ function rejectedAttempt(response, failure2) {
88807
88972
  function findResponse(value, id) {
88808
88973
  const messages = isList(value) ? value : [value];
88809
88974
  for (const message of messages) {
88810
- if (isRecord8(message) && message.id === id && !Object.hasOwn(message, "method")) return message;
88975
+ if (isRecord9(message) && message.id === id && !Object.hasOwn(message, "method")) return message;
88811
88976
  }
88812
88977
  return void 0;
88813
88978
  }
@@ -88857,8 +89022,8 @@ async function readReply(session, response, id, what) {
88857
89022
  return { ok: true, value: message };
88858
89023
  }
88859
89024
  function rpcError2(error) {
88860
- const message = isRecord8(error) && typeof error.message === "string" ? error.message : JSON.stringify(error);
88861
- const code = isRecord8(error) && typeof error.code === "number" ? ` (code ${error.code})` : "";
89025
+ const message = isRecord9(error) && typeof error.message === "string" ? error.message : JSON.stringify(error);
89026
+ const code = isRecord9(error) && typeof error.code === "number" ? ` (code ${error.code})` : "";
88862
89027
  return { title: "MCP error", detail: cutDetail(`${message}${code}`), status: void 0 };
88863
89028
  }
88864
89029
  async function initialize(session) {
@@ -88885,7 +89050,7 @@ async function initialize(session) {
88885
89050
  if (!reply2.ok) return reply2;
88886
89051
  if (Object.hasOwn(reply2.value, "error")) return { ok: false, error: rpcError2(reply2.value.error) };
88887
89052
  const result2 = reply2.value.result;
88888
- if (!isRecord8(result2)) return invalidResponse("The MCP server's initialize result is not an object.", response.status);
89053
+ if (!isRecord9(result2)) return invalidResponse("The MCP server's initialize result is not an object.", response.status);
88889
89054
  const version2 = result2.protocolVersion;
88890
89055
  session.protocol = typeof version2 === "string" && PROTOCOL_VERSION2.test(version2) ? version2 : MCP_PROTOCOL_VERSION2;
88891
89056
  return { ok: true, value: void 0 };
@@ -89087,8 +89252,8 @@ function firstPosition(paging, args, options) {
89087
89252
  if (paging.style === "offset") return 0;
89088
89253
  const properties = options.inputSchema.properties;
89089
89254
  const name = options.agentName(paging.input);
89090
- const property = isRecord8(properties) && Object.hasOwn(properties, name) ? properties[name] : void 0;
89091
- if (isRecord8(property)) {
89255
+ const property = isRecord9(properties) && Object.hasOwn(properties, name) ? properties[name] : void 0;
89256
+ if (isRecord9(property)) {
89092
89257
  const fallback = wholeNumber(property.default) ?? wholeNumber(property.minimum);
89093
89258
  if (fallback !== void 0) return fallback;
89094
89259
  }
@@ -89238,7 +89403,7 @@ function graphqlDocument(template, args) {
89238
89403
  return { query, variables: Object.fromEntries(present.map((a) => [a.name, args[a.property]])) };
89239
89404
  }
89240
89405
  function errorMessages(errors) {
89241
- return errors.map((entry2) => isRecord8(entry2) && typeof entry2.message === "string" ? entry2.message : JSON.stringify(entry2)).join("; ");
89406
+ return errors.map((entry2) => isRecord9(entry2) && typeof entry2.message === "string" ? entry2.message : JSON.stringify(entry2)).join("; ");
89242
89407
  }
89243
89408
  function invalidResponse2(detail, status2) {
89244
89409
  return { ok: false, error: { title: "Invalid response", detail, status: status2 } };
@@ -89249,14 +89414,14 @@ function interpret(template) {
89249
89414
  const status2 = response.status;
89250
89415
  const parsed = bytes.byteLength === 0 ? void 0 : parseJson3(decodeText2(bytes));
89251
89416
  const body2 = parsed?.ok === true ? parsed.value : void 0;
89252
- if (isRecord8(body2) && isList(body2.errors) && body2.errors.length > 0) {
89417
+ if (isRecord9(body2) && isList(body2.errors) && body2.errors.length > 0) {
89253
89418
  return { ok: false, error: { title: "GraphQL error", detail: cutDetail(errorMessages(body2.errors)), status: status2 } };
89254
89419
  }
89255
89420
  if (status2 < 200 || status2 >= 300) return { ok: false, error: upstreamError(response, bytes) };
89256
89421
  if (parsed === void 0) return invalidResponse2(`The upstream answered ${status2} with no body.`, status2);
89257
89422
  if (!parsed.ok) return invalidResponse2(`The upstream answered ${status2} with JSON that does not parse: ${parsed.message}`, status2);
89258
- const data = isRecord8(body2) ? body2.data : void 0;
89259
- if (!isRecord8(data)) return invalidResponse2(`The upstream answered ${status2} with no data object.`, status2);
89423
+ const data = isRecord9(body2) ? body2.data : void 0;
89424
+ if (!isRecord9(data)) return invalidResponse2(`The upstream answered ${status2} with no data object.`, status2);
89260
89425
  if (!Object.hasOwn(data, field)) return invalidResponse2(`The response's data has no ${field} field.`, status2);
89261
89426
  const value = data[field];
89262
89427
  return { ok: true, value: isList(value) ? { items: value } : value };
@@ -107551,7 +107716,7 @@ function scalarText(value, name) {
107551
107716
  }
107552
107717
  function shapeOf(value, name) {
107553
107718
  if (isList(value)) return { kind: "list", items: value.map((item) => scalarText(item, name)) };
107554
- if (isRecord8(value)) {
107719
+ if (isRecord9(value)) {
107555
107720
  return {
107556
107721
  kind: "object",
107557
107722
  entries: Object.entries(value).filter(([, item]) => item !== void 0).map(([key, item]) => [key, scalarText(item, name)])
@@ -107672,7 +107837,7 @@ function formText(value) {
107672
107837
  throw invalidArguments(`A form body cannot carry a ${typeof value} value.`);
107673
107838
  }
107674
107839
  function formBody(value) {
107675
- if (!isRecord8(value)) throw invalidArguments("A form body takes an object.");
107840
+ if (!isRecord9(value)) throw invalidArguments("A form body takes an object.");
107676
107841
  const form = new URLSearchParams();
107677
107842
  for (const [key, item] of Object.entries(value)) {
107678
107843
  const items = (isList(item) ? item : [item]).filter((one) => one !== void 0);
@@ -107900,7 +108065,7 @@ function project(value, at) {
107900
108065
  const each = at.each;
107901
108066
  return value.map((item) => project(item, each)).filter((item) => item !== ABSENT);
107902
108067
  }
107903
- if (isRecord8(value) && at.fields.size > 0) {
108068
+ if (isRecord9(value) && at.fields.size > 0) {
107904
108069
  const kept = [];
107905
108070
  for (const [name, child] of at.fields) {
107906
108071
  if (!Object.hasOwn(value, name)) continue;
@@ -107917,7 +108082,7 @@ function remove(value, at) {
107917
108082
  const each = at.each;
107918
108083
  return value.map((item) => remove(item, each)).filter((item) => item !== ABSENT);
107919
108084
  }
107920
- if (isRecord8(value) && at.fields.size > 0) {
108085
+ if (isRecord9(value) && at.fields.size > 0) {
107921
108086
  const kept = [];
107922
108087
  for (const [name, item] of Object.entries(value)) {
107923
108088
  const child = at.fields.get(name);
@@ -107953,10 +108118,10 @@ function shapeRecord(value, rules, isError) {
107953
108118
  let out = value;
107954
108119
  if (rules.select !== void 0 && !isError) out = project(out, rules.select);
107955
108120
  if (rules.redact !== void 0) out = remove(out, rules.redact);
107956
- return isRecord8(out) ? out : {};
108121
+ return isRecord9(out) ? out : {};
107957
108122
  }
107958
108123
  function shapeJson(value, rules) {
107959
- return isRecord8(value) ? shapeRecord(value, rules, false) : value;
108124
+ return isRecord9(value) ? shapeRecord(value, rules, false) : value;
107960
108125
  }
107961
108126
  function byteLength(text4) {
107962
108127
  return encodeText(text4).byteLength;
@@ -107983,7 +108148,7 @@ function resultBytes(content, structured) {
107983
108148
  }
107984
108149
  function jsonResult(value, text4) {
107985
108150
  const result2 = { content: [textItem(text4)] };
107986
- if (isRecord8(value)) result2.structuredContent = value;
108151
+ if (isRecord9(value)) result2.structuredContent = value;
107987
108152
  return result2;
107988
108153
  }
107989
108154
  function fitsCap(result2, rules) {
@@ -108038,7 +108203,7 @@ function shapeTextItem(item, rules, isError) {
108038
108203
  const text4 = item.text;
108039
108204
  if (typeof text4 !== "string") return item;
108040
108205
  const parsed = parseJson3(text4);
108041
- if (!parsed.ok || !isRecord8(parsed.value)) return item;
108206
+ if (!parsed.ok || !isRecord9(parsed.value)) return item;
108042
108207
  return { ...item, text: JSON.stringify(shapeRecord(parsed.value, rules, isError)) };
108043
108208
  }
108044
108209
  function shapeToolResult(result2, rules, notes) {
@@ -108103,7 +108268,7 @@ function hasType(type, value) {
108103
108268
  case "boolean":
108104
108269
  return typeof value === "boolean";
108105
108270
  case "object":
108106
- return isRecord8(value);
108271
+ return isRecord9(value);
108107
108272
  case "array":
108108
108273
  return isList(value);
108109
108274
  default:
@@ -108175,7 +108340,7 @@ function resolveRef(root, ref2) {
108175
108340
  const index = Number(token);
108176
108341
  if (!Number.isInteger(index) || index < 0 || index >= current.length) return void 0;
108177
108342
  current = current[index];
108178
- } else if (isRecord8(current) && Object.hasOwn(current, token)) {
108343
+ } else if (isRecord9(current) && Object.hasOwn(current, token)) {
108179
108344
  current = current[token];
108180
108345
  } else {
108181
108346
  return void 0;
@@ -108185,7 +108350,7 @@ function resolveRef(root, ref2) {
108185
108350
  }
108186
108351
  function canonical2(value) {
108187
108352
  if (isList(value)) return `[${value.map(canonical2).join(",")}]`;
108188
- if (isRecord8(value)) {
108353
+ if (isRecord9(value)) {
108189
108354
  const keys = Object.keys(value).sort();
108190
108355
  return `{${keys.map((key) => `${JSON.stringify(key)}:${canonical2(value[key])}`).join(",")}}`;
108191
108356
  }
@@ -108229,7 +108394,7 @@ var init_validate = __esm({
108229
108394
  this.steps += 1;
108230
108395
  if (depth > MAX_DEPTH2 || this.steps > MAX_STEPS) return [];
108231
108396
  if (schema === false) return [`${path2} is not allowed.`];
108232
- if (!isRecord8(schema)) return [];
108397
+ if (!isRecord9(schema)) return [];
108233
108398
  if (value === null && schema.nullable === true) return [];
108234
108399
  const issues = [];
108235
108400
  if (typeof schema.$ref === "string") {
@@ -108247,7 +108412,7 @@ var init_validate = __esm({
108247
108412
  if (typeof value === "string") issues.push(...checkString(schema, value, path2));
108248
108413
  else if (typeof value === "number") issues.push(...checkNumber(schema, value, path2));
108249
108414
  else if (isList(value)) issues.push(...this.checkArray(schema, value, path2, depth));
108250
- else if (isRecord8(value)) issues.push(...this.checkObject(schema, value, path2, depth));
108415
+ else if (isRecord9(value)) issues.push(...this.checkObject(schema, value, path2, depth));
108251
108416
  issues.push(...this.checkCombinators(schema, value, path2, depth));
108252
108417
  return issues;
108253
108418
  }
@@ -108297,8 +108462,8 @@ var init_validate = __esm({
108297
108462
  if (typeof schema.maxProperties === "number" && present.length > schema.maxProperties) {
108298
108463
  issues.push(`${path2} must have at most ${schema.maxProperties} ${plural4(schema.maxProperties, "property", "properties")}.`);
108299
108464
  }
108300
- const properties = isRecord8(schema.properties) ? schema.properties : {};
108301
- const patterns = isRecord8(schema.patternProperties) ? Object.entries(schema.patternProperties) : [];
108465
+ const properties = isRecord9(schema.properties) ? schema.properties : {};
108466
+ const patterns = isRecord9(schema.patternProperties) ? Object.entries(schema.patternProperties) : [];
108302
108467
  for (const key of present) {
108303
108468
  const at = propertyPath(path2, key);
108304
108469
  let known = false;
@@ -108578,7 +108743,7 @@ function differenceAt(path2, expected, actual) {
108578
108743
  if (expected.length === actual.length) return void 0;
108579
108744
  return { path: `${path2}[${shared}]`, expected: expected[shared], actual: actual[shared] };
108580
108745
  }
108581
- if (isRecord8(expected) && isRecord8(actual)) {
108746
+ if (isRecord9(expected) && isRecord9(actual)) {
108582
108747
  for (const key of Object.keys(expected)) {
108583
108748
  const found = differenceAt(keyPath(path2, key), expected[key], Object.hasOwn(actual, key) ? actual[key] : void 0);
108584
108749
  if (found !== void 0) return found;
@@ -108656,7 +108821,7 @@ function rpcMessage(request3) {
108656
108821
  const parsed = parseJson3(decodeText2(request3.body));
108657
108822
  if (!parsed.ok) return void 0;
108658
108823
  const value = isList(parsed.value) ? parsed.value[0] : parsed.value;
108659
- return isRecord8(value) ? value : void 0;
108824
+ return isRecord9(value) ? value : void 0;
108660
108825
  }
108661
108826
  function replayTransport(exchanges, route) {
108662
108827
  let next = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxagen/cli",
3
- "version": "2.1.4-381",
3
+ "version": "2.1.4-384",
4
4
  "description": "Oxagen governance CLI — spend, lineage, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
5
5
  "type": "module",
6
6
  "bin": {