heyquilt 0.3.140 → 0.3.141

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/RELEASES.md CHANGED
@@ -11,6 +11,10 @@ Format: `## <version> — <YYYY-MM-DD>`, an optional one-line summary, then bull
11
11
  Lead each bullet with a short bold phrase. Inline `code` and **bold** are rendered;
12
12
  nothing else is.
13
13
 
14
+ ## 0.3.141 — 2026-11-01
15
+
16
+ - **A new, empty folder joining a session that is already in Seam takes the square as it is.** Its first files come from the session's old copy of the branch, and before, a folder without git could start following its square while that old copy was still being written to it, so every older file went into the square as its own edits (an agent's new folder put 166 stale files into main's square). Now the folder's own syncing stops before it follows the square, and nothing it got from the session is ever counted as its edits.
17
+
14
18
  ## 0.3.140 — 2026-11-01
15
19
 
16
20
  0.3.139 was tagged but never published; everything meant for it is here.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heyquilt",
3
- "version": "0.3.140",
3
+ "version": "0.3.141",
4
4
  "description": "Real-time, tool-agnostic pair vibe coding: sync a project folder live between collaborators using any AI coding tool.",
5
5
  "author": {
6
6
  "name": "Daniel Carmichael",
@@ -307,8 +307,9 @@ export class SquareFollower {
307
307
  const s = this.session
308
308
  // Held before the first await: nothing of the folder reaches the read-only branch document while the block opens.
309
309
  const at = this.inPlaceOn() ? squareFor(quilt, s.squareBranchKey ? s.squareBranchKey() : s.branchKey()) : null
310
- if (at && s.enterSquare && !(this.here && this.here.square === at.square)) s.enterSquare(at, quilt)
311
- const next = this.turn.then(() => this.settle(quilt)).catch((err) => { if (s.log) s.log(`🧵 ${err.message}`) })
310
+ const entered = at && s.enterSquare && !(this.here && this.here.square === at.square) ? at.square : null
311
+ if (entered) s.enterSquare(at, quilt)
312
+ const next = this.turn.then(() => this.settle(quilt, entered)).catch((err) => { if (s.log) s.log(`🧵 ${err.message}`) })
312
313
  this.turn = next
313
314
  // A merge onto main moves a branch on (quiltNext), and the relay says so: the other squares may be behind now.
314
315
  next.then(() => this.catchUpSoon())
@@ -318,7 +319,8 @@ export class SquareFollower {
318
319
  /** Seam on for the app, a folder of the session's own, and a session that can hold its sync (a Session). */
319
320
  inPlaceOn () { return !!(appSeamUrl() && this.session.root && this.session.enterSquare) }
320
321
 
321
- async settle (quilt) {
322
+ /** `entered`: the square onQuilt already held the session's sync for. */
323
+ async settle (quilt, entered = null) {
322
324
  const s = this.session
323
325
  const at = this.inPlaceOn() ? squareFor(quilt, s.squareBranchKey ? s.squareBranchKey() : s.branchKey()) : null
324
326
  // The separate folder lets go of a square the branch no longer has (switched back, moved).
@@ -340,6 +342,11 @@ export class SquareFollower {
340
342
  } else if (s.log) s.log(`🧵 this folder left square ${squareShort(was)}: its branch is on ${squareShort(at.square)} now.`)
341
343
  }
342
344
  if (!at || (this.here && this.here.square === at.square)) return
345
+ // The branch may only be known now (a folder without git learns the room's default branch after
346
+ // the relay's quilt message): the session's own sync holds before the block opens, every time, or
347
+ // it writes the read-only branch document's older copy over the square's files and the block takes
348
+ // that for this member's edits (2026-11-01: an agent's new folder put 166 stale files into main's square).
349
+ if (s.enterSquare && entered !== at.square) s.enterSquare(at, quilt)
343
350
  await this.openHere(at, quilt)
344
351
  }
345
352
 
@@ -349,13 +356,18 @@ export class SquareFollower {
349
356
  const here = { square: at.square, quilt, block: null, problem: '', opening: true }
350
357
  this.here = here
351
358
  if (s.scheduleStatusWrite) s.scheduleStatusWrite()
359
+ // A folder that joined the quilt empty (Session.joinedEmpty): what it has is the session's sync from
360
+ // the read-only branch document, an older copy of the square's files. Its first look takes nothing
361
+ // of that for its edits (no refused writes, boxes or branch work of its own); only a file changed
362
+ // on disk since the session wrote it is the member's.
363
+ const empty = !fresh && !!s.joinedEmpty
352
364
  try {
353
365
  // Edits the read-only branch document refused (they reached it after the switch) are the folder's too.
354
- const unsent = !fresh && s.unsentPaths ? await s.unsentPaths().catch(() => null) : null
366
+ const unsent = !fresh && !empty && s.unsentPaths ? await s.unsentPaths().catch(() => null) : null
355
367
  const block = await this.open({
356
368
  dir: s.root,
357
369
  // A square opened for this folder's branch (Session.openSquareHere: the branch had none) takes the folder as it is: its files are the work.
358
- inPlace: fresh ? { edited: () => false, fresh: true } : s.folderWins === at.square ? { edited: () => true } : { edited: (p) => s.editedSinceSync(p) || !!(unsent && unsent.has(p)) || !!(s.boxedHere && s.boxedHere(p)), boxed: (p) => !!(s.boxedHere && s.boxedHere(p)), heldBack: (p) => !!(s.heldBackHere && s.heldBackHere(p)), synced: (p) => !!(s.syncedHere && s.syncedHere(p)), base: s.syncedText ? (p) => s.syncedText(p) : null, own: () => (s.branchOwnPaths ? s.branchOwnPaths() : null), atTip: ((quilt && quilt.atTip) || []).includes(s.squareBranchKey ? s.squareBranchKey() : s.branchKey()) },
370
+ inPlace: fresh ? { edited: () => false, fresh: true } : empty ? { edited: (p) => !!(s.editedSinceSync && s.editedSinceSync(p)), fresh: true } : s.folderWins === at.square ? { edited: () => true } : { edited: (p) => s.editedSinceSync(p) || !!(unsent && unsent.has(p)) || !!(s.boxedHere && s.boxedHere(p)), boxed: (p) => !!(s.boxedHere && s.boxedHere(p)), heldBack: (p) => !!(s.heldBackHere && s.heldBackHere(p)), synced: (p) => !!(s.syncedHere && s.syncedHere(p)), base: s.syncedText ? (p) => s.syncedText(p) : null, own: () => (s.branchOwnPaths ? s.branchOwnPaths() : null), atTip: ((quilt && quilt.atTip) || []).includes(s.squareBranchKey ? s.squareBranchKey() : s.branchKey()) },
359
371
  skip: (p) => !s.syncable(p),
360
372
  skipDir: s.ignoredDir ? (p) => s.ignoredDir(p) : null,
361
373
  record: path.join(s.stateDir || path.join(s.root, '.quilt'), 'block.json'),
@@ -371,6 +383,7 @@ export class SquareFollower {
371
383
  onEdits: s.squareEdits ? (list, doc, held) => { if (this.here === here) s.squareEdits(list, doc, held) } : null
372
384
  })
373
385
  if (this.here !== here) { await block.close().catch(() => {}); return }
386
+ if (empty) s.joinedEmpty = false
374
387
  here.block = block
375
388
  here.opening = false
376
389
  if (s.followSquareDoc) s.followSquareDoc(block.doc)
package/src/session.js CHANGED
@@ -592,6 +592,11 @@ export class Session extends EventEmitter {
592
592
  this.loadWebhook()
593
593
  this.loadOnMention()
594
594
  const hadState = this.loadState()
595
+ // A folder never synced and empty as the session starts: in a session that is a layout-3 quilt already,
596
+ // whatever it gets before its block opens is the read-only branch document's older copy, never its
597
+ // member's edits (session-follow.js openHere; 2026-11-01). Cleared by a first word of the quilt that is
598
+ // not layout 3, and once the block opens.
599
+ this.joinedEmpty = !hadState && !walk(this.root, this.ig).some((rel) => this.syncable(rel))
595
600
  // Restarted while the folder follows its square: its .git is set aside (session-follow.js) and stays so; its branch is the note's.
596
601
  this.gitAside = hasGitDir(this.root) ? null : gitAsideOf(this.root)
597
602
  if (hadState) this.loadClaims()
@@ -638,6 +643,7 @@ export class Session extends EventEmitter {
638
643
  // Seam (Seam's plans/quilt-source-control/16): the relay says when the session is a quilt, and which.
639
644
  this.conn.on('quilt', (q) => {
640
645
  this.quilt = q
646
+ if (!(q && q.layout === 3)) this.joinedEmpty = false
641
647
  this.emit('quilt', q)
642
648
  // At layout 3 this folder follows its branch's square by itself (session-follow.js).
643
649
  if (!this.squareFollower) this.squareFollower = new SquareFollower(this)