heyquilt 0.3.192 → 0.3.193

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/RELEASES.md CHANGED
@@ -11,6 +11,12 @@ Format: `## <version> — <YYYY-MM-DD>`, an optional one-line summary, then bull
11
11
  Lead each bullet with a short bold phrase. Inline `code` and **bold** are rendered;
12
12
  nothing else is.
13
13
 
14
+ ## 0.3.193 — 2026-11-23
15
+
16
+ - **The Connections page, redrawn.** A project's and a codebase's Connections page (and the Connections cards in the pop-ups) show what is connected as the same tiles as a project's Overview: the app's logo, who connected it, where it is from, and who may use it. "Connect an app" opens the apps to pick from in the page, with the search across it. With nothing connected yet, the apps are there to pick from straight away.
17
+ - **See what an app does before you connect it.** In the apps to pick from, click an app's name: its page says what it is and lists what agents could do with it, the things they would do at once (reads) apart from the ones they would ask a person about first (anything that sends, changes or deletes).
18
+ - **Download updates automatically.** A new switch in Settings, under Account, in About Quilt. With it on, a newer Quilt is downloaded as soon as it is out, and the update button becomes "Restart to update": the restart is all that is left. Nothing is installed without you.
19
+
14
20
  ## 0.3.192 — 2026-11-23
15
21
 
16
22
  - **A preview's own pages look like Quilt.** What a preview's address shows by itself (open it from Quilt, starting, it did not start, nothing running) was bare text on grey. They now carry Quilt's mark, type and colours, in light and dark, and the starting page shows the mark piecing itself while it waits. The pages that send you back to Quilt have the Open in Quilt button.
package/desktop/main.js CHANGED
@@ -15,7 +15,7 @@ import { registerProcess } from '../src/procs.js'
15
15
  import { decodeInvite } from '../src/runner.js'
16
16
  import { quiltHome, adoptLegacyEnv } from '../src/legacy.js'
17
17
  import { downloadUrl } from '../src/releases.js'
18
- import { installUpdate } from './updater.js'
18
+ import { installUpdate, downloadUpdate } from './updater.js'
19
19
  import { registerOnStart } from '../src/integrations.js'
20
20
  import { adoptLoginShellPath } from '../src/shell-path.js'
21
21
  import { getSettings } from '../src/settings.js'
@@ -140,7 +140,8 @@ async function start () {
140
140
  return r.canceled ? null : r.filePaths[0]
141
141
  })
142
142
 
143
- ipcMain.handle('install-update', () => update())
143
+ ipcMain.handle('install-update', (e, version) => update(typeof version === 'string' ? version : ''))
144
+ ipcMain.handle('download-update', (e, version) => downloadAhead(typeof version === 'string' ? version : ''))
144
145
  ipcMain.handle('dev-restart', () => devRestart())
145
146
 
146
147
  // The title bar follows the app's theme (Settings → Appearance), from the saved one at launch, then as the
@@ -165,14 +166,30 @@ const windowIcon = () => path.join(HERE, 'icons', (nativeTheme.shouldUseDarkColo
165
166
 
166
167
  // ---------------------------------------------------------------- update --
167
168
  // "Update Quilt" in the app: download the newest build, install it, restart.
169
+ // With "Download updates automatically" on, the page asks for the newest build ahead of time
170
+ // (downloadAhead): "Restart to update" then installs that file without fetching it again.
168
171
  let updating = null
169
- function update () {
172
+ const ahead = new Map() // a version -> its download ahead of time, while it runs and once it is there
173
+ function downloadAhead (version) {
174
+ if (!app.isPackaged) return Promise.reject(new Error('Updates install into the packaged app only; from source, pull and restart.'))
175
+ if (updating) return Promise.reject(new Error('It is being installed.'))
176
+ if (!ahead.has(version)) {
177
+ ahead.set(version, downloadUpdate(downloadUrl(), { version, tempDir: app.getPath('temp') }).then(() => ({ ok: true }), (err) => {
178
+ ahead.delete(version)
179
+ throw new Error(err.message || 'The download failed.')
180
+ }))
181
+ }
182
+ return ahead.get(version)
183
+ }
184
+ function update (version = '') {
170
185
  if (updating) return updating
171
186
  updating = (async () => {
172
187
  if (!app.isPackaged) throw new Error('Updates install into the packaged app only; from source, pull and restart.')
173
188
  const progress = (p) => { if (win && !win.isDestroyed()) win.webContents.send('update-progress', p) }
174
189
  try {
175
- const next = await installUpdate(downloadUrl(), { tempDir: app.getPath('temp'), onProgress: progress })
190
+ // A download ahead of time that is still running is waited for, not started a second time.
191
+ if (ahead.has(version)) await ahead.get(version).catch(() => {})
192
+ const next = await installUpdate(downloadUrl(), { version, tempDir: app.getPath('temp'), onProgress: progress })
176
193
  quitting = true
177
194
  // An AppImage relaunches from its file, not from the mount it runs in now.
178
195
  if (next === 'relaunch') app.relaunch(process.env.APPIMAGE ? { execPath: process.env.APPIMAGE, args: process.argv.slice(1) } : undefined)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heyquilt",
3
- "version": "0.3.192",
3
+ "version": "0.3.193",
4
4
  "description": "Real-time, tool-agnostic pair vibe coding: sync a project folder live between collaborators using any AI coding tool.",
5
5
  "author": {
6
6
  "name": "Daniel Carmichael",
@@ -220,6 +220,15 @@ export function connectionRoutes (ctx) {
220
220
  return { apps: await composio.toolkits({ search: u.searchParams.get('search') || '', limit: Number(u.searchParams.get('limit')) || 60 }) }
221
221
  }],
222
222
 
223
+ // One app, before anyone connects it: what it is, and what agents could do with it (each action
224
+ // says whether it only reads, so the page can tell what would run at once from what would ask first).
225
+ ['GET', /^\/v1\/connections\/apps\/([a-z0-9][a-z0-9_-]{0,79})$/i, async (req, body, [slug]) => {
226
+ await whoCalls(req)
227
+ const [app, tools] = await Promise.all([composio.toolkit(slug.toLowerCase()), composio.tools({ app: slug.toLowerCase(), limit: 100 })])
228
+ const actions = tools.map((t) => ({ name: t.name, description: String(t.description || '').replace(/\s+/g, ' ').trim().slice(0, 240), readOnly: !!t.readOnly }))
229
+ return { app, actions }
230
+ }],
231
+
223
232
  // Composio sends the browser back here once someone signed in (or gave up).
224
233
  ['GET', /^\/v1\/connections\/done$/, async (req, body, params, url) => {
225
234
  const u = url || new URL(req.url, 'http://x')
package/src/ui/app.css CHANGED
@@ -3109,28 +3109,68 @@ label.radio:has(input:disabled) { cursor: default; opacity: .75; }
3109
3109
  .ss-secrets { padding: 4px 0; }
3110
3110
  /* App connections (connections.js): cards that fill their container, and the approval card in the chat */
3111
3111
  .ss-connections { padding: 4px 0; }
3112
+ /* Connections (connections.js): what is connected as the Overview's tiles, each with who may use it;
3113
+ "Connect an app" opens the apps to pick from in the page. */
3112
3114
  .cn { display: flex; flex-direction: column; gap: 18px; }
3113
- .cn .lead { margin: 0; }
3115
+ .cn > .files-head { margin-bottom: 0; }
3114
3116
  .cn-sec { display: flex; flex-direction: column; gap: 10px; }
3115
- .cn-sec h4 { margin: 0; font-size: 13px; font-weight: 600; } .cn-sec h4 i { font-style: normal; color: var(--muted); font-weight: 500; margin-left: 4px; }
3116
- .cn-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; } .cn-head h4 { flex: 1; }
3117
- .cn-search { display: flex; align-items: center; gap: 6px; flex: 1 1 240px; } .cn-search svg { width: 14px; height: 14px; color: var(--muted); flex: none; } .cn-search .input { flex: 1; min-width: 0; }
3118
- .cn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
3119
- .cn-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
3120
- .cn-card.off { background: var(--panel); }
3121
- .cn-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
3122
- .cn-what { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; } .cn-what b { font-size: 14px; } .cn-what small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3123
- .cn-logo { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; flex: none; background: #fff; }
3124
- .cn-logo.none { display: grid; place-items: center; background: var(--panel-2); color: var(--muted); font-weight: 600; font-size: 13px; }
3117
+ .cn-sec h3, .cn-add h3 { margin: 0; font-size: 14px; font-weight: 600; }
3118
+ .cn-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 10px; align-items: start; }
3119
+ .cn-tiles > .pj-slot { align-self: stretch; }
3120
+ .cn-tile { grid-template-rows: auto 12px auto auto; min-height: 0; }
3121
+ .cn-tile.off { background: none; box-shadow: 0 0 0 1px var(--border); }
3122
+ .cn-tile.off .pj-face { opacity: .55; }
3123
+ .cn-corner { grid-area: 1 / 2; align-self: start; justify-self: end; display: flex; align-items: center; min-height: 26px; }
3124
+ .cn-remove { width: 26px; height: 26px; margin: -3px -5px 0 0; color: var(--faint); opacity: 0; transition: opacity .12s; }
3125
+ .cn-tile:hover .cn-remove, .cn-tile:focus-within .cn-remove { opacity: 1; }
3126
+ .cn-remove:hover { color: var(--bad); }
3127
+ @media (hover: none) { .cn-remove { opacity: 1; } }
3125
3128
  .cn-state { font-size: 11.5px; font-weight: 600; color: var(--warn); white-space: nowrap; } .cn-state.failed { color: var(--bad); }
3126
- .cn-foot { display: flex; align-items: center; gap: 8px; } .cn-foot .spacer { flex: 1; }
3127
- .cn-confirm { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
3128
- .cn-agents { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-top: 10px; border-top: 1px solid var(--border); }
3129
- .cn-agent { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
3130
- .cn-agents .hint { flex-basis: 100%; }
3131
- .cn-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
3132
- .cn-app { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); min-width: 0; }
3133
- .cn-app b { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3129
+ .cn-who, .cn-confirm, .cn-agents { grid-column: 1 / 3; margin-top: 12px; min-width: 0; }
3130
+ .cn-who, .cn-confirm { grid-row: 6; } .cn-agents { grid-row: 7; }
3131
+ .cn-who .input, .cn-who .dd-btn { width: 100%; }
3132
+ .cn-who .dd-btn { padding: 0 10px; font-size: 13px; }
3133
+ .cn-who .btn { width: 100%; justify-content: center; }
3134
+ .cn-confirm { display: flex; align-items: center; gap: 6px; font-size: 12.5px; } .cn-confirm span { flex: 1; min-width: 0; font-weight: 600; }
3135
+ .cn-agents { display: flex; flex-direction: column; gap: 7px; padding-top: 12px; border-top: 1px solid var(--border); }
3136
+ .cn-agent { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; cursor: pointer; } .cn-agent span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3137
+ /* the apps to pick from */
3138
+ .cn-add { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 12px; background: var(--panel); box-shadow: 0 0 0 1px light-dark(rgba(29, 27, 46, .08), var(--border)); }
3139
+ .cn-add.enter { animation: cn-in .2s cubic-bezier(.3, .7, .2, 1); }
3140
+ @keyframes cn-in { from { opacity: 0; transform: translateY(-6px); } }
3141
+ @media (prefers-reduced-motion: reduce) { .cn-add.enter { animation: none; } }
3142
+ .cn-add-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; } .cn-add-head .spacer { flex: 1; } .cn-add-head .btn { align-self: center; margin: -4px -4px -4px 0; }
3143
+ .cn-add-head .hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3144
+ .cn-search { position: relative; display: block; }
3145
+ .cn-search svg { position: absolute; left: 12px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; color: var(--muted); pointer-events: none; }
3146
+ .cn-search .input { width: 100%; height: 38px; padding-left: 36px; }
3147
+ .cn-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
3148
+ .cn-app { display: flex; align-items: center; gap: 4px; min-width: 0; padding: 4px 6px 4px 4px; border-radius: 10px; background: var(--panel-2); transition: background .12s; }
3149
+ .cn-app:hover { background: color-mix(in srgb, var(--text) 9%, var(--panel)); }
3150
+ .cn-app-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 5px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
3151
+ .cn-app-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
3152
+ .cn-app .pj-face.md { width: 32px; height: 32px; border-radius: 9px; }
3153
+ .cn-app b { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3154
+ .cn-go { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); }
3155
+ .cn-go:hover:not(:disabled) { color: var(--accent); background: none; }
3156
+ /* one app, opened: what it is, and what agents could do with it */
3157
+ .cn-back { margin: -4px 0 -4px -6px; color: var(--muted); } .cn-back svg { width: 14px; height: 14px; }
3158
+ .cn-app-top { display: flex; align-items: center; gap: 14px; min-width: 0; }
3159
+ .cn-app-top .pj-face.md { width: 48px; height: 48px; border-radius: 13px; }
3160
+ .cn-app-top .t { flex: 1; min-width: 0; } .cn-app-top h3 { font-size: 17px; } .cn-app-top .hint { margin: 2px 0 0; }
3161
+ .cn-acts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
3162
+ .cn-acts { min-width: 0; padding: 14px; border-radius: 10px; background: var(--panel-2); }
3163
+ .cn-acts h4 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 600; }
3164
+ .cn-acts h4 i { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--panel); border-radius: 999px; padding: 0 7px; line-height: 18px; }
3165
+ .cn-acts > .hint { margin: 2px 0 0; }
3166
+ .cn-acts ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; }
3167
+ .cn-acts li { display: flex; flex-direction: column; min-width: 0; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
3168
+ .cn-acts li b { font-weight: 600; } .cn-acts li span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3169
+ .cn-acts .cn-none { margin-top: 10px; }
3170
+ @media (max-width: 760px) { .cn-acts-grid { grid-template-columns: minmax(0, 1fr); } .cn-app-top { flex-wrap: wrap; } }
3171
+ .cn-more { align-self: flex-start; }
3172
+ .cn-note { display: flex; align-items: flex-start; gap: 8px; margin: 2px 0 0; }
3173
+ .cn-note svg { flex: none; width: 14px; height: 14px; margin-top: 2px; }
3134
3174
  .cn-calls { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); }
3135
3175
  .cn-call { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 12.5px; min-width: 0; } .cn-call + .cn-call { border-top: 1px solid var(--border); }
3136
3176
  .cn-call code { font: 12px var(--mono); } .cn-call .hint { margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@@ -1,7 +1,9 @@
1
- // The Connections card in the app (Session settings → Connections, and the header's Connections
2
- // button): apps people connect for a session, workspace or team through Composio, which keeps the
1
+ // Connections in the app (a project's and a codebase's Connections page, and the pop-ups' Connections
2
+ // cards): apps people connect for a session, workspace or team through Composio, which keeps the
3
3
  // sign-ins (plans/app-connections.md). Agents use them with quilt_apps / quilt_app_tools /
4
4
  // quilt_app_call. Also the approval card an app action waiting for a person draws in the chat.
5
+ // What is connected shows as the same tiles as on a project's Overview (projects.js), each with who
6
+ // may use it; "Connect an app" opens the apps to pick from, in the page.
5
7
  // A person's own connections ({ type: 'account', id: 'me' }) are for every project of theirs. A
6
8
  // connection is for people and agents, for people only, or for the agents chosen for it.
7
9
  import { api, esc, toast, ago, I } from './common.js'
@@ -9,9 +11,13 @@ import { api, esc, toast, ago, I } from './common.js'
9
11
  const SEARCH_ICON = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>'
10
12
 
11
13
  const views = new Map() // `${type}:${id}` -> the last view, so a redraw shows it at once
14
+ const appInfo = new Map() // an app's slug -> { app, actions } once asked, or { error }: what it is and what agents can do with it
15
+ const ACTS_SHOWN = 8
16
+ const BACK_ICON = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>'
12
17
  const urlOf = (type, id, rest = '') => `/api/connections/${type}/${encodeURIComponent(id)}${rest}`
13
- const LEVEL = { session: 'this codebase', workspace: 'the project', org: 'the team', account: 'every project of yours' }
14
- const FROM = { ...LEVEL, account: 'every project' }
18
+ // Where a connection is from, on its tile: the ones made here, and the ones this place gets from above.
19
+ const HERE = { session: 'This codebase', workspace: 'This project', org: 'This team', account: 'Every project' }
20
+ const ABOVE = { workspace: 'This project', org: 'Team', account: 'Every project' }
15
21
 
16
22
  // Your agents, asked once: who a connection can be for. A page that knows more (a project's agents) hands them in.
17
23
  let mine = null
@@ -27,17 +33,20 @@ export function whoWords (c, names = new Map()) {
27
33
  const STATUS = { active: 'Connected', pending: 'Waiting for sign-in', failed: 'Didn\'t connect' }
28
34
  const SHOWN = 12
29
35
 
30
- const logoHtml = (a) => a.logo
31
- ? `<img class="cn-logo" src="${esc(a.logo)}" alt="" loading="lazy" referrerpolicy="no-referrer">`
32
- : `<span class="cn-logo none">${esc(String(a.name || a.app || a.slug || '?').slice(0, 1).toUpperCase())}</span>`
36
+ // An app's face: its logo on a white tile, as on a project's Overview; its first letter without one.
37
+ const logoHtml = (a) => `<span class="pj-face md sq">${a.logo
38
+ ? `<img src="${esc(a.logo)}" alt="" loading="lazy" referrerpolicy="no-referrer">`
39
+ : `<i class="show">${esc(String(a.name || a.app || a.slug || '?').slice(0, 1).toUpperCase())}</i>`}</span>`
33
40
 
34
41
  /**
35
42
  * Draws the card into `root` for one scope ({ type, id }: a session's room, a workspace's id, a
36
43
  * team's slug, or 'account' with 'me'). `agents()`: more agents a connection here can be for
37
- * ([{ id, name }]: a project's), besides your own. Answers { refresh, destroy }.
44
+ * ([{ id, name }]: a project's), besides your own. `page`: { title, hint } when it is a page of its
45
+ * own, which then gets its heading with "Connect an app" in it. Answers { refresh, destroy }.
38
46
  */
39
- export function mountConnections (root, { type, id, agents = () => [] }) {
40
- const ui = { search: '', apps: null, appsFor: null, more: false, busy: '', error: '', calls: null, confirm: null, choosing: null, yours: [] }
47
+ export function mountConnections (root, { type, id, agents = () => [], page = null }) {
48
+ // `adding`: the apps to pick from are open (null: not chosen yet, so open when nothing is connected).
49
+ const ui = { search: '', apps: null, appsFor: null, more: false, busy: '', error: '', calls: null, confirm: null, choosing: null, yours: [], adding: null, entering: false, app: null, allActs: false }
41
50
  /** The agents a connection here can be for, once each. */
42
51
  const choices = () => { const seen = new Map(); for (const a of [...agents(), ...ui.yours]) if (a && a.id && !seen.has(a.id)) seen.set(a.id, a.name || 'an agent'); return seen }
43
52
  let view = views.get(`${type}:${id}`) || null
@@ -46,61 +55,109 @@ export function mountConnections (root, { type, id, agents = () => [] }) {
46
55
  let searchTimer = null
47
56
 
48
57
  function connectedHtml (c, own) {
49
- const status = c.status === 'active' ? '' : `<span class="cn-state ${esc(c.status)}">${esc(STATUS[c.status] || c.status)}</span>`
50
58
  const names = choices()
59
+ const mayChange = own && c.mayChange
60
+ const active = c.status === 'active'
51
61
  // Chosen agents: the ones it is for are ticked; a tick saves at once, and at least one stays ticked.
52
- const picking = own && c.mayChange && c.status === 'active' && (c.who === 'agents' || ui.choosing === c.id)
62
+ const picking = mayChange && active && (c.who === 'agents' || ui.choosing === c.id)
53
63
  const value = picking ? 'agents' : c.who
54
- const who = own && c.mayChange && c.status === 'active'
55
- ? `<select class="input sm" data-who="${esc(c.id)}" aria-label="Who may use ${esc(c.name)}"><option value="all"${value === 'all' ? ' selected' : ''}>People and agents</option><option value="agents"${value === 'agents' ? ' selected' : ''}>People and chosen agents</option><option value="people"${value === 'people' ? ' selected' : ''}>People only</option></select>`
56
- : `<span class="hint">${esc(whoWords(c, names))}</span>`
57
64
  const chosen = new Set(c.who === 'agents' ? c.agents || [] : [])
58
65
  for (const a of chosen) if (!names.has(a)) names.set(a, 'an agent')
59
- const pick = !picking ? '' : `<div class="cn-agents" role="group" aria-label="The agents that may use ${esc(c.name)}">${names.size
66
+ // Top right: how it stands while it is not connected, else the way to remove it.
67
+ const corner = !active
68
+ ? `<span class="cn-state ${esc(c.status)}">${esc(STATUS[c.status] || c.status)}</span>`
69
+ : mayChange && ui.confirm !== c.id ? `<button class="btn sm ghost icon cn-remove" data-ask-remove="${esc(c.id)}" title="Remove ${esc(c.name)}" aria-label="Remove ${esc(c.name)}">${I.trash}</button>` : ''
70
+ const where = own ? HERE[type] || '' : c.level === 'org' ? c.levelName || ABOVE.org : ABOVE[c.level] || c.levelName || ''
71
+ const pills = `${where ? `<span class="pill pj-scope${own ? ' own' : ''}"${!own && c.levelName ? ` title="Connected for ${esc(c.levelName)}"` : ''}>${esc(where)}</span>` : ''}${mayChange && active ? '' : `<span class="pill pj-scope" title="Who may use it">${esc(whoWords(c, names))}</span>`}`
72
+ const who = !(mayChange && active) ? '' : ui.confirm === c.id
73
+ ? `<div class="cn-confirm"><span>Remove it?</span><button class="btn sm danger" data-remove="${esc(c.id)}">Remove</button><button class="btn sm ghost" data-cancel>Keep</button></div>`
74
+ : `<div class="cn-who"><select class="input sm" data-who="${esc(c.id)}" aria-label="Who may use ${esc(c.name)}"><option value="all"${value === 'all' ? ' selected' : ''}>People and agents</option><option value="agents"${value === 'agents' ? ' selected' : ''}>People and chosen agents</option><option value="people"${value === 'people' ? ' selected' : ''}>People only</option></select></div>`
75
+ const pick = !picking || ui.confirm === c.id ? '' : `<div class="cn-agents" role="group" aria-label="The agents that may use ${esc(c.name)}">${names.size
60
76
  ? [...names].map(([aid, name]) => `<label class="cn-agent"><input type="checkbox" data-agent-of="${esc(c.id)}" value="${esc(aid)}"${chosen.has(aid) ? ' checked' : ''}><span>${esc(name)}</span></label>`).join('')
61
77
  : '<span class="hint">You have no agents yet.</span>'}${chosen.size ? '' : '<span class="hint">Tick the agents that may use it. Until then it stays as it was.</span>'}</div>`
62
- const remove = own && c.mayChange
78
+ // A connection that waits for its sign-in or did not connect can still be removed.
79
+ const stuck = mayChange && !active
63
80
  ? (ui.confirm === c.id
64
- ? `<span class="cn-confirm">Remove ${esc(c.name)}? <button class="btn sm danger" data-remove="${esc(c.id)}">Remove</button><button class="btn sm ghost" data-cancel>Keep</button></span>`
65
- : `<button class="btn sm ghost icon" data-ask-remove="${esc(c.id)}" title="Remove ${esc(c.name)}" aria-label="Remove ${esc(c.name)}">${I.trash}</button>`)
81
+ ? `<div class="cn-confirm"><span>Remove it?</span><button class="btn sm danger" data-remove="${esc(c.id)}">Remove</button><button class="btn sm ghost" data-cancel>Keep</button></div>`
82
+ : `<div class="cn-who"><button class="btn sm ghost" data-ask-remove="${esc(c.id)}">${I.trash}<span>Remove</span></button></div>`)
66
83
  : ''
67
- return `<div class="cn-card${c.status === 'active' ? '' : ' off'}">
68
- <div class="cn-top">${logoHtml(c)}<div class="cn-what"><b>${esc(c.name)}</b><small>${own ? `${c.status === 'active' ? 'Connected' : 'Started'} by ${esc(c.by)} · ${esc(ago(c.createdAt))}` : `From ${esc(FROM[c.level] || c.level)}${c.levelName ? ` (${esc(c.levelName)})` : ''} · by ${esc(c.by)}`}</small></div>${status}</div>
69
- <div class="cn-foot">${who}<span class="spacer"></span>${remove}</div>${pick}</div>`
84
+ return `<div class="pj-app cn-tile${active ? '' : ' off'}">${logoHtml(c)}<span class="cn-corner">${corner}</span>
85
+ <b title="${esc(c.name)}">${esc(c.name)}</b><span class="hint">${active ? 'Connected' : 'Started'} by ${esc(c.by)}${own ? ` · ${esc(ago(c.createdAt))}` : ''}</span>
86
+ <span class="pj-pills">${pills}</span>${who}${stuck}${pick}</div>`
70
87
  }
71
88
 
89
+ // An app to connect: its name opens what it is and what it does; Connect connects it straight away.
72
90
  function appHtml (a, connected) {
73
91
  const busy = ui.busy === a.slug
74
- return `<div class="cn-app">${logoHtml(a)}<b title="${esc(a.description || a.name)}">${esc(a.name)}</b>
75
- <button class="btn sm${connected ? ' ghost' : ''}" data-connect="${esc(a.slug)}"${busy ? ' disabled' : ''}>${busy ? 'Opening…' : connected ? 'Add another' : 'Connect'}</button></div>`
92
+ return `<div class="cn-app"><button type="button" class="cn-app-open" data-app="${esc(a.slug)}" title="See what ${esc(a.name)} does">${logoHtml(a)}<b>${esc(a.name)}</b></button>
93
+ <button type="button" class="btn sm ghost cn-go" data-connect="${esc(a.slug)}"${busy ? ' disabled' : ''}>${busy ? 'Opening…' : connected ? 'Add another' : 'Connect'}</button></div>`
94
+ }
95
+
96
+ /** One app, opened from the apps to pick from: what it is, and what agents could do with it once it is connected. */
97
+ function appDetailHtml (ownApps) {
98
+ const slug = ui.app
99
+ const info = appInfo.get(slug)
100
+ const a = (info && info.app) || (ui.apps || []).find((x) => x.slug === slug) || { slug, name: slug }
101
+ const busy = ui.busy === slug
102
+ const acts = (info && info.actions) || []
103
+ const list = (title, hint, items) => {
104
+ const shown = ui.allActs ? items : items.slice(0, ACTS_SHOWN)
105
+ return `<div class="cn-acts"><h4>${title}<i>${items.length}</i></h4><p class="hint">${hint}</p>${items.length
106
+ ? `<ul>${shown.map((x) => `<li><b>${esc(x.name)}</b>${x.description ? `<span title="${esc(x.description)}">${esc(x.description)}</span>` : ''}</li>`).join('')}</ul>`
107
+ : '<p class="hint cn-none">None.</p>'}</div>`
108
+ }
109
+ const reads = acts.filter((x) => x.readOnly)
110
+ const asks = acts.filter((x) => !x.readOnly)
111
+ const more = !ui.allActs && (reads.length > ACTS_SHOWN || asks.length > ACTS_SHOWN)
112
+ return `<section class="cn-add cn-detail${ui.entering ? ' enter' : ''}" data-add-panel aria-label="${esc(a.name)}">
113
+ <div class="cn-add-head"><button type="button" class="btn sm ghost cn-back" data-app-back>${BACK_ICON}<span>All apps</span></button><span class="spacer"></span><button type="button" class="btn sm ghost icon" data-add-close title="Close" aria-label="Close">${I.x}</button></div>
114
+ <div class="cn-app-top">${logoHtml(a)}<div class="t"><h3>${esc(a.name)}</h3>${a.description ? `<p class="hint">${esc(a.description)}</p>` : ''}</div>
115
+ <button type="button" class="btn primary" data-connect="${esc(slug)}"${busy ? ' disabled' : ''}>${busy ? 'Opening…' : ownApps.has(slug) ? 'Add another' : 'Connect'}</button></div>
116
+ ${!info ? '<p class="hint">Loading what it can do…</p>' : info.error ? `<p class="hint">${esc(info.error)}</p>` : `<div class="cn-acts-grid">
117
+ ${list('Reads', 'Agents do these at once.', reads)}${list('Sends, changes or deletes', 'Agents ask a person here first, each time.', asks)}</div>
118
+ ${more ? `<button type="button" class="btn sm ghost cn-more" data-all-acts>Show all ${acts.length}${acts.length >= 100 ? '+' : ''} actions</button>` : ''}`}
119
+ </section>`
76
120
  }
77
121
 
78
122
  function callsHtml () {
79
123
  if (type !== 'session' || !ui.calls || !ui.calls.length) return ''
80
124
  const word = { waiting: 'waiting for approval', approved: 'approved', declined: 'declined', ran: 'ran', failed: 'failed' }
81
- return `<section class="cn-sec"><h4>What agents did in apps</h4><div class="cn-calls">${ui.calls.slice(0, 20).map((c) => `<div class="cn-call">
125
+ return `<section class="cn-sec"><h3>What agents did in apps</h3><div class="cn-calls">${ui.calls.slice(0, 20).map((c) => `<div class="cn-call">
82
126
  <span class="cn-call-state ${esc(c.state)}">${esc(word[c.state] || c.state)}</span><code>${esc(c.tool)}</code><span class="hint">by ${esc(c.by)}${c.decidedBy ? ` · ${c.state === 'declined' ? 'declined' : 'approved'} by ${esc(c.decidedBy)}` : ''} · ${esc(ago(c.at))}</span></div>`).join('')}</div></section>`
83
127
  }
84
128
 
129
+ /** The apps to pick from: a search across the page, then a tile an app. */
130
+ function addHtml (ownApps, first) {
131
+ if (ui.app) return appDetailHtml(ownApps)
132
+ const apps = ui.apps || []
133
+ const shown = ui.more || ui.search ? apps : apps.slice(0, SHOWN)
134
+ return `<section class="cn-add${ui.entering ? ' enter' : ''}" data-add-panel aria-label="Connect an app">
135
+ <div class="cn-add-head"><h3>${first ? 'Connect your first app' : 'Connect an app'}</h3><span class="hint">You sign in to it in your browser. Agents never see the login.</span><span class="spacer"></span>${first ? '' : `<button type="button" class="btn sm ghost icon" data-add-close title="Close" aria-label="Close">${I.x}</button>`}</div>
136
+ <label class="cn-search">${SEARCH_ICON}<input class="input" data-search placeholder="Search thousands of apps" value="${esc(ui.search)}" aria-label="Search apps" autocomplete="off" spellcheck="false"></label>
137
+ ${ui.apps === null ? '<p class="hint">Loading apps…</p>' : shown.length ? `<div class="cn-apps">${shown.map((a) => appHtml(a, ownApps.has(a.slug))).join('')}</div>` : `<p class="hint">No app matches "${esc(ui.search)}".</p>`}
138
+ ${!ui.search && !ui.more && apps.length > SHOWN ? '<button type="button" class="btn sm ghost cn-more" data-more>Show more apps</button>' : ''}</section>`
139
+ }
140
+
85
141
  function draw () {
86
142
  if (!alive) return
87
143
  const had = root.contains(document.activeElement) && document.activeElement.matches('[data-search]')
88
- if (ui.error && !view) { root.innerHTML = `<div class="cn"><p class="hint">${esc(ui.error)}</p></div>`; return }
89
- if (!view) { root.innerHTML = '<div class="cn"><p class="hint">Loading connections…</p></div>'; return }
90
- const own = view.connections || []
144
+ const canAdd = !!view && view.canManage
145
+ const own = view ? view.connections || [] : []
146
+ const above = view ? view.inherited || [] : []
147
+ const none = !own.length && !above.length
148
+ const adding = canAdd && (ui.adding ?? none)
149
+ const head = page ? `<div class="files-head"><div class="t"><h2 class="crumbs">${esc(page.title)}</h2><p class="hint">${esc(page.hint)}</p></div><span class="spacer"></span>${canAdd && !none ? `<button type="button" class="btn sm primary" data-add aria-expanded="${adding}">${I.plus}<span>Connect an app</span></button>` : ''}</div>` : ''
150
+ if (!view) { root.innerHTML = `<div class="cn">${head}<p class="hint">${esc(ui.error || 'Loading connections…')}</p></div>`; return }
91
151
  const ownApps = new Set(own.map((c) => c.app))
92
- const apps = ui.apps || []
93
- const shown = ui.more || ui.search ? apps : apps.slice(0, SHOWN)
94
- root.innerHTML = `<div class="cn">
95
- <p class="lead">Apps agents in ${esc(LEVEL[type] || type)} can use: they read at once and ask a person here before they send, change or delete anything. Composio keeps each sign-in; Quilt never sees it.</p>
96
- ${own.length ? `<section class="cn-sec"><h4>Connected here <i>${own.length}</i></h4><div class="cn-grid">${own.map((c) => connectedHtml(c, true)).join('')}</div></section>` : ''}
97
- ${(view.inherited || []).length ? `<section class="cn-sec"><h4>From above</h4><div class="cn-grid">${view.inherited.map((c) => connectedHtml(c, false)).join('')}</div></section>` : ''}
98
- ${view.canManage ? `<section class="cn-sec"><div class="cn-head"><h4>Add an app</h4><label class="cn-search">${SEARCH_ICON}<input class="input" data-search placeholder="Search thousands of apps" value="${esc(ui.search)}" aria-label="Search apps"></label></div>
99
- ${ui.apps === null ? '<p class="hint">Loading apps…</p>' : shown.length ? `<div class="cn-apps">${shown.map((a) => appHtml(a, ownApps.has(a.slug))).join('')}</div>` : `<p class="hint">No app matches "${esc(ui.search)}".</p>`}
100
- ${!ui.search && !ui.more && apps.length > SHOWN ? '<button class="btn sm ghost" data-more>Show more apps</button>' : ''}</section>` : ''}
152
+ root.innerHTML = `<div class="cn">${head}
153
+ ${none ? (canAdd ? '' : '<p class="hint">Nothing is connected here yet.</p>') : `<div class="cn-tiles">${own.map((c) => connectedHtml(c, true)).join('')}${above.map((c) => connectedHtml(c, false)).join('')}
154
+ ${canAdd && !adding ? `<button type="button" class="pj-app pj-slot" data-add aria-expanded="false"><span class="pj-plus">${I.plus}</span><span>Connect an app</span></button>` : ''}</div>`}
155
+ ${adding ? addHtml(ownApps, none) : ''}
101
156
  ${callsHtml()}
157
+ <p class="hint cn-note">${I.lock}<span>Agents read at once, and ask a person here before they send, change or delete anything. Composio keeps each sign-in: Quilt never sees it.</span></p>
102
158
  </div>`
103
- if (had) { const s = root.querySelector('[data-search]'); s.focus(); s.setSelectionRange(s.value.length, s.value.length) }
159
+ ui.entering = false
160
+ if (had) { const s = root.querySelector('[data-search]'); if (s) { s.focus(); s.setSelectionRange(s.value.length, s.value.length) } }
104
161
  }
105
162
 
106
163
  yourAgents().then((list) => { ui.yours = list; if (alive && view) draw() })
@@ -155,7 +212,22 @@ export function mountConnections (root, { type, id, agents = () => [] }) {
155
212
  try { await api('PATCH', urlOf(type, id, `/${sel.dataset.who}`), { who: sel.value }); load() } catch (err) { toast(err.message); load() }
156
213
  })
157
214
 
215
+ /** Opens one app: what it is and what it does, asked once. */
216
+ async function openApp (slug) {
217
+ ui.app = slug
218
+ ui.allActs = false
219
+ draw()
220
+ root.querySelector('[data-app-back]')?.focus()
221
+ if (appInfo.has(slug)) return
222
+ try { appInfo.set(slug, await api('GET', `/api/connections/apps/${encodeURIComponent(slug)}`)) } catch (err) { appInfo.set(slug, { error: `Couldn't load what it can do. ${err.message}` }); setTimeout(() => appInfo.delete(slug), 5000) }
223
+ if (ui.app === slug) draw()
224
+ }
225
+
158
226
  root.addEventListener('click', async (e) => {
227
+ const open = e.target.closest('[data-app]')
228
+ if (open) return openApp(open.dataset.app)
229
+ if (e.target.closest('[data-app-back]')) { const was = ui.app; ui.app = null; draw(); [...root.querySelectorAll('[data-app]')].find((b) => b.dataset.app === was)?.focus(); return }
230
+ if (e.target.closest('[data-all-acts]')) { ui.allActs = true; draw(); return }
159
231
  const c = e.target.closest('[data-connect]')
160
232
  if (c) {
161
233
  ui.busy = c.dataset.connect
@@ -179,7 +251,20 @@ export function mountConnections (root, { type, id, agents = () => [] }) {
179
251
  load()
180
252
  return
181
253
  }
182
- if (e.target.closest('[data-more]')) { ui.more = true; draw() }
254
+ if (e.target.closest('[data-more]')) { ui.more = true; draw(); return }
255
+ // "Connect an app" opens the apps to pick from, in the page, with the search ready to type in.
256
+ if (e.target.closest('[data-add]')) {
257
+ ui.adding = !(ui.adding ?? false)
258
+ ui.app = null
259
+ ui.entering = ui.adding
260
+ draw()
261
+ if (ui.adding) { const box = root.querySelector('[data-search]'); box?.focus(); root.querySelector('[data-add-panel]')?.scrollIntoView({ block: 'nearest', behavior: 'smooth' }) }
262
+ return
263
+ }
264
+ if (e.target.closest('[data-add-close]')) { ui.adding = false; ui.app = null; ui.search = ''; draw(); loadApps() }
265
+ })
266
+ root.addEventListener('keydown', (e) => {
267
+ if (e.key === 'Escape' && e.target.matches('[data-search]') && ui.adding) { ui.adding = false; ui.search = ''; draw(); loadApps(); root.querySelector('[data-add]')?.focus() }
183
268
  })
184
269
 
185
270
  draw()
package/src/ui/home.js CHANGED
@@ -5,7 +5,7 @@ import { go, pickFolder, signedOutNow, agentInviteHtml } from './app.js'
5
5
  import { agentPaste } from './invite.js'
6
6
  import { openKindMenu, kindLineHtml } from './agent-kinds.js'
7
7
  import { quiltMark } from './mark.js'
8
- import { updateControl } from './releases.js'
8
+ import { updateControl, downloadAhead } from './releases.js'
9
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'
@@ -814,6 +814,7 @@ function settingsHtml (session = null) {
814
814
  <div class="sec-intro"><h2>About Quilt</h2><p>${state.release?.outOfDate ? `Quilt ${esc(state.release.latest.version)} is out.` : 'The version on this computer.'}</p></div>
815
815
  <div class="sec-body">
816
816
  <div class="kv"><span>Version</span><span>${esc(state.release?.version || '…')}${state.release?.outOfDate ? ` <span class="pill warn">update available</span>` : state.release ? ' <span class="pill">up to date</span>' : ''}</span></div>
817
+ ${window.quiltDesktop?.downloadUpdate && !window.quiltDesktop.dev ? `<div class="row">${toggle('autoUpdate', !!p.autoUpdate, 'Download updates automatically', 'A newer Quilt is downloaded as soon as it is out. You restart when you like: nothing is installed without you.')}</div>` : ''}
817
818
  <div class="sec-actions"><span class="hint">Everything that changed, release by release.</span><span class="row">
818
819
  ${state.release?.outOfDate ? updateControl() : ''}
819
820
  <button class="btn" type="button" data-release-notes>${I.sparkle}<span>What's new</span></button></span></div>
@@ -1025,6 +1026,18 @@ function bindSettings (root, refresh) {
1025
1026
  }
1026
1027
  })
1027
1028
 
1029
+ // Download updates automatically: saved at once, and a newer Quilt that is already out is fetched now.
1030
+ $('#about-sec [name="autoUpdate"]', root)?.addEventListener('change', async (e) => {
1031
+ const box = e.target
1032
+ try {
1033
+ state.profile = await api('POST', '/api/settings', { autoUpdate: box.checked })
1034
+ if (box.checked) downloadAhead()
1035
+ } catch (err) {
1036
+ box.checked = !box.checked
1037
+ toast(err.message)
1038
+ }
1039
+ })
1040
+
1028
1041
  if ($('#agents-sec', root)) bindAgents(root)
1029
1042
 
1030
1043
  const signOut = $('#sign-out', root)
@@ -345,7 +345,7 @@ function projectPageHtml (p, view) {
345
345
  const main = page === 'artifacts' ? artifactsHtml(d)
346
346
  : page === 'tasks' ? '<div class="pj-board" data-project-board></div>'
347
347
  : page === 'channel' ? '<div class="pj-chanpage" data-project-channel></div>'
348
- : page === 'connections' ? `<div class="files-head"><div class="t"><h2 class="crumbs">Connections</h2><p class="hint">Apps this project's agents can use. Agents never see the logins.</p></div></div><div data-project-connections></div>`
348
+ : page === 'connections' ? '<div data-project-connections></div>'
349
349
  : codebasesHtml(projectCodebases(d, state.sessions, `person:${state.account?.id}`), { project: p, canAdd: d.access?.access === 'edit' }) +
350
350
  projectAgentsHtml(d) + (state.connectionsOn ? appsSectionHtml(appsOf(p.id)) : '')
351
351
  return `${sideHtml(p, d, page)}<div class="pj-pmain${page === 'artifacts' ? ' pj-files' : page === 'tasks' ? ' pj-tasks' : page === 'channel' ? ' pj-chat' : ''}">${main}</div>`
@@ -472,7 +472,7 @@ export function bindProjectShell (view, { go, rerender, newSessionDialog, joinSe
472
472
  // The open count beside Tasks follows the board as it changes.
473
473
  if (board) mountProjectBoard(board, { d, go, reload, changed: () => { const ct = root.querySelector('[data-page="tasks"] .ct'); if (ct) ct.textContent = projectOpenTasks(state.workspace) } })
474
474
  const conns = root.querySelector('[data-project-connections]')
475
- if (conns) mountConnections(conns, { type: 'workspace', id: p.id, agents: () => ((state.workspace && state.workspace.agents) || []).filter((a) => a.agentId).map((a) => ({ id: a.agentId, name: a.name })) })
475
+ if (conns) mountConnections(conns, { type: 'workspace', id: p.id, page: { title: 'Connections', hint: "Apps this project's agents can use." }, agents: () => ((state.workspace && state.workspace.agents) || []).filter((a) => a.agentId).map((a) => ({ id: a.agentId, name: a.name })) })
476
476
  // An agent's switch in this project: one added here keeps its place and changes whether it is invited; one from above gets this project's own setting.
477
477
  root.querySelectorAll('[data-agent-here]').forEach((box) => {
478
478
  box.onchange = async () => {
@@ -27,6 +27,7 @@ export async function checkRelease () {
27
27
  r.unseen = false
28
28
  }
29
29
  renderUpdateBar()
30
+ downloadAhead()
30
31
  if (!checkRelease.timer) checkRelease.timer = setInterval(() => checkRelease().catch(() => {}), RECHECK_MS)
31
32
  }
32
33
 
@@ -34,17 +35,19 @@ export async function checkRelease () {
34
35
  const desktop = () => window.quiltDesktop?.installUpdate ? window.quiltDesktop : null
35
36
  // Quilt run from source can't install a build: its folder gets each release with main, by itself.
36
37
  const fromSource = () => window.quiltDesktop?.dev === true
37
- let update = null // { phase: 'downloading' | 'installing' | 'restarting' | 'failed', received, total, error }
38
+ let update = null // { phase: 'ready' | 'downloading' | 'installing' | 'restarting' | 'failed', received, total, error }: 'ready' is downloaded ahead, waiting for a restart
39
+ let fetching = '' // the version being downloaded ahead of time, or already asked for
38
40
 
39
41
  /** Downloads and installs the newest Quilt from inside the desktop app. */
40
42
  async function startUpdate () {
41
43
  const d = desktop()
42
- if (!d || (update && update.phase !== 'failed')) return
44
+ if (!d || (update && update.phase !== 'failed' && update.phase !== 'ready')) return
43
45
  if (!startUpdate.listening) { startUpdate.listening = true; d.onUpdateProgress?.((p) => { update = { ...update, ...p }; refreshUpdateControls() }) }
44
- update = { phase: 'downloading', received: 0, total: 0 }
46
+ // Downloaded ahead of time: there is only the install left.
47
+ update = update?.phase === 'ready' ? { phase: 'installing' } : { phase: 'downloading', received: 0, total: 0 }
45
48
  refreshUpdateControls()
46
49
  try {
47
- await d.installUpdate()
50
+ await d.installUpdate(state.release?.latest?.version || '')
48
51
  update = { phase: 'restarting' }
49
52
  } catch (err) {
50
53
  update = { phase: 'failed', error: String(err?.message || err).replace(/^Error invoking remote method '[^']*': (Error: )?/, '') }
@@ -52,6 +55,27 @@ async function startUpdate () {
52
55
  refreshUpdateControls()
53
56
  }
54
57
 
58
+ /**
59
+ * With "Download updates automatically" on (Settings, About Quilt): fetches the newer Quilt quietly as
60
+ * soon as it is out, so the button only has to restart. A download that fails says nothing: the
61
+ * button still downloads it.
62
+ */
63
+ export async function downloadAhead () {
64
+ const d = desktop()
65
+ const r = state.release
66
+ const version = r?.latest?.version || ''
67
+ if (!d?.downloadUpdate || fromSource() || !r?.outOfDate || !state.profile?.autoUpdate) return
68
+ if (update || fetching === version) return
69
+ fetching = version
70
+ try {
71
+ await d.downloadUpdate(version)
72
+ if (update || state.release?.latest?.version !== version) return
73
+ update = { phase: 'ready' }
74
+ refreshUpdateControls()
75
+ renderUpdateBar()
76
+ } catch { fetching = '' }
77
+ }
78
+
55
79
  /** The button that gets the newer Quilt: installs it in the desktop app, downloads it elsewhere. */
56
80
  export function updateControl () {
57
81
  const r = state.release
@@ -60,6 +84,7 @@ export function updateControl () {
60
84
  if (!desktop()) return `<span class="update-ctl">${download}</span>`
61
85
  const phase = update?.phase
62
86
  if (!phase) return `<span class="update-ctl"><button class="btn sm primary" type="button" data-update>${I.down}<span>Update Quilt</span></button></span>`
87
+ if (phase === 'ready') return `<span class="update-ctl"><button class="btn sm primary" type="button" data-update>${I.refresh}<span>Restart to update</span></button></span>`
63
88
  if (phase === 'failed') {
64
89
  return `<span class="update-ctl update-failed"><span class="update-err" title="${esc(update.error)}">${esc(update.error)}</span><button class="btn sm primary" type="button" data-update>${I.refresh}<span>Try again</span></button>${download}</span>`
65
90
  }
@@ -89,7 +114,7 @@ export function renderUpdateBar () {
89
114
  }
90
115
  bar.innerHTML = `
91
116
  <span class="ub-dot"></span>
92
- <span class="ub-text"><b>Quilt ${esc(r.latest.version)} is out.</b> You have ${esc(r.version)}.</span>
117
+ <span class="ub-text"><b>Quilt ${esc(r.latest.version)} is ${update?.phase === 'ready' ? 'downloaded' : 'out'}.</b> You have ${esc(r.version)}.</span>
93
118
  <button class="btn sm ghost" type="button" data-release-notes>What's new</button>
94
119
  ${updateControl()}
95
120
  <label class="ub-never" title="Hide this bar until a newer Quilt than ${esc(r.latest.version)} is out"><input type="checkbox" data-update-never><span class="ub-long">Don't show this again</span><span class="ub-short">Don't show again</span></label>
package/src/ui/session.js CHANGED
@@ -461,8 +461,8 @@ function renderCodeSide () {
461
461
  })
462
462
  }
463
463
  if (boxed === 'connections') {
464
- extra.innerHTML = '<div class="files-head"><div class="t"><h2 class="crumbs">Connections</h2><p class="hint">Apps the agents in this codebase can use: its own, and the ones it gets from above. Agents never see the logins.</p></div></div><div data-code-connections></div>'
465
- codeConns = mountConnections(extra.querySelector('[data-code-connections]'), { type: 'session', id: st.room })
464
+ extra.innerHTML = '<div data-code-connections></div>'
465
+ codeConns = mountConnections(extra.firstElementChild, { type: 'session', id: st.room, page: { title: 'Connections', hint: `Apps the agents in this codebase can use: its own, and the ones it gets from ${projectHere() ? projectHere().name : 'above'}.` } })
466
466
  }
467
467
  if (boxed === 'artifacts') { drawCodeArtifacts(); loadCodeArtifacts() }
468
468
  } else if (codePreview) codePreview.update()
package/src/ui-server.js CHANGED
@@ -74,6 +74,8 @@ function profile () {
74
74
  preferLocal: !!s.preferLocal,
75
75
  theme: THEMES.includes(s.theme) ? s.theme : 'dark', // dark unless you pick another
76
76
  report: s.report !== false,
77
+ // Download updates automatically (the desktop app): a newer Quilt is fetched as soon as it is out, so updating is a restart.
78
+ autoUpdate: !!s.autoUpdate,
77
79
  aiTasks: pickupMode(s.aiTasks),
78
80
  // When work comes to your AI (autowork.js): 'chat', 'open' or 'auto', with its model, files and daily cap.
79
81
  auto: publicConfig(autoConfig(s)),
@@ -104,6 +106,7 @@ function updateProfile (b) {
104
106
  patch.theme = b.theme === 'dark' ? undefined : b.theme
105
107
  }
106
108
  if ('report' in b) patch.report = b.report ? undefined : false
109
+ if ('autoUpdate' in b) patch.autoUpdate = b.autoUpdate ? true : undefined
107
110
  if ('aiTasks' in b) {
108
111
  if (!PICKUP_MODES.includes(b.aiTasks)) throw httpError(400, 'Pick Off, Assigned to it, or Assigned and unassigned.')
109
112
  patch.aiTasks = b.aiTasks === 'off' ? undefined : b.aiTasks
@@ -1041,6 +1044,8 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
1041
1044
  const enc = (v) => encodeURIComponent(String(v))
1042
1045
  return asAccount(async (token) => {
1043
1046
  const c = secretsApi(token)
1047
+ const one = method === 'GET' && p.match(/^\/api\/connections\/apps\/([a-z0-9][a-z0-9_-]{0,79})$/i)
1048
+ if (one) return apiCall(c, 'GET', `/v1/connections/apps/${enc(one[1])}`)
1044
1049
  if (method === 'GET' && p === '/api/connections/apps') return apiCall(c, 'GET', `/v1/connections/apps?search=${enc(url.searchParams.get('search') || '')}&limit=${enc(url.searchParams.get('limit') || '60')}`)
1045
1050
  const sc = p.match(/^\/api\/connections\/(org|workspace|session|account)\/([^/]+)(?:\/([0-9a-f-]{36}))?$/i)
1046
1051
  // A person's own connections are always "me": the accounts API reads who from the sign-in.