heyquilt 0.3.174 → 0.3.176
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/README.md +6 -3
- package/RELEASES.md +30 -0
- package/bin/quilt.js +1 -75
- package/desktop/main.js +22 -9
- package/package.json +2 -3
- package/src/ai-vm.js +1 -1
- package/src/api/memory-store.js +1 -5
- package/src/api/server.js +4 -45
- package/src/api/supabase-store.js +0 -10
- package/src/autowork.js +7 -142
- package/src/base-pick.js +125 -12
- package/src/branch-view.js +1 -1
- package/src/connection.js +12 -37
- package/src/control.js +16 -93
- package/src/fsutil.js +1 -1
- package/src/git-aside.js +70 -0
- package/src/github-commit.js +1 -2
- package/src/gitstate.js +326 -0
- package/src/held.js +12 -53
- package/src/history.js +1 -25
- package/src/live-merge.js +42 -161
- package/src/mcp.js +6 -90
- package/src/merge3.js +21 -5
- package/src/pathrules.js +1 -1
- package/src/protocol.js +6 -11
- package/src/read-bases.js +3 -5
- package/src/relay-live-write.js +37 -44
- package/src/relay-mcp.js +30 -164
- package/src/relay-prune.js +3 -6
- package/src/relay-turn-sync.js +7 -11
- package/src/runner.js +2 -4
- package/src/server.js +61 -1717
- package/src/session.js +895 -844
- package/src/setup.js +11 -3
- package/src/status.js +2 -5
- package/src/swap-in.js +56 -13
- package/src/turn-sync-plan.js +2 -2
- package/src/turn-sync.js +1 -1
- package/src/ui/agent-guide.js +3 -1
- package/src/ui/app.css +4 -96
- package/src/ui/app.js +1 -1
- package/src/ui/chat.js +2 -6
- package/src/ui/cloud-ai-model.js +0 -13
- package/src/ui/cloud-ai.js +2 -10
- package/src/ui/connections.js +2 -1
- package/src/ui/fileview.js +7 -20
- package/src/ui/git-rule.js +2 -13
- package/src/ui/home.js +2 -8
- package/src/ui/session-words.js +27 -0
- package/src/ui/session.js +34 -407
- package/src/ui-server.js +7 -56
- package/src/api/routes/seam-connect.js +0 -103
- package/src/api/routes/session-migrate.js +0 -39
- package/src/force-date.js +0 -27
- package/src/quilt-default.js +0 -84
- package/src/quilt-history.js +0 -106
- package/src/quilt-remote.js +0 -78
- package/src/seam-access.js +0 -97
- package/src/seam-url.js +0 -15
- package/src/session-follow.js +0 -583
- package/src/session-layout3.js +0 -466
- package/src/session-migrate.js +0 -123
- package/src/session-quilt.js +0 -126
- package/src/session-seam.js +0 -312
- package/src/source-live/bring-in.js +0 -391
- package/src/source-live/land.js +0 -410
- package/src/source-live/live-block.js +0 -1166
- package/src/source-live/live-square.js +0 -116
- package/src/ui/force-words.js +0 -19
- package/src/ui/quiltview.js +0 -213
- package/src/ui/seam-model.js +0 -309
package/src/relay-mcp.js
CHANGED
|
@@ -29,10 +29,8 @@ import { scanInbox, renderInbox } from './inbox.js'
|
|
|
29
29
|
import { withContext, queryConversation, renderConversation, CONVERSATION_DESCRIPTION } from './conversation.js'
|
|
30
30
|
import { UpdateCheck } from './update-check.js'
|
|
31
31
|
import { TASK_WORKFLOW, pickupBrief, doneRefusal, verifiedEnough, verifiedLine, qaRefusal, qaNotesEnough, qaNotesLine, pickChecklist, MAX_VERIFIED } from './agent-task-workflow.js'
|
|
32
|
-
import { HistoryLog, queryHistory, parseSince, formatHistory, currentTask, lineDiff
|
|
33
|
-
import { linkedHistory } from './quilt-history.js'
|
|
32
|
+
import { HistoryLog, queryHistory, parseSince, formatHistory, currentTask, lineDiff } from './history.js'
|
|
34
33
|
import { changeRefusal, TALK_REFUSED } from './session-access.js'
|
|
35
|
-
import { MIGRATE_SESSION_DESCRIPTION, describeQuiltPlan } from './session-quilt.js'
|
|
36
34
|
import { chatAbout, renderChatAbout, waitingOn, needsNoReply, renderUnanswered, answered, unaddressed, CHAT_RULES, RE_HELP, replyFor, renderReplied, PERSON_CHAT, PERSON_INBOX } from './duties.js'
|
|
37
35
|
import { describeSubscription, describeWebhookTest, COALESCE_HELP, WEBHOOK_EVENTS } from './webhooks.js'
|
|
38
36
|
import { registerWorkspaceTools, bytesFetcher, WORKSPACE_GUIDE_HOSTED } from './workspace-tools.js'
|
|
@@ -41,10 +39,7 @@ import { isDiff, hasEntry, listPaths, readPath, readPaths, textOf, notePresent,
|
|
|
41
39
|
import { hostedRooms, hostedIn, newHosted } from './hosted-agents.js'
|
|
42
40
|
import { turnSyncStep, ROOM_KEY } from './relay-turn-sync.js'
|
|
43
41
|
import { describeSecretNames, SECRET_NAMES_DESCRIPTION } from './secret-names.js'
|
|
44
|
-
import {
|
|
45
|
-
import { seamAccess } from './seam-access.js'
|
|
46
|
-
import { LAYOUT_QUILT } from './session-layout3.js'
|
|
47
|
-
import { HELD_MAP, readHeld, findHeld, settleHeld, renderHeld, renderOwnHeld, ownHeld, describeHeld, versionsOf, versionBy, staleWriteMinutes, RESOLVE_DESCRIPTION } from './held.js'
|
|
42
|
+
import { HELD_MAP, readHeld, findHeld, settleHeld, renderHeld, renderOwnHeld, ownHeld, describeHeld, versionsOf, versionBy, RESOLVE_DESCRIPTION } from './held.js'
|
|
48
43
|
import { applyMine, LiveRules } from './live-merge.js'
|
|
49
44
|
import { readBasesOf } from './read-bases.js'
|
|
50
45
|
import { TRANSCRIPT_DESCRIPTION, JOIN_DESCRIPTION, SAY_DESCRIPTION, MAX_LINE, renderLines, readLines, inVoice, transcribeSetting, voiceStatusLines, callAgents, liveCallOf, setAgentLeft, notInCall, agentSays, agentsJoinCalls } from './voice.js'
|
|
@@ -87,7 +82,7 @@ export const HOSTED_INSTRUCTIONS =
|
|
|
87
82
|
'around, quilt_write_file to change a file (read it right before, and give the version quilt_read_file ends with as base), quilt_share to ' +
|
|
88
83
|
'tell everyone what you are doing, and quilt_message to talk. The shared task board is quilt_tasks, quilt_add_task, quilt_assign_task and quilt_move_task; quilt_task reads one in full with its comments, and quilt_comment_task leaves a work note or handoff on it. ' +
|
|
89
84
|
'quilt_history tells you who changed which file, when, with the diff: read it for the files you are about to touch. ' +
|
|
90
|
-
'Nobody holds files: no write is refused because someone else is working on a file. Your write merges with what others changed elsewhere in it; if it clashes with someone\'s on the same lines
|
|
85
|
+
'Nobody holds files: no write is refused because someone else is working on a file. Your write merges with what others changed elsewhere in it; if it clashes with someone\'s on the same lines, Quilt holds your lines and tells you: resolve it at once with quilt_resolve_merge. A conflict must not sit: until you resolve your own, moving a task to QA or Done is refused, and a conflict whose writer\'s AI is gone is handed to another AI in the session, which is woken for it. ' +
|
|
91
86
|
'Read what people said about a file before you change it: quilt_read_messages, and each write tells you what was said about that file. ' +
|
|
92
87
|
'This rule is enforced for agents: while someone who messaged or mentioned you waits for an answer, writes and task changes are refused until you answer with quilt_message. ' +
|
|
93
88
|
PERSON_CHAT + ' ' +
|
|
@@ -98,7 +93,7 @@ export const HOSTED_INSTRUCTIONS =
|
|
|
98
93
|
'You can be in several sessions at once (quilt_join_session each): every tool then takes session: <id> (quilt_session_info lists them; a webhook event or inbox entry says which session it is from), and a call that names none is refused, so an answer never lands in the wrong session. ' +
|
|
99
94
|
'You are connected over HTTP, so you show as online for 30 minutes after each tool call; while idle, people reach you in the way you chose with quilt_wake. ' +
|
|
100
95
|
'HTTP is only for an agent with no computer. If you can run shell commands anywhere (a computer, a cloud machine, a sandbox), you must use the Quilt CLI there instead (`quilt agent join`, then `quilt join <invite> --agent <your name>`): files sync to disk and you show as live. ' +
|
|
101
|
-
'A session has a branch for each branch its members work on, each with its own files: your first call on files puts you on the busiest one.
|
|
96
|
+
'A session has a branch for each branch its members work on, each with its own files: your first call on files puts you on the busiest one. ' +
|
|
102
97
|
MAIL_GUIDE + ' ' +
|
|
103
98
|
APPS_GUIDE + ' ' +
|
|
104
99
|
TASK_WORKFLOW
|
|
@@ -128,18 +123,6 @@ function takeStock (doc, me) {
|
|
|
128
123
|
const linkInboxes = new WeakMap()
|
|
129
124
|
const text = (t) => ({ content: [{ type: 'text', text: t }] })
|
|
130
125
|
const fail = (t) => ({ content: [{ type: 'text', text: t }], isError: true })
|
|
131
|
-
// A session that is a quilt, by its quilt's name (its slug; its id before the relay knows one), or null.
|
|
132
|
-
const quiltName = (room) => { const q = quiltOf(room.meta); return q ? ((room.meta.quilt && room.meta.quilt.slug) || q) : null }
|
|
133
|
-
// quilt_status in a session that is a quilt starts with how work goes there (session-seam.js).
|
|
134
|
-
// Any other answer, the first in a session that is a quilt for this agent: its instructions may be from before the move.
|
|
135
|
-
const withSeamLead = (r, quilt) => {
|
|
136
|
-
if (r && typeof r.then === 'function') return r.then((x) => withSeamLead(x, quilt))
|
|
137
|
-
return r && Array.isArray(r.content) ? { ...r, content: [{ type: 'text', text: `🧵 ${seamNote(quilt, { hosted: true })} This is how work lands here, whatever your instructions said before.` }, ...r.content] } : r
|
|
138
|
-
}
|
|
139
|
-
const withSeamNote = (r, quilt) => {
|
|
140
|
-
if (r && typeof r.then === 'function') return r.then((x) => withSeamNote(x, quilt))
|
|
141
|
-
return r && Array.isArray(r.content) ? { ...r, content: [{ type: 'text', text: seamNote(quilt, { hosted: true }) }, ...r.content.map((c) => c && c.type === 'text' ? { ...c, text: seamStatus(c.text) } : c)] } : r
|
|
142
|
-
}
|
|
143
126
|
|
|
144
127
|
function ago (ts) {
|
|
145
128
|
const s = Math.max(0, Math.round((Date.now() - ts) / 1000))
|
|
@@ -170,8 +153,7 @@ function sessionTools (server, ctx) {
|
|
|
170
153
|
// The branch document the agent works on (its store entry), or null for a room without branch documents.
|
|
171
154
|
// The session's default branch may always start; any other new branch only for someone who may change files.
|
|
172
155
|
const branchEntry = (room) => {
|
|
173
|
-
|
|
174
|
-
if (!room.branchDoc || room.meta.layout === LAYOUT_QUILT) return null
|
|
156
|
+
if (!room.branchDoc) return null
|
|
175
157
|
const key = branchOf(room)
|
|
176
158
|
const editor = room.resolveKey(key) === room.defaultKey || ctx.access(room)?.role !== 'viewer'
|
|
177
159
|
return room.branchDoc(key, { by: me, editor })
|
|
@@ -184,30 +166,35 @@ function sessionTools (server, ctx) {
|
|
|
184
166
|
return { ...r, content: [{ type: 'text', text: n }, ...r.content] }
|
|
185
167
|
}
|
|
186
168
|
// The live-write engine (live-merge.js) for one hosted write or sync: held conflicts go to the room's
|
|
187
|
-
// document,
|
|
169
|
+
// document, and what the writer must hear lands in `notices`.
|
|
188
170
|
// `folder`: the writer has a folder that gets the result (quilt sync's); a hosted write has none.
|
|
189
171
|
const liveRules = (room, files, notices = [], { folder = true } = {}) => new LiveRules({
|
|
190
172
|
room: () => room.doc,
|
|
191
|
-
staleMinutes: () => staleWriteMinutes(room.doc, room.memberList ? room.memberList() : []),
|
|
192
173
|
notice: (t) => notices.push(t),
|
|
193
174
|
texts: function * () { for (const [p, t] of files) if (t && isSafeRelPath(p)) yield [p, t.toString()] },
|
|
194
175
|
origin: AGENT,
|
|
195
176
|
folder
|
|
196
177
|
})
|
|
178
|
+
// Who last changed `rel` on `branch`, as a folder's live write names them (relay-live-write.js): the newer of the
|
|
179
|
+
// last live write there (room.liveWriters) and the room's activity. The activity alone misses a folder's change:
|
|
180
|
+
// its entry arrives a moment after its write, and its edits to one file within 20 seconds make one entry.
|
|
181
|
+
const lastWriter = (room, activity, branch, rel) => {
|
|
182
|
+
const list = activity.toArray()
|
|
183
|
+
let e = null
|
|
184
|
+
for (let i = list.length - 1; i >= 0 && !e; i--) { const x = list[i]; if (x && x.path === rel && (!branch || !x.branch || x.branch === branch.key)) e = x }
|
|
185
|
+
const w = branch && room.liveWriters ? room.liveWriters.get(`${branch.key}\0${rel}`) : null
|
|
186
|
+
const last = w && e ? ((e.ts || 0) > (w.ts || 0) ? e : w) : (w || e)
|
|
187
|
+
return (last && last.by) || null
|
|
188
|
+
}
|
|
197
189
|
// Who this agent is, for what it last read of each file (read-bases.js).
|
|
198
190
|
const readerId = (room) => (ctx.who(room) && ctx.who(room).id) || me
|
|
199
191
|
const tool = (name, def, fn) => server.registerTool(name, ctx.multi ? { ...def, inputSchema: { ...(def.inputSchema || {}), session: SESSION_ARG } } : def, async (given) => {
|
|
200
192
|
// Hosted agents are in several sessions at once: `session` says which this call is about.
|
|
201
193
|
const { session, ...args } = given || {}
|
|
202
194
|
return stale(await ctx.withSession((room) => {
|
|
203
|
-
// A session that is a quilt has no GitHub path for agents: each GitHub tool names its Seam tool.
|
|
204
|
-
// At layout 3 its files are in squares, not branches: the file tools name Seam's (quilt_history reads Seam's log, quilt_project_rules main's rules).
|
|
205
|
-
const quilt = quiltName(room)
|
|
206
|
-
const refused = seamRefusal(name, quilt, { hosted: true }) || (quilt && room.meta.layout === LAYOUT_QUILT && FILE_TOOLS.has(name) && name !== 'quilt_history' && name !== 'quilt_project_rules' ? seamFileRefusal(quilt) : null)
|
|
207
|
-
if (refused) return fail(refused)
|
|
208
195
|
// A hosted agent with no branch of its own is pinned to the active branch by its first call
|
|
209
196
|
// on files, so a read and the write after it never land on two different branches.
|
|
210
|
-
if (ctx.pin && FILE_TOOLS.has(name)
|
|
197
|
+
if (ctx.pin && FILE_TOOLS.has(name)) ctx.pin(room)
|
|
211
198
|
// The audit trail: which tool, on what (a path, a pattern or a task id; never contents).
|
|
212
199
|
const caller = ctx.who(room)
|
|
213
200
|
// An agent at work: its held conflicts stay its own while it is (server.js handHeld).
|
|
@@ -226,11 +213,9 @@ function sessionTools (server, ctx) {
|
|
|
226
213
|
room.auditAs = caller && caller.id
|
|
227
214
|
try {
|
|
228
215
|
const r = fn(args || {}, parts)
|
|
229
|
-
// The first answer in a session that is a quilt says how work lands there (quilt_status always does).
|
|
230
|
-
const once = quilt && ctx.seamOnce ? ctx.seamOnce(room) : false
|
|
231
216
|
// quilt_sync answers JSON for `quilt sync` to read: the open conflicts go inside it (`open`), not before it.
|
|
232
217
|
if (name === 'quilt_sync') return r
|
|
233
|
-
return heldNote(room,
|
|
218
|
+
return heldNote(room, r)
|
|
234
219
|
} finally { room.auditAs = prev }
|
|
235
220
|
}, session))
|
|
236
221
|
})
|
|
@@ -307,15 +292,7 @@ function sessionTools (server, ctx) {
|
|
|
307
292
|
}, async ({ path: p, by, since, task, with_diff, limit }, { room }) => {
|
|
308
293
|
const from = parseSince(since)
|
|
309
294
|
if (from === undefined) return fail('since: use a duration like 2h or 3d, "today", "yesterday", or a date.')
|
|
310
|
-
const
|
|
311
|
-
const own = legacyTail(historyOf(room).entries(), { at: q && q.at, history: !!(q && q.history) })
|
|
312
|
-
// Linked to a quilt (16: the session became one, or shadows one in step 1): Seam's log plus this record.
|
|
313
|
-
const link = room.quiltHistoryLink ? room.quiltHistoryLink() : null
|
|
314
|
-
if (link) {
|
|
315
|
-
const r = await linkedHistory({ seam: link.seam, quilt: link.quilt, entries: own, query: { path: p ? cleanPath(p) : '', by, since: from ?? undefined, task, limit: limit || 30, withDiff: !!with_diff } })
|
|
316
|
-
return text(`${formatHistory(r.list, { withDiff: !!with_diff })}${r.note ? `\n\n${r.note}` : ''}`)
|
|
317
|
-
}
|
|
318
|
-
const list = queryHistory(own, { path: p ? cleanPath(p) : '', by, since: from ?? undefined, task, limit: limit || 30 })
|
|
295
|
+
const list = queryHistory(historyOf(room).entries(), { path: p ? cleanPath(p) : '', by, since: from ?? undefined, task, limit: limit || 30 })
|
|
319
296
|
return text(formatHistory(list, { withDiff: !!with_diff }))
|
|
320
297
|
})
|
|
321
298
|
|
|
@@ -357,18 +334,6 @@ function sessionTools (server, ctx) {
|
|
|
357
334
|
return text(lines.join('\n') + ctx.warn(room))
|
|
358
335
|
})
|
|
359
336
|
|
|
360
|
-
// Seam (Seam's plans/quilt-source-control/16), behind QUILT_SOURCE_URL: what making this session a
|
|
361
|
-
// quilt would do. Only the dry run: the move itself is the owner's, from the app.
|
|
362
|
-
if (process.env.QUILT_SOURCE_URL) {
|
|
363
|
-
tool('quilt_migrate_session', {
|
|
364
|
-
description: MIGRATE_SESSION_DESCRIPTION,
|
|
365
|
-
inputSchema: { dry_run: z.literal(true).optional().describe('Always true: report what would happen, change nothing.') }
|
|
366
|
-
}, (_, { room }) => {
|
|
367
|
-
if (!room.quiltPlan) return fail('This session cannot become a quilt here.')
|
|
368
|
-
try { return text(describeQuiltPlan(room.quiltPlan(ctx.access(room)))) } catch (e) { return fail(e.message) }
|
|
369
|
-
})
|
|
370
|
-
}
|
|
371
|
-
|
|
372
337
|
const taskMap = (doc) => doc.getMap('tasks')
|
|
373
338
|
|
|
374
339
|
const reader = () => ({ name: me, tool: ctx.tool(), asAi: false, agent: true })
|
|
@@ -406,13 +371,13 @@ function sessionTools (server, ctx) {
|
|
|
406
371
|
const a = ctx.access(room)
|
|
407
372
|
if (a && a.role === 'viewer') return fail('You can only view this session; resolving a conflict is refused.')
|
|
408
373
|
// "mine": this agent's own held version, else the one asked first; "edited" with a held version of its
|
|
409
|
-
// own: that write is what it wrote, so it goes in
|
|
374
|
+
// own: that write is what it wrote, so it goes in.
|
|
410
375
|
const own = versionBy(rec, me, readerId(room))
|
|
411
376
|
const here = !!branch && !!rec.where.branch && room.resolveKey(rec.where.branch) === room.resolveKey(branch.key)
|
|
412
377
|
const v = how === 'mine' ? (own || versionsOf(rec)[0]) : how === 'edited' && here && own && typeof own.mine === 'string' ? own : null
|
|
413
378
|
if (v) {
|
|
414
|
-
// On the relay, only in the branch document this agent works on
|
|
415
|
-
if (!here) return fail(`${rec.path} was held on ${rec.where.
|
|
379
|
+
// On the relay, only in the branch document this agent works on.
|
|
380
|
+
if (!here) return fail(`${rec.path} was held on ${rec.where.branch ? `branch ${rec.where.branch}` : 'another branch'}, not where you work: write the file yourself (quilt_write_file) and resolve it "edited", or ask ${rec.by} to resolve it "mine".`)
|
|
416
381
|
const refusal = a && changeRefusal(a, rec.path)
|
|
417
382
|
if (refusal) return fail(`${refusal[0].toUpperCase()}${refusal.slice(1)}.`)
|
|
418
383
|
if (typeof v.mine !== 'string') return fail(`${rec.path}'s held lines are only on ${v.by}'s computer: write the file yourself and resolve it "edited", or ask ${v.by}.`)
|
|
@@ -462,8 +427,6 @@ function sessionTools (server, ctx) {
|
|
|
462
427
|
: pickChecklist(files.get('AGENTS.md')?.toString(), files.get('CLAUDE.md')?.toString())
|
|
463
428
|
/** The project's rules (project-rules.js) on the agent's branch, a diff branch's from git where the session left them. */
|
|
464
429
|
const rulesFor = async (room, branch, files) => {
|
|
465
|
-
// In squares (layout 3): main's rules on Seam, read with the room's read token (the branch documents are as they were at the move).
|
|
466
|
-
if (room.meta.layout === LAYOUT_QUILT && quiltOf(room.meta)) return rulesOnSeam(room)
|
|
467
430
|
if (!branch || !isDiff(branch)) return projectRules({ list: [...files.keys()], read: (p) => files.get(p)?.toString() ?? null })
|
|
468
431
|
const list = [...(await listPaths(room, branch.key, branch)).keys()]
|
|
469
432
|
const got = new Map()
|
|
@@ -476,20 +439,6 @@ function sessionTools (server, ctx) {
|
|
|
476
439
|
}
|
|
477
440
|
return projectRules({ list, read: (p) => got.get(p) ?? null })
|
|
478
441
|
}
|
|
479
|
-
const rulesOnSeam = async (room) => {
|
|
480
|
-
const seam = room.quiltReadClient ? room.quiltReadClient() : null
|
|
481
|
-
if (!seam) throw new Error(`The session has no read token for ${quiltName(room)}, so its rules can't be read here: its owner links it to Seam again. Meanwhile read AGENTS.md with seam_cat.`)
|
|
482
|
-
const q = room.meta.quilt_id
|
|
483
|
-
const list = ((await seam.tree(q, 'main')).entries || []).filter((e) => e && e.path && e.mode !== 'dir').map((e) => e.path)
|
|
484
|
-
const got = new Map()
|
|
485
|
-
for (let round = 0; round < 4; round++) {
|
|
486
|
-
const asked = new Set()
|
|
487
|
-
const r = projectRules({ list, read: (p) => { if (got.has(p)) return got.get(p); asked.add(p); return null } })
|
|
488
|
-
if (!asked.size) return r
|
|
489
|
-
for (const p of asked) got.set(p, await seam.cat(q, 'main', p).then((x) => Buffer.from(x.content || '', 'base64').toString('utf8'), () => null))
|
|
490
|
-
}
|
|
491
|
-
return projectRules({ list, read: (p) => got.get(p) ?? null })
|
|
492
|
-
}
|
|
493
442
|
tool('quilt_move_task', {
|
|
494
443
|
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). ' +
|
|
495
444
|
'"qa" when you finish implementing and testing: requires `qaNotes` (what changed and how you self-validated); without it the move is refused. ' +
|
|
@@ -519,7 +468,6 @@ function sessionTools (server, ctx) {
|
|
|
519
468
|
const tf = task.files || []
|
|
520
469
|
const all = historyOf(room).entries()
|
|
521
470
|
const history = (tf.length ? all.filter((e) => tf.includes(e.path)) : all).slice(-8)
|
|
522
|
-
if (quiltOf(room.meta)) return text(pickupBrief({ task: { ...task, comments: readComments(doc.getMap('taskComments'), task.id) }, history, checklist: await checklistOf(files, room, null), me, workflow: seamWorkflow(TASK_WORKFLOW, { hosted: true }) }))
|
|
523
471
|
return text(pickupBrief({ task: { ...task, comments: readComments(doc.getMap('taskComments'), task.id) }, history, checklist: await checklistOf(files, room, branchEntry(room)), me }))
|
|
524
472
|
}
|
|
525
473
|
if (column === 'qa') return text(`Moved "${task.title}" to QA. Notes: ${qaNotesLine(task)}`)
|
|
@@ -858,7 +806,7 @@ function sessionTools (server, ctx) {
|
|
|
858
806
|
tool('quilt_write_file', {
|
|
859
807
|
description: 'Write a text file in the shared project (new or existing): everyone gets it on their disk within moments. ' +
|
|
860
808
|
'Give the whole file and, as base, the version quilt_read_file gave you: your write is merged against what you read, so changes others made since, anywhere in the file, survive. ' +
|
|
861
|
-
'Without base it is merged against the version you last read; a version Quilt no longer has is merged
|
|
809
|
+
'Without base it is merged against the version you last read; a version Quilt no longer has is merged against the oldest one it has. Where someone changed the same lines first, the file keeps theirs and your lines are held for you to resolve (quilt_resolve_merge).',
|
|
862
810
|
inputSchema: {
|
|
863
811
|
path: z.string().min(1).max(500).describe('Relative path, e.g. src/app.ts'),
|
|
864
812
|
content: z.string().max(MAX_WRITE_BYTES).describe('The whole new contents of the file'),
|
|
@@ -902,16 +850,13 @@ function sessionTools (server, ctx) {
|
|
|
902
850
|
const cur = files.has(rel) ? files.get(rel).toString() : fromGit
|
|
903
851
|
const known = moved ? { text: moved.text, from: 'given' } : bases.base(readerId(room), branchKey, rel, { version, current: cur })
|
|
904
852
|
const where = branch ? { branch: branch.key } : {}
|
|
905
|
-
const lastBy =
|
|
853
|
+
const lastBy = lastWriter(room, activity, branch, rel)
|
|
906
854
|
let next = content
|
|
907
855
|
let merged = null
|
|
908
|
-
// A base not known for sure (a version no longer kept, or nothing read): merged as a stale write, so the
|
|
909
|
-
// lines anyone added lately stay, this agent's own included (another of its loops may have added them).
|
|
910
|
-
const strict = known.from === 'unknown' || known.from === 'none'
|
|
911
856
|
if (typeof cur === 'string') {
|
|
912
|
-
merged = rules.write({ doc: fdoc, where, path: rel, base: typeof known.text === 'string' ? known.text : cur, ours: content, theirs: cur, by: me, byId: readerId(room), others: lastBy && lastBy !== me ? [lastBy] : []
|
|
857
|
+
merged = rules.write({ doc: fdoc, where, path: rel, base: typeof known.text === 'string' ? known.text : cur, ours: content, theirs: cur, by: me, byId: readerId(room), others: lastBy && lastBy !== me ? [lastBy] : [] })
|
|
913
858
|
next = merged.text
|
|
914
|
-
} else rules.write({ doc: fdoc, where, path: rel, ours: content, by: me }) // a new file:
|
|
859
|
+
} else rules.write({ doc: fdoc, where, path: rel, ours: content, by: me }) // a new file: nothing to merge
|
|
915
860
|
let detail = ''
|
|
916
861
|
let existed = false
|
|
917
862
|
fdoc.transact(() => doc.transact(() => {
|
|
@@ -939,7 +884,7 @@ function sessionTools (server, ctx) {
|
|
|
939
884
|
const context = renderChatAbout(said)
|
|
940
885
|
const notes = []
|
|
941
886
|
if (moved) notes.push(`${moved.by} moved ${cleanPath(p)} to ${rel}: your edit went into ${rel}. Edit ${rel} from now on.`)
|
|
942
|
-
if (known.from === 'unknown') notes.push(`Quilt no longer has the version ${version ? `you gave as base (${String(version).slice(0, 12)})` : 'you last read'}, so your write was merged against ${typeof known.text === 'string' && known.text !== cur ? 'the oldest version it still has' : 'the file as it is'}
|
|
887
|
+
if (known.from === 'unknown') notes.push(`Quilt no longer has the version ${version ? `you gave as base (${String(version).slice(0, 12)})` : 'you last read'}, so your write was merged against ${typeof known.text === 'string' && known.text !== cur ? 'the oldest version it still has' : 'the file as it is'}. Read the file again before your next write, and give its version as base.`)
|
|
943
888
|
if (next !== content && !(merged && merged.held.length)) notes.push(`Others had changed ${rel} since you read it: their changes are kept alongside yours, so the file is not exactly what you wrote. Read it again before your next write.`)
|
|
944
889
|
notes.push(...notices)
|
|
945
890
|
return text(`${existed ? 'Updated' : 'Created'} ${rel}${onBranchNote(room, branch)}${detail ? ` (${detail} lines)` : ' (no change)'}. Everyone in the session has it now.${opened ? ` It was in ${opened.by}'s box: the box opened, and your change went in with their work.` : ''} (Version ${version2}: your next write's base.)${notes.length ? `\n\n${notes.join('\n\n')}` : ''}${context ? `\n\n${context}` : ''}`)
|
|
@@ -1019,7 +964,7 @@ function sessionTools (server, ctx) {
|
|
|
1019
964
|
if (activity.length > ACTIVITY_CAP) activity.delete(0, activity.length - ACTIVITY_CAP)
|
|
1020
965
|
historyOf(room).record({ by: me, path: rel, kind, before, after, detail, task: currentTask(readTasks(taskMap(doc)), me) })
|
|
1021
966
|
},
|
|
1022
|
-
lastEditor: (rel) =>
|
|
967
|
+
lastEditor: (rel) => lastWriter(room, activity, branch, rel),
|
|
1023
968
|
// Others' boxes: their unfinished work stays out of this folder until this folder changes the file (relay-turn-sync.js).
|
|
1024
969
|
ghosts: new Set(boxesOf(room).filter((c) => c.by !== me).map((c) => c.pattern)),
|
|
1025
970
|
openBox: (rel) => { try { room.boxRequest({ ...who(room), talk: a?.talk !== false }, { op: 'unbox', pattern: rel, edit: true }); room.broadcastBoxes() } catch {} },
|
|
@@ -1144,13 +1089,6 @@ export function hostedWorkspaceAccess ({ apiUrl, pass, fetch: fetchImpl = global
|
|
|
1144
1089
|
return { call, fetchBytes: bytesFetcher(fetchImpl, { timeoutMs: WORKSPACE_TRANSFER_TIMEOUT_MS }), put, saveDir: null, readLocal: null }
|
|
1145
1090
|
}
|
|
1146
1091
|
|
|
1147
|
-
/** A request's JSON body, read here (the transport takes it parsed). */
|
|
1148
|
-
async function readJsonBody (req) {
|
|
1149
|
-
const chunks = []
|
|
1150
|
-
for await (const c of req) chunks.push(c)
|
|
1151
|
-
return JSON.parse(Buffer.concat(chunks).toString('utf8'))
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
1092
|
async function serve (mcp, req, res, body) {
|
|
1155
1093
|
const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined, enableJsonResponse: true })
|
|
1156
1094
|
res.on('close', () => { transport.close().catch(() => {}); mcp.close().catch(() => {}) })
|
|
@@ -1170,27 +1108,8 @@ export async function handleHostedMcp ({ req, res, pass, relay, workspaces = nul
|
|
|
1170
1108
|
const me = pass.name
|
|
1171
1109
|
const account = `${pass.kind}:${pass.sub}`
|
|
1172
1110
|
const touched = new Set()
|
|
1173
|
-
// Whether the agent's sessions on this machine are quilts (some, all): an agent whose sessions all
|
|
1174
|
-
// are reads only Seam's way, with no git in its instructions or tool list (session-seam.js).
|
|
1175
|
-
const quilts = (() => {
|
|
1176
|
-
let any = false; let all = true; let seen = 0
|
|
1177
|
-
for (const name of hostedRooms(relay.hosted.get(account))) {
|
|
1178
|
-
if (relay.roomEnded(name)) continue
|
|
1179
|
-
const room = relay.getRoom(name)
|
|
1180
|
-
if (!room || !room.exists) continue
|
|
1181
|
-
touched.add(room)
|
|
1182
|
-
seen++
|
|
1183
|
-
if (quiltOf(room.meta)) any = true; else all = false
|
|
1184
|
-
}
|
|
1185
|
-
return { any, all: any && all && seen > 0 }
|
|
1186
|
-
})()
|
|
1187
1111
|
// The library's guide is part of the instructions only when its tools are offered.
|
|
1188
|
-
const
|
|
1189
|
-
const mcp = new McpServer({ name: 'quilt', version: '0.2.0' }, { instructions: (workspaces ? `${base}\n\n${WORKSPACE_GUIDE_HOSTED}` : base) })
|
|
1190
|
-
// Every tool it registers, so the git-era ones can be left out for an agent whose sessions are all quilts.
|
|
1191
|
-
const registered = new Map()
|
|
1192
|
-
const register = mcp.registerTool.bind(mcp)
|
|
1193
|
-
mcp.registerTool = (name, spec, handler) => { const t = register(name, spec, handler); registered.set(name, t); return t }
|
|
1112
|
+
const mcp = new McpServer({ name: 'quilt', version: '0.2.0' }, { instructions: (workspaces ? `${HOSTED_INSTRUCTIONS}\n\n${WORKSPACE_GUIDE_HOSTED}` : HOSTED_INSTRUCTIONS) })
|
|
1194
1113
|
const done = () => { for (const room of touched) if (room && !room.conns.size && room.onEmpty) room.onEmpty() }
|
|
1195
1114
|
res.on('close', done)
|
|
1196
1115
|
// Which sessions the agent is in, for the accounts API (x-quilt-rooms), and which one this
|
|
@@ -1288,8 +1207,6 @@ export async function handleHostedMcp ({ req, res, pass, relay, workspaces = nul
|
|
|
1288
1207
|
multi: true, // every tool takes `session`
|
|
1289
1208
|
who: () => ({ name: me, id: account }),
|
|
1290
1209
|
kind: pass.kind === 'agent' ? 'agent' : 'human',
|
|
1291
|
-
// This agent to Seam (its pass, traded for an agent token), for what it does there as itself.
|
|
1292
|
-
seam: () => process.env.QUILT_SOURCE_URL && pass.kind === 'agent' && req.headers['x-quilt-pass'] ? hostedSeam(account, String(req.headers['x-quilt-pass'])) : null,
|
|
1293
1210
|
access: (room) => room.hostedAccess(pass),
|
|
1294
1211
|
branch: (room) => room.hostedBranch(account),
|
|
1295
1212
|
setBranch: (room, key, opts) => room.setHostedBranch(account, key, opts),
|
|
@@ -1330,14 +1247,6 @@ export async function handleHostedMcp ({ req, res, pass, relay, workspaces = nul
|
|
|
1330
1247
|
} : null,
|
|
1331
1248
|
updates: relay.updates || null,
|
|
1332
1249
|
image: () => image,
|
|
1333
|
-
// Whether this agent is yet to be told the Seam way in `room` (once per quilt, kept with its record there).
|
|
1334
|
-
seamOnce: (room) => {
|
|
1335
|
-
const r = hostedIn(relay.hosted.get(account), room.name)
|
|
1336
|
-
if (!r || !room.meta.quilt_id || r.seamTold === room.meta.quilt_id) return false
|
|
1337
|
-
r.seamTold = room.meta.quilt_id
|
|
1338
|
-
relay.saveHosted()
|
|
1339
|
-
return true
|
|
1340
|
-
},
|
|
1341
1250
|
withSession: (fn, session) => {
|
|
1342
1251
|
const c = current(session)
|
|
1343
1252
|
return c.error ? fail(c.error) : fn(c.room)
|
|
@@ -1487,54 +1396,11 @@ export async function handleHostedMcp ({ req, res, pass, relay, workspaces = nul
|
|
|
1487
1396
|
}
|
|
1488
1397
|
|
|
1489
1398
|
sessionTools(mcp, ctx)
|
|
1490
|
-
// Seam's tools for an agent in a session that is a quilt (session-seam.js), as itself: its
|
|
1491
|
-
// pass, traded once for an agent token of its own (seam-access.js). Only while one of its
|
|
1492
|
-
// sessions here is a quilt, so every other agent's tool list stays as it was.
|
|
1493
|
-
const rawPass = String(req.headers['x-quilt-pass'] || '')
|
|
1494
|
-
// Hidden from the list, but a call still answers with the Seam way: an agent's client keeps the
|
|
1495
|
-
// list it read before its session moved into Seam, and a hidden tool would answer only "disabled".
|
|
1496
|
-
if (quilts.all) {
|
|
1497
|
-
if (body === undefined && req.method === 'POST') {
|
|
1498
|
-
try { body = await readJsonBody(req) } catch { res.writeHead(400, { 'content-type': 'application/json' }); res.end(JSON.stringify({ jsonrpc: '2.0', error: { code: -32700, message: 'Parse error' }, id: null })); return }
|
|
1499
|
-
}
|
|
1500
|
-
const calls = [].concat(body || []).some((m) => m && m.method === 'tools/call')
|
|
1501
|
-
if (!calls) for (const [name, t] of registered) if (GIT_TOOLS.has(name)) t.disable()
|
|
1502
|
-
}
|
|
1503
|
-
if (process.env.QUILT_SOURCE_URL && pass.kind === 'agent' && rawPass && quilts.any) {
|
|
1504
|
-
const seam = hostedSeam(account, rawPass)
|
|
1505
|
-
for (const name of SEAM_SESSION_TOOLS) {
|
|
1506
|
-
const spec = seamToolSpec(name, { hosted: true })
|
|
1507
|
-
mcp.registerTool(name, { ...spec, inputSchema: spec.inputSchema.extend({ session: SESSION_ARG }) }, async ({ session, ...args } = {}) => {
|
|
1508
|
-
const c = current(session)
|
|
1509
|
-
if (c.error) return fail(c.error)
|
|
1510
|
-
const quilt = quiltOf(c.room.meta)
|
|
1511
|
-
if (!quilt) return fail('This session is not a quilt: its source control is git, as quilt_status says.')
|
|
1512
|
-
let client
|
|
1513
|
-
try { client = (await seam.client(quilt)).client } catch (e) { return fail(e.message) }
|
|
1514
|
-
// Open held conflicts (held.js) keep their paths from landing until they are resolved.
|
|
1515
|
-
return runSessionSeamTool(name, args, { client, quilt, hosted: true, held: () => readHeld(c.room.doc.getMap(HELD_MAP)) })
|
|
1516
|
-
})
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
1399
|
// The library works whether or not the agent is in a session (it never touches relay.hosted).
|
|
1520
1400
|
if (workspaces) registerWorkspaceTools(mcp, { ...hostedWorkspaceAccess(workspaces), webhook: false })
|
|
1521
1401
|
await serve(mcp, req, res, body)
|
|
1522
1402
|
}
|
|
1523
1403
|
|
|
1524
|
-
// Each hosted agent's way into Seam, kept between its requests (each is a new MCP server): the
|
|
1525
|
-
// agent token it traded its pass for lasts hours, while passes last minutes.
|
|
1526
|
-
const hostedSeams = new Map() // account -> { access, pass }
|
|
1527
|
-
function hostedSeam (account, pass) {
|
|
1528
|
-
let e = hostedSeams.get(account)
|
|
1529
|
-
if (!e) {
|
|
1530
|
-
e = { pass }
|
|
1531
|
-
e.access = seamAccess({ api: () => process.env.QUILT_SOURCE_URL, credential: async () => `QuiltPass ${e.pass}` })
|
|
1532
|
-
hostedSeams.set(account, e)
|
|
1533
|
-
}
|
|
1534
|
-
e.pass = pass
|
|
1535
|
-
return e.access
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
1404
|
/**
|
|
1539
1405
|
* Handles one MCP request (stateless: a fresh server per request) for the older
|
|
1540
1406
|
* link-based flow: a browser's token tied to a room by /agent/link.
|
package/src/relay-prune.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Branches leave a session by themselves, so it never fills up with forgotten work (each branch is
|
|
2
2
|
// a whole copy of the project in the relay's memory and disk): a branch nobody edited or was on for
|
|
3
3
|
// INACTIVE_MS leaves the session, whoever made it. Never the default branch or main, nor a branch
|
|
4
|
-
// someone is on, holds a file on, or a hosted agent chose (while it was worked on this week)
|
|
5
|
-
//
|
|
4
|
+
// someone is on, holds a file on, or a hosted agent chose (while it was worked on this week).
|
|
5
|
+
// An inactive branch is kept in the relay's archive (on disk, out of the
|
|
6
6
|
// session) for ARCHIVE_KEEP_MS before it goes. A branch comes back whenever someone checks it out.
|
|
7
7
|
import { RELAY_NAME as RELAY_BY } from './ui/chat.js'
|
|
8
8
|
|
|
@@ -39,11 +39,8 @@ export const lastActive = (b) => Math.max(Number(b && (b.used || b.seen)) || 0,
|
|
|
39
39
|
/** Branches nobody has worked on for INACTIVE_MS: not the default, not main or master, not in use. */
|
|
40
40
|
export function inactiveBranches (room, now = Date.now(), inactiveMs = INACTIVE_MS) {
|
|
41
41
|
const on = inUse(room, now)
|
|
42
|
-
// A quilt's squares' live documents (layout 3) stay: their squares decide when they go. Agents'
|
|
43
|
-
// own branches are named quilt/<agent>/… too, so only the keys the room lists are kept.
|
|
44
|
-
const live = new Set(Object.values(room.meta.quilt?.live || {}))
|
|
45
42
|
return Object.entries(room.meta.branches)
|
|
46
|
-
.filter(([k, b]) => k !== room.defaultKey && !TRUNKS.has(k) && !
|
|
43
|
+
.filter(([k, b]) => k !== room.defaultKey && !TRUNKS.has(k) && !on.has(k) && now - lastActive(b) >= inactiveMs)
|
|
47
44
|
.map(([k]) => k)
|
|
48
45
|
}
|
|
49
46
|
|
package/src/relay-turn-sync.js
CHANGED
|
@@ -9,13 +9,12 @@
|
|
|
9
9
|
// again against the session as it is now), pull (the session's version of some paths), done (the
|
|
10
10
|
// folder's manifest after writing; the checkpoint saved).
|
|
11
11
|
//
|
|
12
|
-
// A sync's push is a live write like any other (
|
|
13
|
-
//
|
|
14
|
-
// as every live path (live-merge.js LiveRules). Lines only one side changed all go in; where both
|
|
12
|
+
// A sync's push is a live write like any other (ruling 2026-11-13): merged against the version the
|
|
13
|
+
// folder last synced (its checkpoint) by the same engine as every live path (live-merge.js LiveRules). Lines only one side changed all go in; where both
|
|
15
14
|
// changed the same lines the session keeps what landed first and the folder's lines are held for its
|
|
16
15
|
// writer (or any AI) to resolve (held.js, quilt_resolve_merge): the agent hears in the sync's answer
|
|
17
|
-
// (`held`), and its copy is kept aside in the folder. The newer edit no longer wins. The
|
|
18
|
-
//
|
|
16
|
+
// (`held`), and its copy is kept aside in the folder. The newer edit no longer wins. The removed-name
|
|
17
|
+
// warning runs on it too. Nobody holds files (no-holds, 2026-11-13): a folder's
|
|
19
18
|
// change to someone else's boxed file opens the box (ctx.openBox) and is merged the same way. Versions
|
|
20
19
|
// an older relay held for someone ('claimed' records) go in at the agent's next sync (settleWaiting).
|
|
21
20
|
import fs from 'node:fs'
|
|
@@ -30,7 +29,6 @@ import { unionMatcher } from './merge3.js'
|
|
|
30
29
|
import { isRelay } from './ui/chat.js'
|
|
31
30
|
import { decide, planSync, nextCheckpoint, behind, sessionEntry, SKIP } from './turn-sync-plan.js'
|
|
32
31
|
import { LiveRules } from './live-merge.js'
|
|
33
|
-
import { staleWriteMinutes } from './held.js'
|
|
34
32
|
|
|
35
33
|
export const SLOT = /^[A-Za-z0-9_-]{8,64}$/
|
|
36
34
|
const HASH = /^[0-9a-f]{40}$/
|
|
@@ -151,7 +149,7 @@ function content (v) {
|
|
|
151
149
|
|
|
152
150
|
/**
|
|
153
151
|
* The live-write engine for this sync: ctx.rules, else one on the room (held conflicts in its
|
|
154
|
-
* document
|
|
152
|
+
* document). What the agent must hear comes back in the answer.
|
|
155
153
|
*/
|
|
156
154
|
function rulesOf (ctx) {
|
|
157
155
|
if (ctx.rules) return ctx.rules
|
|
@@ -159,7 +157,6 @@ function rulesOf (ctx) {
|
|
|
159
157
|
if (!doc) return null
|
|
160
158
|
ctx.rules = new LiveRules({
|
|
161
159
|
room: () => doc,
|
|
162
|
-
staleMinutes: () => staleWriteMinutes(doc, typeof ctx.room.memberList === 'function' ? ctx.room.memberList() : []),
|
|
163
160
|
texts: () => textsOf(ctx),
|
|
164
161
|
origin: ctx.origin
|
|
165
162
|
})
|
|
@@ -386,14 +383,13 @@ function logMerge (rel, ctx, { c, base, now, by, how, reason, id = null }) {
|
|
|
386
383
|
}
|
|
387
384
|
|
|
388
385
|
/**
|
|
389
|
-
* Only the folder changed rel since its checkpoint: its version goes in, as a live write
|
|
390
|
-
* stale-write rule still keeps lines someone else added minutes ago, held for this agent to confirm).
|
|
386
|
+
* Only the folder changed rel since its checkpoint: its version goes in, as a live write.
|
|
391
387
|
*/
|
|
392
388
|
function push (rel, c, now, base, ctx, out) {
|
|
393
389
|
const rules = typeof c.text === 'string' ? rulesOf(ctx) : null
|
|
394
390
|
if (!rules) { write(rel, c, ctx); out.pushed.push(rel); return }
|
|
395
391
|
const by = editorOf(rel, ctx)
|
|
396
|
-
// A new file: nothing to merge
|
|
392
|
+
// A new file: nothing to merge.
|
|
397
393
|
if (!now || typeof now.text !== 'string') {
|
|
398
394
|
if (!now) rules.write({ doc: ctx.fdoc, where: whereOf(ctx), path: rel, ours: c.text, by: ctx.me })
|
|
399
395
|
write(rel, c, ctx)
|
package/src/runner.js
CHANGED
|
@@ -103,7 +103,7 @@ export async function describeOtherSync (dir) {
|
|
|
103
103
|
* optionally overrides the relay address given out in invites (e.g. a public
|
|
104
104
|
* tunnel URL when the relay runs on this machine).
|
|
105
105
|
*/
|
|
106
|
-
export async function runSession ({ dir, conn, name, tool, color = null, shareByDefault = true, summarizeByDefault = false, joined = false, prefer = 'remote', inviteServer, onLog, onFatal, onDebug, kind = 'human', agentFeed = true, readerOptions = {}, passes = null, identity = null, startName = '', startAgentCommits = '',
|
|
106
|
+
export async function runSession ({ dir, conn, name, tool, color = null, shareByDefault = true, summarizeByDefault = false, joined = false, prefer = 'remote', inviteServer, onLog, onFatal, onDebug, kind = 'human', agentFeed = true, readerOptions = {}, passes = null, identity = null, startName = '', startAgentCommits = '', workspace = '', apiAuth = null }) {
|
|
107
107
|
dir = path.resolve(dir)
|
|
108
108
|
if (!/^wss?:\/\//.test(conn.server)) throw new Error('The relay address must start with ws:// or wss://')
|
|
109
109
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true })
|
|
@@ -142,7 +142,7 @@ export async function runSession ({ dir, conn, name, tool, color = null, shareBy
|
|
|
142
142
|
|
|
143
143
|
// An agent whose keys are kept in its project (quilt agent join --here) is in a sandbox that is cleaned up after every run: it works in turns.
|
|
144
144
|
const turns = kind === 'agent' && keptInProject(name)
|
|
145
|
-
const session = new Session({ dir, ...conn, name, tool, color, prefer, kind, shareAgent, identity, passes, startName, startAgentCommits,
|
|
145
|
+
const session = new Session({ dir, ...conn, name, tool, color, prefer, kind, shareAgent, identity, passes, startName, startAgentCommits, workspace: savedWorkspace, turns })
|
|
146
146
|
const summarizer = () => createSummarizer({ onWarn: (msg) => session.log(`✂️ ${msg}`) })
|
|
147
147
|
if (summarize) session.summarizer = summarizer()
|
|
148
148
|
session.taskTitler = createTaskTitler({ onWarn: (msg) => session.log(`📋 ${msg}`) })
|
|
@@ -177,8 +177,6 @@ export async function runSession ({ dir, conn, name, tool, color = null, shareBy
|
|
|
177
177
|
// listens before the session starts: what was written to their cloud AI while it was away arrives
|
|
178
178
|
// as the session syncs, before start() returns, and is its work.
|
|
179
179
|
autowork().attach(session)
|
|
180
|
-
// Whether this person connected a cloud AI, as the API last said (land.js asks it to settle conflicts in their square).
|
|
181
|
-
session.cloudAiKnown = () => { try { return !!autowork().cloudAi() } catch { return false } }
|
|
182
180
|
try {
|
|
183
181
|
await session.start({ waitTimeoutMs: 15000 })
|
|
184
182
|
} catch (err) {
|