heyquilt 0.3.156 → 0.3.158
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 +8 -0
- package/package.json +1 -1
- package/src/api/routes/connections.js +26 -10
- package/src/ui/app.css +63 -0
- package/src/ui/connections.js +36 -47
- package/src/ui-server.js +1 -1
package/RELEASES.md
CHANGED
|
@@ -11,6 +11,14 @@ 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.158 — 2026-11-12
|
|
15
|
+
|
|
16
|
+
- **Connections, laid out like a directory.** One search for every app ("1,644 available"), tabs for Recommended, Email & Calendar, Projects & Code, Marketing & Growth, Business Ops, Knowledge and Other, and two columns of cards: each app's logo, what it does, how you sign in, and **Connect**. Your connected apps are the same cards at the top, with their switch and **Manage**.
|
|
17
|
+
|
|
18
|
+
## 0.3.157 — 2026-11-12
|
|
19
|
+
|
|
20
|
+
- **A new Connections page.** The apps you've connected are cards at the top. Below them, one search box for every app you can connect, a row of categories, and a grid of app icons. Click an app to see what it is and how you sign in, and connect it right there.
|
|
21
|
+
|
|
14
22
|
## 0.3.156 — 2026-11-12
|
|
15
23
|
|
|
16
24
|
- **Every app you can connect.** Connections lists all 1,600+ apps Composio can connect for you, most used first, with categories, search, and Load more. Each says how you sign in: one click, or your own API key. **Add a connection** takes you to them.
|
package/package.json
CHANGED
|
@@ -25,13 +25,29 @@ const MAX_KEPT = 16_000
|
|
|
25
25
|
const MAX_ARGS = 32_000
|
|
26
26
|
|
|
27
27
|
/** An action's arguments in a line: what people read on the approval card. */
|
|
28
|
+
// The catalog's tabs (Daniel, 2026-11-12: laid out as Kylon's): Composio's categories grouped. An app is in every
|
|
29
|
+
// group one of its categories is in; Other has the apps in none; Recommended is every app, most used first.
|
|
30
|
+
export const APP_GROUPS = [
|
|
31
|
+
{ id: 'email', name: 'Email & Calendar', cats: ['email', 'calendar', 'scheduling-&-booking', 'email-newsletters', 'transactional-email', 'drip-emails', 'video-conferencing', 'ai-meeting-assistants', 'webinars', 'event-management'] },
|
|
32
|
+
{ id: 'code', name: 'Projects & Code', cats: ['developer-tools', 'project-management', 'task-management', 'product-management', 'server-monitoring', 'it-operations', 'databases', 'app-builder', 'website-&-app-building', 'website-builders', 'security-&-identity-tools', 'time-tracking-software'] },
|
|
33
|
+
{ id: 'marketing', name: 'Marketing & Growth', cats: ['marketing-automation', 'marketing', 'analytics', 'social-media-marketing', 'social-media-accounts', 'ads-&-conversion', 'seo-&-ai-visibility', 'url-shortener', 'business-intelligence', 'dashboards', 'reviews', 'forms-&-surveys', 'customer-appreciation', 'social-&-creator-data', 'call-tracking'] },
|
|
34
|
+
{ id: 'business', name: 'Business Ops', cats: ['crm', 'sales-&-crm', 'ecommerce', 'commerce', 'accounting', 'payment-processing', 'customer-support', 'support', 'contact-management', 'human-resources', 'hr-talent-&-recruitment', 'proposal-&-invoice-management', 'signatures', 'taxes', 'fundraising', 'ai-sales-tools', 'people-&-contact-data', 'company-data', 'legal-&-public-records', 'phone-&-sms', 'communication', 'team-chat', 'notifications'] },
|
|
35
|
+
{ id: 'knowledge', name: 'Knowledge', cats: ['documents', 'productivity', 'team-collaboration', 'notes', 'file-management-&-storage', 'spreadsheets', 'content-&-files', 'documents-&-ocr', 'bookmark-managers', 'web-search-&-research', 'education', 'online-courses', 'transcription', 'ai-document-extraction'] }
|
|
36
|
+
]
|
|
37
|
+
const groupsOf = (a) => {
|
|
38
|
+
const ids = a.categories.map((c) => c.id)
|
|
39
|
+
const in_ = APP_GROUPS.filter((g) => g.cats.some((c) => ids.includes(c))).map((g) => g.id)
|
|
40
|
+
return in_.length ? in_ : ['other']
|
|
41
|
+
}
|
|
42
|
+
|
|
28
43
|
/**
|
|
29
|
-
* A page of the catalog for the Connections page: { apps, total,
|
|
30
|
-
*
|
|
44
|
+
* A page of the catalog for the Connections page: { apps, total, all, groups }. `group`: one of APP_GROUPS (or
|
|
45
|
+
* 'other'), '' for every app. A search matches names first, then descriptions and categories, across every group.
|
|
46
|
+
* `groups`: each tab with how many apps it has.
|
|
31
47
|
*/
|
|
32
|
-
export function pickApps (all, { search = '',
|
|
48
|
+
export function pickApps (all, { search = '', group = '', offset = 0, limit = 48 }) {
|
|
33
49
|
const words = String(search).toLowerCase().trim().slice(0, 100).split(/\s+/).filter(Boolean)
|
|
34
|
-
let list =
|
|
50
|
+
let list = group && !words.length ? all.filter((a) => groupsOf(a).includes(group)) : all
|
|
35
51
|
if (words.length) {
|
|
36
52
|
const score = (a) => {
|
|
37
53
|
const name = a.name.toLowerCase()
|
|
@@ -41,15 +57,15 @@ export function pickApps (all, { search = '', category = '', offset = 0, limit =
|
|
|
41
57
|
}
|
|
42
58
|
list = list.map((a, i) => ({ a, s: score(a), i })).filter((x) => x.s).sort((x, y) => y.s - x.s || x.i - y.i).map((x) => x.a)
|
|
43
59
|
}
|
|
44
|
-
const
|
|
45
|
-
for (const a of all) for (const
|
|
60
|
+
const n = new Map()
|
|
61
|
+
for (const a of all) for (const g of groupsOf(a)) n.set(g, (n.get(g) || 0) + 1)
|
|
46
62
|
const from = Math.max(0, offset)
|
|
47
|
-
const
|
|
63
|
+
const size = Math.min(200, Math.max(1, limit))
|
|
48
64
|
return {
|
|
49
|
-
apps: list.slice(from, from +
|
|
65
|
+
apps: list.slice(from, from + size),
|
|
50
66
|
total: list.length,
|
|
51
67
|
all: all.length,
|
|
52
|
-
|
|
68
|
+
groups: [...APP_GROUPS.map((g) => ({ id: g.id, name: g.name, n: n.get(g.id) || 0 })), { id: 'other', name: 'Other', n: n.get('other') || 0 }]
|
|
53
69
|
}
|
|
54
70
|
}
|
|
55
71
|
|
|
@@ -205,7 +221,7 @@ export function connectionRoutes (ctx) {
|
|
|
205
221
|
const u = url || new URL(req.url, 'http://x')
|
|
206
222
|
return pickApps(await composio.catalog(), {
|
|
207
223
|
search: u.searchParams.get('search') || '',
|
|
208
|
-
|
|
224
|
+
group: u.searchParams.get('group') || '',
|
|
209
225
|
offset: Number(u.searchParams.get('offset')) || 0,
|
|
210
226
|
limit: Number(u.searchParams.get('limit')) || 48
|
|
211
227
|
})
|
package/src/ui/app.css
CHANGED
|
@@ -3592,3 +3592,66 @@ button.sh-repo:hover { color: var(--text); }
|
|
|
3592
3592
|
.cn-how { flex: 1; min-width: 0; font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .cn-how.oneclick { color: var(--ok); }
|
|
3593
3593
|
.cn-af .btn { height: 30px; padding: 0 14px; }
|
|
3594
3594
|
.cn-ready { font-size: 12px; font-weight: 600; color: var(--ok); }
|
|
3595
|
+
|
|
3596
|
+
/* Connections, layout C (conn-options.html): connected cards, one big search with a row of category tabs, and an
|
|
3597
|
+
icon grid; the open app's details sit under its row */
|
|
3598
|
+
.cn-hero { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 0 4px; }
|
|
3599
|
+
.cn-bigsrc { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 560px; height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--faint); }
|
|
3600
|
+
.cn-bigsrc:focus-within { border-color: var(--border-strong); }
|
|
3601
|
+
.cn-bigsrc svg { width: 16px; height: 16px; flex: none; }
|
|
3602
|
+
.cn-bigsrc input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: 14px var(--sans); color: var(--text); }
|
|
3603
|
+
.cn-tabs { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
|
|
3604
|
+
.cn-tab { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: 500 12.5px var(--sans); white-space: nowrap; cursor: pointer; }
|
|
3605
|
+
.cn-tab:hover { color: var(--text); } .cn-tab.on { background: var(--panel-2); color: var(--text); }
|
|
3606
|
+
.cn-tab svg { width: 12px; height: 12px; }
|
|
3607
|
+
.cn-tabmore { position: relative; }
|
|
3608
|
+
.cn-tabmenu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; min-width: 220px; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); box-shadow: 0 12px 30px light-dark(rgba(29, 27, 46, .12), rgba(0, 0, 0, .45)); display: flex; flex-direction: column; }
|
|
3609
|
+
.cn-tabmenu button { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: 13px var(--sans); text-align: left; cursor: pointer; }
|
|
3610
|
+
.cn-tabmenu button:hover { background: var(--panel-2); } .cn-tabmenu i { font-style: normal; color: var(--faint); font-size: 12px; }
|
|
3611
|
+
.cn-found { margin: 0; font-size: 12.5px; color: var(--muted); }
|
|
3612
|
+
.cn-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; margin-top: 6px; }
|
|
3613
|
+
.cn-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; padding: 16px 8px 12px; border: 1px solid transparent; border-radius: 12px; background: none; color: var(--text); font: inherit; cursor: pointer; }
|
|
3614
|
+
.cn-tile:hover, .cn-tile.open { background: var(--panel); border-color: var(--border); }
|
|
3615
|
+
.cn-tile .cn-logo { width: 44px; height: 44px; padding: 6px; box-sizing: border-box; border-radius: 11px; background: #fff; box-shadow: 0 0 0 1px var(--border); object-fit: contain; }
|
|
3616
|
+
.cn-tile .cn-logo.none { display: grid; place-items: center; background: var(--panel-2); font-size: 16px; }
|
|
3617
|
+
.cn-tile b { max-width: 100%; font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
3618
|
+
.cn-detail { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
|
|
3619
|
+
.cn-detail .cn-logo { width: 44px; height: 44px; padding: 6px; box-sizing: border-box; border-radius: 11px; background: #fff; box-shadow: 0 0 0 1px var(--border); object-fit: contain; flex: none; }
|
|
3620
|
+
.cn-detail > div { flex: 1; min-width: 0; } .cn-detail b { font-size: 15px; font-weight: 600; } .cn-detail p { margin: 3px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
|
|
3621
|
+
.cn-detail .btn { flex: none; height: 36px; }
|
|
3622
|
+
.cn-page .cn-grid { margin-bottom: 4px; }
|
|
3623
|
+
|
|
3624
|
+
/* Connections as Kylon lays out theirs (Daniel, 2026-11-12): a big title, one search with how many apps are
|
|
3625
|
+
available, underlined tabs, a small caps label, and two columns of roomy cards with the action on the right */
|
|
3626
|
+
.cn.kl { gap: 0; }
|
|
3627
|
+
.kl-h h2 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.01em; } .kl-h h3 { margin: 0; font-size: 17px; font-weight: 600; }
|
|
3628
|
+
.kl-h p { margin: 6px 0 0; font-size: 13.5px; color: var(--muted); }
|
|
3629
|
+
.kl-sec { display: flex; flex-direction: column; margin-top: 28px; }
|
|
3630
|
+
.kl-search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--faint); }
|
|
3631
|
+
.kl-search:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 6%, transparent); }
|
|
3632
|
+
.kl-search svg { width: 17px; height: 17px; flex: none; }
|
|
3633
|
+
.kl-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: 14px var(--sans); color: var(--text); }
|
|
3634
|
+
.kl-search span { flex: none; font-size: 13px; font-weight: 600; color: var(--muted); }
|
|
3635
|
+
.kl-tabs { display: flex; gap: 22px; margin-top: 16px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
|
|
3636
|
+
.kl-tab { flex: none; padding: 0 2px 11px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--muted); font: 600 13.5px var(--sans); cursor: pointer; white-space: nowrap; }
|
|
3637
|
+
.kl-tab:hover { color: var(--text); } .kl-tab.on { color: var(--text); border-bottom-color: var(--text); }
|
|
3638
|
+
.kl-label { margin: 22px 2px 12px; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
|
|
3639
|
+
.kl-label i { font-style: normal; font-weight: 500; letter-spacing: 0; color: var(--faint); margin-left: 4px; }
|
|
3640
|
+
.kl-sec > .kl-label:first-child { margin-top: 0; }
|
|
3641
|
+
.kl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
|
|
3642
|
+
.kl-card { display: flex; align-items: center; gap: 16px; min-width: 0; padding: 18px 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); transition: border-color .15s; }
|
|
3643
|
+
.kl-card:hover { border-color: var(--border-strong); }
|
|
3644
|
+
.kl-card .cn-logo { width: 40px; height: 40px; padding: 0; border-radius: 9px; background: none; box-shadow: none; object-fit: contain; flex: none; align-self: flex-start; }
|
|
3645
|
+
.kl-card .cn-logo.none { display: grid; place-items: center; background: var(--panel-2); font-size: 16px; }
|
|
3646
|
+
.kl-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
|
|
3647
|
+
.kl-t b { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3648
|
+
.kl-t b i { font-style: normal; font-weight: 500; font-size: 12.5px; color: var(--faint); margin-left: 8px; } .kl-t b i.oneclick { color: var(--ok); }
|
|
3649
|
+
.kl-t small { font-size: 13px; line-height: 1.45; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
3650
|
+
.kl-r { flex: none; display: flex; align-items: center; gap: 14px; }
|
|
3651
|
+
.kl-act { border: 0; padding: 6px 2px; background: none; color: var(--text); font: 600 13.5px var(--sans); cursor: pointer; } .kl-act:hover { color: var(--accent); } .kl-act:disabled { color: var(--faint); cursor: default; }
|
|
3652
|
+
.kl-ready { font-size: 13px; font-weight: 600; color: var(--ok); }
|
|
3653
|
+
.kl-card.conn.off .cn-logo { filter: grayscale(1); opacity: .6; }
|
|
3654
|
+
.kl .cn-confirm { display: inline-flex; gap: 8px; font-size: 12.5px; }
|
|
3655
|
+
.kl .cn-more { margin-top: 16px; }
|
|
3656
|
+
@media (max-width: 760px) { .kl-grid { grid-template-columns: 1fr; } }
|
|
3657
|
+
.kl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
package/src/ui/connections.js
CHANGED
|
@@ -8,7 +8,6 @@ import { SEARCH_ICON } from './quiltview.js'
|
|
|
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
10
|
const PAGE = 48 // apps fetched at a time for the catalog
|
|
11
|
-
const cap = (t) => String(t || '').replace(/(^|[\s/&-])(\p{L})/gu, (m, a, b) => a + b.toUpperCase()).replace(/\bAi\b/g, 'AI').replace(/\bCrm\b/g, 'CRM')
|
|
12
11
|
const LEVEL = { session: 'this session', workspace: 'the workspace', org: 'the team' }
|
|
13
12
|
const STATUS = { active: 'Connected', pending: 'Waiting for sign-in', failed: 'Didn\'t connect' }
|
|
14
13
|
|
|
@@ -22,45 +21,37 @@ const logoHtml = (a) => a.logo
|
|
|
22
21
|
*/
|
|
23
22
|
export function mountConnections (root, { type, id, page = false, sessions = [], callsRoom = null, me = '' }) {
|
|
24
23
|
// The catalog: `apps` the page shown so far, `total` how many match, `cat` the category picked ('' every app).
|
|
25
|
-
const ui = { search: '', apps: null, total: 0, all: 0,
|
|
24
|
+
const ui = { search: '', apps: null, total: 0, all: 0, groups: [], group: '', loadingMore: false, busy: '', error: '', calls: null, confirm: null }
|
|
26
25
|
let view = views.get(`${type}:${id}`) || null
|
|
27
26
|
let alive = true
|
|
28
27
|
let poll = null
|
|
29
28
|
let searchTimer = null
|
|
30
29
|
|
|
31
|
-
// The
|
|
30
|
+
// The page as Kylon lays theirs out (Daniel, 2026-11-12): two columns of roomy cards, a logo, the name and what it
|
|
31
|
+
// is, and the action on the right. A connected app's card says where it reaches and has its switch and Manage.
|
|
32
|
+
const HOW = { oneclick: 'one-click sign-in', key: 'your API key', none: 'no sign-in' }
|
|
32
33
|
function cardHtml (c, own) {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
34
|
+
const where = own ? (type === 'workspace' ? (sessions.length ? sessions.join(', ') : 'every session') : (sessions[0] || LEVEL[type])) : `${LEVEL[c.level] || c.level}${c.levelName ? ` (${c.levelName})` : ''}`
|
|
35
|
+
const by = me && c.by === me ? 'you' : c.by
|
|
36
|
+
const what = c.status === 'pending' ? 'Waiting for you to sign in, in your browser.'
|
|
37
|
+
: c.status === 'failed' ? 'Didn’t connect. Connect it again.'
|
|
38
|
+
: `${c.who === 'people' ? 'People and their own AIs can use it' : 'People and agents can use it'} in ${where}. Connected by ${by}.`
|
|
39
|
+
const sw = c.status === 'active'
|
|
40
|
+
? `<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>`
|
|
37
41
|
: `<span class="cn-state ${esc(c.status)}">${esc(STATUS[c.status] || c.status)}</span>`
|
|
38
42
|
const manage = own && c.mayChange
|
|
39
43
|
? (ui.confirm === c.id
|
|
40
|
-
?
|
|
41
|
-
:
|
|
44
|
+
? `<span class="cn-confirm">Remove ${esc(c.name)}? <button type="button" class="cn-link danger" data-remove="${esc(c.id)}">Remove</button><button type="button" class="cn-link" data-cancel>Keep</button></span>`
|
|
45
|
+
: `<button type="button" class="kl-act" data-ask-remove="${esc(c.id)}">Manage</button>`)
|
|
42
46
|
: ''
|
|
43
|
-
|
|
44
|
-
const chips = page ? (own ? (type === 'workspace' ? sessions : [sessions[0] || LEVEL[type]]) : [c.levelName || LEVEL[c.level] || c.level]).filter(Boolean) : [where]
|
|
45
|
-
const by = page && me && c.by === me ? 'you' : c.by
|
|
46
|
-
const pageManage = own && c.mayChange
|
|
47
|
-
? (ui.confirm === c.id
|
|
48
|
-
? ` · <span class="cn-confirm">Remove it? <button type="button" class="cn-link danger" data-remove="${esc(c.id)}">Remove</button> <button type="button" class="cn-link" data-cancel>Keep</button></span>`
|
|
49
|
-
: ` · <button type="button" class="cn-link" data-ask-remove="${esc(c.id)}">Manage</button>`)
|
|
50
|
-
: ''
|
|
51
|
-
return `<div class="cn-card${c.status === 'active' && c.who === 'all' ? '' : ' off'}">${logoHtml(c)}<div class="cn-t"><b>${esc(c.name)}</b><small>${esc(what)}</small></div>${sw}
|
|
52
|
-
<div class="cn-where">${chips.map((x) => `<span>${esc(x)}</span>`).join('')}</div><div class="cn-by">Connected by ${esc(by)}${page ? pageManage : ` · ${esc(ago(c.createdAt))}${manage}`}</div></div>`
|
|
47
|
+
return `<div class="kl-card conn${c.status === 'active' && c.who === 'all' ? '' : ' off'}">${logoHtml(c)}<div class="kl-t"><b>${esc(c.name)}</b><small>${esc(what)}</small></div><div class="kl-r">${sw}${manage}</div></div>`
|
|
53
48
|
}
|
|
54
|
-
|
|
55
|
-
// An app to add (dm06's catalog): its logo, name and what it is, how you sign in, and Connect.
|
|
56
|
-
const HOW = { oneclick: 'Sign in with one click', key: 'Uses your own API key', none: 'No sign-in needed' }
|
|
57
|
-
function appCardHtml (a, connected) {
|
|
49
|
+
function appHtml (a, connected) {
|
|
58
50
|
const busy = ui.busy === a.slug
|
|
59
51
|
const act = a.how === 'none'
|
|
60
|
-
? '<span class="
|
|
61
|
-
: `<button type="button" class="
|
|
62
|
-
return `<div class="
|
|
63
|
-
<div class="cn-af"><span class="cn-how ${esc(a.how)}">${esc(HOW[a.how] || '')}</span>${act}</div></div>`
|
|
52
|
+
? '<span class="kl-ready">Ready to use</span>'
|
|
53
|
+
: `<button type="button" class="kl-act" data-connect="${esc(a.slug)}"${busy ? ' disabled' : ''}>${busy ? 'Opening…' : connected ? 'Add another' : 'Connect'}</button>`
|
|
54
|
+
return `<div class="kl-card">${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>`
|
|
64
55
|
}
|
|
65
56
|
|
|
66
57
|
function callsHtml () {
|
|
@@ -80,19 +71,21 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
80
71
|
const ownApps = new Set(own.map((c) => c.app))
|
|
81
72
|
const apps = ui.apps || []
|
|
82
73
|
const left = ui.total - apps.length
|
|
83
|
-
|
|
74
|
+
// Apps already connected here are in Connected above, not again in the list (unless you search for one).
|
|
75
|
+
const shown = ui.search ? apps : apps.filter((a) => !ownApps.has(a.slug))
|
|
84
76
|
const count = own.filter((c) => c.status === 'active').length + inherited.length
|
|
85
77
|
const lead = page
|
|
86
78
|
? (type === 'workspace' ? 'Apps your sessions and their AIs can use, connected once for the whole workspace through Composio' : 'Apps this session and its AIs can use, connected through Composio')
|
|
87
79
|
: `Apps ${esc(LEVEL[type] || type)}’s AIs can use. They read at once and ask a person before they send, change or delete anything; each sign-in stays with Composio, never in Quilt.`
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
${own.length || inherited.length ? `<div class="
|
|
92
|
-
${view.canManage ? `<section class="
|
|
93
|
-
<
|
|
94
|
-
${ui.
|
|
95
|
-
|
|
80
|
+
const groupName = ui.group ? (ui.groups.find((g) => g.id === ui.group) || { name: ui.group }).name : 'Recommended'
|
|
81
|
+
root.innerHTML = `<div class="cn kl${page ? ' cn-page' : ''}">
|
|
82
|
+
<header class="kl-h">${page ? '<h2>Connections</h2>' : '<h3>Connections</h3>'}<p>${lead}</p></header>
|
|
83
|
+
${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>` : ''}
|
|
84
|
+
${view.canManage ? `<section class="kl-sec" id="cn-catalog">
|
|
85
|
+
<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>
|
|
86
|
+
${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>` : ''}
|
|
87
|
+
<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>
|
|
88
|
+
${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>`}
|
|
96
89
|
${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>` : ''}
|
|
97
90
|
</section>` : ''}
|
|
98
91
|
${callsHtml()}
|
|
@@ -119,16 +112,16 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
119
112
|
|
|
120
113
|
// A page of the catalog: the first (`more` false, after a new search or category) or the next one.
|
|
121
114
|
async function loadApps (more = false) {
|
|
122
|
-
const key = `${ui.search}|${ui.
|
|
115
|
+
const key = `${ui.search}|${ui.group}`
|
|
123
116
|
const offset = more ? (ui.apps || []).length : 0
|
|
124
117
|
if (more) { ui.loadingMore = true; draw() }
|
|
125
118
|
try {
|
|
126
|
-
const r = await api('GET', `/api/connections/apps?search=${encodeURIComponent(ui.search)}&
|
|
127
|
-
if (key !== `${ui.search}|${ui.
|
|
119
|
+
const r = await api('GET', `/api/connections/apps?search=${encodeURIComponent(ui.search)}&group=${encodeURIComponent(ui.group)}&offset=${offset}&limit=${PAGE}`)
|
|
120
|
+
if (key !== `${ui.search}|${ui.group}`) return
|
|
128
121
|
ui.apps = more ? [...(ui.apps || []), ...(r.apps || [])] : (r.apps || [])
|
|
129
122
|
ui.total = r.total ?? ui.apps.length
|
|
130
123
|
ui.all = r.all ?? ui.total
|
|
131
|
-
if (r.
|
|
124
|
+
if (r.groups && r.groups.length) ui.groups = r.groups
|
|
132
125
|
} catch (err) { if (!more) ui.apps = []; if (err.status !== 503) toast(err.message) }
|
|
133
126
|
ui.loadingMore = false
|
|
134
127
|
draw()
|
|
@@ -171,14 +164,10 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
171
164
|
load()
|
|
172
165
|
return
|
|
173
166
|
}
|
|
174
|
-
const
|
|
175
|
-
if (
|
|
167
|
+
const tab = e.target.closest('[data-group]')
|
|
168
|
+
if (tab) { ui.group = tab.dataset.group; ui.apps = null; draw(); loadApps(); return }
|
|
176
169
|
if (e.target.closest('[data-load-more]')) { loadApps(true); return }
|
|
177
|
-
|
|
178
|
-
if (e.target.closest('[data-add-focus]')) {
|
|
179
|
-
root.querySelector('#cn-catalog')?.scrollIntoView({ block: 'start', behavior: 'smooth' })
|
|
180
|
-
root.querySelector('[data-search]')?.focus()
|
|
181
|
-
}
|
|
170
|
+
|
|
182
171
|
})
|
|
183
172
|
|
|
184
173
|
draw()
|
package/src/ui-server.js
CHANGED
|
@@ -962,7 +962,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
962
962
|
const enc = (v) => encodeURIComponent(String(v))
|
|
963
963
|
return asAccount(async (token) => {
|
|
964
964
|
const c = secretsApi(token)
|
|
965
|
-
if (method === 'GET' && p === '/api/connections/apps') return apiCall(c, 'GET', `/v1/connections/apps?search=${enc(url.searchParams.get('search') || '')}&
|
|
965
|
+
if (method === 'GET' && p === '/api/connections/apps') return apiCall(c, 'GET', `/v1/connections/apps?search=${enc(url.searchParams.get('search') || '')}&group=${enc(url.searchParams.get('group') || '')}&offset=${enc(url.searchParams.get('offset') || '0')}&limit=${enc(url.searchParams.get('limit') || '48')}`)
|
|
966
966
|
const sc = p.match(/^\/api\/connections\/(org|workspace|session)\/([^/]+)(?:\/([0-9a-f-]{36}))?$/i)
|
|
967
967
|
if (sc && SECRET_SCOPE_ID[sc[1]].test(decodeURIComponent(sc[2]))) {
|
|
968
968
|
const base = `/v1/connections/${sc[1]}/${enc(decodeURIComponent(sc[2]))}`
|