@nathapp/nax 0.75.0 → 0.75.2

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/dist/nax.js +93 -32
  2. package/package.json +1 -1
package/dist/nax.js CHANGED
@@ -20396,6 +20396,60 @@ var init_env = __esm(() => {
20396
20396
  ];
20397
20397
  });
20398
20398
 
20399
+ // src/agents/acp/model-spec.ts
20400
+ function parseModelSpec(raw) {
20401
+ const match = EFFORT_SUFFIX.exec(raw);
20402
+ if (!match)
20403
+ return { model: raw };
20404
+ return { model: match[1], effort: match[2] };
20405
+ }
20406
+ var EFFORT_SUFFIX;
20407
+ var init_model_spec = __esm(() => {
20408
+ EFFORT_SUFFIX = /^([^[\]]+)\[([^[\]]+)\]$/;
20409
+ });
20410
+
20411
+ // src/agents/acp/reasoning-effort.ts
20412
+ async function applyReasoningEffort(params) {
20413
+ const { effort, agentName, sessionName, cwd, storyId, spawn: spawn2 } = params;
20414
+ if (!effort)
20415
+ return;
20416
+ const cmd = ["acpx", "--cwd", cwd, agentName, "set", "reasoning_effort", effort, "-s", sessionName];
20417
+ const { exitCode, stdout, stderr } = await spawn2(cmd);
20418
+ if (exitCode !== 0) {
20419
+ getSafeLogger()?.warn("acp-adapter", "Failed to set reasoning_effort; continuing at adapter default", {
20420
+ storyId,
20421
+ effort,
20422
+ session: sessionName,
20423
+ cause: stdout || stderr
20424
+ });
20425
+ }
20426
+ }
20427
+ var init_reasoning_effort = __esm(() => {
20428
+ init_logger2();
20429
+ });
20430
+
20431
+ // src/agents/acp/session-ids.ts
20432
+ function parseSessionIds(stdout) {
20433
+ for (const line of stdout.split(`
20434
+ `).reverse()) {
20435
+ const trimmed = line.trim();
20436
+ if (!trimmed.startsWith("{"))
20437
+ continue;
20438
+ try {
20439
+ const parsed = JSON.parse(trimmed);
20440
+ const sessionId = parsed.acpxSessionId;
20441
+ const recordId = parsed.acpxRecordId;
20442
+ if (typeof sessionId === "string" && sessionId.length > 0) {
20443
+ return {
20444
+ sessionId,
20445
+ recordId: typeof recordId === "string" && recordId.length > 0 ? recordId : undefined
20446
+ };
20447
+ }
20448
+ } catch {}
20449
+ }
20450
+ return { sessionId: undefined, recordId: undefined };
20451
+ }
20452
+
20399
20453
  // src/agents/acp/spawn-client.ts
20400
20454
  import { randomUUID } from "crypto";
20401
20455
  async function readAndParseLines(stream, state, onActivity) {
@@ -20438,6 +20492,7 @@ class SpawnAcpSession {
20438
20492
  sessionName;
20439
20493
  cwd;
20440
20494
  model;
20495
+ modelLabel;
20441
20496
  timeoutSeconds;
20442
20497
  promptRetries;
20443
20498
  permissionMode;
@@ -20458,6 +20513,7 @@ class SpawnAcpSession {
20458
20513
  this.sessionName = opts.sessionName;
20459
20514
  this.cwd = opts.cwd;
20460
20515
  this.model = opts.model;
20516
+ this.modelLabel = opts.modelLabel ?? opts.model;
20461
20517
  this.timeoutSeconds = opts.timeoutSeconds;
20462
20518
  this.promptRetries = opts.promptRetries;
20463
20519
  this.permissionMode = opts.permissionMode;
@@ -20530,7 +20586,7 @@ class SpawnAcpSession {
20530
20586
  emit?.({
20531
20587
  ...baseEvent,
20532
20588
  kind: "agent.call_started",
20533
- model: this.model,
20589
+ model: this.modelLabel,
20534
20590
  timeoutSeconds: this.timeoutSeconds,
20535
20591
  timestamp: now()
20536
20592
  });
@@ -20701,29 +20757,11 @@ class SpawnAcpSession {
20701
20757
  await this.trackedSpawn(cmd);
20702
20758
  }
20703
20759
  }
20704
- function parseSessionIds(stdout) {
20705
- for (const line of stdout.split(`
20706
- `).reverse()) {
20707
- const trimmed = line.trim();
20708
- if (!trimmed.startsWith("{"))
20709
- continue;
20710
- try {
20711
- const parsed = JSON.parse(trimmed);
20712
- const sessionId = parsed.acpxSessionId;
20713
- const recordId = parsed.acpxRecordId;
20714
- if (typeof sessionId === "string" && sessionId.length > 0) {
20715
- return {
20716
- sessionId,
20717
- recordId: typeof recordId === "string" && recordId.length > 0 ? recordId : undefined
20718
- };
20719
- }
20720
- } catch {}
20721
- }
20722
- return { sessionId: undefined, recordId: undefined };
20723
- }
20724
20760
 
20725
20761
  class SpawnAcpClient {
20726
20762
  model;
20763
+ rawModel;
20764
+ reasoningEffort;
20727
20765
  cwd;
20728
20766
  timeoutSeconds;
20729
20767
  promptRetries;
@@ -20738,7 +20776,11 @@ class SpawnAcpClient {
20738
20776
  constructor(cmdStr, cwd, timeoutSeconds, onPidSpawned, promptRetries, onPidExited, opts) {
20739
20777
  const parts = cmdStr.split(/\s+/);
20740
20778
  const modelIdx = parts.indexOf("--model");
20741
- this.model = modelIdx >= 0 && parts[modelIdx + 1] ? parts[modelIdx + 1] : "default";
20779
+ const rawModel = modelIdx >= 0 && parts[modelIdx + 1] ? parts[modelIdx + 1] : "default";
20780
+ const spec = parseModelSpec(rawModel);
20781
+ this.rawModel = rawModel;
20782
+ this.model = spec.model;
20783
+ this.reasoningEffort = spec.effort;
20742
20784
  const lastToken = parts[parts.length - 1];
20743
20785
  if (!lastToken || lastToken.startsWith("-")) {
20744
20786
  throw new Error(`[acp-adapter] Could not parse agentName from cmdStr: "${cmdStr}"`);
@@ -20794,11 +20836,20 @@ class SpawnAcpClient {
20794
20836
  throw new Error(`[acp-adapter] Failed to create session: ${stdout || stderr || `exit code ${exitCode}`}`);
20795
20837
  }
20796
20838
  const { sessionId, recordId } = parseSessionIds(stdout);
20839
+ await applyReasoningEffort({
20840
+ effort: this.reasoningEffort,
20841
+ agentName: opts.agentName,
20842
+ sessionName,
20843
+ cwd: this.cwd,
20844
+ storyId: this.storyId,
20845
+ spawn: (c) => this.trackedSpawn(c)
20846
+ });
20797
20847
  return new SpawnAcpSession({
20798
20848
  agentName: opts.agentName,
20799
20849
  sessionName,
20800
20850
  cwd: this.cwd,
20801
20851
  model: this.model,
20852
+ modelLabel: this.rawModel,
20802
20853
  timeoutSeconds: this.timeoutSeconds,
20803
20854
  promptRetries: this.promptRetries,
20804
20855
  permissionMode: opts.permissionMode,
@@ -20821,11 +20872,20 @@ class SpawnAcpClient {
20821
20872
  return null;
20822
20873
  }
20823
20874
  const { sessionId, recordId } = parseSessionIds(stdout);
20875
+ await applyReasoningEffort({
20876
+ effort: this.reasoningEffort,
20877
+ agentName,
20878
+ sessionName,
20879
+ cwd: this.cwd,
20880
+ storyId: this.storyId,
20881
+ spawn: (c) => this.trackedSpawn(c)
20882
+ });
20824
20883
  return new SpawnAcpSession({
20825
20884
  agentName,
20826
20885
  sessionName,
20827
20886
  cwd: this.cwd,
20828
20887
  model: this.model,
20888
+ modelLabel: this.rawModel,
20829
20889
  timeoutSeconds: this.timeoutSeconds,
20830
20890
  promptRetries: this.promptRetries,
20831
20891
  permissionMode,
@@ -20864,6 +20924,8 @@ var init_spawn_client = __esm(() => {
20864
20924
  init_logger2();
20865
20925
  init_bun_deps();
20866
20926
  init_env();
20927
+ init_model_spec();
20928
+ init_reasoning_effort();
20867
20929
  _spawnClientDeps = {
20868
20930
  spawn: typedSpawn,
20869
20931
  streamDrainTimeoutMs: ACPX_STREAM_DRAIN_TIMEOUT_MS
@@ -21721,6 +21783,7 @@ var init_acp = __esm(() => {
21721
21783
  init_spawn_client();
21722
21784
  init_adapter_lifecycle();
21723
21785
  init_token_mapper();
21786
+ init_model_spec();
21724
21787
  });
21725
21788
 
21726
21789
  // src/agents/registry.ts
@@ -36810,11 +36873,11 @@ var init_adversarial_review = __esm(() => {
36810
36873
  category: f.category
36811
36874
  });
36812
36875
  }
36813
- const hadBlockingSeverity = accepted.some((f) => isBlockingSeverity(f.severity, threshold));
36814
- const passed = blocking.length === 0 && (parsed.passed || hadBlockingSeverity);
36876
+ const passed = blocking.length === 0 && (parsed.passed || accepted.length > 0);
36815
36877
  return {
36816
36878
  ...parsed,
36817
36879
  passed,
36880
+ modelPassed: parsed.passed,
36818
36881
  findings: accepted,
36819
36882
  normalizedFindings: toAdversarialReviewFindings(blocking, { isTestFile: testFileMatch }),
36820
36883
  advisoryFindings: [
@@ -42430,7 +42493,7 @@ var package_default;
42430
42493
  var init_package = __esm(() => {
42431
42494
  package_default = {
42432
42495
  name: "@nathapp/nax",
42433
- version: "0.75.0",
42496
+ version: "0.75.2",
42434
42497
  description: "AI Coding Agent Orchestrator \u2014 loops until done",
42435
42498
  type: "module",
42436
42499
  bin: {
@@ -42533,8 +42596,8 @@ var init_version = __esm(() => {
42533
42596
  NAX_VERSION = package_default.version;
42534
42597
  NAX_COMMIT = (() => {
42535
42598
  try {
42536
- if (/^[0-9a-f]{6,10}$/.test("05b2a123"))
42537
- return "05b2a123";
42599
+ if (/^[0-9a-f]{6,10}$/.test("8538e8f4"))
42600
+ return "8538e8f4";
42538
42601
  } catch {}
42539
42602
  try {
42540
42603
  const result = Bun.spawnSync(["git", "rev-parse", "--short", "HEAD"], {
@@ -43047,12 +43110,10 @@ ${formatFindings(blockingFindings)}` : "Adversarial review failed (no findings)"
43047
43110
  cost: llmCost
43048
43111
  };
43049
43112
  }
43050
- if (!opResult.passed && acDropped.length > 0) {
43051
- const allHallucinated = acDropped.every((d) => d.code === "ac_quote_not_substring");
43052
- if (allHallucinated) {
43113
+ if (!opResult.modelPassed && acDropped.length > 0) {
43114
+ if (acDropped.every((d) => d.code === "ac_quote_not_substring")) {
43053
43115
  const demotedFindings = toAdversarialReviewFindings(acDropped.map((d) => ({ ...d.finding, severity: "warning", acQuote: undefined, acIndex: undefined })), { isTestFile: testFileMatch });
43054
- const existingAdvisory = advisoryFindings.length > 0 ? advisoryFindingsAsFindings : [];
43055
- const allAdvisory = [...existingAdvisory, ...demotedFindings];
43116
+ const allAdvisory = [...advisoryFindingsAsFindings, ...demotedFindings];
43056
43117
  logger?.warn("review", "Adversarial review passed: all blocking findings discarded as hallucinated AC quotes", {
43057
43118
  storyId: story.id,
43058
43119
  durationMs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nathapp/nax",
3
- "version": "0.75.0",
3
+ "version": "0.75.2",
4
4
  "description": "AI Coding Agent Orchestrator — loops until done",
5
5
  "type": "module",
6
6
  "bin": {