pantheon-cli 0.2.43 → 0.2.44

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/pantheon.mjs +248 -28
  2. package/package.json +1 -1
package/dist/pantheon.mjs CHANGED
@@ -39836,13 +39836,14 @@ import {
39836
39836
  existsSync as existsSync3,
39837
39837
  mkdirSync as mkdirSync2,
39838
39838
  readFileSync as readFileSync3,
39839
+ realpathSync,
39839
39840
  readdirSync as readdirSync3,
39840
39841
  rmSync as rmSync2,
39841
39842
  statSync as statSync2,
39842
39843
  writeFileSync as writeFileSync2,
39843
39844
  appendFileSync
39844
39845
  } from "node:fs";
39845
- import { execFileSync } from "node:child_process";
39846
+ import { execFileSync, spawnSync } from "node:child_process";
39846
39847
  import { homedir as homedir2 } from "node:os";
39847
39848
  import { basename as basename2, isAbsolute, join as join3, relative, resolve } from "node:path";
39848
39849
 
@@ -40946,14 +40947,27 @@ function extractFencedArtifacts(turns) {
40946
40947
  function artifactKey(name) {
40947
40948
  return basename2(name).replace(/[^a-zA-Z0-9._-]/g, "_");
40948
40949
  }
40950
+ var WORKSPACE_PATCH = "pantheon-workspace.patch";
40949
40951
  function mergeArtifacts(...lists) {
40950
- const seen = /* @__PURE__ */ new Set();
40952
+ const seen = /* @__PURE__ */ new Map();
40951
40953
  const out = [];
40952
40954
  for (const list of lists) {
40953
40955
  for (const item of list ?? []) {
40954
40956
  const key = artifactKey(item.name).toLowerCase();
40955
- if (seen.has(key)) continue;
40956
- seen.add(key);
40957
+ if (seen.has(key)) {
40958
+ if (key === WORKSPACE_PATCH && seen.get(key) !== item.content) {
40959
+ let suffix = 2;
40960
+ let name = `pantheon-workspace-${suffix}.patch`;
40961
+ while (seen.has(name)) {
40962
+ suffix += 1;
40963
+ name = `pantheon-workspace-${suffix}.patch`;
40964
+ }
40965
+ seen.set(name, item.content);
40966
+ out.push({ ...item, name });
40967
+ }
40968
+ continue;
40969
+ }
40970
+ seen.set(key, item.content);
40957
40971
  out.push(item);
40958
40972
  }
40959
40973
  }
@@ -41014,7 +41028,7 @@ function collectDiskArtifacts(turns) {
41014
41028
  }
41015
41029
  return found;
41016
41030
  }
41017
- var WRITE_TOOL = /write|edit|patch|notebook|replace|create|save/i;
41031
+ var MUTATION_TOOL = /write|edit|patch|notebook|replace|create|save|delete|remove/i;
41018
41032
  var PATH_KEYS = [
41019
41033
  "path",
41020
41034
  "file_path",
@@ -41028,7 +41042,7 @@ function pathsFromPatch(input) {
41028
41042
  const body = typeof input === "string" ? input : input && typeof input === "object" ? String(input.input ?? input.patch ?? "") : "";
41029
41043
  if (!body.includes("***")) return [];
41030
41044
  const found = [];
41031
- for (const match of body.matchAll(/^\*\*\*\s+(?:Add|Update|Move to) File:\s*(.+)$/gm)) {
41045
+ for (const match of body.matchAll(/^\*\*\*\s+(?:Add|Update|Delete|Move to) File:\s*(.+)$/gm)) {
41032
41046
  const path = match[1].trim();
41033
41047
  if (path) found.push(path);
41034
41048
  }
@@ -41037,7 +41051,12 @@ function pathsFromPatch(input) {
41037
41051
  var slash = (path) => path.replace(/\\/g, "/");
41038
41052
  function toFull(path, from) {
41039
41053
  const expanded = /^~[\\/]/.test(path) ? join3(homedir2(), path.slice(2)) : path;
41040
- return slash(isAbsolute(expanded) ? resolve(expanded) : resolve(from, expanded));
41054
+ const full = isAbsolute(expanded) ? resolve(expanded) : resolve(from, expanded);
41055
+ try {
41056
+ return slash(realpathSync(full));
41057
+ } catch {
41058
+ return slash(full);
41059
+ }
41041
41060
  }
41042
41061
  function inside(base, full) {
41043
41062
  const rel = relative(base, full);
@@ -41046,11 +41065,50 @@ function inside(base, full) {
41046
41065
  var SKIP_PATH = /(^|\/)(node_modules|\.git|\.next|coverage|\.turbo)(\/|$)|\.(lock|log|db|sqlite3?|map)$|lock\.(json|yaml)$/;
41047
41066
  var BUILD_DIR = /(^|\/)(dist|build|out)(\/|$)/;
41048
41067
  var DELIVERABLE = /\.(png|jpe?g|gif|webp|avif|svg|mp4|mov|webm|mp3|wav|pdf|csv|xlsx?|docx?|pptx?|zip)$/i;
41068
+ var GENERATED_TEXT = /\.(md|txt|html?|json|xml)$/i;
41069
+ var GENERATED_OUTPUT_DIR = /(^|\/)(outputs?|reports?|exports?)(\/|$)/i;
41070
+ function isDeliverable(path) {
41071
+ return DELIVERABLE.test(path) || GENERATED_OUTPUT_DIR.test(path) && GENERATED_TEXT.test(path);
41072
+ }
41049
41073
  var SECRET_PATH = /(^|\/)(\.env(\.[\w-]+)*|\.npmrc|\.netrc|\.pgpass|id_(rsa|dsa|ecdsa|ed25519)|(credentials|secrets?)(\.[\w-]+)?)$|\.(pem|key|p12|pfx|keystore|jks)$/i;
41050
41074
  var MAX_WRITTEN_FILE = 8 * 1024 * 1024;
41051
41075
  var MAX_WRITTEN_TOTAL = 24 * 1024 * 1024;
41052
41076
  var MAX_WRITTEN_COUNT = 200;
41053
41077
  var MAX_SKIP_REPORT = 12;
41078
+ function artifactBytes(artifact) {
41079
+ return artifact.encoding === "base64" ? Buffer.from(artifact.content.replace(/\s/g, ""), "base64").byteLength : Buffer.byteLength(artifact.content);
41080
+ }
41081
+ function fitArtifactBudget(artifacts) {
41082
+ const kept = [];
41083
+ const skipped = [];
41084
+ let skippedTotal = 0;
41085
+ let total = 0;
41086
+ const skip = (name, reason) => {
41087
+ skippedTotal += 1;
41088
+ if (skipped.length < MAX_SKIP_REPORT) skipped.push({ name: artifactKey(name), reason });
41089
+ };
41090
+ for (const artifact of artifacts) {
41091
+ const bytes = artifactBytes(artifact);
41092
+ if (bytes > MAX_WRITTEN_FILE) {
41093
+ skip(
41094
+ artifact.name,
41095
+ `${Math.round(bytes / 1024)}KB, over the ${MAX_WRITTEN_FILE / 1024 / 1024}MB per-file limit`
41096
+ );
41097
+ continue;
41098
+ }
41099
+ if (kept.length >= MAX_WRITTEN_COUNT) {
41100
+ skip(artifact.name, `over the ${MAX_WRITTEN_COUNT}-file limit for one handoff`);
41101
+ continue;
41102
+ }
41103
+ if (total + bytes > MAX_WRITTEN_TOTAL) {
41104
+ skip(artifact.name, `over the ${MAX_WRITTEN_TOTAL / 1024 / 1024}MB total limit for one handoff`);
41105
+ continue;
41106
+ }
41107
+ kept.push(artifact);
41108
+ total += bytes;
41109
+ }
41110
+ return { artifacts: kept, skipped, skippedTotal };
41111
+ }
41054
41112
  function pathsFromText(text2) {
41055
41113
  const found = [];
41056
41114
  const cleaned = text2.replace(/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi, " ");
@@ -41107,25 +41165,125 @@ function readArtifactFile(path, base) {
41107
41165
  bytes: stat2.size
41108
41166
  };
41109
41167
  }
41110
- function trackedFiles(base) {
41168
+ function gitWorkspace(base, since) {
41111
41169
  try {
41112
- const out = execFileSync("git", ["-C", base, "ls-files", "-z"], {
41170
+ const root = slash(
41171
+ resolve(
41172
+ execFileSync("git", ["-C", base, "rev-parse", "--show-toplevel"], {
41173
+ encoding: "utf8",
41174
+ stdio: ["ignore", "pipe", "ignore"]
41175
+ }).trim()
41176
+ )
41177
+ );
41178
+ const out = execFileSync("git", ["-C", root, "ls-files", "-z", "--cached"], {
41113
41179
  encoding: "utf8",
41114
41180
  maxBuffer: 64 * 1024 * 1024,
41115
41181
  stdio: ["ignore", "pipe", "ignore"]
41116
41182
  });
41117
- return new Set(
41118
- out.split("\0").filter(Boolean).map((relative3) => slash(join3(base, relative3)))
41183
+ let hasHead = true;
41184
+ try {
41185
+ execFileSync("git", ["-C", root, "rev-parse", "--verify", "HEAD"], {
41186
+ stdio: "ignore"
41187
+ });
41188
+ } catch {
41189
+ hasHead = false;
41190
+ }
41191
+ let baseRef = hasHead ? "HEAD" : null;
41192
+ if (hasHead && since !== null) {
41193
+ const before = execFileSync(
41194
+ "git",
41195
+ [
41196
+ "-C",
41197
+ root,
41198
+ "rev-list",
41199
+ "-1",
41200
+ // Git commit timestamps have one-second precision. Move the boundary
41201
+ // back a second so a commit made just after capture began is not
41202
+ // mistaken for the baseline.
41203
+ `--before=${new Date(since - 1e3).toISOString()}`,
41204
+ "HEAD"
41205
+ ],
41206
+ {
41207
+ encoding: "utf8",
41208
+ stdio: ["ignore", "pipe", "ignore"]
41209
+ }
41210
+ ).trim();
41211
+ baseRef = before || execFileSync("git", ["-C", root, "hash-object", "-w", "-t", "tree", "--stdin"], {
41212
+ encoding: "utf8",
41213
+ input: "",
41214
+ stdio: ["pipe", "pipe", "ignore"]
41215
+ }).trim();
41216
+ }
41217
+ const tracked = new Set(
41218
+ out.split("\0").filter(Boolean).map((path) => slash(resolve(root, path)))
41119
41219
  );
41220
+ if (baseRef) {
41221
+ const atBase = execFileSync(
41222
+ "git",
41223
+ ["-C", root, "ls-tree", "-r", "--name-only", "-z", baseRef],
41224
+ {
41225
+ encoding: "utf8",
41226
+ maxBuffer: 64 * 1024 * 1024,
41227
+ stdio: ["ignore", "pipe", "ignore"]
41228
+ }
41229
+ );
41230
+ for (const path of atBase.split("\0").filter(Boolean)) {
41231
+ tracked.add(slash(resolve(root, path)));
41232
+ }
41233
+ }
41234
+ return {
41235
+ root,
41236
+ tracked,
41237
+ hasHead,
41238
+ baseRef
41239
+ };
41120
41240
  } catch {
41121
41241
  return null;
41122
41242
  }
41123
41243
  }
41244
+ var GIT_DIFF_BUFFER = MAX_WRITTEN_TOTAL + 1024 * 1024;
41245
+ function gitDiff(cwd, args) {
41246
+ const result = spawnSync(
41247
+ "git",
41248
+ ["-C", cwd, "diff", "--binary", "--no-ext-diff", "--no-textconv", ...args],
41249
+ {
41250
+ encoding: "utf8",
41251
+ maxBuffer: GIT_DIFF_BUFFER,
41252
+ stdio: ["ignore", "pipe", "ignore"]
41253
+ }
41254
+ );
41255
+ if (result.error || result.status !== 0 && result.status !== 1) return null;
41256
+ return result.stdout || "";
41257
+ }
41258
+ function workspacePatch(paths, base, workspace) {
41259
+ const root = workspace?.root ?? base;
41260
+ const candidates = [...new Set(paths)].filter((path) => inside(root, path)).map((path) => ({ full: path, relative: slash(relative(root, path)) })).filter((item) => item.relative && !item.relative.startsWith(".."));
41261
+ if (!candidates.length) return "";
41262
+ const tracked = workspace?.hasHead && workspace.baseRef ? candidates.filter((item) => workspace.tracked.has(item.full)).map((item) => item.relative) : [];
41263
+ const untracked = candidates.filter((item) => !tracked.includes(item.relative));
41264
+ let patch = "";
41265
+ if (tracked.length) {
41266
+ const diff = gitDiff(root, [workspace?.baseRef || "HEAD", "--", ...tracked]);
41267
+ if (diff === null) return null;
41268
+ patch += diff;
41269
+ }
41270
+ for (const item of untracked) {
41271
+ if (!existsSync3(item.full)) continue;
41272
+ const diff = gitDiff(root, ["--no-index", "--", "/dev/null", item.relative]);
41273
+ if (diff === null) return null;
41274
+ patch += diff;
41275
+ }
41276
+ return patch;
41277
+ }
41124
41278
  function budgetReason(tracked, limit) {
41125
41279
  return tracked ? `already tracked by git, so the ${limit} went to files that are not` : `over the ${limit}`;
41126
41280
  }
41127
41281
  function collectWrittenArtifacts(turns, cwd = process.cwd(), opts = {}) {
41128
- const base = slash(resolve(cwd));
41282
+ let base = slash(resolve(cwd));
41283
+ try {
41284
+ base = slash(realpathSync(base));
41285
+ } catch {
41286
+ }
41129
41287
  const since = opts.since ?? null;
41130
41288
  const vault = opts.home ? slash(resolve(opts.home)) : null;
41131
41289
  const written = /* @__PURE__ */ new Set();
@@ -41133,14 +41291,14 @@ function collectWrittenArtifacts(turns, cwd = process.cwd(), opts = {}) {
41133
41291
  const add = (into, path, from = base) => {
41134
41292
  const full = toFull(path, from);
41135
41293
  if (SKIP_PATH.test(full) || SECRET_PATH.test(full)) return;
41136
- if (BUILD_DIR.test(full) && !DELIVERABLE.test(full)) return;
41294
+ if (BUILD_DIR.test(full) && !isDeliverable(full)) return;
41137
41295
  if (vault && inside(vault, full)) return;
41138
41296
  if (into === touched && !inside(base, full)) return;
41139
41297
  into.add(full);
41140
41298
  };
41141
41299
  for (const turn of turns) {
41142
41300
  for (const call of turn.toolCalls ?? []) {
41143
- if (WRITE_TOOL.test(call.name || "")) {
41301
+ if (MUTATION_TOOL.test(call.name || "")) {
41144
41302
  const path = pathFromInput(call.input);
41145
41303
  if (path) add(written, path);
41146
41304
  for (const patched of pathsFromPatch(call.input)) add(written, patched);
@@ -41154,12 +41312,13 @@ function collectWrittenArtifacts(turns, cwd = process.cwd(), opts = {}) {
41154
41312
  const found = [];
41155
41313
  const skipped = [];
41156
41314
  let skippedTotal = 0;
41315
+ let consolidatedFiles = 0;
41157
41316
  let total = 0;
41158
41317
  const note = (path, reason) => {
41159
41318
  skippedTotal += 1;
41160
41319
  if (skipped.length < MAX_SKIP_REPORT) skipped.push({ name: flatName(path, base), reason });
41161
41320
  };
41162
- const store = (path, gate, tracked2) => {
41321
+ const store = (path, gate, tracked) => {
41163
41322
  if (!existsSync3(path)) return;
41164
41323
  const stat2 = statSync2(path);
41165
41324
  if (!stat2.isFile() || stat2.size === 0) return;
@@ -41172,13 +41331,13 @@ function collectWrittenArtifacts(turns, cwd = process.cwd(), opts = {}) {
41172
41331
  return;
41173
41332
  }
41174
41333
  if (found.length >= MAX_WRITTEN_COUNT) {
41175
- note(path, budgetReason(tracked2, `${MAX_WRITTEN_COUNT}-file limit for one handoff`));
41334
+ note(path, budgetReason(tracked, `${MAX_WRITTEN_COUNT}-file limit for one handoff`));
41176
41335
  return;
41177
41336
  }
41178
41337
  if (total + stat2.size > MAX_WRITTEN_TOTAL) {
41179
41338
  note(
41180
41339
  path,
41181
- budgetReason(tracked2, `${MAX_WRITTEN_TOTAL / 1024 / 1024}MB total limit for one handoff`)
41340
+ budgetReason(tracked, `${MAX_WRITTEN_TOTAL / 1024 / 1024}MB total limit for one handoff`)
41182
41341
  );
41183
41342
  return;
41184
41343
  }
@@ -41187,19 +41346,65 @@ function collectWrittenArtifacts(turns, cwd = process.cwd(), opts = {}) {
41187
41346
  total += file.bytes;
41188
41347
  found.push({ name: file.name, content: file.content, encoding: file.encoding });
41189
41348
  };
41190
- const tracked = trackedFiles(base);
41349
+ const workspace = gitWorkspace(base, since);
41191
41350
  const queue = [
41192
41351
  ...[...written].map((path) => ({ path, gate: false })),
41193
41352
  ...[...touched].filter((path) => !written.has(path)).map((path) => ({ path, gate: true }))
41194
- ].map((item) => ({ ...item, tracked: tracked?.has(item.path) ?? false }));
41353
+ ].map((item) => ({ ...item, tracked: workspace?.tracked.has(item.path) ?? false }));
41195
41354
  queue.sort((a, b) => Number(a.tracked) - Number(b.tracked));
41355
+ const source = /* @__PURE__ */ new Set();
41356
+ const snapshotRoot = workspace?.root ?? base;
41196
41357
  for (const item of queue) {
41197
41358
  try {
41198
- store(item.path, item.gate, item.tracked);
41359
+ if (isDeliverable(item.path)) {
41360
+ store(item.path, item.gate, item.tracked);
41361
+ continue;
41362
+ }
41363
+ if (!inside(snapshotRoot, item.path)) {
41364
+ if (!item.gate) {
41365
+ store(item.path, false, item.tracked);
41366
+ } else {
41367
+ note(item.path, "outside the project; the transcript records the change");
41368
+ }
41369
+ continue;
41370
+ }
41371
+ if (existsSync3(item.path)) {
41372
+ const stat2 = statSync2(item.path);
41373
+ if (!stat2.isFile() || stat2.size === 0) continue;
41374
+ if (item.gate && since !== null && stat2.mtimeMs < since) continue;
41375
+ source.add(item.path);
41376
+ } else if (item.tracked) {
41377
+ source.add(item.path);
41378
+ }
41199
41379
  } catch {
41200
41380
  }
41201
41381
  }
41202
- return { artifacts: found, skipped, skippedTotal };
41382
+ if (source.size) {
41383
+ const patch = workspacePatch([...source], base, workspace);
41384
+ const noteSource = (reason) => {
41385
+ for (const path of source) note(path, reason);
41386
+ };
41387
+ if (patch === null) {
41388
+ noteSource("could not create the consolidated source snapshot");
41389
+ } else if (patch) {
41390
+ const bytes = Buffer.byteLength(patch);
41391
+ if (bytes > MAX_WRITTEN_FILE) {
41392
+ noteSource(
41393
+ `workspace patch is ${Math.round(bytes / 1024)}KB, over the ${MAX_WRITTEN_FILE / 1024 / 1024}MB per-file limit`
41394
+ );
41395
+ } else if (found.length >= MAX_WRITTEN_COUNT) {
41396
+ noteSource(`workspace patch is over the ${MAX_WRITTEN_COUNT}-file limit for one handoff`);
41397
+ } else if (total + bytes > MAX_WRITTEN_TOTAL) {
41398
+ noteSource(
41399
+ `workspace patch is over the ${MAX_WRITTEN_TOTAL / 1024 / 1024}MB total limit for one handoff`
41400
+ );
41401
+ } else {
41402
+ found.push({ name: WORKSPACE_PATCH, content: patch, encoding: "utf8" });
41403
+ consolidatedFiles = source.size;
41404
+ }
41405
+ }
41406
+ }
41407
+ return { artifacts: found, consolidatedFiles, skipped, skippedTotal };
41203
41408
  }
41204
41409
  function collectAttachedArtifacts(turns, cwd = process.cwd()) {
41205
41410
  const base = slash(resolve(cwd));
@@ -41426,7 +41631,7 @@ function resolveSpace(home, name) {
41426
41631
  const { slug, root } = resolveForRead(home, name, { create: false });
41427
41632
  return { slug, root };
41428
41633
  }
41429
- function writeArtifacts(sessionDir, artifacts = []) {
41634
+ function writeArtifacts(sessionDir, artifacts = [], options = {}) {
41430
41635
  if (artifacts.length > MAX_WRITTEN_COUNT) {
41431
41636
  throw new Error(`A handoff can store at most ${MAX_WRITTEN_COUNT} artifacts.`);
41432
41637
  }
@@ -41457,6 +41662,12 @@ function writeArtifacts(sessionDir, artifacts = []) {
41457
41662
  writeFileSync2(join3(dir, safe2), buf);
41458
41663
  names.push(safe2);
41459
41664
  }
41665
+ if (options.replace) {
41666
+ const keep = new Set(names);
41667
+ for (const existing of readdirSync3(dir)) {
41668
+ if (!keep.has(existing)) rmSync2(join3(dir, existing), { recursive: true, force: true });
41669
+ }
41670
+ }
41460
41671
  return names;
41461
41672
  }
41462
41673
  function sanitizeSessionId(value) {
@@ -41491,7 +41702,7 @@ function mergeTurns(existing, incoming) {
41491
41702
  function latestSessionId(root) {
41492
41703
  return sessionDirs(root)[0]?.id ?? null;
41493
41704
  }
41494
- function writeSession(root, source, turns, artifacts, sessionId) {
41705
+ function writeSession(root, source, turns, artifacts, sessionId, options = {}) {
41495
41706
  const id = sanitizeSessionId(
41496
41707
  sessionId || `${(source || "session").replace(/[^a-z0-9-]/gi, "").toLowerCase() || "session"}-${stamp()}`
41497
41708
  );
@@ -41514,7 +41725,7 @@ function writeSession(root, source, turns, artifacts, sessionId) {
41514
41725
  ""
41515
41726
  ].join("\n")
41516
41727
  );
41517
- const stored = writeArtifacts(sessionDir, artifacts);
41728
+ const stored = writeArtifacts(sessionDir, artifacts, { replace: options.replaceArtifacts });
41518
41729
  return { sessionId: id, artifacts: stored, turns: merged, added, existing: existing.length };
41519
41730
  }
41520
41731
  var RECAP = /\b(user (uploaded|asked|then asked|also asked|also earlier)|assistant (built|wrote|revised|updated|saved)|the user (then |also )?(asked|uploaded|wanted)|\[unrelated)\b/i;
@@ -41625,20 +41836,28 @@ function writeHandoff(home, input) {
41625
41836
  }
41626
41837
  const cwd = input.cwd || process.cwd();
41627
41838
  const sweep = captured ? collectWrittenArtifacts(turns, cwd, { since: sessionStart(captured.session.path), home }) : null;
41628
- const artifacts = mergeArtifacts(
41839
+ const mergedArtifacts = mergeArtifacts(
41629
41840
  input.artifacts,
41630
41841
  extractFencedArtifacts(turns),
41631
41842
  collectDiskArtifacts(turns),
41632
41843
  sweep?.artifacts,
41633
41844
  captured ? collectAttachedArtifacts(turns, cwd) : void 0
41634
41845
  );
41846
+ const fitted = fitArtifactBudget(mergedArtifacts);
41847
+ const artifacts = fitted.artifacts;
41848
+ const sweepPatch = sweep?.artifacts.find((artifact) => artifact.name === WORKSPACE_PATCH);
41849
+ const consolidatedOverflow = sweepPatch && !artifacts.some((artifact) => artifact.content === sweepPatch.content) ? Math.max((sweep?.consolidatedFiles ?? 0) - 1, 0) : 0;
41635
41850
  if (!captured) {
41636
41851
  const missing = missingGeneratedFiles(turns, artifacts);
41637
41852
  if (missing) throw new Error(missing);
41638
41853
  }
41639
41854
  const source = input.source || captured?.session.source;
41640
41855
  const sessionId = captured ? captured.session.key : input.append ? latestSessionId(root) || void 0 : void 0;
41641
- const session = writeSession(root, source, turns, artifacts, sessionId);
41856
+ const session = writeSession(root, source, turns, artifacts, sessionId, {
41857
+ // A local capture rereads the complete session, so its artifact set is
41858
+ // authoritative. Remove obsolete per-file artifacts from older captures.
41859
+ replaceArtifacts: Boolean(captured)
41860
+ });
41642
41861
  const sessions = sessionSummaries(root);
41643
41862
  const packet = distill({
41644
41863
  space: input.space,
@@ -41682,10 +41901,10 @@ function writeHandoff(home, input) {
41682
41901
  artifacts: session.artifacts,
41683
41902
  // Files this session made that the archive would not take. Silence here is
41684
41903
  // how a handoff comes to promise more than it holds.
41685
- skipped: sweep?.skipped ?? [],
41904
+ skipped: [...sweep?.skipped ?? [], ...fitted.skipped].slice(0, MAX_SKIP_REPORT),
41686
41905
  // The list above is capped. Reporting its length as the total understates
41687
41906
  // the loss by however many it left out.
41688
- skippedTotal: sweep?.skippedTotal ?? 0,
41907
+ skippedTotal: (sweep?.skippedTotal ?? 0) + fitted.skippedTotal + consolidatedOverflow,
41689
41908
  // Usually empty. Only a failure that recurred across separate conversations
41690
41909
  // and is not already documented gets this far.
41691
41910
  skillCandidates: spaceSkillCandidates(root, cwd),
@@ -42632,6 +42851,7 @@ var MIME_BY_EXTENSION = {
42632
42851
  ".md": "text/markdown",
42633
42852
  ".mp3": "audio/mpeg",
42634
42853
  ".mp4": "video/mp4",
42854
+ ".patch": "text/x-diff",
42635
42855
  ".pdf": "application/pdf",
42636
42856
  ".png": "image/png",
42637
42857
  ".ppt": "application/vnd.ms-powerpoint",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pantheon-cli",
3
- "version": "0.2.43",
3
+ "version": "0.2.44",
4
4
  "description": "Carry agent conscience between AI coding agents. Hand off a conversation in one agent, resume it in another.",
5
5
  "license": "MIT",
6
6
  "type": "module",