heyquilt 0.3.181 → 0.3.183

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +101 -97
  2. package/RELEASES.md +17 -0
  3. package/bin/quilt.js +32 -32
  4. package/desktop/main.js +1 -1
  5. package/package.json +1 -1
  6. package/src/account.js +2 -2
  7. package/src/admit-policy.js +2 -2
  8. package/src/agent-join.js +3 -3
  9. package/src/agent-task-workflow.js +14 -14
  10. package/src/ai-vm.js +1 -1
  11. package/src/api/agent-placement.js +2 -2
  12. package/src/api/audit.js +1 -1
  13. package/src/api/file-paths.js +1 -1
  14. package/src/api/file-store.js +1 -1
  15. package/src/api/invite-email.js +4 -4
  16. package/src/api/join-text.js +5 -5
  17. package/src/api/notify.js +7 -7
  18. package/src/api/permissions.js +1 -1
  19. package/src/api/routes/agent-wake.js +1 -1
  20. package/src/api/routes/agents.js +2 -2
  21. package/src/api/routes/ai-vm.js +5 -5
  22. package/src/api/routes/connections.js +13 -13
  23. package/src/api/routes/grants.js +2 -2
  24. package/src/api/routes/mail.js +10 -10
  25. package/src/api/routes/relay.js +1 -1
  26. package/src/api/routes/secrets.js +11 -11
  27. package/src/api/routes/session-invites.js +5 -5
  28. package/src/api/routes/sessions.js +3 -3
  29. package/src/api/routes/workspace-agents.js +14 -14
  30. package/src/api/routes/workspace-files.js +12 -12
  31. package/src/api/routes/workspace-invites.js +5 -5
  32. package/src/api/routes/workspaces.js +11 -11
  33. package/src/api/secrets-access.js +1 -1
  34. package/src/api/server.js +3 -3
  35. package/src/api/team-access.js +1 -1
  36. package/src/api/workspace-access.js +1 -1
  37. package/src/api/workspace-reach.js +3 -3
  38. package/src/app-tools.js +10 -10
  39. package/src/autowork.js +4 -4
  40. package/src/branch-view.js +1 -1
  41. package/src/catchup.js +5 -5
  42. package/src/chat-links.js +18 -18
  43. package/src/connection.js +11 -11
  44. package/src/control.js +5 -5
  45. package/src/conversation.js +1 -1
  46. package/src/doctor.js +2 -2
  47. package/src/duties.js +1 -1
  48. package/src/fsutil.js +1 -1
  49. package/src/gitstate.js +117 -1
  50. package/src/held.js +4 -4
  51. package/src/hooks.js +3 -3
  52. package/src/hosted-client.js +2 -2
  53. package/src/identity.js +1 -1
  54. package/src/inbox.js +1 -1
  55. package/src/key-cli.js +1 -1
  56. package/src/mail-tools.js +11 -11
  57. package/src/mcp-proxy.js +1 -1
  58. package/src/mcp.js +59 -59
  59. package/src/new-session.js +112 -0
  60. package/src/project-rules.js +2 -2
  61. package/src/relay-ask.js +2 -2
  62. package/src/relay-cluster.js +3 -3
  63. package/src/relay-live-write.js +3 -3
  64. package/src/relay-mcp.js +56 -56
  65. package/src/relay-prune.js +1 -1
  66. package/src/relay-turn-sync.js +1 -1
  67. package/src/repo-ref.js +54 -0
  68. package/src/secret-import.js +1 -1
  69. package/src/secret-names.js +6 -6
  70. package/src/secret-run.js +3 -3
  71. package/src/server.js +41 -41
  72. package/src/session-access.js +3 -3
  73. package/src/session-name.js +1 -1
  74. package/src/session.js +118 -52
  75. package/src/setup.js +7 -7
  76. package/src/status.js +2 -2
  77. package/src/tasks.js +1 -1
  78. package/src/turn-sync.js +4 -4
  79. package/src/ui/account-sessions.js +2 -2
  80. package/src/ui/agent-env-key.js +1 -1
  81. package/src/ui/agent-guide.js +35 -35
  82. package/src/ui/agent-kinds.js +8 -8
  83. package/src/ui/agent-place.js +16 -16
  84. package/src/ui/agents-table.js +6 -6
  85. package/src/ui/app.css +357 -0
  86. package/src/ui/app.js +29 -14
  87. package/src/ui/board.js +2 -2
  88. package/src/ui/catchup.js +5 -5
  89. package/src/ui/changes-seen.js +2 -2
  90. package/src/ui/changes.js +3 -3
  91. package/src/ui/cloud-ai.js +12 -12
  92. package/src/ui/common.js +1 -1
  93. package/src/ui/connections.js +1 -1
  94. package/src/ui/diffview.js +2 -2
  95. package/src/ui/feed.js +1 -1
  96. package/src/ui/feedback.js +4 -4
  97. package/src/ui/files.js +120 -14
  98. package/src/ui/fileview.js +3 -3
  99. package/src/ui/git-rule.js +3 -3
  100. package/src/ui/home.js +95 -67
  101. package/src/ui/index.html +1 -1
  102. package/src/ui/invite.js +8 -8
  103. package/src/ui/invites.js +3 -3
  104. package/src/ui/new-session.js +151 -0
  105. package/src/ui/prail-model.js +22 -0
  106. package/src/ui/prail.js +43 -0
  107. package/src/ui/project-board.js +359 -0
  108. package/src/ui/project-model.js +197 -0
  109. package/src/ui/project-pop.js +451 -0
  110. package/src/ui/projects.js +406 -0
  111. package/src/ui/sandbox-keys.js +3 -3
  112. package/src/ui/secrets-view.js +5 -5
  113. package/src/ui/session-words.js +2 -2
  114. package/src/ui/session.js +156 -43
  115. package/src/ui/tree.js +3 -3
  116. package/src/ui/voice.js +6 -6
  117. package/src/ui/workspaces.js +23 -23
  118. package/src/ui-server.js +104 -26
  119. package/src/update-check.js +2 -2
  120. package/src/voice.js +7 -7
  121. package/src/wake-tool.js +1 -1
  122. package/src/webhooks.js +1 -1
  123. package/src/workspace-cli.js +12 -12
  124. package/src/workspace-tools.js +33 -33
@@ -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 ? 'session' : 'sessions'}</span><span><b>${w.counts?.files ?? 0}</b> ${w.counts?.files === 1 ? 'file' : 'files'}</span></div>
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 workspace</b><span>Sessions, files and agents in one place</span>
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 workspaces</h2><span class="count">${list.length}</span><span class="spacer"></span>
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">Sessions not in a workspace</h2><span class="count">${loose.length}</span><span class="spacer"></span>
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 session</span></button>
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 workspace" aria-label="Move to a workspace">${I.folder}</button>` : ''}
121
- </div>`).join('')}</div>` : `<p class="hint">${state.sessions.size || state.recent.length ? 'Every session is in a workspace.' : 'No sessions yet.'}</p>`}
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 workspace you can edit.')
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 workspace's admins can add its people." : n ? `Moved, with ${n} ${n === 1 ? 'person or agent' : 'people and agents'} added to the workspace` : 'Moved')
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 workspace', name: (state.workspaces || []).find((x) => x.id === id)?.name || '', steady })
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 workspaces</a>
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, 'session', 'sessions')}${stat(fileCount, 'file', 'files')}${stat(people.length + agents.length, 'person or agent', 'people and agents')}</div>
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 workspace">${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="Workspace settings" aria-label="Workspace settings">${I.gear}</button>` : ''}</div>
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>Sessions</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 session</span></button>` : ''}</div>
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 sessions yet.${d.access.access === 'edit' ? ' Start one with New session: it opens a folder of yours here.' : ''}</p>`}
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 workspace?', message: 'They lose access to its sessions unless a session owner lets them in directly.', ok: 'Remove', danger: true })) return
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 workspace?', message: `${m.name} leaves this workspace and its sessions. It keeps its other workspaces, and you can let it back in here.`, ok: 'Not in this workspace', danger: true })) return
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>Workspace settings</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 workspace</button>' : ''}<span class="spacer"></span><button type="button" class="btn ghost" data-cancel>Cancel</button><button class="btn primary" type="submit">Save</button></div>`)
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 sessions stay, outside any workspace. Type the workspace name to confirm.', ok: 'Delete', danger: true, input: { placeholder: w.name } })
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
@@ -14,6 +14,7 @@ import { runSession, decodeInvite, encodeInvite, newConn, readConfig, recentSess
14
14
  import { MAX_SHARED_FILE_BYTES } from './protocol.js'
15
15
  import { getSettings, saveSettings, unsupportedRelay, relayUrl } from './settings.js'
16
16
  import { PICKUP_MODES, pickupMode } from './tasks.js'
17
+ import { prepareFolder, lookAt, briefTicket } from './new-session.js'
17
18
  import { execFile } from 'node:child_process'
18
19
  import { installedEditors, openIn, copyToClipboard } from './editors.js'
19
20
  import { autowork, autoConfig, publicConfig, AUTO_MODES } from './autowork.js'
@@ -45,9 +46,9 @@ const COLOR_RE = /^#[0-9a-f]{6}$/i
45
46
  const THEMES = ['light', 'dark', 'system']
46
47
  const SAVE_FAILED = "Quilt couldn't save your sign-in on this computer."
47
48
  const SIGNED_OUT_MESSAGE = 'This computer was signed out. Sign in again.'
48
- const LOCAL_RELAY_GONE = "This session ran on your computer's own relay, which Quilt no longer supports. Your files are untouched."
49
+ const LOCAL_RELAY_GONE = "This codebase ran on your computer's own relay, which Quilt no longer supports. Your files are untouched."
49
50
  // There is no New session from GitHub. Said to an older window that still offers it.
50
- export const GITHUB_GONE = 'Starting a session from GitHub is gone: clone the repository and start a session from its folder. The session\'s folder is a git folder: commit and push with git as usual.'
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.'
51
52
  const STATUS_PUSH_MS = 500 // a session's status goes to the window at most this often when the session changes it
52
53
  // Until this computer is signed in, only these answer.
53
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'])
@@ -181,11 +182,18 @@ export const STATIC = {
181
182
  '/loom.js': ['loom.js', 'text/javascript; charset=utf-8'],
182
183
  '/loom-model.js': ['loom-model.js', 'text/javascript; charset=utf-8'],
183
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'],
184
191
  '/rail-model.js': ['rail-model.js', 'text/javascript; charset=utf-8'],
185
192
  '/feedback.js': ['feedback.js', 'text/javascript; charset=utf-8'],
186
193
  '/feedback-model.js': ['feedback-model.js', 'text/javascript; charset=utf-8'],
187
194
  '/loom.css': ['loom.css', 'text/css; charset=utf-8'],
188
195
  '/board.js': ['board.js', 'text/javascript; charset=utf-8'],
196
+ '/new-session.js': ['new-session.js', 'text/javascript; charset=utf-8'],
189
197
  '/schedule.js': ['schedule.js', 'text/javascript; charset=utf-8'],
190
198
  '/workspaces.js': ['workspaces.js', 'text/javascript; charset=utf-8'],
191
199
  '/invites.js': ['invites.js', 'text/javascript; charset=utf-8'],
@@ -434,7 +442,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
434
442
 
435
443
  // One of your sessions that isn't on this computer yet: joined by its room, with no link (accountSessions).
436
444
  const byRoom = (room) => {
437
- if (!/^[A-Za-z0-9_-]{1,64}$/.test(String(room))) throw httpError(400, 'Which session?')
445
+ if (!/^[A-Za-z0-9_-]{1,64}$/.test(String(room))) throw httpError(400, 'Which codebase?')
438
446
  return { server: relayUrl(), room: String(room), secret: '' }
439
447
  }
440
448
  // Its folder is named after the session when that folder is free, otherwise after its room.
@@ -444,7 +452,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
444
452
  return dir && !fs.existsSync(dir) ? dir : underJoinDir(joinDir, room)
445
453
  }
446
454
 
447
- async function start ({ mode, dir, tool, invite, room, name, prefer, workspace }) {
455
+ async function start ({ mode, dir, tool, invite, room, name, prefer, workspace, source, repo, brief, into }) {
448
456
  // An older window may still ask for a session from GitHub: it is told to start from a folder.
449
457
  if (mode === 'github') throw httpError(410, GITHUB_GONE)
450
458
  const me = profile()
@@ -453,7 +461,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
453
461
  // Signing out (or in again) replaces `passes`, so a start that outlives the sign-in it began under can tell.
454
462
  const current = () => passes === sessionPasses
455
463
  const outlived = () => readAccount()
456
- ? httpError(409, 'Your sign-in changed while this session was starting. Start it again.')
464
+ ? httpError(409, 'Your sign-in changed while this codebase was starting. Start it again.')
457
465
  : Object.assign(httpError(401, 'Sign in to Quilt first.'), { signedOut: true })
458
466
  tool = tool || me.tool
459
467
  prefer = prefer || (me.preferLocal ? 'local' : 'remote')
@@ -471,7 +479,16 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
471
479
  if (mode === 'join' && !dir) {
472
480
  dir = room ? byRoomFolder(me.joinDir, byRoom(room).room, name) : underJoinDir(me.joinDir, decodeInvite(invite || '').room)
473
481
  }
474
- if (!dir) throw new Error('Choose a project folder.')
482
+ // A new session's folder has git before the session starts in it (new-session.js): a clone, a
483
+ // folder already here, or something new, with what the person wants to build as its first ticket.
484
+ let project = null
485
+ if (mode === 'create') {
486
+ if (dir) dir = path.resolve(expandHome(dir))
487
+ if (dir && runs.has(idFor(dir))) return summary(idFor(dir))
488
+ project = await prepareFolder({ source: source || 'folder', dir: dir || '', repo, name, brief, base: path.resolve(expandHome(into || me.joinDir)), who: { name: me.name } })
489
+ dir = project.dir
490
+ }
491
+ if (!dir) throw new Error('Choose a folder.')
475
492
  dir = path.resolve(expandHome(dir))
476
493
  const id = idFor(dir)
477
494
  if (runs.has(id)) return summary(id)
@@ -482,7 +499,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
482
499
  conn = room ? byRoom(room) : decodeInvite(invite || '')
483
500
  } else if (mode === 'rejoin') {
484
501
  const saved = readConfig(dir)
485
- if (!saved) throw new Error('No previous session in that folder.')
502
+ if (!saved) throw new Error('No previous codebase in that folder.')
486
503
  if (unsupportedRelay(saved.server)) throw httpError(400, LOCAL_RELAY_GONE)
487
504
  conn = { server: saved.server, room: saved.room, secret: saved.secret, ...(saved.viewSecret ? { viewSecret: saved.viewSecret } : {}) }
488
505
  inviteServer = unsupportedRelay(saved.inviteServer) ? undefined : saved.inviteServer
@@ -515,7 +532,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
515
532
  // Secrets (`quilt run` in this folder): the API as this computer's account.
516
533
  apiAuth: personApiAuth,
517
534
  // A new session is named after its folder (the owner can rename it later).
518
- startName: mode === 'create' ? cleanSessionName([...path.basename(dir)].slice(0, SESSION_NAME_MAX).join('')) || '' : '',
535
+ startName: mode === 'create' ? cleanSessionName([...((project && project.name) || path.basename(dir))].slice(0, SESSION_NAME_MAX).join('')) || '' : '',
519
536
  workspace: workspace || '',
520
537
  onLog: log,
521
538
  onFatal: async (err) => {
@@ -527,6 +544,9 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
527
544
  }
528
545
  })
529
546
  } catch (err) {
547
+ // A clone or a new project made a moment ago for a session that then couldn't start: taken away
548
+ // again, so trying once more doesn't make a second folder beside it.
549
+ if (project && project.made) { try { fs.rmSync(dir, { recursive: true, force: true }) } catch {} }
530
550
  if (!current()) throw outlived()
531
551
  if (err.signedOut) {
532
552
  await signedOut('revoked')
@@ -541,6 +561,14 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
541
561
  }
542
562
  runs.set(id, entry)
543
563
  const s = entry.run.session
564
+ // What the person said they want to build is the project's first ticket, for their AI to pick up.
565
+ const first = project && briefTicket(project.brief)
566
+ if (first) {
567
+ try {
568
+ const t = s.addTask({ title: first.title })
569
+ if (first.comment) s.commentTask({ id: t.id, text: first.comment })
570
+ } catch (err) { log(`could not add the first ticket: ${err.message}`) }
571
+ }
544
572
  s.on('status-changed', () => pushSoon(id))
545
573
  s.on('access', () => pushSoon(id))
546
574
  s.on('message', (m) => broadcast('message', { id, message: m }))
@@ -566,7 +594,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
566
594
  // Put the new room in its workspace before anyone else connects. A failure is logged, never
567
595
  // fatal, and the session is outside any workspace here too, as it is on the API.
568
596
  const linked = await asAccount((token) => setSessionWorkspace({ token, id: workspace, room: conn.room })).then(() => true, (err) => {
569
- log(`could not add this session to its workspace: ${err.message}`)
597
+ log(`could not add this codebase to its project: ${err.message}`)
570
598
  forgetWorkspace(entry.run.dir)
571
599
  return false
572
600
  })
@@ -594,7 +622,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
594
622
 
595
623
  const get = (id) => {
596
624
  const r = runs.get(id)
597
- if (!r) throw httpError(404, 'That session is not running.')
625
+ if (!r) throw httpError(404, 'That codebase is not running.')
598
626
  return r.run.session
599
627
  }
600
628
 
@@ -605,7 +633,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
605
633
  */
606
634
  async function rename (id, raw) {
607
635
  const s = get(id)
608
- if (!s.isOwner) throw httpError(403, 'Only the session owner can rename it.')
636
+ if (!s.isOwner) throw httpError(403, "Only the codebase's owner can rename it.")
609
637
  const name = cleanSessionName(raw)
610
638
  if (!name) throw httpError(400, BAD_SESSION_NAME)
611
639
  await s.rename(name)
@@ -626,8 +654,8 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
626
654
  if (!readAccount()) return
627
655
  asAccount((token) => aiVmFollow({ token, link })).then((has) => {
628
656
  hasCloudAi = has
629
- if (has) log('☁️ your cloud AI is joining this session too')
630
- }, (err) => log(`could not tell your cloud AI about this session: ${err.message}`))
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}`))
631
659
  }
632
660
  // Sessions handed to the cloud AI since it was connected (rooms), so each is handed over once.
633
661
  const handed = new Set()
@@ -815,7 +843,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
815
843
  }
816
844
  })
817
845
  const needInviteId = (id) => { if (!/^[0-9a-f-]{36}$/i.test(String(id || ''))) throw httpError(400, 'Which invite?'); return String(id) }
818
- const needWorkspaceId = (id) => { if (!/^[0-9a-f-]{36}$/i.test(String(id || ''))) throw httpError(400, 'Which workspace?'); return id }
846
+ const needWorkspaceId = (id) => { if (!/^[0-9a-f-]{36}$/i.test(String(id || ''))) throw httpError(400, 'Which project?'); return id }
819
847
  const needAgentId = (id) => { if (!/^[0-9a-f-]{36}$/i.test(String(id || ''))) throw httpError(400, 'Which agent?'); return id }
820
848
  const needKeyId = (id) => { if (!/^[0-9a-f-]{36}$/i.test(String(id || ''))) throw httpError(400, 'Which key?'); return String(id) }
821
849
  /**
@@ -845,12 +873,12 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
845
873
  const ACCOUNT = /^(person|agent):[A-Za-z0-9_-]{1,64}$/
846
874
  const owned = (id) => {
847
875
  const s = get(id)
848
- if (!s.isOwner) throw httpError(403, 'Only the session owner can do that.')
876
+ if (!s.isOwner) throw httpError(403, "Only the codebase's owner can do that.")
849
877
  return s
850
878
  }
851
879
  const admitter = (id) => {
852
880
  const s = get(id)
853
- if (!s.canAdmit) throw httpError(403, 'You cannot let people into this session.')
881
+ if (!s.canAdmit) throw httpError(403, 'You cannot let people into this codebase.')
854
882
  return s
855
883
  }
856
884
  const typeById = async (token, typeId) => {
@@ -907,7 +935,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
907
935
  const workspace = r && readConfig(r.run.dir)?.workspace
908
936
  if (!workspacesOn || !workspace) return { ok: true, notified: false }
909
937
  const sent = await asAccount((token) => announceSessionStarted({ token, id: workspace, room: s.room, link: r.run.invite, agents: [agentId] }))
910
- .catch((err) => { r.log?.(`could not send that agent this session's link: ${err.message}`); return null })
938
+ .catch((err) => { r.log?.(`could not send that agent this codebase's link: ${err.message}`); return null })
911
939
  return { ok: true, notified: !!sent?.notified?.includes(agentId) }
912
940
  }
913
941
 
@@ -928,7 +956,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
928
956
  let timer
929
957
  const late = new Promise((resolve, reject) => { timer = setTimeout(() => reject(new Error('Quilt took too long to answer')), keepOutMs) })
930
958
  await Promise.race([asAccount((token) => excludeSessionAgent({ token, room: s.room, agentId: agent[1] })), late])
931
- .catch((err) => r.log?.(`could not keep that agent out of this session: ${err.message}`))
959
+ .catch((err) => r.log?.(`could not keep that agent out of this codebase: ${err.message}`))
932
960
  .finally(() => clearTimeout(timer))
933
961
  }
934
962
  let warning = ''
@@ -1015,7 +1043,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
1015
1043
  },
1016
1044
  'POST /api/secrets/env-scan': (b) => {
1017
1045
  const dirs = envDirs(b)
1018
- if (!dirs.length) return { files: [], empty: 'Open this session (or one of the workspace\'s) on this computer to import its .env files.' }
1046
+ if (!dirs.length) return { files: [], empty: 'Open this codebase (or one of the project\'s) on this computer to import its .env files.' }
1019
1047
  return { files: envFilesIn(dirs) }
1020
1048
  },
1021
1049
  'POST /api/secrets/env-import': (b) => {
@@ -1044,6 +1072,15 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
1044
1072
  },
1045
1073
  'GET /api/agents': () => asAccount(async (token) => ({ agents: await listAgents({ token, activity: true }) })),
1046
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
+ }),
1047
1084
  // `global` (workspaces on): a global agent's invite. Without it, the invite as it always was.
1048
1085
  'POST /api/agent-invites': (b) => asAccount((token) => createAgentInvite({ token, global: workspacesOn && b?.global === true })),
1049
1086
  'GET /api/workspaces': () => workspaceList(),
@@ -1061,7 +1098,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
1061
1098
  'POST /api/agents/:id/sandbox-keys': (b, id) => asAccount(async (token) => {
1062
1099
  const pick = String(b.session || '')
1063
1100
  const local = pick.startsWith('local:') ? localSessions().find((s) => s.value === pick) : null
1064
- if (pick.startsWith('local:') && !local) throw httpError(404, 'That session is not on this computer any more.')
1101
+ if (pick.startsWith('local:') && !local) throw httpError(404, 'That codebase is not on this computer any more.')
1065
1102
  const where = local ? { session: local.link, sessionName: local.name } : pick.startsWith('room:') ? { room: pick.slice(5) } : { session: String(b.link || '').trim() }
1066
1103
  const r = await createSandboxKey({ token, id: needAgentId(id), name: String(b.name || '').trim(), ...where })
1067
1104
  return { envKey: r.envKey, key: r.key }
@@ -1080,10 +1117,10 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
1080
1117
  // workspace. Its people and agents come along when you manage the workspace (`added`).
1081
1118
  'POST /api/workspaces/:id/sessions/move': (b, id) => asAccount(async (token) => {
1082
1119
  const live = b.session ? runs.get(String(b.session)) : null
1083
- if (b.session && !live) throw httpError(404, 'That session is not open.')
1120
+ if (b.session && !live) throw httpError(404, 'That codebase is not open.')
1084
1121
  const dir = live ? live.run.dir : path.resolve(expandHome(String(b.dir || '')))
1085
1122
  const saved = readConfig(dir)
1086
- if (!saved) throw httpError(404, 'No session in that folder.')
1123
+ if (!saved) throw httpError(404, 'No codebase in that folder.')
1087
1124
  const r = await moveSessionToWorkspace({ token, id: needWorkspaceId(id), room: saved.room })
1088
1125
  writePrivateJson(path.join(dir, '.quilt', 'config.json'), { ...readConfig(dir), workspace: id })
1089
1126
  rememberWorkspace(dir, id)
@@ -1115,6 +1152,8 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
1115
1152
  'POST /api/invites/:id/decline': (b, id) => asAccount(async (token) => answerMyInvite({ token, id: needInviteId(id), how: 'decline' })),
1116
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 }) })),
1117
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),
1118
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 } }) })),
1119
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 } }),
1120
1159
  'POST /api/workspaces/:id/folders': (b, id) => asAccount(async (token) => ({ file: await createWorkspaceFolder({ token, id: needWorkspaceId(id), path: String(b.path || '') }) })),
@@ -1142,6 +1181,8 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
1142
1181
  workspacesOn
1143
1182
  }),
1144
1183
  'POST /api/sessions': (b) => start(b),
1184
+ // What starting a session from this would do (new-session.js), shown as the person fills the form in: nothing is made.
1185
+ 'POST /api/new-session/look': (b) => lookAt({ source: b.source, dir: b.dir ? path.resolve(expandHome(String(b.dir))) : '', repo: b.repo, name: b.name, base: path.resolve(expandHome(String(b.into || '') || profile().joinDir)) }),
1145
1186
  'POST /api/sessions/:id/open-in': async (b, id) => { await openIn(String(b.app || ''), get(id).root); return { ok: true } },
1146
1187
  // Gathering the project's AI rules into AGENTS.md (project-rules.js): look first, then apply what was shown.
1147
1188
  'GET /api/sessions/:id/rules/gather': (b, id) => get(id).rulesGatherPlan(),
@@ -1164,7 +1205,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
1164
1205
  'POST /api/sessions/:id/attach-from-workspace': async (b, id) => {
1165
1206
  const s = get(id)
1166
1207
  const workspace = (readConfig(s.root) || {}).workspace
1167
- if (!workspace) throw httpError(400, 'This session is not in a workspace.')
1208
+ if (!workspace) throw httpError(400, 'This codebase is not in a project.')
1168
1209
  const info = await asAccount((token) => workspaceFileDownload({ token, id: workspace, fileId: String(b.fileId || '') }))
1169
1210
  if (info.size > MAX_SHARED_FILE_BYTES) throw httpError(413, 'That file is too big to send in chat (100 MB at most).')
1170
1211
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'quilt-wsattach-'))
@@ -1205,7 +1246,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
1205
1246
  },
1206
1247
  'GET /api/sessions/:id/file': (b, id, url) => {
1207
1248
  const f = get(id).readShared(url.searchParams.get('path'))
1208
- if (!f) throw httpError(404, 'That file is not in this session.')
1249
+ if (!f) throw httpError(404, 'That file is not in this codebase.')
1209
1250
  return f
1210
1251
  },
1211
1252
  'POST /api/sessions/:id/members/approve': async (b, id) => {
@@ -1231,7 +1272,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
1231
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 } },
1232
1273
  'POST /api/sessions/:id/summarize': (b, id) => {
1233
1274
  const r = runs.get(id)
1234
- if (!r) throw httpError(404, 'That session is not running.')
1275
+ if (!r) throw httpError(404, 'That codebase is not running.')
1235
1276
  return { on: r.run.session.setSummarize(b.on ? r.run.summarizer() : null) }
1236
1277
  },
1237
1278
  'POST /api/sessions/:id/sharing': (b, id) => ({ on: get(id).setAgentSharing(b.on !== false) }),
@@ -1335,6 +1376,10 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
1335
1376
  return res.end(fs.readFileSync(LOGO))
1336
1377
  }
1337
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
+
1338
1383
  const supplied = req.headers['x-quilt-token'] || url.searchParams.get('t')
1339
1384
  if (supplied !== token) return json(401, { error: 'Open quilt from the link printed by `quilt ui`.' })
1340
1385
 
@@ -1492,7 +1537,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
1492
1537
  // token): no sniffing, and a sandbox for every type but PDF, which Chromium won't render sandboxed.
1493
1538
  function serveRaw (res, session, rel, download) {
1494
1539
  const f = session.readSharedBytes(rel)
1495
- if (!f) throw httpError(404, 'That file is not in this session.')
1540
+ if (!f) throw httpError(404, 'That file is not in this codebase.')
1496
1541
  const name = path.basename(f.path)
1497
1542
  const type = download ? 'application/octet-stream' : rawType(name)
1498
1543
  res.writeHead(200, {
@@ -1538,6 +1583,39 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
1538
1583
  } finally { fs.rmSync(dir, { recursive: true, force: true }) }
1539
1584
  }
1540
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
+
1541
1619
  /** Streams a workspace file to the page, so previews stay same-origin. */
1542
1620
  async function streamWorkspaceFile (req, res, id, fileId) {
1543
1621
  const url = new URL(req.url, 'http://x')
@@ -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 rejoin the session.'
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 session needs ${version ? `Quilt ${version} or later` : 'a newer version of Quilt'}. Update Quilt, then join again.`
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 session owner turns transcripts on.'
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 session.'
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 session\'s agents join its calls.'
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 session yet.'
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 session\'s voice call, or leave it (leave: true). Agents are not in a call until someone says their name in it: ' +
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 session\'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 session owner has transcripts on, each person who agreed has their own speech written here. ' +
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 session's own address. Recorded: ${r.wake.label}.`
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.`