heyquilt 0.3.164 → 0.3.167
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 +14 -0
- package/package.json +1 -1
- package/src/api/audit.js +0 -1
- package/src/api/composio.js +1 -64
- package/src/api/memory-store.js +0 -7
- package/src/api/routes/connections.js +1 -78
- package/src/api/routes/workspaces.js +3 -43
- package/src/api/supabase-store.js +0 -11
- package/src/control.js +0 -21
- package/src/presence.js +1 -2
- package/src/server.js +1 -15
- package/src/ui/app.css +5 -743
- package/src/ui/app.js +22 -38
- package/src/ui/board.js +7 -17
- package/src/ui/connections.js +41 -235
- package/src/ui/feed.js +8 -23
- package/src/ui/files.js +22 -67
- package/src/ui/home.js +6 -95
- package/src/ui/loom-model.js +8 -11
- package/src/ui/loom.css +2 -183
- package/src/ui/loom.js +55 -132
- package/src/ui/session.js +75 -1065
- package/src/ui/signin.js +6 -4
- package/src/ui/workspaces.js +1 -2
- package/src/ui-server.js +4 -50
- package/src/dev-servers.js +0 -65
- package/src/ui/home-view.js +0 -170
- package/src/ui/palette.js +0 -75
- package/src/ui/people-view.js +0 -116
package/src/ui/app.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
// Quilt app: boot, live events, home screen, folder picker and invites.
|
|
2
2
|
// The session workspace lives in session.js. Plain ES modules, no build step.
|
|
3
3
|
import { authorOf } from './chat.js'
|
|
4
|
-
import { TOKEN, I, state, $, esc, basename, ago, toast, api, ask, decodeInvite, remember, recall, startDropdowns, avatar, loadAccessTypes, typeOptions, loadingHtml, loadingNote
|
|
4
|
+
import { TOKEN, I, state, $, esc, basename, ago, toast, api, ask, decodeInvite, remember, recall, startDropdowns, avatar, loadAccessTypes, typeOptions, loadingHtml, loadingNote } from './common.js'
|
|
5
5
|
import { renderShell, joinSessionDialog } from './home.js'
|
|
6
6
|
import { mountSession, sessionUpdated, sessionMessage, sessionFeed, sessionFileChanged, sessionLog, sessionUnmount } from './session.js'
|
|
7
7
|
import { quiltMark } from './mark.js'
|
|
8
|
-
import { paletteSource } from './palette.js'
|
|
9
8
|
import { renderSignIn } from './signin.js'
|
|
10
9
|
import { checkRelease, openReleaseNotes } from './releases.js'
|
|
11
10
|
import { loadWorkspaces, openWorkspace, wsIdOf } from './workspaces.js'
|
|
@@ -321,50 +320,35 @@ export function render () {
|
|
|
321
320
|
}
|
|
322
321
|
|
|
323
322
|
export function renderLocked (msg) {
|
|
324
|
-
// The same card as sign-in (signin.js), so the screens before the app look like the app.
|
|
325
323
|
$('#app').innerHTML = `
|
|
326
|
-
<div class="
|
|
327
|
-
<div class="
|
|
328
|
-
<
|
|
329
|
-
<p class="signin-lead">${esc(msg || 'Open Quilt using the link printed in your terminal by')} ${msg ? '' : '<code>quilt ui</code>.'}</p>
|
|
324
|
+
<div class="home"><div class="hero">
|
|
325
|
+
<div class="wordmark">${quiltMark({ sew: 'first' })}</div>
|
|
326
|
+
<p class="tagline">${esc(msg || 'Open Quilt using the link printed in your terminal by')} ${msg ? '' : '<code>quilt ui</code>.'}</p>
|
|
330
327
|
</div></div>`
|
|
331
328
|
}
|
|
332
329
|
|
|
333
|
-
// ⌘K everywhere (palette.js): sessions, workspaces and what the app can do.
|
|
334
|
-
paletteSource('app', () => [
|
|
335
|
-
...[...state.sessions.values()].map((x) => {
|
|
336
|
-
const n = [x.status.me, ...(x.status.peers || [])].filter((p) => p && p.agent && p.agent.status === 'working').length
|
|
337
|
-
const ws = (state.workspaces || []).find((w) => w.id === x.workspace)
|
|
338
|
-
return { group: 'Sessions', title: x.status.sessionName || basename(x.dir), sub: [n ? `${n} working` : 'Quiet', ws ? ws.name : '', `~/${basename(x.dir)}`].filter(Boolean).join(' · '), icon: I.grid, run: () => go(x.id) }
|
|
339
|
-
}),
|
|
340
|
-
...(state.workspaces || []).map((w) => ({ group: 'Workspaces', title: w.name, sub: 'Its home: charts, sessions, previews', icon: I.home, run: () => go(`ws:${w.id}`) })),
|
|
341
|
-
{ group: 'Actions', title: 'New session…', sub: 'Share a folder', icon: I.plus, run: () => go('home') },
|
|
342
|
-
{ group: 'Actions', title: 'Join a session…', sub: 'With an invite link', icon: I.link, run: () => joinSessionDialog() },
|
|
343
|
-
{ group: 'Actions', title: 'Agents', sub: 'Your agents and their keys', icon: I.bot, run: () => go('agents') },
|
|
344
|
-
{ group: 'Actions', title: 'Account settings', sub: 'Your defaults for new sessions', icon: I.gear, run: () => go('settings') }
|
|
345
|
-
])
|
|
346
|
-
|
|
347
330
|
export function renderTabs () {
|
|
348
331
|
const el = $('#tabs')
|
|
349
|
-
// In a session the rail switches workspaces: the "…" menu keeps only the session's own actions.
|
|
350
332
|
if (!el) return
|
|
351
|
-
|
|
352
|
-
//
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
loadWorkspaces().catch(() => {}).finally(() => { renderTabs.loading = false; renderTabs(); if (state.sessions.has(state.view)) sessionUpdated(state.view) })
|
|
357
|
-
}
|
|
358
|
-
const mine = state.sessions.get(state.view)?.workspace
|
|
359
|
-
const wsList = state.workspaces || []
|
|
333
|
+
// The session menu lists every session on this computer: open ones to switch to, with their
|
|
334
|
+
// connection, and earlier ones to rejoin. The button's dot is this session's connection.
|
|
335
|
+
const open = [...state.sessions.values()]
|
|
336
|
+
const dirs = new Set(open.map((s) => s.dir))
|
|
337
|
+
const earlier = (state.recent || []).filter((r) => !r.unsupported && !dirs.has(r.dir))
|
|
360
338
|
el.hidden = false
|
|
361
|
-
el.innerHTML = '<div class="pop-label">
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
<span class="
|
|
339
|
+
el.innerHTML = '<div class="pop-label">Your sessions</div>' + open.map((s) => {
|
|
340
|
+
const unread = s.status.unread
|
|
341
|
+
const on = state.view === s.id
|
|
342
|
+
return `<button class="pop-item tab${on ? ' on' : ''}" role="menuitem" data-go="${s.id}"${on ? ' aria-current="true"' : ''}>
|
|
343
|
+
<span class="dot ${s.status.connected ? 'ok' : 'bad'}" title="${s.status.connected ? 'Connected' : 'Not connected'}"></span>
|
|
344
|
+
<span class="grow">${esc(s.status.sessionName || basename(s.dir))}</span>
|
|
345
|
+
${unread && !on ? `<span class="badge">${unread}</span>` : ''}
|
|
366
346
|
</button>`
|
|
367
|
-
}).join('') +
|
|
347
|
+
}).join('') + earlier.map((r) => `<button class="pop-item tab" role="menuitem" data-rejoin="${esc(r.dir)}" title="${esc(r.dir)}">
|
|
348
|
+
<span class="dot off" title="Not open"></span>
|
|
349
|
+
<span class="grow">${esc(basename(r.dir))}</span>
|
|
350
|
+
<span class="hint">${esc(ago(r.lastUsed))}</span>
|
|
351
|
+
</button>`).join('') + '<div class="pop-sep"></div>'
|
|
368
352
|
const here = state.sessions.get(state.view)
|
|
369
353
|
const dot = $('#sess-dot')
|
|
370
354
|
if (dot && here) {
|
|
@@ -375,7 +359,7 @@ export function renderTabs () {
|
|
|
375
359
|
}
|
|
376
360
|
const badge = $('#sess-badge')
|
|
377
361
|
if (badge) {
|
|
378
|
-
const n =
|
|
362
|
+
const n = open.filter((s) => s.id !== state.view).reduce((a, s) => a + (s.status.unread || 0), 0)
|
|
379
363
|
badge.hidden = !n
|
|
380
364
|
badge.textContent = n
|
|
381
365
|
}
|
package/src/ui/board.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// The session task board: four columns. Task ids and titles come from the
|
|
2
2
|
// shared room, so every string is escaped. Column ids match src/tasks.js.
|
|
3
|
-
import { I, esc, ago, colorFor
|
|
4
|
-
import { toolLabel } from './tool-logo.js'
|
|
3
|
+
import { I, esc, ago, colorFor } from './common.js'
|
|
5
4
|
import { markdown } from './feed.js'
|
|
6
5
|
import { cronToText } from './schedule.js'
|
|
7
6
|
|
|
@@ -26,7 +25,7 @@ const COLUMNS = [
|
|
|
26
25
|
* `archived` shows the archived tasks in place of the columns. `show` keeps only some tasks:
|
|
27
26
|
* '' everyone's, 'none' unassigned ones, `p:name` a person's, `a:name` that person's AI's.
|
|
28
27
|
*/
|
|
29
|
-
export function renderBoard (tasks, me, people = [], assignTo = '', { archived = false, show = '', closedGroups = []
|
|
28
|
+
export function renderBoard (tasks, me, people = [], assignTo = '', { archived = false, show = '', closedGroups = [] } = {}) {
|
|
30
29
|
const every = (Array.isArray(tasks) ? tasks : []).filter(Boolean)
|
|
31
30
|
const all = every.filter((t) => showsTask(t, show))
|
|
32
31
|
const list = all.filter((t) => !t.archived)
|
|
@@ -35,7 +34,7 @@ export function renderBoard (tasks, me, people = [], assignTo = '', { archived =
|
|
|
35
34
|
const cols = COLUMNS.map((col) => {
|
|
36
35
|
const cards = list.filter((t) => t && t.column === col.id)
|
|
37
36
|
const body = cards.length
|
|
38
|
-
? cards.map((t) => card(t, col, me, people
|
|
37
|
+
? cards.map((t) => card(t, col, me, people)).join('')
|
|
39
38
|
: `<p class="board-empty">${col.id === 'todo' ? 'Nothing here yet.' : 'Nothing here.'}</p>`
|
|
40
39
|
const n = cards.length
|
|
41
40
|
// When the board is too narrow for every column, session.js folds some to a strip:
|
|
@@ -78,7 +77,7 @@ export function renderBoard (tasks, me, people = [], assignTo = '', { archived =
|
|
|
78
77
|
|
|
79
78
|
// Folding (session.js lays it out): open columns are BOARD_COL wide at least, a folded
|
|
80
79
|
// one is a BOARD_STRIP-wide strip, BOARD_GAP apart. Match .board-col and .board-cols in app.css.
|
|
81
|
-
export const BOARD_COL =
|
|
80
|
+
export const BOARD_COL = 320
|
|
82
81
|
export const BOARD_STRIP = 44
|
|
83
82
|
export const BOARD_GAP = 10
|
|
84
83
|
// Before you open or fold one yourself, the work in flight stays open first.
|
|
@@ -445,7 +444,7 @@ export function matchesSearch (text, query) {
|
|
|
445
444
|
return words.every((w) => text.includes(w))
|
|
446
445
|
}
|
|
447
446
|
|
|
448
|
-
function card (t, col, me, people
|
|
447
|
+
function card (t, col, me, people) {
|
|
449
448
|
const who = t.by === me ? 'You' : (t.by || '')
|
|
450
449
|
const mine = t.assignee === me && !t.forAi ? ' mine' : t.assignee === me && t.forAi ? ' mine-ai' : ''
|
|
451
450
|
const moves = col.moves.map((m) =>
|
|
@@ -453,24 +452,16 @@ function card (t, col, me, people, open = false) {
|
|
|
453
452
|
).join('')
|
|
454
453
|
// An assigned task wears its owner's colour as a corner piece (app.css .task.owned).
|
|
455
454
|
const owner = t.assignee ?` owned" style="--c:${esc(colorFor(t.assignee, people.find((p) => p.name === t.assignee)?.color))}` : ''
|
|
456
|
-
|
|
457
|
-
const holder = t.assignee ? people.find((p) => p.name === t.assignee) : null
|
|
458
|
-
const whoHtml = t.assignee ? `<div class="task-who">${avatar(t.assignee, holder?.color)}<span>${esc(t.forAi ? assigneeText(t, me).replace(/^your /, 'Your ') : t.assignee === me ? 'You' : t.assignee)}</span></div>` : ''
|
|
459
|
-
const live = t.column === 'doing' && holder && holder.working && (t.forAi || holder.agent)
|
|
460
|
-
? `<div class="task-live"><span class="pulse"></span>${esc(holder.agent ? 'working' : `${toolLabel(t.tool || holder.tool) || 'AI'} working`)}${holder.since ? ` · ${esc(ago(holder.since))}` : ''}</div>`
|
|
461
|
-
: ''
|
|
462
|
-
return `<article class="task${mine}${owner}${open ? ' open' : ''}" draggable="true" data-task="${esc(t.id)}" data-search="${esc(searchText(t, me))}">
|
|
455
|
+
return `<article class="task${mine}${owner}" draggable="true" data-task="${esc(t.id)}" data-search="${esc(searchText(t, me))}">
|
|
463
456
|
<div class="task-main">
|
|
464
457
|
<div class="task-tools">
|
|
465
458
|
${notesButton(t)}
|
|
466
459
|
${recurButton(t)}
|
|
467
460
|
<button type="button" class="task-icon" data-task-more title="More" aria-label="More for ${esc(t.title)}" aria-haspopup="menu" aria-expanded="false">${I.more}</button>
|
|
468
461
|
</div>
|
|
469
|
-
<p class="task-title" title="
|
|
462
|
+
<p class="task-title" title="Click to rename">${esc(t.title)}</p>
|
|
470
463
|
</div>
|
|
471
|
-
${whoHtml}${live}
|
|
472
464
|
${noPickupHtml(t)}
|
|
473
|
-
<div class="task-details">
|
|
474
465
|
<select class="task-assign" aria-label="Assign ${esc(t.title)}">${assignOptions(t, me, people)}</select>
|
|
475
466
|
${recurHtml(t)}
|
|
476
467
|
${filesHtml(t.files)}
|
|
@@ -483,6 +474,5 @@ function card (t, col, me, people, open = false) {
|
|
|
483
474
|
<span class="task-by">${esc(who)}</span>
|
|
484
475
|
<div class="task-moves">${moves}</div>
|
|
485
476
|
</div>
|
|
486
|
-
</div>
|
|
487
477
|
</article>`
|
|
488
478
|
}
|
package/src/ui/connections.js
CHANGED
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
// button): 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
|
-
import { api, esc, toast, ago, I
|
|
5
|
+
import { api, esc, toast, ago, I } from './common.js'
|
|
6
6
|
import { SEARCH_ICON } from './quiltview.js'
|
|
7
7
|
|
|
8
8
|
const views = new Map() // `${type}:${id}` -> the last view, so a redraw shows it at once
|
|
9
9
|
const urlOf = (type, id, rest = '') => `/api/connections/${type}/${encodeURIComponent(id)}${rest}`
|
|
10
|
-
const PAGE = 48 // apps fetched at a time for the catalog
|
|
11
|
-
// An app's page on the website, with every action it has (web/app/integrations/[slug]).
|
|
12
|
-
const siteUrl = (a) => `https://heyquilt.com/integrations/${encodeURIComponent(a.slug)}`
|
|
13
10
|
const LEVEL = { session: 'this session', workspace: 'the workspace', org: 'the team' }
|
|
14
11
|
const STATUS = { active: 'Connected', pending: 'Waiting for sign-in', failed: 'Didn\'t connect' }
|
|
12
|
+
const SHOWN = 12
|
|
15
13
|
|
|
16
14
|
const logoHtml = (a) => a.logo
|
|
17
15
|
? `<img class="cn-logo" src="${esc(a.logo)}" alt="" loading="lazy" referrerpolicy="no-referrer">`
|
|
@@ -21,186 +19,39 @@ const logoHtml = (a) => a.logo
|
|
|
21
19
|
* Draws the card into `root` for one scope ({ type, id }: a session's room, a workspace's id, a
|
|
22
20
|
* team's slug). Answers { refresh, destroy }.
|
|
23
21
|
*/
|
|
24
|
-
export function mountConnections (root, { type, id
|
|
25
|
-
|
|
26
|
-
const ui = { search: '', apps: null, total: 0, all: 0, groups: [], group: '', open: null, pour: null, loadingMore: false, busy: '', error: '', calls: null, confirm: null }
|
|
27
|
-
const details = new Map() // app slug -> { actions, total } or { error }, for its opened card
|
|
28
|
-
|
|
22
|
+
export function mountConnections (root, { type, id }) {
|
|
23
|
+
const ui = { search: '', apps: null, appsFor: null, more: false, busy: '', error: '', calls: null, confirm: null }
|
|
29
24
|
let view = views.get(`${type}:${id}`) || null
|
|
30
25
|
let alive = true
|
|
31
26
|
let poll = null
|
|
32
27
|
let searchTimer = null
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
const what = c.status === 'pending' ? 'Waiting for you to sign in, in your browser.'
|
|
41
|
-
: c.status === 'failed' ? 'Didn’t connect. Connect it again.'
|
|
42
|
-
: `${c.who === 'people' ? 'People and their own AIs can use it' : 'People and agents can use it'} in ${where}. Connected by ${by}.`
|
|
43
|
-
const sw = c.status === 'active'
|
|
44
|
-
? `<label class="cn-sw" title="${c.who === 'people' ? 'Agents can’t use it: switch on to let them' : 'Agents can use it: switch off to keep it to people'}"><input type="checkbox" ${own && c.mayChange ? `data-who-toggle="${esc(c.id)}"` : 'disabled'} ${c.who === 'all' ? 'checked' : ''} aria-label="${esc(`Agents can use ${c.name}`)}"><i></i></label>`
|
|
45
|
-
: `<span class="cn-state ${esc(c.status)}">${esc(STATUS[c.status] || c.status)}</span>`
|
|
46
|
-
const manage = own && c.mayChange
|
|
29
|
+
function connectedHtml (c, own) {
|
|
30
|
+
const status = c.status === 'active' ? '' : `<span class="cn-state ${esc(c.status)}">${esc(STATUS[c.status] || c.status)}</span>`
|
|
31
|
+
const who = own && c.mayChange && c.status === 'active'
|
|
32
|
+
? `<select class="input sm" data-who="${esc(c.id)}" aria-label="Who may use ${esc(c.name)}"><option value="all"${c.who === 'all' ? ' selected' : ''}>People and agents</option><option value="people"${c.who === 'people' ? ' selected' : ''}>People only</option></select>`
|
|
33
|
+
: `<span class="hint">${c.who === 'people' ? 'People only' : 'People and agents'}</span>`
|
|
34
|
+
const remove = own && c.mayChange
|
|
47
35
|
? (ui.confirm === c.id
|
|
48
|
-
? `<span class="cn-confirm">Remove ${esc(c.name)}? <button
|
|
49
|
-
: `<button
|
|
36
|
+
? `<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>`
|
|
37
|
+
: `<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>`)
|
|
50
38
|
: ''
|
|
51
|
-
return `<div class="
|
|
39
|
+
return `<div class="cn-card${c.status === 'active' ? '' : ' off'}">
|
|
40
|
+
<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(LEVEL[c.level] || c.level)}${c.levelName ? ` (${esc(c.levelName)})` : ''} · by ${esc(c.by)}`}</small></div>${status}</div>
|
|
41
|
+
<div class="cn-foot">${who}<span class="spacer"></span>${remove}</div></div>`
|
|
52
42
|
}
|
|
43
|
+
|
|
53
44
|
function appHtml (a, connected) {
|
|
54
45
|
const busy = ui.busy === a.slug
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
: `<button type="button" class="kl-act" data-connect="${esc(a.slug)}"${busy ? ' disabled' : ''}>${busy ? 'Opening…' : connected ? 'Add another' : 'Connect'}</button>`
|
|
58
|
-
return `<div class="kl-card${ui.open === a.slug ? ' open' : ''}" data-open="${esc(a.slug)}" role="button" tabindex="0" aria-expanded="${ui.open === a.slug}">${logoHtml(a)}<div class="kl-t"><b>${esc(a.name)}<i class="${esc(a.how)}">${esc(HOW[a.how] || '')}</i></b><small title="${esc(a.description)}">${esc(a.description || '')}</small></div><div class="kl-r">${act}</div></div>`
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// An opened card's row under it (Daniel, 2026-11-12): all it says about itself, how you sign in, and what agents
|
|
62
|
-
// can do with it, split the way Quilt runs it: reads at once, anything that changes something asks a person first.
|
|
63
|
-
// What an action does, as a small icon from its name: search and read, create, change, delete, send.
|
|
64
|
-
const SEARCH = '<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>'
|
|
65
|
-
const HAND = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 11V6a2 2 0 0 0-4 0v5M14 10V4a2 2 0 0 0-4 0v6M10 10.5V6a2 2 0 0 0-4 0v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-6-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/></svg>'
|
|
66
|
-
function verbIcon (t) {
|
|
67
|
-
const words = `${t.slug} ${t.name}`.toUpperCase()
|
|
68
|
-
if (/\b(DELETE|REMOVE|ARCHIVE|CANCEL|TRASH)/.test(words)) return I.trash
|
|
69
|
-
if (/\b(SEND|REPLY|POST_MESSAGE|INVITE|SHARE|FORWARD|NOTIFY|PUBLISH)/.test(words)) return I.send
|
|
70
|
-
if (/\b(CREATE|ADD|NEW|INSERT|UPLOAD|SUBMIT|START)/.test(words)) return I.plus
|
|
71
|
-
if (/\b(UPDATE|EDIT|MODIFY|SET|CONFIGURE|MANAGE|MOVE|RENAME|CHANGE|CLEAN)/.test(words)) return I.pencil
|
|
72
|
-
if (/\b(SEARCH|FIND|QUERY|LOOKUP|AUTOCOMPLETE)/.test(words)) return SEARCH
|
|
73
|
-
return t.readOnly ? I.eye : I.pencil
|
|
74
|
-
}
|
|
75
|
-
// An opened card's row (Daniel, 2026-11-12): only what the app can do, split the way Quilt runs it: what agents read
|
|
76
|
-
// on their own, and what asks a person first. Six of each, the rest a click away.
|
|
77
|
-
function openRowHtml (a) {
|
|
78
|
-
const d = details.get(a.slug)
|
|
79
|
-
const SHOWN = 6
|
|
80
|
-
const col = (kind, title, note, icon, xs) => {
|
|
81
|
-
const list = xs.slice(0, SHOWN)
|
|
82
|
-
return `<div class="kl-dcol ${kind}"><div class="kl-dch"><span class="kl-dbadge">${icon}${esc(title)}<i>${xs.length}</i></span><small>${esc(note)}</small></div>
|
|
83
|
-
${xs.length ? `<ul>${list.map((t) => `<li><span class="kl-vi">${verbIcon(t)}</span><span><b>${esc(t.name)}</b><small>${esc(t.description)}</small></span></li>`).join('')}</ul>` : '<p class="kl-dnone">None among its actions.</p>'}
|
|
84
|
-
${xs.length > SHOWN ? `<a class="kl-dmore" href="${esc(siteUrl(a))}" target="_blank" rel="noopener">More on heyquilt.com ${I.external}</a>` : ''}</div>`
|
|
85
|
-
}
|
|
86
|
-
const reads = d && !d.error ? d.actions.filter((t) => t.readOnly) : []
|
|
87
|
-
const changes = d && !d.error ? d.actions.filter((t) => !t.readOnly) : []
|
|
88
|
-
const what = !d ? `<p class="hint">${loadingNote()}</p>`
|
|
89
|
-
: d.error ? `<p class="hint">${esc(d.error)}</p>`
|
|
90
|
-
: `<div class="kl-dcols">${col('reads', 'Reads on its own', 'Agents use these right away.', I.eye, reads)}${col('asks', 'Asks someone first', 'Anything that sends, creates, changes or deletes waits for a person to approve it in the session’s chat.', HAND, changes)}</div>
|
|
91
|
-
<p class="kl-dfoot">${I.sparkle}<span>${d.total > d.actions.length ? `Showing ${d.actions.length} of its ${d.total.toLocaleString()} actions.` : `${d.actions.length} actions in all.`} <a href="${esc(siteUrl(a))}" target="_blank" rel="noopener">Every ${esc(a.name)} action on heyquilt.com</a></span></p>`
|
|
92
|
-
// Only what it can do: its name, logo and Connect are on the card it flows out of.
|
|
93
|
-
return `<div class="kl-detail" data-detail="${esc(a.slug)}"><div class="kl-dinner">${what}</div></div>`
|
|
94
|
-
}
|
|
95
|
-
// Opening: its actions are fetched first, so the row pours out of the card at its full height; a second click (or
|
|
96
|
-
// Escape) draws it back in.
|
|
97
|
-
async function openApp (slug) {
|
|
98
|
-
if (ui.open === slug) return closeApp()
|
|
99
|
-
const card = root.querySelector(`.kl-card[data-open="${CSS.escape(slug)}"]`)
|
|
100
|
-
if (!details.has(slug)) {
|
|
101
|
-
card?.classList.add('busy')
|
|
102
|
-
try { const r = await api('GET', `/api/connections/apps/${encodeURIComponent(slug)}`); details.set(slug, { actions: r.actions || [], total: r.total || 0 }) } catch (err) { details.set(slug, { error: err.message, actions: [], total: 0 }) }
|
|
103
|
-
card?.classList.remove('busy')
|
|
104
|
-
}
|
|
105
|
-
ui.open = slug
|
|
106
|
-
ui.pour = 'in'
|
|
107
|
-
draw()
|
|
108
|
-
}
|
|
109
|
-
function closeApp () {
|
|
110
|
-
if (!ui.open) return
|
|
111
|
-
const det = root.querySelector('.kl-detail')
|
|
112
|
-
if (!det || reduced()) { ui.open = null; draw(); return }
|
|
113
|
-
pour(det, 'out', () => { ui.open = null; draw() })
|
|
114
|
-
}
|
|
115
|
-
const reduced = () => window.matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
116
|
-
// An app opened low on the page: the page scrolls along as it pours, so the whole row ends up in view (keeping the
|
|
117
|
-
// card's top in view when the row is taller than the window).
|
|
118
|
-
function bringIntoView (det, full) {
|
|
119
|
-
let sc = det.parentElement
|
|
120
|
-
while (sc && sc !== document.body && !/(auto|scroll)/.test(getComputedStyle(sc).overflowY)) sc = sc.parentElement
|
|
121
|
-
if (!sc || sc === document.body) return
|
|
122
|
-
const card = det.parentElement.querySelector('.kl-card.open')
|
|
123
|
-
const S = sc.getBoundingClientRect()
|
|
124
|
-
const top = (card || det).getBoundingClientRect().top
|
|
125
|
-
const bottom = det.getBoundingClientRect().top + full
|
|
126
|
-
const need = bottom + 16 - S.bottom
|
|
127
|
-
const room = top - 12 - S.top
|
|
128
|
-
const by = Math.min(need, room)
|
|
129
|
-
if (by > 0) sc.scrollBy({ top: by, behavior: reduced() ? 'auto' : 'smooth' })
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// The open card and its row are one shape, drawn behind them: the card's sides curve out into the row, which pours
|
|
133
|
-
// down out of the card and spreads to the full width as it grows (liquid), or draws back in.
|
|
134
|
-
function shapePath (grid, card, det, t) {
|
|
135
|
-
const G = grid.getBoundingClientRect()
|
|
136
|
-
const C = card.getBoundingClientRect()
|
|
137
|
-
const D = det.getBoundingClientRect()
|
|
138
|
-
const r = 14
|
|
139
|
-
const x1 = C.left - G.left + 0.5
|
|
140
|
-
const x2 = C.right - G.left - 0.5
|
|
141
|
-
const y1 = C.top - G.top + 0.5
|
|
142
|
-
const cb = D.top - G.top
|
|
143
|
-
const B = D.bottom - G.top - 0.5
|
|
144
|
-
const L = D.left - G.left + 0.5
|
|
145
|
-
const W = D.right - G.left - 0.5
|
|
146
|
-
// It spreads as it falls: slowly at first (a stream out of the card), then out to both edges.
|
|
147
|
-
const tt = Math.min(1, Math.max(0, t))
|
|
148
|
-
const e = tt * tt * (3 - 2 * tt)
|
|
149
|
-
const PL = x1 + (L - x1) * e
|
|
150
|
-
const PR = x2 + (W - x2) * e
|
|
151
|
-
const h = Math.max(0, B - cb)
|
|
152
|
-
const rr = Math.min(r, h / 2)
|
|
153
|
-
const left = x1 - PL
|
|
154
|
-
const right = PR - x2
|
|
155
|
-
const fl = Math.min(22, left / 2, h)
|
|
156
|
-
const fr = Math.min(22, right / 2, h)
|
|
157
|
-
const tl = Math.min(rr, Math.max(0, left - fl))
|
|
158
|
-
const tr = Math.min(rr, Math.max(0, right - fr))
|
|
159
|
-
let d = `M ${x1 + r} ${y1} H ${x2 - r} A ${r} ${r} 0 0 1 ${x2} ${y1 + r}`
|
|
160
|
-
d += right < 1 ? ` V ${B - rr} A ${rr} ${rr} 0 0 1 ${x2 - rr} ${B}`
|
|
161
|
-
: ` V ${cb - fr} A ${fr} ${fr} 0 0 0 ${x2 + fr} ${cb} H ${PR - tr} A ${tr} ${tr} 0 0 1 ${PR} ${cb + tr} V ${B - rr} A ${rr} ${rr} 0 0 1 ${PR - rr} ${B}`
|
|
162
|
-
d += left < 1 ? ` H ${x1 + rr} A ${rr} ${rr} 0 0 1 ${x1} ${B - rr} V ${y1 + r}`
|
|
163
|
-
: ` H ${PL + rr} A ${rr} ${rr} 0 0 1 ${PL} ${B - rr} V ${cb + tl} A ${tl} ${tl} 0 0 1 ${PL + tl} ${cb} H ${x1 - fl} A ${fl} ${fl} 0 0 0 ${x1} ${cb - fl} V ${y1 + r}`
|
|
164
|
-
return `${d} A ${r} ${r} 0 0 1 ${x1 + r} ${y1} Z`
|
|
165
|
-
}
|
|
166
|
-
function drawShape (t = 1) {
|
|
167
|
-
const grid = root.querySelector('.kl-detail')?.parentElement
|
|
168
|
-
const det = grid && grid.querySelector('.kl-detail')
|
|
169
|
-
const card = grid && grid.querySelector('.kl-card.open')
|
|
170
|
-
if (!det || !card) return
|
|
171
|
-
let svg = grid.querySelector(':scope > .kl-shape')
|
|
172
|
-
if (!svg) { grid.insertAdjacentHTML('afterbegin', '<svg class="kl-shape" aria-hidden="true"><path/></svg>'); svg = grid.firstElementChild }
|
|
173
|
-
svg.firstElementChild.setAttribute('d', shapePath(grid, card, det, t))
|
|
174
|
-
}
|
|
175
|
-
// Pours the row in (its height from nothing to its own, spreading out of the card) or out, then calls `done`.
|
|
176
|
-
function pour (det, way, done = () => {}) {
|
|
177
|
-
const inner = det.firstElementChild
|
|
178
|
-
const full = inner.offsetHeight
|
|
179
|
-
if (way === 'in') bringIntoView(det, full)
|
|
180
|
-
const from = way === 'in' ? 0 : det.offsetHeight
|
|
181
|
-
const to = way === 'in' ? full : 0
|
|
182
|
-
const ms = way === 'in' ? 520 : 300
|
|
183
|
-
const start = performance.now()
|
|
184
|
-
let raf = 0
|
|
185
|
-
const ease = way === 'in' ? (x) => 1 - Math.pow(1 - x, 3) : (x) => x * x
|
|
186
|
-
const frame = (now) => {
|
|
187
|
-
const x = Math.min(1, (now - start) / ms)
|
|
188
|
-
const hgt = from + (to - from) * ease(x)
|
|
189
|
-
det.style.height = `${hgt}px`
|
|
190
|
-
inner.style.opacity = String(way === 'in' ? Math.max(0, (x - 0.35) / 0.65) : Math.max(0, 1 - x * 2))
|
|
191
|
-
drawShape(full ? hgt / full : 0)
|
|
192
|
-
if (x < 1) raf = requestAnimationFrame(frame)
|
|
193
|
-
else { det.style.height = ''; inner.style.opacity = ''; done() }
|
|
194
|
-
}
|
|
195
|
-
cancelAnimationFrame(raf)
|
|
196
|
-
raf = requestAnimationFrame(frame)
|
|
46
|
+
return `<div class="cn-app">${logoHtml(a)}<b title="${esc(a.description || a.name)}">${esc(a.name)}</b>
|
|
47
|
+
<button class="btn sm${connected ? ' ghost' : ''}" data-connect="${esc(a.slug)}"${busy ? ' disabled' : ''}>${busy ? 'Opening…' : connected ? 'Add another' : 'Connect'}</button></div>`
|
|
197
48
|
}
|
|
198
49
|
|
|
199
50
|
function callsHtml () {
|
|
200
|
-
if (!ui.calls || !ui.calls.length) return ''
|
|
51
|
+
if (type !== 'session' || !ui.calls || !ui.calls.length) return ''
|
|
201
52
|
const word = { waiting: 'waiting for approval', approved: 'approved', declined: 'declined', ran: 'ran', failed: 'failed' }
|
|
202
|
-
return `<
|
|
203
|
-
<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>`
|
|
53
|
+
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">
|
|
54
|
+
<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>`
|
|
204
55
|
}
|
|
205
56
|
|
|
206
57
|
function draw () {
|
|
@@ -209,40 +60,18 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
209
60
|
if (ui.error && !view) { root.innerHTML = `<div class="cn"><p class="hint">${esc(ui.error)}</p></div>`; return }
|
|
210
61
|
if (!view) { root.innerHTML = '<div class="cn"><p class="hint">Loading connections…</p></div>'; return }
|
|
211
62
|
const own = view.connections || []
|
|
212
|
-
const inherited = view.inherited || []
|
|
213
63
|
const ownApps = new Set(own.map((c) => c.app))
|
|
214
64
|
const apps = ui.apps || []
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
root.innerHTML = `<div class="cn kl${page ? ' cn-page' : ''}">
|
|
224
|
-
<header class="kl-h">${page ? '<h2>Connections</h2>' : '<h3>Connections</h3>'}<p>${lead}</p></header>
|
|
225
|
-
${own.length || inherited.length ? `<section class="kl-sec"><div class="kl-label">Connected <i>${count}</i></div><div class="kl-grid">${own.map((c) => cardHtml(c, true)).join('')}${inherited.map((c) => cardHtml(c, false)).join('')}</div></section>` : ''}
|
|
226
|
-
${view.canManage ? `<section class="kl-sec" id="cn-catalog">
|
|
227
|
-
<label class="kl-search">${SEARCH_ICON}<input data-search placeholder="Search for an app" value="${esc(ui.search)}" aria-label="Search for an app"><span>${ui.all ? `${ui.all.toLocaleString()} available` : ''}</span></label>
|
|
228
|
-
${ui.groups.length && !ui.search ? `<div class="kl-tabs" role="tablist" aria-label="Kinds of apps">${[{ id: '', name: 'Recommended' }, ...ui.groups].map((g) => `<button type="button" class="kl-tab${ui.group === g.id ? ' on' : ''}" role="tab" aria-selected="${ui.group === g.id}" data-group="${esc(g.id)}">${esc(g.name)}</button>`).join('')}</div>` : ''}
|
|
229
|
-
<div class="kl-label">${ui.search ? `Apps matching “${esc(ui.search)}” <i>${ui.apps === null ? '' : ui.total.toLocaleString()}</i>` : `${esc(groupName)} <i>${ui.apps === null ? '' : ui.total.toLocaleString()}</i>`}</div>
|
|
230
|
-
${ui.apps === null ? '<p class="hint">Loading apps…</p>' : shown.length ? `<div class="kl-grid">${shown.map((a) => appHtml(a, ownApps.has(a.slug))).join('')}</div>` : `<p class="hint">No app matches${ui.search ? ` “${esc(ui.search)}”` : ''}.</p>`}
|
|
231
|
-
${left > 0 ? `<button type="button" class="btn cn-more" data-load-more${ui.loadingMore ? ' disabled' : ''}>${ui.loadingMore ? 'Loading…' : `Load more <i>${left.toLocaleString()} more</i>`}</button>` : ''}
|
|
232
|
-
</section>` : ''}
|
|
65
|
+
const shown = ui.more || ui.search ? apps : apps.slice(0, SHOWN)
|
|
66
|
+
root.innerHTML = `<div class="cn">
|
|
67
|
+
<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>
|
|
68
|
+
${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>` : ''}
|
|
69
|
+
${(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>` : ''}
|
|
70
|
+
${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>
|
|
71
|
+
${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>`}
|
|
72
|
+
${!ui.search && !ui.more && apps.length > SHOWN ? '<button class="btn sm ghost" data-more>Show more apps</button>' : ''}</section>` : ''}
|
|
233
73
|
${callsHtml()}
|
|
234
74
|
</div>`
|
|
235
|
-
// The open card's row goes after the last card of its row, across both columns.
|
|
236
|
-
const opened = ui.open && root.querySelector(`.kl-card[data-open="${CSS.escape(ui.open)}"]`)
|
|
237
|
-
const openApp_ = ui.open && shown.find((a) => a.slug === ui.open)
|
|
238
|
-
if (opened && openApp_) {
|
|
239
|
-
let end = opened
|
|
240
|
-
while (end.nextElementSibling && end.nextElementSibling.offsetTop === opened.offsetTop) end = end.nextElementSibling
|
|
241
|
-
end.insertAdjacentHTML('afterend', openRowHtml(openApp_))
|
|
242
|
-
const det = end.nextElementSibling
|
|
243
|
-
if (ui.pour === 'in' && !reduced()) { det.style.height = '0px'; det.firstElementChild.style.opacity = '0'; pour(det, 'in') } else drawShape(1)
|
|
244
|
-
ui.pour = null
|
|
245
|
-
}
|
|
246
75
|
if (had) { const s = root.querySelector('[data-search]'); s.focus(); s.setSelectionRange(s.value.length, s.value.length) }
|
|
247
76
|
}
|
|
248
77
|
|
|
@@ -255,52 +84,34 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
255
84
|
ui.error = err.status === 503 ? 'App connections are not switched on for your account\'s server yet.' : err.message
|
|
256
85
|
view = null
|
|
257
86
|
}
|
|
258
|
-
|
|
259
|
-
if (room) ui.calls = (await api('GET', `/api/app-calls/${encodeURIComponent(room)}`).catch(() => ({ calls: null }))).calls
|
|
87
|
+
if (type === 'session') ui.calls = (await api('GET', `/api/app-calls/${encodeURIComponent(id)}`).catch(() => ({ calls: null }))).calls
|
|
260
88
|
draw()
|
|
261
89
|
// A connection waiting for its sign-in is looked at again until it lands.
|
|
262
90
|
clearTimeout(poll)
|
|
263
91
|
if (alive && view && (view.connections || []).some((c) => c.status === 'pending' && Date.now() - c.createdAt < 10 * 60 * 1000)) poll = setTimeout(load, 3000)
|
|
264
92
|
}
|
|
265
93
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
const key = `${ui.search}|${ui.group}`
|
|
269
|
-
const offset = more ? (ui.apps || []).length : 0
|
|
270
|
-
if (more) { ui.loadingMore = true; draw() }
|
|
94
|
+
async function loadApps () {
|
|
95
|
+
const q = ui.search
|
|
271
96
|
try {
|
|
272
|
-
const r = await api('GET', `/api/connections/apps?search=${encodeURIComponent(
|
|
273
|
-
if (
|
|
274
|
-
ui.apps =
|
|
275
|
-
|
|
276
|
-
ui.all = r.all ?? ui.total
|
|
277
|
-
if (r.groups && r.groups.length) ui.groups = r.groups
|
|
278
|
-
} catch (err) { if (!more) ui.apps = []; if (err.status !== 503) toast(err.message) }
|
|
279
|
-
ui.loadingMore = false
|
|
97
|
+
const r = await api('GET', `/api/connections/apps?search=${encodeURIComponent(q)}&limit=${q ? 40 : 60}`)
|
|
98
|
+
if (q !== ui.search) return
|
|
99
|
+
ui.apps = r.apps || []
|
|
100
|
+
} catch (err) { ui.apps = []; if (err.status !== 503) toast(err.message) }
|
|
280
101
|
draw()
|
|
281
102
|
}
|
|
282
103
|
|
|
283
104
|
root.addEventListener('input', (e) => {
|
|
284
105
|
if (!e.target.matches('[data-search]')) return
|
|
285
106
|
ui.search = e.target.value.trim()
|
|
286
|
-
ui.open = null
|
|
287
107
|
clearTimeout(searchTimer)
|
|
288
108
|
searchTimer = setTimeout(loadApps, 250)
|
|
289
109
|
})
|
|
290
110
|
|
|
291
|
-
root.addEventListener('keydown', (e) => {
|
|
292
|
-
const card = e.target.matches && e.target.matches('[data-open]') ? e.target : null
|
|
293
|
-
if (card && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); openApp(card.dataset.open) }
|
|
294
|
-
if (e.key === 'Escape' && ui.open) closeApp()
|
|
295
|
-
})
|
|
296
|
-
// A resize moves cards between rows: the open one's row moves with it.
|
|
297
|
-
const onResize = () => { if (ui.open) draw() } // the row moves under its card's new row, and the shape is redrawn
|
|
298
|
-
window.addEventListener('resize', onResize)
|
|
299
|
-
|
|
300
111
|
root.addEventListener('change', async (e) => {
|
|
301
|
-
const
|
|
302
|
-
if (!
|
|
303
|
-
try { await api('PATCH', urlOf(type, id, `/${
|
|
112
|
+
const sel = e.target.closest('[data-who]')
|
|
113
|
+
if (!sel) return
|
|
114
|
+
try { await api('PATCH', urlOf(type, id, `/${sel.dataset.who}`), { who: sel.value }); load() } catch (err) { toast(err.message); load() }
|
|
304
115
|
})
|
|
305
116
|
|
|
306
117
|
root.addEventListener('click', async (e) => {
|
|
@@ -327,12 +138,7 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
327
138
|
load()
|
|
328
139
|
return
|
|
329
140
|
}
|
|
330
|
-
|
|
331
|
-
if (card && !e.target.closest('button, a, input, label')) { openApp(card.dataset.open); return }
|
|
332
|
-
const tab = e.target.closest('[data-group]')
|
|
333
|
-
if (tab) { ui.group = tab.dataset.group; ui.open = null; ui.apps = null; draw(); loadApps(); return }
|
|
334
|
-
if (e.target.closest('[data-load-more]')) { loadApps(true); return }
|
|
335
|
-
|
|
141
|
+
if (e.target.closest('[data-more]')) { ui.more = true; draw() }
|
|
336
142
|
})
|
|
337
143
|
|
|
338
144
|
draw()
|
|
@@ -340,7 +146,7 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
340
146
|
loadApps()
|
|
341
147
|
return {
|
|
342
148
|
refresh: load,
|
|
343
|
-
destroy () { alive = false; clearTimeout(poll); clearTimeout(searchTimer)
|
|
149
|
+
destroy () { alive = false; clearTimeout(poll); clearTimeout(searchTimer) }
|
|
344
150
|
}
|
|
345
151
|
}
|
|
346
152
|
|