@nathapp/nax 0.67.0-canary.4 → 0.67.0-canary.5

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 +44 -33
  2. package/package.json +1 -1
package/dist/nax.js CHANGED
@@ -34141,7 +34141,7 @@ var init_autofix_implementer = __esm(() => {
34141
34141
  kind: "run",
34142
34142
  name: "autofix-implementer",
34143
34143
  stage: "rectification",
34144
- session: { role: "implementer", lifetime: "fresh" },
34144
+ session: { role: "implementer", lifetime: "warm" },
34145
34145
  config: autofixConfigSelector,
34146
34146
  build(input, _ctx) {
34147
34147
  const prompt = RectifierPromptBuilder.reviewRectification(input.failedChecks, input.story);
@@ -39573,17 +39573,22 @@ ${finalPrompt}`;
39573
39573
  const maxTransportRetries = config2.execution?.sessionErrorRetryableMaxRetries ?? 3;
39574
39574
  while (true) {
39575
39575
  if (!heldHandle) {
39576
- heldHandle = await runtime.sessionManager.openSession(rectificationSessionName, {
39577
- agentName: defaultAgent,
39578
- role: "implementer",
39579
- workdir,
39580
- pipelineStage: "rectification",
39581
- modelDef,
39582
- timeoutSeconds: config2.execution.sessionTimeoutSeconds,
39583
- featureName,
39584
- storyId: story.id,
39585
- signal: runtime.signal
39586
- });
39576
+ const existingHandle = runtime.sessionManager.getLiveHandle(rectificationSessionName);
39577
+ if (existingHandle && existingHandle.agentName === defaultAgent) {
39578
+ heldHandle = existingHandle;
39579
+ } else {
39580
+ heldHandle = await runtime.sessionManager.openSession(rectificationSessionName, {
39581
+ agentName: defaultAgent,
39582
+ role: "implementer",
39583
+ workdir,
39584
+ pipelineStage: "rectification",
39585
+ modelDef,
39586
+ timeoutSeconds: config2.execution.sessionTimeoutSeconds,
39587
+ featureName,
39588
+ storyId: story.id,
39589
+ signal: runtime.signal
39590
+ });
39591
+ }
39587
39592
  }
39588
39593
  try {
39589
39594
  const turn = await agentManager.runAsSession(defaultAgent, heldHandle, prompt, {
@@ -41388,7 +41393,7 @@ function buildHopCallback(ctx, sessionId, _initialOptions) {
41388
41393
  prompt
41389
41394
  };
41390
41395
  } finally {
41391
- if (hopKind.kind !== "stale-retry") {
41396
+ if (hopKind.kind !== "stale-retry" && !resolvedRunOptions.keepOpen) {
41392
41397
  await sessionManager.closeSession(handle);
41393
41398
  }
41394
41399
  }
@@ -41576,6 +41581,7 @@ async function callOp(ctx, op, input) {
41576
41581
  featureName: ctx.featureName,
41577
41582
  storyId: ctx.storyId,
41578
41583
  callId,
41584
+ ...runOp.session.lifetime === "warm" ? { keepOpen: true } : {},
41579
41585
  ...ctx.scopeId !== undefined ? { scopeId: ctx.scopeId } : {},
41580
41586
  ...ctx.interactionBridge ? { interactionBridge: ctx.interactionBridge } : {},
41581
41587
  ...ctx.maxInteractionTurns !== undefined ? { maxInteractionTurns: ctx.maxInteractionTurns } : {}
@@ -50995,7 +51001,7 @@ var init_greenfield = __esm(() => {
50995
51001
  });
50996
51002
 
50997
51003
  // src/tdd/rectification-gate.ts
50998
- async function runFullSuiteGate(story, config2, workdir, agentManager, implementerTier, lite, logger, featureName, projectDir, sessionId, runtime) {
51004
+ async function runFullSuiteGate(story, config2, workdir, agentManager, implementerTier, lite, logger, featureName, projectDir, sessionManager, runtime) {
50999
51005
  const rectificationEnabled = config2.execution.rectification?.enabled ?? false;
51000
51006
  if (!rectificationEnabled) {
51001
51007
  return { passed: false, cost: 0, fullSuiteGatePassed: false, status: "disabled" };
@@ -51023,7 +51029,7 @@ async function runFullSuiteGate(story, config2, workdir, agentManager, implement
51023
51029
  });
51024
51030
  return { passed: true, cost: 0, fullSuiteGatePassed: false, status: "deferred-unattributable" };
51025
51031
  }
51026
- return await runRectificationLoop2(story, config2, workdir, agentManager, implementerTier, lite, logger, testSummary, rectificationConfig, effectiveTestCmd, fullSuiteTimeout, fullSuiteResult.output, runtime, featureName, projectDir, sessionId);
51032
+ return await runRectificationLoop2(story, config2, workdir, agentManager, implementerTier, lite, logger, testSummary, rectificationConfig, effectiveTestCmd, fullSuiteTimeout, fullSuiteResult.output, runtime, featureName, projectDir, sessionManager);
51027
51033
  }
51028
51034
  if (testSummary.failures.length > 0) {
51029
51035
  logger.warn("tdd", "Full suite gate: parser counter mismatch \u2014 failing gate (unreliable failure count)", {
@@ -51060,7 +51066,7 @@ async function runFullSuiteGate(story, config2, workdir, agentManager, implement
51060
51066
  });
51061
51067
  return { passed: false, cost: 0, fullSuiteGatePassed: false, status: "execution-failed" };
51062
51068
  }
51063
- async function runRectificationLoop2(story, config2, workdir, agentManager, implementerTier, lite, logger, testSummary, rectificationConfig, testCmd, fullSuiteTimeout, testOutput, runtime, featureName, projectDir, sessionId) {
51069
+ async function runRectificationLoop2(story, config2, workdir, agentManager, implementerTier, lite, logger, testSummary, rectificationConfig, testCmd, fullSuiteTimeout, testOutput, runtime, featureName, projectDir, sessionManager) {
51064
51070
  logger.warn("tdd", "Full suite gate detected regressions", {
51065
51071
  storyId: story.id,
51066
51072
  failedTests: testSummary.failed,
@@ -51119,17 +51125,22 @@ async function runRectificationLoop2(story, config2, workdir, agentManager, impl
51119
51125
  const maxTransportRetries = config2.execution?.sessionErrorRetryableMaxRetries ?? 3;
51120
51126
  while (true) {
51121
51127
  if (!heldHandle) {
51122
- heldHandle = await runtime.sessionManager.openSession(rectificationSessionName, {
51123
- agentName: defaultAgent,
51124
- role: "implementer",
51125
- workdir,
51126
- pipelineStage: "rectification",
51127
- modelDef: runOptions.modelDef,
51128
- timeoutSeconds: config2.execution.sessionTimeoutSeconds,
51129
- featureName,
51130
- storyId: story.id,
51131
- signal: runtime.signal
51132
- });
51128
+ const existingHandle = sessionManager?.getLiveHandle(rectificationSessionName);
51129
+ if (existingHandle && existingHandle.agentName === defaultAgent) {
51130
+ heldHandle = existingHandle;
51131
+ } else {
51132
+ heldHandle = await runtime.sessionManager.openSession(rectificationSessionName, {
51133
+ agentName: defaultAgent,
51134
+ role: "implementer",
51135
+ workdir,
51136
+ pipelineStage: "rectification",
51137
+ modelDef: runOptions.modelDef,
51138
+ timeoutSeconds: config2.execution.sessionTimeoutSeconds,
51139
+ featureName,
51140
+ storyId: story.id,
51141
+ signal: runtime.signal
51142
+ });
51143
+ }
51133
51144
  }
51134
51145
  try {
51135
51146
  const turn = await agentManager.runAsSession(defaultAgent, heldHandle, prompt, {
@@ -51171,9 +51182,9 @@ async function runRectificationLoop2(story, config2, workdir, agentManager, impl
51171
51182
  throw err;
51172
51183
  }
51173
51184
  }
51174
- if (sessionId && rectifyResult.protocolIds) {
51185
+ if (sessionManager && heldHandle && rectifyResult.protocolIds) {
51175
51186
  try {
51176
- runtime.sessionManager.bindHandle(sessionId, rectificationSessionName, rectifyResult.protocolIds);
51187
+ sessionManager.bindHandle(heldHandle.id, rectificationSessionName, rectifyResult.protocolIds);
51177
51188
  } catch {}
51178
51189
  }
51179
51190
  if (!rectifyResult.success && rectifyResult.pid) {
@@ -51730,7 +51741,7 @@ async function runThreeSessionTdd(options) {
51730
51741
  };
51731
51742
  }
51732
51743
  const implementerBinding = getTddSessionBinding?.("implementer");
51733
- const fullSuiteGate = await runFullSuiteGate(story, config2, workdir, agentManager, implementerTier, lite, logger, featureName, projectDir, implementerBinding?.sessionId, runtime);
51744
+ const fullSuiteGate = await runFullSuiteGate(story, config2, workdir, agentManager, implementerTier, lite, logger, featureName, projectDir, implementerBinding?.sessionManager, runtime);
51734
51745
  const { cost: fullSuiteGateCost, fullSuiteGatePassed } = fullSuiteGate;
51735
51746
  if (fullSuiteGate.status === "rectification-exhausted") {
51736
51747
  const failureCategory = "full-suite-gate-exhausted";
@@ -58864,7 +58875,7 @@ var package_default;
58864
58875
  var init_package = __esm(() => {
58865
58876
  package_default = {
58866
58877
  name: "@nathapp/nax",
58867
- version: "0.67.0-canary.4",
58878
+ version: "0.67.0-canary.5",
58868
58879
  description: "AI Coding Agent Orchestrator \u2014 loops until done",
58869
58880
  type: "module",
58870
58881
  bin: {
@@ -58959,8 +58970,8 @@ var init_version = __esm(() => {
58959
58970
  NAX_VERSION = package_default.version;
58960
58971
  NAX_COMMIT = (() => {
58961
58972
  try {
58962
- if (/^[0-9a-f]{6,10}$/.test("22d1f67c"))
58963
- return "22d1f67c";
58973
+ if (/^[0-9a-f]{6,10}$/.test("9cf63261"))
58974
+ return "9cf63261";
58964
58975
  } catch {}
58965
58976
  try {
58966
58977
  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.67.0-canary.4",
3
+ "version": "0.67.0-canary.5",
4
4
  "description": "AI Coding Agent Orchestrator — loops until done",
5
5
  "type": "module",
6
6
  "bin": {