heyquilt 0.3.182 → 0.3.183
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -97
- package/RELEASES.md +8 -0
- package/bin/quilt.js +32 -32
- package/desktop/main.js +1 -1
- package/package.json +1 -1
- package/src/account.js +2 -2
- package/src/admit-policy.js +2 -2
- package/src/agent-join.js +3 -3
- package/src/agent-task-workflow.js +14 -14
- package/src/ai-vm.js +1 -1
- package/src/api/agent-placement.js +2 -2
- package/src/api/audit.js +1 -1
- package/src/api/file-paths.js +1 -1
- package/src/api/file-store.js +1 -1
- package/src/api/invite-email.js +4 -4
- package/src/api/join-text.js +5 -5
- package/src/api/notify.js +7 -7
- package/src/api/permissions.js +1 -1
- package/src/api/routes/agent-wake.js +1 -1
- package/src/api/routes/agents.js +2 -2
- package/src/api/routes/ai-vm.js +5 -5
- package/src/api/routes/connections.js +13 -13
- package/src/api/routes/grants.js +2 -2
- package/src/api/routes/mail.js +10 -10
- package/src/api/routes/relay.js +1 -1
- package/src/api/routes/secrets.js +11 -11
- package/src/api/routes/session-invites.js +5 -5
- package/src/api/routes/sessions.js +3 -3
- package/src/api/routes/workspace-agents.js +14 -14
- package/src/api/routes/workspace-files.js +12 -12
- package/src/api/routes/workspace-invites.js +5 -5
- package/src/api/routes/workspaces.js +11 -11
- package/src/api/secrets-access.js +1 -1
- package/src/api/server.js +3 -3
- package/src/api/team-access.js +1 -1
- package/src/api/workspace-access.js +1 -1
- package/src/api/workspace-reach.js +3 -3
- package/src/app-tools.js +10 -10
- package/src/autowork.js +4 -4
- package/src/branch-view.js +1 -1
- package/src/catchup.js +5 -5
- package/src/chat-links.js +18 -18
- package/src/connection.js +11 -11
- package/src/control.js +5 -5
- package/src/conversation.js +1 -1
- package/src/doctor.js +2 -2
- package/src/duties.js +1 -1
- package/src/fsutil.js +1 -1
- package/src/held.js +4 -4
- package/src/hooks.js +3 -3
- package/src/hosted-client.js +2 -2
- package/src/identity.js +1 -1
- package/src/inbox.js +1 -1
- package/src/key-cli.js +1 -1
- package/src/mail-tools.js +11 -11
- package/src/mcp-proxy.js +1 -1
- package/src/mcp.js +59 -59
- package/src/new-session.js +6 -6
- package/src/project-rules.js +2 -2
- package/src/relay-ask.js +2 -2
- package/src/relay-cluster.js +3 -3
- package/src/relay-live-write.js +3 -3
- package/src/relay-mcp.js +56 -56
- package/src/relay-prune.js +1 -1
- package/src/relay-turn-sync.js +1 -1
- package/src/secret-import.js +1 -1
- package/src/secret-names.js +6 -6
- package/src/secret-run.js +3 -3
- package/src/server.js +41 -41
- package/src/session-access.js +3 -3
- package/src/session-name.js +1 -1
- package/src/session.js +50 -50
- package/src/setup.js +7 -7
- package/src/status.js +2 -2
- package/src/tasks.js +1 -1
- package/src/turn-sync.js +4 -4
- package/src/ui/account-sessions.js +2 -2
- package/src/ui/agent-env-key.js +1 -1
- package/src/ui/agent-guide.js +35 -35
- package/src/ui/agent-kinds.js +8 -8
- package/src/ui/agent-place.js +16 -16
- package/src/ui/agents-table.js +6 -6
- package/src/ui/app.css +331 -0
- package/src/ui/app.js +28 -13
- package/src/ui/board.js +2 -2
- package/src/ui/catchup.js +5 -5
- package/src/ui/changes-seen.js +2 -2
- package/src/ui/changes.js +3 -3
- package/src/ui/cloud-ai.js +12 -12
- package/src/ui/common.js +1 -1
- package/src/ui/connections.js +1 -1
- package/src/ui/diffview.js +2 -2
- package/src/ui/feed.js +1 -1
- package/src/ui/feedback.js +4 -4
- package/src/ui/files.js +120 -14
- package/src/ui/fileview.js +3 -3
- package/src/ui/git-rule.js +3 -3
- package/src/ui/home.js +92 -47
- package/src/ui/index.html +1 -1
- package/src/ui/invite.js +8 -8
- package/src/ui/invites.js +3 -3
- package/src/ui/new-session.js +3 -3
- package/src/ui/prail-model.js +22 -0
- package/src/ui/prail.js +43 -0
- package/src/ui/project-board.js +359 -0
- package/src/ui/project-model.js +197 -0
- package/src/ui/project-pop.js +451 -0
- package/src/ui/projects.js +406 -0
- package/src/ui/sandbox-keys.js +3 -3
- package/src/ui/secrets-view.js +5 -5
- package/src/ui/session-words.js +2 -2
- package/src/ui/session.js +156 -43
- package/src/ui/tree.js +3 -3
- package/src/ui/voice.js +6 -6
- package/src/ui/workspaces.js +23 -23
- package/src/ui-server.js +78 -24
- package/src/update-check.js +2 -2
- package/src/voice.js +7 -7
- package/src/wake-tool.js +1 -1
- package/src/webhooks.js +1 -1
- package/src/workspace-cli.js +12 -12
- package/src/workspace-tools.js +33 -33
package/src/ui/workspaces.js
CHANGED
|
@@ -60,7 +60,7 @@ function cardHtml (w) {
|
|
|
60
60
|
<div class="ws-card-body">
|
|
61
61
|
<h3>${esc(w.name)} <span class="pill ws-space${w.space?.kind === 'org' ? ' coral' : ''}">${esc(spaceLabel(w))}</span></h3>
|
|
62
62
|
<p class="ws-desc">${esc(w.description || '')}</p>
|
|
63
|
-
<div class="ws-stats"><span><b>${w.counts?.sessions ?? 0}</b> ${w.counts?.sessions === 1 ? '
|
|
63
|
+
<div class="ws-stats"><span><b>${w.counts?.sessions ?? 0}</b> ${w.counts?.sessions === 1 ? 'codebase' : 'codebases'}</span><span><b>${w.counts?.files ?? 0}</b> ${w.counts?.files === 1 ? 'artifact' : 'artifacts'}</span></div>
|
|
64
64
|
</div>
|
|
65
65
|
<div class="ws-foot"><span>${esc(plural((w.counts?.members ?? 0) + (w.space?.kind === 'personal' ? 1 : 0), 'member', 'members'))}</span><span class="spacer"></span><span>${w.archivedAt ? 'archived' : esc(ago(w.createdAt))}</span></div>
|
|
66
66
|
</div>`
|
|
@@ -69,7 +69,7 @@ function cardHtml (w) {
|
|
|
69
69
|
function addCardHtml () {
|
|
70
70
|
return `
|
|
71
71
|
<div class="ws-card add" data-add-ws role="button" tabindex="0">
|
|
72
|
-
<span class="ws-plus">${I.plus}</span><b>Add
|
|
72
|
+
<span class="ws-plus">${I.plus}</span><b>Add project</b><span>Codebases, artifacts and agents in one place</span>
|
|
73
73
|
</div>`
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -103,22 +103,22 @@ export function workspacesHtml () {
|
|
|
103
103
|
const loose = looseRows()
|
|
104
104
|
return `
|
|
105
105
|
<section class="workspaces">
|
|
106
|
-
<div class="sec-head"><h2>Your
|
|
106
|
+
<div class="sec-head"><h2>Your projects</h2><span class="count">${list.length}</span><span class="spacer"></span>
|
|
107
107
|
${spaces().size > 2 ? `<div class="segmented ws-filter" role="tablist">${[...spaces()].map(([k, label]) => `<button type="button" role="tab" data-space-filter="${esc(k)}" class="${filter === k ? 'on' : ''}" aria-selected="${filter === k}">${esc(label)}</button>`).join('')}</div>` : ''}
|
|
108
108
|
</div>
|
|
109
109
|
<div class="ws-grid">${list.map(cardHtml).join('')}${state.addingWorkspace ? addFormHtml() : addCardHtml()}</div>
|
|
110
110
|
</section>
|
|
111
111
|
<section class="ws-loose">
|
|
112
|
-
<div class="sec-head"><h2 class="ws-loose-h">
|
|
112
|
+
<div class="sec-head"><h2 class="ws-loose-h">Codebases not in a project</h2><span class="count">${loose.length}</span><span class="spacer"></span>
|
|
113
113
|
<button class="btn sm ghost" data-join-session>${I.link}<span>Join with an invite</span></button>
|
|
114
|
-
<button class="btn sm" data-new-session>${I.plus}<span>New
|
|
114
|
+
<button class="btn sm" data-new-session>${I.plus}<span>New codebase</span></button>
|
|
115
115
|
</div>
|
|
116
116
|
${loose.length ? `<div class="ws-chips">${loose.map((r) => `
|
|
117
117
|
<div class="ws-chip"><span class="folder-ico${r.live ? ' live' : ''}">${I.folder}</span>
|
|
118
118
|
<span class="t"><b>${esc(basename(r.dir))}</b><span>${r.live ? (r.peers ? `${r.peers} other${r.peers === 1 ? '' : 's'} here` : 'just you') : esc(ago(r.lastUsed))}</span></span>
|
|
119
119
|
${r.live ? `<button class="btn sm primary" data-go="${esc(r.id)}">Open</button>` : `<button class="btn sm" data-rejoin="${esc(r.dir)}">Rejoin</button>`}
|
|
120
|
-
${state.workspaces?.length ? `<button class="btn sm ghost" data-move-session="${esc(r.dir)}" title="Move to a
|
|
121
|
-
</div>`).join('')}</div>` : `<p class="hint">${state.sessions.size || state.recent.length ? 'Every
|
|
120
|
+
${state.workspaces?.length ? `<button class="btn sm ghost" data-move-session="${esc(r.dir)}" title="Move to a project" aria-label="Move to a project">${I.folder}</button>` : ''}
|
|
121
|
+
</div>`).join('')}</div>` : `<p class="hint">${state.sessions.size || state.recent.length ? 'Every codebase is in a project.' : 'No codebases yet.'}</p>`}
|
|
122
122
|
</section>`
|
|
123
123
|
}
|
|
124
124
|
|
|
@@ -158,7 +158,7 @@ export function bindWorkspaces (root, { go, rerender }) {
|
|
|
158
158
|
root.querySelectorAll('[data-move-session]').forEach((b) => {
|
|
159
159
|
b.onclick = async () => {
|
|
160
160
|
const options = (state.workspaces || []).filter((w) => w.access === 'edit')
|
|
161
|
-
if (!options.length) return toast('No
|
|
161
|
+
if (!options.length) return toast('No project you can edit.')
|
|
162
162
|
const choice = await ask({ title: `Move ${basename(b.dataset.moveSession)} to`, input: { select: options.map((w) => ({ value: w.id, label: w.name })) }, ok: 'Move' })
|
|
163
163
|
if (!choice) return
|
|
164
164
|
try {
|
|
@@ -169,7 +169,7 @@ export function bindWorkspaces (root, { go, rerender }) {
|
|
|
169
169
|
for (const sum of st.sessions) { const s = state.sessions.get(sum.id); if (s) s.workspace = sum.workspace }
|
|
170
170
|
await loadWorkspaces(); rerender()
|
|
171
171
|
const n = (moved.added || []).length
|
|
172
|
-
toast(moved.peopleNeedAdmin ? "Moved. Only the
|
|
172
|
+
toast(moved.peopleNeedAdmin ? "Moved. Only the project's admins can add its people." : n ? `Moved, with ${n} ${n === 1 ? 'person or agent' : 'people and agents'} added to the project` : 'Moved')
|
|
173
173
|
} catch (err) { toast(err.message) }
|
|
174
174
|
}
|
|
175
175
|
})
|
|
@@ -226,7 +226,7 @@ export function workspacePageHtml () {
|
|
|
226
226
|
// A refresh while it is still loading draws it again without fading it in again.
|
|
227
227
|
const steady = state.wsLoading === id
|
|
228
228
|
state.wsLoading = id
|
|
229
|
-
return loadingHtml({ label: 'Loading
|
|
229
|
+
return loadingHtml({ label: 'Loading project', name: (state.workspaces || []).find((x) => x.id === id)?.name || '', steady })
|
|
230
230
|
}
|
|
231
231
|
const w = d.workspace
|
|
232
232
|
const admin = d.access.admin
|
|
@@ -252,29 +252,29 @@ export function workspacePageHtml () {
|
|
|
252
252
|
state.wsLoading = null
|
|
253
253
|
return `
|
|
254
254
|
<div class="ws-page${enter ? ' enter' : ''}">
|
|
255
|
-
<a class="ws-back" href="#" data-ws-back>${I.caret} All
|
|
255
|
+
<a class="ws-back" href="#" data-ws-back>${I.caret} All projects</a>
|
|
256
256
|
<header class="ws-head">
|
|
257
257
|
<span class="ws-mark big" style="background:${coverOf(w)}">${esc(initial(w.name))}</span>
|
|
258
258
|
<div class="ws-head-t">
|
|
259
259
|
<h1>${esc(w.name)} <span class="pill ws-space${w.orgId ? ' coral' : ''}">${esc(w.orgId ? d.owner.name : 'Personal')}</span>${w.archivedAt ? ' <span class="pill">Archived</span>' : ''}</h1>
|
|
260
260
|
${w.description ? `<p>${esc(w.description)}</p>` : ''}
|
|
261
|
-
<div class="ws-statline">${running.length ? `<span class="live"><span class="dot"></span><b>${running.length}</b> open now</span>` : ''}${stat(sessionCount, '
|
|
261
|
+
<div class="ws-statline">${running.length ? `<span class="live"><span class="dot"></span><b>${running.length}</b> open now</span>` : ''}${stat(sessionCount, 'codebase', 'codebases')}${stat(fileCount, 'artifact', 'artifacts')}${stat(people.length + agents.length, 'person or agent', 'people and agents')}</div>
|
|
262
262
|
</div>
|
|
263
|
-
<div class="acts"><button class="btn sm" data-team title="People and agents in this
|
|
263
|
+
<div class="acts"><button class="btn sm" data-team title="People and agents in this project">${I.users}<span>Team</span><span class="count">${people.length + agents.length}</span></button>${admin ? `<button class="btn sm" data-invite-ws>${I.link}<span>Invite</span></button><button class="btn sm ghost icon" data-ws-settings title="Project settings" aria-label="Project settings">${I.gear}</button>` : ''}</div>
|
|
264
264
|
</header>
|
|
265
265
|
|
|
266
266
|
<div class="ws-dash">
|
|
267
267
|
<div class="ws-main">
|
|
268
268
|
<section class="sec">
|
|
269
|
-
<div class="sec-head"><h2>
|
|
270
|
-
${d.access.access === 'edit' ? `<button type="button" class="btn sm" data-new-session-in="${esc(w.id)}">${I.plus}<span>New
|
|
269
|
+
<div class="sec-head"><h2>Codebases</h2><span class="count">${sessionCount}</span><span class="spacer"></span>
|
|
270
|
+
${d.access.access === 'edit' ? `<button type="button" class="btn sm" data-new-session-in="${esc(w.id)}">${I.plus}<span>New codebase</span></button>` : ''}</div>
|
|
271
271
|
${sessionCount
|
|
272
272
|
? `<div class="sr-list">
|
|
273
273
|
${running.map((s) => sessionRowHtml(d.sessions.find((x) => x.room === s.status.room), { live: true, dir: s.dir, id: s.id, peers: s.status.peers.length })).join('')}
|
|
274
274
|
${recent.map((r) => sessionRowHtml(d.sessions.find((x) => x.room === r.room), { live: false, dir: r.dir, lastUsed: r.lastUsed })).join('')}
|
|
275
275
|
${others.map((s) => sessionRowHtml(s, { live: false, mine: s.ownerAccount === me })).join('')}
|
|
276
276
|
</div>`
|
|
277
|
-
: `<p class="hint ws-empty">No
|
|
277
|
+
: `<p class="hint ws-empty">No codebases yet.${d.access.access === 'edit' ? ' Start one with New codebase: it opens a folder of yours here.' : ''}</p>`}
|
|
278
278
|
</section>
|
|
279
279
|
${filesSectionHtml(d)}
|
|
280
280
|
${state.secretsOn ? '<section class="sec ws-secrets" data-ws-secrets></section>' : ''}
|
|
@@ -289,7 +289,7 @@ export function workspacePageHtml () {
|
|
|
289
289
|
* badge), nine a page with a search, Add for admins, and each card's ⋮ menu. It reads the open
|
|
290
290
|
* workspace afresh after every change, so it stays right while open.
|
|
291
291
|
*/
|
|
292
|
-
function openTeamDialog ({ id, inviteDialog, reload, rerender }) {
|
|
292
|
+
export function openTeamDialog ({ id, inviteDialog, reload, rerender }) {
|
|
293
293
|
$('#team-back')?.remove()
|
|
294
294
|
const d = state.workspace
|
|
295
295
|
if (!d || d.workspace.id !== id) return
|
|
@@ -338,11 +338,11 @@ function openTeamDialog ({ id, inviteDialog, reload, rerender }) {
|
|
|
338
338
|
toast('Saved')
|
|
339
339
|
}
|
|
340
340
|
if (what === 'remove') {
|
|
341
|
-
if (!await ask({ title: 'Remove from this
|
|
341
|
+
if (!await ask({ title: 'Remove from this project?', message: 'They lose access to its codebases unless a codebase\'s owner lets them in directly.', ok: 'Remove', danger: true })) return
|
|
342
342
|
await api('POST', wsUrl(id, '/members/remove'), { account: m.account })
|
|
343
343
|
}
|
|
344
344
|
if (what === 'exclude') {
|
|
345
|
-
if (!await ask({ title: 'Not in this
|
|
345
|
+
if (!await ask({ title: 'Not in this project?', message: `${m.name} leaves this project and its codebases. It keeps its other projects, and you can let it back in here.`, ok: 'Not in this project', danger: true })) return
|
|
346
346
|
await api('POST', agentUrl(m.agentId), { excluded: true })
|
|
347
347
|
}
|
|
348
348
|
if (what === 'include') { await api('POST', agentUrl(m.agentId, '/remove')); toast('Back in') }
|
|
@@ -394,17 +394,17 @@ function usageLine (u) {
|
|
|
394
394
|
}
|
|
395
395
|
|
|
396
396
|
/** `dialog(html)` is home.js's: a modal form that closes on Cancel, Escape or a click outside. */
|
|
397
|
-
function settingsDialog (reload, go, dialog) {
|
|
397
|
+
export function settingsDialog (reload, go, dialog) {
|
|
398
398
|
const w = state.workspace.workspace
|
|
399
399
|
const { form, close } = dialog(`
|
|
400
|
-
<h3>
|
|
400
|
+
<h3>Project settings</h3>
|
|
401
401
|
<div class="field"><label for="wss-name">Name</label><input class="input" id="wss-name" name="name" maxlength="80" required value="${esc(w.name)}"></div>
|
|
402
402
|
<div class="field"><label for="wss-desc">About</label><input class="input" id="wss-desc" name="description" maxlength="500" value="${esc(w.description || '')}"></div>
|
|
403
403
|
<div class="field"><span class="label">Colour</span><div class="swatches">${Object.entries(COLORS).map(([k, c]) => `<label class="swatch"><input type="radio" name="color" value="${k}" ${(w.color || 'lilac') === k ? 'checked' : ''}><span style="background:${c}"></span></label>`).join('')}</div></div>
|
|
404
404
|
<label class="toggle"><input type="checkbox" name="archived" ${w.archivedAt ? 'checked' : ''}><span class="track"><span class="knob"></span></span><span class="tg-text"><b>Archived</b><span class="hint">Kept, but out of the way.</span></span></label>
|
|
405
405
|
${usageLine(state.workspace.usage)}
|
|
406
406
|
<p class="error" data-error></p>
|
|
407
|
-
<div class="actions">${state.workspace.canDelete ? '<button type="button" class="btn ghost danger" data-delete>Delete
|
|
407
|
+
<div class="actions">${state.workspace.canDelete ? '<button type="button" class="btn ghost danger" data-delete>Delete project</button>' : ''}<span class="spacer"></span><button type="button" class="btn ghost" data-cancel>Cancel</button><button class="btn primary" type="submit">Save</button></div>`)
|
|
408
408
|
// Focus inside the dialog, so Escape (bound on the dialog) closes it straight away.
|
|
409
409
|
form.querySelector('#wss-name').focus()
|
|
410
410
|
form.onsubmit = async (e) => {
|
|
@@ -425,7 +425,7 @@ function settingsDialog (reload, go, dialog) {
|
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
427
|
form.querySelector('[data-delete]')?.addEventListener('click', async () => {
|
|
428
|
-
const typed = await ask({ title: `Delete ${w.name}?`, message: 'Its
|
|
428
|
+
const typed = await ask({ title: `Delete ${w.name}?`, message: 'Its codebases stay, in no project. Type the project\'s name to confirm.', ok: 'Delete', danger: true, input: { placeholder: w.name } })
|
|
429
429
|
if (typed !== w.name) { if (typed) toast('That is not the name.'); return }
|
|
430
430
|
try { await api('POST', wsUrl(w.id, '/delete')); close(); await loadWorkspaces(); go('home') } catch (err) { toast(err.message) }
|
|
431
431
|
})
|
package/src/ui-server.js
CHANGED
|
@@ -46,9 +46,9 @@ const COLOR_RE = /^#[0-9a-f]{6}$/i
|
|
|
46
46
|
const THEMES = ['light', 'dark', 'system']
|
|
47
47
|
const SAVE_FAILED = "Quilt couldn't save your sign-in on this computer."
|
|
48
48
|
const SIGNED_OUT_MESSAGE = 'This computer was signed out. Sign in again.'
|
|
49
|
-
const LOCAL_RELAY_GONE = "This
|
|
49
|
+
const LOCAL_RELAY_GONE = "This codebase ran on your computer's own relay, which Quilt no longer supports. Your files are untouched."
|
|
50
50
|
// There is no New session from GitHub. Said to an older window that still offers it.
|
|
51
|
-
export const GITHUB_GONE = 'Starting a
|
|
51
|
+
export const GITHUB_GONE = 'Starting a codebase from GitHub is gone: clone the repository and start a codebase from its folder. The codebase\'s folder is a git folder: commit and push with git as usual.'
|
|
52
52
|
const STATUS_PUSH_MS = 500 // a session's status goes to the window at most this often when the session changes it
|
|
53
53
|
// Until this computer is signed in, only these answer.
|
|
54
54
|
const OPEN_ROUTES = new Set(['GET /api/account', 'POST /api/account/start', 'POST /api/account/signup', 'POST /api/account/signup/confirm', 'POST /api/account/cancel', 'POST /api/account/signout', 'GET /api/events', 'POST /api/shutdown', 'POST /api/report'])
|
|
@@ -182,6 +182,12 @@ export const STATIC = {
|
|
|
182
182
|
'/loom.js': ['loom.js', 'text/javascript; charset=utf-8'],
|
|
183
183
|
'/loom-model.js': ['loom-model.js', 'text/javascript; charset=utf-8'],
|
|
184
184
|
'/rail.js': ['rail.js', 'text/javascript; charset=utf-8'],
|
|
185
|
+
'/projects.js': ['projects.js', 'text/javascript; charset=utf-8'],
|
|
186
|
+
'/project-model.js': ['project-model.js', 'text/javascript; charset=utf-8'],
|
|
187
|
+
'/project-board.js': ['project-board.js', 'text/javascript; charset=utf-8'],
|
|
188
|
+
'/project-pop.js': ['project-pop.js', 'text/javascript; charset=utf-8'],
|
|
189
|
+
'/prail.js': ['prail.js', 'text/javascript; charset=utf-8'],
|
|
190
|
+
'/prail-model.js': ['prail-model.js', 'text/javascript; charset=utf-8'],
|
|
185
191
|
'/rail-model.js': ['rail-model.js', 'text/javascript; charset=utf-8'],
|
|
186
192
|
'/feedback.js': ['feedback.js', 'text/javascript; charset=utf-8'],
|
|
187
193
|
'/feedback-model.js': ['feedback-model.js', 'text/javascript; charset=utf-8'],
|
|
@@ -436,7 +442,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
436
442
|
|
|
437
443
|
// One of your sessions that isn't on this computer yet: joined by its room, with no link (accountSessions).
|
|
438
444
|
const byRoom = (room) => {
|
|
439
|
-
if (!/^[A-Za-z0-9_-]{1,64}$/.test(String(room))) throw httpError(400, 'Which
|
|
445
|
+
if (!/^[A-Za-z0-9_-]{1,64}$/.test(String(room))) throw httpError(400, 'Which codebase?')
|
|
440
446
|
return { server: relayUrl(), room: String(room), secret: '' }
|
|
441
447
|
}
|
|
442
448
|
// Its folder is named after the session when that folder is free, otherwise after its room.
|
|
@@ -455,7 +461,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
455
461
|
// Signing out (or in again) replaces `passes`, so a start that outlives the sign-in it began under can tell.
|
|
456
462
|
const current = () => passes === sessionPasses
|
|
457
463
|
const outlived = () => readAccount()
|
|
458
|
-
? httpError(409, 'Your sign-in changed while this
|
|
464
|
+
? httpError(409, 'Your sign-in changed while this codebase was starting. Start it again.')
|
|
459
465
|
: Object.assign(httpError(401, 'Sign in to Quilt first.'), { signedOut: true })
|
|
460
466
|
tool = tool || me.tool
|
|
461
467
|
prefer = prefer || (me.preferLocal ? 'local' : 'remote')
|
|
@@ -482,7 +488,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
482
488
|
project = await prepareFolder({ source: source || 'folder', dir: dir || '', repo, name, brief, base: path.resolve(expandHome(into || me.joinDir)), who: { name: me.name } })
|
|
483
489
|
dir = project.dir
|
|
484
490
|
}
|
|
485
|
-
if (!dir) throw new Error('Choose a
|
|
491
|
+
if (!dir) throw new Error('Choose a folder.')
|
|
486
492
|
dir = path.resolve(expandHome(dir))
|
|
487
493
|
const id = idFor(dir)
|
|
488
494
|
if (runs.has(id)) return summary(id)
|
|
@@ -493,7 +499,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
493
499
|
conn = room ? byRoom(room) : decodeInvite(invite || '')
|
|
494
500
|
} else if (mode === 'rejoin') {
|
|
495
501
|
const saved = readConfig(dir)
|
|
496
|
-
if (!saved) throw new Error('No previous
|
|
502
|
+
if (!saved) throw new Error('No previous codebase in that folder.')
|
|
497
503
|
if (unsupportedRelay(saved.server)) throw httpError(400, LOCAL_RELAY_GONE)
|
|
498
504
|
conn = { server: saved.server, room: saved.room, secret: saved.secret, ...(saved.viewSecret ? { viewSecret: saved.viewSecret } : {}) }
|
|
499
505
|
inviteServer = unsupportedRelay(saved.inviteServer) ? undefined : saved.inviteServer
|
|
@@ -588,7 +594,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
588
594
|
// Put the new room in its workspace before anyone else connects. A failure is logged, never
|
|
589
595
|
// fatal, and the session is outside any workspace here too, as it is on the API.
|
|
590
596
|
const linked = await asAccount((token) => setSessionWorkspace({ token, id: workspace, room: conn.room })).then(() => true, (err) => {
|
|
591
|
-
log(`could not add this
|
|
597
|
+
log(`could not add this codebase to its project: ${err.message}`)
|
|
592
598
|
forgetWorkspace(entry.run.dir)
|
|
593
599
|
return false
|
|
594
600
|
})
|
|
@@ -616,7 +622,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
616
622
|
|
|
617
623
|
const get = (id) => {
|
|
618
624
|
const r = runs.get(id)
|
|
619
|
-
if (!r) throw httpError(404, 'That
|
|
625
|
+
if (!r) throw httpError(404, 'That codebase is not running.')
|
|
620
626
|
return r.run.session
|
|
621
627
|
}
|
|
622
628
|
|
|
@@ -627,7 +633,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
627
633
|
*/
|
|
628
634
|
async function rename (id, raw) {
|
|
629
635
|
const s = get(id)
|
|
630
|
-
if (!s.isOwner) throw httpError(403,
|
|
636
|
+
if (!s.isOwner) throw httpError(403, "Only the codebase's owner can rename it.")
|
|
631
637
|
const name = cleanSessionName(raw)
|
|
632
638
|
if (!name) throw httpError(400, BAD_SESSION_NAME)
|
|
633
639
|
await s.rename(name)
|
|
@@ -648,8 +654,8 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
648
654
|
if (!readAccount()) return
|
|
649
655
|
asAccount((token) => aiVmFollow({ token, link })).then((has) => {
|
|
650
656
|
hasCloudAi = has
|
|
651
|
-
if (has) log('☁️ your cloud AI is joining this
|
|
652
|
-
}, (err) => log(`could not tell your cloud AI about this
|
|
657
|
+
if (has) log('☁️ your cloud AI is joining this codebase too')
|
|
658
|
+
}, (err) => log(`could not tell your cloud AI about this codebase: ${err.message}`))
|
|
653
659
|
}
|
|
654
660
|
// Sessions handed to the cloud AI since it was connected (rooms), so each is handed over once.
|
|
655
661
|
const handed = new Set()
|
|
@@ -837,7 +843,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
837
843
|
}
|
|
838
844
|
})
|
|
839
845
|
const needInviteId = (id) => { if (!/^[0-9a-f-]{36}$/i.test(String(id || ''))) throw httpError(400, 'Which invite?'); return String(id) }
|
|
840
|
-
const needWorkspaceId = (id) => { if (!/^[0-9a-f-]{36}$/i.test(String(id || ''))) throw httpError(400, 'Which
|
|
846
|
+
const needWorkspaceId = (id) => { if (!/^[0-9a-f-]{36}$/i.test(String(id || ''))) throw httpError(400, 'Which project?'); return id }
|
|
841
847
|
const needAgentId = (id) => { if (!/^[0-9a-f-]{36}$/i.test(String(id || ''))) throw httpError(400, 'Which agent?'); return id }
|
|
842
848
|
const needKeyId = (id) => { if (!/^[0-9a-f-]{36}$/i.test(String(id || ''))) throw httpError(400, 'Which key?'); return String(id) }
|
|
843
849
|
/**
|
|
@@ -867,12 +873,12 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
867
873
|
const ACCOUNT = /^(person|agent):[A-Za-z0-9_-]{1,64}$/
|
|
868
874
|
const owned = (id) => {
|
|
869
875
|
const s = get(id)
|
|
870
|
-
if (!s.isOwner) throw httpError(403,
|
|
876
|
+
if (!s.isOwner) throw httpError(403, "Only the codebase's owner can do that.")
|
|
871
877
|
return s
|
|
872
878
|
}
|
|
873
879
|
const admitter = (id) => {
|
|
874
880
|
const s = get(id)
|
|
875
|
-
if (!s.canAdmit) throw httpError(403, 'You cannot let people into this
|
|
881
|
+
if (!s.canAdmit) throw httpError(403, 'You cannot let people into this codebase.')
|
|
876
882
|
return s
|
|
877
883
|
}
|
|
878
884
|
const typeById = async (token, typeId) => {
|
|
@@ -929,7 +935,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
929
935
|
const workspace = r && readConfig(r.run.dir)?.workspace
|
|
930
936
|
if (!workspacesOn || !workspace) return { ok: true, notified: false }
|
|
931
937
|
const sent = await asAccount((token) => announceSessionStarted({ token, id: workspace, room: s.room, link: r.run.invite, agents: [agentId] }))
|
|
932
|
-
.catch((err) => { r.log?.(`could not send that agent this
|
|
938
|
+
.catch((err) => { r.log?.(`could not send that agent this codebase's link: ${err.message}`); return null })
|
|
933
939
|
return { ok: true, notified: !!sent?.notified?.includes(agentId) }
|
|
934
940
|
}
|
|
935
941
|
|
|
@@ -950,7 +956,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
950
956
|
let timer
|
|
951
957
|
const late = new Promise((resolve, reject) => { timer = setTimeout(() => reject(new Error('Quilt took too long to answer')), keepOutMs) })
|
|
952
958
|
await Promise.race([asAccount((token) => excludeSessionAgent({ token, room: s.room, agentId: agent[1] })), late])
|
|
953
|
-
.catch((err) => r.log?.(`could not keep that agent out of this
|
|
959
|
+
.catch((err) => r.log?.(`could not keep that agent out of this codebase: ${err.message}`))
|
|
954
960
|
.finally(() => clearTimeout(timer))
|
|
955
961
|
}
|
|
956
962
|
let warning = ''
|
|
@@ -1037,7 +1043,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1037
1043
|
},
|
|
1038
1044
|
'POST /api/secrets/env-scan': (b) => {
|
|
1039
1045
|
const dirs = envDirs(b)
|
|
1040
|
-
if (!dirs.length) return { files: [], empty: 'Open this
|
|
1046
|
+
if (!dirs.length) return { files: [], empty: 'Open this codebase (or one of the project\'s) on this computer to import its .env files.' }
|
|
1041
1047
|
return { files: envFilesIn(dirs) }
|
|
1042
1048
|
},
|
|
1043
1049
|
'POST /api/secrets/env-import': (b) => {
|
|
@@ -1066,6 +1072,15 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1066
1072
|
},
|
|
1067
1073
|
'GET /api/agents': () => asAccount(async (token) => ({ agents: await listAgents({ token, activity: true }) })),
|
|
1068
1074
|
'GET /api/agents/:id/details': (b, id) => asAccount((token) => agentDetails({ token, id: needAgentId(id) })),
|
|
1075
|
+
// Your agents with where each works (its placement), for Home's Agents: one answer for the page, eight agents asked at a time.
|
|
1076
|
+
'GET /api/agents/placed': () => asAccount(async (token) => {
|
|
1077
|
+
const agents = await listAgents({ token })
|
|
1078
|
+
const out = []
|
|
1079
|
+
for (let i = 0; i < agents.length; i += 8) {
|
|
1080
|
+
out.push(...await Promise.all(agents.slice(i, i + 8).map(async (a) => ({ ...a, placement: await getAgentPlacement({ token, id: a.id }).catch(() => null) }))))
|
|
1081
|
+
}
|
|
1082
|
+
return { agents: out }
|
|
1083
|
+
}),
|
|
1069
1084
|
// `global` (workspaces on): a global agent's invite. Without it, the invite as it always was.
|
|
1070
1085
|
'POST /api/agent-invites': (b) => asAccount((token) => createAgentInvite({ token, global: workspacesOn && b?.global === true })),
|
|
1071
1086
|
'GET /api/workspaces': () => workspaceList(),
|
|
@@ -1083,7 +1098,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1083
1098
|
'POST /api/agents/:id/sandbox-keys': (b, id) => asAccount(async (token) => {
|
|
1084
1099
|
const pick = String(b.session || '')
|
|
1085
1100
|
const local = pick.startsWith('local:') ? localSessions().find((s) => s.value === pick) : null
|
|
1086
|
-
if (pick.startsWith('local:') && !local) throw httpError(404, 'That
|
|
1101
|
+
if (pick.startsWith('local:') && !local) throw httpError(404, 'That codebase is not on this computer any more.')
|
|
1087
1102
|
const where = local ? { session: local.link, sessionName: local.name } : pick.startsWith('room:') ? { room: pick.slice(5) } : { session: String(b.link || '').trim() }
|
|
1088
1103
|
const r = await createSandboxKey({ token, id: needAgentId(id), name: String(b.name || '').trim(), ...where })
|
|
1089
1104
|
return { envKey: r.envKey, key: r.key }
|
|
@@ -1102,10 +1117,10 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1102
1117
|
// workspace. Its people and agents come along when you manage the workspace (`added`).
|
|
1103
1118
|
'POST /api/workspaces/:id/sessions/move': (b, id) => asAccount(async (token) => {
|
|
1104
1119
|
const live = b.session ? runs.get(String(b.session)) : null
|
|
1105
|
-
if (b.session && !live) throw httpError(404, 'That
|
|
1120
|
+
if (b.session && !live) throw httpError(404, 'That codebase is not open.')
|
|
1106
1121
|
const dir = live ? live.run.dir : path.resolve(expandHome(String(b.dir || '')))
|
|
1107
1122
|
const saved = readConfig(dir)
|
|
1108
|
-
if (!saved) throw httpError(404, 'No
|
|
1123
|
+
if (!saved) throw httpError(404, 'No codebase in that folder.')
|
|
1109
1124
|
const r = await moveSessionToWorkspace({ token, id: needWorkspaceId(id), room: saved.room })
|
|
1110
1125
|
writePrivateJson(path.join(dir, '.quilt', 'config.json'), { ...readConfig(dir), workspace: id })
|
|
1111
1126
|
rememberWorkspace(dir, id)
|
|
@@ -1137,6 +1152,8 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1137
1152
|
'POST /api/invites/:id/decline': (b, id) => asAccount(async (token) => answerMyInvite({ token, id: needInviteId(id), how: 'decline' })),
|
|
1138
1153
|
'GET /api/workspaces/:id/files': (b, id, url) => asAccount(async (token) => ({ files: await listWorkspaceFiles({ token, id: needWorkspaceId(id), folder: url.searchParams.get('folder') ?? undefined }) })),
|
|
1139
1154
|
'GET /api/workspaces/:id/files/:fid/versions': (b, id, url, fid) => asAccount(async (token) => ({ versions: await listWorkspaceFileVersions({ token, id: needWorkspaceId(id), fileId: fid }) })),
|
|
1155
|
+
// The address an HTML artifact's frame loads (serveSealed): asked for by the page, with its token.
|
|
1156
|
+
'POST /api/workspaces/:id/files/:fid/view': (b, id, url, fid) => sealedTicket(id, fid, b.version),
|
|
1140
1157
|
'POST /api/workspaces/:id/files/:fid/update': (b, id, url, fid) => asAccount(async (token) => ({ file: await updateWorkspaceFile({ token, id: needWorkspaceId(id), fileId: fid, patch: { path: b.path, note: b.note } }) })),
|
|
1141
1158
|
'POST /api/workspaces/:id/files/:fid/delete': (b, id, url, fid) => asAccount(async (token) => { await deleteWorkspaceFile({ token, id: needWorkspaceId(id), fileId: fid }); return { ok: true } }),
|
|
1142
1159
|
'POST /api/workspaces/:id/folders': (b, id) => asAccount(async (token) => ({ file: await createWorkspaceFolder({ token, id: needWorkspaceId(id), path: String(b.path || '') }) })),
|
|
@@ -1188,7 +1205,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1188
1205
|
'POST /api/sessions/:id/attach-from-workspace': async (b, id) => {
|
|
1189
1206
|
const s = get(id)
|
|
1190
1207
|
const workspace = (readConfig(s.root) || {}).workspace
|
|
1191
|
-
if (!workspace) throw httpError(400, 'This
|
|
1208
|
+
if (!workspace) throw httpError(400, 'This codebase is not in a project.')
|
|
1192
1209
|
const info = await asAccount((token) => workspaceFileDownload({ token, id: workspace, fileId: String(b.fileId || '') }))
|
|
1193
1210
|
if (info.size > MAX_SHARED_FILE_BYTES) throw httpError(413, 'That file is too big to send in chat (100 MB at most).')
|
|
1194
1211
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'quilt-wsattach-'))
|
|
@@ -1229,7 +1246,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1229
1246
|
},
|
|
1230
1247
|
'GET /api/sessions/:id/file': (b, id, url) => {
|
|
1231
1248
|
const f = get(id).readShared(url.searchParams.get('path'))
|
|
1232
|
-
if (!f) throw httpError(404, 'That file is not in this
|
|
1249
|
+
if (!f) throw httpError(404, 'That file is not in this codebase.')
|
|
1233
1250
|
return f
|
|
1234
1251
|
},
|
|
1235
1252
|
'POST /api/sessions/:id/members/approve': async (b, id) => {
|
|
@@ -1255,7 +1272,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1255
1272
|
'POST /api/sessions/:id/end': async (b, id) => { const room = get(id).room; await get(id).endForEveryone(); await stop(id); unfollowWithCloudAi(room); return { ok: true } },
|
|
1256
1273
|
'POST /api/sessions/:id/summarize': (b, id) => {
|
|
1257
1274
|
const r = runs.get(id)
|
|
1258
|
-
if (!r) throw httpError(404, 'That
|
|
1275
|
+
if (!r) throw httpError(404, 'That codebase is not running.')
|
|
1259
1276
|
return { on: r.run.session.setSummarize(b.on ? r.run.summarizer() : null) }
|
|
1260
1277
|
},
|
|
1261
1278
|
'POST /api/sessions/:id/sharing': (b, id) => ({ on: get(id).setAgentSharing(b.on !== false) }),
|
|
@@ -1359,6 +1376,10 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1359
1376
|
return res.end(fs.readFileSync(LOGO))
|
|
1360
1377
|
}
|
|
1361
1378
|
|
|
1379
|
+
// An HTML artifact, running in its sealed frame: the ticket in its address is all it has (never the token).
|
|
1380
|
+
const sealed = req.method === 'GET' && url.pathname.match(/^\/view\/([A-Za-z0-9_-]{20,64})$/)
|
|
1381
|
+
if (sealed) return serveSealed(res, sealed[1], req.headers.host).catch((err) => { if (!res.headersSent) json(502, { error: err.message }); else res.destroy() })
|
|
1382
|
+
|
|
1362
1383
|
const supplied = req.headers['x-quilt-token'] || url.searchParams.get('t')
|
|
1363
1384
|
if (supplied !== token) return json(401, { error: 'Open quilt from the link printed by `quilt ui`.' })
|
|
1364
1385
|
|
|
@@ -1516,7 +1537,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1516
1537
|
// token): no sniffing, and a sandbox for every type but PDF, which Chromium won't render sandboxed.
|
|
1517
1538
|
function serveRaw (res, session, rel, download) {
|
|
1518
1539
|
const f = session.readSharedBytes(rel)
|
|
1519
|
-
if (!f) throw httpError(404, 'That file is not in this
|
|
1540
|
+
if (!f) throw httpError(404, 'That file is not in this codebase.')
|
|
1520
1541
|
const name = path.basename(f.path)
|
|
1521
1542
|
const type = download ? 'application/octet-stream' : rawType(name)
|
|
1522
1543
|
res.writeHead(200, {
|
|
@@ -1562,6 +1583,39 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1562
1583
|
} finally { fs.rmSync(dir, { recursive: true, force: true }) }
|
|
1563
1584
|
}
|
|
1564
1585
|
|
|
1586
|
+
// An HTML artifact is shown running, as a page, inside a frame on the app's page. It must not be
|
|
1587
|
+
// able to reach the app: so the frame is given an address with a ticket in place of the token
|
|
1588
|
+
// (good for one file, for ten minutes), and the answer seals the page in. `sandbox allow-scripts`
|
|
1589
|
+
// gives it an origin of its own (no reading the app's page, its storage or its answers), and the
|
|
1590
|
+
// rest names what it may load: its own inline code and anything over https, never this computer.
|
|
1591
|
+
const SEALED_CSP = ["sandbox allow-scripts", "default-src 'none'", "script-src 'unsafe-inline' 'unsafe-eval' https:", "style-src 'unsafe-inline' https:", 'img-src https: data: blob:', 'font-src https: data:', 'media-src https: data: blob:', 'connect-src https:', 'worker-src blob:', "frame-src 'none'", "form-action 'none'", "base-uri 'none'"].join('; ')
|
|
1592
|
+
const SEALED_MS = 10 * 60 * 1000
|
|
1593
|
+
const SEALED_MAX_BYTES = 20 * 1024 * 1024
|
|
1594
|
+
const tickets = new Map() // ticket -> { id, fileId, version, until }
|
|
1595
|
+
|
|
1596
|
+
/** A ticket for one version of one workspace file, for the frame that shows it. */
|
|
1597
|
+
function sealedTicket (id, fileId, version) {
|
|
1598
|
+
const now = Date.now()
|
|
1599
|
+
for (const [k, t] of tickets) if (t.until < now) tickets.delete(k)
|
|
1600
|
+
if (tickets.size >= 500) tickets.delete(tickets.keys().next().value)
|
|
1601
|
+
const ticket = crypto.randomBytes(24).toString('base64url')
|
|
1602
|
+
tickets.set(ticket, { id: needWorkspaceId(id), fileId: String(fileId), version: version ? String(version) : undefined, until: now + SEALED_MS })
|
|
1603
|
+
return { url: `/view/${ticket}` }
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
async function serveSealed (res, ticket, host) {
|
|
1607
|
+
const t = tickets.get(ticket)
|
|
1608
|
+
const plain = (status, text) => { res.writeHead(status, { 'content-type': 'text/plain; charset=utf-8', 'content-security-policy': "sandbox; default-src 'none'", 'x-content-type-options': 'nosniff', 'cache-control': 'no-store' }); res.end(text) }
|
|
1609
|
+
if (!t || t.until < Date.now()) { tickets.delete(ticket); return plain(404, 'This view has expired. Open the artifact again.') }
|
|
1610
|
+
const info = await asAccount((token) => workspaceFileDownload({ token, id: t.id, fileId: t.fileId, version: t.version }))
|
|
1611
|
+
if ((info.size || 0) > SEALED_MAX_BYTES) return plain(413, 'This page is too big to show here. Download it to open it.')
|
|
1612
|
+
const r = await fetch(info.url)
|
|
1613
|
+
if (!r.ok) return plain(502, `The file could not be fetched (${r.status}).`)
|
|
1614
|
+
// Only the app's own page may frame it. Named in full: sealed, the page's own origin is no origin, so 'self' would match nothing.
|
|
1615
|
+
res.writeHead(200, { 'content-type': 'text/html; charset=utf-8', 'content-security-policy': `${SEALED_CSP}; frame-ancestors http://${host}`, 'x-content-type-options': 'nosniff', 'referrer-policy': 'no-referrer', 'cache-control': 'no-store' })
|
|
1616
|
+
await pipeline(Readable.fromWeb(r.body), res).catch(() => res.destroy())
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1565
1619
|
/** Streams a workspace file to the page, so previews stay same-origin. */
|
|
1566
1620
|
async function streamWorkspaceFile (req, res, id, fileId) {
|
|
1567
1621
|
const url = new URL(req.url, 'http://x')
|
package/src/update-check.js
CHANGED
|
@@ -5,13 +5,13 @@ import { currentVersion, latestRelease, compareVersions } from './releases.js'
|
|
|
5
5
|
|
|
6
6
|
// How to update each kind of install. Not npm: the heyquilt package there is behind the releases.
|
|
7
7
|
export const UPDATE_STEPS = 'In the desktop app: Settings → About → Update Quilt. On Linux without a desktop: curl -fsSL https://heyquilt.com/install.sh | sh'
|
|
8
|
-
export const UPDATE_HOW = 'Update Quilt (the desktop app: Settings → About → Update Quilt; on Linux without a desktop, run curl -fsSL https://heyquilt.com/install.sh | sh), then
|
|
8
|
+
export const UPDATE_HOW = 'Update Quilt (the desktop app: Settings → About → Update Quilt; on Linux without a desktop, run curl -fsSL https://heyquilt.com/install.sh | sh), then join the codebase again.'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* What the relay tells an app or CLI too old for a session: only what to do. `version` is the oldest
|
|
12
12
|
* Quilt the session takes, when there is one. It fits a WebSocket close frame (123 bytes).
|
|
13
13
|
*/
|
|
14
|
-
export const needsUpdateWords = (version = '') => `This
|
|
14
|
+
export const needsUpdateWords = (version = '') => `This codebase needs ${version ? `Quilt ${version} or later` : 'a newer version of Quilt'}. Update Quilt, then join again.`
|
|
15
15
|
|
|
16
16
|
const UPDATE_REFUSAL = /\bUpdate Quilt, then join again\./
|
|
17
17
|
|
package/src/voice.js
CHANGED
|
@@ -125,7 +125,7 @@ export function readLines (doc, { call = '', since = 0, limit = 200 } = {}) {
|
|
|
125
125
|
export const AGENT_OPEN_MS = 30 * 1000
|
|
126
126
|
// A named agent shows joining this long; one that never comes drops out of the call again.
|
|
127
127
|
export const AGENT_JOIN_MS = 10 * 60 * 1000
|
|
128
|
-
export const AGENT_NEEDS_TRANSCRIPTS = 'Agents hear a call through its transcript, and this one is not transcribed: the
|
|
128
|
+
export const AGENT_NEEDS_TRANSCRIPTS = 'Agents hear a call through its transcript, and this one is not transcribed: the codebase\'s owner turns transcripts on.'
|
|
129
129
|
// Agents in calls are paused (Daniel, 2026-11-06: "I dont want to see any agents join calls"):
|
|
130
130
|
// agents read transcripts with quilt_voice_transcript, but no agent joins a call, is sent a call's
|
|
131
131
|
// lines, or speaks in one, and the join and say tools are left out. setAgentsInCalls(true) is for
|
|
@@ -222,11 +222,11 @@ export function setAgentLeft (doc, { call, name, leave = true, now = Date.now()
|
|
|
222
222
|
|
|
223
223
|
/** Why agent `name` isn't in call `call` now, or '' when it is. */
|
|
224
224
|
export function notInCall (doc, { call, name, members = [] }) {
|
|
225
|
-
if (!call) return 'There is no call going on in this
|
|
225
|
+
if (!call) return 'There is no call going on in this codebase.'
|
|
226
226
|
if (!agentsInCalls) return AGENTS_PAUSED
|
|
227
227
|
if (!takesAgents(doc, call)) return AGENTS_DEV_ONLY
|
|
228
228
|
if (!transcribeSetting(doc, members).on) return AGENT_NEEDS_TRANSCRIPTS
|
|
229
|
-
if (!(members || []).some((m) => m && m.kind === 'agent' && m.name === name)) return 'Only the
|
|
229
|
+
if (!(members || []).some((m) => m && m.kind === 'agent' && m.name === name)) return 'Only the codebase\'s agents join its calls.'
|
|
230
230
|
if (leftCall(doc, call, name)) return 'You left this call: come back with quilt_voice_join.'
|
|
231
231
|
return ''
|
|
232
232
|
}
|
|
@@ -305,7 +305,7 @@ export function agentSays (doc, { call, name, text, members = [], fromChat = fal
|
|
|
305
305
|
|
|
306
306
|
/** Transcript lines as plain text for an agent: one per line, with who and when. */
|
|
307
307
|
export function renderLines ({ lines, more, calls }, { tz } = {}) {
|
|
308
|
-
if (!lines.length) return calls.length ? 'No transcript lines match.' : 'Nothing has been transcribed in this
|
|
308
|
+
if (!lines.length) return calls.length ? 'No transcript lines match.' : 'Nothing has been transcribed in this codebase yet.'
|
|
309
309
|
const time = (ts) => new Date(ts).toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit', ...(tz ? { timeZone: tz } : {}) })
|
|
310
310
|
const out = []
|
|
311
311
|
if (more) out.push('(older lines left out; ask with since or call for them)')
|
|
@@ -374,7 +374,7 @@ export function inVoice (awareness, clientID) {
|
|
|
374
374
|
return out
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
-
export const JOIN_DESCRIPTION = 'Join the
|
|
377
|
+
export const JOIN_DESCRIPTION = 'Join the codebase\'s voice call, or leave it (leave: true). Agents are not in a call until someone says their name in it: ' +
|
|
378
378
|
'then that person\'s line comes to you as a direct message, and your reply to it is said out loud in the call (speaking with quilt_voice_say, or joining with this, works too). ' +
|
|
379
379
|
'In the call you show muted unless you are speaking, and only a line that says your name reaches you; read the rest with quilt_voice_transcript.'
|
|
380
380
|
|
|
@@ -383,8 +383,8 @@ export const SAY_DESCRIPTION = 'Say something out loud in the voice call: everyo
|
|
|
383
383
|
'When someone names you, first say a few words at once that fit what they asked (what you are about to do, in your own words, never a stock phrase) so they know you heard, then answer once you have it. ' +
|
|
384
384
|
'Stay quiet when a line was not for you. [laugh], [sigh] and [hesitate] are spoken as sounds.'
|
|
385
385
|
|
|
386
|
-
export const TRANSCRIPT_DESCRIPTION = 'Read what people said in the
|
|
387
|
-
'People talk in calls in the Quilt app; while the
|
|
386
|
+
export const TRANSCRIPT_DESCRIPTION = 'Read what people said in the codebase\'s voice calls: the transcript lines, oldest first, with who said what and when. ' +
|
|
387
|
+
'People talk in calls in the Quilt app; while the codebase\'s owner has transcripts on, each person who agreed has their own speech written here. ' +
|
|
388
388
|
'quilt_status says who is in a call now. Read the latest call before acting on something decided out loud, and ask in chat when a line is unclear.'
|
|
389
389
|
|
|
390
390
|
/** Who is in a call, for an agent's status: a heading and a line each, or nothing when nobody is. `agents`: the agents in it ({ name }). */
|
package/src/wake-tool.js
CHANGED
|
@@ -43,7 +43,7 @@ export async function runWakeTool (args, { api, relay, onMention = null }) {
|
|
|
43
43
|
const r = await record({ code: args.code })
|
|
44
44
|
await relay.subscribe({ email: true })
|
|
45
45
|
await offElsewhere({ keepRelay: true })
|
|
46
|
-
return `Quilt wakes you by email now: each event goes to ${r.wake.detail.address} (a few at once come as one email), from the
|
|
46
|
+
return `Quilt wakes you by email now: each event goes to ${r.wake.detail.address} (a few at once come as one email), from the codebase's own address. Recorded: ${r.wake.label}.`
|
|
47
47
|
}
|
|
48
48
|
const r = await record({ address: args.address })
|
|
49
49
|
return `Quilt emailed a code to ${r.wake.pending.address}. Give it back with quilt_wake { method: "email", code: "<the code>" } within 30 minutes; nothing else is sent there until you do.`
|
package/src/webhooks.js
CHANGED
|
@@ -144,7 +144,7 @@ export function describeSubscription (sub, { showSecret = false } = {}) {
|
|
|
144
144
|
if (!sub) return 'No webhook: Quilt only answers quilt_inbox when you ask.'
|
|
145
145
|
const lines = [`Webhook: Quilt POSTs to ${sub.url} on ${sub.events.join(', ')}${sub.bearer ? ', with your bearer key in the Authorization header' : ''}${sub.coalesce ? ', a burst in one POST (its events in `events`)' : ''}${sub.local ? ' (sent from this computer: the relay cannot reach that URL)' : ''}.`]
|
|
146
146
|
if (showSecret) lines.push(`Secret (shown once; check x-quilt-signature with it): ${sub.secret}`)
|
|
147
|
-
lines.push('Each POST is JSON ({ event, id, session, workspace, room, to, by, text, ts, task?, mail?, call?, context? }; session: the
|
|
147
|
+
lines.push('Each POST is JSON ({ event, id, session, workspace, room, to, by, text, ts, task?, mail?, call?, context? }; session: the codebase it is from, which you name as `session` in the tools you answer with, so an answer never lands in another codebase; workspace: { id } of its project, or null; mail: { id } of an email to the codebase, read with quilt_mail; call: { id } on a direct message that is a line said to you in the codebase\'s voice call, whose reply is said out loud there; context: the messages before this one between you and its sender, oldest first) with x-quilt-event, x-quilt-delivery, x-quilt-timestamp and ' +
|
|
148
148
|
'x-quilt-signature: sha256=HMAC-SHA256(secret, "<timestamp>.<body>"). Answer 2xx quickly; a failed POST is retried a few times. ' +
|
|
149
149
|
'What you are told is still in quilt_inbox. quilt_webhook_test POSTs a webhook.test event now; stop with quilt_webhook_unsubscribe.')
|
|
150
150
|
return lines.join('\n')
|
package/src/workspace-cli.js
CHANGED
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
import { registerWorkspaceTools } from './workspace-tools.js'
|
|
6
6
|
|
|
7
7
|
export const WORKSPACE_USAGE = `Usage:
|
|
8
|
-
quilt workspace list
|
|
9
|
-
quilt workspace files <
|
|
10
|
-
quilt workspace get <
|
|
11
|
-
quilt workspace put <
|
|
12
|
-
|
|
13
|
-
quilt workspace write <
|
|
14
|
-
Save text as
|
|
15
|
-
quilt workspace mkdir <
|
|
16
|
-
quilt workspace mv <
|
|
17
|
-
quilt workspace rm <
|
|
18
|
-
quilt workspace webhook <https url> | webhook-off
|
|
19
|
-
<
|
|
8
|
+
quilt workspace list Projects you can reach
|
|
9
|
+
quilt workspace files <project> [folder] [--glob g] Its artifacts
|
|
10
|
+
quilt workspace get <project> <path> [--version n] Read an artifact (text is printed; anything else is saved and its path printed)
|
|
11
|
+
quilt workspace put <project> <path> <local file> [--note "what it is"]
|
|
12
|
+
Add a file from this folder as an artifact (a new version if the path exists)
|
|
13
|
+
quilt workspace write <project> <path> <text> [--note n]
|
|
14
|
+
Save text as an artifact
|
|
15
|
+
quilt workspace mkdir <project> <folder> Make a folder (and any above it)
|
|
16
|
+
quilt workspace mv <project> <path> <new path> Rename or move an artifact or folder
|
|
17
|
+
quilt workspace rm <project> <path> Delete an artifact or folder
|
|
18
|
+
quilt workspace webhook <https url> | webhook-off Project events to your URL (agents)
|
|
19
|
+
<project> is its name or id.`
|
|
20
20
|
|
|
21
21
|
/** Pulls `--name value` options out of `args`: { opts, rest }. */
|
|
22
22
|
function options (args, names) {
|