heyquilt 0.3.170 → 0.3.172
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 +30 -0
- package/bin/quilt.js +16 -9
- package/package.json +2 -2
- package/src/agent-task-workflow.js +2 -9
- package/src/base-pick.js +212 -0
- package/src/boxes.js +6 -7
- package/src/catchup.js +1 -1
- package/src/chat-links.js +1 -3
- package/src/connection.js +24 -5
- package/src/control.js +27 -20
- package/src/duties.js +32 -56
- package/src/github-commit.js +1 -1
- package/src/held.js +323 -0
- package/src/hooks.js +27 -66
- package/src/identity.js +1 -1
- package/src/inbox.js +5 -4
- package/src/key-cli.js +1 -1
- package/src/live-merge.js +599 -0
- package/src/mcp.js +57 -102
- package/src/merge3.js +65 -1
- package/src/now-summary.js +4 -6
- package/src/pathrules.js +1 -1
- package/src/persona.js +1 -1
- package/src/presence.js +2 -0
- package/src/protocol.js +2 -2
- package/src/read-bases.js +123 -0
- package/src/relay-ask.js +2 -2
- package/src/relay-live-write.js +179 -0
- package/src/relay-mcp.js +173 -212
- package/src/relay-prune.js +2 -2
- package/src/relay-turn-sync.js +146 -142
- package/src/runner.js +0 -2
- package/src/server.js +253 -375
- package/src/session-follow.js +3 -1
- package/src/session-quilt.js +2 -21
- package/src/session-seam.js +35 -7
- package/src/session.js +795 -553
- package/src/setup.js +15 -25
- package/src/source-live/bring-in.js +5 -5
- package/src/source-live/land.js +20 -3
- package/src/source-live/live-block.js +503 -52
- package/src/status.js +8 -12
- package/src/swap-in.js +81 -0
- package/src/textdiff.js +54 -0
- package/src/turn-sync-plan.js +6 -18
- package/src/turn-sync.js +28 -21
- package/src/ui/agent-guide.js +13 -13
- package/src/ui/app.css +19 -40
- package/src/ui/boxes.js +8 -16
- package/src/ui/common.js +1 -1
- package/src/ui/fileview.js +11 -15
- package/src/ui/loom-model.js +18 -16
- package/src/ui/loom.css +1 -2
- package/src/ui/loom.js +6 -6
- package/src/ui/rail-model.js +25 -64
- package/src/ui/rail.js +48 -60
- package/src/ui/seam-model.js +39 -3
- package/src/ui/session.js +36 -54
- package/src/ui/tree.js +22 -129
- package/src/ui-server.js +2 -6
- package/src/release-words.js +0 -18
- package/src/seam-claims.js +0 -53
package/src/hooks.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
// `quilt hook`: the AI tools' own delivery of Quilt's rules. The rules themselves are
|
|
2
2
|
// the same for every agent (duties.js, Session.prepareEdit): every MCP agent gets
|
|
3
|
-
// them through quilt_before_edit, its quilt answers and quilt_set_work
|
|
4
|
-
// file watcher undoes edits to files someone else holds whatever made them. The
|
|
3
|
+
// them through quilt_before_edit, its quilt answers and quilt_set_work. The
|
|
5
4
|
// hooks make them automatic in every tool that runs hooks: Claude Code and Cursor
|
|
6
5
|
// (which reads the project's Claude Code hooks) from .claude/settings.local.json,
|
|
7
6
|
// Gemini CLI from its user settings (integrations.js). Each speaks its own dialect
|
|
8
|
-
// (DIALECTS below); what happens is the same. Before every edit,
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// made are released when Claude finishes, once it has answered who wrote to it.
|
|
7
|
+
// (DIALECTS below); what happens is the same. Before every edit, what was said about
|
|
8
|
+
// the file in chat and who else changed it lately are shown. A hook never refuses an
|
|
9
|
+
// edit: Quilt holds no files (no-holds, 2026-11-13), and edits merge as they arrive.
|
|
12
10
|
// Direct messages, mentions and tasks handed over are shown as Claude works, and when
|
|
13
11
|
// this person lets their AI pick up work by itself, it is handed its next task as it finishes.
|
|
14
12
|
//
|
|
@@ -21,7 +19,7 @@ import { execFileSync } from 'node:child_process'
|
|
|
21
19
|
import { findDaemon } from './control.js'
|
|
22
20
|
import { migrateDir } from './legacy.js'
|
|
23
21
|
import { eventLines, REFERS_HOW } from './inbox.js'
|
|
24
|
-
import {
|
|
22
|
+
import { renderChatAbout, renderRecent, PERSON_CHAT } from './duties.js'
|
|
25
23
|
import { renderNextTask } from './tasks.js'
|
|
26
24
|
import { quiltShellCommand } from './integrations.js'
|
|
27
25
|
import { foldPersonas } from './persona.js'
|
|
@@ -41,8 +39,7 @@ export const hookCommand = (dialect = '') => quiltShellCommand(dialect ? ['hook'
|
|
|
41
39
|
export const isQuiltHook = (h) => !!h && typeof h.command === 'string' && (h.command.startsWith(HOOK_COMMAND) || /(quilt\.js|\/quilt)"? hook( \w+)?$/.test(h.command))
|
|
42
40
|
/**
|
|
43
41
|
* `stop`: the hook as the AI finishes a turn, for an agent of its own (it is held there to answer
|
|
44
|
-
* what is written to it
|
|
45
|
-
* nothing written to the person is theirs to answer, and their claims go when the session ends.
|
|
42
|
+
* what is written to it). A person's AI sessions get none: nothing written to the person is theirs to answer.
|
|
46
43
|
*/
|
|
47
44
|
export function hookSettings (command = hookCommand(), { stop = true } = {}) {
|
|
48
45
|
const run = { type: 'command', command, timeout: 10 }
|
|
@@ -138,7 +135,7 @@ export async function handleHook (event, { findDaemon: find = findDaemon, call =
|
|
|
138
135
|
const d = find(cwd)
|
|
139
136
|
if (!d) return answer({ exitCode: 0 })
|
|
140
137
|
// Which AI session this is: the one whose tool process (the parent of its `quilt mcp`) is
|
|
141
|
-
// among this hook's parents. Its
|
|
138
|
+
// among this hook's parents. Its inbox and duties are its own (persona.js).
|
|
142
139
|
const mine = pids || parentPids()
|
|
143
140
|
const api = (method, route, body) => method === 'GET'
|
|
144
141
|
? call(d, method, `${route}${route.includes('?') ? '&' : '?'}pids=${mine.join(',')}`)
|
|
@@ -167,15 +164,13 @@ async function sessionStart (api, state, say, name) {
|
|
|
167
164
|
const who = others.length ? others.map((p) => p.name + (p.kind === 'agent' ? ' (AI agent)' : '')).join(', ') : 'nobody else yet'
|
|
168
165
|
const parts = [
|
|
169
166
|
`This folder is in a live Quilt session (room ${st.room}) with ${who}. Files can change underneath you at any time; re-read a file right before editing it.`,
|
|
170
|
-
'
|
|
171
|
-
'
|
|
172
|
-
'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), then carry on with other work: you are told when it is handed to you, with their context. ' +
|
|
173
|
-
'When someone asks for a file you hold, finish your change, then hand it off with quilt_handoff and your context; you cannot finish before you do.',
|
|
167
|
+
'Nobody holds files here: edit any file you may change. Edits merge as they arrive; if your change clashes with someone\'s on the same lines, Quilt tells you and you resolve it. ' +
|
|
168
|
+
'Before you edit a file, Quilt shows you what was said about it in chat and who else changed it lately.',
|
|
174
169
|
// An agent of its own is shown what is written to it; a person's AI session never is (it is the person's).
|
|
175
170
|
st.me && st.me.kind === 'agent'
|
|
176
171
|
? 'Messages from collaborators, mentions of you and tasks handed to you are shown to you as you work; answer with quilt_message and take a task with quilt_move_task.'
|
|
177
172
|
: PERSON_CHAT,
|
|
178
|
-
'In the session you are your person: your messages
|
|
173
|
+
'In the session you are your person: your messages and tasks are theirs, and people see you as them. ' +
|
|
179
174
|
'"<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).'
|
|
180
175
|
]
|
|
181
176
|
const duties = await api('GET', '/duties').catch(() => ({}))
|
|
@@ -187,17 +182,17 @@ async function sessionStart (api, state, say, name) {
|
|
|
187
182
|
|
|
188
183
|
/** One short paragraph naming the files still open for merging, or null when there are none. */
|
|
189
184
|
export function mergesContext (merges) {
|
|
190
|
-
// A file
|
|
185
|
+
// A file with several records: one line, its latest.
|
|
191
186
|
const open = [...new Map((merges || []).filter((m) => m.state !== 'done').map((m) => [m.path, m])).values()]
|
|
192
187
|
if (!open.length) return null
|
|
193
188
|
const describe = (m) => {
|
|
194
189
|
const action = m.oursDeleted ? 'deleted it offline' : 'changed it offline'
|
|
195
|
-
const other =
|
|
190
|
+
const other = m.others && m.others[0]
|
|
196
191
|
return `\`${m.path}\` (${m.by} ${action}${other ? `, ${other} in the session` : ''})`
|
|
197
192
|
}
|
|
198
193
|
const shown = open.slice(0, 5).map(describe).join(', ')
|
|
199
194
|
const more = open.length > 5 ? `, and ${open.length - 5} more` : ''
|
|
200
|
-
return `${open.length} file(s)
|
|
195
|
+
return `${open.length} file(s) have changes Quilt has not merged in yet: ${shown}${more}.`
|
|
201
196
|
}
|
|
202
197
|
|
|
203
198
|
async function preEdit (event, d, api, state, say, name) {
|
|
@@ -206,21 +201,23 @@ async function preEdit (event, d, api, state, say, name) {
|
|
|
206
201
|
.map((file) => path.relative(d.dir, path.resolve(event.cwd || d.dir, String(file))).split(path.sep).join('/'))
|
|
207
202
|
.filter((rel) => rel && !rel.startsWith('..') && !path.isAbsolute(rel)) // not in the project
|
|
208
203
|
if (!rels.length) return { exitCode: 0 }
|
|
209
|
-
// The same check quilt_before_edit makes for every other agent.
|
|
210
|
-
const r = await api('POST', '/before-edit', { paths: rels })
|
|
204
|
+
// The same check quilt_before_edit makes for every other agent. It never refuses: the edit goes ahead.
|
|
205
|
+
const r = await api('POST', '/before-edit', { paths: rels }).catch(() => ({}))
|
|
211
206
|
const files = (r.files || []).filter((f) => f && f.shared) // Quilt doesn't sync the rest, so nobody can clash on them
|
|
212
|
-
const refused = files.find((f) => !f.ok)
|
|
213
|
-
if (refused) return { exitCode: 0, output: say.deny(name, heldRefusal(refused.path, refused.claim, refused.error)) }
|
|
214
207
|
if (!files.length) return { exitCode: 0 }
|
|
215
208
|
const seen = new Set(state.read().seen)
|
|
216
209
|
// What people said about these files in chat, shown once per message per AI session.
|
|
217
210
|
const said = (r.chat || []).filter((q) => q.id && !seen.has(`ask:${q.id}`))
|
|
211
|
+
// Who else changed them lately, shown once per file and writer per AI session.
|
|
212
|
+
const key = (f) => `recent:${f.path}:${(f.recent || []).map((w) => w.by).join(',')}:${f.box ? f.box.by : ''}`
|
|
213
|
+
const recent = files.filter((f) => ((f.recent && f.recent.length) || f.box) && !seen.has(key(f)))
|
|
214
|
+
if (!said.length && !recent.length) return { exitCode: 0 }
|
|
218
215
|
state.update((s) => {
|
|
219
|
-
for (const f of files) if (f.claimed && !s.claims.includes(f.path)) s.claims.push(f.path)
|
|
220
216
|
for (const q of said) s.seen.push(`ask:${q.id}`)
|
|
217
|
+
for (const f of recent) s.seen.push(key(f))
|
|
221
218
|
})
|
|
222
|
-
|
|
223
|
-
return { exitCode: 0, output: say.context(name,
|
|
219
|
+
const text = [said.length ? renderChatAbout(said) : '', renderRecent(recent)].filter(Boolean).join('\n')
|
|
220
|
+
return { exitCode: 0, output: say.context(name, text) }
|
|
224
221
|
}
|
|
225
222
|
|
|
226
223
|
async function postEdit (api, state, say, name) {
|
|
@@ -241,24 +238,15 @@ async function stop (event, api, state, say, name) {
|
|
|
241
238
|
for (const e of owed) if (!events.some((x) => x.id === e.id)) events.push(e)
|
|
242
239
|
if (events.length) {
|
|
243
240
|
state.update((s) => { for (const e of events) s.seen.push(e.id); for (const e of owed) s.seen.push(`owed:${e.id}`) })
|
|
244
|
-
return { exitCode: 0, output: say.block(name, `${renderAsks(events, me)}\nBefore you finish, reply with quilt_message to what asks something of you (settle what needs nothing back with quilt_inbox no_reply), and take or decline a task you were handed
|
|
245
|
-
}
|
|
246
|
-
// Files someone waits for in the file queue: the AI hands them off with its context before it stops (once per request).
|
|
247
|
-
const duties = await api('GET', '/duties').catch(() => ({}))
|
|
248
|
-
const queued = duties.queued || []
|
|
249
|
-
const fresh = queued.flatMap((q) => q.queue).filter((r) => !asked.has(`queue:${r.id}`))
|
|
250
|
-
if (fresh.length) {
|
|
251
|
-
state.update((s) => { for (const r of fresh) s.seen.push(`queue:${r.id}`) })
|
|
252
|
-
return { exitCode: 0, output: say.block(name, renderQueued(queued, 'finish')) }
|
|
241
|
+
return { exitCode: 0, output: say.block(name, `${renderAsks(events, me)}\nBefore you finish, reply with quilt_message to what asks something of you (settle what needs nothing back with quilt_inbox no_reply), and take or decline a task you were handed, then finish.`) }
|
|
253
242
|
}
|
|
254
243
|
// This person lets their AI pick up work by itself: its next task, once per task.
|
|
244
|
+
const duties = await api('GET', '/duties').catch(() => ({}))
|
|
255
245
|
if (duties.next && !asked.has(`next:${duties.next.id}`)) {
|
|
256
|
-
await releaseAll(api, state) // the files of the work just finished are free again
|
|
257
246
|
state.update((s) => { s.seen.push(`next:${duties.next.id}`) })
|
|
258
247
|
return { exitCode: 0, output: say.block(name, renderNextTask(duties.next)) }
|
|
259
248
|
}
|
|
260
249
|
}
|
|
261
|
-
await releaseAll(api, state)
|
|
262
250
|
await api('POST', '/finish', {}).catch(() => {})
|
|
263
251
|
return { exitCode: 0 }
|
|
264
252
|
}
|
|
@@ -269,7 +257,6 @@ async function owedAnswers (api) {
|
|
|
269
257
|
}
|
|
270
258
|
|
|
271
259
|
async function sessionEnd (api, state) {
|
|
272
|
-
await releaseAll(api, state)
|
|
273
260
|
state.remove()
|
|
274
261
|
return { exitCode: 0 }
|
|
275
262
|
}
|
|
@@ -289,17 +276,10 @@ async function unseenEvents (api, state) {
|
|
|
289
276
|
/** What the hooks show: each event with the conversation before it, like quilt_inbox, so "that" means something. */
|
|
290
277
|
export function renderAsks (events, me = []) {
|
|
291
278
|
return `Quilt: collaborators wrote to you, or handed you work, while you were working:\n${eventLines(events, { me }).join('\n')}\n` +
|
|
292
|
-
'
|
|
279
|
+
'Answer messages that ask something of you with quilt_message (to: their name); one that needs nothing back (thanks, a greeting, an FYI) gets no reply, settle it with quilt_inbox (no_reply: [its id]). ' +
|
|
293
280
|
'Take a task you were handed with quilt_move_task when you are free, or say in chat why not. ' + REFERS_HOW
|
|
294
281
|
}
|
|
295
282
|
|
|
296
|
-
/** Releases every claim the hooks made for this Claude session. */
|
|
297
|
-
async function releaseAll (api, state) {
|
|
298
|
-
const s = state.read()
|
|
299
|
-
for (const pattern of s.claims) await api('POST', '/release', { pattern }).catch(() => {})
|
|
300
|
-
state.update((x) => { x.claims = [] })
|
|
301
|
-
}
|
|
302
|
-
|
|
303
283
|
/** This process's parents, nearest first (a few levels), for finding its AI session. */
|
|
304
284
|
export function parentPids (start = process.ppid, depth = 6) {
|
|
305
285
|
const out = []
|
|
@@ -312,12 +292,12 @@ export function parentPids (start = process.ppid, depth = 6) {
|
|
|
312
292
|
return out
|
|
313
293
|
}
|
|
314
294
|
|
|
315
|
-
/** Per-Claude-session state in .quilt/hooks/<session>.json: the
|
|
295
|
+
/** Per-Claude-session state in .quilt/hooks/<session>.json: the messages it has seen. */
|
|
316
296
|
export function hookState (projectDir, sessionId) {
|
|
317
297
|
const dir = path.join(migrateDir(projectDir), 'hooks')
|
|
318
298
|
const file = path.join(dir, `${String(sessionId || 'default').replace(/[^\w.-]/g, '_')}.json`)
|
|
319
299
|
const read = () => {
|
|
320
|
-
try { const s = JSON.parse(fs.readFileSync(file, 'utf8')); return {
|
|
300
|
+
try { const s = JSON.parse(fs.readFileSync(file, 'utf8')); return { seen: s.seen || [], after: s.after || 0 } } catch { return { seen: [], after: 0 } }
|
|
321
301
|
}
|
|
322
302
|
return {
|
|
323
303
|
file,
|
|
@@ -333,25 +313,6 @@ export function hookState (projectDir, sessionId) {
|
|
|
333
313
|
}
|
|
334
314
|
}
|
|
335
315
|
|
|
336
|
-
/**
|
|
337
|
-
* Releases claims left behind by hooks of Claude sessions that ended without
|
|
338
|
-
* telling us (a crash, a closed laptop). Run when a session starts for the folder.
|
|
339
|
-
*/
|
|
340
|
-
export async function releaseLeftoverHookClaims (session) {
|
|
341
|
-
const dir = path.join(session.stateDir, 'hooks')
|
|
342
|
-
let names = []
|
|
343
|
-
try { names = fs.readdirSync(dir).filter((n) => n.endsWith('.json')) } catch { return 0 }
|
|
344
|
-
let released = 0
|
|
345
|
-
for (const n of names) {
|
|
346
|
-
const st = hookState(session.root, n.slice(0, -5))
|
|
347
|
-
for (const pattern of st.read().claims) {
|
|
348
|
-
try { released += await session.release(pattern) } catch {}
|
|
349
|
-
}
|
|
350
|
-
st.remove()
|
|
351
|
-
}
|
|
352
|
-
return released
|
|
353
|
-
}
|
|
354
|
-
|
|
355
316
|
async function callWithTimeout (daemon, method, route, body) {
|
|
356
317
|
const res = await fetch(`http://127.0.0.1:${daemon.port}${route}`, {
|
|
357
318
|
method,
|
package/src/identity.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Per-person identity: an Ed25519 key pair kept in ~/.quilt/identity.json.
|
|
2
2
|
// The relay ties each name in a room to the first key that used it, and
|
|
3
3
|
// checks a signature on every connect, so nobody can act under someone
|
|
4
|
-
// else's name (for example to fake or
|
|
4
|
+
// else's name (for example to fake their messages or open their boxes).
|
|
5
5
|
import fs from 'node:fs'
|
|
6
6
|
import os from 'node:os'
|
|
7
7
|
import path from 'node:path'
|
package/src/inbox.js
CHANGED
|
@@ -99,8 +99,8 @@ export function scanInbox ({ messages = [], tasks = [], reader, now = Date.now()
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
if (seed || seenMsgs.has(m.id) || !me || names.includes(m.by) || own.has(m.by)) continue
|
|
102
|
-
// File queue messages
|
|
103
|
-
//
|
|
102
|
+
// File queue messages from before Quilt stopped holding files (no-holds, 2026-11-13): still in older
|
|
103
|
+
// chat, and they ask for no reply (duties.js).
|
|
104
104
|
const queue = m.kind === 'queue' || m.kind === 'handoff' ? { queue: m.kind, file: typeof m.path === 'string' ? m.path : '' } : {}
|
|
105
105
|
// A note that work the reader asked to commit was committed (commit.js): it wakes them, and asks for no reply.
|
|
106
106
|
if (m.kind === 'commit') queue.commit = typeof m.commit === 'string' ? m.commit : true
|
|
@@ -178,8 +178,9 @@ const idOf = (e) => e.id ? ` (id ${e.id})` : ''
|
|
|
178
178
|
/** One event as a line an agent can act on. */
|
|
179
179
|
export function describeEvent (e) {
|
|
180
180
|
const who = e.by || 'someone'
|
|
181
|
-
|
|
182
|
-
if (e.queue === '
|
|
181
|
+
// From before Quilt stopped holding files: nothing to hand off, every file is editable.
|
|
182
|
+
if (e.queue === 'queue') return `${who} asked for ${e.file} (an old file queue request: nobody holds files now, so there is nothing to hand off). ${e.text}`
|
|
183
|
+
if (e.queue === 'handoff') return `${who} handed you ${e.file} (from before Quilt stopped holding files: every file is editable now). ${e.text}`
|
|
183
184
|
if (e.nudge) return `Quilt reminds you (no reply needed): ${e.text}`
|
|
184
185
|
if (typeof e.commit === 'string') return `${who} asked you for a commit (request ${e.commit}; it waits here until the request is done, no reply needed): ${e.text}`
|
|
185
186
|
if (e.commit) return `${who} committed work you asked for (no reply needed): ${e.text}`
|
package/src/key-cli.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { SAY_USAGE, isHelpArg, splitSayRecipient } from './say-args.js'
|
|
6
6
|
|
|
7
7
|
/** Commands that work with the key. tasks, task and tool exist only here. */
|
|
8
|
+
// claim and release answer that Quilt holds no files (kept one release for older scripts: no-holds, 2026-11-13).
|
|
8
9
|
export const KEY_COMMANDS = new Set(['status', 'messages', 'inbox', 'say', 'history', 'claim', 'release', 'focus', 'commits', 'commit-request', 'tasks', 'task', 'tool'])
|
|
9
10
|
|
|
10
11
|
export const KEY_USAGE = `With QUILT_AGENT_KEY (an agent in a sandbox, no quilt join running):
|
|
@@ -14,7 +15,6 @@ export const KEY_USAGE = `With QUILT_AGENT_KEY (an agent in a sandbox, no quilt
|
|
|
14
15
|
quilt say [@name] <message> [--everyone] [--also]
|
|
15
16
|
quilt task <id> One task in full, with its comments
|
|
16
17
|
quilt history [path] [--by name] [--since 2h] [--task id] [--diff] [-n 30]
|
|
17
|
-
quilt claim <path|glob> [note] | quilt release [path|glob]
|
|
18
18
|
quilt focus <what you are doing> Shared with everyone (quilt_share)
|
|
19
19
|
quilt commit-request <message> [--files a,b] [--task id]
|
|
20
20
|
quilt tool <quilt_tool_name> [json] Any Quilt tool, e.g. quilt tool quilt_move_task '{"id":"t1","column":"doing"}'
|