agentxchain 2.34.2 → 2.35.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentxchain",
3
- "version": "2.34.2",
3
+ "version": "2.35.0",
4
4
  "description": "CLI for AgentXchain — governed multi-agent software delivery",
5
5
  "type": "module",
6
6
  "bin": {
@@ -81,7 +81,7 @@ stage_if_present() {
81
81
  }
82
82
 
83
83
  # 1. Assert only allowed release-surface dirt is present
84
- echo "[1/7] Checking release-prep tree state..."
84
+ echo "[1/8] Checking release-prep tree state..."
85
85
  DISALLOWED_DIRTY=()
86
86
  while IFS= read -r status_line; do
87
87
  [[ -z "$status_line" ]] && continue
@@ -99,7 +99,7 @@ fi
99
99
  echo " OK: tree contains only allowed release-prep changes"
100
100
 
101
101
  # 2. Assert not already at target version
102
- echo "[2/7] Checking current version..."
102
+ echo "[2/8] Checking current version..."
103
103
  CURRENT_VERSION=$(node -e "console.log(JSON.parse(require('fs').readFileSync('package.json','utf8')).version)")
104
104
  if [[ "$CURRENT_VERSION" == "$TARGET_VERSION" ]]; then
105
105
  echo "FAIL: package.json is already at ${TARGET_VERSION}. Cannot double-bump." >&2
@@ -108,20 +108,77 @@ fi
108
108
  echo " OK: current version is ${CURRENT_VERSION}, bumping to ${TARGET_VERSION}"
109
109
 
110
110
  # 3. Assert tag does not already exist
111
- echo "[3/7] Checking for existing tag..."
111
+ echo "[3/8] Checking for existing tag..."
112
112
  if git rev-parse "v${TARGET_VERSION}" >/dev/null 2>&1; then
113
113
  echo "FAIL: tag v${TARGET_VERSION} already exists. Delete it first or choose a different version." >&2
114
114
  exit 1
115
115
  fi
116
116
  echo " OK: tag v${TARGET_VERSION} does not exist"
117
117
 
118
- # 4. Update version files (no git operations)
119
- echo "[4/7] Updating version files..."
118
+ # 4. Pre-bump version-surface alignment guard
119
+ # Ensures all governed version surfaces already reference the target version
120
+ # BEFORE the bump commit is created. This catches stale drift that would
121
+ # otherwise only be discovered after minting local release identities.
122
+ echo "[4/8] Verifying version-surface alignment for ${TARGET_VERSION}..."
123
+ SURFACE_ERRORS=()
124
+
125
+ # 4a. CHANGELOG top heading
126
+ CHANGELOG_TOP=$(grep -m1 -E '^## [0-9]+\.[0-9]+\.[0-9]+$' "${REPO_ROOT}/cli/CHANGELOG.md" 2>/dev/null | sed 's/^## //' || true)
127
+ if [[ "$CHANGELOG_TOP" != "$TARGET_VERSION" ]]; then
128
+ SURFACE_ERRORS+=("CHANGELOG.md top heading is '${CHANGELOG_TOP:-missing}', expected '${TARGET_VERSION}'")
129
+ fi
130
+
131
+ # 4b. Release notes page exists
132
+ RELEASE_DOC_ID="v${TARGET_VERSION//./-}"
133
+ RELEASE_DOC_PATH="website-v2/docs/releases/${RELEASE_DOC_ID}.mdx"
134
+ if [[ ! -f "${REPO_ROOT}/${RELEASE_DOC_PATH}" ]]; then
135
+ SURFACE_ERRORS+=("release notes page missing: ${RELEASE_DOC_PATH}")
136
+ fi
137
+
138
+ # 4c. Docs sidebar links the release page
139
+ if ! grep -q "'releases/${RELEASE_DOC_ID}'" "${REPO_ROOT}/website-v2/sidebars.ts" 2>/dev/null; then
140
+ SURFACE_ERRORS+=("sidebars.ts does not link 'releases/${RELEASE_DOC_ID}'")
141
+ fi
142
+
143
+ # 4d. Homepage hero badge shows target version
144
+ if ! grep -q "v${TARGET_VERSION}" "${REPO_ROOT}/website-v2/src/pages/index.tsx" 2>/dev/null; then
145
+ SURFACE_ERRORS+=("homepage index.tsx does not contain 'v${TARGET_VERSION}'")
146
+ fi
147
+
148
+ # 4e. Conformance capabilities version
149
+ CAPS_VERSION=$(node -e "try{console.log(JSON.parse(require('fs').readFileSync('${REPO_ROOT}/.agentxchain-conformance/capabilities.json','utf8')).version)}catch{console.log('missing')}" 2>/dev/null || echo "missing")
150
+ if [[ "$CAPS_VERSION" != "$TARGET_VERSION" ]]; then
151
+ SURFACE_ERRORS+=("capabilities.json version is '${CAPS_VERSION}', expected '${TARGET_VERSION}'")
152
+ fi
153
+
154
+ # 4f. Protocol implementor guide example
155
+ if ! grep -q "\"version\": \"${TARGET_VERSION}\"" "${REPO_ROOT}/website-v2/docs/protocol-implementor-guide.mdx" 2>/dev/null; then
156
+ SURFACE_ERRORS+=("protocol-implementor-guide.mdx does not contain '\"version\": \"${TARGET_VERSION}\"'")
157
+ fi
158
+
159
+ # 4g. Launch evidence report title
160
+ ESCAPED_VERSION="${TARGET_VERSION//./\\.}"
161
+ if ! grep -qE "^# Launch Evidence Report — AgentXchain v${ESCAPED_VERSION}" "${REPO_ROOT}/.planning/LAUNCH_EVIDENCE_REPORT.md" 2>/dev/null; then
162
+ SURFACE_ERRORS+=("LAUNCH_EVIDENCE_REPORT.md title does not carry v${TARGET_VERSION}")
163
+ fi
164
+
165
+ if [[ "${#SURFACE_ERRORS[@]}" -gt 0 ]]; then
166
+ echo "FAIL: ${#SURFACE_ERRORS[@]} version-surface(s) not aligned to ${TARGET_VERSION}:" >&2
167
+ printf ' - %s\n' "${SURFACE_ERRORS[@]}" >&2
168
+ echo "" >&2
169
+ echo "Fix these surfaces before running release-bump. The bump script refuses to" >&2
170
+ echo "create release identity when governed surfaces are stale." >&2
171
+ exit 1
172
+ fi
173
+ echo " OK: all 7 governed version surfaces reference ${TARGET_VERSION}"
174
+
175
+ # 5. Update version files (no git operations)
176
+ echo "[5/8] Updating version files..."
120
177
  npm version "$TARGET_VERSION" --no-git-tag-version
121
178
  echo " OK: package.json updated to ${TARGET_VERSION}"
122
179
 
123
- # 5. Stage version files
124
- echo "[5/7] Staging version files..."
180
+ # 6. Stage version files
181
+ echo "[6/8] Staging version files..."
125
182
  git add -- package.json
126
183
  if [[ -f package-lock.json ]]; then
127
184
  git add -- package-lock.json
@@ -131,8 +188,8 @@ for rel_path in "${ALLOWED_RELEASE_PATHS[@]}"; do
131
188
  done
132
189
  echo " OK: version files and allowed release surfaces staged"
133
190
 
134
- # 6. Create release commit
135
- echo "[6/7] Creating release commit..."
191
+ # 7. Create release commit
192
+ echo "[7/8] Creating release commit..."
136
193
  git commit -m "${TARGET_VERSION}"
137
194
  RELEASE_SHA=$(git rev-parse HEAD)
138
195
  COMMIT_MSG=$(git log -1 --format=%s)
@@ -142,8 +199,8 @@ if [[ "$COMMIT_MSG" != "$TARGET_VERSION" ]]; then
142
199
  fi
143
200
  echo " OK: commit ${RELEASE_SHA:0:7} with message '${TARGET_VERSION}'"
144
201
 
145
- # 7. Create annotated tag
146
- echo "[7/7] Creating annotated tag..."
202
+ # 8. Create annotated tag
203
+ echo "[8/8] Creating annotated tag..."
147
204
  git tag -a "v${TARGET_VERSION}" -m "v${TARGET_VERSION}"
148
205
  TAG_SHA=$(git rev-parse "v${TARGET_VERSION}")
149
206
  if [[ -z "$TAG_SHA" ]]; then
@@ -1,7 +1,12 @@
1
+ import { existsSync } from 'fs';
2
+ import { join } from 'path';
1
3
  import chalk from 'chalk';
2
4
  import { loadConfig, loadLock, loadProjectContext, loadProjectState, loadState } from '../lib/config.js';
3
5
  import { deriveRecoveryDescriptor } from '../lib/blocked-state.js';
4
6
  import { getActiveTurn, getActiveTurnCount, getActiveTurns } from '../lib/governed-state.js';
7
+ import { readSessionCheckpoint } from '../lib/session-checkpoint.js';
8
+
9
+ const SESSION_RECOVERY_PATH = '.agentxchain/SESSION_RECOVERY.md';
5
10
 
6
11
  export async function statusCommand(opts) {
7
12
  const context = loadProjectContext();
@@ -74,6 +79,7 @@ export async function statusCommand(opts) {
74
79
  function renderGovernedStatus(context, opts) {
75
80
  const { root, config, version } = context;
76
81
  const state = loadProjectState(root, config);
82
+ const continuity = getContinuityStatus(root, state);
77
83
 
78
84
  if (opts.json) {
79
85
  console.log(JSON.stringify({
@@ -82,6 +88,7 @@ function renderGovernedStatus(context, opts) {
82
88
  template: config.template || 'generic',
83
89
  config,
84
90
  state,
91
+ continuity,
85
92
  }, null, 2));
86
93
  return;
87
94
  }
@@ -101,6 +108,8 @@ function renderGovernedStatus(context, opts) {
101
108
  }
102
109
  console.log('');
103
110
 
111
+ renderContinuityStatus(continuity, state);
112
+
104
113
  const activeTurnCount = getActiveTurnCount(state);
105
114
  const activeTurns = getActiveTurns(state);
106
115
  const singleActiveTurn = getActiveTurn(state);
@@ -238,6 +247,64 @@ function renderGovernedStatus(context, opts) {
238
247
  console.log('');
239
248
  }
240
249
 
250
+ function getContinuityStatus(root, state) {
251
+ const checkpoint = readSessionCheckpoint(root);
252
+ const recoveryReportPath = existsSync(join(root, SESSION_RECOVERY_PATH))
253
+ ? SESSION_RECOVERY_PATH
254
+ : null;
255
+
256
+ if (!checkpoint && !recoveryReportPath) return null;
257
+
258
+ const staleCheckpoint = !!(
259
+ checkpoint?.run_id
260
+ && state?.run_id
261
+ && checkpoint.run_id !== state.run_id
262
+ );
263
+
264
+ return {
265
+ checkpoint,
266
+ stale_checkpoint: staleCheckpoint,
267
+ recovery_report_path: recoveryReportPath,
268
+ restart_recommended: !!state && !['blocked', 'completed', 'failed'].includes(state.status),
269
+ };
270
+ }
271
+
272
+ function renderContinuityStatus(continuity, state) {
273
+ if (!continuity) return;
274
+
275
+ console.log(` ${chalk.dim('Continuity:')}`);
276
+
277
+ if (continuity.checkpoint) {
278
+ const checkpoint = continuity.checkpoint;
279
+ const checkpointSummary = checkpoint.last_checkpoint_at
280
+ ? `${checkpoint.checkpoint_reason || 'unknown'} at ${checkpoint.last_checkpoint_at}`
281
+ : (checkpoint.checkpoint_reason || 'unknown');
282
+ console.log(` ${chalk.dim('Session:')} ${checkpoint.session_id || chalk.dim('unknown')}`);
283
+ console.log(` ${chalk.dim('Checkpoint:')} ${checkpointSummary}`);
284
+ console.log(` ${chalk.dim('Last turn:')} ${checkpoint.last_turn_id || chalk.dim('none')}`);
285
+ console.log(` ${chalk.dim('Last role:')} ${checkpoint.last_role || chalk.dim('unknown')}`);
286
+ if (continuity.stale_checkpoint) {
287
+ console.log(
288
+ ` ${chalk.dim('Warning:')} ${chalk.yellow(
289
+ `session checkpoint tracks ${checkpoint.run_id}, but state.json tracks ${state?.run_id || 'unknown'}; state.json remains source of truth`
290
+ )}`
291
+ );
292
+ }
293
+ } else {
294
+ console.log(` ${chalk.dim('Checkpoint:')} ${chalk.yellow('No session checkpoint recorded')}`);
295
+ }
296
+
297
+ if (continuity.restart_recommended) {
298
+ console.log(` ${chalk.dim('Restart:')} ${chalk.cyan('agentxchain restart')} (rebuild session context from disk)`);
299
+ }
300
+
301
+ if (continuity.recovery_report_path) {
302
+ console.log(` ${chalk.dim('Report:')} ${continuity.recovery_report_path}`);
303
+ }
304
+
305
+ console.log('');
306
+ }
307
+
241
308
  function formatPhase(phase) {
242
309
  const colors = { discovery: chalk.blue, build: chalk.green, qa: chalk.yellow, deploy: chalk.magenta, blocked: chalk.red };
243
310
  return (colors[phase] || chalk.white)(phase);
@@ -10,6 +10,7 @@ import { readFileSync, existsSync } from 'fs';
10
10
  import { join, normalize } from 'path';
11
11
 
12
12
  const STATE_FILE = 'state.json';
13
+ const SESSION_FILE = 'session.json';
13
14
  const HISTORY_FILE = 'history.jsonl';
14
15
  const LEDGER_FILE = 'decision-ledger.jsonl';
15
16
  const HOOK_AUDIT_FILE = 'hook-audit.jsonl';
@@ -23,6 +24,7 @@ const BARRIER_LEDGER_FILE = 'barrier-ledger.jsonl';
23
24
  */
24
25
  export const RESOURCE_MAP = {
25
26
  '/api/state': STATE_FILE,
27
+ '/api/continuity': SESSION_FILE,
26
28
  '/api/history': HISTORY_FILE,
27
29
  '/api/ledger': LEDGER_FILE,
28
30
  '/api/hooks/audit': HOOK_AUDIT_FILE,
package/src/lib/export.js CHANGED
@@ -23,6 +23,7 @@ export const RUN_EXPORT_INCLUDED_ROOTS = [
23
23
  'agentxchain.json',
24
24
  'TALK.md',
25
25
  '.agentxchain/state.json',
26
+ '.agentxchain/session.json',
26
27
  '.agentxchain/history.jsonl',
27
28
  '.agentxchain/decision-ledger.jsonl',
28
29
  '.agentxchain/hook-audit.jsonl',
package/src/lib/report.js CHANGED
@@ -503,6 +503,30 @@ export function extractWorkflowKitArtifacts(artifact) {
503
503
  .sort((a, b) => a.path.localeCompare(b.path, 'en'));
504
504
  }
505
505
 
506
+ function extractContinuityMetadata(artifact) {
507
+ const checkpoint = extractFileData(artifact, '.agentxchain/session.json');
508
+ if (!checkpoint || typeof checkpoint !== 'object') return null;
509
+
510
+ const runId = artifact.summary?.run_id || artifact.state?.run_id || null;
511
+ const staleCheckpoint = !!(
512
+ checkpoint.run_id
513
+ && runId
514
+ && checkpoint.run_id !== runId
515
+ );
516
+
517
+ return {
518
+ session_id: checkpoint.session_id || null,
519
+ run_id: checkpoint.run_id || null,
520
+ started_at: checkpoint.started_at || null,
521
+ last_checkpoint_at: checkpoint.last_checkpoint_at || null,
522
+ last_turn_id: checkpoint.last_turn_id || null,
523
+ last_phase: checkpoint.last_phase || null,
524
+ last_role: checkpoint.last_role || null,
525
+ checkpoint_reason: checkpoint.checkpoint_reason || null,
526
+ stale_checkpoint: staleCheckpoint,
527
+ };
528
+ }
529
+
506
530
  function buildRunSubject(artifact) {
507
531
  const activeTurns = artifact.summary?.active_turn_ids || [];
508
532
  const retainedTurns = artifact.summary?.retained_turn_ids || [];
@@ -519,6 +543,7 @@ function buildRunSubject(artifact) {
519
543
  const gateSummary = extractGateSummary(artifact);
520
544
  const intakeLinks = extractIntakeLinks(artifact);
521
545
  const recoverySummary = extractRecoverySummary(artifact);
546
+ const continuity = extractContinuityMetadata(artifact);
522
547
 
523
548
  return {
524
549
  kind: 'governed_run',
@@ -550,6 +575,7 @@ function buildRunSubject(artifact) {
550
575
  gate_summary: gateSummary,
551
576
  intake_links: intakeLinks,
552
577
  recovery_summary: recoverySummary,
578
+ continuity,
553
579
  workflow_kit_artifacts: extractWorkflowKitArtifacts(artifact),
554
580
  },
555
581
  artifacts: {
@@ -620,6 +646,7 @@ function buildCoordinatorSubject(artifact) {
620
646
  base.hook_summary = extractHookSummary(childExport);
621
647
  base.gate_summary = extractGateSummary(childExport);
622
648
  base.recovery_summary = extractRecoverySummary(childExport);
649
+ base.continuity = extractContinuityMetadata(childExport);
623
650
  base.blocked_on = childExport.state?.blocked_on || null;
624
651
  return base;
625
652
  });
@@ -843,6 +870,18 @@ export function formatGovernanceReportText(report) {
843
870
  lines.push(` Turn retained: ${run.recovery_summary.turn_retained == null ? 'n/a' : yesNo(run.recovery_summary.turn_retained)}`);
844
871
  }
845
872
 
873
+ if (run.continuity) {
874
+ lines.push('', 'Continuity:');
875
+ lines.push(` Session: ${run.continuity.session_id || 'unknown'}`);
876
+ lines.push(` Checkpoint: ${run.continuity.checkpoint_reason || 'unknown'} at ${run.continuity.last_checkpoint_at || 'n/a'}`);
877
+ lines.push(` Last turn: ${run.continuity.last_turn_id || 'none'}`);
878
+ lines.push(` Last role: ${run.continuity.last_role || 'unknown'}`);
879
+ lines.push(` Last phase: ${run.continuity.last_phase || 'unknown'}`);
880
+ if (run.continuity.stale_checkpoint) {
881
+ lines.push(` WARNING: checkpoint tracks run ${run.continuity.run_id}, but export tracks ${run.run_id}`);
882
+ }
883
+ }
884
+
846
885
  if (Array.isArray(run.workflow_kit_artifacts) && run.workflow_kit_artifacts.length > 0) {
847
886
  lines.push('', `Workflow Artifacts (${run.phase || 'unknown'} phase):`);
848
887
  for (const art of run.workflow_kit_artifacts) {
@@ -985,6 +1024,17 @@ export function formatGovernanceReportText(report) {
985
1024
  if (repo.recovery_summary) {
986
1025
  repoLines.push(` Recovery: ${repo.recovery_summary.category || 'unknown'} — ${repo.recovery_summary.typed_reason || 'unknown'} (owner: ${repo.recovery_summary.owner || 'unknown'})`);
987
1026
  }
1027
+ if (repo.continuity) {
1028
+ repoLines.push(' Continuity:');
1029
+ repoLines.push(` Session: ${repo.continuity.session_id || 'unknown'}`);
1030
+ repoLines.push(` Checkpoint: ${repo.continuity.checkpoint_reason || 'unknown'} at ${repo.continuity.last_checkpoint_at || 'n/a'}`);
1031
+ repoLines.push(` Last turn: ${repo.continuity.last_turn_id || 'none'}`);
1032
+ repoLines.push(` Last role: ${repo.continuity.last_role || 'unknown'}`);
1033
+ repoLines.push(` Last phase: ${repo.continuity.last_phase || 'unknown'}`);
1034
+ if (repo.continuity.stale_checkpoint) {
1035
+ repoLines.push(` WARNING: checkpoint tracks run ${repo.continuity.run_id}, but repo export tracks ${repo.run_id}`);
1036
+ }
1037
+ }
988
1038
  return repoLines;
989
1039
  }));
990
1040
  return lines.join('\n');
@@ -1110,6 +1160,18 @@ export function formatGovernanceReportMarkdown(report) {
1110
1160
  lines.push(`- Turn retained: \`${run.recovery_summary.turn_retained == null ? 'n/a' : yesNo(run.recovery_summary.turn_retained)}\``);
1111
1161
  }
1112
1162
 
1163
+ if (run.continuity) {
1164
+ lines.push('', '## Continuity', '');
1165
+ lines.push(`- Session: \`${run.continuity.session_id || 'unknown'}\``);
1166
+ lines.push(`- Checkpoint: \`${run.continuity.checkpoint_reason || 'unknown'}\` at \`${run.continuity.last_checkpoint_at || 'n/a'}\``);
1167
+ lines.push(`- Last turn: \`${run.continuity.last_turn_id || 'none'}\``);
1168
+ lines.push(`- Last role: \`${run.continuity.last_role || 'unknown'}\``);
1169
+ lines.push(`- Last phase: \`${run.continuity.last_phase || 'unknown'}\``);
1170
+ if (run.continuity.stale_checkpoint) {
1171
+ lines.push(`- **Warning:** checkpoint tracks run \`${run.continuity.run_id}\`, but export tracks \`${run.run_id}\``);
1172
+ }
1173
+ }
1174
+
1113
1175
  if (Array.isArray(run.workflow_kit_artifacts) && run.workflow_kit_artifacts.length > 0) {
1114
1176
  lines.push('', '## Workflow Artifacts', '');
1115
1177
  lines.push(`Phase: \`${run.phase || 'unknown'}\``, '');
@@ -1258,6 +1320,17 @@ export function formatGovernanceReportMarkdown(report) {
1258
1320
  if (repo.recovery_summary) {
1259
1321
  repoLines.push('', '#### Recovery', '', `- Category: \`${repo.recovery_summary.category || 'unknown'}\``, `- Typed reason: \`${repo.recovery_summary.typed_reason || 'unknown'}\``, `- Owner: \`${repo.recovery_summary.owner || 'unknown'}\``, `- Action: \`${repo.recovery_summary.recovery_action || 'n/a'}\``);
1260
1322
  }
1323
+ if (repo.continuity) {
1324
+ repoLines.push('', '#### Continuity', '');
1325
+ repoLines.push(`- Session: \`${repo.continuity.session_id || 'unknown'}\``);
1326
+ repoLines.push(`- Checkpoint: \`${repo.continuity.checkpoint_reason || 'unknown'}\` at \`${repo.continuity.last_checkpoint_at || 'n/a'}\``);
1327
+ repoLines.push(`- Last turn: \`${repo.continuity.last_turn_id || 'none'}\``);
1328
+ repoLines.push(`- Last role: \`${repo.continuity.last_role || 'unknown'}\``);
1329
+ repoLines.push(`- Last phase: \`${repo.continuity.last_phase || 'unknown'}\``);
1330
+ if (repo.continuity.stale_checkpoint) {
1331
+ repoLines.push(`- **Warning:** checkpoint tracks run \`${repo.continuity.run_id}\`, but repo export tracks \`${repo.run_id}\``);
1332
+ }
1333
+ }
1261
1334
  repoLines.push('');
1262
1335
  return repoLines;
1263
1336
  }));