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/ui/seam-model.js
DELETED
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
// The app in a session that moved into Seam (layout 3, Seam's plans/quilt-source-control/16): what the
|
|
2
|
-
// source control button, its panel and Session settings show there. Each folder follows its branch's
|
|
3
|
-
// square (session-follow.js), and work lands by committing the square and merging it onto main, in
|
|
4
|
-
// Seam; git is set aside in the folder and GitHub only receives Seam's export of main. So nothing here
|
|
5
|
-
// offers git, branches, pushes or pull requests. Pure: no DOM (test/unit/ui-seam-model.test.js).
|
|
6
|
-
|
|
7
|
-
import { forceAheadWords } from './force-words.js'
|
|
8
|
-
|
|
9
|
-
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]))
|
|
10
|
-
|
|
11
|
-
/** Whether the session's files are in Seam's squares now (the relay says layout 3): status.quilt from Session.quiltLink. */
|
|
12
|
-
export const inSeam = (st) => !!(st && st.quilt && st.quilt.layout === 3)
|
|
13
|
-
|
|
14
|
-
/** The quilt's name as people read it. */
|
|
15
|
-
const quiltName = (st) => (st.quilt && (st.quilt.slug || st.quilt.id)) || 'the quilt'
|
|
16
|
-
|
|
17
|
-
/** The square this folder follows, as Seam names it (`sq:` and the end of its id), or ''. */
|
|
18
|
-
export const squareName = (st) => (st && st.square && st.square.short ? `sq:${st.square.short}` : '')
|
|
19
|
-
|
|
20
|
-
/** The branch whose square this folder follows (`st.squares` is branch -> square name), or ''. */
|
|
21
|
-
export function squareBranch (st) {
|
|
22
|
-
const name = squareName(st)
|
|
23
|
-
const hit = name && Object.entries(st.squares || {}).find(([, sq]) => sq === name)
|
|
24
|
-
return hit ? hit[0] : (name && st.branch) || ''
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/** The square as a person reads it: its branch (a square's id means nothing to anyone), or its id when no branch is known. */
|
|
28
|
-
const squareWords = (st) => squareBranch(st) || squareName(st)
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* The source control button at layout 3: { label, title, aria } for the square this folder follows, or
|
|
32
|
-
* why it follows none yet. `label` '' leaves the button with its icon and count only.
|
|
33
|
-
*/
|
|
34
|
-
export function seamChip (st) {
|
|
35
|
-
const name = squareWords(st)
|
|
36
|
-
const s = st.square
|
|
37
|
-
const label = name
|
|
38
|
-
const title = st.moving ? movingCard(st).text
|
|
39
|
-
: st.squareless ? squarelessWords(st).text
|
|
40
|
-
: st.readOnly && !(s && !s.opening && !s.problem)
|
|
41
|
-
? `Your edits here are not reaching anyone: ${st.readOnly.why}`
|
|
42
|
-
: !s ? `This session's code is committed and merged in Seam (${quiltName(st)}), and this folder is not following a square yet.`
|
|
43
|
-
: s.problem ? `This folder's work belongs on ${name}, but it can't follow it yet: ${s.problem}`
|
|
44
|
-
: s.opening ? `This folder is starting to follow ${name}.`
|
|
45
|
-
: [`This folder's work is live on ${name} in ${quiltName(st)}, with everyone else's there. Click to commit it or merge it onto main.`, ...catchUpWords(s)].join(' ')
|
|
46
|
-
// The number is the square's work not committed yet (everyone's on it, not only yours): what a commit takes.
|
|
47
|
-
const count = s && s.work ? s.work.count : 0
|
|
48
|
-
const countLine = count ? `${files(count)} changed on ${name} and not committed yet, by everyone on it.` : ''
|
|
49
|
-
return { label, title, aria: `Source control: ${name || 'Seam'}${count ? `, ${files(count)} not committed` : ''}`, count, countLine }
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const files = (n) => `${n} file${n === 1 ? '' : 's'}`
|
|
53
|
-
const patches = (n) => `${n} newer patch${n === 1 ? '' : 'es'}`
|
|
54
|
-
const listed = (list) => list.length > 4 ? `${list.slice(0, 4).join(', ')} and ${list.length - 4} more` : list.join(', ')
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Main brought into the square (session-follow.js status: `behind`, `conflicted`, `brought`), in plain
|
|
58
|
-
* words: how far behind main it is, when main's newer patches last came in, and what conflicts with main.
|
|
59
|
-
* The app's square card and panel show these, and quilt_status says them. [] with nothing to say.
|
|
60
|
-
*/
|
|
61
|
-
export function catchUpWords (s) {
|
|
62
|
-
if (!s) return []
|
|
63
|
-
const out = []
|
|
64
|
-
const b = s.brought
|
|
65
|
-
const old = Array.isArray(s.outdated) ? s.outdated : []
|
|
66
|
-
if (s.behind && old.length) out.push(`Main has ${patches(s.behind)} this square doesn't have yet. ${s.behind === 1 ? 'It comes' : 'They come'} in once ${listed(old)} ${old.length === 1 ? 'updates' : 'update'} Quilt: the version on ${old.length === 1 ? 'that folder' : 'those folders'} can't follow a square whose base moves.`)
|
|
67
|
-
else if (s.behind) out.push(`Main has ${patches(s.behind)} this square doesn't have yet: Quilt brings ${s.behind === 1 ? 'it' : 'them'} in by itself.`)
|
|
68
|
-
if (b && b.at) {
|
|
69
|
-
const at = new Date(b.at).toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' })
|
|
70
|
-
const combined = b.combined || []
|
|
71
|
-
out.push(`Main's ${b.patches ? patches(b.patches) : 'newer patches'} came in at ${at}${b.by ? ` (brought in by ${b.by})` : ''}${combined.length ? `, combined with this square's work in ${listed(combined)}` : ''}.`)
|
|
72
|
-
const stale = Array.isArray(b.stale) ? b.stale : []
|
|
73
|
-
if (stale.length) out.push(`${files(stale.length)} in this square ${stale.length === 1 ? 'was an older copy' : 'were older copies'} of main's, not anyone's edit: main's ${stale.length === 1 ? 'version stands' : 'versions stand'} (${listed(stale)}).`)
|
|
74
|
-
}
|
|
75
|
-
const n = s.conflicted ?? (b && b.conflicts ? b.conflicts.length : 0)
|
|
76
|
-
const l = s.landing || null
|
|
77
|
-
if (n) {
|
|
78
|
-
const named = b && b.conflicts && b.conflicts.length ? ` (${listed(b.conflicts)})` : ''
|
|
79
|
-
// Held work lands by itself (source-live/land.js): the conflict is settled without the person.
|
|
80
|
-
if (s.lands) out.push(`${files(n)} ${n === 1 ? 'conflicts' : 'conflict'} with main and ${n === 1 ? 'is' : 'are'} marked in this folder${named}. Quilt settles ${n === 1 ? 'it' : 'them'} by itself: Seam's own merge if it has one, else your cloud AI if you connected one, else main's version stays and yours is kept in a square of its own. Then your work merges.`)
|
|
81
|
-
else out.push(`${files(n)} ${n === 1 ? 'conflicts' : 'conflict'} with main and ${n === 1 ? 'is' : 'are'} marked in this folder${named}: settle ${n === 1 ? 'it' : 'them'}, commit, and merge again.`)
|
|
82
|
-
}
|
|
83
|
-
if (l && l.asked) out.push(`Your cloud AI is settling ${listed(l.asked.paths || [])} (try ${l.asked.attempt} of 2); your work merges once it is settled.`)
|
|
84
|
-
if (l && l.kept) out.push(`Main changed the same lines as your ${listed(l.kept.paths || [])}, so main's version stayed there; yours is kept in square sq:${String(l.kept.square || '').slice(-8)} ("${l.kept.title || ''}").`)
|
|
85
|
-
if (l && l.landed) out.push(`Your held work landed on ${l.landed.line || 'main'}${l.landed.patch != null ? ` as patch ${l.landed.patch}` : ''} at ${new Date(l.landed.at).toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' })}, with no step of yours.`)
|
|
86
|
-
if (l && l.waiting) out.push(`Your held work is waiting to merge: ${l.waiting}`)
|
|
87
|
-
if (l && l.held) out.push(l.held.missing ? `Your held work did not land: ${l.held.missing}.` : `Your held work did not land: the fast tests failed${(l.held.failing || []).length ? ` (${listed(l.held.failing)})` : ''}. It lands after your next change once they pass.`)
|
|
88
|
-
return out
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* The square card above the main area: { title, text }, only when something needs the person (a
|
|
93
|
-
* conflict with main, edits reaching nobody, a move under way), else null. The app's words, not
|
|
94
|
-
* quilt_status's: a person commits and merges from the square button, not with a command.
|
|
95
|
-
*/
|
|
96
|
-
export function squareCard (st) {
|
|
97
|
-
// The owner is moving the session (into Seam, or back): said first, with what to expect, on git or in Seam alike.
|
|
98
|
-
if (st.moving) return movingCard(st)
|
|
99
|
-
const s = st.square
|
|
100
|
-
const following = s && !s.opening && !s.problem
|
|
101
|
-
// The relay's own words name a tool: a person gets plain ones, and the button in the square panel.
|
|
102
|
-
// Opening by itself: the square button says so, no card. Only a try that failed gets one, with the button.
|
|
103
|
-
if (st.squareless) return st.squareless.error ? { ...squarelessWords(st), open: true } : null
|
|
104
|
-
if (st.readOnly && !following) return { title: 'Your edits here are not reaching anyone', text: st.readOnly.why }
|
|
105
|
-
// Held conflicts are the session's, on git or in Seam alike: said until an AI resolves them.
|
|
106
|
-
const held = heldCard(st)
|
|
107
|
-
if (!s) return held
|
|
108
|
-
if (s.problem || s.opening) return { title: s.problem ? 'Not following its square yet' : 'Starting to follow its square', text: s.line }
|
|
109
|
-
// Following its square with nothing to settle: the square button at the top says it, so no card (Daniel, 2026-11-01).
|
|
110
|
-
if (!(s.conflicted ?? (s.brought && s.brought.conflicts ? s.brought.conflicts.length : 0))) return held
|
|
111
|
-
const main = catchUpWords(s).join(' ')
|
|
112
|
-
return held ? { title: held.title, text: `${held.text} ${main}` } : { title: 'Main conflicts with this square', text: main }
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Open held conflicts (status `held`, held.js): two edits changed the same lines, or a write removed
|
|
117
|
-
* lines someone just added, or a merge would not parse. The file keeps what landed first and the
|
|
118
|
-
* other lines wait for an AI to resolve them. { title, text }, or null with none open.
|
|
119
|
-
*/
|
|
120
|
-
export function heldCard (st) {
|
|
121
|
-
const open = ((st && st.held) || []).filter((r) => r && r.state === 'open')
|
|
122
|
-
if (!open.length) return null
|
|
123
|
-
const me = st.me && st.me.name
|
|
124
|
-
const named = open.slice(0, 3).map((r) => `${r.path} (${r.by === me ? 'yours' : `${r.by}'s`})`).join(', ')
|
|
125
|
-
return {
|
|
126
|
-
title: `${open.length} open conflict${open.length === 1 ? '' : 's'}`,
|
|
127
|
-
text: `Changes to ${named}${open.length > 3 ? ` and ${open.length - 3} more` : ''} were held back: each file keeps the version that landed first, and the held lines wait for an AI to resolve them. Every AI in the session sees ${open.length === 1 ? 'it' : 'them'} at the top of its next answer; ask yours to take ${open.length === 1 ? 'it' : 'them'}.`
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Session settings' row for `stale_write_minutes` (held.js; status `staleWriteMinutes`, default 15): a
|
|
133
|
-
* write that removes lines someone else added this recently is held for its writer to confirm. The
|
|
134
|
-
* owner changes it in place (saved on change, no dialog); everyone else reads it.
|
|
135
|
-
*/
|
|
136
|
-
export function staleWriteHtml (st) {
|
|
137
|
-
const n = Number.isFinite(Number(st && st.staleWriteMinutes)) ? Number(st.staleWriteMinutes) : 15
|
|
138
|
-
const owner = !!(st && st.access && st.access.owner)
|
|
139
|
-
const what = 'A write that removes lines someone else added this recently is held for its writer to confirm, so a whole file written from an older read can\'t wipe out a partner\'s new work.'
|
|
140
|
-
const value = owner
|
|
141
|
-
? `<span class="pm-number-in"><input class="input" type="number" inputmode="numeric" min="0" max="1440" step="1" value="${n}" data-stale-write aria-label="Minutes a partner's new lines are kept"><span class="hint">min</span></span>`
|
|
142
|
-
: `<span class="pm-number-in"><b>${n ? `${n} min` : 'Off'}</b></span>`
|
|
143
|
-
return `<div class="pm-section"><div class="pm-title">Same-line clashes</div><div class="pm-card pm-settings">
|
|
144
|
-
<label class="pm-number"><span><b>Keep a partner's new lines for</b><small>${what} ${owner ? '0 turns it off.' : 'The session\'s owner sets this.'}</small></span>${value}</label>
|
|
145
|
-
</div></div>`
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* The source control panel's top at layout 3, in place of the branch list: the square, its line, and
|
|
150
|
-
* the two things a person does with it, Commit (the square's live work, with a message) and Merge onto
|
|
151
|
-
* main (Seam merges once its checks pass; the folder carries on in a new square). `busy`: 'commit' or
|
|
152
|
-
* 'merge' while that one runs. A viewer, or a folder not following its square yet, gets the line only.
|
|
153
|
-
*/
|
|
154
|
-
export function squarePanelHtml (st, { busy = '' } = {}) {
|
|
155
|
-
const s = st.square
|
|
156
|
-
const name = squareWords(st)
|
|
157
|
-
const following = s && !s.opening && !s.problem
|
|
158
|
-
const viewer = !!(st.access && st.access.role === 'viewer')
|
|
159
|
-
const head = `<div class="br-here sq-here"><div class="br-title"${squareName(st) ? ` title="Seam's square ${esc(squareName(st))}"` : ''}>${name ? `Live work on <b>${esc(name)}</b> in ${esc(quiltName(st))}` : `Code committed and merged in Seam: <b>${esc(quiltName(st))}</b>`}</div>`
|
|
160
|
-
// While the session moves, nothing is committed or merged from here: the move is what it waits for.
|
|
161
|
-
if (st.moving) return `${head}<div class="br-sub warn">${esc(movingCard(st).text)}</div></div>`
|
|
162
|
-
if (st.squareless) {
|
|
163
|
-
const w = squarelessWords(st)
|
|
164
|
-
if (!st.squareless.error) return `${head}<div class="br-sub">${esc(w.text)}</div></div>`
|
|
165
|
-
return `${head}<div class="br-sub warn">${esc(w.text)}</div>${viewer ? '' : `<div class="sq-acts">${openSquareButton(st, busy)}</div>`}</div>`
|
|
166
|
-
}
|
|
167
|
-
if (!following) {
|
|
168
|
-
const why = st.readOnly ? st.readOnly.why : s ? s.line : 'This folder is not following a square yet: Quilt opens it by itself once the session says which.'
|
|
169
|
-
return `${head}<div class="br-sub${st.readOnly || (s && s.problem) ? ' warn' : ''}">${esc(why)}</div></div>`
|
|
170
|
-
}
|
|
171
|
-
const sub = `<div class="br-sub">Everyone on ${esc(name)} edits this together, live: the files below are everyone's edits, not only yours. Commit them to keep a version; merge them to put them on main (GitHub gets main from Seam by itself).</div>`
|
|
172
|
-
const caught = catchUpWords(s)
|
|
173
|
-
const work = (caught.length ? `<div class="br-sub${s.conflicted ? ' warn' : ''}">${esc(caught.join(' '))}</div>` : '') + workHtml(s.work)
|
|
174
|
-
if (viewer) return `${head}${sub}${work}</div>`
|
|
175
|
-
return `${head}${sub}${work}
|
|
176
|
-
<form class="cp-commit" data-square-commit><input class="input" name="message" placeholder="What this commit is" aria-label="Commit message" maxlength="2000" required autocomplete="off"${busy ? ' disabled' : ''}><button type="submit" class="btn sm primary"${busy ? ' disabled' : ''}>${busy === 'commit' ? 'Committing…' : 'Commit'}</button></form>
|
|
177
|
-
<div class="sq-acts"><button type="button" class="btn sm" data-square-merge${busy ? ' disabled' : ''} title="Commits what is not committed yet, then merges it onto main once its checks pass">${busy === 'merge' ? 'Merging…' : 'Merge onto main'}</button></div>
|
|
178
|
-
</div>`
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/** While the owner moves the session (status `moving`, the relay's): { title, text }, what to expect in plain words. */
|
|
182
|
-
export function movingCard (st) {
|
|
183
|
-
const m = st.moving || {}
|
|
184
|
-
return { title: m.kind === 'back' ? 'Moving the code back to git' : 'Moving the code into Seam', text: m.line || (m.kind === 'back' ? 'The session\'s code is moving back from Seam to its git branches. Keep Quilt open: it can take a few minutes, and your edits are kept.' : 'The session\'s code is moving into Seam, where it will be committed and merged; the session stays in Quilt. Keep Quilt open: it can take a few minutes, and your edits are kept.') }
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* A folder whose branch has no square in the quilt (made after the move into Seam, or main with nothing
|
|
189
|
-
* to adopt): its edits reach nobody until a square is opened for it. { title, text } in plain words.
|
|
190
|
-
*/
|
|
191
|
-
export function squarelessWords (st) {
|
|
192
|
-
const b = (st.squareless && st.squareless.branch) || 'this branch'
|
|
193
|
-
// Quilt opens the square by itself (session.js ensureSquare): only a try that failed needs anyone.
|
|
194
|
-
if (!(st.squareless && st.squareless.error)) return { title: 'Setting up this folder', text: `Quilt is opening a square on ${b} for this folder, so your edits reach everyone in the session. Your files stay as they are.` }
|
|
195
|
-
return { title: `Your edits aren't reaching anyone yet`, text: `Quilt couldn't open a square on ${b} for this folder (${st.squareless.error}), so your edits here stay on this computer. It tries again every minute; your files stay as they are.` }
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/** The button that opens a square for the folder's branch (squareTool open_square). */
|
|
199
|
-
export function openSquareButton (st, busy = '') {
|
|
200
|
-
const b = (st.squareless && st.squareless.branch) || 'this branch'
|
|
201
|
-
return `<button type="button" class="btn sm primary" data-square-open${busy ? ' disabled' : ''}>${busy === 'open' ? 'Opening…' : 'Try again now'}</button>`
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/** What the square holds not committed yet (everyone's on it), folded: what Commit takes. */
|
|
205
|
-
function workHtml (work) {
|
|
206
|
-
if (!work) return ''
|
|
207
|
-
if (!work.count) return '<div class="br-sub">Nothing here is waiting to be committed.</div>'
|
|
208
|
-
const word = { added: 'new', deleted: 'deleted', modified: '' }
|
|
209
|
-
const more = work.count - work.files.length
|
|
210
|
-
return `<details class="sq-work"><summary>${files(work.count)} not committed yet</summary><ul class="commit-files">${work.files.map((f) => `<li><code title="${esc(f.path)}">${esc(f.path)}</code>${word[f.status] ? ` <span class="hint">${word[f.status]}</span>` : ''}</li>`).join('')}${more > 0 ? `<li class="hint">and ${more} more</li>` : ''}</ul></details>`
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* The words on the owner's "Make this a quilt" card (16 flag 9), while the session's code is on git.
|
|
215
|
-
* `quilt`: the status's quilt link ({ slug, shadow }), `remote`: the session has a git remote.
|
|
216
|
-
*/
|
|
217
|
-
export function makeQuiltWords ({ quilt = null, remote = false, moving = false, force = null, importing = null, shadow = null } = {}) {
|
|
218
|
-
const w = makeQuiltWordsNow({ quilt, remote, moving, importing, shadow })
|
|
219
|
-
// The forced date (16 flag 9): live sync stopped here, or when it comes (force-date.js).
|
|
220
|
-
if (force && force.stopped) return { ...w, note: force.stopped.why || '' }
|
|
221
|
-
const ahead = force && force.at ? forceAheadWords({ at: Date.parse(force.at), remote: !!force.remote }) : null
|
|
222
|
-
return ahead ? { ...w, note: ahead } : w
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function makeQuiltWordsNow ({ quilt, remote, moving, importing, shadow }) {
|
|
226
|
-
if (moving) return { text: 'The session\'s code is moving into Seam now. Keep Quilt open: your edits are kept.', button: 'Moving into Seam…', disabled: true }
|
|
227
|
-
// A session with a git remote, step by step (quilt-remote.js): Seam importing it, then linked and ready for the cut-over.
|
|
228
|
-
if (shadow || (quilt && quilt.shadow)) return { text: `Seam follows this session's git remote in the quilt ${(shadow || quilt).slug || ''}. When the team is ready: the repository's GitHub owner lets only Seam push to main (the steps show when you click), then move the session in. Its branches become squares, its uncommitted work a square of its own, and GitHub keeps getting main from Seam.`, button: 'Move into Seam now' }
|
|
229
|
-
if (importing) return { text: `Seam is importing ${importing.repo} into the quilt ${importing.slug} and follows it. Git stays as it is meanwhile: remote, clones and CI. Check again once it has caught up.`, button: 'Check the import' }
|
|
230
|
-
if (quilt && !quilt.shadow) return { text: `This session is the quilt ${quilt.slug} already, but its files are still on its branches. Finish the move to put them in its squares.`, button: 'Finish the move' }
|
|
231
|
-
if (remote) return { text: 'This session has a git remote, so it becomes a quilt with its git history: Seam imports the remote and follows it, then the session moves in when the import is ready. Your git remote, clones and CI keep working.', button: 'Make this a quilt' }
|
|
232
|
-
return { text: 'Move this session\'s code into Seam: main as it is now becomes the quilt\'s first commit, each branch a square, and everyone\'s folder follows its square live. Nothing is lost: the session can go back to its branches.', button: 'Make this a quilt' }
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Session settings' Source control at layout 3, for everyone in it: where the code's history is, in
|
|
237
|
-
* place of the git and GitHub settings, which are put away while the session is in Seam (the relay
|
|
238
|
-
* keeps them for a move back: quilt session migrate --back).
|
|
239
|
-
*/
|
|
240
|
-
export function seamSettingsHtml (st) {
|
|
241
|
-
return `<div class="pm-section"><div class="pm-title">Seam</div><div class="pm-card git-card">
|
|
242
|
-
<div class="git-head"><h4>This session's source control</h4><span class="pill">Seam</span></div>
|
|
243
|
-
<p class="git-line ok"><b>${esc(quiltName(st))}.</b> This session's code is committed and merged in Seam; the session itself is Quilt. Everyone's folder follows its branch's square: people and their AIs commit there and merge onto main, and GitHub gets main from Seam by itself.</p>
|
|
244
|
-
<span class="hint">Git and GitHub settings are put away while the session's code is in Seam. If its owner moves it back to its branches (quilt session migrate --back), they come back as they were.</span>
|
|
245
|
-
</div></div>`
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* The left sidebar in Seam, in place of boxes (there are none: every edit is live in its square): each
|
|
250
|
-
* square with whose folders are on it, and, for yours, how many files it holds not committed yet.
|
|
251
|
-
* `st.squares` is branch -> square name; people are you (`st.square`) and `st.peers` by their branch.
|
|
252
|
-
*/
|
|
253
|
-
export function squaresSideHtml (st) {
|
|
254
|
-
const squares = st.squares || {}
|
|
255
|
-
const branchOf = Object.fromEntries(Object.entries(squares).map(([b, sq]) => [sq, b]))
|
|
256
|
-
const groups = new Map()
|
|
257
|
-
const add = (sq, who) => { if (!sq) return; if (!groups.has(sq)) groups.set(sq, []); if (!groups.get(sq).includes(who)) groups.get(sq).push(who) }
|
|
258
|
-
const mine = squareName(st)
|
|
259
|
-
add(mine, 'you')
|
|
260
|
-
for (const p of st.peers || []) if (p && p.name && p.branch && squares[p.branch] && !(p.persona && p.of === (st.me && st.me.name))) add(squares[p.branch], p.mine ? 'your AI' : p.name)
|
|
261
|
-
const n = st.square && st.square.work ? st.square.work.count : 0
|
|
262
|
-
const rows = [...groups].map(([sq, who]) => `<li class="sq-side-row${sq === mine ? ' on' : ''}"><div title="Seam's square ${esc(sq)}"><b>${esc(branchOf[sq] || sq)}</b></div><div class="hint">${esc(who.join(', '))}${sq === mine ? ` · ${n ? `${files(n)} not committed` : 'all committed'}` : ''}</div></li>`).join('')
|
|
263
|
-
// The pane's own title says Squares already (session.js, as it says Boxes outside Seam): no second heading.
|
|
264
|
-
return rows ? `<ul class="sq-side">${rows}</ul>` : ''
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/** The sidebar's line under it in Seam. */
|
|
268
|
-
export const SEAM_SIDE_HINT = 'In Seam nothing waits in boxes: everyone on a square sees every edit as it is made. Commit and merge your square from the square button at the top.'
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* What the square panel's Commit or Merge onto main did, for a person: from the Seam tool's own record
|
|
272
|
-
* (`structuredContent`), never its tool text (ids, `held by person:…`, CLI hints). `text` is the tool's
|
|
273
|
-
* text, read only for what has no record: nothing to commit, the folder carrying on in a new square.
|
|
274
|
-
*/
|
|
275
|
-
export function seamResultWords (tool, { structuredContent: rec = null, text = '' } = {}) {
|
|
276
|
-
const plural = (n, w) => `${n} ${w}${n === 1 ? '' : 's'}`
|
|
277
|
-
const names = (list) => list.length > 4 ? `${list.slice(0, 4).join(', ')} and ${list.length - 4} more` : list.join(', ')
|
|
278
|
-
const careful = (rec && rec.warnings || []).map((w) => w.kind === 'markers_in_file' ? `${w.path} still has conflict markers in it.` : `${w.path} looks like it holds a secret: check it before you merge.`)
|
|
279
|
-
if (tool === 'seam_commit') {
|
|
280
|
-
if (/^Nothing to commit/.test(text)) return 'Nothing to commit: everything in this square is committed already.'
|
|
281
|
-
const c = rec && rec.result
|
|
282
|
-
if (!c) return text
|
|
283
|
-
const n = Array.isArray(c.changes) ? c.changes.length : 0
|
|
284
|
-
return [`Committed "${String(c.message || '').split('\n')[0]}"${n ? `: ${plural(n, 'file')}` : ''}.`, ...careful].join(' ')
|
|
285
|
-
}
|
|
286
|
-
if (tool === 'seam_merge') {
|
|
287
|
-
if (!rec) return text
|
|
288
|
-
const moved = /carries on in a new square/.test(text) ? 'Your folder carries on in a new square on main\'s new version: keep working as before.' : ''
|
|
289
|
-
if (rec.ok && rec.merged) {
|
|
290
|
-
const m = rec.merged
|
|
291
|
-
const combined = (rec.combined || []).map((c) => c.path)
|
|
292
|
-
return [`Merged onto ${m.line || 'main'} as patch ${m.patch_no}${m.subject ? ` "${m.subject}"` : ''}.`, combined.length ? `Combined with changes already on ${m.line || 'main'} in ${names(combined)}.` : '', ...careful, moved].filter(Boolean).join(' ')
|
|
293
|
-
}
|
|
294
|
-
const terms = (rec.terms || []).map((t) => t.path)
|
|
295
|
-
const why = rec.refused ? rec.refused.detail : rec.error || 'Seam refused'
|
|
296
|
-
return [`Not merged: ${why}.`, terms.length ? `${plural(terms.length, 'file')} ${terms.length === 1 ? 'conflicts' : 'conflict'} with main and ${terms.length === 1 ? 'is' : 'are'} marked in your folder (${names(terms)}): settle ${terms.length === 1 ? 'it' : 'them'}, commit, and merge again.` : ''].filter(Boolean).join(' ')
|
|
297
|
-
}
|
|
298
|
-
return text
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* The words for a session that stopped by itself (the relay sent this app away, its owner ended it, ...):
|
|
303
|
-
* `session` the app's record of it (for its name), `why` what Quilt was told.
|
|
304
|
-
*/
|
|
305
|
-
export function stoppedWords (session, why) {
|
|
306
|
-
const st = session && session.status
|
|
307
|
-
const name = (st && st.sessionName) || (session && session.dir ? String(session.dir).split(/[\\/]/).filter(Boolean).pop() : '') || 'The session'
|
|
308
|
-
return `${name} stopped: ${String(why || '').replace(/^Relay refused connection: /, '')}`
|
|
309
|
-
}
|