heyquilt 0.3.170 → 0.3.171

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 (61) hide show
  1. package/RELEASES.md +22 -0
  2. package/bin/quilt.js +16 -9
  3. package/package.json +2 -2
  4. package/src/agent-task-workflow.js +2 -9
  5. package/src/base-pick.js +91 -0
  6. package/src/boxes.js +6 -7
  7. package/src/catchup.js +1 -1
  8. package/src/chat-links.js +1 -3
  9. package/src/connection.js +24 -5
  10. package/src/control.js +27 -20
  11. package/src/duties.js +32 -56
  12. package/src/github-commit.js +1 -1
  13. package/src/held.js +323 -0
  14. package/src/hooks.js +27 -66
  15. package/src/identity.js +1 -1
  16. package/src/inbox.js +5 -4
  17. package/src/key-cli.js +1 -1
  18. package/src/live-merge.js +592 -0
  19. package/src/mcp.js +57 -102
  20. package/src/merge3.js +65 -1
  21. package/src/now-summary.js +4 -6
  22. package/src/pathrules.js +1 -1
  23. package/src/persona.js +1 -1
  24. package/src/presence.js +2 -0
  25. package/src/protocol.js +2 -2
  26. package/src/read-bases.js +123 -0
  27. package/src/relay-ask.js +2 -2
  28. package/src/relay-live-write.js +173 -0
  29. package/src/relay-mcp.js +173 -212
  30. package/src/relay-prune.js +2 -2
  31. package/src/relay-turn-sync.js +146 -142
  32. package/src/runner.js +0 -2
  33. package/src/server.js +253 -375
  34. package/src/session-follow.js +3 -1
  35. package/src/session-quilt.js +2 -21
  36. package/src/session-seam.js +35 -7
  37. package/src/session.js +650 -554
  38. package/src/setup.js +15 -25
  39. package/src/source-live/bring-in.js +5 -5
  40. package/src/source-live/land.js +20 -3
  41. package/src/source-live/live-block.js +391 -51
  42. package/src/status.js +8 -12
  43. package/src/textdiff.js +54 -0
  44. package/src/turn-sync-plan.js +6 -18
  45. package/src/turn-sync.js +28 -21
  46. package/src/ui/agent-guide.js +13 -13
  47. package/src/ui/app.css +19 -40
  48. package/src/ui/boxes.js +8 -16
  49. package/src/ui/common.js +1 -1
  50. package/src/ui/fileview.js +11 -15
  51. package/src/ui/loom-model.js +18 -16
  52. package/src/ui/loom.css +1 -2
  53. package/src/ui/loom.js +6 -6
  54. package/src/ui/rail-model.js +25 -64
  55. package/src/ui/rail.js +48 -60
  56. package/src/ui/seam-model.js +39 -3
  57. package/src/ui/session.js +36 -54
  58. package/src/ui/tree.js +22 -129
  59. package/src/ui-server.js +2 -6
  60. package/src/release-words.js +0 -18
  61. package/src/seam-claims.js +0 -53
package/src/mcp.js CHANGED
@@ -31,10 +31,9 @@ import { registerWorkspaceTools, bytesFetcher, isInside } from './workspace-tool
31
31
  import { quiltHome } from './legacy.js'
32
32
  import { TASK_WORKFLOW, pickupBrief, doneRefusal, verifiedEnough, verifiedLine, qaRefusal, qaNotesEnough, qaNotesLine, MAX_VERIFIED } from './agent-task-workflow.js'
33
33
  import { formatHistory } from './history.js'
34
- import { releaseWords } from './release-words.js'
35
34
  import { renderInbox, describeEvent, INBOX_HOW } from './inbox.js'
36
35
  import { renderConversation, renderContext, CONVERSATION_DESCRIPTION } from './conversation.js'
37
- import { renderChatAbout, renderUnanswered, heldRefusal, renderQueueNotice, renderQueued, CHAT_RULES, RE_HELP, PERSON_CHAT } from './duties.js'
36
+ import { renderChatAbout, renderRecent, renderUnanswered, NO_HOLDS, CHAT_RULES, RE_HELP, PERSON_CHAT } from './duties.js'
38
37
  import { describeSubscription, describeWebhookTest, COALESCE_HELP, WEBHOOK_EVENTS } from './webhooks.js'
39
38
  import { UpdateCheck } from './update-check.js'
40
39
  import { getSettings } from './settings.js'
@@ -42,6 +41,7 @@ import { describeSecretNames, SECRET_NAMES_DESCRIPTION, RUN_GUIDE } from './secr
42
41
  import { appWorkspaces } from './app-workspaces.js'
43
42
  import { TRANSCRIPT_DESCRIPTION, JOIN_DESCRIPTION, SAY_DESCRIPTION, MAX_LINE, renderLines, agentsJoinCalls } from './voice.js'
44
43
  import { seamGate, seamNote, seamStatus, seamToolSpec, seamOnly, seamWorkflow, seamRefusal, SEAM_SESSION_TOOLS, GIT_TOOLS } from './session-seam.js'
44
+ import { describeHeld, RESOLVE_DESCRIPTION, findHeldIn } from './held.js'
45
45
 
46
46
  // The board's columns, from tasks.js, so this and the hosted MCP (relay-mcp.js) never drift apart.
47
47
  const COLUMN_IDS_LIST = COLUMNS.map((c) => c.id)
@@ -81,19 +81,13 @@ export const MCP_INSTRUCTIONS =
81
81
  'and move a task with quilt_move_task when you start or finish it; quilt_task reads one in full with its comments, and quilt_comment_task leaves a note or handoff on it. ' +
82
82
  'quilt_history tells you who changed which file, when, with the diff: read it for the files you are about to touch. ' +
83
83
  'If the person you work for lets their AI pick up work by itself (their cloud AI, on the cloud machine they connected), finishing (quilt_set_work done, a task to QA or Done) hands you your next task from the board: start it. ' +
84
- 'Before you change files, call quilt_before_edit with their paths: it tells you whether each is yours to edit (claiming free ones for you, so partners are refused instead of overwriting you), ' +
85
- 'and shows what people said about those files in chat, so you know what was asked or planned before you change them. ' +
86
- 'Do not edit a file it refuses: ask for it in its file queue with quilt_request_file (a title like "Working on <what> for <task>" and up to 300 characters on your plan) and carry on with other work; you are woken when it is handed to you, with the holder\'s context. ' +
87
- 'Claims also follow your edits: a file you change that nobody holds is claimed for you until you finish. ' +
88
- 'If an edit of yours was undone because someone else holds the file, your next quilt answer says so: do not retry; ask for it with quilt_request_file and carry on with other work. ' +
89
- 'A boxed file\'s edits are only in its holder\'s folder; quilt_unpack shares a box when someone needs it: decide yourself, and ask your person first for a large, risky or critical change or when the project\'s rules say so. A file boxed by someone else (quilt_status lists Boxed work) is not in your folder yet: do not build on it; ask for it with quilt_request_file. ' +
90
- 'When someone waits in the file queue for a file you hold, every quilt answer says so: finish the change you are making, then hand it off with quilt_handoff and your context (what you changed, what is left, gotchas). ' +
91
- 'Until you do, you cannot finish (quilt_set_work done, a task to Done) or release that file. A claim whose holder does nothing in the session for 20 minutes goes to the next one waiting, or is released. ' +
84
+ 'Before you change files, call quilt_before_edit with their paths: it shows what people said about those files in chat and who else changed them lately, ' +
85
+ 'so you know what was asked or planned before you change them. It never refuses: nobody holds files. ' +
86
+ 'Edit any file you may change: edits merge as they arrive, and if your change clashes with someone\'s on the same lines, Quilt tells you and you resolve it. ' +
87
+ 'A boxed file\'s edits are only in its owner\'s folder; quilt_unpack shares a box when someone needs it: decide yourself, and ask your person first for a large, risky or critical change or when the project\'s rules say so. A file boxed by someone else (quilt_status lists Boxed work) is not in your folder yet: if you edit it, their box opens and your change merges with their work. ' +
92
88
  'For an agent of its own (not a person\'s AI session), every quilt answer starts with anything new for it (direct messages, mentions, tasks handed to it): act on it. ' +
93
- 'These rules are enforced for agents: while someone who messaged or mentioned you is waiting for an answer, the tools that move work on (claims, tasks, focus, quilt_set_work) refuse until you answer them with quilt_message; ' +
94
- 'an edit to a file someone else holds is undone. ' +
95
- 'When you start a piece of work, call quilt_set_work with "working" and a note of what it is (with quilt_set_focus), so the loom shows you stitching; when you finish, call it with "done": it lets go of the files claimed for you. ' +
96
- 'Claim ahead (quilt_claim) only for a larger change across several files. ' +
89
+ 'These rules are enforced for agents: while someone who messaged or mentioned you is waiting for an answer, the tools that move work on (tasks, focus, quilt_set_work) refuse until you answer them with quilt_message. ' +
90
+ 'When you start a piece of work, call quilt_set_work with "working" and a note of what it is (with quilt_set_focus), so the loom shows you stitching; when you finish, call it with "done". ' +
97
91
  'Always re-read a file right before you edit it. ' +
98
92
  'If quilt_status starts with While you were away, the session changed since this folder last synced: read quilt_history for those files before editing them. ' +
99
93
  'For an agent of its own, mentions of it (@yourname) in chat, direct messages to it and tasks handed to it wait in quilt_inbox: read it when you start, and act on each one. ' +
@@ -101,7 +95,7 @@ export const MCP_INSTRUCTIONS =
101
95
  'When you are about to answer someone in chat, quilt_typing shows them you are typing; sending clears it. ' +
102
96
  'Chat: ' + CHAT_RULES.replace(/^Send a chat message\. /, '') + ' A message that needs nothing back is settled with quilt_inbox (no_reply: [its id]), not answered. ' +
103
97
  WAKE_STEP + ' On a computer the ways include a command Quilt runs on each event (`quilt join --on-mention`), `quilt inbox --wait`, the quilt://inbox resource (MCP push), a webhook, email and a schedule. ' +
104
- 'In the session you are your person: your messages, claims and tasks are theirs, and people see you as them. "<person>\'s AI" ("Daniel\'s AI") is only that person\'s cloud AI, when they connected one (Quilt runs their own AI tool for them on their own cloud machine): write to it by that name. Nothing written or handed to "<person>\'s AI" comes to you; when your person asks you to work on tasks, take them from the board (quilt_tasks). ' +
98
+ 'In the session you are your person: your messages and tasks are theirs, and people see you as them. "<person>\'s AI" ("Daniel\'s AI") is only that person\'s cloud AI, when they connected one (Quilt runs their own AI tool for them on their own cloud machine): write to it by that name. Nothing written or handed to "<person>\'s AI" comes to you; when your person asks you to work on tasks, take them from the board (quilt_tasks). ' +
105
99
  PERSON_CHAT + ' ' +
106
100
  'Share what you are doing with quilt_share: when you start on a request (request and your plan) and when you finish (what you did and the files you changed). Partners see it in their feed, and it puts your work on the task board. ' +
107
101
  'When Claude Code is started with the quilt channel, they arrive on their own as <channel source="quilt"> events while you work: treat each like a request from that person, answer with quilt_message, and take a task with quilt_move_task. ' +
@@ -199,12 +193,8 @@ export async function runMcp () {
199
193
  const { waiting } = await call(d, 'GET', '/duties')
200
194
  return renderUnanswered(waiting, `call ${tool} again`)
201
195
  }
202
- // Files this agent holds that someone waits for in the file queue: said with every answer until it hands them off.
203
- const queuedNow = async (d) => { try { return (await call(d, 'GET', '/duties')).queued || [] } catch { return [] } }
204
- const queueGate = (then) => async (d) => renderQueued(await queuedNow(d), then)
205
196
  // When this person lets their AI pick up work by itself: the next task, said as it finishes one.
206
197
  const nextUp = async (d) => { try { const n = renderNextTask((await call(d, 'GET', '/duties')).next); return n ? `\n\n➡️ ${n}` : '' } catch { return '' } }
207
- const gates = (...list) => async (d) => { for (const g of list) { const r = g && await g(d); if (r) return r } return '' }
208
198
  // An AI session started before its session moved into Seam (or back to git) was told the other
209
199
  // way in its instructions, which never change once given: the next answer says the way now, once.
210
200
  let toldQuilt = !!(startQuilt && startQuilt.id)
@@ -218,12 +208,11 @@ export async function runMcp () {
218
208
  const d = findDaemon(joined ? joined.dir : undefined)
219
209
  if (!d) return { content: [{ type: 'text', text: NOT_RUNNING + stale() }], isError: true }
220
210
  const before = async () => introduce() + (await moved()) + (await notices(d)) + (inbox ? await arrivals(d) : '')
221
- const waiting = async () => { const n = renderQueueNotice(await queuedNow(d)); return n ? `\n\n📥 ${n}` : '' }
222
211
  try {
223
212
  const refused = gate ? await gate(d) : ''
224
213
  if (refused) return { content: [{ type: 'text', text: (await before()) + refused + stale() }], isError: true }
225
214
  const body = await fn(d)
226
- return { content: [{ type: 'text', text: (await before()) + body + (await waiting()) + stale() }] }
215
+ return { content: [{ type: 'text', text: (await before()) + body + stale() }] }
227
216
  } catch (err) {
228
217
  return { content: [{ type: 'text', text: (await before()) + `Error: ${err.message}` }], isError: true }
229
218
  }
@@ -274,15 +263,34 @@ export async function runMcp () {
274
263
  }
275
264
 
276
265
  server.registerTool('quilt_status', {
277
- description: 'See who else is in the live session, what they are working on, which files they recently edited or claimed, recent messages, and which open tasks are assigned to you. Call this before starting work.',
266
+ description: 'See who else is in the live session, what they are working on, which files they recently edited, boxed work, recent messages, and which open tasks are assigned to you. Call this before starting work.',
278
267
  inputSchema: {}
279
268
  }, () => withDaemon(async (d) => {
280
269
  const st = await call(d, 'GET', '/status')
281
270
  const q = await quiltNow()
282
- const md = renderStatus(st, { asAi: taskReader(st).asAi, mentionYours: true })
271
+ // Open held conflicts already head the answer (the notices): not listed twice.
272
+ const md = renderStatus({ ...st, held: [] }, { asAi: taskReader(st).asAi, mentionYours: true })
283
273
  return q ? `${seamNote(q.slug || q.id)}\n\n${seamStatus(md)}` : md
284
274
  }))
285
275
 
276
+ server.registerTool('quilt_resolve_merge', {
277
+ description: RESOLVE_DESCRIPTION,
278
+ inputSchema: {
279
+ path: z.string().max(1024).optional().describe('The file whose held conflict to resolve (the oldest open one for it)'),
280
+ id: z.string().max(40).optional().describe('The held conflict\'s id, as the list at the top of every answer shows it'),
281
+ how: z.enum(['theirs', 'mine', 'edited']).optional().describe('theirs: drop the held lines (the file stays as it is). mine: put the held lines over the shared ones. edited: you already wrote the resolved file. Omit to see the conflict in full.')
282
+ }
283
+ }, ({ path: p, id, how } = {}) => withDaemon(async (d) => {
284
+ const ref = id || p
285
+ const { held } = await call(d, 'GET', '/held')
286
+ if (!ref) return held.filter((r) => r.state === 'open').map(describeHeld).join('\n\n') || 'There are no open held conflicts in this session.'
287
+ if (!how) {
288
+ const r = findHeldIn(held, ref)
289
+ return r ? describeHeld(r) : `There is no held conflict for ${ref}.`
290
+ }
291
+ return (await call(d, 'POST', '/resolve-merge', { ref, how })).text
292
+ }))
293
+
286
294
  server.registerTool('quilt_tasks', {
287
295
  description: 'List the shared task board (To do, In progress, QA, Done), with an id on each task. Open tasks assigned to you are listed first. Call this before starting work.',
288
296
  inputSchema: {
@@ -313,7 +321,7 @@ export async function runMcp () {
313
321
  }, { gate: gateFor('quilt_add_task') }))
314
322
 
315
323
  server.registerTool('quilt_move_task', {
316
- description: 'Move a task on the shared board. "doing" when you start it: you get a briefing (its files, recent changes to them, claims, the project\'s checks). ' +
324
+ description: 'Move a task on the shared board. "doing" when you start it: you get a briefing (its files, recent changes to them, the project\'s checks). ' +
317
325
  '"qa" when you finish implementing and testing: requires `qaNotes` (what changed and how you self-validated); without it the move is refused. ' +
318
326
  '"done" after QA: requires `verified`, what you ran and what you saw; without it the move is refused.',
319
327
  inputSchema: {
@@ -336,7 +344,7 @@ export async function runMcp () {
336
344
  if (column === 'qa') return `Moved "${task.title}" to QA. Notes: ${qaNotesLine(task)}` + await nextUp(d)
337
345
  if (column === 'done') return `Moved "${task.title}" to Done. Verified: ${verifiedLine(task)}` + await nextUp(d)
338
346
  return `Moved "${task.title}" to ${columnName(task.column)}.`
339
- }, { gate: gates(gateFor('quilt_move_task'), column === 'done' && queueGate('move the task again')) }))
347
+ }, { gate: gateFor('quilt_move_task') }))
340
348
 
341
349
  server.registerTool('quilt_assign_task', {
342
350
  description: 'Assign a shared task to a person, an agent or a person\'s AI (their cloud AI), and optionally set the files it is about. assignee "" clears it. To take it yourself, set assignee to your own name.',
@@ -414,26 +422,13 @@ export async function runMcp () {
414
422
  return r.typing ? `Showing that you are typing${to ? ` to ${to}` : ''}.` : 'Not showing that you are typing.'
415
423
  }))
416
424
 
417
- server.registerTool('quilt_claim', {
418
- description: 'Claim files so only you can change them while you work: quilt undoes anyone else\'s edits there. Accepts a file path, a folder (it need not exist yet), or a glob like "src/auth/**". Fails if it overlaps someone else\'s claim.',
419
- inputSchema: {
420
- pattern: z.string().describe('File path, folder, or glob'),
421
- reason: z.string().optional().describe('What you are doing there')
422
- }
423
- }, ({ pattern, reason }) => withDaemon(async (d) => {
424
- await call(d, 'POST', '/claim', { pattern, note: reason || '' })
425
- return `Claimed ${pattern}. Only you can change it until you release it.`
426
- }, { gate: gateFor('quilt_claim') }))
427
-
428
- server.registerTool('quilt_release', {
429
- description: 'Release a claim you made (or "*" for all of yours) once you are done.',
430
- inputSchema: { pattern: z.string().describe('The claimed pattern, or "*"') }
431
- }, ({ pattern }) => withDaemon(async (d) => {
432
- const queued = await queuedNow(d)
433
- if (pattern && pattern !== '*' && queued.some((q) => q.pattern === pattern.trim())) throw new Error(renderQueued(queued.filter((q) => q.pattern === pattern.trim()), 'release it'))
434
- const r = await call(d, 'POST', '/release', { pattern })
435
- return releaseWords(r, { cli: 'quilt_release' })
436
- }))
425
+ // Quilt holds no files (no-holds, 2026-11-13): the claim tools stay for one release so older agents
426
+ // don't fail, answer that there is nothing to claim, and change nothing.
427
+ const noHolds = (description, inputSchema) => ({ description: `${description} Quilt holds no files now: this changes nothing.`, inputSchema })
428
+ const anyPath = z.string().max(500).optional()
429
+ const harmless = () => ({ content: [{ type: 'text', text: NO_HOLDS }] })
430
+ server.registerTool('quilt_claim', noHolds('No longer needed: nobody holds files.', { pattern: anyPath, reason: z.string().optional() }), harmless)
431
+ server.registerTool('quilt_release', noHolds('No longer needed: nobody holds files.', { pattern: anyPath }), harmless)
437
432
 
438
433
  server.registerTool('quilt_unpack', {
439
434
  description: 'Share boxed work before you commit it. In a folder that is a git repository, your edits to a file stay in a box: everyone sees the change, but it is only in your folder, so nobody else\'s git can commit it, until you commit it. ' +
@@ -446,47 +441,9 @@ export async function runMcp () {
446
441
  return `Unpacked ${r.unpacked.join(', ')}: in everyone's folder now. Your next edit to one boxes it again.${r.notBoxed.length ? ` Not boxed by you: ${r.notBoxed.join(', ')}.` : ''}`
447
442
  }))
448
443
 
449
- server.registerTool('quilt_request_file', {
450
- description: 'Ask for a file someone else holds (claimed), instead of editing it: your request joins its file queue, its holder is told, and when they finish they hand it to you with their context. ' +
451
- 'You are woken (a direct message: quilt_inbox, the quilt://inbox resource, your webhook) when it is yours. Asking again for the same file updates your request.',
452
- inputSchema: {
453
- path: z.string().min(1).max(500).describe('The file you need, relative to the project folder'),
454
- title: z.string().min(1).max(120).describe('What you will do, e.g. "Working on retry logic for task t-12"'),
455
- description: z.string().max(300).optional().describe('Your plan in summary: what you want to change and why (300 characters at most)'),
456
- task: z.string().max(80).optional().describe('The task id this is for, if any')
457
- }
458
- }, ({ path: p, title, description, task }) => withDaemon(async (d) => {
459
- const rel = path.relative(d.dir, path.resolve(d.dir, p)).split(path.sep).join('/')
460
- const r = await call(d, 'POST', '/request-file', { path: rel, title, description: description || '', task })
461
- return `Asked for ${rel}: you are number ${r.position} in the queue for ${r.pattern} (held by ${r.holder}). ${r.holder} is told; you will be handed it with their context. Carry on with other work.`
462
- }))
463
-
464
- server.registerTool('quilt_handoff', {
465
- description: 'Hand a file you hold to someone waiting for it in its file queue (the first, unless you name them), with your context: what you changed, what is left, anything they should know. ' +
466
- 'The claim becomes theirs and they get your context in a direct message. Required before you finish or release a file someone is waiting for.',
467
- inputSchema: {
468
- path: z.string().min(1).max(500).describe('The file (or the claimed pattern) to hand off'),
469
- context: z.string().min(1).max(2000).describe('What you changed, what is left, gotchas'),
470
- to: z.string().max(80).optional().describe('Who to hand it to (a name or request id); omit for the first in the queue')
471
- }
472
- }, ({ path: p, context, to }) => withDaemon(async (d) => {
473
- const rel = path.relative(d.dir, path.resolve(d.dir, p)).split(path.sep).join('/')
474
- const r = await call(d, 'POST', '/handoff', { path: rel, context, to: to || '' })
475
- return `Handed ${r.pattern} to ${r.to} with your context.${r.waiting ? ` ${r.waiting} more waiting: ${r.to} hands it on next.` : ''}`
476
- }))
477
-
478
- server.registerTool('quilt_withdraw_request', {
479
- description: 'Take back your request for a file (from quilt_request_file) when you no longer need it.',
480
- inputSchema: { path: z.string().min(1).max(500).describe('The file you asked for') }
481
- }, ({ path: p }) => withDaemon(async (d) => {
482
- const rel = path.relative(d.dir, path.resolve(d.dir, p)).split(path.sep).join('/')
483
- const { claims } = await call(d, 'GET', '/tree')
484
- const me = (await call(d, 'GET', '/info')).name
485
- const mine = claims.flatMap((c) => c.queue || []).filter((r) => r.by === me && r.path === rel)
486
- let n = 0
487
- for (const r of mine) n += (await call(d, 'POST', '/withdraw-request', { request: r.id })).withdrawn
488
- return n ? `Withdrew your request for ${rel}.` : `You had not asked for ${rel}.`
489
- }))
444
+ server.registerTool('quilt_request_file', noHolds('No longer needed: nobody holds files, so edit the file instead.', { path: anyPath, title: z.string().max(120).optional(), description: z.string().max(300).optional(), task: z.string().max(80).optional() }), harmless)
445
+ server.registerTool('quilt_handoff', noHolds('No longer needed for files: nobody holds them. To hand on a task, use quilt_comment_task and quilt_assign_task.', { path: anyPath, context: z.string().max(2000).optional(), to: z.string().max(80).optional() }), harmless)
446
+ server.registerTool('quilt_withdraw_request', noHolds('No longer needed: there is no file queue.', { path: anyPath }), harmless)
490
447
 
491
448
  server.registerTool('quilt_message', {
492
449
  description: CHAT_RULES + ' Set "to" to message one person directly.',
@@ -860,8 +817,8 @@ export async function runMcp () {
860
817
  })
861
818
 
862
819
  server.registerTool('quilt_set_work', {
863
- description: 'Tell everyone whether you (this agent) are working or done, so people know what is in progress. Set "working" when you start a task and "done" when you finish: ' +
864
- '"done" lets go of the files claimed for you while you edited. Like every tool that moves work on, it is refused while someone is waiting for an answer from you.',
820
+ description: 'Tell everyone whether you (this agent) are working or done, so people know what is in progress. Set "working" when you start a task and "done" when you finish. ' +
821
+ 'Like every tool that moves work on, it is refused while someone is waiting for an answer from you.',
865
822
  inputSchema: {
866
823
  state: z.enum(['working', 'done']),
867
824
  note: z.string().optional().describe('What you are working on, in a few words')
@@ -871,10 +828,10 @@ export async function runMcp () {
871
828
  await call(d, 'POST', '/work', { state, note })
872
829
  return 'Marked as working. Set "done" when you finish so others know it is safe to commit.'
873
830
  }
874
- const { released } = await call(d, 'POST', '/finish', {})
831
+ await call(d, 'POST', '/finish', {})
875
832
  await call(d, 'POST', '/work', { state, note })
876
- return `Marked as done.${released ? ` Let go of ${released} file${released === 1 ? '' : 's'} claimed for you while you edited.` : ''}` + await nextUp(d)
877
- }, { gate: gates(gateFor('quilt_set_work'), state === 'done' && queueGate('set done again')) }))
833
+ return 'Marked as done.' + await nextUp(d)
834
+ }, { gate: gateFor('quilt_set_work') }))
878
835
 
879
836
  server.registerTool('quilt_share', {
880
837
  description: 'Share what you are doing with your collaborators; it appears live in their Quilt feed and on the task board, in any tool. Call it when you start on a request ' +
@@ -918,9 +875,8 @@ export async function runMcp () {
918
875
  }))
919
876
 
920
877
  server.registerTool('quilt_before_edit', {
921
- description: 'Call before you change files (with your own edit tools), with the paths you are about to change. For each file: whether it is yours to edit ' +
922
- '(a file nobody holds is claimed for you until you finish; one someone else holds is refused: do not edit it, message them instead), and what people said ' +
923
- 'about those files in chat lately (what they asked for, warned about or planned). Works in every tool; it is how Quilt keeps agents from overwriting each other.',
878
+ description: 'Call before you change files (with your own edit tools), with the paths you are about to change. For each file: who else changed it lately, ' +
879
+ 'and what people said about those files in chat (what they asked for, warned about or planned). It never refuses: nobody holds files, and edits merge as they arrive. Works in every tool.',
924
880
  inputSchema: {
925
881
  paths: z.array(z.string().min(1).max(500)).min(1).max(50).describe('Files you are about to change: relative to the project folder, or absolute inside it')
926
882
  }
@@ -936,12 +892,12 @@ export async function runMcp () {
936
892
  const lines = []
937
893
  for (const f of r.files) {
938
894
  if (!f.shared) lines.push(`- ${f.path}: not shared by Quilt (ignored or private): edit it as you like.`)
939
- else if (f.ok) lines.push(`- ${f.path}: ✅ yours to edit${f.claimed ? ' (claimed for you until you finish)' : ''}.`)
940
- else lines.push(`- ${f.path}: ⛔ ${heldRefusal(f.path, f.claim, f.error)}`)
895
+ else lines.push(`- ${f.path}: ✅ go ahead.`)
941
896
  }
942
897
  for (const p of outside) lines.push(`- ${p}: not inside the project folder (${d.dir}).`)
898
+ const recent = renderRecent(r.files)
943
899
  const said = renderChatAbout(r.chat)
944
- return lines.join('\n') + (said ? `\n\n${said}` : '') + '\n\nRe-read each file right before you edit it.'
900
+ return lines.join('\n') + (recent ? `\n\n${recent}` : '') + (said ? `\n\n${said}` : '') + '\n\nRe-read each file right before you edit it.'
945
901
  }))
946
902
 
947
903
  server.registerTool('quilt_project_rules', {
@@ -1026,10 +982,10 @@ export async function runMcp () {
1026
982
  }))
1027
983
 
1028
984
  server.registerTool('quilt_list_files', {
1029
- description: 'List the shared project\'s files with who edited each one recently and any claims, so you can see where others are working.',
985
+ description: 'List the shared project\'s files with who edited each one recently and whose unfinished work is boxed on any, so you can see where others are working.',
1030
986
  inputSchema: { prefix: z.string().optional().describe('Only paths under this folder, e.g. "src/auth"') }
1031
987
  }, ({ prefix }) => withDaemon(async (d) => {
1032
- const { files, claims } = await call(d, 'GET', '/tree')
988
+ const { files } = await call(d, 'GET', '/tree')
1033
989
  const me = (await call(d, 'GET', '/info')).name
1034
990
  const pre = prefix ? prefix.replace(/^\.\//, '').replace(/\/+$/, '') : ''
1035
991
  const shown = files.filter((f) => !pre || f.path === pre || f.path.startsWith(pre + '/'))
@@ -1037,14 +993,13 @@ export async function runMcp () {
1037
993
  const lines = shown.slice(0, 400).map((f) => {
1038
994
  const notes = []
1039
995
  if (f.edited && now - f.edited.ts < 10 * 60 * 1000) notes.push(`edited by ${f.edited.by === me ? 'you' : f.edited.by} ${Math.round((now - f.edited.ts) / 1000)}s ago`)
1040
- if (f.claim) notes.push(`claimed by ${f.claim.by === me ? 'you' : f.claim.by}${f.claim.note ? `: ${f.claim.note}` : ''}${f.claim.queue && f.claim.queue.length ? `, ${f.claim.queue.length} waiting` : ''}`)
996
+ if (f.box) notes.push(`${f.box.by === me ? 'your' : `${f.box.by}'s`} unfinished work, boxed`)
1041
997
  if (f.chat) notes.push(`sent in chat by ${f.chat.by === me ? 'you' : f.chat.by}: in your folder only, never synced or committed`)
1042
998
  if (f.binary) notes.push('binary')
1043
999
  return `${f.path}${notes.length ? ` [${notes.join('; ')}]` : ''}`
1044
1000
  })
1045
1001
  if (shown.length > 400) lines.push(`… and ${shown.length - 400} more (use prefix to narrow)`)
1046
- const claimLines = claims.length ? '\n\nClaims: ' + claims.map((c) => `${c.pattern} (${c.by === me ? 'you' : c.by}${c.note ? `: ${c.note}` : ''})`).join(', ') : ''
1047
- return (lines.join('\n') || 'No shared files.') + claimLines
1002
+ return lines.join('\n') || 'No shared files.'
1048
1003
  }))
1049
1004
 
1050
1005
  server.server.onclose = () => { clearInterval(pushTimer); updates.stop(); leave().catch(() => {}) }
package/src/merge3.js CHANGED
@@ -37,7 +37,7 @@ function eolAware (merge) {
37
37
  const lf = (s) => typeof s === 'string' ? s.replace(/\r\n/g, '\n') : s
38
38
  const back = (t) => target === 'crlf' && typeof t === 'string' ? t.replace(/\n/g, '\r\n') : t
39
39
  const r = merge(lf(base), lf(ours), lf(theirs), ...rest)
40
- return typeof r === 'string' ? back(r) : { ...r, text: back(r.text) }
40
+ return typeof r === 'string' ? back(r) : { ...r, text: back(r.text), ...(typeof r.mine === 'string' ? { mine: back(r.mine) } : {}) }
41
41
  }
42
42
  }
43
43
 
@@ -222,6 +222,70 @@ export const mergeAuto = eolAware(function mergeAuto (base, ours, theirs, { ours
222
222
  return { text: out.join('\n'), lost }
223
223
  })
224
224
 
225
+ /**
226
+ * How a live write is merged (Seam's 07 "Conflicts in the live state", ruling 2026-11-13, which
227
+ * replaces mergeAuto's "the newer edit wins" for live writes). `ours` is the writer's version, made
228
+ * on `base`; `theirs` is what the shared file holds now, which landed first. Changes to different
229
+ * lines all go in (lines, changes next to each other, a line only one side changed). Where both
230
+ * changed the same lines, nobody wins: the shared file keeps theirs there and the writer's lines
231
+ * are held, never written into the file with markers. The only same-line case combined without
232
+ * asking is two names added to one import line (sameImport); the same change spaced differently
233
+ * keeps theirs, with nothing held. Two words changed on one line and two blocks added at one place
234
+ * are held like any same-line change (mergeSmart and mergeAuto still combine them where no live
235
+ * write meets another: bringing main into a square, a box carried onto a square's head and the clash ladder).
236
+ * Returns { text, held, mine }: `text` the shared file's new text, `held` the writer's lines kept
237
+ * aside ({ at: their first line in `text`, base, ours, theirs }), `mine` the text with the writer's
238
+ * lines in place of theirs at each held hunk (what resolving it "mine" would write).
239
+ */
240
+ export const mergeLive = eolAware(function mergeLive (base, ours, theirs, { union = false } = {}) {
241
+ // The lines all three start and end with are set aside first: a live write changes a few lines of a
242
+ // long file, and the merge then costs what changed (the relay merges every folder's write).
243
+ const [a, o, b] = [lines(ours), lines(base), lines(theirs)]
244
+ let pre = 0
245
+ const n = Math.min(a.length, o.length, b.length)
246
+ while (pre < n && a[pre] === o[pre] && b[pre] === o[pre]) pre++
247
+ let suf = 0
248
+ while (suf < n - pre && a[a.length - 1 - suf] === o[o.length - 1 - suf] && b[b.length - 1 - suf] === o[o.length - 1 - suf]) suf++
249
+ const regions = diff3Merge(a.slice(pre, a.length - suf), o.slice(pre, o.length - suf), b.slice(pre, b.length - suf), { excludeFalseConflicts: true })
250
+ if (pre) regions.unshift({ ok: o.slice(0, pre) })
251
+ if (suf) regions.push({ ok: o.slice(o.length - suf) })
252
+ const out = []
253
+ const mine = []
254
+ const held = []
255
+ const both = (ls) => { out.push(...ls); mine.push(...ls) }
256
+ const hold = (o, a, b) => {
257
+ held.push({ at: out.length, base: o, ours: a, theirs: b })
258
+ out.push(...b)
259
+ mine.push(...a)
260
+ }
261
+ for (const r of regions) {
262
+ if (r.ok) { both(r.ok); continue }
263
+ const c = r.conflict
264
+ if (union) { both([...c.a, ...c.b]); continue }
265
+ const imp = c.o.length ? sameImport(c.o, c.a, c.b) : null
266
+ if (imp) { both(imp); continue }
267
+ if (sameIgnoringWs(c.a, c.b)) { both(c.b); continue }
268
+ const side = sideBySide(c.o, c.a, c.b)
269
+ if (side) { both(side); continue }
270
+ if (c.o.length === c.a.length && c.o.length === c.b.length) {
271
+ // Line by line: a line only one side changed keeps that change; runs both changed are held.
272
+ let run = null
273
+ const flush = () => { if (run) { hold(run.o, run.a, run.b); run = null } }
274
+ for (let i = 0; i < c.o.length; i++) {
275
+ const [o, a, b] = [c.o[i], c.a[i], c.b[i]]
276
+ if (a === b || a === o) { flush(); both([b]) } else if (b === o) { flush(); both([a]) } else {
277
+ if (!run) run = { o: [], a: [], b: [] }
278
+ run.o.push(o); run.a.push(a); run.b.push(b)
279
+ }
280
+ }
281
+ flush()
282
+ continue
283
+ }
284
+ hold(c.o, c.a, c.b)
285
+ }
286
+ return { text: out.join('\n'), held, mine: mine.join('\n') }
287
+ })
288
+
225
289
  /** Whether two hunks (one per side) change the same base lines, or one adds lines inside the other's. */
226
290
  function overlaps (x, y) {
227
291
  if (x.len && y.len) return x.at < y.at + y.len && y.at < x.at + x.len
@@ -62,7 +62,7 @@ function peopleIn (room, now) {
62
62
  /**
63
63
  * The summary of `room` for `account`, or null when the account isn't in it. `now` is the time;
64
64
  * `detail` (one session's page) keeps more of the latest file changes, for its Activity tab.
65
- * The room is read through what Room already offers (server.js): meta, awareness, doc, claimList, pendingList.
65
+ * The room is read through what Room already offers (server.js): meta, awareness, doc, boxList, pendingList.
66
66
  */
67
67
  export function nowSummary (room, account, { now = Date.now(), detail = false } = {}) {
68
68
  const me = nameIn(room, account)
@@ -71,7 +71,7 @@ export function nowSummary (room, account, { now = Date.now(), detail = false }
71
71
  const doc = room.doc
72
72
  const chat = doc ? doc.getArray('chat').toArray() : []
73
73
  const tasks = doc ? activeTasks(readTasks(doc.getMap('tasks'))) : []
74
- const claims = room.claimList ? room.claimList() : []
74
+ const boxes = room.boxList ? room.boxList() : []
75
75
  const people = peopleIn(room, now)
76
76
 
77
77
  const needs = []
@@ -81,9 +81,6 @@ export function nowSummary (room, account, { now = Date.now(), detail = false }
81
81
  for (const t of tasks) {
82
82
  if (t.column === 'todo' && t.assignee === me && !t.forAi) needs.push({ kind: 'task', by: clip(t.by, 64), text: clip(t.title), at: t.ts, task: t.id })
83
83
  }
84
- for (const c of claims) {
85
- if (c.by === me && c.queue && c.queue.length) needs.push({ kind: 'file', by: clip(c.queue[0].by, 64), text: clip(c.pattern, 200), at: c.queue[0].ts || c.ts, waiting: c.queue.length })
86
- }
87
84
  if (owner && doc) {
88
85
  for (const r of doc.getMap('commitRequests').values()) {
89
86
  if (r && r.id && r.state === 'open') needs.push({ kind: 'commit', by: clip(r.by, 64), text: clip(r.message), at: r.ts, files: Array.isArray(r.files) ? r.files.length : 0 })
@@ -106,7 +103,8 @@ export function nowSummary (room, account, { now = Date.now(), detail = false }
106
103
  working: people.filter((p) => p.ai === 'working').length,
107
104
  tasks: { open: byColumn.todo + byColumn.doing + byColumn.qa, ...byColumn, mine: tasks.filter((t) => t.column !== 'done' && t.assignee === me).length },
108
105
  recent,
109
- held: claims.slice(0, NOW_LIMITS.held).map((c) => ({ path: clip(c.pattern, 200), by: clip(c.by, 64), box: !!c.box, waiting: (c.queue || []).map((q) => clip(q.by, 64)) })),
106
+ // Unfinished work in boxes (nobody holds files: no-holds, 2026-11-13); `waiting` stays empty for older readers.
107
+ held: boxes.slice(0, NOW_LIMITS.held).map((c) => ({ path: clip(c.pattern, 200), by: clip(c.by, 64), box: true, waiting: [] })),
110
108
  needs: needs.slice(0, NOW_LIMITS.needs),
111
109
  at: now
112
110
  }
package/src/pathrules.js CHANGED
@@ -115,7 +115,7 @@ export function isSafeRelPath (rel) {
115
115
  return true
116
116
  }
117
117
 
118
- /** Whether two claim patterns can cover the same file (paths: files that exist now). */
118
+ /** Whether two path patterns (boxes, access scopes) can cover the same file (paths: files that exist now). */
119
119
  export function patternsOverlap (a, b, paths = []) {
120
120
  if (a === b) return true
121
121
  const ma = globMatcher(a)
package/src/persona.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // AI sessions as their own members. Several AI sessions often work through one person's
2
2
  // app at once (Claude Code in one window, Cursor in another, two Claude Code chats). Each
3
3
  // gets a name of its own, after what it works on, so partners can tell them apart, message
4
- // the right one, and see whose claims are whose: "Daniel · file-queue", "Daniel · hosted costs".
4
+ // the right one, and see whose work is whose: "Daniel · file-queue", "Daniel · hosted costs".
5
5
  //
6
6
  // The name is the person's first name and a label. The label comes from the session's git
7
7
  // branch when it works on one (a branch names the work and doesn't change), otherwise from
package/src/presence.js CHANGED
@@ -25,6 +25,8 @@ const SYNC_MS = 1000
25
25
  export const ACT_COALESCE_MS = 60 * 1000
26
26
  /** Why a visit ended. The accounts API turns an agent's `pass_expired` or `idle` into `revoked` when its keys were revoked first. */
27
27
  export const END_REASONS = ['left', 'disconnected', 'removed', 'pass_expired', 'session_ended', 'relay_restart', 'idle', 'replaced', 'needs_update']
28
+ // claimed, released, requested, handed_off and withdrew are no longer written (Quilt holds no files since
29
+ // no-holds, 2026-11-13); they stay so older audit rows still read.
28
30
  export const ACTIONS = ['created', 'edited', 'deleted', 'claimed', 'released', 'requested', 'handed_off', 'withdrew', 'messaged', 'task', 'tool']
29
31
  const MAX_TARGET = 300
30
32
  const SEND_TIMEOUT_MS = 15 * 1000
package/src/protocol.js CHANGED
@@ -10,8 +10,8 @@ export const MSG_AWARENESS = 1
10
10
  export const MSG_QUERY_AWARENESS = 3
11
11
  // quilt extensions (ignored by plain y-websocket clients):
12
12
  export const MSG_AUTH = 10 // relay -> client: nonce; client -> relay: signature
13
- export const MSG_CLAIM = 11 // client -> relay: JSON { id, op: 'claim'|'release', pattern, note }
14
- export const MSG_CLAIMS = 12 // relay -> client: JSON { claims, reply?: { id, ok, error, released } }
13
+ export const MSG_CLAIM = 11 // client -> relay: JSON { id, op: 'box'|'unbox', pattern, note } (claim ops from older apps answer harmlessly: Quilt holds no files)
14
+ export const MSG_CLAIMS = 12 // relay -> client: JSON { claims: the boxes, reply?: { id, ok, error } } (the field keeps its name for older apps)
15
15
  export const MSG_ACCESS = 13 // relay -> client: JSON { state: 'pending'|'approved', role, scopes, scopesExcept, talk, owner, controlled, refresh?, refused?, why?, secret?, viewSecret? } (the last two: the room's links, for someone let in by their account)
16
16
  export const MSG_ADMIN = 14 // client (owner) -> relay: JSON { id, op: 'approve'|'deny'|'set'|'remove'|'end'|'name', key, role, scopes, access?, typeId?, name }
17
17
  export const MSG_MEMBERS = 15 // relay -> client: JSON { members, sessionName, pending?, reply?: { id, ok, error } }
@@ -0,0 +1,123 @@
1
+ // The recent versions of each shared file, by their hash: the base a live write is merged against
2
+ // (Seam's plans/quilt-source-control/07 "Merge on arrival": every live write carries the version its
3
+ // writer started from). A hosted agent's quilt_read_file answers with the version it read
4
+ // (`versionOf`), which quilt_write_file takes as `base`; a folder's write (relay-live-write.js) names
5
+ // the version it last synced. Versions are kept per file, whoever read or wrote them, so many writers
6
+ // on one file (or many loops on one agent's key) never push each other's bases out. A version the
7
+ // relay no longer has is never silently replaced by the latest: base() says it is `unknown` and gives
8
+ // the oldest version it has, and the write is merged as a stale one (the stale-write rule keeps every
9
+ // member's recent lines, the writer's own included). Per room, in memory on the relay: a restart
10
+ // forgets them, which only makes a write's base unknown.
11
+ import crypto from 'node:crypto'
12
+
13
+ /** Versions kept per file (a write names one read or synced a little earlier). */
14
+ export const KEEP_VERSIONS = 128
15
+ /** All the texts one room keeps, together; past it the longest-unused files' versions go first. */
16
+ export const MAX_BYTES = 24 * 1024 * 1024
17
+ /** A text longer than this is not kept (a live square's text is 2 MiB at most). */
18
+ export const MAX_TEXT = 2 * 1024 * 1024
19
+
20
+ /** A text's version, as quilt_read_file shows it and quilt_write_file takes it: its sha1, in hex. */
21
+ export const versionOf = (text) => crypto.createHash('sha1').update(String(text), 'utf8').digest('hex')
22
+
23
+ const HEX = /^[0-9a-f]+$/
24
+
25
+ export class ReadBases {
26
+ constructor ({ maxBytes = MAX_BYTES, keep = KEEP_VERSIONS } = {}) {
27
+ this.maxBytes = maxBytes
28
+ this.keep = keep
29
+ this.files = new Map() // "<branch>\0<path>" -> [{ h, text }], newest first; least recently used first in the map
30
+ this.reads = new Map() // "<agent>\0<branch>\0<path>" -> the version that agent last read or wrote
31
+ this.bytes = 0
32
+ }
33
+
34
+ fileKey (branch, path) { return `${branch || ''}\0${path}` }
35
+ key (agent, branch, path) { return `${agent}\0${branch || ''}\0${path}` }
36
+
37
+ /** `text` is a version of `path` on `branch` (anyone's): kept to resolve bases. Returns its version. */
38
+ record (branch, path, text) {
39
+ const h = versionOf(text)
40
+ if (typeof text !== 'string' || text.length > MAX_TEXT) return h
41
+ const k = this.fileKey(branch, path)
42
+ const list = this.files.get(k) || []
43
+ if (list.length && list[0].h === h) { this.files.delete(k); this.files.set(k, list); return h }
44
+ const next = [{ h, text }, ...list.filter((v) => v.h !== h)].slice(0, this.keep)
45
+ for (const v of list) this.bytes -= v.text.length
46
+ for (const v of next) this.bytes += v.text.length
47
+ this.files.delete(k)
48
+ this.files.set(k, next)
49
+ this.evict(k)
50
+ return h
51
+ }
52
+
53
+ /** `agent` read (or wrote) `text` of `path` on `branch`: it is what that agent knows of it now. Returns its version. */
54
+ note (agent, branch, path, text) {
55
+ const h = this.record(branch, path, text)
56
+ const k = this.key(agent, branch, path)
57
+ this.reads.delete(k)
58
+ this.reads.set(k, h)
59
+ while (this.reads.size > 20000) this.reads.delete(this.reads.keys().next().value)
60
+ return h
61
+ }
62
+
63
+ /** The text of `path` whose version starts with `version` (a hex prefix of 8 or more), or null. */
64
+ find (branch, path, version) {
65
+ const v = String(version || '').trim().toLowerCase()
66
+ if (v.length < 8 || !HEX.test(v)) return null
67
+ const hit = (this.files.get(this.fileKey(branch, path)) || []).find((x) => x.h.startsWith(v))
68
+ return hit ? hit.text : null
69
+ }
70
+
71
+ /** The oldest version of `path` kept, or null. */
72
+ oldest (branch, path) {
73
+ const list = this.files.get(this.fileKey(branch, path)) || []
74
+ return list.length ? list[list.length - 1].text : null
75
+ }
76
+
77
+ /**
78
+ * The base a write of `path` by `agent` is merged against: the version it names (`version`, a hex
79
+ * prefix of 8 or more), else the one it last read, else `current` (the shared text). { text, from }:
80
+ * `from` is 'given', 'read', 'unknown' (it named a version, or last read one, that is no longer kept:
81
+ * the oldest version kept, else the shared text; never the latest in its place) or 'none' (it read
82
+ * nothing: the shared text).
83
+ */
84
+ base (agent, branch, path, { version = null, current = null } = {}) {
85
+ const v = String(version || '').trim().toLowerCase()
86
+ const unknown = () => { const o = this.oldest(branch, path); return { text: o !== null ? o : current, from: 'unknown' } }
87
+ if (v) {
88
+ const hit = this.find(branch, path, v)
89
+ if (hit !== null) return { text: hit, from: 'given' }
90
+ if (v.length >= 8 && HEX.test(v) && typeof current === 'string' && versionOf(current).startsWith(v)) return { text: current, from: 'given' }
91
+ return unknown()
92
+ }
93
+ const last = this.reads.get(this.key(agent, branch, path))
94
+ if (last) {
95
+ const hit = this.find(branch, path, last)
96
+ if (hit !== null) return { text: hit, from: 'read' }
97
+ if (typeof current === 'string' && versionOf(current) === last) return { text: current, from: 'read' }
98
+ return unknown()
99
+ }
100
+ return { text: current, from: 'none' }
101
+ }
102
+
103
+ /** Past the room's bytes, the longest-unused files' versions go (never `keepKey`'s newest). */
104
+ evict (keepKey = null) {
105
+ while (this.bytes > this.maxBytes && this.files.size) {
106
+ const [k, list] = this.files.entries().next().value
107
+ if (k === keepKey) {
108
+ // The only file left over the limit: its oldest versions go, its newest stays.
109
+ if (list.length <= 1) break
110
+ this.bytes -= list.pop().text.length
111
+ continue
112
+ }
113
+ this.files.delete(k)
114
+ for (const v of list) this.bytes -= v.text.length
115
+ }
116
+ }
117
+ }
118
+
119
+ /** The room's read bases, made the first time a hosted agent or a folder's write needs them. */
120
+ export function readBasesOf (room) {
121
+ if (!room.readBases) room.readBases = new ReadBases()
122
+ return room.readBases
123
+ }
package/src/relay-ask.js CHANGED
@@ -78,10 +78,10 @@ function branchesAnswer (room, now) {
78
78
  */
79
79
  export function unusedBranches (room, now = Date.now()) {
80
80
  const on = whoIsOn(room)
81
- const claimed = new Set(Object.values(room.meta.claims || {}).map((c) => room.branchOf(c)))
81
+ const boxed = new Set(Object.values(room.meta.boxes || {}).map((c) => room.branchOf(c)))
82
82
  const chosen = new Set(Object.values(room.meta.hostedBranch || {}))
83
83
  return Object.entries(room.meta.branches)
84
- .filter(([k, b]) => k !== room.defaultKey && !on.has(k) && !claimed.has(k) && !chosen.has(k) && now - (b.used || b.seen || b.at || 0) >= TRIM_IDLE_MS)
84
+ .filter(([k, b]) => k !== room.defaultKey && !on.has(k) && !boxed.has(k) && !chosen.has(k) && now - (b.used || b.seen || b.at || 0) >= TRIM_IDLE_MS)
85
85
  .map(([k]) => k)
86
86
  }
87
87