@oxagen/cli 2.1.4-380 → 2.1.4-383

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 +358 -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-380";
15349
+ if (true) return "2.1.4-383";
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 } : {}
40435
+ };
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)
40354
40448
  };
40355
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-380",
48238
+ version: "2.1.4-383",
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) {
@@ -66174,6 +66339,60 @@ var init_settings_baseline = __esm({
66174
66339
  }
66175
66340
  });
66176
66341
 
66342
+ // ../../packages/oxagen/src/steering-repo/steering-tools.ts
66343
+ var STEERING_SEARCH_DEFAULT_LIMIT, STEERING_SEARCH_MAX_LIMIT, steeringSearchInputSchema, steeringSearchHitSchema, steeringSearchOutputSchema, steeringReadInputSchema, steeringReadOutputSchema;
66344
+ var init_steering_tools = __esm({
66345
+ "../../packages/oxagen/src/steering-repo/steering-tools.ts"() {
66346
+ "use strict";
66347
+ init_zod();
66348
+ init_common();
66349
+ init_record_kind();
66350
+ STEERING_SEARCH_DEFAULT_LIMIT = 10;
66351
+ STEERING_SEARCH_MAX_LIMIT = 50;
66352
+ steeringSearchInputSchema = external_exports.object({
66353
+ query: external_exports.string().max(500).optional().describe("Words to look for in each record's label, description, and lineage."),
66354
+ kind: recordKindSchema.optional().describe("Only records of this kind, such as skill."),
66355
+ repository: repoRefSchema.optional().describe("Only records that reach a run on this code repository, such as github.com/a-intel/platform."),
66356
+ limit: external_exports.number().int().min(1).max(STEERING_SEARCH_MAX_LIMIT).optional().describe(`How many to return. ${STEERING_SEARCH_DEFAULT_LIMIT} when unset.`)
66357
+ }).strict();
66358
+ steeringSearchHitSchema = external_exports.object({
66359
+ lineage: external_exports.string(),
66360
+ label: external_exports.string(),
66361
+ description: external_exports.string().optional(),
66362
+ kind: external_exports.string(),
66363
+ force: external_exports.string(),
66364
+ /**
66365
+ * True for a record the always-on block of a run on the repository holds:
66366
+ * the version's block for that repository, else its block for every other
66367
+ * repository. With no repository, that second block.
66368
+ */
66369
+ always_on: external_exports.boolean(),
66370
+ source: external_exports.enum(["workspace", "organization"]),
66371
+ line: external_exports.string().describe("The record's index line.")
66372
+ }).strict();
66373
+ steeringSearchOutputSchema = external_exports.object({
66374
+ workspace_version: external_exports.number().int().nullable(),
66375
+ organization_version: external_exports.number().int().nullable(),
66376
+ hits: external_exports.array(steeringSearchHitSchema),
66377
+ /** How many matched before the limit. */
66378
+ total: external_exports.number().int().min(0)
66379
+ }).strict();
66380
+ steeringReadInputSchema = external_exports.object({
66381
+ lineage: lineageSchema.describe("The record or skill to read, such as a-intel.domain.refund."),
66382
+ file: external_exports.string().min(1).max(512).optional().describe("A file in the skill's folder, such as words.md. Unset, the record itself.")
66383
+ }).strict();
66384
+ steeringReadOutputSchema = external_exports.object({
66385
+ lineage: external_exports.string(),
66386
+ label: external_exports.string(),
66387
+ kind: external_exports.string(),
66388
+ source: external_exports.enum(["workspace", "organization"]),
66389
+ version: external_exports.number().int().min(1),
66390
+ path: external_exports.string(),
66391
+ text: external_exports.string()
66392
+ }).strict();
66393
+ }
66394
+ });
66395
+
66177
66396
  // ../../packages/oxagen/src/steering-repo/templates.ts
66178
66397
  function managedBlockHash(content) {
66179
66398
  return sha256Digest(new TextEncoder().encode(content)).slice(7, 23);
@@ -66271,6 +66490,7 @@ var init_steering_repo = __esm({
66271
66490
  init_schema_ids();
66272
66491
  init_schemas();
66273
66492
  init_settings_baseline();
66493
+ init_steering_tools();
66274
66494
  init_templates();
66275
66495
  init_tokens();
66276
66496
  init_toolbelt();
@@ -66279,7 +66499,7 @@ var init_steering_repo = __esm({
66279
66499
  });
66280
66500
 
66281
66501
  // ../../packages/steering-check/src/repo.ts
66282
- function isRecord7(value) {
66502
+ function isRecord8(value) {
66283
66503
  return typeof value === "object" && value !== null && !Array.isArray(value);
66284
66504
  }
66285
66505
  function isString(value) {
@@ -66404,14 +66624,14 @@ function parseTomlLoose(text4) {
66404
66624
  if (text4 === void 0) return null;
66405
66625
  try {
66406
66626
  const value = parse(text4);
66407
- return isRecord7(value) ? value : null;
66627
+ return isRecord8(value) ? value : null;
66408
66628
  } catch {
66409
66629
  return null;
66410
66630
  }
66411
66631
  }
66412
66632
  function canonicalJson(value) {
66413
66633
  if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
66414
- if (isRecord7(value)) {
66634
+ if (isRecord8(value)) {
66415
66635
  const keys = Object.keys(value).sort();
66416
66636
  return `{${keys.map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key])}`).join(",")}}`;
66417
66637
  }
@@ -66421,7 +66641,7 @@ function parseJsonLoose(text4) {
66421
66641
  if (text4 === void 0) return null;
66422
66642
  try {
66423
66643
  const value = JSON.parse(text4);
66424
- return isRecord7(value) ? value : null;
66644
+ return isRecord8(value) ? value : null;
66425
66645
  } catch {
66426
66646
  return null;
66427
66647
  }
@@ -66435,9 +66655,9 @@ function workspaceRepositories(tree) {
66435
66655
  }
66436
66656
  function entries(value) {
66437
66657
  const found = /* @__PURE__ */ new Map();
66438
- if (!isRecord7(value)) return found;
66658
+ if (!isRecord8(value)) return found;
66439
66659
  for (const [key, entry2] of Object.entries(value)) {
66440
- if (isRecord7(entry2)) found.set(key, entry2);
66660
+ if (isRecord8(entry2)) found.set(key, entry2);
66441
66661
  }
66442
66662
  return found;
66443
66663
  }
@@ -66601,14 +66821,14 @@ function isPositiveInteger(value) {
66601
66821
  }
66602
66822
  function alwaysOnBudget(tree) {
66603
66823
  const steering = parseTomlLoose(tree?.get(GOVERNANCE_TOML_PATH))?.steering;
66604
- const value = isRecord7(steering) ? steering.always_on_tokens : void 0;
66824
+ const value = isRecord8(steering) ? steering.always_on_tokens : void 0;
66605
66825
  if (value === "off") return "off";
66606
66826
  if (isPositiveInteger(value)) return { tokens: value, source: "governance.toml" };
66607
66827
  return { tokens: DEFAULT_ALWAYS_ON_TOKENS, source: "Oxagen's default" };
66608
66828
  }
66609
66829
  function definitionBudget(tree) {
66610
66830
  const tools = parseTomlLoose(tree?.get(WORKSPACE_TOML_PATH))?.tools;
66611
- const value = isRecord7(tools) ? tools.definition_budget : void 0;
66831
+ const value = isRecord8(tools) ? tools.definition_budget : void 0;
66612
66832
  return isPositiveInteger(value) ? { tokens: value, source: "workspace.toml" } : { tokens: DEFAULT_WORKSPACE_DEFINITION_BUDGET, source: "Oxagen's default" };
66613
66833
  }
66614
66834
  function repositoryName(repository) {
@@ -66698,12 +66918,12 @@ function directDefinitions(tree) {
66698
66918
  const servers = [];
66699
66919
  for (const [name, folder] of serverFolders(tree)) {
66700
66920
  const exposure = folder.server?.exposure;
66701
- if (!isRecord7(exposure) || exposure.mode !== "direct") continue;
66921
+ if (!isRecord8(exposure) || exposure.mode !== "direct") continue;
66702
66922
  let tokens = 0;
66703
66923
  let tools = 0;
66704
66924
  for (const [key, entry2] of folder.tools) {
66705
66925
  const upstream = folder.locked.get(key)?.upstream;
66706
- if (!isRecord7(upstream)) continue;
66926
+ if (!isRecord8(upstream)) continue;
66707
66927
  const description = isString(entry2.description) ? entry2.description : upstream.description;
66708
66928
  const definition = {
66709
66929
  name: `${name}__${key}`,
@@ -67353,7 +67573,7 @@ function credentialFields(value, prefix = "") {
67353
67573
  (item, n4) => credentialFields(item, prefix === "" ? String(n4) : `${prefix}.${n4}`)
67354
67574
  );
67355
67575
  }
67356
- if (!isRecord7(value)) return [];
67576
+ if (!isRecord8(value)) return [];
67357
67577
  return Object.entries(value).flatMap(
67358
67578
  ([key, item]) => credentialFields(item, prefix === "" ? key : `${prefix}.${key}`)
67359
67579
  );
@@ -67388,7 +67608,7 @@ function groupFindings(tree, context) {
67388
67608
  const reviewers = parsed.reviewers;
67389
67609
  const findings = [];
67390
67610
  reviewers.forEach((entry2, n4) => {
67391
- 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;
67392
67612
  const field = `reviewers.${n4}.group`;
67393
67613
  findings.push(
67394
67614
  find8({
@@ -74072,7 +74292,7 @@ var init_registry_launch = __esm({
74072
74292
  function messageOf2(error) {
74073
74293
  return error instanceof Error ? error.message : String(error);
74074
74294
  }
74075
- function isRecord8(value) {
74295
+ function isRecord9(value) {
74076
74296
  return typeof value === "object" && value !== null && !Array.isArray(value);
74077
74297
  }
74078
74298
  function isList(value) {
@@ -74083,7 +74303,7 @@ function jsonEqual(a, b5) {
74083
74303
  if (Array.isArray(a)) {
74084
74304
  return Array.isArray(b5) && a.length === b5.length && a.every((item, index) => jsonEqual(item, b5[index]));
74085
74305
  }
74086
- if (isRecord8(a) && isRecord8(b5)) {
74306
+ if (isRecord9(a) && isRecord9(b5)) {
74087
74307
  const keys = Object.keys(a);
74088
74308
  return keys.length === Object.keys(b5).length && keys.every((key) => Object.hasOwn(b5, key) && jsonEqual(a[key], b5[key]));
74089
74309
  }
@@ -74092,16 +74312,16 @@ function jsonEqual(a, b5) {
74092
74312
  function valueAt2(value, path2) {
74093
74313
  let current = value;
74094
74314
  for (const step of path2.split(".")) {
74095
- 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;
74096
74316
  current = current[step];
74097
74317
  }
74098
74318
  return current;
74099
74319
  }
74100
74320
  function withValueAt(value, path2, replacement) {
74101
74321
  const [step, ...rest] = path2.split(".");
74102
- if (step === void 0 || !isRecord8(value)) return value;
74322
+ if (step === void 0 || !isRecord9(value)) return value;
74103
74323
  const inner = Object.hasOwn(value, step) ? value[step] : void 0;
74104
- if (rest.length > 0 && !isRecord8(inner)) return value;
74324
+ if (rest.length > 0 && !isRecord9(inner)) return value;
74105
74325
  const next = rest.length === 0 ? replacement : withValueAt(inner, rest.join("."), replacement);
74106
74326
  return { ...value, [step]: next };
74107
74327
  }
@@ -74776,11 +74996,11 @@ var init_openapi = __esm({
74776
74996
  });
74777
74997
 
74778
74998
  // ../../packages/mcp-studio/src/compile/json-schema.ts
74779
- function isRecord10(value) {
74999
+ function isRecord11(value) {
74780
75000
  return typeof value === "object" && value !== null && !Array.isArray(value);
74781
75001
  }
74782
75002
  function propertiesOf(schema) {
74783
- return isRecord10(schema.properties) ? schema.properties : {};
75003
+ return isRecord11(schema.properties) ? schema.properties : {};
74784
75004
  }
74785
75005
  function requiredOf(schema) {
74786
75006
  if (!Array.isArray(schema.required)) return [];
@@ -76146,8 +76366,8 @@ function checkSingular(field, value) {
76146
76366
  }
76147
76367
  return isReflectMessage(value, field.message);
76148
76368
  }
76149
- function checkScalarValue(value, scalar) {
76150
- switch (scalar) {
76369
+ function checkScalarValue(value, scalar2) {
76370
+ switch (scalar2) {
76151
76371
  case ScalarType.DOUBLE:
76152
76372
  return typeof value == "number";
76153
76373
  case ScalarType.FLOAT:
@@ -76284,8 +76504,8 @@ function formatReflectMap(field) {
76284
76504
  return `ReflectMap (${ScalarType[field.mapKey]}, ${ScalarType[field.scalar]})`;
76285
76505
  }
76286
76506
  }
76287
- function scalarTypeDescription(scalar) {
76288
- switch (scalar) {
76507
+ function scalarTypeDescription(scalar2) {
76508
+ switch (scalar2) {
76289
76509
  case ScalarType.STRING:
76290
76510
  return "string";
76291
76511
  case ScalarType.BOOL:
@@ -86706,7 +86926,7 @@ function shapeInput(key, entry2, upstream, supplied, issues) {
86706
86926
  for (const [name, value] of defaults) {
86707
86927
  if (!usable("defaults", name)) continue;
86708
86928
  const property = shaped[name];
86709
- shaped[name] = { ...isRecord10(property) ? property : {}, default: value };
86929
+ shaped[name] = { ...isRecord11(property) ? property : {}, default: value };
86710
86930
  required = required.filter((other) => other !== name);
86711
86931
  }
86712
86932
  const renamed = /* @__PURE__ */ new Map();
@@ -86752,7 +86972,7 @@ function selectTree(paths) {
86752
86972
  return root;
86753
86973
  }
86754
86974
  function trimObject(schema, children) {
86755
- if (!isRecord10(schema.properties)) return schema;
86975
+ if (!isRecord11(schema.properties)) return schema;
86756
86976
  const properties = schema.properties;
86757
86977
  const kept = {};
86758
86978
  for (const [name, node2] of children) {
@@ -86766,9 +86986,9 @@ function trimObject(schema, children) {
86766
86986
  return out;
86767
86987
  }
86768
86988
  function trimNode(schema, node2) {
86769
- if (node2.whole || !isRecord10(schema)) return schema;
86989
+ if (node2.whole || !isRecord11(schema)) return schema;
86770
86990
  if (!node2.array) return trimObject(schema, node2.children);
86771
- 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;
86772
86992
  }
86773
86993
  function selectOutput(outputSchema, select) {
86774
86994
  if (select.length === 0) return outputSchema;
@@ -87440,12 +87660,12 @@ function walkSchemas(root, at, visit2) {
87440
87660
  node2.forEach((item, index) => walk(item, `${path2}[${index}]`, depth + 1));
87441
87661
  return;
87442
87662
  }
87443
- if (!isRecord10(node2) || above.has(node2)) return;
87663
+ if (!isRecord11(node2) || above.has(node2)) return;
87444
87664
  visit2(node2, path2);
87445
87665
  above.add(node2);
87446
87666
  for (const [key, value] of Object.entries(node2)) {
87447
87667
  if (DATA.has(key)) continue;
87448
- if (SCHEMA_MAPS.has(key) && isRecord10(value)) {
87668
+ if (SCHEMA_MAPS.has(key) && isRecord11(value)) {
87449
87669
  for (const [name, child] of Object.entries(value)) walk(child, `${path2}.${key}.${name}`, depth + 1);
87450
87670
  } else {
87451
87671
  walk(value, `${path2}.${key}`, depth + 1);
@@ -87456,14 +87676,14 @@ function walkSchemas(root, at, visit2) {
87456
87676
  walk(root, at, 0);
87457
87677
  }
87458
87678
  function tagOf(schema) {
87459
- if (!isRecord10(schema)) return void 0;
87679
+ if (!isRecord11(schema)) return void 0;
87460
87680
  if (Object.hasOwn(schema, "const")) return JSON.stringify(schema.const);
87461
87681
  if (Array.isArray(schema.enum) && schema.enum.length === 1) return JSON.stringify(schema.enum[0]);
87462
87682
  return void 0;
87463
87683
  }
87464
87684
  function distinguishable(branches) {
87465
87685
  if (branches.length < 2) return true;
87466
- const records = branches.filter(isRecord10);
87686
+ const records = branches.filter(isRecord11);
87467
87687
  const [first] = records;
87468
87688
  if (first === void 0 || records.length < branches.length) return false;
87469
87689
  const types = records.map((branch) => branch.type);
@@ -87554,7 +87774,7 @@ function shapedInput(entry2, upstream) {
87554
87774
  for (const [name, value] of defaults) {
87555
87775
  if (!Object.hasOwn(shaped, name)) continue;
87556
87776
  const property = shaped[name];
87557
- shaped[name] = { ...isRecord10(property) ? property : {}, default: value };
87777
+ shaped[name] = { ...isRecord11(property) ? property : {}, default: value };
87558
87778
  required = required.filter((other) => other !== name);
87559
87779
  }
87560
87780
  const renamed = new Map(rename3.filter(([from]) => Object.hasOwn(shaped, from)));
@@ -87584,7 +87804,7 @@ function selectTree2(paths) {
87584
87804
  return root;
87585
87805
  }
87586
87806
  function trimObject2(schema, children) {
87587
- if (!isRecord10(schema.properties)) return schema;
87807
+ if (!isRecord11(schema.properties)) return schema;
87588
87808
  const properties = schema.properties;
87589
87809
  const kept = {};
87590
87810
  for (const [name, node2] of children) {
@@ -87598,9 +87818,9 @@ function trimObject2(schema, children) {
87598
87818
  return out;
87599
87819
  }
87600
87820
  function trimNode2(schema, node2) {
87601
- if (node2.whole || !isRecord10(schema)) return schema;
87821
+ if (node2.whole || !isRecord11(schema)) return schema;
87602
87822
  if (!node2.array) return trimObject2(schema, node2.children);
87603
- 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;
87604
87824
  }
87605
87825
  function servedOutput(outputSchema, select) {
87606
87826
  if (select.length === 0) return outputSchema;
@@ -87650,7 +87870,7 @@ function quoted(values) {
87650
87870
  return orList2(values.map((value) => JSON.stringify(value)));
87651
87871
  }
87652
87872
  function isArraySchema(schema) {
87653
- if (!isRecord10(schema)) return false;
87873
+ if (!isRecord11(schema)) return false;
87654
87874
  return schema.type === "array" || Array.isArray(schema.type) && schema.type.includes("array");
87655
87875
  }
87656
87876
  function lintTools(folder, context, report) {
@@ -87827,7 +88047,7 @@ function lintUpstream(folder, context, key, entry2, upstream, report) {
87827
88047
  });
87828
88048
  }
87829
88049
  const oneOf2 = (node2, at) => {
87830
- 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;
87831
88051
  report("undiscriminated_one_of", {
87832
88052
  tool: key,
87833
88053
  field: `${at}.oneOf`,
@@ -88437,7 +88657,7 @@ function upstreamError(response, bytes) {
88437
88657
  let problem;
88438
88658
  if (text4 !== "" && isJsonMediaType(headerValue(response.headers, "content-type"))) {
88439
88659
  const parsed = parseJson3(text4);
88440
- if (parsed.ok && isRecord8(parsed.value)) problem = parsed.value;
88660
+ if (parsed.ok && isRecord9(parsed.value)) problem = parsed.value;
88441
88661
  }
88442
88662
  const title = problem === void 0 ? void 0 : firstText(problem, ["title"]);
88443
88663
  const detail = problem === void 0 ? text4.trim() === "" ? void 0 : text4 : firstText(problem, ["detail", "message", "error_description", "error"]);
@@ -88621,11 +88841,11 @@ var init_apply_credential = __esm({
88621
88841
 
88622
88842
  // ../../packages/mcp-studio/src/execute/mcp.ts
88623
88843
  function toolResult(value) {
88624
- 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." };
88625
88845
  if (!isList(value.content)) return { ok: false, detail: "The tools/call result has no content list." };
88626
88846
  const content = [];
88627
88847
  for (const [index, item] of value.content.entries()) {
88628
- if (!isRecord8(item) || typeof item.type !== "string") {
88848
+ if (!isRecord9(item) || typeof item.type !== "string") {
88629
88849
  return { ok: false, detail: `Content item ${index} is not an object with a string type.` };
88630
88850
  }
88631
88851
  content.push({ ...item, type: item.type });
@@ -88633,7 +88853,7 @@ function toolResult(value) {
88633
88853
  const result2 = { content };
88634
88854
  const structured = value.structuredContent;
88635
88855
  if (structured !== void 0 && structured !== null) {
88636
- 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." };
88637
88857
  result2.structuredContent = structured;
88638
88858
  }
88639
88859
  const isError = value.isError;
@@ -88752,7 +88972,7 @@ function rejectedAttempt(response, failure2) {
88752
88972
  function findResponse(value, id) {
88753
88973
  const messages = isList(value) ? value : [value];
88754
88974
  for (const message of messages) {
88755
- 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;
88756
88976
  }
88757
88977
  return void 0;
88758
88978
  }
@@ -88802,8 +89022,8 @@ async function readReply(session, response, id, what) {
88802
89022
  return { ok: true, value: message };
88803
89023
  }
88804
89024
  function rpcError2(error) {
88805
- const message = isRecord8(error) && typeof error.message === "string" ? error.message : JSON.stringify(error);
88806
- 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})` : "";
88807
89027
  return { title: "MCP error", detail: cutDetail(`${message}${code}`), status: void 0 };
88808
89028
  }
88809
89029
  async function initialize(session) {
@@ -88830,7 +89050,7 @@ async function initialize(session) {
88830
89050
  if (!reply2.ok) return reply2;
88831
89051
  if (Object.hasOwn(reply2.value, "error")) return { ok: false, error: rpcError2(reply2.value.error) };
88832
89052
  const result2 = reply2.value.result;
88833
- 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);
88834
89054
  const version2 = result2.protocolVersion;
88835
89055
  session.protocol = typeof version2 === "string" && PROTOCOL_VERSION2.test(version2) ? version2 : MCP_PROTOCOL_VERSION2;
88836
89056
  return { ok: true, value: void 0 };
@@ -89032,8 +89252,8 @@ function firstPosition(paging, args, options) {
89032
89252
  if (paging.style === "offset") return 0;
89033
89253
  const properties = options.inputSchema.properties;
89034
89254
  const name = options.agentName(paging.input);
89035
- const property = isRecord8(properties) && Object.hasOwn(properties, name) ? properties[name] : void 0;
89036
- if (isRecord8(property)) {
89255
+ const property = isRecord9(properties) && Object.hasOwn(properties, name) ? properties[name] : void 0;
89256
+ if (isRecord9(property)) {
89037
89257
  const fallback = wholeNumber(property.default) ?? wholeNumber(property.minimum);
89038
89258
  if (fallback !== void 0) return fallback;
89039
89259
  }
@@ -89183,7 +89403,7 @@ function graphqlDocument(template, args) {
89183
89403
  return { query, variables: Object.fromEntries(present.map((a) => [a.name, args[a.property]])) };
89184
89404
  }
89185
89405
  function errorMessages(errors) {
89186
- 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("; ");
89187
89407
  }
89188
89408
  function invalidResponse2(detail, status2) {
89189
89409
  return { ok: false, error: { title: "Invalid response", detail, status: status2 } };
@@ -89194,14 +89414,14 @@ function interpret(template) {
89194
89414
  const status2 = response.status;
89195
89415
  const parsed = bytes.byteLength === 0 ? void 0 : parseJson3(decodeText2(bytes));
89196
89416
  const body2 = parsed?.ok === true ? parsed.value : void 0;
89197
- if (isRecord8(body2) && isList(body2.errors) && body2.errors.length > 0) {
89417
+ if (isRecord9(body2) && isList(body2.errors) && body2.errors.length > 0) {
89198
89418
  return { ok: false, error: { title: "GraphQL error", detail: cutDetail(errorMessages(body2.errors)), status: status2 } };
89199
89419
  }
89200
89420
  if (status2 < 200 || status2 >= 300) return { ok: false, error: upstreamError(response, bytes) };
89201
89421
  if (parsed === void 0) return invalidResponse2(`The upstream answered ${status2} with no body.`, status2);
89202
89422
  if (!parsed.ok) return invalidResponse2(`The upstream answered ${status2} with JSON that does not parse: ${parsed.message}`, status2);
89203
- const data = isRecord8(body2) ? body2.data : void 0;
89204
- 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);
89205
89425
  if (!Object.hasOwn(data, field)) return invalidResponse2(`The response's data has no ${field} field.`, status2);
89206
89426
  const value = data[field];
89207
89427
  return { ok: true, value: isList(value) ? { items: value } : value };
@@ -107496,7 +107716,7 @@ function scalarText(value, name) {
107496
107716
  }
107497
107717
  function shapeOf(value, name) {
107498
107718
  if (isList(value)) return { kind: "list", items: value.map((item) => scalarText(item, name)) };
107499
- if (isRecord8(value)) {
107719
+ if (isRecord9(value)) {
107500
107720
  return {
107501
107721
  kind: "object",
107502
107722
  entries: Object.entries(value).filter(([, item]) => item !== void 0).map(([key, item]) => [key, scalarText(item, name)])
@@ -107617,7 +107837,7 @@ function formText(value) {
107617
107837
  throw invalidArguments(`A form body cannot carry a ${typeof value} value.`);
107618
107838
  }
107619
107839
  function formBody(value) {
107620
- if (!isRecord8(value)) throw invalidArguments("A form body takes an object.");
107840
+ if (!isRecord9(value)) throw invalidArguments("A form body takes an object.");
107621
107841
  const form = new URLSearchParams();
107622
107842
  for (const [key, item] of Object.entries(value)) {
107623
107843
  const items = (isList(item) ? item : [item]).filter((one) => one !== void 0);
@@ -107845,7 +108065,7 @@ function project(value, at) {
107845
108065
  const each = at.each;
107846
108066
  return value.map((item) => project(item, each)).filter((item) => item !== ABSENT);
107847
108067
  }
107848
- if (isRecord8(value) && at.fields.size > 0) {
108068
+ if (isRecord9(value) && at.fields.size > 0) {
107849
108069
  const kept = [];
107850
108070
  for (const [name, child] of at.fields) {
107851
108071
  if (!Object.hasOwn(value, name)) continue;
@@ -107862,7 +108082,7 @@ function remove(value, at) {
107862
108082
  const each = at.each;
107863
108083
  return value.map((item) => remove(item, each)).filter((item) => item !== ABSENT);
107864
108084
  }
107865
- if (isRecord8(value) && at.fields.size > 0) {
108085
+ if (isRecord9(value) && at.fields.size > 0) {
107866
108086
  const kept = [];
107867
108087
  for (const [name, item] of Object.entries(value)) {
107868
108088
  const child = at.fields.get(name);
@@ -107898,10 +108118,10 @@ function shapeRecord(value, rules, isError) {
107898
108118
  let out = value;
107899
108119
  if (rules.select !== void 0 && !isError) out = project(out, rules.select);
107900
108120
  if (rules.redact !== void 0) out = remove(out, rules.redact);
107901
- return isRecord8(out) ? out : {};
108121
+ return isRecord9(out) ? out : {};
107902
108122
  }
107903
108123
  function shapeJson(value, rules) {
107904
- return isRecord8(value) ? shapeRecord(value, rules, false) : value;
108124
+ return isRecord9(value) ? shapeRecord(value, rules, false) : value;
107905
108125
  }
107906
108126
  function byteLength(text4) {
107907
108127
  return encodeText(text4).byteLength;
@@ -107928,7 +108148,7 @@ function resultBytes(content, structured) {
107928
108148
  }
107929
108149
  function jsonResult(value, text4) {
107930
108150
  const result2 = { content: [textItem(text4)] };
107931
- if (isRecord8(value)) result2.structuredContent = value;
108151
+ if (isRecord9(value)) result2.structuredContent = value;
107932
108152
  return result2;
107933
108153
  }
107934
108154
  function fitsCap(result2, rules) {
@@ -107983,7 +108203,7 @@ function shapeTextItem(item, rules, isError) {
107983
108203
  const text4 = item.text;
107984
108204
  if (typeof text4 !== "string") return item;
107985
108205
  const parsed = parseJson3(text4);
107986
- if (!parsed.ok || !isRecord8(parsed.value)) return item;
108206
+ if (!parsed.ok || !isRecord9(parsed.value)) return item;
107987
108207
  return { ...item, text: JSON.stringify(shapeRecord(parsed.value, rules, isError)) };
107988
108208
  }
107989
108209
  function shapeToolResult(result2, rules, notes) {
@@ -108048,7 +108268,7 @@ function hasType(type, value) {
108048
108268
  case "boolean":
108049
108269
  return typeof value === "boolean";
108050
108270
  case "object":
108051
- return isRecord8(value);
108271
+ return isRecord9(value);
108052
108272
  case "array":
108053
108273
  return isList(value);
108054
108274
  default:
@@ -108120,7 +108340,7 @@ function resolveRef(root, ref2) {
108120
108340
  const index = Number(token);
108121
108341
  if (!Number.isInteger(index) || index < 0 || index >= current.length) return void 0;
108122
108342
  current = current[index];
108123
- } else if (isRecord8(current) && Object.hasOwn(current, token)) {
108343
+ } else if (isRecord9(current) && Object.hasOwn(current, token)) {
108124
108344
  current = current[token];
108125
108345
  } else {
108126
108346
  return void 0;
@@ -108130,7 +108350,7 @@ function resolveRef(root, ref2) {
108130
108350
  }
108131
108351
  function canonical2(value) {
108132
108352
  if (isList(value)) return `[${value.map(canonical2).join(",")}]`;
108133
- if (isRecord8(value)) {
108353
+ if (isRecord9(value)) {
108134
108354
  const keys = Object.keys(value).sort();
108135
108355
  return `{${keys.map((key) => `${JSON.stringify(key)}:${canonical2(value[key])}`).join(",")}}`;
108136
108356
  }
@@ -108174,7 +108394,7 @@ var init_validate = __esm({
108174
108394
  this.steps += 1;
108175
108395
  if (depth > MAX_DEPTH2 || this.steps > MAX_STEPS) return [];
108176
108396
  if (schema === false) return [`${path2} is not allowed.`];
108177
- if (!isRecord8(schema)) return [];
108397
+ if (!isRecord9(schema)) return [];
108178
108398
  if (value === null && schema.nullable === true) return [];
108179
108399
  const issues = [];
108180
108400
  if (typeof schema.$ref === "string") {
@@ -108192,7 +108412,7 @@ var init_validate = __esm({
108192
108412
  if (typeof value === "string") issues.push(...checkString(schema, value, path2));
108193
108413
  else if (typeof value === "number") issues.push(...checkNumber(schema, value, path2));
108194
108414
  else if (isList(value)) issues.push(...this.checkArray(schema, value, path2, depth));
108195
- 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));
108196
108416
  issues.push(...this.checkCombinators(schema, value, path2, depth));
108197
108417
  return issues;
108198
108418
  }
@@ -108242,8 +108462,8 @@ var init_validate = __esm({
108242
108462
  if (typeof schema.maxProperties === "number" && present.length > schema.maxProperties) {
108243
108463
  issues.push(`${path2} must have at most ${schema.maxProperties} ${plural4(schema.maxProperties, "property", "properties")}.`);
108244
108464
  }
108245
- const properties = isRecord8(schema.properties) ? schema.properties : {};
108246
- 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) : [];
108247
108467
  for (const key of present) {
108248
108468
  const at = propertyPath(path2, key);
108249
108469
  let known = false;
@@ -108523,7 +108743,7 @@ function differenceAt(path2, expected, actual) {
108523
108743
  if (expected.length === actual.length) return void 0;
108524
108744
  return { path: `${path2}[${shared}]`, expected: expected[shared], actual: actual[shared] };
108525
108745
  }
108526
- if (isRecord8(expected) && isRecord8(actual)) {
108746
+ if (isRecord9(expected) && isRecord9(actual)) {
108527
108747
  for (const key of Object.keys(expected)) {
108528
108748
  const found = differenceAt(keyPath(path2, key), expected[key], Object.hasOwn(actual, key) ? actual[key] : void 0);
108529
108749
  if (found !== void 0) return found;
@@ -108601,7 +108821,7 @@ function rpcMessage(request3) {
108601
108821
  const parsed = parseJson3(decodeText2(request3.body));
108602
108822
  if (!parsed.ok) return void 0;
108603
108823
  const value = isList(parsed.value) ? parsed.value[0] : parsed.value;
108604
- return isRecord8(value) ? value : void 0;
108824
+ return isRecord9(value) ? value : void 0;
108605
108825
  }
108606
108826
  function replayTransport(exchanges, route) {
108607
108827
  let next = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxagen/cli",
3
- "version": "2.1.4-380",
3
+ "version": "2.1.4-383",
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": {