heyquilt 0.3.181 → 0.3.183
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 +101 -97
- package/RELEASES.md +17 -0
- package/bin/quilt.js +32 -32
- package/desktop/main.js +1 -1
- package/package.json +1 -1
- package/src/account.js +2 -2
- package/src/admit-policy.js +2 -2
- package/src/agent-join.js +3 -3
- package/src/agent-task-workflow.js +14 -14
- package/src/ai-vm.js +1 -1
- package/src/api/agent-placement.js +2 -2
- package/src/api/audit.js +1 -1
- package/src/api/file-paths.js +1 -1
- package/src/api/file-store.js +1 -1
- package/src/api/invite-email.js +4 -4
- package/src/api/join-text.js +5 -5
- package/src/api/notify.js +7 -7
- package/src/api/permissions.js +1 -1
- package/src/api/routes/agent-wake.js +1 -1
- package/src/api/routes/agents.js +2 -2
- package/src/api/routes/ai-vm.js +5 -5
- package/src/api/routes/connections.js +13 -13
- package/src/api/routes/grants.js +2 -2
- package/src/api/routes/mail.js +10 -10
- package/src/api/routes/relay.js +1 -1
- package/src/api/routes/secrets.js +11 -11
- package/src/api/routes/session-invites.js +5 -5
- package/src/api/routes/sessions.js +3 -3
- package/src/api/routes/workspace-agents.js +14 -14
- package/src/api/routes/workspace-files.js +12 -12
- package/src/api/routes/workspace-invites.js +5 -5
- package/src/api/routes/workspaces.js +11 -11
- package/src/api/secrets-access.js +1 -1
- package/src/api/server.js +3 -3
- package/src/api/team-access.js +1 -1
- package/src/api/workspace-access.js +1 -1
- package/src/api/workspace-reach.js +3 -3
- package/src/app-tools.js +10 -10
- package/src/autowork.js +4 -4
- package/src/branch-view.js +1 -1
- package/src/catchup.js +5 -5
- package/src/chat-links.js +18 -18
- package/src/connection.js +11 -11
- package/src/control.js +5 -5
- package/src/conversation.js +1 -1
- package/src/doctor.js +2 -2
- package/src/duties.js +1 -1
- package/src/fsutil.js +1 -1
- package/src/gitstate.js +117 -1
- package/src/held.js +4 -4
- package/src/hooks.js +3 -3
- package/src/hosted-client.js +2 -2
- package/src/identity.js +1 -1
- package/src/inbox.js +1 -1
- package/src/key-cli.js +1 -1
- package/src/mail-tools.js +11 -11
- package/src/mcp-proxy.js +1 -1
- package/src/mcp.js +59 -59
- package/src/new-session.js +112 -0
- package/src/project-rules.js +2 -2
- package/src/relay-ask.js +2 -2
- package/src/relay-cluster.js +3 -3
- package/src/relay-live-write.js +3 -3
- package/src/relay-mcp.js +56 -56
- package/src/relay-prune.js +1 -1
- package/src/relay-turn-sync.js +1 -1
- package/src/repo-ref.js +54 -0
- package/src/secret-import.js +1 -1
- package/src/secret-names.js +6 -6
- package/src/secret-run.js +3 -3
- package/src/server.js +41 -41
- package/src/session-access.js +3 -3
- package/src/session-name.js +1 -1
- package/src/session.js +118 -52
- package/src/setup.js +7 -7
- package/src/status.js +2 -2
- package/src/tasks.js +1 -1
- package/src/turn-sync.js +4 -4
- package/src/ui/account-sessions.js +2 -2
- package/src/ui/agent-env-key.js +1 -1
- package/src/ui/agent-guide.js +35 -35
- package/src/ui/agent-kinds.js +8 -8
- package/src/ui/agent-place.js +16 -16
- package/src/ui/agents-table.js +6 -6
- package/src/ui/app.css +357 -0
- package/src/ui/app.js +29 -14
- package/src/ui/board.js +2 -2
- package/src/ui/catchup.js +5 -5
- package/src/ui/changes-seen.js +2 -2
- package/src/ui/changes.js +3 -3
- package/src/ui/cloud-ai.js +12 -12
- package/src/ui/common.js +1 -1
- package/src/ui/connections.js +1 -1
- package/src/ui/diffview.js +2 -2
- package/src/ui/feed.js +1 -1
- package/src/ui/feedback.js +4 -4
- package/src/ui/files.js +120 -14
- package/src/ui/fileview.js +3 -3
- package/src/ui/git-rule.js +3 -3
- package/src/ui/home.js +95 -67
- package/src/ui/index.html +1 -1
- package/src/ui/invite.js +8 -8
- package/src/ui/invites.js +3 -3
- package/src/ui/new-session.js +151 -0
- package/src/ui/prail-model.js +22 -0
- package/src/ui/prail.js +43 -0
- package/src/ui/project-board.js +359 -0
- package/src/ui/project-model.js +197 -0
- package/src/ui/project-pop.js +451 -0
- package/src/ui/projects.js +406 -0
- package/src/ui/sandbox-keys.js +3 -3
- package/src/ui/secrets-view.js +5 -5
- package/src/ui/session-words.js +2 -2
- package/src/ui/session.js +156 -43
- package/src/ui/tree.js +3 -3
- package/src/ui/voice.js +6 -6
- package/src/ui/workspaces.js +23 -23
- package/src/ui-server.js +104 -26
- package/src/update-check.js +2 -2
- package/src/voice.js +7 -7
- package/src/wake-tool.js +1 -1
- package/src/webhooks.js +1 -1
- package/src/workspace-cli.js +12 -12
- package/src/workspace-tools.js +33 -33
package/src/session.js
CHANGED
|
@@ -52,8 +52,9 @@ import { exchangeKind } from './exchange.js'
|
|
|
52
52
|
import { HELD_MAP, readHeld, findHeld, settleHeld, renderHeld, versionsOf, versionBy, ownHeld } from './held.js'
|
|
53
53
|
import { RELAY_NAME as RELAY_BY, isRelay } from './ui/chat.js'
|
|
54
54
|
import { cleanTyping, TYPING_MS, AGENT_TYPING_MS } from './ui/chat.js'
|
|
55
|
-
import { DEFAULT_KEY } from './branchdocs.js'
|
|
56
|
-
import { headKey, headName, branchTip, busy as gitBusy, leftoverLock, indexStamp, filesAt, blobAt, treeState, watchGit, SETTLE_MS as GIT_SETTLE_MS, STALE_LOCK_MS, upstreamOf, fetchUpstream, aheadBehind, changesBetween, fastForward, stage, hasBranch, switchBranch, defaultRemote, remoteBranch, follow } from './gitstate.js'
|
|
55
|
+
import { DEFAULT_KEY, validBranchKey } from './branchdocs.js'
|
|
56
|
+
import { headKey, headName, branchTip, busy as gitBusy, leftoverLock, indexStamp, filesAt, blobAt, treeState, watchGit, SETTLE_MS as GIT_SETTLE_MS, STALE_LOCK_MS, upstreamOf, fetchUpstream, aheadBehind, changesBetween, fastForward, stage, hasBranch, switchBranch, defaultRemote, remoteBranch, follow, adoptRepo, originUrl } from './gitstate.js'
|
|
57
|
+
import { shareableRemote, repoLabel } from './repo-ref.js'
|
|
57
58
|
import { cleanVoice, newCallId, voiceView, inVoice, transcribeSetting, setTranscribe, addLine, readLines, MAX_IN_CALL, CALL_FULL, callAgents, setAgentLeft, notInCall, agentSays, markCallForAgents, namedAgents, callPing, spokenReply, AGENT_REPLY_MS } from './voice.js'
|
|
58
59
|
import { toolInUse } from './agents/common.js'
|
|
59
60
|
|
|
@@ -153,7 +154,7 @@ const UPSTREAM_MS = Number(process.env.QUILT_UPSTREAM_MS) || 60 * 1000
|
|
|
153
154
|
const CATCHER_WAIT_MS = 2 * 60 * 1000
|
|
154
155
|
const CATCHER_WAITING = 'another member is bringing these commits in'
|
|
155
156
|
// On a branch that syncs live with GitHub, the relay brings GitHub's commits in and folders follow them (bringIn).
|
|
156
|
-
const RELAY_WAITING = 'the relay is bringing these commits into the
|
|
157
|
+
const RELAY_WAITING = 'the relay is bringing these commits into the codebase'
|
|
157
158
|
// How long a git pull's settle waits for the relay to be at the pulled commit before sharing it as before (planSettle).
|
|
158
159
|
const RELAY_PULL_WAIT_MS = 15 * 1000
|
|
159
160
|
const RELAY_ASK_EVERY_MS = 5 * 1000 // a folder waiting for the relay asks it again this often (server.js SYNC_EVERY_GIT_MS)
|
|
@@ -192,12 +193,13 @@ function writeAndStat (abs, data, mode = undefined) {
|
|
|
192
193
|
}
|
|
193
194
|
|
|
194
195
|
export class Session extends EventEmitter {
|
|
195
|
-
constructor ({ dir, server, room, secret, key = '', viewSecret = '', name, tool = 'unknown', color = null, prefer = 'remote', kind = 'human', shareAgent = true, summarize = null, identity = null, passes = null, startName = '', startAgentCommits = '', workspace = '', editQuietMs = EDIT_QUIET_MS, aiTasks = null, pushLocalCommits = null, webhookTransport = null, pullWaitMs = PULL_WAIT_MS, bringInUpstream = true, clashReassignMs = CLASH_REASSIGN_MS, clashWaitMs = CLASH_WAIT_MS, clashSettleMs = CLASH_SETTLE_MS, clashIdleMs = CLASH_IDLE_MS, catcherWaitMs = CATCHER_WAIT_MS, gitBacking = true, gitRemote = null, followsRelay = true, turns = false, features = null, cli = defaultCli() }) {
|
|
196
|
+
constructor ({ dir, server, room, secret, key = '', viewSecret = '', name, tool = 'unknown', color = null, prefer = 'remote', kind = 'human', shareAgent = true, summarize = null, identity = null, passes = null, startName = '', startAgentCommits = '', workspace = '', editQuietMs = EDIT_QUIET_MS, aiTasks = null, pushLocalCommits = null, webhookTransport = null, pullWaitMs = PULL_WAIT_MS, bringInUpstream = true, clashReassignMs = CLASH_REASSIGN_MS, clashWaitMs = CLASH_WAIT_MS, clashSettleMs = CLASH_SETTLE_MS, clashIdleMs = CLASH_IDLE_MS, catcherWaitMs = CATCHER_WAIT_MS, gitBacking = true, gitRemote = null, followsRelay = true, turns = false, features = null, localRepos = process.env.QUILT_LOCAL_REPOS === '1', cli = defaultCli() }) {
|
|
196
197
|
super()
|
|
197
198
|
// An agent that works in turns (agent-join.js keptInProject): the relay shows it away between them.
|
|
198
199
|
this.turns = turns
|
|
199
200
|
this.pullWaitMs = pullWaitMs
|
|
200
201
|
this.bringInUpstream = bringInUpstream // false: commits come in only when someone pulls (tests of the pull path)
|
|
202
|
+
this.localRepos = !!localRepos // a repository at a file:// address is shared with, and taken by, folders that join without git (the same computer, tests)
|
|
201
203
|
this.followsRelay = followsRelay // false: as an app older than 0.3.65, which brings GitHub's commits in itself on every branch (tests)
|
|
202
204
|
this.features = features // what the app says it can do (protocol.js FEATURES), else this version's: an older app's list in tests
|
|
203
205
|
this.catcherWaitMs = catcherWaitMs
|
|
@@ -514,7 +516,7 @@ export class Session extends EventEmitter {
|
|
|
514
516
|
const mine = this.branchList.find((b) => b.key === this.branch)
|
|
515
517
|
if (mine && mine.full && this.fullSaid !== mine.key) {
|
|
516
518
|
this.fullSaid = mine.key
|
|
517
|
-
const msg = `${mine.key} is over the
|
|
519
|
+
const msg = `${mine.key} is over the codebase's size limit for one branch, so the relay takes no new changes on it; they stay in this folder. Other branches, chat and tasks carry on as usual. To keep syncing, start a fresh copy with \`git checkout -b <new name>\`: your changes since are kept in this folder.`
|
|
518
520
|
this.log(`⚠️ ${msg}`)
|
|
519
521
|
this.notice(msg)
|
|
520
522
|
} else if (mine && !mine.full && this.fullSaid === mine.key) this.fullSaid = null
|
|
@@ -555,7 +557,7 @@ export class Session extends EventEmitter {
|
|
|
555
557
|
this.saveHeldBases([])
|
|
556
558
|
this.observeBranch()
|
|
557
559
|
this.awayBackups = []
|
|
558
|
-
const msg = `${this.branch} was removed from the
|
|
560
|
+
const msg = `${this.branch} was removed from the codebase (nobody was on it for 30 days) and has been started again since, so this folder joined it fresh: the codebase's files there are on disk, and your versions that differ are kept in .quilt/conflicts.`
|
|
559
561
|
// As at a first join: what differs is backed up once, by reconcileFirstJoin, not again as a live clash.
|
|
560
562
|
const ready = this.ready
|
|
561
563
|
this.ready = false
|
|
@@ -678,6 +680,7 @@ export class Session extends EventEmitter {
|
|
|
678
680
|
if (first === 'pending') {
|
|
679
681
|
// Finish joining in the background once let in.
|
|
680
682
|
this.admitted = sync.then(async () => {
|
|
683
|
+
await this.gitForJoin()
|
|
681
684
|
this.noteFirstJoin(this.reconcileFirstJoin(null))
|
|
682
685
|
this.goLive()
|
|
683
686
|
await this.startWatcher()
|
|
@@ -690,6 +693,7 @@ export class Session extends EventEmitter {
|
|
|
690
693
|
clearTimeout(timer)
|
|
691
694
|
this.conn.off('access', onAccess)
|
|
692
695
|
}
|
|
696
|
+
await this.gitForJoin()
|
|
693
697
|
this.noteFirstJoin(this.reconcileFirstJoin(null))
|
|
694
698
|
this.goLive()
|
|
695
699
|
}
|
|
@@ -722,13 +726,13 @@ export class Session extends EventEmitter {
|
|
|
722
726
|
this.access = a
|
|
723
727
|
if (a.state === 'approved' && a.owner) this.sendStartName()
|
|
724
728
|
if (a.state === 'approved' && this.webhook && !this.webhook.local) this.migrateWebhook().catch(() => {}) // the relay sends it from now on (or again, if it lost it)
|
|
725
|
-
if (a.state === 'pending' && (!was || was.state !== 'pending')) this.log(`⏳ waiting for the
|
|
729
|
+
if (a.state === 'pending' && (!was || was.state !== 'pending')) this.log(`⏳ waiting for the codebase's owner to let you in (you were invited to ${a.invitedAs === 'viewer' ? 'view' : 'edit'})`)
|
|
726
730
|
if (a.state === 'approved' && was && (was.role !== a.role || String(was.scopes) !== String(a.scopes) || String(was.scopesExcept || []) !== String(a.scopesExcept || []))) {
|
|
727
731
|
const except = a.role !== 'viewer' && a.scopesExcept && a.scopesExcept.length ? `, except ${a.scopesExcept.join(', ')}` : ''
|
|
728
|
-
this.log(`🔑 you can now ${a.role === 'viewer' ? 'only view this
|
|
732
|
+
this.log(`🔑 you can now ${a.role === 'viewer' ? 'only view this codebase' : a.scopes.length ? `change files in ${a.scopes.join(', ')}` : 'change any file'}${except}`)
|
|
729
733
|
}
|
|
730
734
|
if (a.state === 'approved' && (was ? was.talk !== false : true) && a.talk === false) this.log(`🔇 ${TALK_REFUSED}`)
|
|
731
|
-
if (a.state === 'approved' && was && was.talk === false && a.talk !== false) this.log('💬 you can post in this
|
|
735
|
+
if (a.state === 'approved' && was && was.talk === false && a.talk !== false) this.log('💬 you can post in this codebase again')
|
|
732
736
|
// Partners see you sharing your AI chat only while it can reach them.
|
|
733
737
|
if (a.state === 'approved' && (was?.talk === false) !== (a.talk === false)) this.publishAgentState()
|
|
734
738
|
if (a.refused) this.log(`🔒 the relay undid your change to ${a.refused.join(', ')}: ${a.why}`)
|
|
@@ -805,14 +809,14 @@ export class Session extends EventEmitter {
|
|
|
805
809
|
this.sendWorkspace()
|
|
806
810
|
if (!this.startName || this.startNameSent) return
|
|
807
811
|
this.startNameSent = true
|
|
808
|
-
this.rename(this.startName).catch((err) => this.log(`couldn't name the
|
|
812
|
+
this.rename(this.startName).catch((err) => this.log(`couldn't name the codebase: ${err.message}`))
|
|
809
813
|
}
|
|
810
814
|
|
|
811
815
|
/** As the owner, tells the relay which workspace the session is in (once per run; again when it moves). */
|
|
812
816
|
sendWorkspace () {
|
|
813
817
|
if (!this.workspace || this.workspaceSent === this.workspace || !this.isOwner) return
|
|
814
818
|
this.workspaceSent = this.workspace
|
|
815
|
-
this.conn.adminRequest({ op: 'workspace', id: this.workspace }).catch((err) => { this.workspaceSent = null; this.log(`couldn't tell the relay the
|
|
819
|
+
this.conn.adminRequest({ op: 'workspace', id: this.workspace }).catch((err) => { this.workspaceSent = null; this.log(`couldn't tell the relay the codebase's project: ${err.message}`) })
|
|
816
820
|
}
|
|
817
821
|
|
|
818
822
|
/** The session moved to a workspace (the app did it on the API): the relay is told too. */
|
|
@@ -1002,7 +1006,7 @@ export class Session extends EventEmitter {
|
|
|
1002
1006
|
|
|
1003
1007
|
/** saveState now, and never throws (a hold must start even if the state can't be written). */
|
|
1004
1008
|
saveStateNow () {
|
|
1005
|
-
try { this.saveState() } catch (err) { this.log(`could not save the
|
|
1009
|
+
try { this.saveState() } catch (err) { this.log(`could not save the codebase's state: ${err.message}`) }
|
|
1006
1010
|
}
|
|
1007
1011
|
|
|
1008
1012
|
saveState () {
|
|
@@ -1214,7 +1218,7 @@ export class Session extends EventEmitter {
|
|
|
1214
1218
|
}
|
|
1215
1219
|
return this.tryWrite(rel)
|
|
1216
1220
|
} catch (err) {
|
|
1217
|
-
this.log(`could not put the
|
|
1221
|
+
this.log(`could not put the codebase's version of ${rel} back: ${err.message}`)
|
|
1218
1222
|
return false
|
|
1219
1223
|
}
|
|
1220
1224
|
}
|
|
@@ -1254,14 +1258,14 @@ export class Session extends EventEmitter {
|
|
|
1254
1258
|
// Ours already has the session's change in it (git combined them here: a stash popped over a pull):
|
|
1255
1259
|
// only one version is new, so it goes in. Nothing is combined.
|
|
1256
1260
|
if (!conflicts.length && text === ours) {
|
|
1257
|
-
this.applyMerged(rel, ours, 'which already had the
|
|
1261
|
+
this.applyMerged(rel, ours, 'which already had the codebase\'s changes', { pulled })
|
|
1258
1262
|
release()
|
|
1259
1263
|
return 'merged'
|
|
1260
1264
|
}
|
|
1261
1265
|
// Edited live while git was asked about the folder for a moment: combined as live editing would
|
|
1262
1266
|
// have, and only where the lines don't overlap.
|
|
1263
1267
|
if (via === 'hold' && !conflicts.length) {
|
|
1264
|
-
this.applyMerged(rel, text, `with ${theirsBy || 'the
|
|
1268
|
+
this.applyMerged(rel, text, `with ${theirsBy || 'the codebase'}'s changes`)
|
|
1265
1269
|
release()
|
|
1266
1270
|
return 'merged'
|
|
1267
1271
|
}
|
|
@@ -1323,23 +1327,23 @@ export class Session extends EventEmitter {
|
|
|
1323
1327
|
release()
|
|
1324
1328
|
this.lastKnown.delete(rel)
|
|
1325
1329
|
this.tryWrite(rel)
|
|
1326
|
-
keep({ how: 'theirs', reason: `Deleted here, but ${by || 'the
|
|
1327
|
-
this.log(`🧵 ${rel}: you deleted it, but ${by || 'the
|
|
1330
|
+
keep({ how: 'theirs', reason: `Deleted here, but ${by || 'the codebase'} changed it: it stays` })
|
|
1331
|
+
this.log(`🧵 ${rel}: you deleted it, but ${by || 'the codebase'} changed it, so it stays`)
|
|
1328
1332
|
return 'merged'
|
|
1329
1333
|
}
|
|
1330
1334
|
if (theirs === undefined) {
|
|
1331
1335
|
release()
|
|
1332
1336
|
this.ingest(rel, { pulled })
|
|
1333
|
-
keep({ how: 'mine', reason: `${by || 'The
|
|
1334
|
-
this.log(`🧵 ${rel}: ${by || 'the
|
|
1337
|
+
keep({ how: 'mine', reason: `${by || 'The codebase'} deleted it, but it was changed here: it stays` })
|
|
1338
|
+
this.log(`🧵 ${rel}: ${by || 'the codebase'} deleted it, but you changed it, so it stays`)
|
|
1335
1339
|
return 'merged'
|
|
1336
1340
|
}
|
|
1337
1341
|
// Ours stays on this folder's disk under .quilt (keepHeldLocal), for resolving it "mine".
|
|
1338
1342
|
const holdWhole = (kind) => {
|
|
1339
1343
|
try {
|
|
1340
|
-
const rec = this.liveRules().hold({ path: rel, kind, by: this.name, byId: this.myKey(), others: by ? [by] : [], where, hunks: kind === 'binary' ? [] : [{ at: 0, base: [], ours: ours.split('\n'), theirs: theirs.split('\n') }], reason: `${by || 'the
|
|
1344
|
+
const rec = this.liveRules().hold({ path: rel, kind, by: this.name, byId: this.myKey(), others: by ? [by] : [], where, hunks: kind === 'binary' ? [] : [{ at: 0, base: [], ours: ours.split('\n'), theirs: theirs.split('\n') }], reason: `${by || 'the codebase'} changed it first, and the two versions have nothing in common to merge`, result: kind === 'binary' ? null : theirs, mine: kind === 'binary' ? null : ours })
|
|
1341
1345
|
if (kind === 'binary' && disk && disk.buf) { fs.mkdirSync(this.heldDir(rec.id), { recursive: true }); fs.writeFileSync(path.join(this.heldDir(rec.id), 'mine'), disk.buf) }
|
|
1342
|
-
this.notice(`Quilt held back your version of ${rel}: ${by || 'someone'} changed it first, so the
|
|
1346
|
+
this.notice(`Quilt held back your version of ${rel}: ${by || 'someone'} changed it first, so the codebase keeps theirs and your folder has it now. Resolve it with quilt_resolve_merge { path: "${rel}", how: "theirs" | "mine" | "edited" } (id ${rec.id}).`)
|
|
1343
1347
|
} catch (err) { this.log(`could not hold your version of ${rel}: ${err.message}`) }
|
|
1344
1348
|
// ours is set aside (the record, .quilt/merges/<id>/): the session's version comes back to disk.
|
|
1345
1349
|
this.lastKnown.set(rel, ours)
|
|
@@ -1347,22 +1351,22 @@ export class Session extends EventEmitter {
|
|
|
1347
1351
|
}
|
|
1348
1352
|
if (binary) {
|
|
1349
1353
|
release()
|
|
1350
|
-
keep({ how: 'theirs', reason: `Both changed it: ${by || 'the
|
|
1354
|
+
keep({ how: 'theirs', reason: `Both changed it: ${by || 'the codebase'}'s version, which landed first, stays; yours is held` })
|
|
1351
1355
|
holdWhole('binary')
|
|
1352
|
-
this.log(`⚖️ ${rel}: both changed it; ${by || 'the
|
|
1356
|
+
this.log(`⚖️ ${rel}: both changed it; ${by || 'the codebase'}'s version stays and yours is held (quilt_resolve_merge)`)
|
|
1353
1357
|
return 'merged'
|
|
1354
1358
|
}
|
|
1355
1359
|
// No common version (git couldn't read it, or both made the file): nothing lines up to combine.
|
|
1356
1360
|
if (typeof base !== 'string') {
|
|
1357
1361
|
release()
|
|
1358
|
-
keep({ how: 'theirs', reason: `Both made it: ${by || 'the
|
|
1362
|
+
keep({ how: 'theirs', reason: `Both made it: ${by || 'the codebase'}'s version stays; yours is held` })
|
|
1359
1363
|
holdWhole('lines')
|
|
1360
1364
|
return 'merged'
|
|
1361
1365
|
}
|
|
1362
1366
|
const r = this.liveRules().write({ doc: this.bdoc, where, path: rel, base, ours, theirs, by: this.name, byId: this.myKey(), others: by ? [by] : [] })
|
|
1363
|
-
this.applyMerged(rel, r.text, `with ${by || 'the
|
|
1367
|
+
this.applyMerged(rel, r.text, `with ${by || 'the codebase'}'s changes${r.held.length ? ' (where both changed the same lines, theirs stays and yours is held)' : ''}`, { pulled })
|
|
1364
1368
|
release()
|
|
1365
|
-
if (r.held.length) keep({ how: 'theirs', reason: `Merged by Quilt: where both changed the same lines, ${by || 'the
|
|
1369
|
+
if (r.held.length) keep({ how: 'theirs', reason: `Merged by Quilt: where both changed the same lines, ${by || 'the codebase'}'s version, which landed first, stays; yours is held to resolve` })
|
|
1366
1370
|
return 'merged'
|
|
1367
1371
|
}
|
|
1368
1372
|
|
|
@@ -1472,7 +1476,7 @@ export class Session extends EventEmitter {
|
|
|
1472
1476
|
}
|
|
1473
1477
|
} finally { this.seeding = false }
|
|
1474
1478
|
this.log(`initial sync: ${pulled} file(s) pulled, ${pushed} pushed` +
|
|
1475
|
-
(removed ? `, ${removed} removed (deleted in the
|
|
1479
|
+
(removed ? `, ${removed} removed (deleted in the codebase)` : '') +
|
|
1476
1480
|
(backedUp || removed ? `, ${backedUp + removed} local version(s) backed up to ${path.relative(this.root, backupDir)}` : ''))
|
|
1477
1481
|
// Kept at once, not a second later: a sandbox that ends a turn by wiping the machine may stop
|
|
1478
1482
|
// quilt join any moment, and the next start measures offline edits from this.
|
|
@@ -1712,7 +1716,7 @@ export class Session extends EventEmitter {
|
|
|
1712
1716
|
// A rebase or a bisect can stay open for a long time (a conflict to resolve): said once, to the person and their AI.
|
|
1713
1717
|
if (busy && busy !== 'index-lock' && !this.hold.said && Date.now() - this.hold.since >= HOLD_SAY_MS) {
|
|
1714
1718
|
this.hold.said = true
|
|
1715
|
-
const text = `git is in the middle of a ${busy} in this folder, so nothing here is shared and nothing from the
|
|
1719
|
+
const text = `git is in the middle of a ${busy} in this folder, so nothing here is shared and nothing from the codebase is written here until it is finished (or aborted).`
|
|
1716
1720
|
this.log(`⏸️ ${text}`)
|
|
1717
1721
|
this.notice(text)
|
|
1718
1722
|
}
|
|
@@ -1824,11 +1828,11 @@ export class Session extends EventEmitter {
|
|
|
1824
1828
|
if (this.moveSaid === said) return
|
|
1825
1829
|
this.moveSaid = said
|
|
1826
1830
|
if (refused) {
|
|
1827
|
-
const text = `The
|
|
1831
|
+
const text = `The codebase can't take ${to}: ${msg}. This folder isn't syncing while it's on ${to}; check out ${this.branch} again in git to keep syncing there.`
|
|
1828
1832
|
this.log(`⚠️ ${text}`)
|
|
1829
1833
|
this.notice(text)
|
|
1830
1834
|
} else {
|
|
1831
|
-
this.log(`⚠️ You're on ${to} in git, but its work in the
|
|
1835
|
+
this.log(`⚠️ You're on ${to} in git, but its work in the codebase can't be loaded yet (${msg}). This folder waits and tries again.`)
|
|
1832
1836
|
}
|
|
1833
1837
|
}
|
|
1834
1838
|
|
|
@@ -1934,7 +1938,7 @@ export class Session extends EventEmitter {
|
|
|
1934
1938
|
m.doc = doc = fresh
|
|
1935
1939
|
m.left = left = null
|
|
1936
1940
|
m.epoch = null
|
|
1937
|
-
const said = `${to} was removed from the
|
|
1941
|
+
const said = `${to} was removed from the codebase (nobody was on it for 30 days) and has been started again since, so what this folder had kept of it is not brought back; the codebase's files there are on disk.`
|
|
1938
1942
|
this.log(`⚠️ ${said}`)
|
|
1939
1943
|
this.notice(said)
|
|
1940
1944
|
}
|
|
@@ -1978,7 +1982,7 @@ export class Session extends EventEmitter {
|
|
|
1978
1982
|
if (this.stopped) return null
|
|
1979
1983
|
if (entries.length && !movedOn) {
|
|
1980
1984
|
this.mergeHeld(entries).then(({ conflicts }) => {
|
|
1981
|
-
if (conflicts) this.log(`🔀 ${conflicts} file${conflicts === 1 ? '' : 's'} you changed on ${to} clash with the
|
|
1985
|
+
if (conflicts) this.log(`🔀 ${conflicts} file${conflicts === 1 ? '' : 's'} you changed on ${to} clash with the codebase's; see Merges.`)
|
|
1982
1986
|
}).catch((err) => this.log(`could not merge: ${err.message}`))
|
|
1983
1987
|
} else for (const e of entries) this.merging.delete(e.rel)
|
|
1984
1988
|
this.saveStateNow()
|
|
@@ -1986,7 +1990,7 @@ export class Session extends EventEmitter {
|
|
|
1986
1990
|
const note = this.moveNote({ from, to: this.branch, created: !!reply.created, carried: [...carried.keys()] })
|
|
1987
1991
|
this.log(`🔀 ${note}`)
|
|
1988
1992
|
// Agents working in this folder hear it with their next answer; the room sees it in the activity log.
|
|
1989
|
-
this.notice(`This folder moved from ${from} to ${this.branch} (a checkout in git): its files are ${this.branch}'s in the
|
|
1993
|
+
this.notice(`This folder moved from ${from} to ${this.branch} (a checkout in git): its files are ${this.branch}'s in the codebase now, and ${from}'s work stays in the codebase on ${from}.`)
|
|
1990
1994
|
this.doc.transact(() => {
|
|
1991
1995
|
this.activity.push([{ by: this.name, path: '', kind: 'switched', detail: '', branch: this.branch, from, ts: Date.now() }])
|
|
1992
1996
|
if (this.activity.length > 300) this.activity.delete(0, this.activity.length - 300)
|
|
@@ -2267,10 +2271,10 @@ export class Session extends EventEmitter {
|
|
|
2267
2271
|
/** What a move says in the log. */
|
|
2268
2272
|
moveNote ({ from, to, created, carried = [] }) {
|
|
2269
2273
|
const head = `You're on ${to} now (you switched in git)`
|
|
2270
|
-
if (created) return `${head}. ${to} is new to the
|
|
2274
|
+
if (created) return `${head}. ${to} is new to the codebase: this folder's files are its starting point, and ${from}'s work stays in the codebase on ${from}.`
|
|
2271
2275
|
const list = carried.slice(0, 3).join(', ') + (carried.length > 3 ? ', …' : '')
|
|
2272
|
-
const brought = carried.length ? ` git had carried ${from}'s uncommitted work in ${list} over: that stays in the
|
|
2273
|
-
return `${head}; the
|
|
2276
|
+
const brought = carried.length ? ` git had carried ${from}'s uncommitted work in ${list} over: that stays in the codebase on ${from}, and ${to}'s version is on disk.` : ''
|
|
2277
|
+
return `${head}; the codebase's work there is on disk.${brought}`
|
|
2274
2278
|
}
|
|
2275
2279
|
|
|
2276
2280
|
/** Watches the folder's .git: HEAD moving is looked at with the next flush, and git starting work holds the folder at once. */
|
|
@@ -2290,6 +2294,67 @@ export class Session extends EventEmitter {
|
|
|
2290
2294
|
// `git pull --autostash` would. It never merges git history: a branch with commits of its own the
|
|
2291
2295
|
// upstream hasn't, or uncommitted work on the same lines as a commit, is left to the person's git.
|
|
2292
2296
|
|
|
2297
|
+
// ------------------------------------------------------ git for a joiner --
|
|
2298
|
+
// Every session's folder has git (Daniel, 2026-11-19). Whoever starts a session has it already
|
|
2299
|
+
// (new-session.js). A folder that joins without it gets the session's repository around the
|
|
2300
|
+
// files: the address a partner's folder shared (shareRepo), fetched with the joiner's own git
|
|
2301
|
+
// sign-in, its branch at the commit a partner's folder is at, so what the session has that is
|
|
2302
|
+
// not committed shows as the folder's changes. When that can't be done (nobody shared an
|
|
2303
|
+
// address, no sign-in for it, no network) the folder joins as it always did, and says why.
|
|
2304
|
+
|
|
2305
|
+
/** The repository this folder's branch is a checkout of, as a partner's folder shared it ('': none did, or it is no address git may be given). */
|
|
2306
|
+
sessionRepo () { return shareableRemote(this.bdoc.getMap('git').get('origin'), { local: this.localRepos }) }
|
|
2307
|
+
|
|
2308
|
+
/** Shares this folder's origin (never a sign-in in it) and its branch's commit in the branch's document, for folders that join without git. */
|
|
2309
|
+
async shareRepo () {
|
|
2310
|
+
if (!this.git || !this.git.branch || this.stopped || (this.access && this.access.role === 'viewer')) return
|
|
2311
|
+
const url = shareableRemote(await originUrl(this.root), { local: this.localRepos })
|
|
2312
|
+
if (this.stopped || !this.git || !this.git.branch) return
|
|
2313
|
+
const g = this.bdoc.getMap('git')
|
|
2314
|
+
const sha = this.git.sha || null
|
|
2315
|
+
// The first address said stays (two folders may reach one repository by different addresses).
|
|
2316
|
+
const say = { ...(url && !this.sessionRepo() ? { origin: url } : {}), ...(sha && g.get('tip') !== sha ? { tip: sha } : {}) }
|
|
2317
|
+
if (Object.keys(say).length) this.transact(() => { for (const [k, v] of Object.entries(say)) g.set(k, v) })
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
/**
|
|
2321
|
+
* At a first join, before the session's files are written: a folder without git is made a
|
|
2322
|
+
* checkout of the session's repository (gitstate.js adoptRepo). True when it has git now.
|
|
2323
|
+
*/
|
|
2324
|
+
async gitForJoin () {
|
|
2325
|
+
// Whatever goes wrong here, the folder still joins.
|
|
2326
|
+
try { return await this.adoptGit() } catch (err) { this.emit('debug', `git for this folder: ${err && err.message}`); return false }
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
async adoptGit () {
|
|
2330
|
+
if (this.git || this.gitAside || this.stopped || this.prefer === 'local' || hasGitDir(this.root)) return false
|
|
2331
|
+
const url = this.sessionRepo()
|
|
2332
|
+
const branch = this.branchKey()
|
|
2333
|
+
if (!url || !validBranchKey(branch) || branch === DEFAULT_KEY || branch.startsWith('@')) return false
|
|
2334
|
+
const label = repoLabel(url)
|
|
2335
|
+
// The commit the session's files are measured from: where a partner's folder on the branch is now, else where one last said it was.
|
|
2336
|
+
let sha = null
|
|
2337
|
+
for (const [id, st] of this.conn.awareness.getStates()) {
|
|
2338
|
+
if (id !== this.doc.clientID && st && st.tip && st.tip.key === branch && typeof st.tip.sha === 'string') { sha = st.tip.sha; break }
|
|
2339
|
+
}
|
|
2340
|
+
if (!sha) { const said = this.bdoc.getMap('git').get('tip'); if (typeof said === 'string') sha = said }
|
|
2341
|
+
if (sha && !/^[0-9a-f]{40,64}$/.test(sha)) sha = null
|
|
2342
|
+
this.log(`setting up git in this folder from ${label}…`)
|
|
2343
|
+
const r = await adoptRepo(this.root, { url, branch, sha, local: this.localRepos })
|
|
2344
|
+
if (this.stopped) return false
|
|
2345
|
+
if (!r.ok) {
|
|
2346
|
+
const text = `Quilt could not set up git in this folder: ${r.error}. The codebase's files are here and stay in sync. To have git too, clone ${label} and join the codebase from that folder.`
|
|
2347
|
+
this.log(`⚠️ ${text}`)
|
|
2348
|
+
this.notice(text)
|
|
2349
|
+
return false
|
|
2350
|
+
}
|
|
2351
|
+
this.git = await this.headAt()
|
|
2352
|
+
this.gitSeen = this.git
|
|
2353
|
+
this.gitIndex = indexStamp(this.root)
|
|
2354
|
+
this.log(`git is set up in this folder: ${branch}, from ${label}.`)
|
|
2355
|
+
return !!this.git
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2293
2358
|
/** Starts looking at the upstream: now, then every UPSTREAM_MS. */
|
|
2294
2359
|
startUpstream () {
|
|
2295
2360
|
if (!this.git || !this.bringInUpstream || this.upstreamPoll) return
|
|
@@ -2305,6 +2370,7 @@ export class Session extends EventEmitter {
|
|
|
2305
2370
|
const was = this.conn.awareness.getLocalState().tip
|
|
2306
2371
|
const tip = this.git.branch && this.git.sha ? { key: this.git.key, sha: this.git.sha } : null
|
|
2307
2372
|
if (JSON.stringify(was || null) !== JSON.stringify(tip)) this.conn.awareness.setLocalStateField('tip', tip)
|
|
2373
|
+
this.shareRepo().catch((err) => this.emit('debug', `sharing the repository: ${err.message}`))
|
|
2308
2374
|
}
|
|
2309
2375
|
|
|
2310
2376
|
/** A partner's folder on this branch is at a commit this one isn't: it may have pushed, so this folder fetches (again a little later: a push follows its commit). */
|
|
@@ -2411,7 +2477,7 @@ export class Session extends EventEmitter {
|
|
|
2411
2477
|
})
|
|
2412
2478
|
if (!here.length || !(await stage(this.root, here))) return
|
|
2413
2479
|
this.gitIndex = indexStamp(this.root) // Quilt's own write of the index: no burst of git's
|
|
2414
|
-
this.log(`staged ${here.length} file${here.length === 1 ? '' : 's'} the
|
|
2480
|
+
this.log(`staged ${here.length} file${here.length === 1 ? '' : 's'} the codebase brought here from ${to.slice(0, 7)} (${here.slice(0, 3).join(', ')}${here.length > 3 ? ', …' : ''}), so a pull with --autostash goes through`)
|
|
2415
2481
|
}
|
|
2416
2482
|
|
|
2417
2483
|
/** Keeps what is known of the upstream, and says why commits wait (to the log and the AI) once per reason. */
|
|
@@ -2515,7 +2581,7 @@ export class Session extends EventEmitter {
|
|
|
2515
2581
|
this.headChangedAt = 0
|
|
2516
2582
|
this.scheduleStateSave()
|
|
2517
2583
|
this.shareTip()
|
|
2518
|
-
this.log(`⬇️ brought in ${commits} from ${facts.name}${written ? ` (${written} file${written === 1 ? '' : 's'} written)` : ': the
|
|
2584
|
+
this.log(`⬇️ brought in ${commits} from ${facts.name}${written ? ` (${written} file${written === 1 ? '' : 's'} written)` : ': the codebase already had their files'}`)
|
|
2519
2585
|
this.setUpstream({ name: facts.name, sha: to, behind: 0, ahead: 0, brought: { count: facts.behind, files: written, at: Date.now() } })
|
|
2520
2586
|
}
|
|
2521
2587
|
|
|
@@ -2675,7 +2741,7 @@ export class Session extends EventEmitter {
|
|
|
2675
2741
|
if (!(await this.savesSent())) return stays('git is at work in this folder. Try again in a moment.')
|
|
2676
2742
|
const said = await switchBranch(this.root, main, { force: true })
|
|
2677
2743
|
if (said || !(await this.arrivedOn(main))) return stays(`git could not check out ${main}${said ? ` (${said})` : ''}.`)
|
|
2678
|
-
this.log(`🌿 back on ${main}; what you had not committed on ${from} stays there in the
|
|
2744
|
+
this.log(`🌿 back on ${main}; what you had not committed on ${from} stays there in the codebase`)
|
|
2679
2745
|
return { branch: main, from }
|
|
2680
2746
|
}
|
|
2681
2747
|
|
|
@@ -3134,7 +3200,7 @@ export class Session extends EventEmitter {
|
|
|
3134
3200
|
this.relayAgain.delete(rel)
|
|
3135
3201
|
if (this.stopped) return
|
|
3136
3202
|
if (/unknown branch request/.test(err.message)) { this.noRelayWrites = true; try { this.ingest(rel) } catch {} return }
|
|
3137
|
-
if (this.relayProblem !== err.message) this.log(`${rel}: your edit waits to reach the
|
|
3203
|
+
if (this.relayProblem !== err.message) this.log(`${rel}: your edit waits to reach the codebase (${err.message}); it is tried again`)
|
|
3138
3204
|
this.relayProblem = err.message
|
|
3139
3205
|
const t = setTimeout(() => { if (!this.stopped) this.queue(rel) }, 1000)
|
|
3140
3206
|
t.unref?.()
|
|
@@ -3601,7 +3667,7 @@ export class Session extends EventEmitter {
|
|
|
3601
3667
|
if (!placed) return // saved again and again meanwhile: what is there now is taken in
|
|
3602
3668
|
// Made from what disk had before Quilt's write: merged against that (base-pick.js).
|
|
3603
3669
|
if (ours && typeof before === 'string' && !looksBinary(bytes)) this.overwritten.mark(rel, bytes.toString('utf8'), before)
|
|
3604
|
-
this.log(`${rel}: a save landed while Quilt wrote the
|
|
3670
|
+
this.log(`${rel}: a save landed while Quilt wrote the codebase's version; it is taken in now`)
|
|
3605
3671
|
this.queue(rel)
|
|
3606
3672
|
} catch {}
|
|
3607
3673
|
}
|
|
@@ -3614,7 +3680,7 @@ export class Session extends EventEmitter {
|
|
|
3614
3680
|
swapIn (rel, abs, tmp, look, unchanged = null) {
|
|
3615
3681
|
const r = swapIn(abs, tmp, look, { asideDir: path.join(this.stateDir, 'tmp'), log: (m) => this.log(m), unchanged })
|
|
3616
3682
|
if (r.replaced) {
|
|
3617
|
-
const w = `A save of ${rel} landed in the same instant Quilt wrote the
|
|
3683
|
+
const w = `A save of ${rel} landed in the same instant Quilt wrote the codebase's version over it, and could not be kept: save ${rel} again (your editor still has it).`
|
|
3618
3684
|
this.notice(w)
|
|
3619
3685
|
this.log(`⚠️ ${w}`)
|
|
3620
3686
|
}
|
|
@@ -4117,7 +4183,7 @@ export class Session extends EventEmitter {
|
|
|
4117
4183
|
* { muted, sig, transcribing, sharing } from the app window, which does the audio. Only people talk.
|
|
4118
4184
|
*/
|
|
4119
4185
|
setVoice (v) {
|
|
4120
|
-
if (!this.conn || !this.conn.awareness) throw new Error('Not connected to the
|
|
4186
|
+
if (!this.conn || !this.conn.awareness) throw new Error('Not connected to the codebase yet.')
|
|
4121
4187
|
if (v && v.in !== false) {
|
|
4122
4188
|
if (this.kind === 'agent') throw new Error('Voice is for people: agents read the transcript instead.')
|
|
4123
4189
|
if (!this.mayTalk()) throw new Error(TALK_REFUSED)
|
|
@@ -4150,7 +4216,7 @@ export class Session extends EventEmitter {
|
|
|
4150
4216
|
|
|
4151
4217
|
/** The owner turns transcripts of the session's calls on or off. */
|
|
4152
4218
|
setVoiceTranscribe (on) {
|
|
4153
|
-
if (!this.isOwner) throw new Error(
|
|
4219
|
+
if (!this.isOwner) throw new Error("Only the codebase's owner can turn transcripts on or off.")
|
|
4154
4220
|
setTranscribe(this.doc, { on, by: this.name })
|
|
4155
4221
|
// Off: nobody's speech goes on being sent.
|
|
4156
4222
|
if (!on) {
|
|
@@ -4211,9 +4277,9 @@ export class Session extends EventEmitter {
|
|
|
4211
4277
|
* says its name in it (it is pinged, and joins with this or by speaking).
|
|
4212
4278
|
*/
|
|
4213
4279
|
voiceJoin ({ leave = false } = {}) {
|
|
4214
|
-
if (this.kind !== 'agent') throw new Error(`In this
|
|
4280
|
+
if (this.kind !== 'agent') throw new Error(`In this codebase you are ${this.name}: people join calls in the Quilt app. An agent (and "${this.name}'s AI") joins a transcribed call when someone says its name.`)
|
|
4215
4281
|
const call = this.liveCall()
|
|
4216
|
-
if (!call) throw new Error('There is no call going on in this
|
|
4282
|
+
if (!call) throw new Error('There is no call going on in this codebase.')
|
|
4217
4283
|
setAgentLeft(this.doc, { call, name: this.name, leave })
|
|
4218
4284
|
if (leave) return { in: false, call }
|
|
4219
4285
|
const why = notInCall(this.doc, { call, name: this.name, members: this.members })
|
|
@@ -4711,7 +4777,7 @@ export class Session extends EventEmitter {
|
|
|
4711
4777
|
* which the accounts API sends to the address the agent confirmed. Replaces a webhook.
|
|
4712
4778
|
*/
|
|
4713
4779
|
async setWakeEmail () {
|
|
4714
|
-
if (!this.relayWebhooks) throw new Error('This folder is not let into the
|
|
4780
|
+
if (!this.relayWebhooks) throw new Error('This folder is not let into the codebase yet: choose email once it is (the relay keeps it).')
|
|
4715
4781
|
this.webhook = null
|
|
4716
4782
|
try { fs.rmSync(this.webhookFile, { force: true }) } catch {}
|
|
4717
4783
|
return this.relayWebhookRequest({ action: 'subscribe', email: true })
|
|
@@ -4968,7 +5034,7 @@ export class Session extends EventEmitter {
|
|
|
4968
5034
|
if (c.after === null) fs.rmSync(abs, { force: true })
|
|
4969
5035
|
else { fs.mkdirSync(path.dirname(abs), { recursive: true }); fs.writeFileSync(abs, c.after) }
|
|
4970
5036
|
}
|
|
4971
|
-
this.log(`📐 gathered the
|
|
5037
|
+
this.log(`📐 gathered the codebase's AI rules into AGENTS.md (${plan.changes.length} file${plan.changes.length === 1 ? '' : 's'})`)
|
|
4972
5038
|
return { changed: plan.changes.map((c) => c.path), manual: plan.manual }
|
|
4973
5039
|
}
|
|
4974
5040
|
|
|
@@ -5277,7 +5343,7 @@ export class Session extends EventEmitter {
|
|
|
5277
5343
|
fs.mkdirSync(dir, { recursive: true })
|
|
5278
5344
|
// Git leaves the folder alone (Quilt never syncs it: pathrules.js), with nothing added to the project's .gitignore.
|
|
5279
5345
|
const gi = path.join(dir, '.gitignore')
|
|
5280
|
-
if (!fs.existsSync(gi)) fs.writeFileSync(gi, '# Files sent in the Quilt
|
|
5346
|
+
if (!fs.existsSync(gi)) fs.writeFileSync(gi, '# Files sent in the Quilt codebase\'s chat: only for the people who can see them.\n*\n')
|
|
5281
5347
|
}
|
|
5282
5348
|
return path.join(dir, name)
|
|
5283
5349
|
}
|
|
@@ -5308,7 +5374,7 @@ export class Session extends EventEmitter {
|
|
|
5308
5374
|
*/
|
|
5309
5375
|
async createChatLink ({ name = '', minutes } = {}) {
|
|
5310
5376
|
if (!this.conn) throw new Error('not connected to the relay')
|
|
5311
|
-
if (!this.canAdmit) throw new Error('only people who may let others into this
|
|
5377
|
+
if (!this.canAdmit) throw new Error('only people who may let others into this codebase can make a chat link')
|
|
5312
5378
|
const r = await this.conn.adminRequest({ op: 'chatlink', name: String(name || ''), ...(minutes ? { minutes: Number(minutes) } : {}) })
|
|
5313
5379
|
return { url: `${this.httpBase()}/c/${this.room}/${r.token}`, name: r.name, expiresAt: r.expiresAt }
|
|
5314
5380
|
}
|
|
@@ -5316,7 +5382,7 @@ export class Session extends EventEmitter {
|
|
|
5316
5382
|
/** Whoever may let people in: a chat link (by its member key, or its name) works for `minutes` from now. One that ran out can't be. */
|
|
5317
5383
|
async extendChatLink (who, minutes) {
|
|
5318
5384
|
if (!this.conn) throw new Error('not connected to the relay')
|
|
5319
|
-
if (!this.canAdmit) throw new Error('only people who may let others into this
|
|
5385
|
+
if (!this.canAdmit) throw new Error('only people who may let others into this codebase can extend a chat link')
|
|
5320
5386
|
const m = this.members.find((x) => x.chat && (x.key === who || x.name === who))
|
|
5321
5387
|
if (!m) throw new Error(`no chat link called ${who}; it may have run out (make a new one)`)
|
|
5322
5388
|
const r = await this.conn.adminRequest({ op: 'chatextend', key: m.key, minutes: Number(minutes) })
|
|
@@ -5687,7 +5753,7 @@ export class Session extends EventEmitter {
|
|
|
5687
5753
|
// Texts kept on this machine (`local`) are this folder's writer's version only.
|
|
5688
5754
|
const local = (name) => { if (v.by !== this.name) return null; try { return fs.readFileSync(path.join(dir, name)) } catch { return null } }
|
|
5689
5755
|
// A record an older Quilt held away from the session's branches (`where.square`) is on no branch a folder can be on.
|
|
5690
|
-
if (rec.where.square) throw new Error(`${rec.path} was held by an older Quilt, away from the
|
|
5756
|
+
if (rec.where.square) throw new Error(`${rec.path} was held by an older Quilt, away from the codebase's branches, so its held lines can't be put in from a folder: write the file yourself and resolve it "edited".`)
|
|
5691
5757
|
if (rec.where.branch && rec.where.branch !== this.branchKey()) throw new Error(`${rec.path} was held on branch ${rec.where.branch}, not the one this folder is on: resolve it "mine" from a folder there, or write the file yourself and resolve it "edited".`)
|
|
5692
5758
|
const abs = resolveInside(this.root, rec.path)
|
|
5693
5759
|
if (v.kind === 'binary') {
|
package/src/setup.js
CHANGED
|
@@ -12,19 +12,19 @@ const START = '<!-- quilt:start -->'
|
|
|
12
12
|
const END = '<!-- quilt:end -->'
|
|
13
13
|
|
|
14
14
|
export const AGENT_GUIDE = `${START}
|
|
15
|
-
## Live
|
|
15
|
+
## Live codebase (quilt)
|
|
16
16
|
|
|
17
|
-
This
|
|
17
|
+
This codebase is being edited **live by more than one person at once**, each
|
|
18
18
|
with their own AI coding tool. Files can change underneath you at any time.
|
|
19
19
|
|
|
20
20
|
- Before starting a task, check what your collaborators are doing: call the
|
|
21
21
|
\`quilt_status\` MCP tool, or run \`quilt status\` in a shell, or read
|
|
22
22
|
\`.quilt/STATUS.md\`.
|
|
23
|
-
- The
|
|
23
|
+
- The codebase has a shared task board (To do, In progress, QA, Done). Read it with
|
|
24
24
|
\`quilt_tasks\`. Add work with \`quilt_add_task\`. Move a task to In progress
|
|
25
25
|
when you start it and to QA with \`qaNotes\` when you finish (\`quilt_move_task\`).
|
|
26
26
|
${TASK_WORKFLOW_MD}
|
|
27
|
-
- Read the
|
|
27
|
+
- Read the codebase's rules and design system with \`quilt_project_rules\` before your
|
|
28
28
|
first change: the same rules whatever tool each person uses.
|
|
29
29
|
- See what a partner's AI is doing with \`quilt_partner_feed\`, and where people
|
|
30
30
|
are working with \`quilt_list_files\` (recent edits).
|
|
@@ -35,7 +35,7 @@ ${TASK_WORKFLOW_MD}
|
|
|
35
35
|
- Before you change files, call \`quilt_before_edit\` with their paths. It shows what
|
|
36
36
|
people said about those files in chat and who else changed them lately. It never
|
|
37
37
|
refuses: nobody holds files.
|
|
38
|
-
- In the
|
|
38
|
+
- In the codebase you are your person: your messages and tasks are theirs, and
|
|
39
39
|
people see you as them. "<person>'s AI" ("@Daniel's AI") is only that
|
|
40
40
|
person's cloud AI, when they connected one (their own AI tool on their own cloud
|
|
41
41
|
machine). Nothing written or handed to "<person>'s AI" comes to you; when your person
|
|
@@ -84,9 +84,9 @@ ${TASK_WORKFLOW_MD}
|
|
|
84
84
|
conflict (a merge, rebase, cherry-pick or revert) this folder is paused:
|
|
85
85
|
nothing is shared from it or written to it until you settle it and commit.
|
|
86
86
|
Checking out another branch moves this folder to that branch's work in the
|
|
87
|
-
|
|
87
|
+
codebase (the old branch keeps its own).
|
|
88
88
|
If git refuses a checkout because local changes would be overwritten,
|
|
89
|
-
those are the
|
|
89
|
+
those are the codebase's uncommitted work, which the codebase keeps: switch with
|
|
90
90
|
\`git checkout -f <branch>\` (or \`git stash && git checkout <branch>\` in one
|
|
91
91
|
command; a stash on its own is put back a moment later).
|
|
92
92
|
Deleting a file deletes it for everyone.
|
package/src/status.js
CHANGED
|
@@ -17,12 +17,12 @@ const ago = (ts) => {
|
|
|
17
17
|
|
|
18
18
|
export function renderStatus (st, { asAi = false, mentionYours = false } = {}) {
|
|
19
19
|
const out = []
|
|
20
|
-
out.push(`# Quilt
|
|
20
|
+
out.push(`# Live Quilt codebase: room \`${st.room}\``)
|
|
21
21
|
out.push('')
|
|
22
22
|
out.push(`Relay: ${st.connected ? 'connected' : '**disconnected** (edits are kept and will sync on reconnect)'} · ${st.fileCount} shared files`)
|
|
23
23
|
if (!st.connected && st.problem) out.push(`⚠️ ${st.problem}`)
|
|
24
24
|
out.push(`You: **${st.me.name}** (${st.me.tool})${st.me.persona ? `, one of ${st.me.of}'s AI sessions` : ''}${st.me.focus ? ` · focus: ${st.me.focus}` : ''}`)
|
|
25
|
-
if (st.workspaceName || st.workspace) out.push(`
|
|
25
|
+
if (st.workspaceName || st.workspace) out.push(`Project: ${st.workspaceName || st.workspace}`)
|
|
26
26
|
out.push('')
|
|
27
27
|
// Held conflicts (held.js): every open one in the session, first, until someone resolves it.
|
|
28
28
|
const held = renderHeld(st.held || [], { me: st.me.name, max: 20 })
|
package/src/tasks.js
CHANGED
|
@@ -63,7 +63,7 @@ export function cleanFiles (files) {
|
|
|
63
63
|
for (const raw of files) {
|
|
64
64
|
const p = String(raw ?? '').trim().replace(/^\.\//, '').replace(/\\/g, '/')
|
|
65
65
|
if (!p) continue
|
|
66
|
-
if (p.length > MAX_FILE_PATH || !isSafeRelPath(p)) throw new Error(`not a
|
|
66
|
+
if (p.length > MAX_FILE_PATH || !isSafeRelPath(p)) throw new Error(`not a file in the codebase: ${p.slice(0, 80)}`)
|
|
67
67
|
if (!out.includes(p)) out.push(p)
|
|
68
68
|
if (out.length > MAX_FILES) throw new Error(`a task can list at most ${MAX_FILES} files`)
|
|
69
69
|
}
|
package/src/turn-sync.js
CHANGED
|
@@ -187,12 +187,12 @@ export async function turnSync ({ dir = process.cwd(), key, fetch: fetchImpl = g
|
|
|
187
187
|
/** The summary in a few lines, for the agent reading the command's output. */
|
|
188
188
|
export function describeSync (s, { name = '' } = {}) {
|
|
189
189
|
const n = (list) => list.length
|
|
190
|
-
const lines = [`quilt sync:
|
|
190
|
+
const lines = [`quilt sync: codebase ${s.room}${s.branch ? ` (${s.branch})` : ''}${name ? ` as ${name}` : ''}`]
|
|
191
191
|
if (s.open) lines.unshift(s.open, '')
|
|
192
192
|
const parts = [`${n(s.pulled)} pulled`, `${n(s.pushed)} pushed`]
|
|
193
193
|
if (n(s.merged)) parts.push(`${n(s.merged)} merged`)
|
|
194
194
|
if (n(s.removed)) parts.push(`${n(s.removed)} removed here`)
|
|
195
|
-
if (n(s.deleted)) parts.push(`${n(s.deleted)} deleted in the
|
|
195
|
+
if (n(s.deleted)) parts.push(`${n(s.deleted)} deleted in the codebase`)
|
|
196
196
|
lines.push(` ${parts.join(', ')}.`)
|
|
197
197
|
const list = (xs) => xs.slice(0, 10).join(', ') + (xs.length > 10 ? `, and ${xs.length - 10} more` : '')
|
|
198
198
|
const yours = s.backup ? ` Your copy is in ${s.backup}.` : ''
|
|
@@ -200,7 +200,7 @@ export function describeSync (s, { name = '' } = {}) {
|
|
|
200
200
|
const held = s.held || []
|
|
201
201
|
for (const h of held.slice(0, 10)) {
|
|
202
202
|
const who = h.others && h.others.length ? h.others.join(', ') : 'someone'
|
|
203
|
-
const what = h.kind === 'stale' ? `it was made from an older copy and lacks ${h.lines || 'some'} line(s) ${who} changed since, which stay` : h.kind === 'binary' ? `${who} changed it first, so the
|
|
203
|
+
const what = h.kind === 'stale' ? `it was made from an older copy and lacks ${h.lines || 'some'} line(s) ${who} changed since, which stay` : h.kind === 'binary' ? `${who} changed it first, so the codebase keeps their version and yours is held` : `${who} changed the same lines first, so the codebase keeps theirs there and your ${h.hunks === 1 ? 'change is' : `${h.hunks || 'clashing'} changes are`} held`
|
|
204
204
|
lines.push(` ${h.path}: ${what} (id ${h.id}). Resolve it with quilt_resolve_merge { path: "${h.path}", how: "theirs" | "mine" | "edited" }.${yours}`)
|
|
205
205
|
}
|
|
206
206
|
if (held.length > 10) lines.push(` …and ${held.length - 10} more held the same way (every Quilt answer lists them).`)
|
|
@@ -210,7 +210,7 @@ export function describeSync (s, { name = '' } = {}) {
|
|
|
210
210
|
for (const w of (s.warnings || []).slice(0, 5)) lines.push(` ⚠️ ${w}`)
|
|
211
211
|
const told = new Set([...(s.lost || []).map((l) => l.path), ...held.map((h) => h.path)])
|
|
212
212
|
const asideOnly = s.aside.filter((p) => !told.has(p))
|
|
213
|
-
if (asideOnly.length) lines.push(` Kept your copy of ${list(asideOnly)} in ${s.backup}: the
|
|
213
|
+
if (asideOnly.length) lines.push(` Kept your copy of ${list(asideOnly)} in ${s.backup}: the codebase's version is on disk now.`)
|
|
214
214
|
if (s.kept.length) lines.push(` Not sent: ${list(s.kept.map((k) => `${k.path} (${k.why})`))}.`)
|
|
215
215
|
if (s.refused) lines.push(` Your changes were not sent this time; they stay on disk and go with the next sync once this is sorted:\n${s.refused.split('\n').map((l) => ` ${l}`).join('\n')}`)
|
|
216
216
|
if (s.skipped.length) lines.push(` Not carried by quilt sync (too large, or kept in Quilt's storage): ${list(s.skipped)}.`)
|
|
@@ -31,7 +31,7 @@ function rowHtml (s) {
|
|
|
31
31
|
<button type="button" class="btn ghost" data-acct-cancel>Cancel</button>
|
|
32
32
|
<button class="btn primary" type="submit">Join</button>
|
|
33
33
|
</div>
|
|
34
|
-
<span class="hint">Leave it empty for a new folder in ${esc(state.profile.joinDir)}, or pick the folder you already have the
|
|
34
|
+
<span class="hint">Leave it empty for a new folder in ${esc(state.profile.joinDir)}, or pick the folder you already have the codebase in.</span>
|
|
35
35
|
<p class="error"></p>
|
|
36
36
|
</form>
|
|
37
37
|
</div>`
|
|
@@ -43,7 +43,7 @@ export function accountRowsHtml () {
|
|
|
43
43
|
const shown = state.accountSessionsAll ? list : list.slice(0, SHOWN)
|
|
44
44
|
const more = list.length - shown.length
|
|
45
45
|
return shown.map(rowHtml).join('') + (more > 0
|
|
46
|
-
? `<div class="session-row acct-more"><button class="btn sm ghost" type="button" data-acct-all>Show ${more} more of your
|
|
46
|
+
? `<div class="session-row acct-more"><button class="btn sm ghost" type="button" data-acct-all>Show ${more} more of your codebases</button></div>`
|
|
47
47
|
: '')
|
|
48
48
|
}
|
|
49
49
|
|
package/src/ui/agent-env-key.js
CHANGED
|
@@ -41,7 +41,7 @@ function cleanApi (api) {
|
|
|
41
41
|
|
|
42
42
|
/** The room a session invite link is for, or an error. */
|
|
43
43
|
function roomOf (session) {
|
|
44
|
-
try { return parseInvite(String(session || ''), { allowRelay: () => true }).room } catch { throw new Error('session must be the
|
|
44
|
+
try { return parseInvite(String(session || ''), { allowRelay: () => true }).room } catch { throw new Error('session must be the codebase invite link (https://join.heyquilt.com/<room>#<secret>)') }
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
function check ({ api, key, session, slot, name }) {
|