heyquilt 0.3.176 → 0.3.177
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 +10 -0
- package/bin/quilt.js +1 -1
- package/package.json +2 -2
- package/src/agent-task-workflow.js +3 -3
- package/src/connection.js +1 -9
- package/src/control.js +0 -1
- package/src/duties.js +2 -4
- package/src/gitstate.js +159 -10
- package/src/hooks.js +2 -2
- package/src/identity.js +1 -1
- package/src/mcp.js +2 -16
- package/src/now-summary.js +2 -4
- package/src/pathrules.js +1 -1
- package/src/protocol.js +2 -2
- package/src/relay-ask.js +2 -3
- package/src/relay-live-write.js +0 -1
- package/src/relay-mcp.js +7 -48
- package/src/relay-prune.js +1 -2
- package/src/relay-turn-sync.js +11 -37
- package/src/server.js +20 -287
- package/src/session.js +265 -240
- package/src/setup.js +17 -27
- package/src/status.js +3 -8
- package/src/ui/agent-guide.js +8 -17
- package/src/ui/app.css +22 -121
- package/src/ui/common.js +1 -4
- package/src/ui/feedback.js +3 -3
- package/src/ui/fileview.js +6 -12
- package/src/ui/rail-model.js +19 -35
- package/src/ui/rail.js +13 -153
- package/src/ui/session.js +63 -146
- package/src/ui/tree.js +5 -28
- package/src/ui-server.js +0 -4
- package/src/boxes.js +0 -36
- package/src/ui/boxes.js +0 -80
package/RELEASES.md
CHANGED
|
@@ -11,6 +11,16 @@ 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.177 — 2026-11-17
|
|
15
|
+
|
|
16
|
+
- **No more boxes.** Every edit is shared with everyone as it is made, in a git folder or any other. Nothing is kept out of your folder until someone commits it, and there is nothing to unpack.
|
|
17
|
+
- **The left pane is People.** It lists who is in the session and what each is working on, as before, without the boxes under each name. Folded, it shows everyone's face; click one to open it again.
|
|
18
|
+
- **AIs are no longer told about boxes.** `quilt_unpack` is gone, and `quilt_status`, `quilt_list_files`, the edit check and the guide your AI gets no longer mention boxed work.
|
|
19
|
+
- **Older apps keep working.** An app from before this version that asks to keep a file out of other folders is told nothing is kept, so its edit is shared like any other.
|
|
20
|
+
- **Commits come into your folder by themselves.** When a partner pushes, or a pull request is merged on GitHub, your branch moves forward to those commits within about a minute and your uncommitted work stays where it is. After a partner commits and pushes what you were both editing, your git shows nothing left to commit. There is nothing to pull.
|
|
21
|
+
- **Two cases are left to your own git, and Quilt says so.** If your branch has commits of its own that the remote doesn't, or a new commit changed the same lines as work you haven't committed, Quilt brings nothing in and tells you and your AI why, once, with the pull command to use (`git pull --rebase --autostash`). `quilt_status` lists it under "Git". Files a partner's commit added that the session already put in your folder are staged for you, so git does not refuse the pull over them.
|
|
22
|
+
- **What AIs are told about git is true again.** The guide no longer promises task branches, pull requests opened or merged by Quilt, or git tools that don't exist. A test now checks that every tool the guide names is one Quilt has.
|
|
23
|
+
|
|
14
24
|
## 0.3.176 — 2026-11-16
|
|
15
25
|
|
|
16
26
|
A clash stays in your own file for your AI to settle, the way git does it. And your folder follows the git branch you check out.
|
package/bin/quilt.js
CHANGED
|
@@ -30,7 +30,7 @@ Usage:
|
|
|
30
30
|
With the key, status, messages, say, tasks, task, history,
|
|
31
31
|
focus, tool and mcp work too
|
|
32
32
|
quilt setup Connect Claude Code / Cursor / others via MCP
|
|
33
|
-
quilt status Show collaborators,
|
|
33
|
+
quilt status Show collaborators, activity, chat
|
|
34
34
|
quilt history [path] [--by name] [--since 2h] [--task id] [--diff] [-n 30]
|
|
35
35
|
Who changed what, when, and for which task
|
|
36
36
|
quilt chat Live chat (messages, DMs, files) in this terminal
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "heyquilt",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.177",
|
|
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",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"build": {
|
|
71
71
|
"appId": "dev.quilt.app",
|
|
72
72
|
"productName": "Quilt",
|
|
73
|
-
"copyright": "Copyright
|
|
73
|
+
"copyright": "Copyright © 2026 Daniel Carmichael. All rights reserved.",
|
|
74
74
|
"directories": {
|
|
75
75
|
"buildResources": "desktop/build",
|
|
76
76
|
"output": "dist"
|
|
@@ -24,7 +24,7 @@ export const TASK_WORKFLOW =
|
|
|
24
24
|
'When finished, move the ticket to QA (not straight to Done) with `qaNotes`: describe the changes you made and how you self-validated them. ' +
|
|
25
25
|
'Keep qaNotes, verified and task comments brief: a few short sentences, no logs or play-by-play. ' +
|
|
26
26
|
'Moving to Done still requires `verified` (what you ran and what you saw). Unit tests passing is not enough when the app itself was not exercised. ' +
|
|
27
|
-
'
|
|
27
|
+
'Get the task\'s files into git before you move it to QA: commit only the files you changed and push, on a branch of your own with a pull request you open yourself where the project works that way. Quilt does not commit, push, open pull requests or merge them for anyone. Without a folder you cannot commit: say in `qaNotes` which files need committing. Work only in the session has not shipped.'
|
|
28
28
|
|
|
29
29
|
/** Markdown bullets for AGENTS.md / CLAUDE.md (same steps as TASK_WORKFLOW). */
|
|
30
30
|
export const TASK_WORKFLOW_MD =
|
|
@@ -35,8 +35,8 @@ export const TASK_WORKFLOW_MD =
|
|
|
35
35
|
' 4. **Test** it: confirm the tests you touch pass, then run the project\'s own checks under "Verifying a change" below.\n' +
|
|
36
36
|
' 5. **QA**: move to `qa` (not straight to Done) with `qaNotes` describing the changes and how you self-validated them.\n' +
|
|
37
37
|
' Keep `qaNotes`, `verified` and task comments brief: a few short sentences, no logs or play-by-play.\n' +
|
|
38
|
-
' 6. **Done** (after QA): `quilt_move_task` to `done` needs `verified`, what you ran and what you saw. Unit tests passing is not enough when the app itself was not exercised
|
|
39
|
-
' 7. **Commit and push** before QA: only the
|
|
38
|
+
' 6. **Done** (after QA): `quilt_move_task` to `done` needs `verified`, what you ran and what you saw. Unit tests passing is not enough when the app itself was not exercised.\n' +
|
|
39
|
+
' 7. **Commit and push** before QA: only the files you changed, with a message; on a branch of your own with a pull request you open yourself, where the project works that way. Quilt does not commit, push or merge for anyone. Without a folder you cannot commit: say in `qaNotes` which files need committing. Work only in the session has not shipped.'
|
|
40
40
|
|
|
41
41
|
/** Scaffolded into AGENTS.md by `quilt setup` when the project has no checklist yet. Owners edit it in place. */
|
|
42
42
|
export const CHECKLIST_SCAFFOLD = `${CHECKLIST_HEADING}
|
package/src/connection.js
CHANGED
|
@@ -6,7 +6,7 @@ import WebSocket from 'ws'
|
|
|
6
6
|
import crypto from 'node:crypto'
|
|
7
7
|
import * as Y from 'yjs'
|
|
8
8
|
import {
|
|
9
|
-
MSG_SYNC, MSG_AWARENESS, MSG_QUERY_AWARENESS, MSG_AUTH,
|
|
9
|
+
MSG_SYNC, MSG_AWARENESS, MSG_QUERY_AWARENESS, MSG_AUTH,
|
|
10
10
|
MSG_ACCESS, MSG_ADMIN, MSG_MEMBERS, MSG_PASS, MSG_BRANCH, MSG_BRANCHES,
|
|
11
11
|
CLOSE_AUTH_FAILED, CLOSE_NAME_TAKEN, CLOSE_ROOM_FULL, CLOSE_DENIED, CLOSE_ENDED, CLOSE_PASS_EXPIRED,
|
|
12
12
|
encoding, decoding, syncProtocol, awarenessProtocol,
|
|
@@ -430,11 +430,6 @@ export class Connection extends EventEmitter {
|
|
|
430
430
|
const msg = JSON.parse(decoding.readVarString(dec))
|
|
431
431
|
this.emit('members', msg)
|
|
432
432
|
this.settle(msg.reply, 'request refused')
|
|
433
|
-
} else if (type === MSG_CLAIMS) {
|
|
434
|
-
// The room's boxes (the field keeps its old name): Quilt holds no files, so only boxes come here.
|
|
435
|
-
const { claims, reply } = JSON.parse(decoding.readVarString(dec))
|
|
436
|
-
this.emit('boxes', claims)
|
|
437
|
-
this.settle(reply, 'box refused')
|
|
438
433
|
}
|
|
439
434
|
}
|
|
440
435
|
|
|
@@ -546,9 +541,6 @@ export class Connection extends EventEmitter {
|
|
|
546
541
|
})
|
|
547
542
|
}
|
|
548
543
|
|
|
549
|
-
/** Asks the relay to box or unbox a file; resolves with its reply. Needs a live connection. */
|
|
550
|
-
boxRequest (req) { return this.request(MSG_CLAIM, req, 'boxes') }
|
|
551
|
-
|
|
552
544
|
/** Approve / deny / change / remove someone, or set who may admit (relay enforces who may). */
|
|
553
545
|
adminRequest (req, { timeoutMs } = {}) { return this.request(MSG_ADMIN, req, 'changes to who is in the session', null, timeoutMs) }
|
|
554
546
|
|
package/src/control.js
CHANGED
|
@@ -86,7 +86,6 @@ export async function startControl (session, extras = {}) {
|
|
|
86
86
|
const remind = await wake.reminder()
|
|
87
87
|
return { notices: [...heldFirst(b), ...notices, ...(remind ? [remind] : [])] }
|
|
88
88
|
},
|
|
89
|
-
'POST /unpack': (b) => session.unpack(b.paths, b.via),
|
|
90
89
|
// Before an agent changes files (any tool): who else changed them lately, and what did people say
|
|
91
90
|
// about them? It never refuses (Session.prepareEdit, duties.js).
|
|
92
91
|
'POST /before-edit': (b) => session.prepareEdit(Array.isArray(b.paths) ? b.paths.slice(0, 100) : [], b.via),
|
package/src/duties.js
CHANGED
|
@@ -259,9 +259,8 @@ export function renderChatAbout (said, { now = Date.now(), max = 8 } = {}) {
|
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
/**
|
|
262
|
-
* Who else wrote the files an agent is about to change lately
|
|
263
|
-
*
|
|
264
|
-
* hold: '' when nobody.
|
|
262
|
+
* Who else wrote the files an agent is about to change lately (quilt_before_edit's `files`:
|
|
263
|
+
* [{ path, recent: [{ by, at }] }]). Presence, never a hold: '' when nobody.
|
|
265
264
|
*/
|
|
266
265
|
export function renderRecent (files, { now = Date.now() } = {}) {
|
|
267
266
|
const lines = []
|
|
@@ -269,7 +268,6 @@ export function renderRecent (files, { now = Date.now() } = {}) {
|
|
|
269
268
|
if (!f || !f.path) continue
|
|
270
269
|
const who = (f.recent || []).filter((w) => w && w.by).map((w) => `${w.by} ${ago(w.at, now)}`)
|
|
271
270
|
if (who.length) lines.push(`- ${f.path}: changed lately by ${who.join(', ')}`)
|
|
272
|
-
if (f.box && f.box.by) lines.push(`- ${f.path}: ${f.box.by}'s unfinished work is boxed on it; your edit opens the box and merges with it`)
|
|
273
271
|
}
|
|
274
272
|
if (!lines.length) return ''
|
|
275
273
|
return 'Others working on these files (nobody holds files: edit them; changes merge as they arrive, and a clash on the same lines comes back to you to resolve):\n' + lines.join('\n')
|
package/src/gitstate.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// What git is doing to a synced folder
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// below are synchronous.
|
|
1
|
+
// What git is doing to a synced folder: which branch (or commit) the folder is on, whether git is
|
|
2
|
+
// at work in it, and what a file looked like at a commit, so a checkout of another branch is told
|
|
3
|
+
// apart from edits and the folder can follow its branch (session.js). Quilt does two things to git
|
|
4
|
+
// itself, both at the end of this file: it fetches the branch's upstream, and it moves the branch
|
|
5
|
+
// forward to a commit it is behind (never merging history). Every git call is asynchronous (the
|
|
6
|
+
// app's window and its relay connection never wait on git); the file reads below are synchronous.
|
|
7
7
|
import fs from 'node:fs'
|
|
8
8
|
import path from 'node:path'
|
|
9
9
|
import { execFile } from 'node:child_process'
|
|
@@ -16,16 +16,20 @@ export const SETTLE_MS = 500
|
|
|
16
16
|
// An index.lock this old, with no other operation under way, may be one a crashed git left behind.
|
|
17
17
|
export const STALE_LOCK_MS = 60 * 1000
|
|
18
18
|
|
|
19
|
-
// What marks git at work in a folder: its index lock,
|
|
20
|
-
//
|
|
19
|
+
// What marks git at work in a folder: its index lock, the operations that take HEAD off its branch
|
|
20
|
+
// until they finish (a rebase, a bisect), and the ones that stop on a conflict with git's own markers
|
|
21
|
+
// in the files until the person settles it (a merge, a cherry-pick, a revert).
|
|
21
22
|
const MARKERS = [
|
|
22
|
-
['index.lock', 'index-lock'], ['rebase-merge', 'rebase'], ['rebase-apply', 'rebase'], ['BISECT_LOG', 'bisect']
|
|
23
|
+
['index.lock', 'index-lock'], ['rebase-merge', 'rebase'], ['rebase-apply', 'rebase'], ['BISECT_LOG', 'bisect'],
|
|
24
|
+
['MERGE_HEAD', 'merge'], ['CHERRY_PICK_HEAD', 'cherry-pick'], ['REVERT_HEAD', 'revert']
|
|
23
25
|
]
|
|
24
26
|
|
|
25
27
|
// Output read in one go: a listing of a big repository, or a batch of files (see filesAt).
|
|
26
28
|
const MAX_OUTPUT = 256 * 1024 * 1024
|
|
27
29
|
// More paths than this are not passed on the command line: the whole tree is asked, and filtered.
|
|
28
30
|
const MAX_PATHSPECS = 200
|
|
31
|
+
// Index locks this process holds (lockIndex): Quilt's own work, never git at work in the folder.
|
|
32
|
+
const ownLocks = new Set()
|
|
29
33
|
|
|
30
34
|
/** Runs git: its output (a string, or a Buffer with `buffer`), or null when it fails. */
|
|
31
35
|
async function run (root, args, opts) {
|
|
@@ -142,7 +146,7 @@ export function busy (root, dir = gitDir(root), leftover = null) {
|
|
|
142
146
|
if (!dir) return null
|
|
143
147
|
for (const [file, kind] of MARKERS) {
|
|
144
148
|
if (!fs.existsSync(path.join(dir, file))) continue
|
|
145
|
-
if (kind === 'index-lock' && leftover && lockStamp(root, dir) === leftover) continue
|
|
149
|
+
if (kind === 'index-lock' && ((leftover && lockStamp(root, dir) === leftover) || ownLocks.has(path.join(dir, file)))) continue
|
|
146
150
|
return kind
|
|
147
151
|
}
|
|
148
152
|
return null
|
|
@@ -324,3 +328,148 @@ export function watchGit (root, onEvent) {
|
|
|
324
328
|
watcher.on('add', onAny).on('change', onAny).on('unlink', onAny).on('addDir', onAny).on('unlinkDir', onAny).on('error', () => {})
|
|
325
329
|
return { close: () => closeWatcher(watcher) }
|
|
326
330
|
}
|
|
331
|
+
|
|
332
|
+
// ------------------------------------------------------------ upstream --
|
|
333
|
+
// What the folder's branch has to catch up with. A fetch can wait on the network: it gets longer.
|
|
334
|
+
export const FETCH_TIMEOUT_MS = 60 * 1000
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* The branch's upstream: { name ("origin/main"), remote ("origin"), sha }, or null (no upstream
|
|
338
|
+
* set, or git failed). It is read from the folder's own git config: nobody sets it in Quilt.
|
|
339
|
+
*/
|
|
340
|
+
export async function upstreamOf (root) {
|
|
341
|
+
const name = ((await run(root, ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{upstream}'])) || '').trim()
|
|
342
|
+
if (!name) return null
|
|
343
|
+
const sha = ((await run(root, ['rev-parse', '-q', '--verify', '@{upstream}^{commit}'])) || '').trim() || null
|
|
344
|
+
const branch = headRef(root)
|
|
345
|
+
const remote = branch ? ((await run(root, ['config', '--get', `branch.${branch}.remote`])) || '').trim() : ''
|
|
346
|
+
return { name, remote: remote || null, sha }
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Fetches the branch's upstream remote in the background: only remote-tracking refs move, never
|
|
351
|
+
* a file, the index or a branch. No prompt ever waits for a password (GIT_TERMINAL_PROMPT=0, no
|
|
352
|
+
* askpass): a remote that needs one the folder doesn't have just isn't fetched. Returns
|
|
353
|
+
* { ok, error }: `error` says in plain English why it failed (fetchProblem), null when it worked.
|
|
354
|
+
*/
|
|
355
|
+
export async function fetchUpstream (root, remote) {
|
|
356
|
+
if (!remote || remote === '.') return { ok: false, error: null, skipped: true }
|
|
357
|
+
const r = await call(root, ['-c', 'core.askPass=', 'fetch', '--quiet', '--no-tags', '--no-write-fetch-head', remote], {
|
|
358
|
+
timeout: FETCH_TIMEOUT_MS,
|
|
359
|
+
env: { GIT_TERMINAL_PROMPT: '0', GIT_ASKPASS: '', SSH_ASKPASS: '', GCM_INTERACTIVE: 'never', GIT_SSH_COMMAND: process.env.GIT_SSH_COMMAND || 'ssh -o BatchMode=yes' }
|
|
360
|
+
})
|
|
361
|
+
if (r.out !== null) return { ok: true, error: null }
|
|
362
|
+
return { ok: false, error: fetchProblem({ stderr: r.stderr, remote, timedOut: r.timedOut, missing: r.missing }) }
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/** Why a fetch failed, in a few plain words (never the remote's address: it may hold a password). */
|
|
366
|
+
export function fetchProblem ({ stderr = '', remote = 'origin', timedOut = false, missing = false } = {}) {
|
|
367
|
+
const e = String(stderr || '').toLowerCase()
|
|
368
|
+
if (missing) return "git can't be run here"
|
|
369
|
+
if (timedOut) return `fetching from ${remote} took over a minute and was stopped`
|
|
370
|
+
if (/does not appear to be a git repository|not a git repository|no such remote/.test(e)) return `${remote} isn't a repository git can fetch from`
|
|
371
|
+
if (/could not read (username|password)|terminal prompts disabled|authentication failed|permission denied \(publickey|host key verification failed|invalid username or password|access denied|returned error: 40[13]/.test(e)) {
|
|
372
|
+
return `git can't sign in to ${remote} from this folder`
|
|
373
|
+
}
|
|
374
|
+
if (/could not resolve host|failed to connect|connection (timed out|refused)|network is unreachable|operation timed out|couldn't connect|unable to access|no route to host|temporary failure in name resolution/.test(e)) {
|
|
375
|
+
return `can't reach ${remote} (no network?)`
|
|
376
|
+
}
|
|
377
|
+
const line = String(stderr || '').split('\n').map((l) => l.replace(/^(fatal|error):\s*/i, '').trim()).find(Boolean)
|
|
378
|
+
return line ? `git fetch failed: ${line.replace(/[a-z]+:\/\/[^\s'"]*@/gi, '').slice(0, 120)}` : 'git fetch failed'
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/** How `from` and `to` stand: { ahead: commits only `from` has, behind: commits only `to` has }; null when git can't say. */
|
|
382
|
+
export async function aheadBehind (root, from, to) {
|
|
383
|
+
const m = /^(\d+)\s+(\d+)$/.exec(String((await run(root, ['rev-list', '--left-right', '--count', `${from}...${to}`])) || '').trim())
|
|
384
|
+
return m ? { ahead: Number(m[1]), behind: Number(m[2]) } : null
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* The paths that differ between two commits: rel -> { status (git's letter: A, M, D, T), exec
|
|
389
|
+
* (whether `to` has it as an executable; null when it is gone there), plain (an ordinary file at
|
|
390
|
+
* both ends: no link, no submodule) }. Null when git fails.
|
|
391
|
+
*/
|
|
392
|
+
export async function changesBetween (root, from, to) {
|
|
393
|
+
const out = await run(root, ['diff', '--no-renames', '--no-ext-diff', '--raw', '-z', from, to])
|
|
394
|
+
if (out === null) return null
|
|
395
|
+
const f = out.split('\0')
|
|
396
|
+
const changes = new Map()
|
|
397
|
+
for (let i = 0; i + 1 < f.length; i += 2) {
|
|
398
|
+
const m = /^:(\d{6}) (\d{6}) \S+ \S+ ([A-Z])/.exec(f[i])
|
|
399
|
+
if (!m || !f[i + 1]) continue
|
|
400
|
+
const file = (mode) => mode === '000000' || mode.startsWith('100')
|
|
401
|
+
changes.set(f[i + 1], { status: m[3], exec: m[2] === '000000' ? null : m[2] === '100755', plain: file(m[1]) && file(m[2]) })
|
|
402
|
+
}
|
|
403
|
+
return changes
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** Stages `rels` as they are in the folder (git add); whether git did. */
|
|
407
|
+
export async function stage (root, rels) {
|
|
408
|
+
for (let i = 0; i < rels.length; i += MAX_PATHSPECS) {
|
|
409
|
+
if ((await call(root, ['--literal-pathspecs', 'add', '--', ...rels.slice(i, i + MAX_PATHSPECS)])).out === null) return false
|
|
410
|
+
}
|
|
411
|
+
return true
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Moves the folder's branch from `from` to `to` and sets the index to `to`, leaving every file as it
|
|
416
|
+
* is; `during()` (writing `to`'s files: session.js bringIn) runs first. git's index lock is held
|
|
417
|
+
* throughout, so a person's `git commit` meanwhile either went first (the branch is no longer at
|
|
418
|
+
* `from`: not moved) or is refused by git and asked again. The index is set before the branch
|
|
419
|
+
* moves: git reads HEAD, then the index, and only then takes the lock, so a commit that read the new
|
|
420
|
+
* HEAD reads the new index too, and one that read the old HEAD fails git's own check that HEAD
|
|
421
|
+
* hasn't moved. Never a commit on `to` made from the old index or missing `to`'s files, which would
|
|
422
|
+
* undo `to`'s changes. Returns whether it moved.
|
|
423
|
+
*/
|
|
424
|
+
export async function fastForward (root, branch, from, to, during = null) {
|
|
425
|
+
const lock = await lockIndex(root)
|
|
426
|
+
if (!lock) return false
|
|
427
|
+
try {
|
|
428
|
+
if (((await run(root, ['rev-parse', '-q', '--verify', `refs/heads/${branch}`])) || '').trim() !== from) return false
|
|
429
|
+
if (during) await during()
|
|
430
|
+
const kept = lock.keep()
|
|
431
|
+
if (!(await lock.setIndex(to))) return false
|
|
432
|
+
if ((await call(root, ['update-ref', '-m', 'quilt: catch up with upstream', `refs/heads/${branch}`, to, from])).out === null) {
|
|
433
|
+
if (kept) lock.putBack()
|
|
434
|
+
return false
|
|
435
|
+
}
|
|
436
|
+
return true
|
|
437
|
+
} finally { lock.release() }
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Takes git's index lock (index.lock) as git itself does, asking again for up to two seconds while
|
|
442
|
+
* another git holds it; null when it can't. While it is held, `setIndex(sha)` makes the index
|
|
443
|
+
* `sha`'s tree (keeping what git knows of files that didn't change) and `release()` lets git in again.
|
|
444
|
+
*/
|
|
445
|
+
async function lockIndex (root) {
|
|
446
|
+
const dir = gitDir(root)
|
|
447
|
+
if (!dir) return null
|
|
448
|
+
const index = path.join(dir, 'index')
|
|
449
|
+
const lock = `${index}.lock`
|
|
450
|
+
const prev = `${index}.quilt-prev-${process.pid}`
|
|
451
|
+
for (let i = 0; i < 20; i++) {
|
|
452
|
+
try {
|
|
453
|
+
fs.closeSync(fs.openSync(lock, 'wx'))
|
|
454
|
+
ownLocks.add(lock)
|
|
455
|
+
return {
|
|
456
|
+
async setIndex (sha) {
|
|
457
|
+
const next = `${index}.quilt-${process.pid}`
|
|
458
|
+
try { fs.copyFileSync(index, next) } catch {}
|
|
459
|
+
const r = await call(root, ['read-tree', '--reset', sha], { env: { GIT_INDEX_FILE: next } })
|
|
460
|
+
try {
|
|
461
|
+
if (r.out === null) return false
|
|
462
|
+
fs.renameSync(next, index)
|
|
463
|
+
return true
|
|
464
|
+
} catch { return false } finally { fs.rmSync(next, { force: true }); fs.rmSync(`${next}.lock`, { force: true }) }
|
|
465
|
+
},
|
|
466
|
+
// A copy of the index as it is, put back by putBack() (the branch it was for didn't move after all).
|
|
467
|
+
keep () { try { fs.copyFileSync(index, prev); return true } catch { return false } },
|
|
468
|
+
putBack () { try { fs.renameSync(prev, index) } catch {} },
|
|
469
|
+
release () { fs.rmSync(prev, { force: true }); fs.rmSync(lock, { force: true }); ownLocks.delete(lock) }
|
|
470
|
+
}
|
|
471
|
+
} catch (err) { if (err.code !== 'EEXIST') return null }
|
|
472
|
+
await new Promise((resolve) => setTimeout(resolve, 100))
|
|
473
|
+
}
|
|
474
|
+
return null
|
|
475
|
+
}
|
package/src/hooks.js
CHANGED
|
@@ -209,8 +209,8 @@ async function preEdit (event, d, api, state, say, name) {
|
|
|
209
209
|
// What people said about these files in chat, shown once per message per AI session.
|
|
210
210
|
const said = (r.chat || []).filter((q) => q.id && !seen.has(`ask:${q.id}`))
|
|
211
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(',')}
|
|
213
|
-
const recent = files.filter((f) =>
|
|
212
|
+
const key = (f) => `recent:${f.path}:${(f.recent || []).map((w) => w.by).join(',')}`
|
|
213
|
+
const recent = files.filter((f) => f.recent && f.recent.length && !seen.has(key(f)))
|
|
214
214
|
if (!said.length && !recent.length) return { exitCode: 0 }
|
|
215
215
|
state.update((s) => {
|
|
216
216
|
for (const q of said) s.seen.push(`ask:${q.id}`)
|
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 their messages
|
|
4
|
+
// else's name (for example to fake their messages).
|
|
5
5
|
import fs from 'node:fs'
|
|
6
6
|
import os from 'node:os'
|
|
7
7
|
import path from 'node:path'
|
package/src/mcp.js
CHANGED
|
@@ -83,7 +83,6 @@ export const MCP_INSTRUCTIONS =
|
|
|
83
83
|
'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, ' +
|
|
84
84
|
'so you know what was asked or planned before you change them. It never refuses: nobody holds files. ' +
|
|
85
85
|
'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. In your own folder the clash is in the file itself: your save is not shared, and the file has both versions of those lines between conflict markers ("<<<<<<< mine", "=======", ">>>>>>> session"). Edit them to what they should be, delete the marker lines and save: it is shared then. A conflict listed at the top of a Quilt answer instead (an agent with no folder made it, or an older app) is resolved at once with quilt_resolve_merge. A conflict must not sit: until you resolve your own, moving a task to QA or Done, quilt_set_work done and commits refuse, and a conflict whose writer\'s AI is gone is handed to another AI in the session. ' +
|
|
86
|
-
'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. ' +
|
|
87
86
|
'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. ' +
|
|
88
87
|
'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. ' +
|
|
89
88
|
'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". ' +
|
|
@@ -204,7 +203,7 @@ export async function runMcp () {
|
|
|
204
203
|
}
|
|
205
204
|
|
|
206
205
|
server.registerTool('quilt_status', {
|
|
207
|
-
description: 'See who else is in the live session, what they are working on, which files they recently edited,
|
|
206
|
+
description: 'See who else is in the live session, what they are working on, which files they recently edited, recent messages, and which open tasks are assigned to you. Call this before starting work.',
|
|
208
207
|
inputSchema: {}
|
|
209
208
|
}, () => withDaemon(async (d) => {
|
|
210
209
|
const st = await call(d, 'GET', '/status')
|
|
@@ -359,18 +358,6 @@ export async function runMcp () {
|
|
|
359
358
|
return r.typing ? `Showing that you are typing${to ? ` to ${to}` : ''}.` : 'Not showing that you are typing.'
|
|
360
359
|
}))
|
|
361
360
|
|
|
362
|
-
server.registerTool('quilt_unpack', {
|
|
363
|
-
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. ' +
|
|
364
|
-
'Unpack when someone needs your change now: it reaches everyone\'s folder, and the file stays yours. Decide this yourself; for a large, risky or critical change, or when the project\'s rules say so, ask your person first.',
|
|
365
|
-
inputSchema: { paths: z.array(z.string().min(1).max(500)).min(1).max(100).describe('Your boxed files, relative to the project folder') }
|
|
366
|
-
}, ({ paths }) => withDaemon(async (d) => {
|
|
367
|
-
const rels = paths.map((p) => path.relative(d.dir, path.resolve(d.dir, p)).split(path.sep).join('/'))
|
|
368
|
-
const r = await call(d, 'POST', '/unpack', { paths: rels })
|
|
369
|
-
if (!r.unpacked.length) throw new Error(`${r.notBoxed.join(', ')} ${r.notBoxed.length === 1 ? 'is' : 'are'} not boxed by you.`)
|
|
370
|
-
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(', ')}.` : ''}`
|
|
371
|
-
}))
|
|
372
|
-
|
|
373
|
-
|
|
374
361
|
server.registerTool('quilt_message', {
|
|
375
362
|
description: CHAT_RULES + ' Set "to" to message one person directly.',
|
|
376
363
|
inputSchema: {
|
|
@@ -906,7 +893,7 @@ export async function runMcp () {
|
|
|
906
893
|
}))
|
|
907
894
|
|
|
908
895
|
server.registerTool('quilt_list_files', {
|
|
909
|
-
description: 'List the shared project\'s files with who edited each one recently
|
|
896
|
+
description: 'List the shared project\'s files with who edited each one recently, so you can see where others are working.',
|
|
910
897
|
inputSchema: { prefix: z.string().optional().describe('Only paths under this folder, e.g. "src/auth"') }
|
|
911
898
|
}, ({ prefix }) => withDaemon(async (d) => {
|
|
912
899
|
const { files } = await call(d, 'GET', '/tree')
|
|
@@ -917,7 +904,6 @@ export async function runMcp () {
|
|
|
917
904
|
const lines = shown.slice(0, 400).map((f) => {
|
|
918
905
|
const notes = []
|
|
919
906
|
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`)
|
|
920
|
-
if (f.box) notes.push(`${f.box.by === me ? 'your' : `${f.box.by}'s`} unfinished work, boxed`)
|
|
921
907
|
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`)
|
|
922
908
|
if (f.binary) notes.push('binary')
|
|
923
909
|
return `${f.path}${notes.length ? ` [${notes.join('; ')}]` : ''}`
|
package/src/now-summary.js
CHANGED
|
@@ -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,
|
|
65
|
+
* The room is read through what Room already offers (server.js): meta, awareness, doc, 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,6 @@ 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 boxes = room.boxList ? room.boxList() : []
|
|
75
74
|
const people = peopleIn(room, now)
|
|
76
75
|
|
|
77
76
|
const needs = []
|
|
@@ -103,8 +102,7 @@ export function nowSummary (room, account, { now = Date.now(), detail = false }
|
|
|
103
102
|
working: people.filter((p) => p.ai === 'working').length,
|
|
104
103
|
tasks: { open: byColumn.todo + byColumn.doing + byColumn.qa, ...byColumn, mine: tasks.filter((t) => t.column !== 'done' && t.assignee === me).length },
|
|
105
104
|
recent,
|
|
106
|
-
|
|
107
|
-
held: boxes.slice(0, NOW_LIMITS.held).map((c) => ({ path: clip(c.pattern, 200), by: clip(c.by, 64), box: true, waiting: [] })),
|
|
105
|
+
held: [], // nobody holds files; the field stays for older readers
|
|
108
106
|
needs: needs.slice(0, NOW_LIMITS.needs),
|
|
109
107
|
at: now
|
|
110
108
|
}
|
package/src/pathrules.js
CHANGED
|
@@ -115,7 +115,7 @@ export function isSafeRelPath (rel) {
|
|
|
115
115
|
return true
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
/** Whether two path patterns (
|
|
118
|
+
/** Whether two path patterns (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/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: 'box'|'unbox', pattern
|
|
14
|
-
export const MSG_CLAIMS = 12 // relay -> client: JSON { claims:
|
|
13
|
+
export const MSG_CLAIM = 11 // client -> relay, from apps before 0.3.177: JSON { id, op: 'box'|'unbox', pattern }; nothing is kept out of a folder, and they are told so
|
|
14
|
+
export const MSG_CLAIMS = 12 // relay -> client, for apps before 0.3.177: JSON { claims: [], reply?: { id, ok, boxed: 0 | unboxed: 0 } }
|
|
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 } }
|
package/src/relay-ask.js
CHANGED
|
@@ -72,16 +72,15 @@ function branchesAnswer (room, now) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
* The branches trim would remove: not the default, nobody on it
|
|
75
|
+
* The branches trim would remove: not the default, nobody on it, no
|
|
76
76
|
* hosted agent's choice, and no member on it for TRIM_IDLE_MS. A branch from before `used` was
|
|
77
77
|
* kept counts from its last `seen` (the relay's own saves move that too, so it only waits longer).
|
|
78
78
|
*/
|
|
79
79
|
export function unusedBranches (room, now = Date.now()) {
|
|
80
80
|
const on = whoIsOn(room)
|
|
81
|
-
const boxed = new Set(Object.values(room.meta.boxes || {}).map((c) => room.branchOf(c)))
|
|
82
81
|
const chosen = new Set(Object.values(room.meta.hostedBranch || {}))
|
|
83
82
|
return Object.entries(room.meta.branches)
|
|
84
|
-
.filter(([k, b]) => k !== room.defaultKey && !on.has(k) && !
|
|
83
|
+
.filter(([k, b]) => k !== room.defaultKey && !on.has(k) && !chosen.has(k) && now - (b.used || b.seen || b.at || 0) >= TRIM_IDLE_MS)
|
|
85
84
|
.map(([k]) => k)
|
|
86
85
|
}
|
|
87
86
|
|
package/src/relay-live-write.js
CHANGED
|
@@ -152,7 +152,6 @@ export function liveWrite (room, ws, req, { origin = WRITE_ORIGIN, now = Date.no
|
|
|
152
152
|
room.liveWriters.set(wkey, { by, ts: now })
|
|
153
153
|
if (room.liveWriters.size > 5000) room.liveWriters.delete(room.liveWriters.keys().next().value)
|
|
154
154
|
}
|
|
155
|
-
if (room.noteActivity && room.holderKeys) room.noteActivity(room.holderKeys(ws))
|
|
156
155
|
// An agent's write is its AI at work (server.js handHeld: its held conflicts stay its own while it is).
|
|
157
156
|
if (a.kind === 'agent' && room.noteAi) room.noteAi(by, now)
|
|
158
157
|
const version = bases.note(by || 'folder', k, rel, r.text)
|