@cortexkit/aft 0.58.0 → 0.58.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.
@@ -6,6 +6,7 @@ import { type NativeRunner } from "../lib/feature-plan.js";
6
6
  import { resolveAdaptersForCommand } from "../lib/harness-select.js";
7
7
  import { type ClearResult } from "../lib/lsp-cache.js";
8
8
  import { runOnnxFix } from "../lib/onnx-fix.js";
9
+ import { type RecentSession } from "../lib/sessions.js";
9
10
  import { type FeatureSetupDeps, type GhStatus } from "../setup/feature-wizard.js";
10
11
  import { type OpenCodeHostDetection } from "../setup/host-generation.js";
11
12
  export type DoctorClearTarget = "plugin-cache" | "lsp-cache" | "binary-cache";
@@ -137,5 +138,11 @@ export declare function fixPluginEntries(adapters: HarnessAdapter[]): Promise<{
137
138
  }>;
138
139
  export declare function renderIssueDescription(description: string): string;
139
140
  export declare function deriveIssueTitleFromBody(body: string): string;
141
+ /** Select matching lines across log history; the most recent lines may belong to other sessions. */
142
+ export declare function collectIssueLog(path: string, selectedSession: RecentSession | null): {
143
+ logText: string;
144
+ errors: string;
145
+ notice: string;
146
+ };
140
147
  export {};
141
148
  //# sourceMappingURL=doctor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAEL,KAAK,QAAQ,EAEd,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAAE,KAAK,gBAAgB,EAAoC,MAAM,0BAA0B,CAAC;AAkBnG,OAAO,EAEL,kBAAkB,EAClB,KAAK,gBAAgB,EAMtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGL,KAAK,YAAY,EAIlB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAYrE,OAAO,EAAE,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AQ,GAAG,eAAe,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACvF,OAAO,EAAE,MAAM,CAAC;CACjB;AA4ID,qEAAqE;AACrE,MAAM,MAAM,kBAAkB,GAAG,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAwIvE,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,cAAc,EAAE,EAC1B,MAAM,EAAE,gBAAgB,GACvB,iBAAiB,EAAE,CAgIrB;AAiBD,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAIvE;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAK9F;AAgXD,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,CAQ1F;AAiHD,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,cAAc,EAAE,GACzB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAQ9C;AA+ED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAOlE;AAgCD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG7D;AAkED,oGAAoG;AACpG,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,aAAa,GAAG,IAAI,GACpC;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAaA"}
package/dist/index.js CHANGED
@@ -113,7 +113,7 @@ var init_active_logger = __esm(() => {
113
113
  var init_bash_hints = () => {};
114
114
 
115
115
  // ../aft-bridge/dist/child-process.js
116
- import { execFileSync as nodeExecFileSync, execSync as nodeExecSync, spawn as nodeSpawn, spawnSync as nodeSpawnSync } from "node:child_process";
116
+ import { execFile as nodeExecFile, execFileSync as nodeExecFileSync, execSync as nodeExecSync, spawn as nodeSpawn, spawnSync as nodeSpawnSync } from "node:child_process";
117
117
  function withWindowsHidden(args, takesArgv) {
118
118
  const out = [...args];
119
119
  let index = 1;
@@ -132,11 +132,12 @@ function withWindowsHidden(args, takesArgv) {
132
132
  function hidden(resolve, takesArgv) {
133
133
  return (...args) => resolve()(...withWindowsHidden(args, takesArgv));
134
134
  }
135
- var HIDDEN, spawn, spawnSync, execFileSync, execSync;
135
+ var HIDDEN, spawn, spawnSync, execFile, execFileSync, execSync;
136
136
  var init_child_process = __esm(() => {
137
137
  HIDDEN = { windowsHide: true };
138
138
  spawn = hidden(() => nodeSpawn, true);
139
139
  spawnSync = hidden(() => nodeSpawnSync, true);
140
+ execFile = hidden(() => nodeExecFile, true);
140
141
  execFileSync = hidden(() => nodeExecFileSync, true);
141
142
  execSync = hidden(() => nodeExecSync, false);
142
143
  });
@@ -444,6 +445,9 @@ var init_command_timeouts = __esm(() => {
444
445
  PASSIVE_COMMANDS = new Set(["status"]);
445
446
  });
446
447
 
448
+ // ../aft-bridge/dist/transport.js
449
+ var WORKER_SESSION_FIELD = "worker_session";
450
+
447
451
  // ../aft-bridge/dist/bridge.js
448
452
  import { homedir as homedir2 } from "node:os";
449
453
  import { join as join2 } from "node:path";
@@ -858,9 +862,11 @@ var init_bridge = __esm(() => {
858
862
  params.edit_slot_survives = editSlotSurvives;
859
863
  this.logHashlineRegistrationCarrier("tool_call", sessionId, editSlotSurvives);
860
864
  }
861
- const { preview, ...sendOptions } = options ?? {};
865
+ const { preview, workerSession, ...sendOptions } = options ?? {};
862
866
  if (preview === true)
863
867
  params.preview = true;
868
+ if (workerSession === true)
869
+ params[WORKER_SESSION_FIELD] = true;
864
870
  return await this.send("tool_call", params, Object.keys(sendOptions).length > 0 ? sendOptions : undefined);
865
871
  }
866
872
  async sendWithVersionMismatchRetry(command, params, options, canRetryAfterVersionSwap) {
@@ -929,7 +935,7 @@ var init_bridge = __esm(() => {
929
935
  if (command === "cancel_request" || Object.hasOwn(params, "command") || Object.hasOwn(params, "method")) {
930
936
  const nested = { ...params };
931
937
  const reserved = {};
932
- for (const key of ["session_id", "lsp_hints"]) {
938
+ for (const key of ["session_id", "lsp_hints", WORKER_SESSION_FIELD]) {
933
939
  if (Object.hasOwn(nested, key)) {
934
940
  reserved[key] = nested[key];
935
941
  delete nested[key];
@@ -1311,17 +1317,30 @@ var init_bridge = __esm(() => {
1311
1317
  }
1312
1318
  }
1313
1319
  onStderrData(data) {
1314
- this.stderrBuffer += data;
1315
- let newlineIdx;
1316
- while ((newlineIdx = this.stderrBuffer.indexOf(`
1317
- `)) !== -1) {
1318
- const line = this.stderrBuffer.slice(0, newlineIdx).replace(/\r$/, "");
1319
- this.stderrBuffer = this.stderrBuffer.slice(newlineIdx + 1);
1320
- if (!line || !shouldSurfaceStderrLine(line))
1321
- continue;
1322
- const tagged = tagStderrLine(line);
1323
- this.logVia(tagged);
1324
- this.pushStderrLine(tagged);
1320
+ const partialLimit = 64 * 1024;
1321
+ let offset = 0;
1322
+ while (offset < data.length) {
1323
+ const newline = data.indexOf(`
1324
+ `, offset);
1325
+ const end = newline < 0 ? data.length : newline;
1326
+ while (offset < end) {
1327
+ const count = Math.min(partialLimit - this.stderrBuffer.length, end - offset);
1328
+ this.stderrBuffer += data.slice(offset, offset + count);
1329
+ offset += count;
1330
+ if (this.stderrBuffer.length === partialLimit) {
1331
+ const last = this.stderrBuffer.charCodeAt(this.stderrBuffer.length - 1);
1332
+ const carry = last >= 55296 && last <= 56319 ? this.stderrBuffer.slice(-1) : "";
1333
+ const fragment = carry ? this.stderrBuffer.slice(0, -1) : this.stderrBuffer;
1334
+ const tagged = tagStderrLine(`${fragment} [stderr record truncated into bounded fragments; ${Buffer.byteLength(fragment)} bytes shown, continuation follows]`);
1335
+ this.stderrBuffer = carry;
1336
+ this.logVia(tagged);
1337
+ this.pushStderrLine(tagged);
1338
+ }
1339
+ }
1340
+ if (newline < 0)
1341
+ break;
1342
+ this.flushStderrBuffer();
1343
+ offset = newline + 1;
1325
1344
  }
1326
1345
  }
1327
1346
  flushStderrBuffer() {
@@ -1645,6 +1664,9 @@ function readConfigTiers(opts) {
1645
1664
  }
1646
1665
  var init_config_tiers = () => {};
1647
1666
 
1667
+ // ../aft-bridge/dist/config-watch.js
1668
+ var init_config_watch = () => {};
1669
+
1648
1670
  // ../aft-bridge/dist/platform.js
1649
1671
  var PLATFORM_ARCH_MAP, PLATFORM_ASSET_MAP;
1650
1672
  var init_platform = __esm(() => {
@@ -2625,13 +2647,14 @@ var init_lifecycle_registry = __esm(() => {
2625
2647
  var init_project_identity = () => {};
2626
2648
 
2627
2649
  // ../aft-bridge/dist/subc-transport.js
2628
- var LOCALLY_SATISFIED_COMMANDS;
2650
+ var CALL_DEADLINE_EXPIRED, LOCALLY_SATISFIED_COMMANDS;
2629
2651
  var init_subc_transport = __esm(() => {
2630
2652
  init_dist();
2631
2653
  init_active_logger();
2632
2654
  init_error_contract();
2633
2655
  init_lifecycle_registry();
2634
2656
  init_project_identity();
2657
+ CALL_DEADLINE_EXPIRED = Symbol("call deadline expired");
2635
2658
  LOCALLY_SATISFIED_COMMANDS = new Set(["configure"]);
2636
2659
  });
2637
2660
 
@@ -4115,6 +4138,9 @@ async function downloadOnnxRuntime(info, targetDir) {
4115
4138
  copyOnnxLibraries(info, extractedDir, stagedInstallDir, realFiles, symlinks);
4116
4139
  const libPath = join10(stagedInstallDir, info.libName);
4117
4140
  const libHash = sha256File2(libPath);
4141
+ if (libHash !== info.librarySha256) {
4142
+ throw new Error(`onnx runtime library hash mismatch at ${libPath}: sha256 ${libHash}, ` + `expected the pinned ${info.librarySha256} for ${info.assetName}`);
4143
+ }
4118
4144
  writeOnnxInstalledMeta(stagedInstallDir, ORT_VERSION, libHash, archiveSha256);
4119
4145
  publishOnnxRuntime(stagedInstallDir, targetDir);
4120
4146
  rmSync2(tmpDir, { recursive: true, force: true });
@@ -4382,31 +4408,36 @@ var init_onnx_runtime = __esm(() => {
4382
4408
  arm64: {
4383
4409
  assetName: `onnxruntime-osx-arm64-${ORT_VERSION}`,
4384
4410
  libName: "libonnxruntime.dylib",
4385
- archiveType: "tgz"
4411
+ archiveType: "tgz",
4412
+ librarySha256: "872533f130f1839a5bc01788ddb4f75c83a189763441ba1178788ed965449289"
4386
4413
  }
4387
4414
  },
4388
4415
  linux: {
4389
4416
  x64: {
4390
4417
  assetName: `onnxruntime-linux-x64-${ORT_VERSION}`,
4391
4418
  libName: "libonnxruntime.so",
4392
- archiveType: "tgz"
4419
+ archiveType: "tgz",
4420
+ librarySha256: "d132535d051344ff5c64c9c200004150559049a81ed330eb4422c1962fb6b7e4"
4393
4421
  },
4394
4422
  arm64: {
4395
4423
  assetName: `onnxruntime-linux-aarch64-${ORT_VERSION}`,
4396
4424
  libName: "libonnxruntime.so",
4397
- archiveType: "tgz"
4425
+ archiveType: "tgz",
4426
+ librarySha256: "52b2a0e75e79468404284fec38ad5ee1a7a996232274f5e1b84f3e793fb07554"
4398
4427
  }
4399
4428
  },
4400
4429
  win32: {
4401
4430
  x64: {
4402
4431
  assetName: `onnxruntime-win-x64-${ORT_VERSION}`,
4403
4432
  libName: "onnxruntime.dll",
4404
- archiveType: "zip"
4433
+ archiveType: "zip",
4434
+ librarySha256: "b95efb2113b603bbbf3f191061c5516a871ed546893c820e4f3b7b6c358dbf2a"
4405
4435
  },
4406
4436
  arm64: {
4407
4437
  assetName: `onnxruntime-win-arm64-${ORT_VERSION}`,
4408
4438
  libName: "onnxruntime.dll",
4409
- archiveType: "zip"
4439
+ archiveType: "zip",
4440
+ librarySha256: "724d81ac50b11bfaa01ab3ce01b99fb6734a4b762259a8be4395ca662ce99fe6"
4410
4441
  }
4411
4442
  }
4412
4443
  };
@@ -4493,6 +4524,7 @@ var init_dist2 = __esm(() => {
4493
4524
  init_config_error();
4494
4525
  init_config_keys();
4495
4526
  init_config_tiers();
4527
+ init_config_watch();
4496
4528
  init_downloader();
4497
4529
  init_durable_log();
4498
4530
  init_error_contract();
@@ -18423,12 +18455,6 @@ var init_github = __esm(() => {
18423
18455
  });
18424
18456
 
18425
18457
  // src/lib/issue-body.ts
18426
- function filterLogToSession(logText, sessionId) {
18427
- const bareId = sessionId.replace(/^ses_/, "");
18428
- const keepTokens = [`[ses_${bareId}]`, `[${bareId}]`];
18429
- return logText.split(/\r?\n/).filter((line) => !SESSION_TAG_PATTERN2.test(line) || keepTokens.some((token) => line.includes(token))).join(`
18430
- `);
18431
- }
18432
18458
  function isErrorLogLine(line) {
18433
18459
  return ERROR_LOG_PATTERNS.some((rx) => rx.test(line));
18434
18460
  }
@@ -18445,8 +18471,7 @@ function extractRecentErrors(sanitized, limit = 20) {
18445
18471
  function capBodyToGithubLimit(body, maxBytes = MAX_GITHUB_BODY_BYTES) {
18446
18472
  if (Buffer.byteLength(body, "utf8") <= maxBytes)
18447
18473
  return body;
18448
- const heading = "## Logs (last";
18449
- const headingIdx = body.indexOf(heading);
18474
+ const headingIdx = body.search(/^## Logs \(/m);
18450
18475
  if (headingIdx === -1) {
18451
18476
  const marker = `
18452
18477
 
@@ -18506,9 +18531,8 @@ function truncateToByteBudget(input, maxBytes) {
18506
18531
  }
18507
18532
  return buf.subarray(0, end).toString("utf8");
18508
18533
  }
18509
- var MAX_GITHUB_BODY_BYTES = 60000, SESSION_TAG_PATTERN2, ERROR_LOG_PATTERNS;
18534
+ var MAX_GITHUB_BODY_BYTES = 60000, ERROR_LOG_PATTERNS;
18510
18535
  var init_issue_body = __esm(() => {
18511
- SESSION_TAG_PATTERN2 = /\[ses_[^\]\s]+\]|\[[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\]/;
18512
18536
  ERROR_LOG_PATTERNS = [
18513
18537
  /\bcrashed:/i,
18514
18538
  /\bfailed:/i,
@@ -18671,8 +18695,87 @@ var init_onnx_fix = __esm(() => {
18671
18695
  init_prompts();
18672
18696
  });
18673
18697
 
18698
+ // src/lib/session-log.ts
18699
+ import { closeSync as closeSync8, openSync as openSync8, readSync as readSync6, statSync as statSync17 } from "node:fs";
18700
+ function readSessionLog(path, session, maxBytes = MAX_SCAN_BYTES) {
18701
+ const lines = [];
18702
+ const errors = [];
18703
+ let remaining = maxBytes;
18704
+ let boundHit = false;
18705
+ const bareId = session.id.replace(/^ses_/, "");
18706
+ const selectedTags = [`[ses_${bareId}]`, `[${bareId}]`];
18707
+ const tagPattern = /\[ses_[^\]\s]+\]|\[[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}\]/;
18708
+ const accept = (line) => {
18709
+ if (!line)
18710
+ return;
18711
+ const tag = tagPattern.exec(line)?.[0];
18712
+ if (tag && !selectedTags.includes(tag))
18713
+ return;
18714
+ if (!tag) {
18715
+ const stamp = /^\[([^\]]+)\]/.exec(line)?.[1];
18716
+ const time = stamp ? Date.parse(stamp) : NaN;
18717
+ const inWindow = Number.isFinite(time) && (session.startedAt === undefined || time >= session.startedAt) && time <= session.lastActivity;
18718
+ if (session.projectRoot) {
18719
+ if (Number.isFinite(time) && session.startedAt !== undefined && !inWindow)
18720
+ return;
18721
+ if (!line.includes(session.projectRoot) && (!inWindow || PROJECT_PATH.test(line)))
18722
+ return;
18723
+ } else if (!inWindow) {
18724
+ return;
18725
+ }
18726
+ }
18727
+ if (lines.length < 200)
18728
+ lines.push(line);
18729
+ if (errors.length < 20 && isErrorLogLine(line))
18730
+ errors.push(line);
18731
+ };
18732
+ for (const file of [path, `${path}.1`]) {
18733
+ if (remaining <= 0 || lines.length >= 200 && errors.length >= 20)
18734
+ break;
18735
+ let fd;
18736
+ try {
18737
+ fd = openSync8(file, "r");
18738
+ let position = statSync17(file).size;
18739
+ let suffix = Buffer.alloc(0);
18740
+ while (position > 0 && remaining > 0 && (lines.length < 200 || errors.length < 20)) {
18741
+ const length = Math.min(CHUNK_BYTES, position, remaining);
18742
+ position -= length;
18743
+ remaining -= length;
18744
+ const chunk = Buffer.allocUnsafe(length);
18745
+ const count = readSync6(fd, chunk, 0, length, position);
18746
+ const bytes = Buffer.concat([chunk.subarray(0, count), suffix]);
18747
+ let end = bytes.length;
18748
+ for (let i = bytes.length - 1;i >= 0; i -= 1) {
18749
+ if (bytes[i] !== 10)
18750
+ continue;
18751
+ accept(bytes.subarray(i + 1, end).toString("utf8").replace(/\r$/, ""));
18752
+ end = i;
18753
+ if (lines.length >= 200 && errors.length >= 20)
18754
+ break;
18755
+ }
18756
+ suffix = bytes.subarray(0, end);
18757
+ }
18758
+ if (position === 0)
18759
+ accept(suffix.toString("utf8").replace(/\r$/, ""));
18760
+ else if (remaining === 0)
18761
+ boundHit = true;
18762
+ } catch {} finally {
18763
+ if (fd !== undefined)
18764
+ closeSync8(fd);
18765
+ }
18766
+ }
18767
+ return { lines: lines.reverse(), errors: errors.reverse(), boundHit };
18768
+ }
18769
+ var MAX_SCAN_BYTES, CHUNK_BYTES, PROJECT_PATH;
18770
+ var init_session_log = __esm(() => {
18771
+ init_issue_body();
18772
+ MAX_SCAN_BYTES = 64 * 1024 * 1024;
18773
+ CHUNK_BYTES = 64 * 1024;
18774
+ PROJECT_PATH = /\broot\s*=|(?:^|[\s"'(=])(?:\/[^\s"'(),]+|[A-Za-z]:[\\/][^\s"'(),]+)/;
18775
+ });
18776
+
18674
18777
  // src/lib/sessions.ts
18675
- import { existsSync as existsSync29, readdirSync as readdirSync12, readFileSync as readFileSync16, statSync as statSync17 } from "node:fs";
18778
+ import { existsSync as existsSync29, readdirSync as readdirSync12, readFileSync as readFileSync16, statSync as statSync18 } from "node:fs";
18676
18779
  import { createRequire as createRequire4 } from "node:module";
18677
18780
  import { homedir as homedir16 } from "node:os";
18678
18781
  import { basename as basename3, join as join28 } from "node:path";
@@ -18698,10 +18801,13 @@ function mapOpenCodeSessionRows(rows) {
18698
18801
  const lastActivity = typeof row.time_updated === "number" ? row.time_updated : Number(row.time_updated);
18699
18802
  if (!Number.isFinite(lastActivity))
18700
18803
  return null;
18804
+ const startedAt = Number(row.time_created);
18701
18805
  return {
18702
18806
  id: row.id,
18703
18807
  title: row.title,
18704
- lastActivity
18808
+ lastActivity,
18809
+ ...typeof row.directory === "string" && row.directory ? { projectRoot: row.directory } : {},
18810
+ ...row.time_created != null && Number.isFinite(startedAt) ? { startedAt } : {}
18705
18811
  };
18706
18812
  }).filter((session) => session !== null).sort((a, b) => b.lastActivity - a.lastActivity).slice(0, MAX_RECENT_SESSIONS);
18707
18813
  }
@@ -18714,7 +18820,7 @@ function listRecentOpenCodeSessions() {
18714
18820
  const require2 = createRequire4(import.meta.url);
18715
18821
  const sqlite = require2("node:sqlite");
18716
18822
  db = new sqlite.DatabaseSync(dbPath, { readOnly: true });
18717
- const rows = db.prepare("SELECT id, title, time_updated FROM session ORDER BY time_updated DESC LIMIT 5").all();
18823
+ const rows = db.prepare("SELECT id, title, time_updated, time_created, directory FROM session ORDER BY time_updated DESC LIMIT 5").all();
18718
18824
  return mapOpenCodeSessionRows(rows);
18719
18825
  } catch {
18720
18826
  return [];
@@ -18741,7 +18847,7 @@ function listPiSessionsFromDir(sessionsDir) {
18741
18847
  return [];
18742
18848
  const files = collectJsonlFiles(sessionsDir).map((filePath) => {
18743
18849
  try {
18744
- const stats = statSync17(filePath);
18850
+ const stats = statSync18(filePath);
18745
18851
  return { filePath, mtimeMs: stats.mtimeMs };
18746
18852
  } catch {
18747
18853
  return null;
@@ -18788,6 +18894,8 @@ function collectJsonlFiles(root) {
18788
18894
  function parsePiSessionJsonl(jsonl, fallbackFilename = "") {
18789
18895
  let id = extractUuidFromFilename(fallbackFilename);
18790
18896
  let title = null;
18897
+ let projectRoot;
18898
+ let startedAt;
18791
18899
  for (const line of jsonl.split(/\r?\n/)) {
18792
18900
  const trimmed = line.trim();
18793
18901
  if (trimmed.length === 0)
@@ -18801,8 +18909,16 @@ function parsePiSessionJsonl(jsonl, fallbackFilename = "") {
18801
18909
  if (!value || typeof value !== "object")
18802
18910
  continue;
18803
18911
  const record = value;
18804
- if (record.type === "session" && typeof record.id === "string" && record.id.length > 0) {
18805
- id = record.id;
18912
+ if (record.type === "session") {
18913
+ if (typeof record.id === "string" && record.id.length > 0)
18914
+ id = record.id;
18915
+ if (typeof record.cwd === "string" && record.cwd.length > 0)
18916
+ projectRoot = record.cwd;
18917
+ if (typeof record.timestamp === "string") {
18918
+ const time = Date.parse(record.timestamp);
18919
+ if (Number.isFinite(time))
18920
+ startedAt = time;
18921
+ }
18806
18922
  }
18807
18923
  if (title === null) {
18808
18924
  const maybeTitle = extractPiUserMessageText(record);
@@ -18814,7 +18930,12 @@ function parsePiSessionJsonl(jsonl, fallbackFilename = "") {
18814
18930
  }
18815
18931
  if (!id)
18816
18932
  return null;
18817
- return { id, title: title ?? id };
18933
+ return {
18934
+ id,
18935
+ title: title ?? id,
18936
+ ...projectRoot ? { projectRoot } : {},
18937
+ ...startedAt !== undefined ? { startedAt } : {}
18938
+ };
18818
18939
  }
18819
18940
  function extractPiUserMessageText(record) {
18820
18941
  if (record.type !== "message")
@@ -18867,7 +18988,7 @@ import {
18867
18988
  readFileSync as readFileSync17,
18868
18989
  realpathSync as realpathSync6,
18869
18990
  rmSync as rmSync7,
18870
- statSync as statSync18,
18991
+ statSync as statSync19,
18871
18992
  writeFileSync as writeFileSync5
18872
18993
  } from "node:fs";
18873
18994
  import { tmpdir as tmpdir4 } from "node:os";
@@ -19293,7 +19414,7 @@ function clearOldBinaries() {
19293
19414
  const dir = join29(info.path, version);
19294
19415
  let bytes = 0;
19295
19416
  try {
19296
- bytes = statSync18(dir).isDirectory() ? dirSize(dir) : 0;
19417
+ bytes = statSync19(dir).isDirectory() ? dirSize(dir) : 0;
19297
19418
  } catch {
19298
19419
  bytes = 0;
19299
19420
  }
@@ -19649,7 +19770,7 @@ function userAftConfigPath(report) {
19649
19770
  }
19650
19771
  function fileIdentity(path) {
19651
19772
  try {
19652
- const stat = statSync18(path);
19773
+ const stat = statSync19(path);
19653
19774
  return `${stat.size}:${stat.mtimeMs}:${stat.ino}`;
19654
19775
  } catch {
19655
19776
  return null;
@@ -20136,6 +20257,23 @@ function shortSessionId(id) {
20136
20257
  const bareId = id.replace(/^ses_/, "");
20137
20258
  return bareId.length <= 12 ? bareId : bareId.slice(0, 12);
20138
20259
  }
20260
+ function collectIssueLog(path, selectedSession) {
20261
+ if (!selectedSession) {
20262
+ return { logText: tailLogFile(path, 200), errors: tailLogFile(path, 4000), notice: "" };
20263
+ }
20264
+ const scoped = readSessionLog(path, selectedSession);
20265
+ return {
20266
+ logText: scoped.lines.join(`
20267
+ `),
20268
+ errors: scoped.errors.join(`
20269
+ `),
20270
+ notice: [
20271
+ ...scoped.boundHit ? ["[scan limit reached; older session lines may be missing]"] : [],
20272
+ ...scoped.lines.length === 0 ? ["[no lines found for selected session]"] : []
20273
+ ].join(`
20274
+ `)
20275
+ };
20276
+ }
20139
20277
  async function runIssueFlow(argv) {
20140
20278
  intro(`${CLI} doctor --issue`);
20141
20279
  if (!isInteractiveTerminal()) {
@@ -20154,26 +20292,24 @@ async function runIssueFlow(argv) {
20154
20292
  const selectedSession = await promptForIssueSession(adapters[0]);
20155
20293
  const selectedBareSessionId = selectedSession?.id.replace(/^ses_/, "") ?? null;
20156
20294
  const report = await collectDiagnostics(adapters);
20157
- const logSections = adapters.map((adapter) => {
20295
+ const logResults = adapters.map((adapter) => {
20158
20296
  const path = adapter.getLogFile();
20159
- const tail = tailLogFile(path, 200);
20160
- const scopedTail = selectedBareSessionId ? filterLogToSession(tail, selectedBareSessionId) : tail;
20161
- return `#### ${adapter.displayName} log (${path})
20297
+ const { logText, errors, notice } = collectIssueLog(path, selectedSession);
20298
+ return {
20299
+ section: `#### ${adapter.displayName} log (${path})
20162
20300
 
20301
+ ${notice}
20163
20302
  \`\`\`
20164
- ${scopedTail || "<no log output>"}
20303
+ ${logText || "<no log output>"}
20165
20304
  \`\`\`
20166
- `;
20167
- }).join(`
20168
- `);
20169
- const errorScanWindow = adapters.map((adapter) => {
20170
- const path = adapter.getLogFile();
20171
- const tail = tailLogFile(path, 4000);
20172
- const scopedTail = selectedBareSessionId ? filterLogToSession(tail, selectedBareSessionId) : tail;
20173
- return sanitizeContent(scopedTail);
20174
- }).join(`
20305
+ `,
20306
+ errors
20307
+ };
20308
+ });
20309
+ const logSections = logResults.map((result) => result.section).join(`
20175
20310
  `);
20176
- const recentErrorLines = extractRecentErrors(errorScanWindow, 20);
20311
+ const recentErrorLines = extractRecentErrors(logResults.map((result) => sanitizeContent(result.errors)).join(`
20312
+ `), 20);
20177
20313
  const recentErrorsSection = recentErrorLines.length === 0 ? "_No error-shaped log lines found in recent history._" : ["```", recentErrorLines.join(`
20178
20314
  `), "```"].join(`
20179
20315
  `);
@@ -20197,7 +20333,7 @@ ${scopedTail || "<no log output>"}
20197
20333
  "",
20198
20334
  toolFailuresSection,
20199
20335
  "",
20200
- "## Logs (last 200 lines per harness)",
20336
+ selectedSession ? `## Logs (last 200 lines for session ${selectedSession.id}; project ${selectedSession.projectRoot ?? "unknown"}, ${selectedSession.startedAt !== undefined ? new Date(selectedSession.startedAt).toISOString() : "unknown start"}–${new Date(selectedSession.lastActivity).toISOString()})` : "## Logs (last 200 lines per harness)",
20201
20337
  logSections,
20202
20338
  "_Usernames and home paths have been stripped from this report._"
20203
20339
  ].join(`
@@ -20272,6 +20408,7 @@ var init_doctor = __esm(async () => {
20272
20408
  init_prompts();
20273
20409
  init_sanitize();
20274
20410
  init_self_version();
20411
+ init_session_log();
20275
20412
  init_sessions();
20276
20413
  init_host_generation();
20277
20414
  init_opencode_config();
@@ -20299,14 +20436,14 @@ var init_doctor = __esm(async () => {
20299
20436
  });
20300
20437
 
20301
20438
  // src/commands/lsp.ts
20302
- import { existsSync as existsSync31, readdirSync as readdirSync13, statSync as statSync19 } from "node:fs";
20439
+ import { existsSync as existsSync31, readdirSync as readdirSync13, statSync as statSync20 } from "node:fs";
20303
20440
  import { createRequire as createRequire5 } from "node:module";
20304
20441
  import { dirname as dirname11, join as join30, resolve as resolve13 } from "node:path";
20305
20442
  function findProjectRootForFile(filePath, fallbackCwd = process.cwd()) {
20306
20443
  const resolvedFile = resolve13(fallbackCwd, filePath);
20307
20444
  let dir = dirname11(resolvedFile);
20308
20445
  try {
20309
- if (existsSync31(resolvedFile) && statSync19(resolvedFile).isDirectory()) {
20446
+ if (existsSync31(resolvedFile) && statSync20(resolvedFile).isDirectory()) {
20310
20447
  dir = resolvedFile;
20311
20448
  }
20312
20449
  } catch {
@@ -20475,7 +20612,7 @@ function childDirs(path) {
20475
20612
  try {
20476
20613
  return readdirSync13(path).map((entry) => join30(path, entry)).filter((entry) => {
20477
20614
  try {
20478
- return statSync19(entry).isDirectory();
20615
+ return statSync20(entry).isDirectory();
20479
20616
  } catch {
20480
20617
  return false;
20481
20618
  }
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * 1. Error-line extraction — pull the most-recent ERROR-shaped lines from
8
8
  * a sanitized log so the issue body has a dedicated `## Recent errors`
9
- * section that survives even when the main log tail needs aggressive
9
+ * section that survives even when the main log section needs aggressive
10
10
  * truncation.
11
11
  *
12
12
  * 2. GitHub byte-budget capping — when a rendered report exceeds the
@@ -28,6 +28,7 @@
28
28
  */
29
29
  export declare const MAX_GITHUB_BODY_BYTES = 60000;
30
30
  export declare function filterLogToSession(logText: string, sessionId: string): string;
31
+ export declare function isErrorLogLine(line: string): boolean;
31
32
  /**
32
33
  * Extract the most-recent error-shaped log lines from a sanitized log.
33
34
  * Returns them in chronological order (oldest match first → newest match
@@ -43,7 +44,7 @@ export declare function extractRecentErrors(sanitized: string, limit?: number):
43
44
  /**
44
45
  * Apply a byte budget to a rendered issue body. If the body is already
45
46
  * within budget, returns it unchanged. Otherwise rewrites the main
46
- * fenced log block (whose heading must start with `## Logs (last`) to
47
+ * fenced log block (whose heading must start with `## Logs (`) to
47
48
  * drop oldest log lines until the body fits, leaving a clear
48
49
  * `[truncated for GitHub 64KB limit — older log lines dropped]` marker
49
50
  * at the top of the kept slice.
@@ -55,7 +56,7 @@ export declare function extractRecentErrors(sanitized: string, limit?: number):
55
56
  *
56
57
  * AFT's main log section contains per-harness sub-sections (`#### opencode
57
58
  * log (path)\n```...```\n#### pi log (path)\n```...```\n`). The cap walks
58
- * the entire `## Logs (last ...` block as a single shrinkable region
59
+ * the entire `## Logs (...)` block as a single shrinkable region
59
60
  * because precise per-harness allocation is fiddly and the alternative —
60
61
  * dropping the whole log block on overflow — is strictly worse for
61
62
  * debugging.
@@ -1 +1 @@
1
- {"version":3,"file":"issue-body.d.ts","sourceRoot":"","sources":["../../src/lib/issue-body.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAa5C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAW7E;AA2CD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,MAAM,EAAE,CAU3E;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,MAA8B,GACvC,MAAM,CAqER"}
1
+ {"version":3,"file":"issue-body.d.ts","sourceRoot":"","sources":["../../src/lib/issue-body.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAa5C,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAW7E;AAuCD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,MAAM,EAAE,CAU3E;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,MAA8B,GACvC,MAAM,CAoER"}
@@ -0,0 +1,9 @@
1
+ import type { RecentSession } from "./sessions.js";
2
+ export interface SessionLogResult {
3
+ lines: string[];
4
+ errors: string[];
5
+ boundHit: boolean;
6
+ }
7
+ /** Read newest matching lines from the active log and its single rotated predecessor. */
8
+ export declare function readSessionLog(path: string, session: RecentSession, maxBytes?: number): SessionLogResult;
9
+ //# sourceMappingURL=session-log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-log.d.ts","sourceRoot":"","sources":["../../src/lib/session-log.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAQnD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,aAAa,EACtB,QAAQ,SAAiB,GACxB,gBAAgB,CAsElB"}
@@ -3,16 +3,20 @@ export interface RecentSession {
3
3
  id: string;
4
4
  title: string;
5
5
  lastActivity: number;
6
+ projectRoot?: string;
7
+ startedAt?: number;
6
8
  }
7
9
  interface OpenCodeSessionRow {
8
10
  id: unknown;
9
11
  title: unknown;
10
12
  time_updated: unknown;
13
+ time_created?: unknown;
14
+ directory?: unknown;
11
15
  }
12
16
  export declare function listRecentSessions(adapter: HarnessAdapter): RecentSession[];
13
17
  export declare function mapOpenCodeSessionRows(rows: OpenCodeSessionRow[]): RecentSession[];
14
18
  export declare function listPiSessionsFromDir(sessionsDir: string): RecentSession[];
15
- export declare function parsePiSessionJsonl(jsonl: string, fallbackFilename?: string): Pick<RecentSession, "id" | "title"> | null;
19
+ export declare function parsePiSessionJsonl(jsonl: string, fallbackFilename?: string): Pick<RecentSession, "id" | "title" | "projectRoot" | "startedAt"> | null;
16
20
  export declare function truncateTitle(title: string, maxLength?: number): string;
17
21
  export {};
18
22
  //# sourceMappingURL=sessions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../src/lib/sessions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3D,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,kBAAkB;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;CACvB;AASD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,aAAa,EAAE,CAS3E;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,aAAa,EAAE,CAiBlF;AA0CD,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,EAAE,CA8B1E;AA0BD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,gBAAgB,SAAK,GACpB,IAAI,CAAC,aAAa,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG,IAAI,CA8B5C;AAqCD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,SAAK,GAAG,MAAM,CAInE"}
1
+ {"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../src/lib/sessions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3D,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,kBAAkB;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AASD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,aAAa,EAAE,CAS3E;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,aAAa,EAAE,CAsBlF;AA4CD,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,EAAE,CA8B1E;AA0BD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,gBAAgB,SAAK,GACpB,IAAI,CAAC,aAAa,EAAE,IAAI,GAAG,OAAO,GAAG,aAAa,GAAG,WAAW,CAAC,GAAG,IAAI,CA0C1E;AAqCD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,SAAK,GAAG,MAAM,CAInE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/aft",
3
- "version": "0.58.0",
3
+ "version": "0.58.2",
4
4
  "type": "module",
5
5
  "description": "Unified CLI for Agent File Tools (AFT) — setup, one-shot index snapshots, doctor, and diagnostics across supported agent harnesses (OpenCode, Pi)",
6
6
  "license": "MIT",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@clack/core": "^1.4.2",
27
27
  "@clack/prompts": "^1.6.0",
28
- "@cortexkit/aft-bridge": "0.58.0",
28
+ "@cortexkit/aft-bridge": "0.58.2",
29
29
  "comment-json": "^4.6.2"
30
30
  },
31
31
  "devDependencies": {