@nathapp/nax 0.64.2-canary.1 → 0.64.2-canary.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 +29 -16
  2. package/package.json +1 -1
package/dist/nax.js CHANGED
@@ -5304,7 +5304,11 @@ class AgentManager {
5304
5304
  const sessionRole = handle.role ?? opts.sessionRole ?? "main";
5305
5305
  const start = Date.now();
5306
5306
  try {
5307
- const result = await this._sendPrompt(handle, prompt, opts);
5307
+ const rawResult = await this._sendPrompt(handle, prompt, opts);
5308
+ const result = {
5309
+ ...rawResult,
5310
+ protocolIds: rawResult.protocolIds ?? handle.protocolIds
5311
+ };
5308
5312
  const event = {
5309
5313
  kind: "session-turn",
5310
5314
  sessionName: handle.id,
@@ -30355,7 +30359,9 @@ function turnResultToAgentResult(r) {
30355
30359
  durationMs: 0,
30356
30360
  estimatedCostUsd: r.estimatedCostUsd ?? 0,
30357
30361
  exactCostUsd: r.exactCostUsd,
30358
- tokenUsage: r.tokenUsage
30362
+ tokenUsage: r.tokenUsage,
30363
+ protocolIds: r.protocolIds,
30364
+ internalRoundTrips: r.internalRoundTrips
30359
30365
  };
30360
30366
  }
30361
30367
  function buildHopCallback(ctx, sessionId, _initialOptions) {
@@ -36840,9 +36846,9 @@ async function runTrackedSession(state, id, runner, request) {
36840
36846
  ...request,
36841
36847
  runOptions: {
36842
36848
  ...request.runOptions,
36843
- onSessionEstablished: (protocolIds, sessionName2) => {
36849
+ onSessionEstablished: (protocolIds2, sessionName2) => {
36844
36850
  try {
36845
- state.bindHandle(id, sessionName2, protocolIds);
36851
+ state.bindHandle(id, sessionName2, protocolIds2);
36846
36852
  } catch (err) {
36847
36853
  getLogger().warn("session", "bindHandle via onSessionEstablished failed", {
36848
36854
  storyId: state.sessions.get(id)?.storyId,
@@ -36850,7 +36856,7 @@ async function runTrackedSession(state, id, runner, request) {
36850
36856
  error: err instanceof Error ? err.message : String(err)
36851
36857
  });
36852
36858
  }
36853
- callerCallback?.(protocolIds, sessionName2);
36859
+ callerCallback?.(protocolIds2, sessionName2);
36854
36860
  }
36855
36861
  }
36856
36862
  };
@@ -36925,6 +36931,8 @@ async function runTrackedSession(state, id, runner, request) {
36925
36931
  if (current?.state === "RUNNING") {
36926
36932
  state.transition(id, result.success ? "COMPLETED" : "FAILED");
36927
36933
  }
36934
+ const protocolIds = result.protocolIds ?? current?.protocolIds;
36935
+ const turn = Math.max(result.internalRoundTrips ?? 1, 1);
36928
36936
  const sessionName = state.nameFor({
36929
36937
  workdir: pre.workdir,
36930
36938
  featureName: pre.featureName,
@@ -36943,10 +36951,10 @@ async function runTrackedSession(state, id, runner, request) {
36943
36951
  featureName: pre.featureName,
36944
36952
  workdir: pre.workdir,
36945
36953
  resolvedPermissions,
36946
- turn: result.internalRoundTrips ?? 0,
36954
+ turn,
36947
36955
  protocolIds: {
36948
- sessionId: result.protocolIds?.sessionId ?? null,
36949
- recordId: result.protocolIds?.recordId ?? null
36956
+ sessionId: protocolIds?.sessionId ?? null,
36957
+ recordId: protocolIds?.recordId ?? null
36950
36958
  },
36951
36959
  origin: "runTrackedSession",
36952
36960
  tokenUsage: result.tokenUsage,
@@ -37336,11 +37344,12 @@ class SessionManager {
37336
37344
  }
37337
37345
  this._busySessions.add(handle.id);
37338
37346
  try {
37339
- return await adapter.sendTurn(handle, prompt, {
37347
+ const result = await adapter.sendTurn(handle, prompt, {
37340
37348
  interactionHandler: opts?.interactionHandler ?? NO_OP_INTERACTION_HANDLER,
37341
37349
  signal: opts?.signal,
37342
37350
  maxTurns: opts?.maxTurns
37343
37351
  });
37352
+ return { ...result, protocolIds: result.protocolIds ?? handle.protocolIds };
37344
37353
  } catch (err) {
37345
37354
  if (opts?.signal?.aborted || err instanceof Error && err.name === "AbortError") {
37346
37355
  this._cancelledSessions.add(handle.id);
@@ -37648,7 +37657,9 @@ function createSessionRunHop(sessionManager) {
37648
37657
  durationMs: Date.now() - startMs,
37649
37658
  estimatedCostUsd: turnResult.estimatedCostUsd ?? 0,
37650
37659
  exactCostUsd: turnResult.exactCostUsd,
37651
- tokenUsage: turnResult.tokenUsage
37660
+ tokenUsage: turnResult.tokenUsage,
37661
+ protocolIds: handle.protocolIds,
37662
+ internalRoundTrips: turnResult.internalRoundTrips
37652
37663
  }
37653
37664
  };
37654
37665
  } catch (err) {
@@ -46763,7 +46774,8 @@ async function runThreeSessionTdd(options) {
46763
46774
  lite = false,
46764
46775
  _recursionDepth = 0,
46765
46776
  projectDir,
46766
- agentManager
46777
+ agentManager,
46778
+ runtime
46767
46779
  } = options;
46768
46780
  const logger = getLogger();
46769
46781
  const MAX_RECURSION_DEPTH = 2;
@@ -46906,7 +46918,7 @@ async function runThreeSessionTdd(options) {
46906
46918
  };
46907
46919
  }
46908
46920
  const implementerBinding = getTddSessionBinding?.("implementer");
46909
- const { cost: fullSuiteGateCost, fullSuiteGatePassed } = await runFullSuiteGate(story, config2, workdir, agentManager, implementerTier, lite, logger, featureName, projectDir, implementerBinding?.sessionManager, implementerBinding?.sessionId);
46921
+ const { cost: fullSuiteGateCost, fullSuiteGatePassed } = await runFullSuiteGate(story, config2, workdir, agentManager, implementerTier, lite, logger, featureName, projectDir, implementerBinding?.sessionManager, implementerBinding?.sessionId, runtime);
46910
46922
  const session3Ref = await captureGitRef(workdir) ?? "HEAD";
46911
46923
  const verifierBundle = await getTddContextBundle?.("verifier") ?? tddContextBundles?.verifier;
46912
46924
  const session3 = await runTddSessionOp(verifyTddOp, options, session3Ref, verifierBundle, getTddSessionBinding?.("verifier"));
@@ -47162,7 +47174,8 @@ async function runThreeSessionTddFromCtx(ctx, opts) {
47162
47174
  interactionChain: ctx.interaction,
47163
47175
  projectDir: ctx.projectDir,
47164
47176
  abortSignal: ctx.abortSignal,
47165
- agentManager: ctx.agentManager
47177
+ agentManager: ctx.agentManager,
47178
+ runtime: ctx.runtime
47166
47179
  });
47167
47180
  }
47168
47181
  var init_orchestrator_ctx = __esm(() => {
@@ -50141,7 +50154,7 @@ var package_default;
50141
50154
  var init_package = __esm(() => {
50142
50155
  package_default = {
50143
50156
  name: "@nathapp/nax",
50144
- version: "0.64.2-canary.1",
50157
+ version: "0.64.2-canary.2",
50145
50158
  description: "AI Coding Agent Orchestrator \u2014 loops until done",
50146
50159
  type: "module",
50147
50160
  bin: {
@@ -50225,8 +50238,8 @@ var init_version = __esm(() => {
50225
50238
  NAX_VERSION = package_default.version;
50226
50239
  NAX_COMMIT = (() => {
50227
50240
  try {
50228
- if (/^[0-9a-f]{6,10}$/.test("b8feb3bf"))
50229
- return "b8feb3bf";
50241
+ if (/^[0-9a-f]{6,10}$/.test("6c7fd18c"))
50242
+ return "6c7fd18c";
50230
50243
  } catch {}
50231
50244
  try {
50232
50245
  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.64.2-canary.1",
3
+ "version": "0.64.2-canary.2",
4
4
  "description": "AI Coding Agent Orchestrator — loops until done",
5
5
  "type": "module",
6
6
  "bin": {