@nathapp/nax 0.82.0-canary.2 → 0.82.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 +51 -11
  2. package/package.json +2 -2
package/dist/nax.js CHANGED
@@ -22746,7 +22746,8 @@ async function buildNativeClient() {
22746
22746
  return createClient({
22747
22747
  providers: await defaultProviders2(),
22748
22748
  protocols: _clientDeps.defaultProtocols({
22749
- credentials: naxCredentialStore()
22749
+ credentials: naxCredentialStore(),
22750
+ clientApp: NAX_CLIENT_APP
22750
22751
  })
22751
22752
  });
22752
22753
  }
@@ -22759,9 +22760,10 @@ async function getNativeClient() {
22759
22760
  }
22760
22761
  return cached3;
22761
22762
  }
22762
- var _clientDeps, cached3;
22763
+ var NAX_CLIENT_APP, _clientDeps, cached3;
22763
22764
  var init_client = __esm(() => {
22764
22765
  init_credentials();
22766
+ NAX_CLIENT_APP = { name: "nax", url: "https://github.com/nathapp-io/nax" };
22765
22767
  _clientDeps = {
22766
22768
  build: buildNativeClient,
22767
22769
  defaultProtocols
@@ -46900,12 +46902,20 @@ function makeSelfHealStep(spec) {
46900
46902
  async function runSelfHealChain(ctx, seed, steps) {
46901
46903
  let last = seed;
46902
46904
  let totalCost = seed.estimatedCostUsd ?? 0;
46905
+ let lastFailure = seed.adapterFailure;
46903
46906
  for (const step of steps) {
46904
46907
  try {
46905
46908
  const turn = await step.run(ctx);
46906
46909
  if (turn) {
46907
46910
  totalCost += turn.estimatedCostUsd ?? 0;
46908
- last = turn;
46911
+ if (turn.adapterFailure) {
46912
+ lastFailure = turn.adapterFailure;
46913
+ last = turn;
46914
+ } else if (lastFailure) {
46915
+ last = { ...turn, adapterFailure: lastFailure };
46916
+ } else {
46917
+ last = turn;
46918
+ }
46909
46919
  }
46910
46920
  } catch (err) {
46911
46921
  getSafeLogger()?.warn("self-heal", "step threw \u2014 skipping", { error: errorMessage(err) });
@@ -48306,6 +48316,16 @@ var init_types6 = __esm(() => {
48306
48316
  });
48307
48317
 
48308
48318
  // src/operations/call.ts
48319
+ function attachOutcomeAdapterFailure(parsed, outcomeFailure) {
48320
+ if (!outcomeFailure)
48321
+ return parsed;
48322
+ if (parsed === null || typeof parsed !== "object")
48323
+ return parsed;
48324
+ const asRecord = parsed;
48325
+ if (asRecord.adapterFailure !== undefined)
48326
+ return parsed;
48327
+ return { ...asRecord, adapterFailure: outcomeFailure };
48328
+ }
48309
48329
  async function callOp(ctx, op, input) {
48310
48330
  if (op.kind === "deterministic") {
48311
48331
  return op.execute(input, ctx);
@@ -48607,7 +48627,8 @@ async function callOp(ctx, op, input) {
48607
48627
  }
48608
48628
  try {
48609
48629
  const parsedRun = op.parse(rawOutput, input, buildCtx);
48610
- return await runPostParse(op, parsedRun, input, buildCtx);
48630
+ const parsedRunWithFailure = attachOutcomeAdapterFailure(parsedRun, outcome.result.adapterFailure);
48631
+ return await runPostParse(op, parsedRunWithFailure, input, buildCtx);
48611
48632
  } catch (_parseErr) {
48612
48633
  if (maxRetriesExceeded) {
48613
48634
  getSafeLogger()?.error("callop", "Op retry budget exhausted", {
@@ -60189,7 +60210,7 @@ var package_default;
60189
60210
  var init_package = __esm(() => {
60190
60211
  package_default = {
60191
60212
  name: "@nathapp/nax",
60192
- version: "0.82.0-canary.2",
60213
+ version: "0.82.0-canary.3",
60193
60214
  description: "AI Coding Agent Orchestrator \u2014 loops until done",
60194
60215
  type: "module",
60195
60216
  bin: {
@@ -60257,7 +60278,7 @@ var init_package = __esm(() => {
60257
60278
  "spec:lint": "bun run scripts/spec-lint.ts"
60258
60279
  },
60259
60280
  dependencies: {
60260
- "@nathapp/nax-ai": "0.1.8",
60281
+ "@nathapp/nax-ai": "0.1.9",
60261
60282
  "@types/react": "^19.2.14",
60262
60283
  chalk: "^5.6.2",
60263
60284
  commander: "^13.1.0",
@@ -60310,8 +60331,8 @@ var init_version = __esm(() => {
60310
60331
  NAX_VERSION = package_default.version;
60311
60332
  NAX_COMMIT = (() => {
60312
60333
  try {
60313
- if (/^[0-9a-f]{6,10}$/.test("c2ee0b93"))
60314
- return "c2ee0b93";
60334
+ if (/^[0-9a-f]{6,10}$/.test("701335de"))
60335
+ return "701335de";
60315
60336
  } catch {}
60316
60337
  try {
60317
60338
  const result = Bun.spawnSync(["git", "rev-parse", "--short", "HEAD"], {
@@ -72991,8 +73012,16 @@ async function runAcceptanceSetup(ctx, featureDir2, phaseStartTime) {
72991
73012
  ..."implementationContext" in ctx && ctx.implementationContext ? { implementationContext: ctx.implementationContext } : {}
72992
73013
  }, groupStoryId);
72993
73014
  const testCode = genResult.testCode;
73015
+ const dispatchFailure = genResult.adapterFailure;
72994
73016
  if (testCode) {
72995
73017
  await _acceptanceSetupDeps.writeFile(testPath, testCode);
73018
+ } else if (dispatchFailure) {
73019
+ getSafeLogger()?.warn("acceptance-setup", `agent dispatch failed (${dispatchFailure.outcome}); not writing acceptance tests`, {
73020
+ storyId: groupStoryId,
73021
+ testPath,
73022
+ outcome: dispatchFailure.outcome,
73023
+ message: dispatchFailure.message
73024
+ });
72996
73025
  } else {
72997
73026
  const skeletonCriteria = groupRefined.map((c, i) => ({
72998
73027
  id: `AC-${i + 1}`,
@@ -79051,7 +79080,7 @@ function buildFailureResult(prd, totalCost, iterations, storiesCompleted, failed
79051
79080
  };
79052
79081
  }
79053
79082
  async function regenerateAcceptanceTest(testPath, acceptanceContext) {
79054
- const logger = getSafeLogger();
79083
+ const logger = _regenerateDeps.getLogger();
79055
79084
  const bakPath = `${testPath}.bak`;
79056
79085
  const content = await Bun.file(testPath).text();
79057
79086
  await Bun.write(bakPath, content);
@@ -79102,7 +79131,12 @@ async function regenerateAcceptanceTest(testPath, acceptanceContext) {
79102
79131
  };
79103
79132
  await _regenerateDeps.acceptanceSetupExecute(contextForSetup);
79104
79133
  if (!await Bun.file(testPath).exists()) {
79105
- logger?.error("acceptance", "Acceptance test regeneration failed \u2014 manual intervention required");
79134
+ logger?.error("acceptance", "Acceptance test regeneration failed \u2014 file not created");
79135
+ return false;
79136
+ }
79137
+ const regeneratedContent = await _regenerateDeps.readFile(testPath);
79138
+ if (isStubTestFile(regeneratedContent)) {
79139
+ logger?.error("acceptance", "Acceptance test regeneration produced stub content \u2014 regenerator unable to generate real tests");
79106
79140
  return false;
79107
79141
  }
79108
79142
  logger?.info("acceptance", "Acceptance test regenerated successfully");
@@ -79127,7 +79161,8 @@ var init_acceptance_helpers = __esm(() => {
79127
79161
  acceptanceSetupExecute: async (ctx) => {
79128
79162
  const { acceptanceSetupStage: acceptanceSetupStage2 } = await Promise.resolve().then(() => (init_stages(), exports_stages));
79129
79163
  await acceptanceSetupStage2.execute(ctx);
79130
- }
79164
+ },
79165
+ getLogger: () => getSafeLogger()
79131
79166
  };
79132
79167
  });
79133
79168
 
@@ -80782,6 +80817,11 @@ function buildStatusSnapshot(state) {
80782
80817
  }
80783
80818
  if (state.postRun) {
80784
80819
  snapshot.postRun = state.postRun;
80820
+ const acceptanceStatus = state.postRun.acceptance.skippedPackages && state.postRun.acceptance.skippedPackages.length > 0 ? "failed" : state.postRun.acceptance.status;
80821
+ snapshot.gates = {
80822
+ acceptance: acceptanceStatus,
80823
+ regression: state.postRun.regression.status
80824
+ };
80785
80825
  }
80786
80826
  return snapshot;
80787
80827
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nathapp/nax",
3
- "version": "0.82.0-canary.2",
3
+ "version": "0.82.0-canary.3",
4
4
  "description": "AI Coding Agent Orchestrator — loops until done",
5
5
  "type": "module",
6
6
  "bin": {
@@ -68,7 +68,7 @@
68
68
  "spec:lint": "bun run scripts/spec-lint.ts"
69
69
  },
70
70
  "dependencies": {
71
- "@nathapp/nax-ai": "0.1.8",
71
+ "@nathapp/nax-ai": "0.1.9",
72
72
  "@types/react": "^19.2.14",
73
73
  "chalk": "^5.6.2",
74
74
  "commander": "^13.1.0",