heyquilt 0.3.195 → 0.3.197
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RELEASES.md +19 -0
- package/package.json +1 -1
- package/src/chat-links.js +44 -8
- package/src/discard.js +119 -0
- package/src/gitstate.js +29 -1
- package/src/merge3.js +8 -0
- package/src/server.js +4 -3
- package/src/session.js +187 -13
- package/src/setup.js +5 -1
- package/src/ui/agent-guide.js +1 -1
- package/src/ui/app.css +45 -9
- package/src/ui/app.js +77 -96
- package/src/ui/invite.js +7 -4
- package/src/ui/projects.js +14 -14
- package/src/ui/session.js +8 -11
- package/src/ui-server.js +1 -1
package/RELEASES.md
CHANGED
|
@@ -11,6 +11,25 @@ Format: `## <version> — <YYYY-MM-DD>`, an optional one-line summary, then bull
|
|
|
11
11
|
Lead each bullet with a short bold phrase. Inline `code` and **bold** are rendered;
|
|
12
12
|
nothing else is.
|
|
13
13
|
|
|
14
|
+
## 0.3.197 — 2026-11-24
|
|
15
|
+
|
|
16
|
+
- **One short invite.** A codebase's Invite is two tiles: a person (Copy invite link) and an AI (Copy prompt). There is nothing to pick first: no edit or view-only link, no "Invite as", no kinds of AI. Under them the owner can still let someone straight in by their email, or by picking someone they have worked with; invites still waiting sit beside them. A view-only link is one quiet line at the bottom.
|
|
17
|
+
- **One prompt for any AI.** The prompt works in Claude Code, Cursor, Codex or any other tool, and in a chat window such as ChatGPT: it carries a chat link for an AI that can only open web pages. That AI joins the codebase only when it opens the link, so nobody extra shows on the member list before then.
|
|
18
|
+
- **An empty codebase's invite card shows one link too.**
|
|
19
|
+
|
|
20
|
+
## 0.3.196 — 2026-11-23
|
|
21
|
+
|
|
22
|
+
Git can throw away only your own uncommitted work.
|
|
23
|
+
|
|
24
|
+
- **A reset or a restore takes out only your own work.** Your folder holds everyone's uncommitted work on the branch you are on. When git puts files back as the last commit has them (`git reset --hard`, `git restore`, `git checkout -- <file>`), your own uncommitted changes go, for everyone, as you asked. Your partners' changes are written back into your files, and nobody else's folder loses anything. Before, their lines could be taken out of everyone's folder, and a second reset always took them.
|
|
25
|
+
- **Quilt says whose work stayed.** You and your AI are told which files still differ from the commit and whose changes are in them. A change with no author on record stays when someone else has also changed that file.
|
|
26
|
+
- **`git reset --hard <commit>` carries your partners' work along.** Their uncommitted changes are put onto the commit you reset to. Where the commits changed the same lines, the file stays as the codebase has it.
|
|
27
|
+
- **A stash is all or nothing.** `git stash` with only your own work does what git does: your partners see it go, and `git stash pop` brings it back. When a stashed file also holds someone else's work, every stashed file goes back as it was and nothing is shared. The stash keeps its copy: `git stash drop` removes it.
|
|
28
|
+
- **A stash that pops into a conflict is not shared.** The file keeps git's conflict markers in your folder only. Once you have settled them and saved, it is shared, with what your partners changed meanwhile merged in.
|
|
29
|
+
- **A commit that took in someone else's work says so.** After a commit, you and your AI are told which of its files held uncommitted work that was not yours, and whose, with how to undo the commit if you didn't mean it. Nothing is refused.
|
|
30
|
+
- **Quilt's own folder stays out of git.** `.quilt/` is kept out of `git status`, `git add -A`, `git stash -u` and `git clean` in every folder that is a git clone, not only the ones Quilt set up. It is listed in `.git/info/exclude`, on your computer only.
|
|
31
|
+
- **The sidebar's button stays in one place.** A small chip on the edge of the strip of projects, halfway down the window, hides the sidebar and shows it again. It replaces the row at the bottom of the sidebar and the button in the header.
|
|
32
|
+
|
|
14
33
|
## 0.3.195 — 2026-11-23
|
|
15
34
|
|
|
16
35
|
- **A project's channels inside a codebase.** A codebase's sidebar lists its project's channels after its own, with the plus to make one, and what is new in each. A channel opens on the codebase's page, so you stay where you are.
|
package/package.json
CHANGED
package/src/chat-links.js
CHANGED
|
@@ -39,6 +39,10 @@ export const CHAT_LINK_MAX_MINUTES = 30 * 24 * 60
|
|
|
39
39
|
const MINUTE = 60 * 1000
|
|
40
40
|
export const CHAT_ADD_MAX_BYTES = 5 * 1024 * 1024
|
|
41
41
|
const MAX_LINKS = 20 // per session
|
|
42
|
+
// A link made ahead, inside an AI's invite, before anyone knows a chat AI will use it: it can
|
|
43
|
+
// be opened for this long, and a session keeps this many (the oldest goes for a new one).
|
|
44
|
+
export const CHAT_LINK_WAIT_MINUTES = 60
|
|
45
|
+
const MAX_WAITING = 20
|
|
42
46
|
const MAX_TEXT = 4000 // a message, a task title is shorter (tasks.js)
|
|
43
47
|
const MAX_NOTE = 20000
|
|
44
48
|
const MAX_READ = 100 * 1024
|
|
@@ -56,23 +60,54 @@ const memberId = (id) => `chat:${id}`
|
|
|
56
60
|
/** Minutes asked for, kept between one and CHAT_LINK_MAX_MINUTES (CHAT_LINK_DEFAULT_MINUTES when not given). */
|
|
57
61
|
const minutesOf = (minutes) => Math.min(Math.max(Math.round(Number(minutes)) || CHAT_LINK_DEFAULT_MINUTES, 1), CHAT_LINK_MAX_MINUTES)
|
|
58
62
|
|
|
59
|
-
|
|
63
|
+
/** `wanted`, or it with a number after, so it is not the name of anyone already in the session. */
|
|
64
|
+
function freeName (room, wanted) {
|
|
65
|
+
const taken = new Set([...Object.values(room.meta.members || {}).map((m) => m && m.name), ...Object.keys(room.meta.identities || {})])
|
|
66
|
+
let label = wanted
|
|
67
|
+
for (let n = 2; taken.has(label); n++) label = `${wanted} ${n}`
|
|
68
|
+
return label
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const chatMember = (l, now) => ({ name: l.name, kind: 'agent', role: 'editor', scopes: [], scopesExcept: [], talk: true, since: now, chat: true, expiresAt: l.expiresAt })
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Makes a chat link in `room` (someone who may let people in asked). Returns { id, token, name, expiresAt }.
|
|
75
|
+
* `waiting`: made ahead, inside an AI's invite. Nobody joins yet: the link can be opened for
|
|
76
|
+
* CHAT_LINK_WAIT_MINUTES, and whoever opens it first joins then, its minutes counting from that moment.
|
|
77
|
+
*/
|
|
78
|
+
export function makeChatLink (room, { name, minutes, by, waiting = false } = {}, now = Date.now()) {
|
|
60
79
|
const links = room.meta.chatLinks = pruneChatLinks(room, now)
|
|
61
|
-
if (Object.
|
|
80
|
+
if (!waiting && Object.values(links).filter((l) => !l.waiting).length >= MAX_LINKS) throw new Error(`a codebase can have ${MAX_LINKS} chat links at most; remove one first`)
|
|
62
81
|
const id = crypto.randomBytes(6).toString('hex')
|
|
63
82
|
const token = crypto.randomBytes(24).toString('base64url')
|
|
64
83
|
const wanted = String(name || '').replace(/[\u0000-\u001f\u007f]+/g, ' ').trim().slice(0, 40) || 'Chat AI'
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
84
|
+
if (waiting) {
|
|
85
|
+
const ahead = Object.entries(links).filter(([, l]) => l.waiting).sort((x, y) => x[1].createdAt - y[1].createdAt)
|
|
86
|
+
while (ahead.length >= MAX_WAITING) delete links[ahead.shift()[0]]
|
|
87
|
+
const expiresAt = now + CHAT_LINK_WAIT_MINUTES * MINUTE
|
|
88
|
+
links[hashToken(token)] = { id, name: wanted, by: String(by || ''), createdAt: now, expiresAt, waiting: minutesOf(minutes) }
|
|
89
|
+
room.saveMeta()
|
|
90
|
+
return { id, token, name: wanted, expiresAt, waiting: true }
|
|
91
|
+
}
|
|
92
|
+
const label = freeName(room, wanted)
|
|
69
93
|
const expiresAt = now + minutesOf(minutes) * MINUTE
|
|
70
94
|
links[hashToken(token)] = { id, name: label, by: String(by || ''), createdAt: now, expiresAt }
|
|
71
|
-
room.meta.members[memberId(id)] =
|
|
95
|
+
room.meta.members[memberId(id)] = chatMember(links[hashToken(token)], now)
|
|
72
96
|
room.saveMeta()
|
|
73
97
|
return { id, token, name: label, expiresAt }
|
|
74
98
|
}
|
|
75
99
|
|
|
100
|
+
/** A link made ahead is opened for the first time: it joins now, under a free name, for the minutes it was made with. False when the session has all the chat links it may. */
|
|
101
|
+
function startChatLink (room, l, now) {
|
|
102
|
+
if (Object.values(room.meta.chatLinks).filter((x) => x && !x.waiting).length >= MAX_LINKS) return false
|
|
103
|
+
l.name = freeName(room, l.name)
|
|
104
|
+
l.expiresAt = now + l.waiting * MINUTE
|
|
105
|
+
delete l.waiting
|
|
106
|
+
room.meta.members[memberId(l.id)] = chatMember(l, now)
|
|
107
|
+
room.saveMeta()
|
|
108
|
+
return true
|
|
109
|
+
}
|
|
110
|
+
|
|
76
111
|
/**
|
|
77
112
|
* The owner sets how long a chat link still works: `minutes` from now (shorter or longer).
|
|
78
113
|
* Only a link that still works: one that ran out is gone, and a new one is needed.
|
|
@@ -92,7 +127,7 @@ export function pruneChatLinks (room, now = Date.now()) {
|
|
|
92
127
|
const links = room.meta.chatLinks || {}
|
|
93
128
|
let changed = false
|
|
94
129
|
for (const [k, l] of Object.entries(links)) {
|
|
95
|
-
const gone = !l || l.expiresAt <= now || !room.meta.members[memberId(l.id)]
|
|
130
|
+
const gone = !l || l.expiresAt <= now || (!l.waiting && !room.meta.members[memberId(l.id)]) // one made ahead has no member until it is opened
|
|
96
131
|
if (!gone) continue
|
|
97
132
|
delete links[k]
|
|
98
133
|
if (l && room.meta.members[memberId(l.id)]?.chat) delete room.meta.members[memberId(l.id)]
|
|
@@ -107,6 +142,7 @@ export function findChatLink (room, token, now = Date.now()) {
|
|
|
107
142
|
if (!room || !room.meta.chatLinks) return null
|
|
108
143
|
const l = pruneChatLinks(room, now)[hashToken(token)]
|
|
109
144
|
if (!l) return null
|
|
145
|
+
if (l.waiting && !startChatLink(room, l, now)) return null
|
|
110
146
|
return { ...l, member: room.meta.members[memberId(l.id)], memberId: memberId(l.id) }
|
|
111
147
|
}
|
|
112
148
|
|
package/src/discard.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// What git throwing a file's uncommitted work away means in a session. A folder holds everyone's
|
|
2
|
+
// uncommitted work on its branch, so when git puts a file back as a commit has it (a reset, a restore,
|
|
3
|
+
// a checkout of the file, a stash), only the work of the folder's own member goes; everyone else's
|
|
4
|
+
// stays (2026-11-22, Daniel: the folder threw work away, the person did not delete those lines).
|
|
5
|
+
//
|
|
6
|
+
// Whose a change is comes from the session's history (history.js): each entry has who made it and the
|
|
7
|
+
// lines it added and removed. Read with care, since a wrong "yours" loses someone's work and a wrong
|
|
8
|
+
// "theirs" only leaves a change in the file:
|
|
9
|
+
//
|
|
10
|
+
// theirs a line of the change was last added or removed by someone else
|
|
11
|
+
// yours a line of it was last added or removed by you, and no one else's entry has that line
|
|
12
|
+
// unknown nothing on record for it (the history is capped): yours only when nobody else has an
|
|
13
|
+
// entry for the file at all
|
|
14
|
+
import { diffLines } from './textdiff.js'
|
|
15
|
+
|
|
16
|
+
const lines = (s) => String(s).split('\n')
|
|
17
|
+
/** A line that says whose a change is: not blank, not only brackets and punctuation. */
|
|
18
|
+
const telling = (l) => l.replace(/[\s{}()[\];,]/g, '').length >= 2
|
|
19
|
+
/** At most this many names in a message. */
|
|
20
|
+
export const MAX_NAMES = 3
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* `session` (a file as the session has it) without the uncommitted changes `me` made to `head` (the
|
|
24
|
+
* same file as git's commit has it); null for either: no file there. `entries`: the file's history,
|
|
25
|
+
* oldest first. `binary`: no lines to tell apart, so the file is one change, its newest entry's.
|
|
26
|
+
* Returns { text, mine, kept, others, unknown }: `text` is what the file should hold (null: no file),
|
|
27
|
+
* `mine` the changes taken out, `kept` the ones left in, `others` whose those are (names, in the
|
|
28
|
+
* order they come) and `unknown` how many of them nobody is on record for.
|
|
29
|
+
* A file new to git or gone from the session is one change: all of it goes, or none.
|
|
30
|
+
*/
|
|
31
|
+
export function withoutMine ({ head = null, session = null, entries = [], me, binary = false }) {
|
|
32
|
+
const log = [...entries].reverse().filter((e) => e && !e.pulled && e.by)
|
|
33
|
+
const strangers = log.some((e) => e.by !== me)
|
|
34
|
+
if (binary) {
|
|
35
|
+
const mine = log.length ? log[0].by === me : true
|
|
36
|
+
return mine ? { text: head, mine: 1, kept: 0, others: [], unknown: 0 } : { text: session, mine: 0, kept: 1, others: [log[0].by], unknown: 0 }
|
|
37
|
+
}
|
|
38
|
+
const diffs = log.filter((e) => typeof e.diff === 'string' && e.diff).map((e) => ({ by: e.by, lines: new Set(e.diff.split('\n')) }))
|
|
39
|
+
const author = (signed) => { const e = diffs.find((x) => x.lines.has(signed)); return e ? e.by : null }
|
|
40
|
+
const noOneElses = (signed) => !diffs.some((x) => x.by !== me && x.lines.has(signed))
|
|
41
|
+
const a = head === null ? [] : lines(head)
|
|
42
|
+
const b = session === null ? [] : lines(session)
|
|
43
|
+
const others = []
|
|
44
|
+
let unknown = 0
|
|
45
|
+
const hunks = diffLines(a, b).map((h) => {
|
|
46
|
+
const signed = [...h.buffer1Content.filter(telling).map((l) => `-${l}`), ...h.buffer2Content.filter(telling).map((l) => `+${l}`)]
|
|
47
|
+
const who = signed.map(author)
|
|
48
|
+
const theirs = [...new Set(who.filter((n) => n && n !== me))]
|
|
49
|
+
let mine
|
|
50
|
+
if (theirs.length) mine = false
|
|
51
|
+
else if (who.some(Boolean)) mine = signed.some((s, i) => who[i] === me && noOneElses(s))
|
|
52
|
+
else mine = !strangers
|
|
53
|
+
if (!mine) {
|
|
54
|
+
for (const n of theirs) if (!others.includes(n)) others.push(n)
|
|
55
|
+
if (!theirs.length) unknown++
|
|
56
|
+
}
|
|
57
|
+
return { ...h, mine }
|
|
58
|
+
})
|
|
59
|
+
const mine = hunks.filter((h) => h.mine).length
|
|
60
|
+
const kept = hunks.length - mine
|
|
61
|
+
if (!kept) return { text: head, mine, kept: 0, others: [], unknown: 0 }
|
|
62
|
+
// No file at one end: nothing to put a part of the change back onto.
|
|
63
|
+
if (head === null || session === null || !mine) return { text: session, mine: 0, kept: hunks.length, others, unknown }
|
|
64
|
+
const out = []
|
|
65
|
+
let at = 0
|
|
66
|
+
for (const h of hunks) {
|
|
67
|
+
const [start, n] = h.buffer2
|
|
68
|
+
out.push(...b.slice(at, start), ...(h.mine ? h.buffer1Content : b.slice(start, start + n)))
|
|
69
|
+
at = start + n
|
|
70
|
+
}
|
|
71
|
+
out.push(...b.slice(at))
|
|
72
|
+
return { text: out.join('\n'), mine, kept, others, unknown }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** "Ada", "Ada and Brandon", "Ada, Brandon and 2 others"; "someone else" for nobody known. */
|
|
76
|
+
export function whose (names) {
|
|
77
|
+
if (!names.length) return 'someone else'
|
|
78
|
+
if (names.length === 1) return names[0]
|
|
79
|
+
if (names.length <= MAX_NAMES) return `${names.slice(0, -1).join(', ')} and ${names.at(-1)}`
|
|
80
|
+
return `${names.slice(0, MAX_NAMES - 1).join(', ')} and ${names.length - MAX_NAMES + 1} others`
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const some = (paths) => paths.slice(0, 3).join(', ') + (paths.length > 3 ? ` and ${paths.length - 3} more` : '')
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* What a member is told after git put files back and other people's uncommitted work stayed.
|
|
87
|
+
* `files`: [{ path, mine, kept, others, unknown }] for each file with work left in it; `stash`: the
|
|
88
|
+
* work was stashed (then every file is back as it was, `mine` 0).
|
|
89
|
+
*/
|
|
90
|
+
export function discardNotice (files, { stash = false } = {}) {
|
|
91
|
+
if (!files.length) return ''
|
|
92
|
+
const names = []
|
|
93
|
+
for (const f of files) for (const n of f.others) if (!names.includes(n)) names.push(n)
|
|
94
|
+
const unknown = files.some((f) => f.unknown)
|
|
95
|
+
const who = names.length ? `${whose(names)}'s${unknown ? ' (and some Quilt has no author on record for)' : ''}` : 'not on record as yours'
|
|
96
|
+
const list = some(files.map((f) => f.path))
|
|
97
|
+
const why = 'This folder holds everyone\'s uncommitted work on this branch, and git can only throw away your own.'
|
|
98
|
+
if (stash) {
|
|
99
|
+
return `git stash set work aside here, but ${list} ${files.length === 1 ? 'has' : 'have'} uncommitted changes that are ${who}, so Quilt put every stashed file back as it was: nothing was shared and nothing is lost. ${why} The stash still holds a copy: remove it with \`git stash drop\`. To change branch, use \`git checkout -f <branch>\`.`
|
|
100
|
+
}
|
|
101
|
+
const part = files.filter((f) => f.mine)
|
|
102
|
+
const whole = files.filter((f) => !f.mine)
|
|
103
|
+
const said = []
|
|
104
|
+
if (part.length) said.push(`your own uncommitted changes to ${some(part.map((f) => f.path))} are gone, and the rest ${part.length === 1 ? 'is' : 'are'} still in ${part.length === 1 ? 'it' : 'them'}`)
|
|
105
|
+
if (whole.length) said.push(`${some(whole.map((f) => f.path))} ${whole.length === 1 ? 'is' : 'are'} back as ${whole.length === 1 ? 'it was' : 'they were'}`)
|
|
106
|
+
return `git put ${list} back as the commit has ${files.length === 1 ? 'it' : 'them'}, but the uncommitted changes there are ${who}: ${said.join('; ')}. Nothing of theirs was lost. ${why} To take a change of theirs out, edit the file.`
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** What a member is told when its commit took in work that is not its own. `files`: [{ path, others }]. */
|
|
110
|
+
export function commitNotice (sha, files) {
|
|
111
|
+
if (!files.length) return ''
|
|
112
|
+
const list = files.slice(0, 4).map((f) => `${f.path} (${whose(f.others)})`).join(', ') + (files.length > 4 ? ` and ${files.length - 4} more` : '')
|
|
113
|
+
return `Your commit ${String(sha).slice(0, 7)} took in uncommitted work that is not yours: ${list}. That is fine if you meant to commit it for them. If not, undo the commit with \`git reset --soft HEAD@{1}\`, stage only your own changes (\`git add -p\`) and commit again.`
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** What a member is told when git left a conflict in a file of this folder (a stash popped onto lines that changed since). */
|
|
117
|
+
export function gitConflictNotice (p) {
|
|
118
|
+
return `⚖️ git left a conflict in ${p} (a stash applied onto lines that changed since): it has git's conflict markers ("<<<<<<<", "=======", ">>>>>>>"), so it is not shared yet and nobody's later change is written over it. Edit ${p} to what it should be, delete the marker lines and save: it is shared then.`
|
|
119
|
+
}
|
package/src/gitstate.js
CHANGED
|
@@ -315,6 +315,32 @@ export async function treeState (root, paths) {
|
|
|
315
315
|
return { dirty, unmerged, tracked: new Set(listed.split('\0').filter(Boolean)) }
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
+
/** How many stashes git holds here (0: none); null when git can't be run. */
|
|
319
|
+
export async function stashCount (root) {
|
|
320
|
+
const r = await call(root, ['rev-list', '-g', '--count', 'refs/stash'])
|
|
321
|
+
if (r.missing || r.timedOut) return null
|
|
322
|
+
const n = r.out === null ? 0 : Number(r.out.trim()) // no refs/stash: git fails, and there are none
|
|
323
|
+
return Number.isInteger(n) ? n : null
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/** What last moved HEAD, in git's own words ("commit: …", "reset: moving to …", "pull: Fast-forward"); '' when git can't say. */
|
|
327
|
+
export async function lastMove (root) {
|
|
328
|
+
const out = await run(root, ['reflog', '-1', '--format=%gs'])
|
|
329
|
+
return out ? out.trim() : ''
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* The paths git has a conflict open on: unmerged in its index, as a stash popped onto changed lines
|
|
334
|
+
* leaves them (no merge is under way then, so `busy` says nothing). Null when git fails.
|
|
335
|
+
*/
|
|
336
|
+
export async function unmergedPaths (root) {
|
|
337
|
+
const out = await run(root, ['ls-files', '-u', '-z'])
|
|
338
|
+
if (out === null) return null
|
|
339
|
+
const paths = new Set()
|
|
340
|
+
for (const e of out.split('\0')) { const i = e.indexOf('\t'); if (i >= 0) paths.add(e.slice(i + 1)) }
|
|
341
|
+
return paths
|
|
342
|
+
}
|
|
343
|
+
|
|
318
344
|
/**
|
|
319
345
|
* Watches the folder's .git for HEAD moving, the index being written and git starting or
|
|
320
346
|
* finishing work (see busy); events: head, index, busy, idle.
|
|
@@ -550,9 +576,11 @@ export async function cloneRepo (url, dir) {
|
|
|
550
576
|
|
|
551
577
|
/** Git never offers Quilt's own state in a folder (.quilt/) for a commit: said in the repository's own exclude file, which is not shared. */
|
|
552
578
|
export function keepQuiltOut (root) {
|
|
553
|
-
|
|
579
|
+
let dir = gitDir(root)
|
|
554
580
|
if (!dir) return
|
|
555
581
|
try {
|
|
582
|
+
// A worktree's own .git has no exclude file git reads: the repository's (its `commondir`) is the one.
|
|
583
|
+
try { dir = path.resolve(dir, fs.readFileSync(path.join(dir, 'commondir'), 'utf8').trim()) } catch {}
|
|
556
584
|
const file = path.join(dir, 'info', 'exclude')
|
|
557
585
|
let text = ''
|
|
558
586
|
try { text = fs.readFileSync(file, 'utf8') } catch {}
|
package/src/merge3.js
CHANGED
|
@@ -92,6 +92,14 @@ export function hasMarkers (text) {
|
|
|
92
92
|
return typeof text === 'string' && text.split('\n').some((l) => l.startsWith(`${MARK.start} (`) || l.startsWith(`${MARK.end} (`))
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/** True when the text holds a conflict as git writes one: a line starting "<<<<<<< " and, after it, one starting ">>>>>>> ". */
|
|
96
|
+
export function hasGitMarkers (text) {
|
|
97
|
+
if (typeof text !== 'string') return false
|
|
98
|
+
const ls = text.split('\n')
|
|
99
|
+
const start = ls.findIndex((l) => l.startsWith('<<<<<<< '))
|
|
100
|
+
return start >= 0 && ls.slice(start + 1).some((l) => l.startsWith('>>>>>>> '))
|
|
101
|
+
}
|
|
102
|
+
|
|
95
103
|
/**
|
|
96
104
|
* merge3, plus the clashes where neither side lost anything, resolved the way a person would:
|
|
97
105
|
* - both sides only added lines in the same place (base had nothing there): ours, then theirs,
|
package/src/server.js
CHANGED
|
@@ -1365,9 +1365,10 @@ class Room {
|
|
|
1365
1365
|
if (req.op === 'chatlink') {
|
|
1366
1366
|
// A link a chat-only AI (ChatGPT, claude.ai, Grok…) works through by opening pages (chat-links.js).
|
|
1367
1367
|
// It joins as a member of its own; the token is in this reply only, to whoever asked.
|
|
1368
|
-
|
|
1369
|
-
this
|
|
1370
|
-
|
|
1368
|
+
// `waiting`: made ahead, inside an AI's invite: nobody joins until an AI opens it.
|
|
1369
|
+
const l = makeChatLink(this, { name: req.name, minutes: req.minutes, by: me.name, waiting: req.waiting === true })
|
|
1370
|
+
this.log(`[${this.name}] chat link made for ${l.name}${l.waiting ? ' (waiting to be opened)' : ''}`)
|
|
1371
|
+
return { ok: true, token: l.token, name: l.name, expiresAt: l.expiresAt, ...(l.waiting ? { waiting: true } : {}) }
|
|
1371
1372
|
}
|
|
1372
1373
|
if (req.op === 'chatextend') {
|
|
1373
1374
|
// How long a chat link still works, from now. One that ran out is gone: a new link is needed.
|
package/src/session.js
CHANGED
|
@@ -41,7 +41,8 @@ import { MentionRunner, parseOnMention, readOnMention, writeOnMention } from './
|
|
|
41
41
|
import { pickChecklist } from './agent-task-workflow.js'
|
|
42
42
|
import { changeRefusal, TALK_REFUSED } from './session-access.js'
|
|
43
43
|
import { canAdmit } from './admit-policy.js'
|
|
44
|
-
import { merge3, mergeAuto, hasMarkers, mergeLive } from './merge3.js'
|
|
44
|
+
import { merge3, mergeAuto, hasMarkers, hasGitMarkers, mergeLive } from './merge3.js'
|
|
45
|
+
import { withoutMine, discardNotice, commitNotice, gitConflictNotice } from './discard.js'
|
|
45
46
|
import { sameEditClient, asClient } from './same-edit.js'
|
|
46
47
|
import { openMerge, updateMerge, readMerges, pruneMerges, cleanName } from './merges.js'
|
|
47
48
|
import { LiveRules, applyMine, findUses, removedNameWarning, clashNotice, clashStillNotice } from './live-merge.js'
|
|
@@ -54,7 +55,7 @@ import { RELAY_NAME as RELAY_BY, isRelay } from './ui/chat.js'
|
|
|
54
55
|
import { cleanTyping, TYPING_MS, AGENT_TYPING_MS } from './ui/chat.js'
|
|
55
56
|
import { DEFAULT_KEY, validBranchKey } from './branchdocs.js'
|
|
56
57
|
import { cleanPreview, previewId, previewList, previewsView, branchChoices, hasDevScript, cleanLooking, cleanRunning, describePreviews, APP_ID, MAX_PREVIEWS } from './previews.js'
|
|
57
|
-
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'
|
|
58
|
+
import { headKey, headName, branchTip, busy as gitBusy, leftoverLock, indexStamp, filesAt, blobAt, treeState, watchGit, stashCount, lastMove, unmergedPaths, keepQuiltOut, 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'
|
|
58
59
|
import { shareableRemote, repoLabel } from './repo-ref.js'
|
|
59
60
|
import { cleanVoice, cleanDmVoice, dmVoiceView, dmCallers, 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'
|
|
60
61
|
import { toolInUse } from './agents/common.js'
|
|
@@ -377,8 +378,8 @@ export class Session extends EventEmitter {
|
|
|
377
378
|
this.hold = null // { kind: 'busy'|'switching', since, to?, waiting? } while this folder's sync is held (git at work; moving to another branch)
|
|
378
379
|
this.upstreamAfterHold = null // a look at the upstream asked while held ({ fetch }): asked again when the hold ends
|
|
379
380
|
this.heldPaths = new Set() // paths that changed (here or in the room) while held
|
|
380
|
-
this.
|
|
381
|
-
this.stashSeen =
|
|
381
|
+
this.gitConflicts = new Map() // path -> its text with git's conflict markers, as last told (null: not yet): not shared until they are gone (gitWork)
|
|
382
|
+
this.stashSeen = undefined // how many stashes git had when the folder was last quiet (undefined: not read yet): one more by the settle means the person stashed
|
|
382
383
|
this.headChangedAt = 0
|
|
383
384
|
this.settleTimer = null
|
|
384
385
|
this.savedGit = null // { key, sha } from state.json: the branch this folder synced at the last stop
|
|
@@ -1607,8 +1608,10 @@ export class Session extends EventEmitter {
|
|
|
1607
1608
|
// the session. While git is at work in the folder (its index lock is there, or a rebase or a
|
|
1608
1609
|
// bisect has HEAD off its branch) and while a move is under way, the folder's sync is held:
|
|
1609
1610
|
// nothing is taken in and nothing from the session is written out. Git work that leaves the
|
|
1610
|
-
// folder on its branch (a commit, a
|
|
1611
|
-
// made, like any other change to the files
|
|
1611
|
+
// folder on its branch (a commit, a pull, a stash popped) is shared afterwards as the edits it
|
|
1612
|
+
// made, like any other change to the files, with one exception: git putting files back as a
|
|
1613
|
+
// commit has them (a reset, a restore, a stash) throws away only this member's own uncommitted
|
|
1614
|
+
// work, and everyone else's is written back (gitWork, discard.js).
|
|
1612
1615
|
|
|
1613
1616
|
/**
|
|
1614
1617
|
* Where git has the folder now: { key, branch, sha } (a branch, or a detached commit keyed `@<sha>`).
|
|
@@ -1744,6 +1747,11 @@ export class Session extends EventEmitter {
|
|
|
1744
1747
|
this.followHead(head.key)
|
|
1745
1748
|
return
|
|
1746
1749
|
}
|
|
1750
|
+
// What git did to the files it wrote, read before anything is changed: a file put back as a commit has it is
|
|
1751
|
+
// uncommitted work thrown away, which is no edit of the session's text (gitWork).
|
|
1752
|
+
const work = await this.gitWork([...this.heldPaths], this.git, head)
|
|
1753
|
+
if (!this.settleable()) return
|
|
1754
|
+
if (this.gitBusy() || gen !== this.settleGen || head.key !== headName(this.root)) { this.settleHoldSoon(); return }
|
|
1747
1755
|
this.git = head
|
|
1748
1756
|
this.gitSeen = head
|
|
1749
1757
|
// What git wrote is accounted for here: the next flush is an edit unless git moves again.
|
|
@@ -1755,7 +1763,152 @@ export class Session extends EventEmitter {
|
|
|
1755
1763
|
if (this.rejoin) for (const rel of [...this.sharedPaths(), ...walk(this.root, this.ig)]) late.add(rel)
|
|
1756
1764
|
this.rejoin = false
|
|
1757
1765
|
this.releaseHold()
|
|
1758
|
-
this.resumeHeld([...late])
|
|
1766
|
+
this.resumeHeld([...late], work)
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
/**
|
|
1770
|
+
* What git did in this folder while it was held, for the `paths` that changed (`was`, `head`: where HEAD
|
|
1771
|
+
* was before and is now, on the same branch). Nothing is changed here: resumeHeld acts on it once the hold
|
|
1772
|
+
* is known to be over.
|
|
1773
|
+
* discards rel -> { key, shared, put, info }: git put the file back as a commit has it (a reset, a
|
|
1774
|
+
* restore, a checkout of the file, a stash) while the session has uncommitted work in it. `put`
|
|
1775
|
+
* is what the file gets: the session's version without this member's own changes (discard.js).
|
|
1776
|
+
* After `git reset --hard <commit>`, everyone else's work is carried onto the new commit's
|
|
1777
|
+
* version; where it can't be (the same lines), the session's version stays.
|
|
1778
|
+
* stash the work was stashed: then no file loses anything unless every one can (a stash that came
|
|
1779
|
+
* back in part could not be popped)
|
|
1780
|
+
* unmerged the paths git has a conflict open on (a stash popped onto changed lines)
|
|
1781
|
+
* commit { sha, files: [{ path, others }] }: this folder's commit took in other people's uncommitted work
|
|
1782
|
+
*/
|
|
1783
|
+
async gitWork (paths, was, head) {
|
|
1784
|
+
const work = { discards: new Map(), stash: false, stashes: undefined, unmerged: null, commit: null }
|
|
1785
|
+
if (!head || !head.sha) return work
|
|
1786
|
+
work.stashes = await stashCount(this.root)
|
|
1787
|
+
work.stash = typeof this.stashSeen === 'number' && typeof work.stashes === 'number' && work.stashes > this.stashSeen
|
|
1788
|
+
work.unmerged = await unmergedPaths(this.root)
|
|
1789
|
+
const moved = !!(was && was.sha && was.sha !== head.sha)
|
|
1790
|
+
const move = moved ? await lastMove(this.root) : ''
|
|
1791
|
+
const isText = (k) => k === null || (typeof k === 'string' && !/^bin:[0-9a-f]{40}$/.test(k))
|
|
1792
|
+
const history = () => {
|
|
1793
|
+
const by = new Map()
|
|
1794
|
+
for (const e of this.history.entries()) { if (!by.has(e.path)) by.set(e.path, []); by.get(e.path).push(e) }
|
|
1795
|
+
return by
|
|
1796
|
+
}
|
|
1797
|
+
const cands = []
|
|
1798
|
+
for (const rel of paths) {
|
|
1799
|
+
if (!this.syncable(rel) || this.merging.has(rel) || this.followsGit(rel) || this.clashed.has(rel) || this.relayWriting.has(rel)) continue
|
|
1800
|
+
let disk
|
|
1801
|
+
try { disk = this.readDisk(rel) } catch { continue }
|
|
1802
|
+
if (disk && (disk.skip || disk.tooLarge)) continue
|
|
1803
|
+
const key = disk ? disk.key : undefined
|
|
1804
|
+
const shared = this.sharedKey(rel)
|
|
1805
|
+
// As this folder last had it (git didn't touch it), or as the session has it: nothing was thrown away.
|
|
1806
|
+
if (key === this.lastKnown.get(rel) || key === shared) continue
|
|
1807
|
+
cands.push({ rel, key, shared })
|
|
1808
|
+
}
|
|
1809
|
+
if (cands.length) {
|
|
1810
|
+
const rels = cands.map((c) => c.rel)
|
|
1811
|
+
const now = await filesAt(this.root, head.sha, rels)
|
|
1812
|
+
const before = moved ? await filesAt(this.root, was.sha, rels) : now
|
|
1813
|
+
const entries = now && before ? history() : null
|
|
1814
|
+
for (const { rel, key, shared } of entries ? cands : []) {
|
|
1815
|
+
const [hNow, hWas] = [now.get(rel), before.get(rel)]
|
|
1816
|
+
if (hNow === undefined || hWas === undefined) continue // git couldn't read it
|
|
1817
|
+
if ((key ?? null) !== hNow) continue // not as the commit has it: an edit, taken in as one
|
|
1818
|
+
// The commit under it changed too: only a reset throws work away then (a commit of a save just made, or a pull, is what git brought).
|
|
1819
|
+
if (hNow !== hWas && !/^reset:/.test(move)) continue
|
|
1820
|
+
const session = shared ?? null
|
|
1821
|
+
if (session === hWas) continue // no uncommitted work in it
|
|
1822
|
+
const text = isText(hWas) && isText(session)
|
|
1823
|
+
const r = withoutMine({ head: hWas, session, entries: entries.get(rel) || [], me: this.name, binary: !text })
|
|
1824
|
+
let put = r.text
|
|
1825
|
+
if (hNow !== hWas) {
|
|
1826
|
+
if (!r.kept) put = hNow
|
|
1827
|
+
else {
|
|
1828
|
+
// Everyone else's work, made on the commit the branch left, goes onto the one it is at now.
|
|
1829
|
+
const m = text && typeof hWas === 'string' && typeof hNow === 'string' && typeof put === 'string' ? mergeLive(hWas, hNow, put) : null
|
|
1830
|
+
if (m && !m.held.length) put = m.text
|
|
1831
|
+
else { put = session; r.mine = 0 }
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
work.discards.set(rel, { key, shared, put, info: { path: rel, mine: r.mine, kept: r.kept, others: r.others, unknown: r.unknown } })
|
|
1835
|
+
}
|
|
1836
|
+
// Stashed, and someone else's work is in a stashed file: every file goes back as it was.
|
|
1837
|
+
if (work.stash && [...work.discards.values()].some((d) => d.info.kept)) {
|
|
1838
|
+
for (const d of work.discards.values()) { d.put = d.shared ?? null; d.info.mine = 0 }
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
if (moved && /^commit( \(amend\))?:/.test(move)) {
|
|
1842
|
+
const changes = await changesBetween(this.root, was.sha, head.sha)
|
|
1843
|
+
const rels = changes ? [...changes.keys()].filter((rel) => this.syncable(rel)).slice(0, 200) : []
|
|
1844
|
+
const [a, b] = rels.length ? [await filesAt(this.root, was.sha, rels), await filesAt(this.root, head.sha, rels)] : [null, null]
|
|
1845
|
+
if (a && b) {
|
|
1846
|
+
const entries = history()
|
|
1847
|
+
const files = []
|
|
1848
|
+
for (const rel of rels) {
|
|
1849
|
+
const [x, y] = [a.get(rel), b.get(rel)]
|
|
1850
|
+
if (!isText(x) || !isText(y)) continue
|
|
1851
|
+
const others = blameChange({ before: x ?? '', after: y ?? '', entries: entries.get(rel) || [] }).filter((n) => n !== this.name)
|
|
1852
|
+
if (others.length) files.push({ path: rel, others })
|
|
1853
|
+
}
|
|
1854
|
+
if (files.length) work.commit = { sha: head.sha, files }
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
return work
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
/**
|
|
1861
|
+
* Acts on what git did while the folder was held (gitWork), now that the hold is over. Returns the paths
|
|
1862
|
+
* dealt with here. A file that changed again since gitWork looked is left to resumeHeld, as any save.
|
|
1863
|
+
*/
|
|
1864
|
+
applyGitWork (work) {
|
|
1865
|
+
const done = new Set()
|
|
1866
|
+
if (typeof work.stashes === 'number') this.stashSeen = work.stashes
|
|
1867
|
+
if (work.unmerged) {
|
|
1868
|
+
for (const rel of work.unmerged) if (!this.gitConflicts.has(rel)) this.gitConflicts.set(rel, null)
|
|
1869
|
+
for (const rel of [...this.gitConflicts.keys()]) if (!work.unmerged.has(rel)) this.gitConflicts.delete(rel)
|
|
1870
|
+
}
|
|
1871
|
+
const told = []
|
|
1872
|
+
for (const [rel, d] of work.discards) {
|
|
1873
|
+
let disk
|
|
1874
|
+
try { disk = this.readDisk(rel) } catch { continue }
|
|
1875
|
+
if (disk && (disk.skip || disk.tooLarge || disk.unsettled)) continue
|
|
1876
|
+
const key = disk ? disk.key : undefined
|
|
1877
|
+
if (key !== d.key || this.sharedKey(rel) !== d.shared) continue
|
|
1878
|
+
done.add(rel)
|
|
1879
|
+
if (d.put === (d.shared ?? null)) {
|
|
1880
|
+
// Nothing of this member's in it: the session's version goes back on disk, and nothing is shared.
|
|
1881
|
+
if (key === undefined) this.lastKnown.delete(rel); else this.lastKnown.set(rel, key)
|
|
1882
|
+
this.tryWrite(rel)
|
|
1883
|
+
} else {
|
|
1884
|
+
// This member's own work goes, as an edit of the session's version made by them; the rest is written back.
|
|
1885
|
+
if (typeof d.put === 'string' && d.put !== key) {
|
|
1886
|
+
try {
|
|
1887
|
+
const abs = resolveInside(this.root, rel)
|
|
1888
|
+
const over = this.writeOver(rel, abs, d.put, disk)
|
|
1889
|
+
if (over === false) { done.delete(rel); continue } // saved again in that instant: taken in as a save
|
|
1890
|
+
if (over === null) this.writeFile(rel, abs, d.put)
|
|
1891
|
+
} catch (err) { this.log(`could not write ${rel}: ${err.message}`); continue }
|
|
1892
|
+
}
|
|
1893
|
+
if (d.shared === undefined) this.lastKnown.delete(rel); else this.lastKnown.set(rel, d.shared)
|
|
1894
|
+
// Made from the session's version as it is now, whatever older text it looks like (base-pick.js).
|
|
1895
|
+
if (typeof d.put === 'string') this.overwritten.told(rel, d.put)
|
|
1896
|
+
this.ingestAll([rel])
|
|
1897
|
+
}
|
|
1898
|
+
if (d.info.kept) told.push(d.info)
|
|
1899
|
+
}
|
|
1900
|
+
if (told.length) {
|
|
1901
|
+
told.sort((a, b) => (a.path < b.path ? -1 : 1))
|
|
1902
|
+
const text = discardNotice(told, { stash: work.stash })
|
|
1903
|
+
this.notice(text)
|
|
1904
|
+
this.log(`↩️ ${text}`)
|
|
1905
|
+
}
|
|
1906
|
+
if (work.commit) {
|
|
1907
|
+
const text = commitNotice(work.commit.sha, work.commit.files)
|
|
1908
|
+
this.notice(text)
|
|
1909
|
+
this.log(`📦 ${text}`)
|
|
1910
|
+
}
|
|
1911
|
+
return done
|
|
1759
1912
|
}
|
|
1760
1913
|
|
|
1761
1914
|
/**
|
|
@@ -1763,9 +1916,10 @@ export class Session extends EventEmitter {
|
|
|
1763
1916
|
* the disk is as Quilt left it, the session's version is written out; where it changed here (git
|
|
1764
1917
|
* rewrote it, or someone saved it), it is taken in as an edit, merged with the session's as any save is.
|
|
1765
1918
|
*/
|
|
1766
|
-
resumeHeld (paths) {
|
|
1919
|
+
resumeHeld (paths, work = null) {
|
|
1920
|
+
const done = work ? this.applyGitWork(work) : null
|
|
1767
1921
|
for (const rel of paths) {
|
|
1768
|
-
if (!this.syncable(rel) || this.merging.has(rel)) continue
|
|
1922
|
+
if (!this.syncable(rel) || this.merging.has(rel) || (done && done.has(rel))) continue
|
|
1769
1923
|
if (this.untouchedHere(rel)) this.tryWrite(rel)
|
|
1770
1924
|
else this.ingestAll([rel])
|
|
1771
1925
|
}
|
|
@@ -2289,6 +2443,9 @@ export class Session extends EventEmitter {
|
|
|
2289
2443
|
/** Watches the folder's .git: HEAD moving is looked at with the next flush, and git starting work holds the folder at once. */
|
|
2290
2444
|
startGitWatch () {
|
|
2291
2445
|
if (this.gitWatcher || !this.git) return
|
|
2446
|
+
// Quilt's own folder is never git's to add, stash or clean away (a clone made before Quilt kept it out, or joined from a terminal).
|
|
2447
|
+
keepQuiltOut(this.root)
|
|
2448
|
+
stashCount(this.root).then((n) => { if (this.stashSeen === undefined && typeof n === 'number') this.stashSeen = n }, () => {})
|
|
2292
2449
|
this.gitWatcher = watchGit(this.root, (e) => {
|
|
2293
2450
|
if (this.stopped) return
|
|
2294
2451
|
if (e.type === 'head') { this.headChangedAt = Date.now(); this.queue(HEAD_CHANGED) } else if (e.type === 'busy') { this.setHold('busy'); this.settleHoldSoon() } else this.settleHoldSoon() // idle, index
|
|
@@ -2529,7 +2686,7 @@ export class Session extends EventEmitter {
|
|
|
2529
2686
|
const o = !d ? null : d.skip || d.tooLarge ? undefined : d.key
|
|
2530
2687
|
if (!changes.get(rel).plain || b === undefined || t === undefined || o === undefined) { unread.push(rel); continue }
|
|
2531
2688
|
// A file whose clash is still in this folder (its own lines between markers) is its writer's to settle first.
|
|
2532
|
-
if (this.clashed.has(rel)) { clashes.push(rel); continue }
|
|
2689
|
+
if (this.clashed.has(rel) || this.gitConflicts.get(rel)) { clashes.push(rel); continue }
|
|
2533
2690
|
// The session and this folder must agree first: a change still on its way waits for the next look.
|
|
2534
2691
|
if (this.syncable(rel) && !this.followsGit(rel) && (o ?? undefined) !== this.sharedKey(rel)) { this.upstreamLater(); return }
|
|
2535
2692
|
if (o === t) continue // the session has it already (a partner committed what everyone was editing)
|
|
@@ -2957,6 +3114,20 @@ export class Session extends EventEmitter {
|
|
|
2957
3114
|
return false
|
|
2958
3115
|
}
|
|
2959
3116
|
if (this.clashed.delete(rel)) this.log(`⚖️ ${rel}: its conflict markers are gone; sharing it`)
|
|
3117
|
+
// A conflict git left in this file (a stash popped onto lines that changed since: gitWork): not shared
|
|
3118
|
+
// while git's own markers are in it. Settled by hand, or marked resolved in git, it is shared as any save.
|
|
3119
|
+
if (this.gitConflicts.has(rel)) {
|
|
3120
|
+
if (!disk.binary && hasGitMarkers(disk.text)) {
|
|
3121
|
+
if (this.gitConflicts.get(rel) !== disk.text) {
|
|
3122
|
+
this.gitConflicts.set(rel, disk.text)
|
|
3123
|
+
this.notice(gitConflictNotice(rel))
|
|
3124
|
+
this.log(`⚖️ ${rel}: git left a conflict in it, so it is not shared until its markers are gone`)
|
|
3125
|
+
}
|
|
3126
|
+
return false
|
|
3127
|
+
}
|
|
3128
|
+
if (this.gitConflicts.get(rel)) this.log(`⚖️ ${rel}: git's conflict markers are gone; sharing it`)
|
|
3129
|
+
this.gitConflicts.delete(rel)
|
|
3130
|
+
}
|
|
2960
3131
|
if (disk.key === this.sharedKey(rel)) {
|
|
2961
3132
|
this.lastKnown.set(rel, disk.key)
|
|
2962
3133
|
if (stored && stored.stored) this.setOnDisk(rel, stored.hash)
|
|
@@ -5505,12 +5676,15 @@ export class Session extends EventEmitter {
|
|
|
5505
5676
|
* opening pages: read and send messages, read and add tasks, read files, add pictures,
|
|
5506
5677
|
* documents and notes (see chat-links.js). It joins as its own member; removing it ends the link.
|
|
5507
5678
|
* It works for ten minutes unless `minutes` says otherwise, and the owner can extend it.
|
|
5679
|
+
* `waiting`: made ahead, inside an AI's invite: nobody joins, and its minutes do not start,
|
|
5680
|
+
* until an AI opens it (within the hour); `expiresAt` is then when it stops waiting.
|
|
5508
5681
|
*/
|
|
5509
|
-
async createChatLink ({ name = '', minutes } = {}) {
|
|
5682
|
+
async createChatLink ({ name = '', minutes, waiting = false } = {}) {
|
|
5510
5683
|
if (!this.conn) throw new Error('not connected to the relay')
|
|
5511
5684
|
if (!this.canAdmit) throw new Error('only people who may let others into this codebase can make a chat link')
|
|
5512
|
-
const r = await this.conn.adminRequest({ op: 'chatlink', name: String(name || ''), ...(minutes ? { minutes: Number(minutes) } : {}) })
|
|
5513
|
-
|
|
5685
|
+
const r = await this.conn.adminRequest({ op: 'chatlink', name: String(name || ''), ...(minutes ? { minutes: Number(minutes) } : {}), ...(waiting ? { waiting: true } : {}) })
|
|
5686
|
+
// A relay that does not make links ahead yet made one that works now: said as it is.
|
|
5687
|
+
return { url: `${this.httpBase()}/c/${this.room}/${r.token}`, name: r.name, expiresAt: r.expiresAt, ...(r.waiting ? { waiting: true } : {}) }
|
|
5514
5688
|
}
|
|
5515
5689
|
|
|
5516
5690
|
/** 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. */
|
package/src/setup.js
CHANGED
|
@@ -88,7 +88,11 @@ ${TASK_WORKFLOW_MD}
|
|
|
88
88
|
If git refuses a checkout because local changes would be overwritten,
|
|
89
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
|
-
command
|
|
91
|
+
command). git throws away only your own uncommitted work: after
|
|
92
|
+
\`git reset --hard\`, \`git restore\` or \`git stash\` your changes are gone and
|
|
93
|
+
other people's are still in the files (a stash whose files hold someone else's
|
|
94
|
+
work is put back whole: \`git stash drop\` it). When a commit of yours took in
|
|
95
|
+
someone else's uncommitted work, Quilt tells you which files.
|
|
92
96
|
Deleting a file deletes it for everyone.
|
|
93
97
|
${END}`
|
|
94
98
|
|
package/src/ui/agent-guide.js
CHANGED
|
@@ -99,7 +99,7 @@ export function agentGuide ({ apiUrl = 'https://api.heyquilt.com', via = 'both'
|
|
|
99
99
|
'### Getting your work into git',
|
|
100
100
|
'- Work that is only in the codebase has not shipped. Get it into git yourself as soon as it is finished and tested, before you move its task to QA.',
|
|
101
101
|
cli ? `- ${both ? 'With the CLI, join' : 'Join'} from a git clone of the repository (\`git clone <url>\` first, then \`quilt join\` in it). Git is yours to run, with your own sign-in. A ticket is a unit of work, and its work is on a branch of its own, quilt/<ticket>. Taking a ticket (\`quilt_move_task\` to doing) moves your folder onto that branch, made from the latest commit when nobody opened the ticket before (an agent's folder only: a person's stays where it is unless they open the ticket from the board). Everyone who has the ticket open works there together, live; nobody else gets that work until it is merged. Commit only the files you changed there (never \`git add -A\` or \`git commit -a\`), \`git push -u origin <that branch>\`, and open the pull request yourself (\`gh pr create\`). Your ticket moves to QA only once the branch is committed and pushed. When your ticket is Done, your folder goes back to the main branch by itself; a quick fix that needs no ticket can be made there. Quilt does not commit, push, open pull requests or merge them for anyone.` : null,
|
|
102
|
-
cli ? `- ${both ? 'With the CLI: s' : 'S'}witching branches moves your folder to that branch's work in the codebase, and the branch you left keeps its own. Your folder also holds everyone's uncommitted work on the branch you are on, so git may refuse a checkout ("local changes would be overwritten"): switch with \`git checkout -f <branch>\`. Nothing is lost, because the codebase keeps that work on the branch you leave.
|
|
102
|
+
cli ? `- ${both ? 'With the CLI: s' : 'S'}witching branches moves your folder to that branch's work in the codebase, and the branch you left keeps its own. Your folder also holds everyone's uncommitted work on the branch you are on, so git may refuse a checkout ("local changes would be overwritten"): switch with \`git checkout -f <branch>\`. Nothing is lost, because the codebase keeps that work on the branch you leave. git throws away only your own uncommitted work: after \`git reset --hard\`, \`git restore\` or \`git stash\` your changes are gone and other people's are still in the files, and Quilt says whose (a stash whose files hold someone else's work is put back whole: \`git stash drop\` it). When a commit of yours took in someone else's uncommitted work, Quilt tells you which files.` : null,
|
|
103
103
|
cli ? `- ${both ? 'With the CLI: c' : 'C'}ommits pushed to your branch's upstream (a partner's push, a pull request merged on GitHub) come into your folder by themselves: about once a minute, and when a partner's folder moves, Quilt fetches the upstream and moves your branch forward to them, keeping the codebase's uncommitted work. There is nothing to pull. For that the folder needs fetch credentials that work without a prompt (a credential helper, an SSH key, or a token in the remote's URL). Quilt leaves two cases to your own git, and \`quilt_status\` says so under "Git": your branch has commits of its own that the upstream hasn't, and a commit changed the same lines as uncommitted work (commit it first). In both, pull with \`git pull --rebase --autostash\` (or \`--no-rebase\` to merge) and settle any conflict. While git is stopped on a conflict (a merge, rebase, cherry-pick or revert) your folder is paused: nothing is shared from it or written to it until you settle it and commit. Quilt never rewrites or force-pushes history, and neither should you.` : null,
|
|
104
104
|
http ? `- ${both ? 'Over HTTP you have no folder, so ' : 'You have no folder, so '}you cannot commit. What you write is in the codebase and in every member's folder, and someone with a folder commits it: say in your task's \`qaNotes\` which files need committing. Quilt never rewrites or force-pushes history.` : null,
|
|
105
105
|
cliOnly('- Quilt merges on its own: changes made offline or by a pull are combined with the codebase\'s by Quilt, as live edits are (below)'),
|
package/src/ui/app.css
CHANGED
|
@@ -273,6 +273,44 @@ textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
|
|
|
273
273
|
.inv-agent-label { margin: 18px 0 6px; padding-top: 16px; border-top: 1px solid var(--border); }
|
|
274
274
|
.inv-agent .hint { margin: 0 0 10px; }
|
|
275
275
|
.inv-agent .error:empty { display: none; }
|
|
276
|
+
/* The invite pop-up: a tile for a person and a tile for an AI, then the way straight in. */
|
|
277
|
+
.modal.inv { width: min(600px, 100%); }
|
|
278
|
+
.inv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
|
|
279
|
+
.inv-head h3 { display: flex; align-items: center; gap: 10px; margin: 0; min-width: 0; }
|
|
280
|
+
.inv-head h3 span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
281
|
+
.inv-head h3 .pj-block { width: 26px; height: 26px; border-radius: 7px; }
|
|
282
|
+
.inv-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
|
|
283
|
+
.inv-tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
|
|
284
|
+
.inv-ic { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 4px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); color: var(--text); }
|
|
285
|
+
.inv-ic svg { width: 16px; height: 16px; }
|
|
286
|
+
.inv-tile b { font-size: 15px; }
|
|
287
|
+
.inv-tile p { flex: 1; margin: 0 0 10px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
|
|
288
|
+
.inv-tile .btn { height: 38px; justify-content: center; }
|
|
289
|
+
.inv-tile .btn.copied { background: var(--ok); border-color: var(--ok); color: #10231a; }
|
|
290
|
+
.inv-tile .error { flex: none; margin: 6px 0 0; }
|
|
291
|
+
.modal.inv .error:empty { display: none; }
|
|
292
|
+
.inv-shown { margin: 12px 0 0; }
|
|
293
|
+
.inv-shown[hidden] { display: none; }
|
|
294
|
+
.inv-shown code { max-height: 96px; overflow: auto; }
|
|
295
|
+
.inv-in { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
|
|
296
|
+
.inv-in .label { display: block; margin-bottom: 8px; }
|
|
297
|
+
.inv-add { display: flex; gap: 8px; margin-bottom: 10px; }
|
|
298
|
+
.inv-add .input { flex: 1; min-width: 0; }
|
|
299
|
+
.inv-chips, .inv-chips > span { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
|
|
300
|
+
.inv-chips > span:empty { display: none; }
|
|
301
|
+
.inv-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel-2); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; }
|
|
302
|
+
.inv-chip:hover, .inv-chip:focus-visible { border-color: var(--text); }
|
|
303
|
+
.inv-chip:disabled { opacity: .5; cursor: default; }
|
|
304
|
+
.inv-chip .avatar { width: 20px; height: 20px; font-size: 10px; }
|
|
305
|
+
.inv-chip svg { width: 12px; height: 12px; color: var(--muted); }
|
|
306
|
+
.inv-chip.wait { padding-left: 10px; border-style: dashed; background: none; color: var(--muted); cursor: default; }
|
|
307
|
+
.inv-chip.wait:hover { border-color: var(--border); }
|
|
308
|
+
.inv-chip.wait button { display: grid; place-items: center; width: 18px; height: 18px; margin-right: -4px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
|
|
309
|
+
.inv-chip.wait button:hover { color: var(--text); background: var(--border); }
|
|
310
|
+
.inv-more { display: flex; justify-content: flex-end; margin-top: 12px; }
|
|
311
|
+
.inv-quiet { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
|
|
312
|
+
.inv-quiet:hover, .inv-quiet.copied { color: var(--text); }
|
|
313
|
+
@media (max-width: 640px) { .inv-tiles { grid-template-columns: 1fr; } }
|
|
276
314
|
.agent-row { grid-template-columns: 24px minmax(0, 1fr); align-items: center; }
|
|
277
315
|
.agent-row svg { width: 16px; height: 16px; }
|
|
278
316
|
/* Your agents in Settings › Agents with workspaces on: one card each, who it is on top, then
|
|
@@ -1184,11 +1222,6 @@ details.choice-foot .hint { display: block; margin-top: 6px; }
|
|
|
1184
1222
|
.pm-member .nm { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1185
1223
|
.pm-member .input { height: 28px; width: auto; font-size: 12px; padding: 0 6px; }
|
|
1186
1224
|
.pm-member input.input { width: 110px; }
|
|
1187
|
-
.invite-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0 4px; text-align: left; }
|
|
1188
|
-
.invite-pair .codebox { margin: 6px 0 10px; }
|
|
1189
|
-
.invite-pair .codebox code { font-size: 11.5px; max-height: 72px; overflow: auto; }
|
|
1190
|
-
.invite-pair .btn { width: 100%; }
|
|
1191
|
-
@media (max-width: 900px) { .invite-pair { grid-template-columns: 1fr; } }
|
|
1192
1225
|
.pm-member.edit { flex-wrap: wrap; padding: 6px; border-radius: 4px; }
|
|
1193
1226
|
.pm-member.edit + .pm-member.edit { border-top: 1px dashed var(--border); }
|
|
1194
1227
|
.pm-member.edit .nm { flex-basis: 100%; font-weight: 600; }
|
|
@@ -1611,10 +1644,13 @@ body.has-asks .prail { margin-top: calc(var(--update-bar, 0px) + var(--asks-bar)
|
|
|
1611
1644
|
.pj-crumb { display: inline-flex; align-items: center; gap: 8px; min-width: 0; height: 30px; padding: 0 8px; border: 0; border-radius: 4px; background: none; color: var(--text); font: 600 14px var(--sans); cursor: pointer; }
|
|
1612
1645
|
.pj-crumb > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1613
1646
|
.pj-crumb:hover { background: var(--panel-2); }
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1647
|
+
/* The sidebar's one button: a chip half over the right edge of the strip of projects, halfway down
|
|
1648
|
+
the window. It never moves: its arrow points left while the sidebar is open, right while it is closed. */
|
|
1649
|
+
.pj-side-chip { position: fixed; left: 52px; top: 50%; z-index: 7; width: 16px; height: 44px; margin-top: -22px; padding: 0; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel); color: var(--muted); cursor: pointer; box-shadow: var(--card); }
|
|
1650
|
+
.pj-side-chip:hover, .pj-side-chip:focus-visible { color: var(--text); border-color: var(--text); }
|
|
1651
|
+
.pj-side-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
1652
|
+
.pj-side-chip svg { width: 12px; height: 12px; transition: transform var(--side-slide, 0s); }
|
|
1653
|
+
[data-side="shut"] .pj-side-chip svg { transform: rotate(180deg); }
|
|
1618
1654
|
.pj-home .ws-top .spacer { flex: 1; }
|
|
1619
1655
|
.pj-home .ws-top .brand .qm-word { transform: translateY(11%); }
|
|
1620
1656
|
.pj-home .page { flex: 1; min-height: 0; padding: 16px 24px 32px; overflow-y: auto; }
|
package/src/ui/app.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Quilt app: boot, live events, home screen, folder picker and invites.
|
|
2
2
|
// The session workspace lives in session.js. Plain ES modules, no build step.
|
|
3
3
|
import { authorOf } from './chat.js'
|
|
4
|
-
import { TOKEN, I, state, $, esc, basename, ago, toast, api, ask, decodeInvite, remember, recall, startDropdowns, avatar,
|
|
4
|
+
import { TOKEN, I, state, $, esc, basename, ago, toast, api, ask, decodeInvite, remember, recall, startDropdowns, avatar, loadingHtml } from './common.js'
|
|
5
5
|
import { renderShell, joinSessionDialog, openProjectSettings } from './home.js'
|
|
6
6
|
import { mountSession, sessionUpdated, sessionMessage, sessionFeed, sessionFileChanged, sessionLog, sessionUnmount } from './session.js'
|
|
7
7
|
import { quiltMark } from './mark.js'
|
|
@@ -9,12 +9,11 @@ import { renderSignIn } from './signin.js'
|
|
|
9
9
|
import { checkRelease, openReleaseNotes } from './releases.js'
|
|
10
10
|
import { loadWorkspaces, openWorkspace, wsIdOf } from './workspaces.js'
|
|
11
11
|
import { renderRail } from './prail.js'
|
|
12
|
-
import { menuCodebases, previewAt } from './project-model.js'
|
|
12
|
+
import { menuCodebases, previewAt, quiltBlock } from './project-model.js'
|
|
13
13
|
import { knownMachines } from './preview-page.js'
|
|
14
14
|
import { openNewProject } from './project-pop.js'
|
|
15
15
|
import { previewBusy } from './files.js'
|
|
16
16
|
import { agentPaste, NO_LINK_YET } from './invite.js'
|
|
17
|
-
import { openKindMenu, kindLineHtml } from './agent-kinds.js'
|
|
18
17
|
import { messageSound, letInSound, taskSound, soundOn, playSound, unlockSounds } from './sounds.js'
|
|
19
18
|
import { watchSecretAsks } from './secrets.js'
|
|
20
19
|
import { voiceEvent } from './voice.js'
|
|
@@ -497,142 +496,124 @@ export async function pickFolder (input) {
|
|
|
497
496
|
|
|
498
497
|
|
|
499
498
|
// --------------------------------------------------------------- invite --
|
|
499
|
+
// One short pop-up: a tile for a person (copy the link) and a tile for an AI (copy one prompt,
|
|
500
|
+
// whatever AI it is), then, for the owner, the way straight in: an email, or someone they have
|
|
501
|
+
// worked with. No kinds of link or of AI to pick.
|
|
500
502
|
export function openInvite (id) {
|
|
501
503
|
const s = state.sessions.get(id)
|
|
502
504
|
if (!s) return
|
|
503
|
-
const
|
|
504
|
-
// The owner of a
|
|
505
|
+
const name = s.status?.sessionName || basename(s.dir)
|
|
506
|
+
// The owner of a codebase with approvals can let people straight in, by email or by name.
|
|
505
507
|
const owner = !!(s.viewInvite && s.status.access?.owner)
|
|
508
|
+
const canChat = !!(s.status.access?.owner || s.status.access?.canAdmit)
|
|
509
|
+
const wait = !s.viewInvite ? 'Anyone with it can edit, so send it only to people you trust.' : owner ? 'They wait until you let them in.' : 'They wait until someone lets them in.'
|
|
506
510
|
const back = document.createElement('div')
|
|
507
511
|
back.className = 'modal-back'
|
|
508
|
-
back.innerHTML = `<div class="card modal" role="dialog" aria-modal="true" aria-labelledby="inv-title">
|
|
509
|
-
<h3 id="inv-title">Invite
|
|
510
|
-
<
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
<
|
|
517
|
-
${owner ? `<div class="inv-
|
|
518
|
-
<
|
|
519
|
-
<
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
<div class="inv-list" id="inv-people"><p class="hint">${loadingNote()}</p></div>
|
|
523
|
-
<div class="label inv-sub">Invite by email</div>
|
|
524
|
-
<form class="row" id="inv-email-form">
|
|
525
|
-
<input class="input grow" type="email" id="inv-email" placeholder="name@example.com" aria-label="Email address" required>
|
|
526
|
-
<button class="btn primary" type="submit">Send invite</button>
|
|
512
|
+
back.innerHTML = `<div class="card modal inv" role="dialog" aria-modal="true" aria-labelledby="inv-title">
|
|
513
|
+
<div class="inv-head"><h3 id="inv-title">${quiltBlock(name)}<span>Invite to ${esc(name)}</span></h3><button class="btn sm ghost icon" type="button" id="inv-done" title="Close" aria-label="Close">${I.x}</button></div>
|
|
514
|
+
<div class="inv-tiles">
|
|
515
|
+
<div class="inv-tile"><span class="inv-ic">${I.user}</span><b>A person</b><p>${s.invite ? `Send them the link. ${wait}` : esc(NO_LINK_YET)}</p>
|
|
516
|
+
${s.invite ? `<button class="btn primary" type="button" id="inv-copy-link">${I.copy}<span>Copy invite link</span></button>` : ''}</div>
|
|
517
|
+
<div class="inv-tile"><span class="inv-ic">${I.bot}</span><b>An AI</b><p id="inv-agent-note">Paste the prompt into any AI: Claude Code, Cursor, Codex or ChatGPT. It joins as your agent.</p>
|
|
518
|
+
<button class="btn" type="button" id="inv-agent-make">${I.bot}<span>Copy prompt</span></button><p class="error" id="inv-agent-error"></p></div>
|
|
519
|
+
</div>
|
|
520
|
+
<div class="codebox inv-shown" id="inv-shown" hidden><code class="paste"></code></div>
|
|
521
|
+
${owner ? `<div class="inv-in">
|
|
522
|
+
<span class="label">Or let someone straight in</span>
|
|
523
|
+
<form class="inv-add" id="inv-email-form">
|
|
524
|
+
<input class="input" type="email" id="inv-email" placeholder="Add an email" aria-label="Add an email" required>
|
|
525
|
+
<button class="btn" type="submit">Send invite</button>
|
|
527
526
|
</form>
|
|
528
|
-
<div class="
|
|
529
|
-
<div class="inv-list" id="inv-pending"></div>
|
|
527
|
+
<div class="inv-chips"><span id="inv-people"></span><span id="inv-pending"></span></div>
|
|
530
528
|
<p class="error" id="inv-error"></p>
|
|
531
529
|
</div>` : ''}
|
|
532
|
-
|
|
533
|
-
<div id="inv-agent" class="inv-agent">
|
|
534
|
-
<p class="hint">An AI that already has the Quilt command just needs the link above: tell it "Join my Quilt codebase: <link>". To add an AI that isn't registered with Quilt yet, make it an agent invite and paste the text into it: it carries the link above too. It joins as your own agent, listed in Settings.</p>
|
|
535
|
-
<button class="btn" type="button" id="inv-agent-make"${state.workspacesOn ? ' aria-haspopup="menu" aria-expanded="false"' : ''}>${I.bot}<span>Invite an AI agent</span></button>
|
|
536
|
-
<p class="error" id="inv-agent-error"></p>
|
|
537
|
-
</div>
|
|
538
|
-
${s.status.access?.owner || s.status.access?.canAdmit ? `<div class="label inv-agent-label">A chat AI</div>
|
|
539
|
-
<div id="inv-chat" class="inv-agent">
|
|
540
|
-
<p class="hint">For ChatGPT, claude.ai, Grok and other AIs you use in a chat window: make a chat link and paste it into the chat. It can read and send messages, add, assign, move and comment on tasks, read files, and add pictures, documents and notes. It can't change existing files. It shows up in the codebase as its own member and works for 10 minutes: extend it in Codebase settings while it works, or make a new one after.</p>
|
|
541
|
-
<button class="btn" type="button" id="inv-chat-make">${I.link}<span>Make a chat link</span></button>
|
|
542
|
-
<p class="error" id="inv-chat-error"></p>
|
|
543
|
-
</div>` : ''}
|
|
544
|
-
<div class="actions"><button class="btn primary" id="inv-done">Done</button></div>
|
|
530
|
+
${s.viewInvite ? `<div class="inv-more"><button type="button" class="inv-quiet" id="inv-copy-view">Copy a view-only link</button></div>` : ''}
|
|
545
531
|
</div>`
|
|
546
532
|
document.body.appendChild(back)
|
|
547
533
|
const close = () => back.remove()
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
534
|
+
// Copies `text` and says so on the button for a moment. Where the clipboard is not to be had, the text is shown, selected, to copy by hand.
|
|
535
|
+
const copy = async (text, btn, said = 'Copied') => {
|
|
536
|
+
const label = btn.querySelector('span') || btn
|
|
537
|
+
try {
|
|
538
|
+
await navigator.clipboard.writeText(text)
|
|
539
|
+
if (!btn.dataset.label) btn.dataset.label = label.textContent
|
|
540
|
+
label.textContent = said
|
|
541
|
+
btn.classList.add('copied')
|
|
542
|
+
clearTimeout(btn._t)
|
|
543
|
+
btn._t = setTimeout(() => { label.textContent = btn.dataset.label; btn.classList.remove('copied') }, 1800)
|
|
544
|
+
} catch {
|
|
545
|
+
const box = $('#inv-shown', back)
|
|
546
|
+
box.hidden = false
|
|
547
|
+
box.firstElementChild.textContent = text
|
|
548
|
+
const r = document.createRange(); r.selectNodeContents(box.firstElementChild)
|
|
554
549
|
getSelection().removeAllRanges(); getSelection().addRange(r); toast('Press ⌘/Ctrl+C to copy')
|
|
555
550
|
}
|
|
556
|
-
}
|
|
551
|
+
}
|
|
552
|
+
if ($('#inv-copy-link', back)) $('#inv-copy-link', back).onclick = (e) => copy(s.invite, e.currentTarget)
|
|
553
|
+
if ($('#inv-copy-view', back)) $('#inv-copy-view', back).onclick = (e) => copy(s.viewInvite, e.currentTarget, 'View-only link copied')
|
|
554
|
+
// One prompt for any AI: an agent invite (it joins as your agent, in this codebase), and with it a
|
|
555
|
+
// chat link made ahead for an AI that can only open web pages (nobody joins until one opens it).
|
|
556
|
+
// Made at the first press and copied; pressed again, the same prompt is copied again.
|
|
557
|
+
let prompt = ''
|
|
557
558
|
$('#inv-agent-make', back).onclick = async () => {
|
|
558
559
|
const btn = $('#inv-agent-make', back)
|
|
559
|
-
|
|
560
|
-
if (state.workspacesOn) {
|
|
561
|
-
return openKindMenu(btn, {
|
|
562
|
-
sessionId: id,
|
|
563
|
-
workspaceId: s.workspace || '',
|
|
564
|
-
onInvite: ({ kind, text, where }) => { $('#inv-agent', back).innerHTML = agentInviteHtml(text, 'inv-agent-text', kindLineHtml(kind, where)) }
|
|
565
|
-
})
|
|
566
|
-
}
|
|
560
|
+
if (prompt) return copy(prompt, btn)
|
|
567
561
|
btn.disabled = true
|
|
562
|
+
$('#inv-agent-error', back).textContent = ''
|
|
568
563
|
try {
|
|
569
|
-
const inv = await
|
|
570
|
-
|
|
564
|
+
const [inv, chat] = await Promise.all([
|
|
565
|
+
api('POST', '/api/agent-invites'),
|
|
566
|
+
canChat ? api('POST', `/api/sessions/${id}/chat-link`, { waiting: true }).catch(() => null) : null
|
|
567
|
+
])
|
|
568
|
+
prompt = agentPaste({ link: inv.link, session: s.invite, chat: chat?.url })
|
|
569
|
+
$('#inv-agent-note', back).textContent = 'Paste it into your AI. It works once, within an hour. Anyone with it can join as your agent, so give it only to your own AI.'
|
|
570
|
+
btn.disabled = false
|
|
571
|
+
copy(prompt, btn)
|
|
571
572
|
} catch (err) {
|
|
572
573
|
btn.disabled = false
|
|
573
574
|
$('#inv-agent-error', back).textContent = err.message
|
|
574
575
|
}
|
|
575
576
|
}
|
|
576
|
-
const chatMake = $('#inv-chat-make', back)
|
|
577
|
-
if (chatMake) {
|
|
578
|
-
chatMake.onclick = async () => {
|
|
579
|
-
chatMake.disabled = true
|
|
580
|
-
try {
|
|
581
|
-
const r = await api('POST', `/api/sessions/${id}/chat-link`, {})
|
|
582
|
-
const until = new Date(r.expiresAt).toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' })
|
|
583
|
-
$('#inv-chat', back).innerHTML = `<p class="hint">Paste this into the chat. It works until ${esc(until)} (extend it in Codebase settings) and shows in the codebase as <b>${esc(r.name)}</b>. Anyone with it can act as ${esc(r.name)}, so only paste it there.</p>
|
|
584
|
-
<div class="codebox"><code id="inv-chat-text">${esc(`Open this link and follow it to join our Quilt codebase: ${r.url}`)}</code><button class="btn icon" data-copy="inv-chat-text" title="Copy" aria-label="Copy chat link">${I.copy}</button></div>`
|
|
585
|
-
} catch (err) {
|
|
586
|
-
chatMake.disabled = false
|
|
587
|
-
$('#inv-chat-error', back).textContent = err.message
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
577
|
$('#inv-done', back).onclick = close
|
|
592
578
|
back.onclick = (e) => { if (e.target === back) close() }
|
|
593
|
-
if (
|
|
579
|
+
back.onkeydown = (e) => { if (e.key === 'Escape') close() }
|
|
580
|
+
if (owner) bindInvitePeople(id, back)
|
|
581
|
+
;($('#inv-copy-link', back) || $('#inv-done', back)).focus()
|
|
594
582
|
}
|
|
595
583
|
|
|
596
|
-
/** The owner's
|
|
597
|
-
function
|
|
584
|
+
/** The owner's part of the invite: by email, or someone they have worked with (a chip each); the invites still waiting are chips beside them. They get straight in, to edit. */
|
|
585
|
+
function bindInvitePeople (id, back) {
|
|
598
586
|
const error = (msg) => { $('#inv-error', back).textContent = msg || '' }
|
|
599
|
-
|
|
587
|
+
let waiting = [] // the invites still open, as last heard
|
|
588
|
+
let known = [] // the people you have worked with
|
|
589
|
+
const here = () => { const st = state.sessions.get(id)?.status || {}; return new Set([st.me?.name, ...(st.peers || []).map((p) => p.name), ...(st.members || []).map((m) => m.name)]) }
|
|
590
|
+
const draw = () => {
|
|
591
|
+
// Someone already in the codebase, or already invited, is not offered again.
|
|
592
|
+
const asked = new Set(waiting.map((i) => i.name))
|
|
593
|
+
$('#inv-people', back).innerHTML = known.filter((c) => !here().has(c.name) && !asked.has(c.name)).map((c) => `<button type="button" class="inv-chip" data-invite-account="${esc(c.account)}" data-name="${esc(c.name)}" title="Invite ${esc(c.name)}">${avatar(c.name, null)}<span>${esc(c.name)}</span>${c.kind === 'agent' ? I.bot : I.plus}</button>`).join('')
|
|
594
|
+
$('#inv-pending', back).innerHTML = waiting.map((i) => `<span class="inv-chip wait">${esc(i.email || i.name)} · invited<button type="button" data-cancel-invite="${esc(i.id)}" title="Cancel the invite" aria-label="Cancel the invite to ${esc(i.email || i.name)}">${I.x}</button></span>`).join('')
|
|
595
|
+
}
|
|
600
596
|
const invite = async (to, done) => {
|
|
601
597
|
error('')
|
|
602
598
|
try {
|
|
603
|
-
await api('POST', `/api/sessions/${id}/invites`, { typeId:
|
|
599
|
+
await api('POST', `/api/sessions/${id}/invites`, { typeId: 'builtin:edit', to })
|
|
604
600
|
toast(done)
|
|
605
601
|
await pending()
|
|
606
602
|
} catch (err) { error(err.message) }
|
|
607
603
|
}
|
|
608
604
|
async function pending () {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
const open = (await api('GET', `/api/sessions/${id}/invites`)).invites.filter((i) => i.status === 'waiting')
|
|
612
|
-
el.innerHTML = open.length
|
|
613
|
-
? open.map((i) => `<div class="inv-row"><span class="grow">${esc(i.email || i.name)}<span class="hint"> · ${esc(i.typeName)}</span></span><button class="btn sm ghost" type="button" data-cancel-invite="${esc(i.id)}">Cancel</button></div>`).join('')
|
|
614
|
-
: '<p class="hint">No pending invites.</p>'
|
|
615
|
-
} catch (err) { el.innerHTML = `<p class="hint">${esc(err.message)}</p>` }
|
|
605
|
+
try { waiting = (await api('GET', `/api/sessions/${id}/invites`)).invites.filter((i) => i.status === 'waiting') } catch (err) { error(err.message) }
|
|
606
|
+
draw()
|
|
616
607
|
}
|
|
617
608
|
async function people () {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
const list = (await api('GET', '/api/collaborators')).collaborators
|
|
621
|
-
el.innerHTML = list.length
|
|
622
|
-
? list.map((c) => `<div class="inv-row">${avatar(c.name, null)}<span class="grow">${esc(c.name)}${c.kind === 'agent' ? `<span class="tag bot">${I.bot}agent</span>` : ''}</span><button class="btn sm" type="button" data-invite-account="${esc(c.account)}" data-name="${esc(c.name)}">Invite</button></div>`).join('')
|
|
623
|
-
: "<p class=\"hint\">Nobody yet. People and agents you've been in a codebase with show up here.</p>"
|
|
624
|
-
} catch (err) { el.innerHTML = `<p class="hint">${esc(err.message)}</p>` }
|
|
609
|
+
try { known = (await api('GET', '/api/collaborators')).collaborators } catch {} // the link and the email still work
|
|
610
|
+
draw()
|
|
625
611
|
}
|
|
626
|
-
;(state.accessTypes ? Promise.resolve(state.accessTypes) : loadAccessTypes()).then((types) => {
|
|
627
|
-
const sel = $('#inv-type', back)
|
|
628
|
-
if (types) sel.innerHTML = typeOptions()
|
|
629
|
-
else { sel.innerHTML = '<option value="builtin:edit">Can edit</option><option value="builtin:view">View only</option>' }
|
|
630
|
-
})
|
|
631
612
|
people()
|
|
632
613
|
pending()
|
|
633
614
|
back.addEventListener('click', async (e) => {
|
|
634
615
|
const inv = e.target.closest('[data-invite-account]')
|
|
635
|
-
if (inv) { inv.disabled = true; await invite({ account: inv.dataset.inviteAccount }, `Invited ${inv.dataset.name}`);
|
|
616
|
+
if (inv) { inv.disabled = true; await invite({ account: inv.dataset.inviteAccount }, `Invited ${inv.dataset.name}`); return }
|
|
636
617
|
const cancel = e.target.closest('[data-cancel-invite]')
|
|
637
618
|
if (cancel) {
|
|
638
619
|
try { await api('POST', `/api/sessions/${id}/invites/cancel`, { inviteId: cancel.dataset.cancelInvite }); toast('Invite cancelled'); await pending() } catch (err) { error(err.message) }
|
package/src/ui/invite.js
CHANGED
|
@@ -77,11 +77,13 @@ export function parseInvite (code, { allowRelay = () => false } = {}) {
|
|
|
77
77
|
/**
|
|
78
78
|
* What to paste into an AI so it joins Quilt as your agent. `link` is a one-time agent
|
|
79
79
|
* invite from the accounts API; `session` is the session invite link when it is made from a
|
|
80
|
-
* session's Invite, so the agent joins that session straight after registering.
|
|
81
|
-
*
|
|
82
|
-
*
|
|
80
|
+
* session's Invite, so the agent joins that session straight after registering. `chat` is a
|
|
81
|
+
* chat link made ahead for that session (chat-links.js), for an AI that can only open web
|
|
82
|
+
* pages: with it the one prompt works whatever AI it is pasted into. This is the one invite
|
|
83
|
+
* prompt: the app (Settings and a session's Invite) and the website (Agents, an org's People)
|
|
84
|
+
* all show exactly this.
|
|
83
85
|
*/
|
|
84
|
-
export function agentPaste ({ link, session, invitedToSessions = false } = {}) {
|
|
86
|
+
export function agentPaste ({ link, session, chat, invitedToSessions = false } = {}) {
|
|
85
87
|
let apiUrl
|
|
86
88
|
try { apiUrl = new URL(link).origin } catch {}
|
|
87
89
|
const sessionLink = session || '<codebase invite link>'
|
|
@@ -94,6 +96,7 @@ export function agentPaste ({ link, session, invitedToSessions = false } = {}) {
|
|
|
94
96
|
`- With the CLI (whenever you can run commands): ${INSTALL_CLI} Then run \`quilt agent join ${link} --name <your name>\` (pick a short name), and in the codebase's folder start \`quilt join ${sessionLink} --agent <your name>\` and keep it running (see below).`,
|
|
95
97
|
`- In a sandbox wiped after every turn: ${SANDBOX_CLI}`,
|
|
96
98
|
`- Only if you have no computer and can do nothing but make HTTP requests: open ${link} and follow it to join over HTTP (register, then connect to the MCP server it names and call quilt_join_session with ${session ? 'my codebase invite link' : 'the codebase invite link I send you'}).`,
|
|
99
|
+
...(chat ? [`- If all you can do is open web pages (an AI in a chat window, such as ChatGPT, claude.ai or Grok, that can neither run commands nor send requests): leave the rest of this, open ${chat} and follow what it says. There you read and send messages, work on tasks, read files, and add pictures, documents and notes. It works for 10 minutes from when you first open it, and I can make that longer.`] : []),
|
|
97
100
|
'- If you joined Quilt before, give the agent id Quilt gave you then (CLI: `--agent-id <your agent id>`; over HTTP: "agentId"), so you come back as the same agent instead of a new one. Not joined before, or lost it? Leave it out.',
|
|
98
101
|
'- Quilt answers with your agent id. Save it where you will still have it later (your memory, notes or config): it is public, not a secret, and it is how you come back as yourself.',
|
|
99
102
|
session ? `- My codebase invite link: ${session}. I may have to let you in first.` : '- I will send you a codebase invite link (https://join.heyquilt.com/...).',
|
package/src/ui/projects.js
CHANGED
|
@@ -19,7 +19,6 @@ import { previewRowHtml } from './preview-page.js'
|
|
|
19
19
|
const colorOf = (w) => COLORS[w.color] || COLORS.lilac
|
|
20
20
|
const tile = (w, size = '') => `<span class="pj-tile ${size}" style="background:${esc(colorOf(w))}">${esc(tileLetter(w.name))}</span>`
|
|
21
21
|
const faces = (list) => list.length ? `<span class="pj-faces sm">${list.map((f) => avatar(f.name, f.color)).join('')}</span>` : ''
|
|
22
|
-
const panelIcon = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="16" rx="2.5"/><path d="M9 4v16"/></svg>'
|
|
23
22
|
|
|
24
23
|
// Kept on this computer: whether the sidebar is closed, and which of its sections are folded.
|
|
25
24
|
const saved = (key) => { try { return localStorage.getItem(key) } catch { return null } }
|
|
@@ -29,17 +28,19 @@ const foldedNow = () => (folded ||= readFolded(saved('quilt.sideFolded')))
|
|
|
29
28
|
/** Whether the sidebar of a project or a codebase is closed (one choice for both, kept on this computer). */
|
|
30
29
|
export const sideShut = () => saved('quilt.projectSide') === 'shut'
|
|
31
30
|
export const toggleSideShut = () => save('quilt.projectSide', sideShut() ? 'open' : 'shut')
|
|
32
|
-
// The sidebar's
|
|
33
|
-
//
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
/** Shows the sidebar closed or open, as it was just set: on the page's shell (`ws`), where it slides. The button now showing takes the focus the other had. */
|
|
31
|
+
// The sidebar's one button: a chip on the right edge of the strip of projects, half over it. It is
|
|
32
|
+
// in the same place whether the sidebar is open or closed, and its arrow says which way it goes.
|
|
33
|
+
const sideBtn = () => { const shut = sideShut(); return `<button type="button" class="pj-side-chip" id="pj-side-btn" aria-expanded="${!shut}" title="${shut ? 'Show' : 'Hide'} the sidebar" aria-label="${shut ? 'Show' : 'Hide'} the sidebar"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 6-6 6 6 6"/></svg></button>` }
|
|
34
|
+
/** Shows the sidebar closed or open, as it was just set: on the page's shell (`ws`), where it slides. Its button says what it does now. */
|
|
37
35
|
export function drawSideShut (ws) {
|
|
38
36
|
const shut = sideShut()
|
|
39
37
|
if (!ws) return
|
|
40
|
-
const had = ws.contains(document.activeElement) && document.activeElement.matches('#pj-side-btn, [data-side-toggle]')
|
|
41
38
|
ws.dataset.side = shut ? 'shut' : 'open'
|
|
42
|
-
|
|
39
|
+
const b = ws.querySelector('#pj-side-btn')
|
|
40
|
+
if (!b) return
|
|
41
|
+
b.setAttribute('aria-expanded', String(!shut))
|
|
42
|
+
b.title = `${shut ? 'Show' : 'Hide'} the sidebar`
|
|
43
|
+
b.setAttribute('aria-label', b.title)
|
|
43
44
|
}
|
|
44
45
|
// The plus beside Channels, in a project's sidebar and a codebase's: a row to name the new one in, in the list.
|
|
45
46
|
const newChannelBtn = `<button type="button" class="btn sm ghost icon" data-new-channel title="New channel" aria-label="New channel">${I.plus}</button>`
|
|
@@ -109,7 +110,7 @@ function headerHtml (p) {
|
|
|
109
110
|
return `
|
|
110
111
|
<header class="ws-top">
|
|
111
112
|
<button class="brand" data-go="home" aria-label="Home">${quiltMark({ sew: 'first' })}</button>
|
|
112
|
-
${p ? `${
|
|
113
|
+
${p ? `${sideBtn()}
|
|
113
114
|
<button type="button" class="pj-crumb" data-go="ws:${esc(p.id)}" title="${esc(p.description || p.name)}">${tile(p, 'xs')}<span>${esc(p.name)}</span></button>` : ''}
|
|
114
115
|
<span class="spacer"></span>
|
|
115
116
|
${p ? '' : `<div class="menu-wrap pj-new"><button type="button" class="btn sm primary" id="pj-new-btn" aria-haspopup="true" aria-expanded="false">${I.plus}<span>New</span><span class="caret">${I.caret}</span></button>
|
|
@@ -285,7 +286,6 @@ function sideHtml (p, d, page) {
|
|
|
285
286
|
<div class="side-foot side-nav">
|
|
286
287
|
<button type="button" data-team title="People and agents in this project"><span class="pj-faces sm">${team.slice(0, 3).map((m) => avatar(m.name)).join('')}</span><span class="nm">Team</span><span class="ct">${count}</span></button>
|
|
287
288
|
${d.access?.admin ? `<button type="button" data-invite-project>${I.link}<span class="nm">Invite</span></button>` : ''}
|
|
288
|
-
${sideHideBtn()}
|
|
289
289
|
</div>
|
|
290
290
|
</aside>`
|
|
291
291
|
}
|
|
@@ -294,9 +294,9 @@ function sideHtml (p, d, page) {
|
|
|
294
294
|
// A codebase's page (session.js) wears the same sidebar, trimmed to that codebase: Loom in place
|
|
295
295
|
// of Overview (the loom is a codebase's main page), no list of codebases, and its chat as a channel.
|
|
296
296
|
|
|
297
|
-
/** Beside the logo on a codebase's page: the button
|
|
297
|
+
/** Beside the logo on a codebase's page: the sidebar's button (drawn on the strip's edge), then the project it is in, if any. */
|
|
298
298
|
export function codeCrumbHtml (project) {
|
|
299
|
-
return `${
|
|
299
|
+
return `${sideBtn()}${project ? `
|
|
300
300
|
<button type="button" class="pj-crumb" data-go="ws:${esc(project.id)}" title="${esc(project.description || project.name)}">${tile(project, 'xs')}<span>${esc(project.name)}</span></button><span class="pj-crumb-sep">/</span>` : ''}`
|
|
301
301
|
}
|
|
302
302
|
|
|
@@ -332,7 +332,6 @@ export function codeSideHtml ({ page, name, project, tasks = 0, artifacts = 0, c
|
|
|
332
332
|
<div class="side-foot side-nav">
|
|
333
333
|
<button type="button" data-code-team title="People in this codebase"><span class="pj-faces sm">${people.slice(0, 3).map((m) => avatar(m.name, m.color)).join('')}</span><span class="nm">Team</span><span class="ct">${people.length}</span></button>
|
|
334
334
|
${canInvite ? `<button type="button" data-code-invite>${I.link}<span class="nm">Invite</span></button>` : ''}
|
|
335
|
-
${sideHideBtn()}
|
|
336
335
|
</div>`
|
|
337
336
|
}
|
|
338
337
|
|
|
@@ -472,7 +471,8 @@ export function bindProjectShell (view, { go, rerender, newSessionDialog, joinSe
|
|
|
472
471
|
root.querySelectorAll('[data-manage-connections]').forEach((b) => { b.onclick = () => { state.settingsTab = 'connections'; openSettings() } })
|
|
473
472
|
if (!p) return
|
|
474
473
|
// The sidebar: its pages, closing it, folding a section.
|
|
475
|
-
root.
|
|
474
|
+
const sideBtnEl = root.querySelector('#pj-side-btn')
|
|
475
|
+
if (sideBtnEl) sideBtnEl.onclick = () => { toggleSideShut(); drawSideShut(root) }
|
|
476
476
|
root.querySelectorAll('[data-page]').forEach((b) => {
|
|
477
477
|
b.onclick = () => {
|
|
478
478
|
const page = b.dataset.page
|
package/src/ui/session.js
CHANGED
|
@@ -450,7 +450,10 @@ function renderCodeSide () {
|
|
|
450
450
|
}
|
|
451
451
|
const root = $('#ws')
|
|
452
452
|
root.dataset.sidePage = side
|
|
453
|
-
|
|
453
|
+
// Drawn only when it changes: the sidebar's chip is in it, and a press on it must not be lost to a redraw.
|
|
454
|
+
const crumb = codeCrumbHtml(p)
|
|
455
|
+
const crumbEl = $('#code-crumb')
|
|
456
|
+
if (crumbEl.dataset.drawn !== crumb) { crumbEl.innerHTML = crumb; crumbEl.dataset.drawn = crumb }
|
|
454
457
|
// The pages drawn over the middle in their own box: Connections, the project's Artifacts, and one of the project's channels.
|
|
455
458
|
// Drawn when the page changes, not every time the sidebar is: an artifact that is running stays as it is.
|
|
456
459
|
const extra = $('#code-extra')
|
|
@@ -550,7 +553,6 @@ function bindCodeSide () {
|
|
|
550
553
|
if (b.dataset.dm !== undefined) { state.to = b.dataset.dm; showCodePage('chat'); renderRecipients(); updatePlaceholder(); return renderCodeSide() }
|
|
551
554
|
if (b.dataset.codePage) return showCodePage(b.dataset.codePage)
|
|
552
555
|
if (b.hasAttribute('data-new-channel')) { const p = projectHere(); if (p) { startNewChannel(p.id); renderCodeSide() } return }
|
|
553
|
-
if (b.hasAttribute('data-side-toggle')) { toggleSideShut(); return drawSideShut($('#ws')) }
|
|
554
556
|
if (b.dataset.fold) return foldSection(b.dataset.fold, renderCodeSide)
|
|
555
557
|
if (b.dataset.go) return go(b.dataset.go)
|
|
556
558
|
if (b.hasAttribute('data-code-team')) { e.stopPropagation(); return $('#people-btn').click() }
|
|
@@ -1397,10 +1399,9 @@ function bindMain () {
|
|
|
1397
1399
|
$('#main').addEventListener('click', async (e) => {
|
|
1398
1400
|
const copy = e.target.closest('[data-copy-invite]')
|
|
1399
1401
|
if (copy) {
|
|
1400
|
-
const
|
|
1401
|
-
const link = view ? sum().viewInvite : sum().invite
|
|
1402
|
+
const link = sum().invite
|
|
1402
1403
|
if (!link) return toast(NO_LINK_YET)
|
|
1403
|
-
try { await navigator.clipboard.writeText(link); toast(
|
|
1404
|
+
try { await navigator.clipboard.writeText(link); toast('Invite link copied') } catch { openInvite(current) }
|
|
1404
1405
|
return
|
|
1405
1406
|
}
|
|
1406
1407
|
const b = e.target.closest('[data-person]')
|
|
@@ -2171,12 +2172,8 @@ function renderMain () {
|
|
|
2171
2172
|
el.innerHTML = `<div class="main-empty invite-empty">
|
|
2172
2173
|
<div class="ill">${I.link}</div>
|
|
2173
2174
|
<h3>Invite someone to code with you</h3>
|
|
2174
|
-
<p class="hint">Send a link. Clicking it opens this codebase in Quilt${viewInvite ? ', and you approve them before they get in' : ''}.
|
|
2175
|
-
${
|
|
2176
|
-
<div class="invite-pair">
|
|
2177
|
-
<div><div class="label">Can edit</div><div class="codebox"><code>${esc(invite)}</code></div><button class="btn primary" data-copy-invite="edit">${I.copy}<span>Copy edit link</span></button></div>
|
|
2178
|
-
<div><div class="label">View only</div><div class="codebox"><code>${esc(viewInvite)}</code></div><button class="btn" data-copy-invite="view">${I.copy}<span>Copy view link</span></button></div>
|
|
2179
|
-
</div>` : invite ? `
|
|
2175
|
+
<p class="hint">Send a link. Clicking it opens this codebase in Quilt${viewInvite ? ', and you approve them before they get in' : ''}. For an AI, or a view-only link, use <b>Invite</b> above.</p>
|
|
2176
|
+
${invite ? `
|
|
2180
2177
|
<div class="codebox"><code id="empty-invite">${esc(invite)}</code></div>
|
|
2181
2178
|
<button class="btn primary" data-copy-invite="edit">${I.copy}<span>Copy invite link</span></button>` : `<p class="hint">${esc(NO_LINK_YET)}</p>`}
|
|
2182
2179
|
<p class="hint small">Once they join, you'll see their AI chat here as it happens.</p>
|
package/src/ui-server.js
CHANGED
|
@@ -1335,7 +1335,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1335
1335
|
'POST /api/sessions/:id/members/set': async (b, id) => (await get(id).setMember(b.key, { role: b.role, scopes: b.scopes }), { ok: true }),
|
|
1336
1336
|
'POST /api/sessions/:id/members/remove': (b, id) => removeMember(id, b.key),
|
|
1337
1337
|
// Owner only: a link a chat-only AI (ChatGPT, claude.ai, Grok…) works through (chat-links.js).
|
|
1338
|
-
'POST /api/sessions/:id/chat-link': (b, id) => get(id).createChatLink({ name: b.name || 'Chat AI', minutes: b.minutes }),
|
|
1338
|
+
'POST /api/sessions/:id/chat-link': (b, id) => get(id).createChatLink({ name: b.name || 'Chat AI', minutes: b.minutes, waiting: b.waiting === true }),
|
|
1339
1339
|
'POST /api/sessions/:id/chat-link/extend': (b, id) => get(id).extendChatLink(String(b.key || ''), b.minutes),
|
|
1340
1340
|
// Agents kept out of this session (removing one in a workspace does it), and letting one back in.
|
|
1341
1341
|
'GET /api/sessions/:id/agents/excluded': (b, id) => { const s = owned(id); return asAccount(async (token) => ({ agents: await listExcludedSessionAgents({ token, room: s.room }) })) },
|