heyquilt 0.3.182 → 0.3.183

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +101 -97
  2. package/RELEASES.md +8 -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/held.js +4 -4
  50. package/src/hooks.js +3 -3
  51. package/src/hosted-client.js +2 -2
  52. package/src/identity.js +1 -1
  53. package/src/inbox.js +1 -1
  54. package/src/key-cli.js +1 -1
  55. package/src/mail-tools.js +11 -11
  56. package/src/mcp-proxy.js +1 -1
  57. package/src/mcp.js +59 -59
  58. package/src/new-session.js +6 -6
  59. package/src/project-rules.js +2 -2
  60. package/src/relay-ask.js +2 -2
  61. package/src/relay-cluster.js +3 -3
  62. package/src/relay-live-write.js +3 -3
  63. package/src/relay-mcp.js +56 -56
  64. package/src/relay-prune.js +1 -1
  65. package/src/relay-turn-sync.js +1 -1
  66. package/src/secret-import.js +1 -1
  67. package/src/secret-names.js +6 -6
  68. package/src/secret-run.js +3 -3
  69. package/src/server.js +41 -41
  70. package/src/session-access.js +3 -3
  71. package/src/session-name.js +1 -1
  72. package/src/session.js +50 -50
  73. package/src/setup.js +7 -7
  74. package/src/status.js +2 -2
  75. package/src/tasks.js +1 -1
  76. package/src/turn-sync.js +4 -4
  77. package/src/ui/account-sessions.js +2 -2
  78. package/src/ui/agent-env-key.js +1 -1
  79. package/src/ui/agent-guide.js +35 -35
  80. package/src/ui/agent-kinds.js +8 -8
  81. package/src/ui/agent-place.js +16 -16
  82. package/src/ui/agents-table.js +6 -6
  83. package/src/ui/app.css +331 -0
  84. package/src/ui/app.js +28 -13
  85. package/src/ui/board.js +2 -2
  86. package/src/ui/catchup.js +5 -5
  87. package/src/ui/changes-seen.js +2 -2
  88. package/src/ui/changes.js +3 -3
  89. package/src/ui/cloud-ai.js +12 -12
  90. package/src/ui/common.js +1 -1
  91. package/src/ui/connections.js +1 -1
  92. package/src/ui/diffview.js +2 -2
  93. package/src/ui/feed.js +1 -1
  94. package/src/ui/feedback.js +4 -4
  95. package/src/ui/files.js +120 -14
  96. package/src/ui/fileview.js +3 -3
  97. package/src/ui/git-rule.js +3 -3
  98. package/src/ui/home.js +92 -47
  99. package/src/ui/index.html +1 -1
  100. package/src/ui/invite.js +8 -8
  101. package/src/ui/invites.js +3 -3
  102. package/src/ui/new-session.js +3 -3
  103. package/src/ui/prail-model.js +22 -0
  104. package/src/ui/prail.js +43 -0
  105. package/src/ui/project-board.js +359 -0
  106. package/src/ui/project-model.js +197 -0
  107. package/src/ui/project-pop.js +451 -0
  108. package/src/ui/projects.js +406 -0
  109. package/src/ui/sandbox-keys.js +3 -3
  110. package/src/ui/secrets-view.js +5 -5
  111. package/src/ui/session-words.js +2 -2
  112. package/src/ui/session.js +156 -43
  113. package/src/ui/tree.js +3 -3
  114. package/src/ui/voice.js +6 -6
  115. package/src/ui/workspaces.js +23 -23
  116. package/src/ui-server.js +78 -24
  117. package/src/update-check.js +2 -2
  118. package/src/voice.js +7 -7
  119. package/src/wake-tool.js +1 -1
  120. package/src/webhooks.js +1 -1
  121. package/src/workspace-cli.js +12 -12
  122. 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,9 @@ 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 { openProjectPop } from './project-pop.js'
21
24
 
22
25
  export const tildify = (p) => state.defaults.home && String(p).startsWith(state.defaults.home) ? `~${String(p).slice(state.defaults.home.length)}` : p
23
26
  const hostOf = (url) => { try { return new URL(String(url).replace(/^ws/, 'http')).host } catch { return url } }
@@ -29,6 +32,32 @@ function greeting () {
29
32
  }
30
33
 
31
34
  // ---------------------------------------------------------------- shell --
35
+ /** Home or a project's page, with projects on. Settings and Agents are a pop-up over Home there, not pages. */
36
+ function renderProjects (view) {
37
+ const popup = view === 'settings' || view === 'agents' ? view : ''
38
+ if (popup) { view = 'home'; state.view = 'home' }
39
+ // 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.
40
+ if (view === state.shellView && !popup && holdProjectBoard(() => { if (state.view === view) renderShell(view) })) return
41
+ const scroll = view === state.shellView ? ($('.pj-pmain') || $('#page'))?.scrollTop || 0 : 0
42
+ $('#app').innerHTML = projectShellHtml(view)
43
+ state.shellView = view
44
+ const main = $('.pj-pmain') || $('#page')
45
+ if (main && scroll) main.scrollTop = scroll
46
+ const rerender = () => { if (state.view === view) renderShell(view) }
47
+ bindProjectShell(view, {
48
+ go, rerender, newSessionDialog, joinSessionDialog, openSettings, bindSessionActions,
49
+ submitSession: async (body) => { const sum = await api('POST', '/api/sessions', body); state.sessions.set(sum.id, sum); await go(sum.id) }
50
+ })
51
+ if (popup) { if (popup === 'agents') state.settingsTab = 'agents'; openSettings() }
52
+ }
53
+
54
+ /** A project's settings, from the strip's gear: on the project's own page, which has it loaded. */
55
+ export async function openProjectSettings (id) {
56
+ if (!/^(ws|wsfiles):/.test(state.view) || wsIdOf(state.view) !== id) await go(`ws:${id}`)
57
+ if (state.workspace?.workspace?.id !== id) return
58
+ openProjectPop({ id })
59
+ }
60
+
32
61
  /** Whether the sidebar is collapsed to a rail of icons (wide windows only; kept on this computer). */
33
62
  function sideCollapsed () {
34
63
  if (state.sideCollapsed === undefined) { try { state.sideCollapsed = localStorage.getItem('quilt.sideCollapsed') === '1' } catch { state.sideCollapsed = false } }
@@ -36,6 +65,8 @@ function sideCollapsed () {
36
65
  }
37
66
 
38
67
  export function renderShell (view) {
68
+ // With projects on, Home and a project's page are projects.js's: a header, and no sidebar of the app's own.
69
+ if (state.workspacesOn) return renderProjects(view)
39
70
  const page = $('#page')
40
71
  const scroll = page ? page.scrollTop : 0
41
72
  $('#app').innerHTML = `
@@ -67,8 +98,8 @@ function placeName (view) {
67
98
  if (view === 'agents') return 'Agents'
68
99
  const id = view.startsWith('wsfiles:') ? view.slice(8) : view.startsWith('ws:') ? view.slice(3) : ''
69
100
  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
101
+ const name = (state.workspaces || []).find((w) => w.id === id)?.name || state.workspace?.workspace?.name || 'Project'
102
+ return view.startsWith('wsfiles:') ? `${name} · Artifacts` : name
72
103
  }
73
104
 
74
105
  function mobileBarHtml (view) {
@@ -105,11 +136,11 @@ function sidebarHtml (view) {
105
136
  </nav>
106
137
 
107
138
  ${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>`
139
+ ? `<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
140
  : `<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>
141
+ <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
142
  <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>
143
+ <button class="pop-item" role="menuitem" data-new-session>${I.plus}<span>New codebase…</span></button>
113
144
  <button class="pop-item" role="menuitem" data-join-session>${I.link}<span>Join with an invite…</span></button>
114
145
  ${running.length ? `<div class="pop-sep"></div><div class="pop-label">Open now</div>${running.map((s) => `
115
146
  <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 +156,7 @@ function sidebarHtml (view) {
125
156
 
126
157
  <nav class="side-nav side-foot" aria-label="App">
127
158
  ${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>
159
+ <button data-view="settings" class="${view === 'settings' ? 'on' : ''}" title="Account settings: your defaults for new codebases">${I.gear}<span>Settings</span></button>
129
160
  </nav>
130
161
  ${feedbackDockHtml('side')}
131
162
  </aside>`
@@ -137,8 +168,8 @@ function sideWorkspacesHtml (view) {
137
168
  const list = state.workspacesOn ? (state.workspaces || []) : []
138
169
  if (!list.length) return ''
139
170
  return `
140
- <div class="side-label">Workspaces</div>
141
- <nav class="side-nav side-workspaces" aria-label="Workspaces">${list.map((w) => `
171
+ <div class="side-label">Projects</div>
172
+ <nav class="side-nav side-workspaces" aria-label="Projects">${list.map((w) => `
142
173
  <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
174
  </nav>`
144
175
  }
@@ -225,7 +256,7 @@ function sessionRowHtml (r) {
225
256
  <div class="folder-ico">${I.folder}</div>
226
257
  <div class="meta">
227
258
  <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>
259
+ <div class="sub">This codebase ran on your computer's own relay, which Quilt no longer supports. Your files are untouched.</div>
229
260
  </div>
230
261
  <div class="facts"><span>${esc(ago(r.lastUsed))}</span></div>
231
262
  <div class="acts"><button class="btn sm" data-forget="${esc(r.dir)}">Remove from list</button></div>
@@ -259,27 +290,27 @@ function homeHtml () {
259
290
  return `
260
291
  <header class="page-head">
261
292
  <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>
293
+ <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
294
  </header>
264
295
  <section class="invites" id="invites-slot"${(state.invites || []).length ? '' : ' hidden'}>${invitesHtml()}</section>
265
296
 
266
297
  ${state.workspacesOn ? workspacesHtml() : rows.length || elsewhere ? `
267
298
  <section class="sessions">
268
- <div class="sec-head"><h2>Your sessions</h2><span class="count">${rows.length + elsewhere}</span>
299
+ <div class="sec-head"><h2>Your codebases</h2><span class="count">${rows.length + elsewhere}</span>
269
300
  <span class="spacer"></span>
270
301
  <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>
302
+ <button class="btn sm primary" data-new-session>${I.plus}<span>New codebase</span></button>
272
303
  </div>
273
304
  <div class="card session-list">${rows.map(sessionRowHtml).join('')}${accountRowsHtml()}</div>
274
305
  </section>` : `
275
306
  <section class="card welcome">
276
307
  <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>
308
+ <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
309
  <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
310
  <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
311
  </div>
281
312
  <div class="welcome-actions">
282
- <button class="btn primary" data-new-session>${I.plus}<span>New session</span></button>
313
+ <button class="btn primary" data-new-session>${I.plus}<span>New codebase</span></button>
283
314
  <button class="btn" data-join-session>${I.link}<span>Join with an invite</span></button>
284
315
  </div>
285
316
  </section>`}`
@@ -340,11 +371,11 @@ function workspaceInviteDialog (id) {
340
371
  const org = isOrg ? (state.workspaces || []).find((w) => w.id === id)?.space : null
341
372
  const orgName = org?.name || d?.owner?.name || 'the org'
342
373
  const { back, form, close } = dialog(`
343
- <h3>Invite to ${esc(d?.workspace?.name || 'this workspace')}</h3>
374
+ <h3>Invite to ${esc(d?.workspace?.name || 'this project')}</h3>
344
375
  <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
376
  <div class="field"><label for="wi-access">Access</label>
346
377
  <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.')}
378
+ ${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
379
  <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
380
  <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
381
  <div id="wi-people"><p class="hint">${loadingNote()}</p></div>
@@ -406,7 +437,7 @@ function workspaceInviteDialog (id) {
406
437
  page = Math.min(page, last)
407
438
  const from = page * PAGE
408
439
  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
440
+ 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
441
  pages.hidden = hits.length <= PAGE
411
442
  pages.innerHTML = `<span>${from + 1}–${from + shown.length} of ${hits.length}</span>
412
443
  <button type="button" class="btn sm icon" data-page="-1" aria-label="Previous page" ${page === 0 ? 'disabled' : ''}>${I.arrowLeft}</button>
@@ -515,8 +546,8 @@ function workspaceInviteDialog (id) {
515
546
  export function joinSessionDialog (invite = '') {
516
547
  const p = state.profile
517
548
  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>
549
+ <h3>Join a codebase</h3>
550
+ <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
551
  <div class="field">
521
552
  <label for="j-invite">Invite link</label>
522
553
  <textarea class="input mono" id="j-invite" rows="2" spellcheck="false" placeholder="https://join.heyquilt.com/…" required></textarea>
@@ -529,7 +560,7 @@ export function joinSessionDialog (invite = '') {
529
560
  <span class="hint">Leave empty to use a new folder in ${esc(p.joinDir)}.</span>
530
561
  </div>
531
562
  <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>`)
563
+ <div class="actions"><button type="button" class="btn ghost" data-cancel>Cancel</button><button class="btn primary" type="submit">Join codebase</button></div>`)
533
564
  const inv = form.querySelector('#j-invite')
534
565
  inv.addEventListener('input', () => {
535
566
  const d = decodeInvite(inv.value)
@@ -583,7 +614,7 @@ function agentsPageHtml () {
583
614
  <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
615
  <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
616
  </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>
617
+ <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
618
  <div id="agents-invite"><p class="error" id="agents-error"></p></div>
588
619
  <div id="agents-list"><p class="hint">${loadingNote()}</p></div>
589
620
  <div class="ag-pages" id="agents-pages" hidden></div>
@@ -621,26 +652,38 @@ async function showAgentDetails (box, a) {
621
652
  // Settings come in sections, picked from the list on the left: Agents (your AI, your agents),
622
653
  // 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
654
  // 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)
655
+ const SETTINGS_TABS = [['agents', 'Agents', 'bot'], ['git', 'Version control', 'branch'], ['you', 'You', 'user'], ['session', 'Codebase', 'folder'], ['workspaces', 'Projects', 'grid'], ['account', 'Account', 'gear']]
656
+ // With projects on the list is in three groups: you, what every project gets, and what a new codebase
657
+ // starts with. Your own AI then has a part to itself (Your AI), apart from the agents every project gets.
658
+ const PROJECT_SETTINGS = [
659
+ { label: 'You', tabs: [['ai', 'Your AI', 'bot'], ['you', 'Profile', 'user'], ['account', 'Account', 'gear']] },
660
+ { label: 'Every project', tabs: [['agents', 'Agents', 'bot'], ['git', 'Version control', 'branch'], ['workspaces', 'Projects', 'grid']] },
661
+ { label: 'New codebases', tabs: [['session', 'Defaults', 'folder']] }
662
+ ]
663
+ const settingsGroups = () => state.workspacesOn ? PROJECT_SETTINGS : [{ label: '', tabs: SETTINGS_TABS.filter(([id]) => id !== 'workspaces') }]
664
+ const settingsTabs = () => settingsGroups().flatMap((g) => g.tabs)
665
+ /** The tab your own AI (the tool on this computer, your cloud AI) is on. */
666
+ const aiTab = () => state.workspacesOn ? 'ai' : 'agents'
626
667
  export function settingsTab () {
627
- if (!state.settingsTab) { try { state.settingsTab = localStorage.getItem('quilt.settingsTab') || 'agents' } catch { state.settingsTab = 'agents' } }
668
+ if (!state.settingsTab) { try { state.settingsTab = localStorage.getItem('quilt.settingsTab') || aiTab() } catch { state.settingsTab = aiTab() } }
628
669
  if (state.settingsTab === 'sessions') state.settingsTab = 'session' // the name it had before
629
- return settingsTabs().some(([id]) => id === state.settingsTab) ? state.settingsTab : 'agents'
670
+ return settingsTabs().some(([id]) => id === state.settingsTab) ? state.settingsTab : aiTab()
630
671
  }
631
672
  const settingsTabLabel = (tab) => (settingsTabs().find(([id]) => id === tab) || settingsTabs()[0])[1]
632
673
 
633
674
  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>`
675
+ 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>`
676
+ 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
677
  }
636
678
 
679
+ /** 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
680
  function workspacesSettingsHtml () {
638
- const list = state.workspaces || []
681
+ const list = [...(state.workspaces || [])].sort((x, y) => Number(!!x.archivedAt) - Number(!!y.archivedAt))
639
682
  return `
640
683
  <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>
684
+ <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
685
  <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>'}
686
+ ${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
687
  </div>
645
688
  </section>`
646
689
  }
@@ -650,10 +693,10 @@ function settingsPageHtml () {
650
693
  const tab = settingsTab()
651
694
  return `<header class="page-head">
652
695
  <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>
696
+ <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
697
  </header>
655
698
  <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>`
699
+ <div role="tabpanel">${tab === aiTab() && cloudSetupOn() ? cloudSetupPageHtml() : settingsHtml()}</div>`
657
700
  }
658
701
 
659
702
  /** Setting up your cloud AI on the Settings page: the whole tab panel, header to footer. */
@@ -671,21 +714,21 @@ function settingsHtml (session = null) {
671
714
  const a = state.account || { name: p.name, email: '' }
672
715
  const theme = p.theme || document.documentElement.dataset.theme || 'dark'
673
716
  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)
717
+ 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'] })[tab].includes(id)
675
718
  return `
676
719
  ${tab === 'workspaces' ? workspacesSettingsHtml() : ''}
677
720
  ${show('account') ? `<section class="card settings-sec" id="account-sec">
678
721
  <div class="sec-intro"><h2>Account</h2><p>This computer is signed in to your heyquilt.com account.</p></div>
679
722
  <div class="sec-body">
680
723
  <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>
724
+ <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
725
  </div>
683
726
  </section>` : ''}
684
727
 
685
728
  ${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>
729
+ <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
730
  <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.')}
731
+ ${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
732
  ${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
733
  <div class="sec-actions"><span></span><button class="btn primary" type="submit">Save</button></div>
691
734
  </div>
@@ -700,7 +743,7 @@ function settingsHtml (session = null) {
700
743
  <div id="agents-invite"><p class="error" id="agents-error"></p></div>
701
744
  <div id="agents-list"><p class="hint">${loadingNote()}</p></div>
702
745
  <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>
746
+ <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
747
  </div>
705
748
  </section>` : ''}
706
749
 
@@ -726,7 +769,7 @@ function settingsHtml (session = null) {
726
769
  <select class="input" id="s-tool" name="tool">${state.defaults.tools.map((t) => `<option ${t === p.tool ? 'selected' : ''}>${esc(t)}</option>`).join('')}</select>
727
770
  <span class="hint">Shown next to your name, and used to find your AI chat so partners can follow along.</span>
728
771
  </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>
772
+ <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
773
  </div>
731
774
  </form>` : ''}
732
775
 
@@ -741,7 +784,7 @@ function settingsHtml (session = null) {
741
784
  </section>` : ''}
742
785
 
743
786
  ${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>
787
+ <div class="sec-intro"><h2>Sounds</h2><p>A short chime when something needs you, in any open codebase.</p></div>
745
788
  <div class="sec-body">
746
789
  ${SOUND_EVENTS.map((ev) => `<div class="row sound-row">${toggle(ev.setting, p[ev.setting] !== false, ev.label, ev.hint)}
747
790
  <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 +793,13 @@ function settingsHtml (session = null) {
750
793
  </section>` : ''}
751
794
 
752
795
  ${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>
796
+ <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
797
  <div class="sec-body">
755
798
  <div class="field">
756
- <label for="s-joindir">Account default folder for projects you join</label>
799
+ <label for="s-joindir">Account default folder for codebases you join</label>
757
800
  <div class="row"><input class="input grow" id="s-joindir" name="joinDir" value="${esc(p.joinDir)}">
758
801
  <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>
802
+ <span class="hint">Each codebase gets its own folder in here.</span>
760
803
  </div>
761
804
  ${toggle('preferLocal', p.preferLocal, 'Keep my files when joining a folder that has some', 'When off, their versions of the same files win.')}
762
805
  ${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 +823,7 @@ function settingsHtml (session = null) {
780
823
  <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
824
  <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
825
  <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>
826
+ <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
827
  </div>
785
828
  </section>` : ''}`
786
829
  }
@@ -893,6 +936,8 @@ function bindAgents (root) {
893
936
 
894
937
  /** Wires the settings cards inside `root`; `refresh()` redraws them after a save. */
895
938
  function bindSettings (root, refresh) {
939
+ // Projects: Open goes to the project's page (the pop-up closes; the old shell's sidebar binds its own).
940
+ if (state.workspacesOn) root.querySelectorAll('#workspaces-sec [data-view]').forEach((b) => { b.onclick = () => { $('#settings-back')?.remove(); go(b.dataset.view) } })
896
941
  // Tabs: the pick is kept on this computer, and the cards are drawn again.
897
942
  root.querySelector('.settings-tabs')?.addEventListener('click', (e) => {
898
943
  const b = e.target.closest('[data-settings-tab]')
@@ -979,7 +1024,7 @@ function bindSettings (root, refresh) {
979
1024
 
980
1025
  const signOut = $('#sign-out', root)
981
1026
  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
1027
+ 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
1028
  try {
984
1029
  await api('POST', '/api/account/signout')
985
1030
  signedOutNow()
@@ -1007,8 +1052,8 @@ export function openSettings (opts = {}) {
1007
1052
  back.innerHTML = `
1008
1053
  <div class="settings-modal" role="dialog" aria-modal="true" aria-labelledby="settings-title">
1009
1054
  <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>
1055
+ <h3 id="settings-title">${state.workspacesOn ? 'Settings' : 'Account settings'}</h3>
1056
+ <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
1057
  <div class="settings-tabs-slot"></div>
1013
1058
  </nav>
1014
1059
  <div class="ss-main">
@@ -1027,7 +1072,7 @@ export function openSettings (opts = {}) {
1027
1072
  const draw = () => {
1028
1073
  const tab = settingsTab()
1029
1074
  // Setting up your cloud AI takes the whole right side: its own header, steps and footer.
1030
- const flow = tab === 'agents' && cloudSetupOn() ? cloudSetupHtml() : null
1075
+ const flow = tab === aiTab() && cloudSetupOn() ? cloudSetupHtml() : null
1031
1076
  // The same tab (or step of the setup) keeps where it was scrolled to; another starts at the top.
1032
1077
  const key = flow ? `setup:${cloudSetupStep()}` : tab
1033
1078
  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
+ }