heyquilt 0.3.182 → 0.3.184

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 (126) hide show
  1. package/README.md +101 -97
  2. package/RELEASES.md +14 -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 +17 -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/memory-store.js +22 -1
  18. package/src/api/notify.js +7 -7
  19. package/src/api/permissions.js +1 -1
  20. package/src/api/routes/agent-wake.js +1 -1
  21. package/src/api/routes/agents.js +2 -2
  22. package/src/api/routes/ai-vm.js +5 -5
  23. package/src/api/routes/connections.js +66 -25
  24. package/src/api/routes/grants.js +2 -2
  25. package/src/api/routes/mail.js +10 -10
  26. package/src/api/routes/relay.js +1 -1
  27. package/src/api/routes/secrets.js +11 -11
  28. package/src/api/routes/session-invites.js +5 -5
  29. package/src/api/routes/sessions.js +3 -3
  30. package/src/api/routes/workspace-agents.js +14 -14
  31. package/src/api/routes/workspace-chat.js +77 -0
  32. package/src/api/routes/workspace-files.js +12 -12
  33. package/src/api/routes/workspace-invites.js +5 -5
  34. package/src/api/routes/workspaces.js +11 -11
  35. package/src/api/secrets-access.js +1 -1
  36. package/src/api/server.js +5 -4
  37. package/src/api/supabase-store.js +25 -1
  38. package/src/api/team-access.js +1 -1
  39. package/src/api/workspace-access.js +1 -1
  40. package/src/api/workspace-reach.js +3 -3
  41. package/src/app-tools.js +11 -11
  42. package/src/autowork.js +4 -4
  43. package/src/branch-view.js +1 -1
  44. package/src/catchup.js +5 -5
  45. package/src/chat-links.js +18 -18
  46. package/src/connection.js +11 -11
  47. package/src/control.js +5 -5
  48. package/src/conversation.js +1 -1
  49. package/src/doctor.js +2 -2
  50. package/src/duties.js +1 -1
  51. package/src/fsutil.js +1 -1
  52. package/src/held.js +4 -4
  53. package/src/hooks.js +3 -3
  54. package/src/hosted-client.js +2 -2
  55. package/src/identity.js +1 -1
  56. package/src/inbox.js +1 -1
  57. package/src/key-cli.js +1 -1
  58. package/src/mail-tools.js +11 -11
  59. package/src/mcp-proxy.js +1 -1
  60. package/src/mcp.js +59 -59
  61. package/src/new-session.js +6 -6
  62. package/src/project-rules.js +2 -2
  63. package/src/relay-ask.js +2 -2
  64. package/src/relay-cluster.js +3 -3
  65. package/src/relay-live-write.js +3 -3
  66. package/src/relay-mcp.js +56 -56
  67. package/src/relay-prune.js +1 -1
  68. package/src/relay-turn-sync.js +1 -1
  69. package/src/secret-import.js +1 -1
  70. package/src/secret-names.js +6 -6
  71. package/src/secret-run.js +3 -3
  72. package/src/server.js +41 -41
  73. package/src/session-access.js +3 -3
  74. package/src/session-name.js +1 -1
  75. package/src/session.js +50 -50
  76. package/src/setup.js +7 -7
  77. package/src/status.js +2 -2
  78. package/src/tasks.js +1 -1
  79. package/src/turn-sync.js +4 -4
  80. package/src/ui/account-sessions.js +2 -2
  81. package/src/ui/agent-env-key.js +1 -1
  82. package/src/ui/agent-guide.js +35 -35
  83. package/src/ui/agent-kinds.js +8 -8
  84. package/src/ui/agent-place.js +16 -16
  85. package/src/ui/agents-table.js +6 -6
  86. package/src/ui/app.css +345 -0
  87. package/src/ui/app.js +28 -13
  88. package/src/ui/board.js +2 -2
  89. package/src/ui/catchup.js +5 -5
  90. package/src/ui/changes-seen.js +2 -2
  91. package/src/ui/changes.js +3 -3
  92. package/src/ui/cloud-ai.js +12 -12
  93. package/src/ui/common.js +1 -1
  94. package/src/ui/connections.js +48 -8
  95. package/src/ui/diffview.js +2 -2
  96. package/src/ui/feed.js +1 -1
  97. package/src/ui/feedback.js +4 -4
  98. package/src/ui/files.js +120 -14
  99. package/src/ui/fileview.js +3 -3
  100. package/src/ui/git-rule.js +3 -3
  101. package/src/ui/home.js +97 -47
  102. package/src/ui/index.html +1 -1
  103. package/src/ui/invite.js +8 -8
  104. package/src/ui/invites.js +3 -3
  105. package/src/ui/new-session.js +3 -3
  106. package/src/ui/prail-model.js +22 -0
  107. package/src/ui/prail.js +43 -0
  108. package/src/ui/project-board.js +359 -0
  109. package/src/ui/project-channel.js +93 -0
  110. package/src/ui/project-model.js +224 -0
  111. package/src/ui/project-pop.js +451 -0
  112. package/src/ui/projects.js +464 -0
  113. package/src/ui/sandbox-keys.js +3 -3
  114. package/src/ui/secrets-view.js +5 -5
  115. package/src/ui/session-words.js +2 -2
  116. package/src/ui/session.js +174 -47
  117. package/src/ui/tree.js +3 -3
  118. package/src/ui/voice.js +6 -6
  119. package/src/ui/workspaces.js +23 -23
  120. package/src/ui-server.js +88 -27
  121. package/src/update-check.js +2 -2
  122. package/src/voice.js +7 -7
  123. package/src/wake-tool.js +1 -1
  124. package/src/webhooks.js +1 -1
  125. package/src/workspace-cli.js +12 -12
  126. package/src/workspace-tools.js +33 -33
package/src/ui/home.js CHANGED
@@ -6,7 +6,7 @@ import { agentPaste } from './invite.js'
6
6
  import { openKindMenu, kindLineHtml } from './agent-kinds.js'
7
7
  import { quiltMark } from './mark.js'
8
8
  import { updateControl } from './releases.js'
9
- import { workspacesHtml, bindWorkspaces, workspacePageHtml, bindWorkspacePage, loadWorkspaces, openWorkspace, COLORS } from './workspaces.js'
9
+ import { workspacesHtml, bindWorkspaces, workspacePageHtml, bindWorkspacePage, loadWorkspaces, openWorkspace, wsIdOf, COLORS } from './workspaces.js'
10
10
  import { allFilesHtml, bindAllFiles } from './files.js'
11
11
  import { invitesHtml, bindInvites } from './invites.js'
12
12
  import { accountRowsHtml, loadAccountSessions, bindAccountSessions } from './account-sessions.js'
@@ -18,6 +18,10 @@ import { thisSessionGitHtml } from './git-rule.js'
18
18
  import { cloudAiCardHtml, bindCloudAi, cloudSetupOn, cloudSetupHtml, cloudSetupStep } from './cloud-ai.js'
19
19
  import { feedbackDockHtml, bindFeedback } from './feedback.js'
20
20
  import { openNewCodebase } from './new-session.js'
21
+ import { projectShellHtml, bindProjectShell } from './projects.js'
22
+ import { holdProjectBoard } from './project-board.js'
23
+ import { mountConnections } from './connections.js'
24
+ import { openProjectPop } from './project-pop.js'
21
25
 
22
26
  export const tildify = (p) => state.defaults.home && String(p).startsWith(state.defaults.home) ? `~${String(p).slice(state.defaults.home.length)}` : p
23
27
  const hostOf = (url) => { try { return new URL(String(url).replace(/^ws/, 'http')).host } catch { return url } }
@@ -29,6 +33,32 @@ function greeting () {
29
33
  }
30
34
 
31
35
  // ---------------------------------------------------------------- shell --
36
+ /** Home or a project's page, with projects on. Settings and Agents are a pop-up over Home there, not pages. */
37
+ function renderProjects (view) {
38
+ const popup = view === 'settings' || view === 'agents' ? view : ''
39
+ if (popup) { view = 'home'; state.view = 'home' }
40
+ // A project's board that is being used (a card dragged, a name typed) is not drawn again under the hand: once that is over.
41
+ if (view === state.shellView && !popup && holdProjectBoard(() => { if (state.view === view) renderShell(view) })) return
42
+ const scroll = view === state.shellView ? ($('.pj-pmain') || $('#page'))?.scrollTop || 0 : 0
43
+ $('#app').innerHTML = projectShellHtml(view)
44
+ state.shellView = view
45
+ const main = $('.pj-pmain') || $('#page')
46
+ if (main && scroll) main.scrollTop = scroll
47
+ const rerender = () => { if (state.view === view) renderShell(view) }
48
+ bindProjectShell(view, {
49
+ go, rerender, newSessionDialog, joinSessionDialog, openSettings, bindSessionActions,
50
+ submitSession: async (body) => { const sum = await api('POST', '/api/sessions', body); state.sessions.set(sum.id, sum); await go(sum.id) }
51
+ })
52
+ if (popup) { if (popup === 'agents') state.settingsTab = 'agents'; openSettings() }
53
+ }
54
+
55
+ /** A project's settings, from the strip's gear: on the project's own page, which has it loaded. */
56
+ export async function openProjectSettings (id) {
57
+ if (!/^(ws|wsfiles):/.test(state.view) || wsIdOf(state.view) !== id) await go(`ws:${id}`)
58
+ if (state.workspace?.workspace?.id !== id) return
59
+ openProjectPop({ id })
60
+ }
61
+
32
62
  /** Whether the sidebar is collapsed to a rail of icons (wide windows only; kept on this computer). */
33
63
  function sideCollapsed () {
34
64
  if (state.sideCollapsed === undefined) { try { state.sideCollapsed = localStorage.getItem('quilt.sideCollapsed') === '1' } catch { state.sideCollapsed = false } }
@@ -36,6 +66,8 @@ function sideCollapsed () {
36
66
  }
37
67
 
38
68
  export function renderShell (view) {
69
+ // With projects on, Home and a project's page are projects.js's: a header, and no sidebar of the app's own.
70
+ if (state.workspacesOn) return renderProjects(view)
39
71
  const page = $('#page')
40
72
  const scroll = page ? page.scrollTop : 0
41
73
  $('#app').innerHTML = `
@@ -67,8 +99,8 @@ function placeName (view) {
67
99
  if (view === 'agents') return 'Agents'
68
100
  const id = view.startsWith('wsfiles:') ? view.slice(8) : view.startsWith('ws:') ? view.slice(3) : ''
69
101
  if (!id) return 'Home'
70
- const name = (state.workspaces || []).find((w) => w.id === id)?.name || state.workspace?.workspace?.name || 'Workspace'
71
- return view.startsWith('wsfiles:') ? `${name} · Files` : name
102
+ const name = (state.workspaces || []).find((w) => w.id === id)?.name || state.workspace?.workspace?.name || 'Project'
103
+ return view.startsWith('wsfiles:') ? `${name} · Artifacts` : name
72
104
  }
73
105
 
74
106
  function mobileBarHtml (view) {
@@ -105,11 +137,11 @@ function sidebarHtml (view) {
105
137
  </nav>
106
138
 
107
139
  ${state.workspacesOn
108
- ? `<button class="btn primary full sessions-btn" type="button" data-join-session title="Join a session">${I.link}<span>Join a session</span></button>`
140
+ ? `<button class="btn primary full sessions-btn" type="button" data-join-session title="Join a codebase">${I.link}<span>Join a codebase</span></button>`
109
141
  : `<div class="menu-wrap" id="sessions-menu-wrap">
110
- <button class="btn primary full sessions-btn" id="sessions-btn" aria-haspopup="true" aria-expanded="false">${I.folder}<span>Sessions</span>${running.length ? `<span class="badge-count">${running.length}</span>` : ''}<span class="caret">${I.caret}</span></button>
142
+ <button class="btn primary full sessions-btn" id="sessions-btn" aria-haspopup="true" aria-expanded="false">${I.folder}<span>Codebases</span>${running.length ? `<span class="badge-count">${running.length}</span>` : ''}<span class="caret">${I.caret}</span></button>
111
143
  <div class="popover menu" id="sessions-menu" role="menu" hidden>
112
- <button class="pop-item" role="menuitem" data-new-session>${I.plus}<span>New session…</span></button>
144
+ <button class="pop-item" role="menuitem" data-new-session>${I.plus}<span>New codebase…</span></button>
113
145
  <button class="pop-item" role="menuitem" data-join-session>${I.link}<span>Join with an invite…</span></button>
114
146
  ${running.length ? `<div class="pop-sep"></div><div class="pop-label">Open now</div>${running.map((s) => `
115
147
  <button class="pop-item" role="menuitem" data-go="${s.id}"><span class="dot" style="background:${s.status.connected ? 'var(--ok)' : 'var(--warn)'}"></span><span class="grow">${esc(s.status.sessionName || basename(s.dir))}</span><span class="hint">${s.status.peers.length + 1} here</span></button>`).join('')}` : ''}
@@ -125,7 +157,7 @@ function sidebarHtml (view) {
125
157
 
126
158
  <nav class="side-nav side-foot" aria-label="App">
127
159
  ${window.quiltDesktop?.dev ? `<button type="button" data-dev-restart title="Quit and start Quilt again (running from source)">${I.refresh}<span>Restart (dev)</span></button>` : ''}
128
- <button data-view="settings" class="${view === 'settings' ? 'on' : ''}" title="Account settings: your defaults for new sessions">${I.gear}<span>Settings</span></button>
160
+ <button data-view="settings" class="${view === 'settings' ? 'on' : ''}" title="Account settings: your defaults for new codebases">${I.gear}<span>Settings</span></button>
129
161
  </nav>
130
162
  ${feedbackDockHtml('side')}
131
163
  </aside>`
@@ -137,8 +169,8 @@ function sideWorkspacesHtml (view) {
137
169
  const list = state.workspacesOn ? (state.workspaces || []) : []
138
170
  if (!list.length) return ''
139
171
  return `
140
- <div class="side-label">Workspaces</div>
141
- <nav class="side-nav side-workspaces" aria-label="Workspaces">${list.map((w) => `
172
+ <div class="side-label">Projects</div>
173
+ <nav class="side-nav side-workspaces" aria-label="Projects">${list.map((w) => `
142
174
  <button data-view="ws:${esc(w.id)}" class="${view === `ws:${w.id}` ? 'on' : ''}" title="${esc(w.name)}"><span class="sw" style="background:${COLORS[w.color] || COLORS.lilac}"></span><span class="nm">${esc(w.name)}${w.space?.kind === 'org' ? `<span class="org"> · ${esc(w.space.name)}</span>` : ''}</span>${w.counts?.open ? `<span class="ct">${w.counts.open}</span>` : ''}</button>`).join('')}
143
175
  </nav>`
144
176
  }
@@ -225,7 +257,7 @@ function sessionRowHtml (r) {
225
257
  <div class="folder-ico">${I.folder}</div>
226
258
  <div class="meta">
227
259
  <div class="name">${esc(basename(r.dir))}</div>
228
- <div class="sub">This session ran on your computer's own relay, which Quilt no longer supports. Your files are untouched.</div>
260
+ <div class="sub">This codebase ran on your computer's own relay, which Quilt no longer supports. Your files are untouched.</div>
229
261
  </div>
230
262
  <div class="facts"><span>${esc(ago(r.lastUsed))}</span></div>
231
263
  <div class="acts"><button class="btn sm" data-forget="${esc(r.dir)}">Remove from list</button></div>
@@ -259,27 +291,27 @@ function homeHtml () {
259
291
  return `
260
292
  <header class="page-head">
261
293
  <h1>${greeting()}, ${esc(firstName())}</h1>
262
- <p>${state.workspacesOn ? 'Your workspaces. Open one, or add a new one.' : rows.some((r) => r.live) ? 'Pick up a session, or start something new from the Sessions menu.' : 'Start a session on one of your folders, or join one a partner shared with you.'}</p>
294
+ <p>${state.workspacesOn ? 'Your projects. Open one, or add a new one.' : rows.some((r) => r.live) ? 'Pick up a codebase, or start something new from the Codebases menu.' : 'Create a codebase from one of your folders, or join one a partner shared with you.'}</p>
263
295
  </header>
264
296
  <section class="invites" id="invites-slot"${(state.invites || []).length ? '' : ' hidden'}>${invitesHtml()}</section>
265
297
 
266
298
  ${state.workspacesOn ? workspacesHtml() : rows.length || elsewhere ? `
267
299
  <section class="sessions">
268
- <div class="sec-head"><h2>Your sessions</h2><span class="count">${rows.length + elsewhere}</span>
300
+ <div class="sec-head"><h2>Your codebases</h2><span class="count">${rows.length + elsewhere}</span>
269
301
  <span class="spacer"></span>
270
302
  <button class="btn sm" data-join-session>${I.link}<span>Join</span></button>
271
- <button class="btn sm primary" data-new-session>${I.plus}<span>New session</span></button>
303
+ <button class="btn sm primary" data-new-session>${I.plus}<span>New codebase</span></button>
272
304
  </div>
273
305
  <div class="card session-list">${rows.map(sessionRowHtml).join('')}${accountRowsHtml()}</div>
274
306
  </section>` : `
275
307
  <section class="card welcome">
276
308
  <div class="welcome-steps">
277
- <div><span class="n">1</span><b>Start a session</b><p class="hint">Pick a folder on your computer to work on together.</p></div>
309
+ <div><span class="n">1</span><b>Create a codebase</b><p class="hint">Pick a folder on your computer to work on together.</p></div>
278
310
  <div><span class="n">2</span><b>Send an invite link</b><p class="hint">Partners click it or paste it into Quilt. You approve who gets in.</p></div>
279
311
  <div><span class="n">3</span><b>Code together</b><p class="hint">Files sync live, and you can watch each other's AI work.</p></div>
280
312
  </div>
281
313
  <div class="welcome-actions">
282
- <button class="btn primary" data-new-session>${I.plus}<span>New session</span></button>
314
+ <button class="btn primary" data-new-session>${I.plus}<span>New codebase</span></button>
283
315
  <button class="btn" data-join-session>${I.link}<span>Join with an invite</span></button>
284
316
  </div>
285
317
  </section>`}`
@@ -340,11 +372,11 @@ function workspaceInviteDialog (id) {
340
372
  const org = isOrg ? (state.workspaces || []).find((w) => w.id === id)?.space : null
341
373
  const orgName = org?.name || d?.owner?.name || 'the org'
342
374
  const { back, form, close } = dialog(`
343
- <h3>Invite to ${esc(d?.workspace?.name || 'this workspace')}</h3>
375
+ <h3>Invite to ${esc(d?.workspace?.name || 'this project')}</h3>
344
376
  <p class="lead">People get the invite in their Quilt and by email, and are in once they accept. Agents are added straight away.</p>
345
377
  <div class="field"><label for="wi-access">Access</label>
346
378
  <select class="input" id="wi-access"><option value="edit">Can edit</option><option value="view">View only</option></select></div>
347
- ${toggle('wiEvery', false, 'Also invite to every new session in this workspace', 'For your own agents. Each new session sends them its link, and its owner lets them in. Off: the agent is in the workspace and sees its files, and joins a session only when someone invites it there.')}
379
+ ${toggle('wiEvery', false, 'Also invite to every new codebase in this project', 'For your own agents. Each new codebase sends them its link, and its owner lets them in. Off: the agent is in the project and sees its artifacts, and joins a codebase only when someone invites it there.')}
348
380
  <div class="inv-sub-row"><div class="label inv-sub">People you've worked with, and ${isOrg ? `${esc(orgName)}'s agents` : 'your agents'}</div>
349
381
  <label class="search-box"><span class="sr-only">Search people and agents</span><input class="input sm" id="wi-search" type="search" placeholder="Search…" autocomplete="off"></label></div>
350
382
  <div id="wi-people"><p class="hint">${loadingNote()}</p></div>
@@ -406,7 +438,7 @@ function workspaceInviteDialog (id) {
406
438
  page = Math.min(page, last)
407
439
  const from = page * PAGE
408
440
  const shown = hits.slice(from, from + PAGE)
409
- list.innerHTML = (shown.length ? `<div class="ag-grid wi-grid">${shown.map(card).join('')}</div>` : rows.length ? '<p class="hint">Nobody matches that.</p>' : "<p class=\"hint\">Nobody yet. People and agents you've been in a session with show up here.</p>") + why
441
+ list.innerHTML = (shown.length ? `<div class="ag-grid wi-grid">${shown.map(card).join('')}</div>` : rows.length ? '<p class="hint">Nobody matches that.</p>' : "<p class=\"hint\">Nobody yet. People and agents you've been in a codebase with show up here.</p>") + why
410
442
  pages.hidden = hits.length <= PAGE
411
443
  pages.innerHTML = `<span>${from + 1}–${from + shown.length} of ${hits.length}</span>
412
444
  <button type="button" class="btn sm icon" data-page="-1" aria-label="Previous page" ${page === 0 ? 'disabled' : ''}>${I.arrowLeft}</button>
@@ -515,8 +547,8 @@ function workspaceInviteDialog (id) {
515
547
  export function joinSessionDialog (invite = '') {
516
548
  const p = state.profile
517
549
  const { form, close } = dialog(`
518
- <h3>Join a session</h3>
519
- <p class="lead">${invite ? 'You were invited to a session. Choose where the files go, then join.' : 'Paste the invite link your partner sent you.'} They'll be asked to let you in.</p>
550
+ <h3>Join a codebase</h3>
551
+ <p class="lead">${invite ? 'You were invited to a codebase. Choose where the files go, then join.' : 'Paste the invite link your partner sent you.'} They'll be asked to let you in.</p>
520
552
  <div class="field">
521
553
  <label for="j-invite">Invite link</label>
522
554
  <textarea class="input mono" id="j-invite" rows="2" spellcheck="false" placeholder="https://join.heyquilt.com/…" required></textarea>
@@ -529,7 +561,7 @@ export function joinSessionDialog (invite = '') {
529
561
  <span class="hint">Leave empty to use a new folder in ${esc(p.joinDir)}.</span>
530
562
  </div>
531
563
  <p class="error" id="j-error"></p>
532
- <div class="actions"><button type="button" class="btn ghost" data-cancel>Cancel</button><button class="btn primary" type="submit">Join session</button></div>`)
564
+ <div class="actions"><button type="button" class="btn ghost" data-cancel>Cancel</button><button class="btn primary" type="submit">Join codebase</button></div>`)
533
565
  const inv = form.querySelector('#j-invite')
534
566
  inv.addEventListener('input', () => {
535
567
  const d = decodeInvite(inv.value)
@@ -583,7 +615,7 @@ function agentsPageHtml () {
583
615
  <label class="search-box"><span class="sr-only">Search agents</span><input class="input" id="agents-search" type="search" placeholder="Search agents…" autocomplete="off"></label>
584
616
  <button class="btn primary" type="button" id="agents-make"${state.workspacesOn ? ' aria-haspopup="menu" aria-expanded="false"' : ''}>${I.bot}<span>Invite an agent</span></button>
585
617
  </header>
586
- <p class="hint ag-lead">${state.workspacesOn ? 'AIs that work with you as their own members. Global agents are in all your workspaces; workspace and session agents in one. Open one for where it has been, where it works and its keys.' : 'AIs that work with you as their own members. An invite is pasted into the AI once; from then on it joins any session you send it. Open one for where it has been and its keys.'}</p>
618
+ <p class="hint ag-lead">${state.workspacesOn ? 'AIs that work with you as their own members. Global agents are in all your projects; project and codebase agents in one. Open one for where it has been, where it works and its keys.' : 'AIs that work with you as their own members. An invite is pasted into the AI once; from then on it joins any codebase you send it. Open one for where it has been and its keys.'}</p>
587
619
  <div id="agents-invite"><p class="error" id="agents-error"></p></div>
588
620
  <div id="agents-list"><p class="hint">${loadingNote()}</p></div>
589
621
  <div class="ag-pages" id="agents-pages" hidden></div>
@@ -621,26 +653,39 @@ async function showAgentDetails (box, a) {
621
653
  // Settings come in sections, picked from the list on the left: Agents (your AI, your agents),
622
654
  // Version control (git for everyone: the default for new sessions; opened from a session, that session's git on top), You (profile, appearance, sounds), Session (defaults for
623
655
  // starting and joining), Workspaces (with workspaces on), Account (sign-in, this computer, the version).
624
- const SETTINGS_TABS = [['agents', 'Agents', 'bot'], ['git', 'Version control', 'branch'], ['you', 'You', 'user'], ['session', 'Session', 'folder'], ['workspaces', 'Workspaces', 'grid'], ['account', 'Account', 'gear']]
625
- const settingsTabs = () => SETTINGS_TABS.filter(([id]) => id !== 'workspaces' || state.workspacesOn)
656
+ const SETTINGS_TABS = [['agents', 'Agents', 'bot'], ['git', 'Version control', 'branch'], ['you', 'You', 'user'], ['session', 'Codebase', 'folder'], ['workspaces', 'Projects', 'grid'], ['account', 'Account', 'gear']]
657
+ // With projects on the list is in three groups: you, what every project gets, and what a new codebase
658
+ // starts with. Your own AI then has a part to itself (Your AI), apart from the agents every project gets.
659
+ const PROJECT_SETTINGS = [
660
+ { label: 'You', tabs: [['ai', 'Your AI', 'bot'], ['you', 'Profile', 'user'], ['account', 'Account', 'gear']] },
661
+ { label: 'Every project', tabs: [['agents', 'Agents', 'bot'], ['connections', 'Connections', 'link'], ['git', 'Version control', 'branch'], ['workspaces', 'Projects', 'grid']] },
662
+ { label: 'New codebases', tabs: [['session', 'Defaults', 'folder']] }
663
+ ]
664
+ // Connections for every project show only while the accounts API has connections on.
665
+ const settingsGroups = () => state.workspacesOn ? PROJECT_SETTINGS.map((g) => ({ ...g, tabs: g.tabs.filter(([id]) => id !== 'connections' || state.connectionsOn) })) : [{ label: '', tabs: SETTINGS_TABS.filter(([id]) => id !== 'workspaces') }]
666
+ const settingsTabs = () => settingsGroups().flatMap((g) => g.tabs)
667
+ /** The tab your own AI (the tool on this computer, your cloud AI) is on. */
668
+ const aiTab = () => state.workspacesOn ? 'ai' : 'agents'
626
669
  export function settingsTab () {
627
- if (!state.settingsTab) { try { state.settingsTab = localStorage.getItem('quilt.settingsTab') || 'agents' } catch { state.settingsTab = 'agents' } }
670
+ if (!state.settingsTab) { try { state.settingsTab = localStorage.getItem('quilt.settingsTab') || aiTab() } catch { state.settingsTab = aiTab() } }
628
671
  if (state.settingsTab === 'sessions') state.settingsTab = 'session' // the name it had before
629
- return settingsTabs().some(([id]) => id === state.settingsTab) ? state.settingsTab : 'agents'
672
+ return settingsTabs().some(([id]) => id === state.settingsTab) ? state.settingsTab : aiTab()
630
673
  }
631
674
  const settingsTabLabel = (tab) => (settingsTabs().find(([id]) => id === tab) || settingsTabs()[0])[1]
632
675
 
633
676
  function settingsTabsHtml (tab) {
634
- return `<div class="ss-tabs settings-tabs" role="tablist" aria-orientation="vertical" aria-label="Account settings">${settingsTabs().map(([id, label, icon]) => `<button type="button" role="tab" class="ss-tab ${tab === id ? 'on' : ''}" data-settings-tab="${id}" aria-selected="${tab === id}" tabindex="${tab === id ? 0 : -1}">${I[icon] || ''}<span>${label}</span></button>`).join('')}</div>`
677
+ const one = ([id, label, icon]) => `<button type="button" role="tab" class="ss-tab ${tab === id ? 'on' : ''}" data-settings-tab="${id}" aria-selected="${tab === id}" tabindex="${tab === id ? 0 : -1}">${I[icon] || ''}<span>${label}</span></button>`
678
+ return settingsGroups().map((g) => `${g.label ? `<div class="label nc-label pj-nav-label">${g.label}</div>` : ''}<div class="ss-tabs settings-tabs" role="tablist" aria-orientation="vertical" aria-label="${g.label || 'Account settings'}">${g.tabs.map(one).join('')}</div>`).join('')
635
679
  }
636
680
 
681
+ /** Every project you are in, the archived ones too: an archived project is off the strip on the left, and is opened from here. */
637
682
  function workspacesSettingsHtml () {
638
- const list = state.workspaces || []
683
+ const list = [...(state.workspaces || [])].sort((x, y) => Number(!!x.archivedAt) - Number(!!y.archivedAt))
639
684
  return `
640
685
  <section class="card settings-sec" id="workspaces-sec">
641
- <div class="sec-intro"><h2>Workspaces</h2><p>The workspaces you are in, and the organizations behind them. Each one's own settings (people, agents, GitHub) are on its page.</p></div>
686
+ <div class="sec-intro"><h2>Projects</h2><p>The projects you are in, and the organizations behind them. An archived one is kept here, off the left: open it to bring it back from its settings.</p></div>
642
687
  <div class="sec-body">
643
- ${list.length ? list.map((w) => `<div class="ws-settings-row"><span class="sw" style="background:${esc(w.color || 'var(--accent)')}"></span><span class="nm"><b>${esc(w.name)}</b>${w.org && w.org.name ? `<span class="org">${esc(w.org.name)}</span>` : ''}</span><button class="btn sm" type="button" data-view="ws:${esc(w.id)}">Open</button></div>`).join('') : '<p class="hint">You are not in a workspace yet. Make one from Home.</p>'}
688
+ ${list.length ? list.map((w) => `<div class="ws-settings-row"><span class="sw" style="background:${esc(COLORS[w.color] || w.color || 'var(--accent)')}"></span><span class="nm"><b>${esc(w.name)}</b>${w.archivedAt ? '<span class="org">Archived</span>' : ''}${w.org && w.org.name ? `<span class="org">${esc(w.org.name)}</span>` : ''}</span><button class="btn sm" type="button" data-view="ws:${esc(w.id)}">Open</button></div>`).join('') : '<p class="hint">You are not in a project yet. Make one with the plus on the left.</p>'}
644
689
  </div>
645
690
  </section>`
646
691
  }
@@ -650,10 +695,10 @@ function settingsPageHtml () {
650
695
  const tab = settingsTab()
651
696
  return `<header class="page-head">
652
697
  <h1>Account settings</h1>
653
- <p class="settings-scope" data-settings-scope="account">Your defaults for new sessions. A session already running keeps its own, in its Session settings.</p>
698
+ <p class="settings-scope" data-settings-scope="account">Your defaults for new codebases. A codebase that is already open keeps its own, in its Codebase settings.</p>
654
699
  </header>
655
700
  <nav class="settings-tabs page-tabs" role="tablist" aria-label="Account settings">${settingsTabs().map(([id, label, icon]) => `<button type="button" role="tab" class="tab ${tab === id ? 'on' : ''}" data-settings-tab="${id}" aria-selected="${tab === id}">${I[icon] || ''}<span>${label}</span></button>`).join('')}</nav>
656
- <div role="tabpanel">${tab === 'agents' && cloudSetupOn() ? cloudSetupPageHtml() : settingsHtml()}</div>`
701
+ <div role="tabpanel">${tab === aiTab() && cloudSetupOn() ? cloudSetupPageHtml() : settingsHtml()}</div>`
657
702
  }
658
703
 
659
704
  /** Setting up your cloud AI on the Settings page: the whole tab panel, header to footer. */
@@ -671,21 +716,22 @@ function settingsHtml (session = null) {
671
716
  const a = state.account || { name: p.name, email: '' }
672
717
  const theme = p.theme || document.documentElement.dataset.theme || 'dark'
673
718
  const tab = settingsTab()
674
- const show = (id) => ({ account: ['account', 'about', 'computer'], you: ['profile', 'appearance', 'sounds'], session: ['sessions'], agents: ['your-ai', 'cloud-ai', 'agents'], git: ['agents-git'], workspaces: ['workspaces'] })[tab].includes(id)
719
+ const show = (id) => ({ account: ['account', 'about', 'computer'], you: ['profile', 'appearance', 'sounds'], session: ['sessions'], ai: ['your-ai', 'cloud-ai'], agents: state.workspacesOn ? ['agents'] : ['your-ai', 'cloud-ai', 'agents'], git: ['agents-git'], workspaces: ['workspaces'], connections: [] })[tab].includes(id)
675
720
  return `
676
721
  ${tab === 'workspaces' ? workspacesSettingsHtml() : ''}
722
+ ${tab === 'connections' ? '<section class="card settings-sec" id="account-connections-sec"><div class="sec-intro"><h2>Connections for every project</h2><p>Apps the agents in every project of yours can use. Agents never see the logins.</p></div><div class="sec-body"><div data-account-connections></div></div></section>' : ''}
677
723
  ${show('account') ? `<section class="card settings-sec" id="account-sec">
678
724
  <div class="sec-intro"><h2>Account</h2><p>This computer is signed in to your heyquilt.com account.</p></div>
679
725
  <div class="sec-body">
680
726
  <div class="kv"><span>Signed in as</span><b>${esc(a.name)}</b><span class="hint">${esc(a.email)}</span></div>
681
- <div class="sec-actions"><span class="hint">Signing out stops your sessions on this computer. Your files stay put.</span><button class="btn" type="button" id="sign-out">Sign out</button></div>
727
+ <div class="sec-actions"><span class="hint">Signing out closes your codebases on this computer. Your files stay put.</span><button class="btn" type="button" id="sign-out">Sign out</button></div>
682
728
  </div>
683
729
  </section>` : ''}
684
730
 
685
731
  ${show('your-ai') ? `<form class="card settings-sec" id="your-ai-sec" autocomplete="off">
686
- <div class="sec-intro"><h2>The AI on this computer</h2><p>The AI tool you code with. In a session it works as you, on what you ask it: what people write to you is yours.</p></div>
732
+ <div class="sec-intro"><h2>The AI on this computer</h2><p>The AI tool you code with. In a codebase it works as you, on what you ask it: what people write to you is yours.</p></div>
687
733
  <div class="sec-body">
688
- ${toggle('shareAgent', p.shareAgent, 'Share my AI chat', 'Partners see your prompts, the replies and which files it touches. You can pause it inside any session.')}
734
+ ${toggle('shareAgent', p.shareAgent, 'Share my AI chat', 'Partners see your prompts, the replies and which files it touches. You can pause it inside any codebase.')}
689
735
  ${toggle('summarize', p.summarize, 'Summarize my chats', 'Your prompts and your AI’s replies are shortened to a sentence or two on this computer before they’re shared. Uses your claude CLI (a few Haiku tokens each); if it isn’t available, the text is just shortened.')}
690
736
  <div class="sec-actions"><span></span><button class="btn primary" type="submit">Save</button></div>
691
737
  </div>
@@ -700,7 +746,7 @@ function settingsHtml (session = null) {
700
746
  <div id="agents-invite"><p class="error" id="agents-error"></p></div>
701
747
  <div id="agents-list"><p class="hint">${loadingNote()}</p></div>
702
748
  <div class="ag-pages" id="agents-pages" hidden></div>
703
- <div class="sec-actions"><span class="hint">${state.workspacesOn ? 'Open one for where it has been, where it works, whether it joins new sessions, and its keys.' : 'An invite is pasted into the AI once; from then on it joins any session you send it. Open one for where it has been and its keys.'} Revoke agents on <a href="https://heyquilt.com/dashboard/agents" target="_blank" rel="noopener">heyquilt.com</a>.</span><button class="btn sm" type="button" data-view="agents">Open Agents</button></div>
749
+ <div class="sec-actions"><span class="hint">${state.workspacesOn ? 'Open one for where it has been, where it works, whether it joins new codebases, and its keys.' : 'An invite is pasted into the AI once; from then on it joins any codebase you send it. Open one for where it has been and its keys.'} Revoke agents on <a href="https://heyquilt.com/dashboard/agents" target="_blank" rel="noopener">heyquilt.com</a>.</span><button class="btn sm" type="button" data-view="agents">Open Agents</button></div>
704
750
  </div>
705
751
  </section>` : ''}
706
752
 
@@ -726,7 +772,7 @@ function settingsHtml (session = null) {
726
772
  <select class="input" id="s-tool" name="tool">${state.defaults.tools.map((t) => `<option ${t === p.tool ? 'selected' : ''}>${esc(t)}</option>`).join('')}</select>
727
773
  <span class="hint">Shown next to your name, and used to find your AI chat so partners can follow along.</span>
728
774
  </div>
729
- <div class="sec-actions"><span class="hint">New sessions use this. Rejoin a running session to update it there.</span><button class="btn primary" type="submit">Save profile</button></div>
775
+ <div class="sec-actions"><span class="hint">New codebases use this. Rejoin an open codebase to update it there.</span><button class="btn primary" type="submit">Save profile</button></div>
730
776
  </div>
731
777
  </form>` : ''}
732
778
 
@@ -741,7 +787,7 @@ function settingsHtml (session = null) {
741
787
  </section>` : ''}
742
788
 
743
789
  ${show('sounds') ? `<section class="card settings-sec" id="sounds-sec">
744
- <div class="sec-intro"><h2>Sounds</h2><p>A short chime when something needs you, in any open session.</p></div>
790
+ <div class="sec-intro"><h2>Sounds</h2><p>A short chime when something needs you, in any open codebase.</p></div>
745
791
  <div class="sec-body">
746
792
  ${SOUND_EVENTS.map((ev) => `<div class="row sound-row">${toggle(ev.setting, p[ev.setting] !== false, ev.label, ev.hint)}
747
793
  <button type="button" class="btn sm ghost" data-sound-test="${ev.kind}" title="Play this sound" aria-label="Play the ${esc(ev.label.toLowerCase())} sound">Play</button></div>`).join('')}
@@ -750,13 +796,13 @@ function settingsHtml (session = null) {
750
796
  </section>` : ''}
751
797
 
752
798
  ${show('sessions') ? `<form class="card settings-sec" id="sessions-sec" autocomplete="off">
753
- <div class="sec-intro"><h2>Account defaults for starting and joining</h2><p>Your defaults for the sessions you start and join from now on.</p></div>
799
+ <div class="sec-intro"><h2>Account defaults for starting and joining</h2><p>Your defaults for the codebases you create and join from now on.</p></div>
754
800
  <div class="sec-body">
755
801
  <div class="field">
756
- <label for="s-joindir">Account default folder for projects you join</label>
802
+ <label for="s-joindir">Account default folder for codebases you join</label>
757
803
  <div class="row"><input class="input grow" id="s-joindir" name="joinDir" value="${esc(p.joinDir)}">
758
804
  <button type="button" class="btn icon" data-browse-settings="s-joindir" title="Browse" aria-label="Browse">${I.folder}</button></div>
759
- <span class="hint">Each session gets its own folder in here.</span>
805
+ <span class="hint">Each codebase gets its own folder in here.</span>
760
806
  </div>
761
807
  ${toggle('preferLocal', p.preferLocal, 'Keep my files when joining a folder that has some', 'When off, their versions of the same files win.')}
762
808
  ${toggle('report', p.report, 'Send problem reports to Quilt', 'The app tells Quilt which actions you take (not what you read), whether they worked and how long they took, with the error message when something fails, your app version and OS. Never your files, your chats or your links.')}
@@ -780,7 +826,7 @@ function settingsHtml (session = null) {
780
826
  <div class="kv"><span>Identity key</span><code>~/.quilt/identity.json</code><span class="hint">Proves your name is yours. Copy it to another computer to keep your name there.</span></div>
781
827
  <div class="kv"><span>Sign-in</span><code>~/.quilt/account.json</code><span class="hint">This computer's sign-in. Only you can read it.</span></div>
782
828
  <div class="kv"><span>Settings</span><code>~/.quilt/settings.json</code></div>
783
- <div class="sec-actions"><span class="hint">Stops every session and this app. Your files stay put.</span><button class="btn" type="button" data-shutdown>${I.power}<span>Shut down Quilt</span></button></div>
829
+ <div class="sec-actions"><span class="hint">Closes every codebase and this app. Your files stay put.</span><button class="btn" type="button" data-shutdown>${I.power}<span>Shut down Quilt</span></button></div>
784
830
  </div>
785
831
  </section>` : ''}`
786
832
  }
@@ -893,6 +939,10 @@ function bindAgents (root) {
893
939
 
894
940
  /** Wires the settings cards inside `root`; `refresh()` redraws them after a save. */
895
941
  function bindSettings (root, refresh) {
942
+ const own = root.querySelector('[data-account-connections]')
943
+ if (own) mountConnections(own, { type: 'account', id: 'me' })
944
+ // Projects: Open goes to the project's page (the pop-up closes; the old shell's sidebar binds its own).
945
+ if (state.workspacesOn) root.querySelectorAll('#workspaces-sec [data-view]').forEach((b) => { b.onclick = () => { $('#settings-back')?.remove(); go(b.dataset.view) } })
896
946
  // Tabs: the pick is kept on this computer, and the cards are drawn again.
897
947
  root.querySelector('.settings-tabs')?.addEventListener('click', (e) => {
898
948
  const b = e.target.closest('[data-settings-tab]')
@@ -979,7 +1029,7 @@ function bindSettings (root, refresh) {
979
1029
 
980
1030
  const signOut = $('#sign-out', root)
981
1031
  if (signOut) signOut.onclick = async () => {
982
- if (!await ask({ title: 'Sign out of Quilt?', message: 'This stops your sessions on this computer. Your files stay where they are.', ok: 'Sign out', danger: true })) return
1032
+ if (!await ask({ title: 'Sign out of Quilt?', message: 'This closes your codebases on this computer. Your files stay where they are.', ok: 'Sign out', danger: true })) return
983
1033
  try {
984
1034
  await api('POST', '/api/account/signout')
985
1035
  signedOutNow()
@@ -1007,8 +1057,8 @@ export function openSettings (opts = {}) {
1007
1057
  back.innerHTML = `
1008
1058
  <div class="settings-modal" role="dialog" aria-modal="true" aria-labelledby="settings-title">
1009
1059
  <nav class="ss-nav settings-nav" aria-label="Account settings">
1010
- <h3 id="settings-title">Account settings</h3>
1011
- <p class="lead settings-scope" data-settings-scope="account">Your defaults for new sessions. A session already running keeps its own, in its Session settings.</p>
1060
+ <h3 id="settings-title">${state.workspacesOn ? 'Settings' : 'Account settings'}</h3>
1061
+ <p class="lead settings-scope" data-settings-scope="account">${state.workspacesOn ? 'You, and what every project of yours gets.' : 'Your defaults for new codebases. A codebase that is already open keeps its own, in its Codebase settings.'}</p>
1012
1062
  <div class="settings-tabs-slot"></div>
1013
1063
  </nav>
1014
1064
  <div class="ss-main">
@@ -1027,7 +1077,7 @@ export function openSettings (opts = {}) {
1027
1077
  const draw = () => {
1028
1078
  const tab = settingsTab()
1029
1079
  // Setting up your cloud AI takes the whole right side: its own header, steps and footer.
1030
- const flow = tab === 'agents' && cloudSetupOn() ? cloudSetupHtml() : null
1080
+ const flow = tab === aiTab() && cloudSetupOn() ? cloudSetupHtml() : null
1031
1081
  // The same tab (or step of the setup) keeps where it was scrolled to; another starts at the top.
1032
1082
  const key = flow ? `setup:${cloudSetupStep()}` : tab
1033
1083
  const scroll = key === shown ? body.scrollTop : 0
package/src/ui/index.html CHANGED
@@ -9,7 +9,7 @@
9
9
  <link rel="stylesheet" href="/loom.css">
10
10
  </head>
11
11
  <body>
12
- <div id="app"></div>
12
+ <div id="frame"><nav class="prail" id="prail" aria-label="Projects" hidden></nav><div id="app"></div></div>
13
13
  <div id="toast" role="status" aria-live="polite"></div>
14
14
  <script type="module" src="/app.js"></script>
15
15
  </body>
package/src/ui/invite.js CHANGED
@@ -11,7 +11,7 @@ export const MISSING_SECRET = 'This link is missing part of it. Ask for a new in
11
11
  export const INVALID_INVITE = 'That invite link is not valid. Copy the whole link they sent.'
12
12
  // Back in a session by your account on a computer that never had its link: the relay hands it over
13
13
  // once someone who has it has opened the session since.
14
- export const NO_LINK_YET = "This session's invite link isn't on this computer yet. It arrives once someone who has it opens the session."
14
+ export const NO_LINK_YET = "This codebase's invite link isn't on this computer yet. It arrives once someone who has it opens the codebase."
15
15
 
16
16
  /** A session's name as a folder name (one plain path segment), or '' when nothing of it is left. */
17
17
  export function joinFolderName (name) {
@@ -84,23 +84,23 @@ export function parseInvite (code, { allowRelay = () => false } = {}) {
84
84
  export function agentPaste ({ link, session, invitedToSessions = false } = {}) {
85
85
  let apiUrl
86
86
  try { apiUrl = new URL(link).origin } catch {}
87
- const sessionLink = session || '<session invite link>'
87
+ const sessionLink = session || '<codebase invite link>'
88
88
  return [
89
- 'Join Quilt as my AI agent. Quilt is a live project folder that people and AI agents work in together. Three steps: register and connect, choose how Quilt wakes you, then work.',
89
+ 'Join Quilt as my AI agent. A Quilt codebase is a live folder that people and AI agents work in together. Three steps: register and connect, choose how Quilt wakes you, then work.',
90
90
  '',
91
91
  CLI_FIRST,
92
92
  '',
93
93
  `Step 1 of 3: register with this invite and connect. The invite works one time, within an hour: ${link}`,
94
- `- With the CLI (whenever you can run commands): ${INSTALL_CLI} Then run \`quilt agent join ${link} --name <your name>\` (pick a short name), and in the project folder start \`quilt join ${sessionLink} --agent <your name>\` and keep it running (see below).`,
94
+ `- With the CLI (whenever you can run commands): ${INSTALL_CLI} Then run \`quilt agent join ${link} --name <your name>\` (pick a short name), and in the codebase's folder start \`quilt join ${sessionLink} --agent <your name>\` and keep it running (see below).`,
95
95
  `- In a sandbox wiped after every turn: ${SANDBOX_CLI}`,
96
- `- Only if you have no computer and can do nothing but make HTTP requests: open ${link} and follow it to join over HTTP (register, then connect to the MCP server it names and call quilt_join_session with ${session ? 'my session invite link' : 'the session invite link I send you'}).`,
96
+ `- Only if you have no computer and can do nothing but make HTTP requests: open ${link} and follow it to join over HTTP (register, then connect to the MCP server it names and call quilt_join_session with ${session ? 'my codebase invite link' : 'the codebase invite link I send you'}).`,
97
97
  '- If you joined Quilt before, give the agent id Quilt gave you then (CLI: `--agent-id <your agent id>`; over HTTP: "agentId"), so you come back as the same agent instead of a new one. Not joined before, or lost it? Leave it out.',
98
98
  '- Quilt answers with your agent id. Save it where you will still have it later (your memory, notes or config): it is public, not a secret, and it is how you come back as yourself.',
99
- session ? `- My session invite link: ${session}. I may have to let you in first.` : '- I will send you a session invite link (https://join.heyquilt.com/...).',
99
+ session ? `- My codebase invite link: ${session}. I may have to let you in first.` : '- I will send you a codebase invite link (https://join.heyquilt.com/...).',
100
100
  '',
101
- `Step 2 of 3: choose how Quilt wakes you, so my @mentions, direct messages and tasks reach you without anyone checking on you. Call quilt_wake (CLI: \`quilt wake\`): it lists the ways that fit you (a webhook, email, a command on your computer, waiting, MCP push, a schedule, or your turns), and quilt_wake with method sets one up.${invitedToSessions ? ' You are invited to each new session in my workspaces too: a webhook (quilt_wake method webhook, or quilt_workspace_webhook) also gets `session.started` with each new session\'s invite link; join it as in step 1, and wait until I let you in.' : ''}`,
101
+ `Step 2 of 3: choose how Quilt wakes you, so my @mentions, direct messages and tasks reach you without anyone checking on you. Call quilt_wake (CLI: \`quilt wake\`): it lists the ways that fit you (a webhook, email, a command on your computer, waiting, MCP push, a schedule, or your turns), and quilt_wake with method sets one up.${invitedToSessions ? ' You are invited to each new codebase in my projects too: a webhook (quilt_wake method webhook, or quilt_workspace_webhook) also gets `session.started` with each new codebase\'s invite link; join it as in step 1, and wait until I let you in.' : ''}`,
102
102
  '',
103
- 'Step 3 of 3: work. Read the project\'s rules (quilt_project_rules), see who is doing what (quilt_status) and what waits for you (quilt_inbox, quilt_tasks), then follow the guide below.',
103
+ 'Step 3 of 3: work. Read the codebase\'s rules (quilt_project_rules), see who is doing what (quilt_status) and what waits for you (quilt_inbox, quilt_tasks), then follow the guide below.',
104
104
  '',
105
105
  agentGuide({ apiUrl })
106
106
  ].join('\n')
package/src/ui/invites.js CHANGED
@@ -7,7 +7,7 @@ const sessionAccess = (i) => (i.access ? ` · ${esc(i.access)}` : '')
7
7
  function rowHtml (i) {
8
8
  const from = i.from?.name || 'Someone'
9
9
  if (i.kind === 'workspace') {
10
- const where = `the <b>${esc(i.workspace.name)}</b> workspace${i.workspace.org ? ` in ${esc(i.workspace.org)}` : ''}`
10
+ const where = `the <b>${esc(i.workspace.name)}</b> project${i.workspace.org ? ` in ${esc(i.workspace.org)}` : ''}`
11
11
  return `
12
12
  <div class="session-row invite-row">
13
13
  ${avatar(from, null)}
@@ -20,8 +20,8 @@ function rowHtml (i) {
20
20
  return `
21
21
  <div class="session-row invite-row">
22
22
  ${avatar(from, null)}
23
- <div class="meta"><div class="name"><span><b>${esc(from)}</b> invited you to the session <b>${esc(i.session.name)}</b></span></div>
24
- <div class="sub">${i.link ? 'Session' : 'Open the link in the email they sent to join'}${sessionAccess(i)}</div></div>
23
+ <div class="meta"><div class="name"><span><b>${esc(from)}</b> invited you to the codebase <b>${esc(i.session.name)}</b></span></div>
24
+ <div class="sub">${i.link ? 'Codebase' : 'Open the link in the email they sent to join'}${sessionAccess(i)}</div></div>
25
25
  <div class="facts"></div>
26
26
  <div class="acts"><button class="btn sm ghost" data-invite-decline="${esc(i.id)}">Decline</button>${i.link ? `<button class="btn sm primary" data-invite-join="${esc(i.id)}">Join</button>` : ''}</div>
27
27
  </div>`
@@ -40,7 +40,7 @@ export function openNewCodebase ({ workspace = '', submit, tildify, pickFolder }
40
40
  let look = null // the server's answer for what is typed now: { dir, name, exists, git }
41
41
  let asked = 0
42
42
  let timer = null
43
- const inWorkspace = workspace ? state.workspaces?.find((w) => w.id === workspace)?.name || 'this workspace' : ''
43
+ const inWorkspace = workspace ? state.workspaces?.find((w) => w.id === workspace)?.name || 'this project' : ''
44
44
  const back = document.createElement('div')
45
45
  back.id = 'nc-back'
46
46
  back.className = 'modal-back settings-back'
@@ -78,8 +78,8 @@ export function openNewCodebase ({ workspace = '', submit, tildify, pickFolder }
78
78
  <div class="field"><label for="nc-name">Name</label><input class="input" id="nc-name" placeholder="neon-dungeon" maxlength="80" value="${esc(v.name)}" required></div>
79
79
  <div class="field"><label for="nc-brief">The idea</label><textarea class="input nc-brief" id="nc-brief" rows="4" maxlength="8000" placeholder="A small browser game: one level to start, keyboard controls.">${esc(v.brief)}</textarea></div>
80
80
  ${where('It goes in')}`),
81
- folder: () => card('Folder', 'Any project on this computer, on GitHub or not.', `
82
- <div class="field"><label for="nc-dir">Project folder</label>
81
+ folder: () => card('Folder', 'Any folder on this computer, on GitHub or not.', `
82
+ <div class="field"><label for="nc-dir">Folder</label>
83
83
  <div class="row"><input class="input grow mono" id="nc-dir" spellcheck="false" placeholder="~/code/my-app" value="${esc(v.dir)}" required>
84
84
  <button type="button" class="btn icon" data-nc-browse title="Browse" aria-label="Browse">${I.folder}</button></div>
85
85
  <span class="hint" data-nc-git></span></div>`)
@@ -0,0 +1,22 @@
1
+ // The strip on the far left, as plain logic (no DOM): which project a page belongs to, and the
2
+ // tiles the strip shows. prail.js puts them on the page.
3
+
4
+ /** The project a view belongs to: its own page, its All files, or a codebase in it. '' for Home and the pages beside it. */
5
+ export function projectOf (view, sessions = new Map()) {
6
+ const v = String(view || '')
7
+ const m = /^(?:ws|wsfiles):(.+)$/.exec(v)
8
+ if (m) return m[1]
9
+ return (sessions.get(v) && sessions.get(v).workspace) || ''
10
+ }
11
+
12
+ /** A project's tile: its first letter (a digit or a sign counts), upper case; '?' for a name with nothing in it. */
13
+ export const tileLetter = (name) => ([...String(name || '').trim()][0] || '?').toUpperCase()
14
+
15
+ /**
16
+ * The strip's tiles, in the order the projects came: { id, name, letter, color, on }. `here`: the
17
+ * project the open page belongs to. An archived project is off the strip, except while it is the
18
+ * one open (opened from Settings): its tile and its settings are how it is brought back.
19
+ */
20
+ export function railTiles (projects = [], here = '', colors = {}) {
21
+ return projects.filter((p) => p && p.id && (!p.archivedAt || p.id === here)).map((p) => ({ id: p.id, name: p.name || '', letter: tileLetter(p.name), color: colors[p.color] || Object.values(colors)[0] || '', on: p.id === here }))
22
+ }
@@ -0,0 +1,43 @@
1
+ // The strip on the far left of every page, once projects are on: Home, a tile for each project,
2
+ // a new project, and at its foot the open project's settings and the bug and idea buttons.
3
+ // It is how you move between projects, and it shows which one you are in.
4
+ import { I, state, $, esc, COLORS } from './common.js'
5
+ import { projectOf, railTiles } from './prail-model.js'
6
+ import { feedbackDockHtml, bindFeedback } from './feedback.js'
7
+
8
+ /** Where a bug or an idea was sent from, as its form says it: the codebase, the project, or Home. */
9
+ function where () {
10
+ const s = state.sessions.get(state.view)
11
+ if (s) return s.status?.sessionName || 'a codebase'
12
+ const id = projectOf(state.view, state.sessions)
13
+ return (state.workspaces || []).find((w) => w.id === id)?.name || 'Home'
14
+ }
15
+
16
+ /**
17
+ * Draws the strip for the page that is open, or hides it while projects are off. `go(view)` opens a
18
+ * page; `addProject()` starts a new project; `projectSettings(id)` opens a project's settings.
19
+ */
20
+ export function renderRail ({ go, addProject, projectSettings }) {
21
+ const el = $('#prail')
22
+ if (!el) return
23
+ const on = !!state.workspacesOn && !!state.account
24
+ el.hidden = !on
25
+ document.body.classList.toggle('has-rail', on)
26
+ if (!on) { el.innerHTML = ''; return }
27
+ const here = projectOf(state.view, state.sessions)
28
+ const tiles = railTiles(state.workspaces || [], here, COLORS)
29
+ const open = tiles.find((t) => t.on)
30
+ const atHome = !here && !state.sessions.has(state.view)
31
+ el.innerHTML = `
32
+ <button type="button" class="rail-home${atHome ? ' on' : ''}" data-rail-go="home" title="Home" aria-label="Home"${atHome ? ' aria-current="page"' : ''}>${I.home}</button>
33
+ <hr>
34
+ ${tiles.map((t) => `<button type="button" class="rail-tile${t.on ? ' on' : ''}" data-rail-go="ws:${esc(t.id)}" title="${esc(t.name)}" aria-label="${esc(t.name)}"${t.on ? ' aria-current="true"' : ''} style="background:${esc(t.color)}">${esc(t.letter)}</button>`).join('')}
35
+ <button type="button" class="add" data-rail-add title="New project" aria-label="New project">${I.plus}</button>
36
+ <span class="rail-foot">${open ? `<button type="button" class="fb-btn rail-gear" data-rail-settings="${esc(open.id)}" title="${esc(open.name)}: project settings" aria-label="${esc(open.name)}: project settings">${I.gear}</button>` : ''}${feedbackDockHtml('rail')}</span>`
37
+ el.querySelectorAll('[data-rail-go]').forEach((b) => { b.onclick = () => go(b.dataset.railGo) })
38
+ el.querySelector('[data-rail-add]').onclick = () => addProject()
39
+ const gear = el.querySelector('[data-rail-settings]')
40
+ if (gear) gear.onclick = () => projectSettings(gear.dataset.railSettings)
41
+ // The forms file into the codebase that is open, or ask which when none is. Bound once: the strip is drawn again and again.
42
+ bindFeedback(el, { session: () => (state.sessions.has(state.view) ? state.view : null), where })
43
+ }