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/session-follow.js
CHANGED
|
@@ -298,7 +298,7 @@ export class SquareFollower {
|
|
|
298
298
|
if (!at) throw new Error(`The session is a quilt, but ${branch} has no live square yet (the owner switches it with quilt session migrate --switch).`)
|
|
299
299
|
if (this.following && this.following.square === at.square && this.following.dir === dir) return { square: at.square, dir }
|
|
300
300
|
await this.closeSeparate()
|
|
301
|
-
const block = await this.open({ dir, client, quilt: s.quilt.id, square: at.square, api: appSeamUrl(), relay: this.relayOpts() })
|
|
301
|
+
const block = await this.open({ dir, client, quilt: s.quilt.id, square: at.square, api: appSeamUrl(), relay: this.relayOpts(), rules: s.liveRules ? s.liveRules() : null })
|
|
302
302
|
this.following = { square: at.square, dir, block }
|
|
303
303
|
if (s.log) s.log(`🧵 ${dir} follows the square ${at.square} of ${s.quilt.slug || s.quilt.id}: edits there are live for everyone on it.`)
|
|
304
304
|
return { square: at.square, dir }
|
|
@@ -383,6 +383,8 @@ export class SquareFollower {
|
|
|
383
383
|
started: (b) => { here.starting = b },
|
|
384
384
|
// Who changed what goes on as on the branch: this folder's edits on record as its member's.
|
|
385
385
|
onEdits: s.squareEdits ? (list, doc, held) => { if (this.here === here) s.squareEdits(list, doc, held) } : null,
|
|
386
|
+
// The live-write engine (live-merge.js): each edit merged against what disk last had, clashes held in the room.
|
|
387
|
+
rules: s.liveRules ? s.liveRules() : null,
|
|
386
388
|
// A file the square wrote to disk: the app redraws its Files list and an open file (as for a change its watcher heard).
|
|
387
389
|
onWrite: (p) => { if (this.here === here && s.emit) s.emit('file-changed', { path: p }) }
|
|
388
390
|
})
|
package/src/session-quilt.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// Snapshot:
|
|
7
7
|
// { room, owner, defaultKey, hasRemote,
|
|
8
8
|
// branches: [{ key, by, files: { path: { hash, bytes } }, history: [entry], merges: [{ id, state }] }],
|
|
9
|
-
//
|
|
9
|
+
// tasks: [{ id, pr }], commitRequests: n }
|
|
10
10
|
// Options:
|
|
11
11
|
// tip: { path: hash } the imported main's tree, when the room has a remote and its import exists.
|
|
12
12
|
import { createHash } from 'node:crypto'
|
|
@@ -41,7 +41,6 @@ export function planSessionQuilt (snap, { tip = null } = {}) {
|
|
|
41
41
|
needs_import: withHistory && !tip,
|
|
42
42
|
first_patch: null,
|
|
43
43
|
squares,
|
|
44
|
-
claims: { moved: 0, opened_for: [], without_square: [] },
|
|
45
44
|
tasks: { matched: [], unmatched: [] },
|
|
46
45
|
terms: 0,
|
|
47
46
|
history: { kept: 0, dropped: 0 },
|
|
@@ -66,22 +65,6 @@ export function planSessionQuilt (snap, { tip = null } = {}) {
|
|
|
66
65
|
squares.push(sq)
|
|
67
66
|
squareOf.set(b.key, sq)
|
|
68
67
|
}
|
|
69
|
-
const adoption = squares.find((s) => s.adoption) || null
|
|
70
|
-
const opened = new Set()
|
|
71
|
-
for (const c of snap.claims || []) {
|
|
72
|
-
const branch = c.branch || defaultKey
|
|
73
|
-
const holder = c.byId || c.by || ''
|
|
74
|
-
if (branch === defaultKey) {
|
|
75
|
-
if (adoption) { report.claims.moved++; continue }
|
|
76
|
-
if (!def) { report.claims.without_square.push({ pattern: c.pattern, branch, holder }); continue }
|
|
77
|
-
// No square holds the default branch's work: one is opened for the claim's holder.
|
|
78
|
-
if (!opened.has(holder)) { opened.add(holder); report.claims.opened_for.push(holder) }
|
|
79
|
-
report.claims.moved++
|
|
80
|
-
continue
|
|
81
|
-
}
|
|
82
|
-
if (squareOf.has(branch)) report.claims.moved++
|
|
83
|
-
else report.claims.without_square.push({ pattern: c.pattern, branch, holder })
|
|
84
|
-
}
|
|
85
68
|
for (const t of snap.tasks || []) {
|
|
86
69
|
if (!t || !t.pr) continue
|
|
87
70
|
const b = t.pr.branch
|
|
@@ -97,7 +80,6 @@ export function planSessionQuilt (snap, { tip = null } = {}) {
|
|
|
97
80
|
}
|
|
98
81
|
report.bytes = squares.reduce((n, s) => n + s.bytes, 0) + (report.first_patch ? report.first_patch.bytes : 0)
|
|
99
82
|
report.problems = [
|
|
100
|
-
...report.claims.without_square.map((c) => `claim on ${c.pattern} (${c.branch}) has no square`),
|
|
101
83
|
...report.tasks.unmatched.map((t) => `task ${t.id}'s pull request${t.pr ? ` #${t.pr}` : ''} has no square; it becomes a task comment`)
|
|
102
84
|
]
|
|
103
85
|
return report
|
|
@@ -105,7 +87,7 @@ export function planSessionQuilt (snap, { tip = null } = {}) {
|
|
|
105
87
|
|
|
106
88
|
export const MIGRATE_SESSION_DESCRIPTION =
|
|
107
89
|
'What making this session a quilt (Quilt\'s own source control, Seam) would do, read only: the first patch or the import, ' +
|
|
108
|
-
'which branches become squares, how
|
|
90
|
+
'which branches become squares, how tasks with pull requests move, and anything that would not carry over. ' +
|
|
109
91
|
'Only the session\'s owner (or, in a session without one, anyone who may change files) can ask. Nothing changes.'
|
|
110
92
|
|
|
111
93
|
/** Why `a` (the asker's access) may not see the dry run, or null when they may. */
|
|
@@ -132,7 +114,6 @@ export function describeQuiltPlan (p) {
|
|
|
132
114
|
out.push(`- ${p.squares.length} square${p.squares.length === 1 ? '' : 's'}:`)
|
|
133
115
|
for (const s of p.squares) out.push(` - ${s.title} from ${s.from}, on ${s.base}, held by ${s.holder || 'nobody'}: ${s.files} file${s.files === 1 ? '' : 's'}`)
|
|
134
116
|
} else out.push('- No squares: there is no other branch with work on it.')
|
|
135
|
-
out.push(`- Claims: ${p.claims.moved} move to their squares${p.claims.opened_for.length ? ` (a square is opened for ${p.claims.opened_for.join(', ')})` : ''}.`)
|
|
136
117
|
if (p.tasks.matched.length) out.push(`- ${p.tasks.matched.length} task${p.tasks.matched.length === 1 ? '' : 's'} with a pull request link${p.tasks.matched.length === 1 ? 's' : ''} to a square.`)
|
|
137
118
|
if (p.terms) out.push(`- ${p.terms} open merge${p.terms === 1 ? '' : 's'} become${p.terms === 1 ? 's' : ''} terms on their squares.`)
|
|
138
119
|
out.push(`- History: ${p.history.kept} entr${p.history.kept === 1 ? 'y' : 'ies'} kept${p.history.dropped ? `, ${p.history.dropped} dropped (they are in the import)` : ''}.`)
|
package/src/session-seam.js
CHANGED
|
@@ -15,6 +15,7 @@ import { z } from 'zod'
|
|
|
15
15
|
import { registerSeamTools, SEAM_INPUTS, SEAM_DESCRIPTIONS } from '@heyquilt/seam/lib/quilts/tools.js'
|
|
16
16
|
import { describeWrite } from '@heyquilt/seam/lib/quilts/describe.js'
|
|
17
17
|
import { squareShort } from '@heyquilt/seam/lib/quilts/errors.js'
|
|
18
|
+
import { heldPathsOn, heldLandingNote } from './held.js'
|
|
18
19
|
|
|
19
20
|
/** The quilt a room's session is, or null while it is a GitHub-backed (or plain) session. */
|
|
20
21
|
export function quiltOf (meta, env = process.env) {
|
|
@@ -84,10 +85,10 @@ export function seamRefusal (tool, quiltId, { hosted = false } = {}) {
|
|
|
84
85
|
* branches, boxes and merges with git): hidden from the tool list while it is one, so nothing an
|
|
85
86
|
* AI reads there names git or GitHub.
|
|
86
87
|
*/
|
|
87
|
-
export const GIT_TOOLS = new Set([...Object.keys(SEAM_FOR), 'quilt_git_status', 'quilt_git_log', 'quilt_git_diff', 'quilt_git_revert', 'quilt_git_pull_requests', 'quilt_git_merge', 'quilt_unpack', 'quilt_merges', '
|
|
88
|
+
export const GIT_TOOLS = new Set([...Object.keys(SEAM_FOR), 'quilt_git_status', 'quilt_git_log', 'quilt_git_diff', 'quilt_git_revert', 'quilt_git_pull_requests', 'quilt_git_merge', 'quilt_unpack', 'quilt_merges', 'quilt_adopt_work', 'quilt_branches', 'quilt_clash', 'quilt_migrate_session'])
|
|
88
89
|
|
|
89
90
|
// A sentence of guidance about git: branches, boxes, pushes, pull requests or GitHub.
|
|
90
|
-
const GITTY = /\bgit\b|GitHub|pull request|\bpush(es|ed|ing)?\b|\bbox(es|ed)?\b|quilt_git_|quilt_unpack|quilt_branches|quilt_sync_|quilt_github|quilt_request_commit|quilt_commit_|quilt_agent_commits|quilt_merges|
|
|
91
|
+
const GITTY = /\bgit\b|GitHub|pull request|\bpush(es|ed|ing)?\b|\bbox(es|ed)?\b|quilt_git_|quilt_unpack|quilt_branches|quilt_sync_|quilt_github|quilt_request_commit|quilt_commit_|quilt_agent_commits|quilt_merges|quilt_adopt_work|quilt_clash|\bbranch(es)?\b/i
|
|
91
92
|
|
|
92
93
|
/** Guidance with every sentence about git left out, for a session that is a quilt. */
|
|
93
94
|
export function seamOnly (text) {
|
|
@@ -188,6 +189,8 @@ function seamHandler (name, client, hosted) {
|
|
|
188
189
|
}
|
|
189
190
|
|
|
190
191
|
const textOf = (r) => ((r && r.content) || []).map((c) => c.text || '').join('\n')
|
|
192
|
+
// What a commit left out because of open held conflicts, after its answer ('' with none).
|
|
193
|
+
const heldNote = (paths) => (paths && paths.length ? `\n${heldLandingNote(paths)}` : '')
|
|
191
194
|
const answer = (text, extra = {}) => ({ content: [{ type: 'text', text }], ...extra })
|
|
192
195
|
|
|
193
196
|
/**
|
|
@@ -197,9 +200,12 @@ const answer = (text, extra = {}) => ({ content: [{ type: 'text', text }], ...ex
|
|
|
197
200
|
* seam_commit commits the live work the relay holds, seam_merge commits it first, the status says
|
|
198
201
|
* what is uncommitted, and a square whose head Seam moved has its live document follow.
|
|
199
202
|
* `next()` is asked after the folder's square merged, to move the branch to its next square.
|
|
203
|
+
* `held()`: the session's held conflicts (held.js readHeld): a path with an open one on the square
|
|
204
|
+
* never lands until it is resolved (Seam's 07 "Terms held aside"): seam_commit leaves it out and
|
|
205
|
+
* commits the rest, refusing only when nothing else is left; seam_merge merges what is committed.
|
|
200
206
|
* Returns an MCP tool result.
|
|
201
207
|
*/
|
|
202
|
-
export async function runSessionSeamTool (name, args = {}, { client, quilt, square = null, live = null, hosted = false, next = null, branch = '' }) {
|
|
208
|
+
export async function runSessionSeamTool (name, args = {}, { client, quilt, square = null, live = null, hosted = false, next = null, branch = '', held = null }) {
|
|
203
209
|
if (!SEAM_SESSION_TOOLS.includes(name)) return answer(`${name} is not one of this session's Seam tools (${SEAM_SESSION_TOOLS.join(', ')}).`, { isError: true })
|
|
204
210
|
const shape = SEAM_INPUTS[name]
|
|
205
211
|
const a = { ...(args || {}) }
|
|
@@ -219,15 +225,23 @@ export async function runSessionSeamTool (name, args = {}, { client, quilt, squa
|
|
|
219
225
|
if (onFolder && name === 'seam_commit' && !a.files && !a.delete && !a.amend) {
|
|
220
226
|
if (!a.message) return answer('Say why: message.')
|
|
221
227
|
const r = await live.commit({ message: a.message })
|
|
222
|
-
|
|
228
|
+
if (r && r.nothing) return answer('Nothing to commit: the square holds no live work since its last commit.')
|
|
229
|
+
return answer(describeWrite(r, 'Committed') + heldNote(r && r.left_held), { structuredContent: r })
|
|
223
230
|
}
|
|
224
231
|
if (onFolder && name === 'seam_merge' && !a.from && !a.dry_run) {
|
|
225
|
-
// The relay holds the square's live work: it is committed first, so the merge has all of it
|
|
226
|
-
|
|
232
|
+
// The relay holds the square's live work: it is committed first, so the merge has all of it
|
|
233
|
+
// (but a path with an open held conflict, which stays live until it is resolved).
|
|
234
|
+
let c = null
|
|
235
|
+
let left = []
|
|
236
|
+
try { c = await live.commit({ message: a.message || 'Work in progress' }) } catch (err) {
|
|
237
|
+
if (err.code !== 'held_conflict') throw err
|
|
238
|
+
left = err.paths || []
|
|
239
|
+
}
|
|
240
|
+
if (c && c.left_held) left = c.left_held
|
|
227
241
|
if (!a.message) { const t = await patchTitle(client, a.quilt, a.square, branch).catch(() => null); if (t) a.message = t }
|
|
228
242
|
const r = await run({ ...a, commit_live: false })
|
|
229
243
|
const rec = r.structuredContent || {}
|
|
230
|
-
const sealed = c && !c.nothing ? `Committed the square's live work first: ${describeWrite(c, 'committed')}\n` : ''
|
|
244
|
+
const sealed = (c && !c.nothing ? `Committed the square's live work first: ${describeWrite(c, 'committed')}\n` : '') + (left.length ? `${heldLandingNote(left)}\n` : '')
|
|
231
245
|
if (rec.ok && rec.merged && next) {
|
|
232
246
|
let moved = ''
|
|
233
247
|
try { const n = await next(); if (n && n.moved) moved = `\nThe folder carries on in a new square, ${squareShort(n.square)}, on main's new tip: keep editing as before.` } catch (err) { moved = `\nThe folder's branch did not move to a new square yet (${err.message}): ask again with seam_square_status.` }
|
|
@@ -237,7 +251,21 @@ export async function runSessionSeamTool (name, args = {}, { client, quilt, squa
|
|
|
237
251
|
return { ...r, content: [{ type: 'text', text: sealed + textOf(r) + inChat(r) }] }
|
|
238
252
|
}
|
|
239
253
|
if (name === 'seam_merge' && !a.message && !a.from && !a.dry_run && mine) { const t = await patchTitle(client, a.quilt, a.square, branch).catch(() => null); if (t) a.message = t }
|
|
254
|
+
// Files given by content (a hosted agent, or an explicit list): one with an open held conflict on that square stays out.
|
|
255
|
+
let leftOut = []
|
|
256
|
+
if (name === 'seam_commit' && (a.files || a.delete) && held) {
|
|
257
|
+
const on = new Set(heldPathsOn(held() || [], a.square || square))
|
|
258
|
+
leftOut = [...(a.files || []).map((f) => f && f.path), ...(a.delete || [])].filter((p) => on.has(p))
|
|
259
|
+
if (leftOut.length) {
|
|
260
|
+
const files = (a.files || []).filter((f) => !on.has(f && f.path))
|
|
261
|
+
const del = (a.delete || []).filter((p) => !on.has(p))
|
|
262
|
+
if (!files.length && !del.length && !a.amend && !a.stack) return answer(heldLandingNote([...new Set(leftOut)], { none: true }), { isError: true })
|
|
263
|
+
a.files = files.length ? files : undefined
|
|
264
|
+
a.delete = del.length ? del : undefined
|
|
265
|
+
}
|
|
266
|
+
}
|
|
240
267
|
const r = await run(a)
|
|
268
|
+
if (leftOut.length && !r.isError) return { ...r, content: [{ type: 'text', text: textOf(r) + heldNote([...new Set(leftOut)]) }] }
|
|
241
269
|
if (name === 'seam_merge') return { ...r, content: [{ type: 'text', text: textOf(r) + inChat(r) }] }
|
|
242
270
|
if (onFolder && name === 'seam_square_status') {
|
|
243
271
|
const work = live.status ? live.status() : []
|