pantheon-cli 0.2.75 → 0.2.77

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 +74 -7
  2. package/package.json +1 -1
package/dist/pantheon.mjs CHANGED
@@ -43701,7 +43701,7 @@ import { gzipSync } from "node:zlib";
43701
43701
  var DRIVE_MAX_FILE_BYTES = 200 * 1024 * 1024;
43702
43702
  var DRIVE_MAX_CHANGE_BYTES = 256 * 1024 * 1024;
43703
43703
  var DRIVE_MAX_CHANGES = 100;
43704
- var DRIVE_MAX_REQUEST_BYTES = 3 * 1024 * 1024;
43704
+ var DRIVE_MAX_REQUEST_BYTES = 4 * 1024 * 1024;
43705
43705
  var CONTROL_NAMES = /* @__PURE__ */ new Set([
43706
43706
  ".git",
43707
43707
  ".pantheon",
@@ -43758,7 +43758,8 @@ function driveWorkspaceStatePaths(home) {
43758
43758
  return {
43759
43759
  ledger: `${base}.pantheon-sync.json`,
43760
43760
  outbox: `${base}.pantheon-outbox.json`,
43761
- conflicts: `${base}.pantheon-conflicts`
43761
+ conflicts: `${base}.pantheon-conflicts`,
43762
+ skipped: `${base}.pantheon-skipped.json`
43762
43763
  };
43763
43764
  }
43764
43765
  function writeJsonAtomic(path, value) {
@@ -43782,6 +43783,39 @@ function readJsonSafe(path) {
43782
43783
  function writeLedger(path, vaultId, manifest) {
43783
43784
  writeJsonAtomic(path, { ...manifest, vaultId });
43784
43785
  }
43786
+ function updateSkippedLedger(home, vaultId, attempted, deleted, skipped) {
43787
+ const path = driveWorkspaceStatePaths(home).skipped;
43788
+ const previous = readJsonSafe(path);
43789
+ const entries = previous?.vaultId === vaultId ? { ...previous.entries } : {};
43790
+ for (const [key, entry] of Object.entries(entries)) {
43791
+ const file = join7(home, ...key.split("/"));
43792
+ if (!existsSync7(file) || !lstatSync2(file).isFile() || readFileSync6(file).length !== entry.size || sha256(readFileSync6(file)) !== entry.sha256) {
43793
+ delete entries[key];
43794
+ }
43795
+ }
43796
+ for (const change of attempted) delete entries[change.path];
43797
+ for (const deletedPath of deleted) delete entries[deletedPath];
43798
+ const byPath = new Map(attempted.map((change) => [change.path, change]));
43799
+ for (const item of skipped) {
43800
+ const change = byPath.get(item.path);
43801
+ if (!change) continue;
43802
+ entries[item.path] = {
43803
+ path: item.path,
43804
+ sha256: change.sha256,
43805
+ size: change.size,
43806
+ reason: item.reason
43807
+ };
43808
+ }
43809
+ if (Object.keys(entries).length) {
43810
+ writeJsonAtomic(path, {
43811
+ version: 1,
43812
+ vaultId,
43813
+ entries
43814
+ });
43815
+ } else {
43816
+ rmSync5(path, { force: true });
43817
+ }
43818
+ }
43785
43819
  function quarantineUnownedDriveWorkspace(home, vaultId, now = /* @__PURE__ */ new Date()) {
43786
43820
  const paths = driveWorkspaceStatePaths(home);
43787
43821
  const ledger = readJsonSafe(paths.ledger);
@@ -43800,6 +43834,7 @@ function quarantineUnownedDriveWorkspace(home, vaultId, now = /* @__PURE__ */ ne
43800
43834
  if (ledger?.vaultId !== vaultId) {
43801
43835
  rmSync5(paths.ledger, { force: true });
43802
43836
  rmSync5(paths.outbox, { force: true });
43837
+ rmSync5(paths.skipped, { force: true });
43803
43838
  }
43804
43839
  return quarantined;
43805
43840
  }
@@ -43838,9 +43873,13 @@ function scanDriveWorkspace(home) {
43838
43873
  }
43839
43874
  function diffDriveManifest(home, manifest) {
43840
43875
  const local = scanDriveWorkspace(home);
43876
+ const skipped = readJsonSafe(driveWorkspaceStatePaths(home).skipped)?.entries ?? {};
43841
43877
  const changes = [];
43842
43878
  let total = 0;
43843
43879
  for (const [path, entry] of Object.entries(local)) {
43880
+ if (skipped[path]?.sha256 === entry.sha256 && skipped[path]?.size === entry.size) {
43881
+ continue;
43882
+ }
43844
43883
  if (manifest.entries[path]?.sha256 === entry.sha256 && manifest.entries[path]?.size === entry.size) {
43845
43884
  continue;
43846
43885
  }
@@ -43892,16 +43931,19 @@ async function responseError(response) {
43892
43931
  );
43893
43932
  }
43894
43933
  async function publishOutbox(config2, credentials, outbox, fetcher) {
43895
- const requestBudget = DRIVE_MAX_REQUEST_BYTES - 256 * 1024;
43934
+ const requestBudget = DRIVE_MAX_REQUEST_BYTES - 128 * 1024;
43896
43935
  const groups = [];
43936
+ const skipped = [];
43897
43937
  let group = [];
43898
43938
  let groupBytes = 0;
43899
43939
  for (const change of outbox.changes) {
43900
43940
  const bytes = Buffer.byteLength(JSON.stringify(change)) + 1;
43901
43941
  if (bytes > requestBudget) {
43902
- throw new Error(
43903
- `Compressed workspace file ${change.path} exceeds the Drive request limit.`
43904
- );
43942
+ skipped.push({
43943
+ path: change.path,
43944
+ reason: `${(change.size / 1024 / 1024).toFixed(1)} MB cannot fit safely in one hosted Drive request. The file remains on this machine; the rest of the handoff was saved.`
43945
+ });
43946
+ continue;
43905
43947
  }
43906
43948
  if (group.length && groupBytes + bytes > requestBudget) {
43907
43949
  groups.push(group);
@@ -43946,7 +43988,8 @@ async function publishOutbox(config2, credentials, outbox, fetcher) {
43946
43988
  if (!published) throw new Error("Drive sync did not publish any batches.");
43947
43989
  return {
43948
43990
  ...published,
43949
- ...merged ? { merged: true } : {}
43991
+ ...merged ? { merged: true } : {},
43992
+ ...skipped.length ? { skipped } : {}
43950
43993
  };
43951
43994
  }
43952
43995
  function httpDriveWorkspaceHooks(config2, credentials, fetcher = fetch) {
@@ -43965,6 +44008,12 @@ function httpDriveWorkspaceHooks(config2, credentials, fetcher = fetch) {
43965
44008
  return manifest;
43966
44009
  }
43967
44010
  async function applyManifest(home, manifest, protectedPaths = /* @__PURE__ */ new Set()) {
44011
+ const locallySkipped = readJsonSafe(paths.skipped);
44012
+ if (locallySkipped?.vaultId === config2.vaultId) {
44013
+ for (const path of Object.keys(locallySkipped.entries)) {
44014
+ protectedPaths.add(path);
44015
+ }
44016
+ }
43968
44017
  const staged = [];
43969
44018
  const previous = readJsonSafe(paths.ledger);
43970
44019
  mkdirSync6(home, { recursive: true });
@@ -44078,6 +44127,14 @@ function httpDriveWorkspaceHooks(config2, credentials, fetcher = fetch) {
44078
44127
  fetcher
44079
44128
  );
44080
44129
  writeLedger(paths.ledger, config2.vaultId, published.manifest);
44130
+ updateSkippedLedger(
44131
+ home,
44132
+ config2.vaultId,
44133
+ currentPending.changes,
44134
+ currentPending.deletes,
44135
+ published.skipped ?? []
44136
+ );
44137
+ result.skipped = published.skipped;
44081
44138
  rmSync5(paths.outbox, { force: true });
44082
44139
  pending = null;
44083
44140
  } catch (error2) {
@@ -44144,12 +44201,20 @@ function httpDriveWorkspaceHooks(config2, credentials, fetcher = fetch) {
44144
44201
  }
44145
44202
  const published = await publishOutbox(config2, credentials, outbox, fetcher);
44146
44203
  writeLedger(paths.ledger, config2.vaultId, published.manifest);
44204
+ updateSkippedLedger(
44205
+ home,
44206
+ config2.vaultId,
44207
+ outbox.changes,
44208
+ outbox.deletes,
44209
+ published.skipped ?? []
44210
+ );
44147
44211
  rmSync5(paths.outbox, { force: true });
44148
44212
  result.ok = true;
44149
44213
  result.changed = true;
44150
44214
  result.committed = true;
44151
44215
  result.pushed = true;
44152
44216
  result.revision = { id: published.revision };
44217
+ result.skipped = published.skipped;
44153
44218
  return result;
44154
44219
  } catch (error2) {
44155
44220
  if (outbox && error2 instanceof DriveWorkspaceHttpError && error2.status === 409) {
@@ -45069,6 +45134,7 @@ ${GUIDE}` }]
45069
45134
  ok: sync2.ok !== false,
45070
45135
  ...written,
45071
45136
  sync: sync2,
45137
+ storageSkipped: sync2.skipped ?? [],
45072
45138
  skillReview: review,
45073
45139
  skillReviewAction: !shouldReview ? null : {
45074
45140
  requiresAgentJudgment: true,
@@ -45087,6 +45153,7 @@ ${GUIDE}` }]
45087
45153
  // many there were as well as which ones, because the list is
45088
45154
  // capped and reporting its length as the total is a lie.
45089
45155
  written.skipped?.length ? `Not stored: ${written.skippedTotal} file${written.skippedTotal === 1 ? "" : "s"}${written.skippedTotal > written.skipped.length ? `, of which these ${written.skipped.length}` : ""} \u2014 ${written.skipped.map((file) => `${file.name} (${file.reason})`).join(", ")}. Report the total, not just the named ones, so the human knows what the space does not hold.` : null,
45156
+ sync2.skipped?.length ? `Drive skipped ${sync2.skipped.length} oversized file${sync2.skipped.length === 1 ? "" : "s"} without blocking the handoff: ${sync2.skipped.map((file) => `${file.path} (${file.reason})`).join(", ")}. Clearly tell the human which files remain local.` : null,
45090
45157
  shouldReview ? review ? AUTO_SKILL_REVIEW : `The post-handoff skill review could not run. Call pantheon_skill_review for "${written.slug}" and continue without asking permission.` : null
45091
45158
  ].filter(Boolean).join(" ")
45092
45159
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pantheon-cli",
3
- "version": "0.2.75",
3
+ "version": "0.2.77",
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",