heyquilt 0.3.196 → 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 +6 -0
- package/package.json +1 -1
- package/src/chat-links.js +44 -8
- package/src/server.js +4 -3
- package/src/session.js +6 -3
- package/src/ui/app.css +38 -5
- package/src/ui/app.js +77 -96
- package/src/ui/invite.js +7 -4
- package/src/ui/session.js +4 -9
- package/src/ui-server.js +1 -1
package/RELEASES.md
CHANGED
|
@@ -11,6 +11,12 @@ 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
|
+
|
|
14
20
|
## 0.3.196 — 2026-11-23
|
|
15
21
|
|
|
16
22
|
Git can throw away only your own uncommitted work.
|
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/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
|
@@ -5676,12 +5676,15 @@ export class Session extends EventEmitter {
|
|
|
5676
5676
|
* opening pages: read and send messages, read and add tasks, read files, add pictures,
|
|
5677
5677
|
* documents and notes (see chat-links.js). It joins as its own member; removing it ends the link.
|
|
5678
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.
|
|
5679
5681
|
*/
|
|
5680
|
-
async createChatLink ({ name = '', minutes } = {}) {
|
|
5682
|
+
async createChatLink ({ name = '', minutes, waiting = false } = {}) {
|
|
5681
5683
|
if (!this.conn) throw new Error('not connected to the relay')
|
|
5682
5684
|
if (!this.canAdmit) throw new Error('only people who may let others into this codebase can make a chat link')
|
|
5683
|
-
const r = await this.conn.adminRequest({ op: 'chatlink', name: String(name || ''), ...(minutes ? { minutes: Number(minutes) } : {}) })
|
|
5684
|
-
|
|
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 } : {}) }
|
|
5685
5688
|
}
|
|
5686
5689
|
|
|
5687
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/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; }
|
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/session.js
CHANGED
|
@@ -1399,10 +1399,9 @@ function bindMain () {
|
|
|
1399
1399
|
$('#main').addEventListener('click', async (e) => {
|
|
1400
1400
|
const copy = e.target.closest('[data-copy-invite]')
|
|
1401
1401
|
if (copy) {
|
|
1402
|
-
const
|
|
1403
|
-
const link = view ? sum().viewInvite : sum().invite
|
|
1402
|
+
const link = sum().invite
|
|
1404
1403
|
if (!link) return toast(NO_LINK_YET)
|
|
1405
|
-
try { await navigator.clipboard.writeText(link); toast(
|
|
1404
|
+
try { await navigator.clipboard.writeText(link); toast('Invite link copied') } catch { openInvite(current) }
|
|
1406
1405
|
return
|
|
1407
1406
|
}
|
|
1408
1407
|
const b = e.target.closest('[data-person]')
|
|
@@ -2173,12 +2172,8 @@ function renderMain () {
|
|
|
2173
2172
|
el.innerHTML = `<div class="main-empty invite-empty">
|
|
2174
2173
|
<div class="ill">${I.link}</div>
|
|
2175
2174
|
<h3>Invite someone to code with you</h3>
|
|
2176
|
-
<p class="hint">Send a link. Clicking it opens this codebase in Quilt${viewInvite ? ', and you approve them before they get in' : ''}.
|
|
2177
|
-
${
|
|
2178
|
-
<div class="invite-pair">
|
|
2179
|
-
<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>
|
|
2180
|
-
<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>
|
|
2181
|
-
</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 ? `
|
|
2182
2177
|
<div class="codebox"><code id="empty-invite">${esc(invite)}</code></div>
|
|
2183
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>`}
|
|
2184
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 }) })) },
|