@nathapp/nax 0.70.0-canary.2 → 0.70.0-canary.3

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 +46 -12
  2. package/package.json +1 -1
package/dist/nax.js CHANGED
@@ -21022,6 +21022,7 @@ class AcpAgentAdapter {
21022
21022
  const MAX_TURNS = opts.maxTurns ?? 10;
21023
21023
  let totalTokenUsage = { inputTokens: 0, outputTokens: 0 };
21024
21024
  let totalExactCostUsd;
21025
+ const interactions = [];
21025
21026
  let turnCount = 0;
21026
21027
  let lastResponse = null;
21027
21028
  let timedOut = false;
@@ -21106,6 +21107,7 @@ class AcpAgentAdapter {
21106
21107
  })
21107
21108
  ]);
21108
21109
  if (response) {
21110
+ interactions.push({ turnIndex: turnCount, question, reply: response.answer });
21109
21111
  currentPrompt = response.answer;
21110
21112
  continue;
21111
21113
  }
@@ -21136,7 +21138,8 @@ class AcpAgentAdapter {
21136
21138
  tokenUsage,
21137
21139
  estimatedCostUsd,
21138
21140
  exactCostUsd,
21139
- internalRoundTrips: turnCount
21141
+ internalRoundTrips: turnCount,
21142
+ ...interactions.length > 0 ? { interactions } : {}
21140
21143
  };
21141
21144
  }
21142
21145
  async closeSession(handle) {
@@ -22139,6 +22142,7 @@ class AgentManager {
22139
22142
  sessionId: handle.protocolIds?.sessionId ?? null,
22140
22143
  recordId: handle.protocolIds?.recordId ?? null
22141
22144
  },
22145
+ ...result.interactions?.length ? { interactions: result.interactions } : {},
22142
22146
  origin: "runAsSession",
22143
22147
  ...opts.callId !== undefined ? { callId: opts.callId } : {},
22144
22148
  ...opts.scopeId !== undefined ? { scopeId: opts.scopeId } : {}
@@ -44729,11 +44733,22 @@ function buildTxtContent(entry) {
44729
44733
  "",
44730
44734
  "=== RESPONSE ===",
44731
44735
  "",
44732
- entry.response
44736
+ entry.response,
44737
+ ...buildInteractionLines(entry.interactions)
44733
44738
  ];
44734
44739
  return lines.join(`
44735
44740
  `);
44736
44741
  }
44742
+ function buildInteractionLines(interactions) {
44743
+ if (!interactions?.length)
44744
+ return [];
44745
+ const lines = ["", "=== INTERACTIONS ===", ""];
44746
+ for (const ix of interactions) {
44747
+ lines.push(`[turn ${ix.turnIndex}] Q: ${ix.question}`, ` A: ${ix.reply}`, "");
44748
+ }
44749
+ lines.pop();
44750
+ return lines;
44751
+ }
44737
44752
 
44738
44753
  class PromptAuditor {
44739
44754
  _queue = Promise.resolve();
@@ -45242,7 +45257,8 @@ function attachAuditSubscriber(bus, auditor, runId) {
45242
45257
  ...event.kind === "session-turn" && {
45243
45258
  sessionId: event.protocolIds.sessionId ?? null,
45244
45259
  recordId: event.protocolIds.recordId ?? null,
45245
- turn: event.turn
45260
+ turn: event.turn,
45261
+ ...event.interactions?.length ? { interactions: event.interactions } : {}
45246
45262
  }
45247
45263
  };
45248
45264
  auditor.record(entry);
@@ -55155,7 +55171,8 @@ async function runRectification(ctx, state, phaseCosts, phaseOutputs, overrides)
55155
55171
  break;
55156
55172
  }
55157
55173
  }
55158
- const validated = rectification.postValidate ? await rectification.postValidate(findings, _validateCtx) : findings;
55174
+ const postValidateFn = overrides?.postValidate ?? rectification.postValidate;
55175
+ const validated = postValidateFn ? await postValidateFn(findings, _validateCtx) : findings;
55159
55176
  return { findings: validated, shortCircuited };
55160
55177
  }
55161
55178
  };
@@ -55325,7 +55342,8 @@ class ExecutionPlan {
55325
55342
  strategies: this.state.nonBlockingFixStrategies ?? [],
55326
55343
  excludePhaseKinds: nonBlockingExcludePhases(),
55327
55344
  extraRevalidationKinds: nonBlockingExtraPhases(advCfg),
55328
- maxAttempts
55345
+ maxAttempts,
55346
+ postValidate: this.state.nonBlockingFixPostValidate
55329
55347
  })
55330
55348
  });
55331
55349
  }
@@ -55421,9 +55439,10 @@ class StoryOrchestratorBuilder {
55421
55439
  this.state.rectification = opts;
55422
55440
  return this;
55423
55441
  }
55424
- addNonBlockingFix(cfg, strategies) {
55442
+ addNonBlockingFix(cfg, strategies, postValidate) {
55425
55443
  this.state.nonBlockingFix = cfg;
55426
55444
  this.state.nonBlockingFixStrategies = strategies;
55445
+ this.state.nonBlockingFixPostValidate = postValidate;
55427
55446
  return this;
55428
55447
  }
55429
55448
  build(ctx, opts = {}) {
@@ -55553,10 +55572,10 @@ async function buildPlanForStrategy(ctx, story, config2, testStrategy, inputs) {
55553
55572
  if (inputs.adversarialReview) {
55554
55573
  builder.addAdversarialReview(inputs.adversarialReview);
55555
55574
  }
55575
+ const packageDir = join47(ctx.packageDir, story.workdir ?? "");
55576
+ const resolvedTestPatterns = await resolveTestFilePatterns(config2, ctx.packageDir, story.workdir);
55556
55577
  if (shouldRunRectification(config2) && inputs.rectification) {
55557
55578
  const sink = makeDeclarationSink();
55558
- const packageDir = join47(ctx.packageDir, story.workdir ?? "");
55559
- const resolvedTestPatterns = await resolveTestFilePatterns(config2, ctx.packageDir, story.workdir);
55560
55579
  const strategies = [];
55561
55580
  const pkgQuality = ctx.packageView.select(qualityConfigSelector).quality;
55562
55581
  if (pkgQuality?.commands?.lintFix || pkgQuality?.commands?.lintFixScoped) {
@@ -55612,7 +55631,22 @@ async function buildPlanForStrategy(ctx, story, config2, testStrategy, inputs) {
55612
55631
  }), makeAutofixTestWriterStrategy(story, config2, nbSink));
55613
55632
  }
55614
55633
  nbStrategies.push(makeFullSuiteRectifyStrategy(story, config2, nbSink));
55615
- builder.addNonBlockingFix(nbf, nbStrategies);
55634
+ const nbPostValidate = async (findings, _validateCtx) => {
55635
+ if (nbSink.testEdits.length === 0 && nbSink.mockHandoffs.length === 0)
55636
+ return findings;
55637
+ const pendingMock = nbSink.mockHandoffs.map((h) => ({
55638
+ reason: "mock_structure",
55639
+ file: h.files[0] ?? "",
55640
+ files: h.files,
55641
+ reasonDetail: h.reasonDetail
55642
+ }));
55643
+ const { valid, invalid } = await validateMockStructureFiles(pendingMock, resolvedTestPatterns, packageDir);
55644
+ nbSink.mockHandoffs = valid.map((d) => ({ files: d.files ?? [], reasonDetail: d.reasonDetail ?? "" }));
55645
+ const allDeclarations = [...nbSink.testEdits, ...valid];
55646
+ nbSink.testEdits = [];
55647
+ return applyTestEditDeclarations(findings, allDeclarations, story, invalid);
55648
+ };
55649
+ builder.addNonBlockingFix(nbf, nbStrategies, nbPostValidate);
55616
55650
  }
55617
55651
  return builder.build(ctx, { isThreeSession });
55618
55652
  }
@@ -60211,7 +60245,7 @@ var package_default;
60211
60245
  var init_package = __esm(() => {
60212
60246
  package_default = {
60213
60247
  name: "@nathapp/nax",
60214
- version: "0.70.0-canary.2",
60248
+ version: "0.70.0-canary.3",
60215
60249
  description: "AI Coding Agent Orchestrator \u2014 loops until done",
60216
60250
  type: "module",
60217
60251
  bin: {
@@ -60306,8 +60340,8 @@ var init_version = __esm(() => {
60306
60340
  NAX_VERSION = package_default.version;
60307
60341
  NAX_COMMIT = (() => {
60308
60342
  try {
60309
- if (/^[0-9a-f]{6,10}$/.test("b070f4c1"))
60310
- return "b070f4c1";
60343
+ if (/^[0-9a-f]{6,10}$/.test("905b80cf"))
60344
+ return "905b80cf";
60311
60345
  } catch {}
60312
60346
  try {
60313
60347
  const result = Bun.spawnSync(["git", "rev-parse", "--short", "HEAD"], {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nathapp/nax",
3
- "version": "0.70.0-canary.2",
3
+ "version": "0.70.0-canary.3",
4
4
  "description": "AI Coding Agent Orchestrator — loops until done",
5
5
  "type": "module",
6
6
  "bin": {