@oxagen/cli 3.0.1-34 → 3.0.1-44

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 +48 -11
  2. package/package.json +1 -1
package/oxagen.mjs CHANGED
@@ -10042,7 +10042,7 @@ function translateCursorPayload(raw) {
10042
10042
  }
10043
10043
  if (typeof toolName4 === "string") {
10044
10044
  out["tool_name"] = cursorToolName(toolName4, raw["mcp_server_name"]);
10045
- out["cursor_tool_name"] = toolName4;
10045
+ out["harness_tool_name"] = toolName4;
10046
10046
  }
10047
10047
  if (isRecord(toolInput2)) out["tool_input"] = toolInput2;
10048
10048
  else if (typeof toolInput2 === "string") {
@@ -11626,6 +11626,9 @@ function isRecord2(value) {
11626
11626
  function str2(value) {
11627
11627
  return typeof value === "string" && value.length > 0 ? value : void 0;
11628
11628
  }
11629
+ function harnessToolNameOf(input) {
11630
+ return str2(input["harness_tool_name"]) ?? str2(input["cursor_tool_name"]);
11631
+ }
11629
11632
  function count(value) {
11630
11633
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.round(value) : void 0;
11631
11634
  }
@@ -11700,7 +11703,7 @@ function backgroundTasksOf(value) {
11700
11703
  function sessionCronsOf(value) {
11701
11704
  return pickEach(value, SESSION_CRON_MEMBERS);
11702
11705
  }
11703
- var ORIGIN_MEMBERS, ORIGIN_HOP_CHAIN, BACKGROUND_TASK_MEMBERS, SESSION_CRON_MEMBERS, MEMBER_MAX, HOP_CHAIN_MAX, ERROR_CLASS_MAX, EXIT_CODE_PREFIX, ATTR_KEY_MAX, ATTR_MAX, ATTR_CUT;
11706
+ var ORIGIN_MEMBERS, ORIGIN_HOP_CHAIN, BACKGROUND_TASK_MEMBERS, SESSION_CRON_MEMBERS, MEMBER_MAX, HOP_CHAIN_MAX, HARNESS_TOOL_NAME_ATTR, ERROR_CLASS_MAX, EXIT_CODE_PREFIX, ATTR_KEY_MAX, ATTR_MAX, ATTR_CUT;
11704
11707
  var init_payload_members = __esm({
11705
11708
  "../../packages/tacho/src/claude-code/payload-members.ts"() {
11706
11709
  "use strict";
@@ -11730,6 +11733,7 @@ var init_payload_members = __esm({
11730
11733
  SESSION_CRON_MEMBERS = ["id", "schedule", "recurring"];
11731
11734
  MEMBER_MAX = 512;
11732
11735
  HOP_CHAIN_MAX = 32;
11736
+ HARNESS_TOOL_NAME_ATTR = "oxagen.harness_tool_name";
11733
11737
  ERROR_CLASS_MAX = 128;
11734
11738
  EXIT_CODE_PREFIX = /^(?:Error: )?Exit code (-?\d+)\b/;
11735
11739
  ATTR_KEY_MAX = 256;
@@ -11940,6 +11944,8 @@ function translateStellaPayload(raw, pid, instance) {
11940
11944
  out["tool_read_only"] = tool["read_only"];
11941
11945
  }
11942
11946
  if (toolResult2 !== void 0) out["tool_response"] = toolResult2;
11947
+ const exitCode = isRecord2(tool) ? stellaExitCode(tool["name"], toolResult2) : void 0;
11948
+ if (exitCode !== void 0) out["exit_code"] = exitCode;
11943
11949
  if (finalText !== void 0) out["last_assistant_message"] = finalText;
11944
11950
  if (subagentResult !== void 0) out["subagent_result"] = subagentResult;
11945
11951
  const subagent = rest["subagent"];
@@ -11950,6 +11956,23 @@ function translateStellaPayload(raw, pid, instance) {
11950
11956
  }
11951
11957
  return out;
11952
11958
  }
11959
+ function stellaExitCode(name, result2) {
11960
+ if (typeof name !== "string" || typeof result2 !== "string") return void 0;
11961
+ let match = null;
11962
+ if (name === "bash") {
11963
+ const at2 = result2.lastIndexOf(BASH_EXIT_MARKER);
11964
+ if (at2 === -1) return void 0;
11965
+ match = /^\n\[exit code: (-?\d+)\]/.exec(result2.slice(at2, at2 + 32));
11966
+ } else {
11967
+ const opening = `custom tool \`${name}\` exited with code `;
11968
+ if (!result2.startsWith(opening)) return void 0;
11969
+ match = /^(-?\d+)(?:\n|$)/.exec(
11970
+ result2.slice(opening.length, opening.length + 16)
11971
+ );
11972
+ }
11973
+ const code = match?.[1] === void 0 ? void 0 : Number(match[1]);
11974
+ return isExitCode(code) ? code : void 0;
11975
+ }
11953
11976
  function digestSubagentInstruction(subagent) {
11954
11977
  const { instructionPreview, ...keep } = subagent;
11955
11978
  if (typeof instructionPreview !== "string") return keep;
@@ -12010,7 +12033,7 @@ function tryParseAnswerBody(body2) {
12010
12033
  return void 0;
12011
12034
  }
12012
12035
  }
12013
- var SHELLS, STELLA_PID_ENV, STELLA_PS_BUDGET_MS, STELLA_PS_FLOOR_MS, STELLA_IDENTITY_FRESH_MS, STELLA_IDENTITY_TRUST_MS, identityCacheSchema;
12036
+ var SHELLS, STELLA_PID_ENV, STELLA_PS_BUDGET_MS, STELLA_PS_FLOOR_MS, STELLA_IDENTITY_FRESH_MS, STELLA_IDENTITY_TRUST_MS, identityCacheSchema, BASH_EXIT_MARKER;
12014
12037
  var init_stella_adapter = __esm({
12015
12038
  "../../packages/tacho/src/claude-code/stella-adapter.ts"() {
12016
12039
  "use strict";
@@ -12042,6 +12065,7 @@ var init_stella_adapter = __esm({
12042
12065
  check: external_exports.string().min(1).optional(),
12043
12066
  confirmed_at: external_exports.number()
12044
12067
  });
12068
+ BASH_EXIT_MARKER = "\n[exit code: ";
12045
12069
  }
12046
12070
  });
12047
12071
 
@@ -12926,6 +12950,10 @@ function effortFactOf(value) {
12926
12950
  const effort = str2(value);
12927
12951
  return effort !== void 0 ? { effort } : {};
12928
12952
  }
12953
+ function harnessToolNameAttr(input) {
12954
+ const name = harnessToolNameOf(input);
12955
+ return name === void 0 ? {} : { [HARNESS_TOOL_NAME_ATTR]: attrValue(name) };
12956
+ }
12929
12957
  function normalizeHook(raw, env, options) {
12930
12958
  const input = hookInputSchema.parse(raw);
12931
12959
  const repairs = payloadRepairs(raw);
@@ -12933,6 +12961,7 @@ function normalizeHook(raw, env, options) {
12933
12961
  hook_event_name: input.hook_event_name,
12934
12962
  attrs: {
12935
12963
  ...leftovers(input),
12964
+ ...harnessToolNameAttr(input),
12936
12965
  ...repairs !== void 0 ? { [PAYLOAD_REPAIRS_ATTR]: attrValue(repairs) } : {}
12937
12966
  },
12938
12967
  ...input.agent_id !== void 0 ? {
@@ -13543,6 +13572,10 @@ var init_hooks = __esm({
13543
13572
  // The exit code an adapter read from its harness's tool output. It is the
13544
13573
  // `tool_exit_code` fact, never an attribute.
13545
13574
  "exit_code",
13575
+ // The tool's name as its harness sent it, when an adapter renamed the
13576
+ // tool. Both spellings land on `HARNESS_TOOL_NAME_ATTR` (#7188).
13577
+ "harness_tool_name",
13578
+ "cursor_tool_name",
13546
13579
  // What a payload cut to fit said of the whole response (`fitHookPayload`):
13547
13580
  // the `tool_output_bytes` and `tool_output_digest` facts.
13548
13581
  TOOL_RESPONSE_ORIGINAL_BYTES,
@@ -13786,14 +13819,15 @@ function evaluateToolPermission(host, local, now, eventName, toolName4, toolInpu
13786
13819
  };
13787
13820
  }
13788
13821
  function decideLocally(host, input, now, match = localMatchContext(), cedar) {
13822
+ const harnessTool = harnessToolNameOf(input);
13789
13823
  const cedarFor = (action) => host.bundle.cedar === void 0 ? void 0 : {
13790
13824
  runtime: cedar?.runtime ?? null,
13791
13825
  harness: cedar?.agent !== void 0 ? "custom" : cedar?.harness ?? "claude-code",
13792
13826
  ...cedar?.agent !== void 0 ? { agent: cedar.agent } : {},
13793
13827
  ...input.agent_type !== void 0 ? { skill: input.agent_type } : {},
13794
13828
  ...action !== void 0 ? { action } : {},
13795
- // Cursor's adapter renames `Shell` to `Bash` and keeps Cursor's own name here.
13796
- ...typeof input["cursor_tool_name"] === "string" ? { harness_tool: input["cursor_tool_name"] } : {}
13829
+ // Cursor's adapter renames `Shell` to `Bash` and keeps Cursor's own name.
13830
+ ...harnessTool !== void 0 ? { harness_tool: harnessTool } : {}
13797
13831
  };
13798
13832
  const bundleVerified = verifyBundle(
13799
13833
  host.bundle,
@@ -14310,6 +14344,7 @@ var init_hook_client = __esm({
14310
14344
  init_runtime();
14311
14345
  init_hook_payload_fit();
14312
14346
  init_hooks();
14347
+ init_payload_members();
14313
14348
  init_stella_adapter();
14314
14349
  CURSOR_UNREADABLE_PAYLOAD = "Oxagen could not read this hook payload, so it cannot say what this agent is permitted to do. Run `oxagen agent status` and check that the wrapper matches this version of Cursor.";
14315
14350
  UNREADABLE_ENROLLMENT = "Oxagen cannot read this machine's enrollment, so it cannot say what this agent is permitted to do. Run `oxagen agent status` to repair it.";
@@ -16242,12 +16277,13 @@ function readLine(line, state, fallbackTs, inputs) {
16242
16277
  return { normalized: NOTHING, state };
16243
16278
  }
16244
16279
  }
16245
- var KNOWN_RECORDS, INPUT_ITEMS, TOOL_ITEMS, LOCAL_TOOL_ITEMS, OUTPUT_ITEMS, TURN_EVENTS, UNKNOWN_TYPES_MAX, UNKNOWN_TYPE_CHARS, KINDS_MAX, CALLS_MAX, PENDING_CALLS_MAX, HELD_INPUT_BYTES_MAX, HARNESS_TOOL_NAME_ATTR, COMMAND_TOOL, BARE2, SINGLE, DOUBLE, heldInputs, NOTHING;
16280
+ var KNOWN_RECORDS, INPUT_ITEMS, TOOL_ITEMS, LOCAL_TOOL_ITEMS, OUTPUT_ITEMS, TURN_EVENTS, UNKNOWN_TYPES_MAX, UNKNOWN_TYPE_CHARS, KINDS_MAX, CALLS_MAX, PENDING_CALLS_MAX, HELD_INPUT_BYTES_MAX, COMMAND_TOOL, BARE2, SINGLE, DOUBLE, heldInputs, NOTHING;
16246
16281
  var init_rollout = __esm({
16247
16282
  "../../packages/tacho/src/codex/rollout.ts"() {
16248
16283
  "use strict";
16249
16284
  init_digest();
16250
16285
  init_frame_body();
16286
+ init_payload_members();
16251
16287
  init_replay_grade();
16252
16288
  init_wire();
16253
16289
  KNOWN_RECORDS = /* @__PURE__ */ new Set([
@@ -16302,7 +16338,6 @@ var init_rollout = __esm({
16302
16338
  CALLS_MAX = 32;
16303
16339
  PENDING_CALLS_MAX = 32;
16304
16340
  HELD_INPUT_BYTES_MAX = 2 * TACHO_MAX_BODY_BYTES;
16305
- HARNESS_TOOL_NAME_ATTR = "oxagen.harness_tool_name";
16306
16341
  COMMAND_TOOL = "Bash";
16307
16342
  BARE2 = 1;
16308
16343
  SINGLE = 2;
@@ -28007,7 +28042,7 @@ import { readFileSync as readFileSync10 } from "node:fs";
28007
28042
  import { dirname as dirname9, resolve as resolve3 } from "node:path";
28008
28043
  import { fileURLToPath } from "node:url";
28009
28044
  function readVersion() {
28010
- if (true) return "3.0.1-34";
28045
+ if (true) return "3.0.1-44";
28011
28046
  try {
28012
28047
  const here = dirname9(fileURLToPath(import.meta.url));
28013
28048
  const pkg = JSON.parse(
@@ -45617,6 +45652,7 @@ async function cedarCallFor(view, record, input, deps, toolName4, action) {
45617
45652
  if (view.bundle.cedar === void 0) return void 0;
45618
45653
  const custom2 = record.customAgent;
45619
45654
  const facts = policyRunFacts(record);
45655
+ const harnessTool = harnessToolNameOf(input);
45620
45656
  return {
45621
45657
  ...oxagenServerVerified(view, record, input, deps, toolName4) ? { oxagenServerVerified: true } : {},
45622
45658
  // No loader means no evaluator: a mutating tool is refused rather than
@@ -45626,8 +45662,8 @@ async function cedarCallFor(view, record, input, deps, toolName4, action) {
45626
45662
  ...custom2 !== void 0 ? { agent: custom2 } : {},
45627
45663
  ...input.agent_type !== void 0 ? { skill: input.agent_type } : {},
45628
45664
  ...action !== void 0 ? { action } : {},
45629
- // Cursor's adapter renames `Shell` to `Bash` and keeps Cursor's own name here.
45630
- ...typeof input["cursor_tool_name"] === "string" ? { harness_tool: input["cursor_tool_name"] } : {},
45665
+ // Cursor's adapter renames `Shell` to `Bash` and keeps Cursor's own name.
45666
+ ...harnessTool !== void 0 ? { harness_tool: harnessTool } : {},
45631
45667
  // The taint and prior calls of the calls that ran in the session (#4666).
45632
45668
  facts
45633
45669
  };
@@ -46413,6 +46449,7 @@ var init_hook_handler = __esm({
46413
46449
  "use strict";
46414
46450
  init_hooks();
46415
46451
  init_context();
46452
+ init_payload_members();
46416
46453
  init_tools();
46417
46454
  init_steering_manifest();
46418
46455
  init_frame_body();
@@ -68265,7 +68302,7 @@ var init_package = __esm({
68265
68302
  "package.json"() {
68266
68303
  package_default = {
68267
68304
  name: "@oxagen/cli",
68268
- version: "3.0.1-34",
68305
+ version: "3.0.1-44",
68269
68306
  description: "Oxagen governance CLI: spend, source tracking, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
68270
68307
  type: "module",
68271
68308
  main: "./dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxagen/cli",
3
- "version": "3.0.1-34",
3
+ "version": "3.0.1-44",
4
4
  "description": "Oxagen governance CLI: spend, source tracking, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
5
5
  "type": "module",
6
6
  "bin": {