heyquilt 0.3.157 → 0.3.159
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/composio.js +19 -1
- package/src/api/routes/connections.js +35 -10
- package/src/ui/app.css +55 -0
- package/src/ui/connections.js +87 -69
- package/src/ui-server.js +3 -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.159 — 2026-11-12
|
|
15
|
+
|
|
16
|
+
- **See what an app can do before you connect it.** Click an app on the Connections page and a row opens under it: all it says about itself, how you sign in, and what agents can do with it. What they read on their own and what asks someone first (anything that sends, creates, changes or deletes) are listed apart.
|
|
17
|
+
|
|
18
|
+
## 0.3.158 — 2026-11-12
|
|
19
|
+
|
|
20
|
+
- **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**.
|
|
21
|
+
|
|
14
22
|
## 0.3.157 — 2026-11-12
|
|
15
23
|
|
|
16
24
|
- **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.
|
package/package.json
CHANGED
package/src/api/composio.js
CHANGED
|
@@ -124,6 +124,24 @@ export function composioClient ({ apiKey = '', base = COMPOSIO_API, fetch: fetch
|
|
|
124
124
|
return (r.items || []).filter((t) => !t.is_deprecated).map(toolView)
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
// What an app lets agents do, for its card on the Connections page, cached CATALOG_MS: up to 100 of its actions
|
|
128
|
+
// (the ones Composio marks important first, none deprecated), and how many it has in all.
|
|
129
|
+
const actionsCache = new Map()
|
|
130
|
+
async function appActions (app) {
|
|
131
|
+
const hit = actionsCache.get(app)
|
|
132
|
+
if (hit && Date.now() - hit.at < CATALOG_MS) return hit.value
|
|
133
|
+
const r = await call('GET', `/tools${q({ toolkit_slug: app, limit: 100 })}`)
|
|
134
|
+
const total = r.total_items
|
|
135
|
+
const live = (r.items || []).filter((t) => !t.is_deprecated && !/deprecated/i.test(`${t.name} ${String(t.description || '').slice(0, 40)}`))
|
|
136
|
+
// The ones Composio marks important first, then the rest as it lists them.
|
|
137
|
+
const important = (t) => ((t.tags || []).includes('important') ? 0 : 1)
|
|
138
|
+
const actions = live.map((t, i) => ({ t, i })).sort((x, y) => important(x.t) - important(y.t) || x.i - y.i).map(({ t }) => toolView(t))
|
|
139
|
+
.map((t) => ({ slug: t.slug, name: t.name, description: t.description.split(/(?<=\.)\s/)[0].slice(0, 200), readOnly: t.readOnly }))
|
|
140
|
+
const value = { actions, total: Number(total) || actions.length }
|
|
141
|
+
actionsCache.set(app, { at: Date.now(), value })
|
|
142
|
+
return value
|
|
143
|
+
}
|
|
144
|
+
|
|
127
145
|
async function tool (slug) {
|
|
128
146
|
return toolView(await call('GET', `/tools/${encodeURIComponent(slug)}`))
|
|
129
147
|
}
|
|
@@ -169,5 +187,5 @@ export function composioClient ({ apiKey = '', base = COMPOSIO_API, fetch: fetch
|
|
|
169
187
|
return { ok: r.successful !== false && !r.error, data: r.data ?? null, error: r.error || null }
|
|
170
188
|
}
|
|
171
189
|
|
|
172
|
-
return { on: !!apiKey, toolkits, catalog, toolkit, tools, tool, link, account, remove, execute }
|
|
190
|
+
return { on: !!apiKey, toolkits, catalog, toolkit, tools, tool, appActions, link, account, remove, execute }
|
|
173
191
|
}
|
|
@@ -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,12 +221,21 @@ 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
|
})
|
|
212
228
|
}],
|
|
213
229
|
|
|
230
|
+
// One app's card opened on the Connections page: what it is, how one signs in, and what agents can do with it.
|
|
231
|
+
['GET', /^\/v1\/connections\/apps\/([a-z0-9_-]{1,80})$/, async (req, body, params) => {
|
|
232
|
+
await whoCalls(req)
|
|
233
|
+
const slug = params[0]
|
|
234
|
+
const app = (await composio.catalog()).find((a) => a.slug === slug)
|
|
235
|
+
if (!app) throw new HttpError(404, 'No such app.')
|
|
236
|
+
return { app, ...(await composio.appActions(slug)) }
|
|
237
|
+
}],
|
|
238
|
+
|
|
214
239
|
// Composio sends the browser back here once someone signed in (or gave up).
|
|
215
240
|
['GET', /^\/v1\/connections\/done$/, async (req, body, params, url) => {
|
|
216
241
|
const u = url || new URL(req.url, 'http://x')
|
package/src/ui/app.css
CHANGED
|
@@ -3620,3 +3620,58 @@ button.sh-repo:hover { color: var(--text); }
|
|
|
3620
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
3621
|
.cn-detail .btn { flex: none; height: 36px; }
|
|
3622
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)); }
|
|
3658
|
+
|
|
3659
|
+
/* An opened app card and its row underneath: what it is, how you sign in, and what agents can do with it */
|
|
3660
|
+
.kl-card[data-open] { cursor: pointer; }
|
|
3661
|
+
.kl-card.open { border-color: var(--text); }
|
|
3662
|
+
.kl-card[data-open]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
3663
|
+
.kl-detail { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 16px; padding: 22px 24px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--panel); animation: kl-open .18s ease-out; }
|
|
3664
|
+
@keyframes kl-open { from { opacity: 0; transform: translateY(-4px); } }
|
|
3665
|
+
@media (prefers-reduced-motion: reduce) { .kl-detail { animation: none; } }
|
|
3666
|
+
.kl-dh { display: flex; align-items: center; gap: 16px; }
|
|
3667
|
+
.kl-dh .cn-logo { width: 48px; height: 48px; padding: 0; border-radius: 10px; background: none; box-shadow: none; object-fit: contain; flex: none; }
|
|
3668
|
+
.kl-dh > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; } .kl-dh b { font-size: 18px; font-weight: 600; } .kl-dh small { font-size: 13px; color: var(--muted); }
|
|
3669
|
+
.kl-dh .btn { height: 36px; flex: none; }
|
|
3670
|
+
.kl-x { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border: 0; border-radius: 8px; background: none; color: var(--faint); cursor: pointer; } .kl-x:hover { background: var(--panel-2); color: var(--text); } .kl-x svg { width: 16px; height: 16px; }
|
|
3671
|
+
.kl-ddesc { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text); }
|
|
3672
|
+
.kl-dcols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; padding-top: 16px; border-top: 1px solid var(--border); }
|
|
3673
|
+
.kl-dcols h4 { margin: 0; font-size: 13.5px; font-weight: 600; } .kl-dcols h4 i { font-style: normal; font-weight: 500; color: var(--faint); margin-left: 4px; }
|
|
3674
|
+
.kl-dnote { margin: 4px 0 0; font-size: 12.5px; color: var(--faint); line-height: 1.5; }
|
|
3675
|
+
.kl-dcols ul { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
|
|
3676
|
+
.kl-dcols li { display: flex; flex-direction: column; gap: 2px; } .kl-dcols li b { font-size: 13.5px; font-weight: 500; } .kl-dcols li small { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
|
|
3677
|
+
@media (max-width: 760px) { .kl-dcols { grid-template-columns: 1fr; } }
|
package/src/ui/connections.js
CHANGED
|
@@ -2,13 +2,12 @@
|
|
|
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 } from './common.js'
|
|
5
|
+
import { api, esc, toast, ago, I, loadingNote } 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
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,46 +21,69 @@ 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: '', open: null, loadingMore: false, busy: '', error: '', calls: null, confirm: null }
|
|
25
|
+
const details = new Map() // app slug -> { actions, total } or { error }, for its opened card
|
|
26
26
|
let view = views.get(`${type}:${id}`) || null
|
|
27
27
|
let alive = true
|
|
28
28
|
let poll = null
|
|
29
29
|
let searchTimer = null
|
|
30
30
|
|
|
31
|
-
// The
|
|
31
|
+
// The page as Kylon lays theirs out (Daniel, 2026-11-12): two columns of roomy cards, a logo, the name and what it
|
|
32
|
+
// is, and the action on the right. A connected app's card says where it reaches and has its switch and Manage.
|
|
33
|
+
const HOW = { oneclick: 'one-click sign-in', key: 'your API key', none: 'no sign-in' }
|
|
32
34
|
function cardHtml (c, own) {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const where = own ? (type === 'workspace' ? (sessions.length ? sessions.join(', ') : 'every session') : (sessions[0] || LEVEL[type])) : `${LEVEL[c.level] || c.level}${c.levelName ? ` (${c.levelName})` : ''}`
|
|
36
|
+
const by = me && c.by === me ? 'you' : c.by
|
|
37
|
+
const what = c.status === 'pending' ? 'Waiting for you to sign in, in your browser.'
|
|
38
|
+
: c.status === 'failed' ? 'Didn’t connect. Connect it again.'
|
|
39
|
+
: `${c.who === 'people' ? 'People and their own AIs can use it' : 'People and agents can use it'} in ${where}. Connected by ${by}.`
|
|
40
|
+
const sw = c.status === 'active'
|
|
41
|
+
? `<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
42
|
: `<span class="cn-state ${esc(c.status)}">${esc(STATUS[c.status] || c.status)}</span>`
|
|
38
43
|
const manage = own && c.mayChange
|
|
39
44
|
? (ui.confirm === c.id
|
|
40
|
-
?
|
|
41
|
-
:
|
|
45
|
+
? `<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>`
|
|
46
|
+
: `<button type="button" class="kl-act" data-ask-remove="${esc(c.id)}">Manage</button>`)
|
|
42
47
|
: ''
|
|
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>`
|
|
48
|
+
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
49
|
}
|
|
54
|
-
|
|
55
|
-
// The catalog as an icon grid (Daniel picked layout C, conn-options.html): a tile per app; the open one's
|
|
56
|
-
// details (what it is, how you sign in, Connect) open in a row under its row of tiles.
|
|
57
|
-
const HOW = { oneclick: 'Sign in with one click', key: 'Uses your own API key', none: 'No sign-in needed' }
|
|
58
|
-
const tileHtml = (a) => `<button type="button" class="cn-tile${ui.open === a.slug ? ' open' : ''}" data-tile="${esc(a.slug)}" aria-expanded="${ui.open === a.slug}" title="${esc(a.name)}">${logoHtml(a)}<b>${esc(a.name)}</b></button>`
|
|
59
|
-
function detailHtml (a, connected) {
|
|
50
|
+
function appHtml (a, connected) {
|
|
60
51
|
const busy = ui.busy === a.slug
|
|
61
52
|
const act = a.how === 'none'
|
|
62
|
-
? '<span class="
|
|
63
|
-
: `<button type="button" class="
|
|
64
|
-
return `<div class="
|
|
53
|
+
? '<span class="kl-ready">Ready to use</span>'
|
|
54
|
+
: `<button type="button" class="kl-act" data-connect="${esc(a.slug)}"${busy ? ' disabled' : ''}>${busy ? 'Opening…' : connected ? 'Add another' : 'Connect'}</button>`
|
|
55
|
+
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>`
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// An opened card's row under it (Daniel, 2026-11-12): all it says about itself, how you sign in, and what agents
|
|
59
|
+
// can do with it, split the way Quilt runs it: reads at once, anything that changes something asks a person first.
|
|
60
|
+
const SIGN_IN = { oneclick: 'Sign in with one click: Composio asks the app for you, and Quilt never sees the login.', key: 'Uses your own API key: Composio asks for it once, and keeps it.', none: 'No sign-in: agents can use it as it is.' }
|
|
61
|
+
function openRowHtml (a, connected) {
|
|
62
|
+
const d = details.get(a.slug)
|
|
63
|
+
const list = (xs) => xs.slice(0, 6).map((t) => `<li><b>${esc(t.name)}</b><small>${esc(t.description)}</small></li>`).join('')
|
|
64
|
+
const reads = d && !d.error ? d.actions.filter((t) => t.readOnly) : []
|
|
65
|
+
const changes = d && !d.error ? d.actions.filter((t) => !t.readOnly) : []
|
|
66
|
+
const busy = ui.busy === a.slug
|
|
67
|
+
const act = a.how === 'none' ? '<span class="kl-ready">Ready to use</span>' : `<button type="button" class="btn primary" data-connect="${esc(a.slug)}"${busy ? ' disabled' : ''}>${busy ? 'Opening…' : connected ? `Add another ${esc(a.name)}` : `Connect ${esc(a.name)}`}</button>`
|
|
68
|
+
const what = !d ? `<p class="hint">${loadingNote()}</p>`
|
|
69
|
+
: d.error ? `<p class="hint">${esc(d.error)}</p>`
|
|
70
|
+
: `<div class="kl-dcols">
|
|
71
|
+
<div><h4>Reads on its own <i>${reads.length}</i></h4><p class="kl-dnote">Agents use these at once.</p>${reads.length ? `<ul>${list(reads)}</ul>` : '<p class="hint">None among its main actions.</p>'}${reads.length > 6 ? `<p class="kl-dnote">and ${reads.length - 6} more</p>` : ''}</div>
|
|
72
|
+
<div><h4>Asks someone first <i>${changes.length}</i></h4><p class="kl-dnote">Sends, creates, changes or deletes: a card in the session's chat asks a person to approve each one.</p>${changes.length ? `<ul>${list(changes)}</ul>` : '<p class="hint">None among its main actions.</p>'}${changes.length > 6 ? `<p class="kl-dnote">and ${changes.length - 6} more</p>` : ''}</div>
|
|
73
|
+
</div>
|
|
74
|
+
${d.total > d.actions.length ? `<p class="kl-dnote">From ${d.actions.length} of its ${d.total.toLocaleString()} actions; agents find the rest when they need them.</p>` : ''}`
|
|
75
|
+
return `<div class="kl-detail" data-detail="${esc(a.slug)}">
|
|
76
|
+
<div class="kl-dh">${logoHtml(a)}<div><b>${esc(a.name)}</b><small>${esc(SIGN_IN[a.how] || '')}</small></div>${act}<button type="button" class="kl-x" data-close-open aria-label="Close">${I.x}</button></div>
|
|
77
|
+
${a.description ? `<p class="kl-ddesc">${esc(a.description)}</p>` : ''}
|
|
78
|
+
${what}
|
|
79
|
+
</div>`
|
|
80
|
+
}
|
|
81
|
+
async function openApp (slug) {
|
|
82
|
+
ui.open = ui.open === slug ? null : slug
|
|
83
|
+
draw()
|
|
84
|
+
if (!ui.open || details.has(slug)) return
|
|
85
|
+
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 }) }
|
|
86
|
+
if (ui.open === slug) draw()
|
|
65
87
|
}
|
|
66
88
|
|
|
67
89
|
function callsHtml () {
|
|
@@ -81,41 +103,32 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
81
103
|
const ownApps = new Set(own.map((c) => c.app))
|
|
82
104
|
const apps = ui.apps || []
|
|
83
105
|
const left = ui.total - apps.length
|
|
84
|
-
|
|
106
|
+
// Apps already connected here are in Connected above, not again in the list (unless you search for one).
|
|
107
|
+
const shown = ui.search ? apps : apps.filter((a) => !ownApps.has(a.slug))
|
|
85
108
|
const count = own.filter((c) => c.status === 'active').length + inherited.length
|
|
86
109
|
const lead = page
|
|
87
110
|
? (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')
|
|
88
111
|
: `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.`
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
${own.length || inherited.length ? `<div class="cn-grid">${own.map((c) => cardHtml(c, true)).join('')}${inherited.map((c) => cardHtml(c, false)).join('')}</div>` : ''}
|
|
99
|
-
${view.canManage ? `<section class="cn-cat" id="cn-catalog">
|
|
100
|
-
<div class="cn-hero">
|
|
101
|
-
<label class="cn-bigsrc">${SEARCH_ICON}<input data-search placeholder="Search ${ui.all ? ui.all.toLocaleString() : 'thousands of'} apps to connect" value="${esc(ui.search)}" aria-label="Search apps to connect"></label>
|
|
102
|
-
${ui.categories.length && !ui.search ? `<div class="cn-tabs" role="tablist" aria-label="Categories">
|
|
103
|
-
<button type="button" class="cn-tab${ui.cat ? '' : ' on'}" role="tab" aria-selected="${!ui.cat}" data-cat="">Popular</button>
|
|
104
|
-
${tabs.map((c) => `<button type="button" class="cn-tab${ui.cat === c.id ? ' on' : ''}" role="tab" aria-selected="${ui.cat === c.id}" data-cat="${esc(c.id)}">${esc(cap(c.name))}</button>`).join('')}
|
|
105
|
-
${rest.length ? `<span class="cn-tabmore"><button type="button" class="cn-tab${inRest ? ' on' : ''}" data-cat-more aria-expanded="${!!ui.moreCats}">${inRest ? esc(cap(inRest.name)) : 'More'} ${I.chevDown || '▾'}</button>${ui.moreCats ? `<span class="cn-tabmenu" role="menu">${rest.map((c) => `<button type="button" role="menuitem" data-cat="${esc(c.id)}">${esc(cap(c.name))}<i>${c.n}</i></button>`).join('')}</span>` : ''}</span>` : ''}
|
|
106
|
-
</div>` : ui.search ? `<p class="cn-found">${ui.apps === null ? 'Looking…' : `${ui.total.toLocaleString()} app${ui.total === 1 ? '' : 's'} match “${esc(ui.search)}”`}</p>` : ''}
|
|
107
|
-
</div>
|
|
108
|
-
${ui.apps === null ? '<p class="hint cn-none">Loading apps…</p>' : shown.length ? `<div class="cn-tiles">${shown.map(tileHtml).join('')}</div>` : `<p class="hint cn-none">No app matches${ui.search ? ` “${esc(ui.search)}”` : ''}${catName ? ` in ${esc(catName)}` : ''}.</p>`}
|
|
112
|
+
const groupName = ui.group ? (ui.groups.find((g) => g.id === ui.group) || { name: ui.group }).name : 'Recommended'
|
|
113
|
+
root.innerHTML = `<div class="cn kl${page ? ' cn-page' : ''}">
|
|
114
|
+
<header class="kl-h">${page ? '<h2>Connections</h2>' : '<h3>Connections</h3>'}<p>${lead}</p></header>
|
|
115
|
+
${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>` : ''}
|
|
116
|
+
${view.canManage ? `<section class="kl-sec" id="cn-catalog">
|
|
117
|
+
<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>
|
|
118
|
+
${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>` : ''}
|
|
119
|
+
<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>
|
|
120
|
+
${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>`}
|
|
109
121
|
${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>` : ''}
|
|
110
122
|
</section>` : ''}
|
|
111
123
|
${callsHtml()}
|
|
112
124
|
</div>`
|
|
113
|
-
// The open
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
125
|
+
// The open card's row goes after the last card of its row, across both columns.
|
|
126
|
+
const opened = ui.open && root.querySelector(`.kl-card[data-open="${CSS.escape(ui.open)}"]`)
|
|
127
|
+
const openApp_ = ui.open && shown.find((a) => a.slug === ui.open)
|
|
128
|
+
if (opened && openApp_) {
|
|
129
|
+
let end = opened
|
|
130
|
+
while (end.nextElementSibling && end.nextElementSibling.offsetTop === opened.offsetTop) end = end.nextElementSibling
|
|
131
|
+
end.insertAdjacentHTML('afterend', openRowHtml(openApp_, ownApps.has(openApp_.slug)))
|
|
119
132
|
}
|
|
120
133
|
if (had) { const s = root.querySelector('[data-search]'); s.focus(); s.setSelectionRange(s.value.length, s.value.length) }
|
|
121
134
|
}
|
|
@@ -139,16 +152,16 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
139
152
|
|
|
140
153
|
// A page of the catalog: the first (`more` false, after a new search or category) or the next one.
|
|
141
154
|
async function loadApps (more = false) {
|
|
142
|
-
const key = `${ui.search}|${ui.
|
|
155
|
+
const key = `${ui.search}|${ui.group}`
|
|
143
156
|
const offset = more ? (ui.apps || []).length : 0
|
|
144
157
|
if (more) { ui.loadingMore = true; draw() }
|
|
145
158
|
try {
|
|
146
|
-
const r = await api('GET', `/api/connections/apps?search=${encodeURIComponent(ui.search)}&
|
|
147
|
-
if (key !== `${ui.search}|${ui.
|
|
159
|
+
const r = await api('GET', `/api/connections/apps?search=${encodeURIComponent(ui.search)}&group=${encodeURIComponent(ui.group)}&offset=${offset}&limit=${PAGE}`)
|
|
160
|
+
if (key !== `${ui.search}|${ui.group}`) return
|
|
148
161
|
ui.apps = more ? [...(ui.apps || []), ...(r.apps || [])] : (r.apps || [])
|
|
149
162
|
ui.total = r.total ?? ui.apps.length
|
|
150
163
|
ui.all = r.all ?? ui.total
|
|
151
|
-
if (r.
|
|
164
|
+
if (r.groups && r.groups.length) ui.groups = r.groups
|
|
152
165
|
} catch (err) { if (!more) ui.apps = []; if (err.status !== 503) toast(err.message) }
|
|
153
166
|
ui.loadingMore = false
|
|
154
167
|
draw()
|
|
@@ -162,6 +175,15 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
162
175
|
searchTimer = setTimeout(loadApps, 250)
|
|
163
176
|
})
|
|
164
177
|
|
|
178
|
+
root.addEventListener('keydown', (e) => {
|
|
179
|
+
const card = e.target.matches && e.target.matches('[data-open]') ? e.target : null
|
|
180
|
+
if (card && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); openApp(card.dataset.open) }
|
|
181
|
+
if (e.key === 'Escape' && ui.open) { ui.open = null; draw() }
|
|
182
|
+
})
|
|
183
|
+
// A resize moves cards between rows: the open one's row moves with it.
|
|
184
|
+
const onResize = () => { if (ui.open) draw() }
|
|
185
|
+
window.addEventListener('resize', onResize)
|
|
186
|
+
|
|
165
187
|
root.addEventListener('change', async (e) => {
|
|
166
188
|
const t = e.target.closest('[data-who-toggle]')
|
|
167
189
|
if (!t) return
|
|
@@ -192,19 +214,15 @@ export function mountConnections (root, { type, id, page = false, sessions = [],
|
|
|
192
214
|
load()
|
|
193
215
|
return
|
|
194
216
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
if (e.target.closest('
|
|
198
|
-
const
|
|
199
|
-
if (
|
|
200
|
-
if (ui.moreCats && !e.target.closest('.cn-tabmenu')) { ui.moreCats = false; draw() }
|
|
217
|
+
if (e.target.closest('[data-close-open]')) { ui.open = null; draw(); return }
|
|
218
|
+
const card = e.target.closest('[data-open]')
|
|
219
|
+
if (card && !e.target.closest('button, a, input, label')) { openApp(card.dataset.open); return }
|
|
220
|
+
const tab = e.target.closest('[data-group]')
|
|
221
|
+
if (tab) { ui.group = tab.dataset.group; ui.open = null; ui.apps = null; draw(); loadApps(); return }
|
|
201
222
|
if (e.target.closest('[data-load-more]')) { loadApps(true); return }
|
|
202
223
|
|
|
203
224
|
})
|
|
204
225
|
|
|
205
|
-
// A resize moves tiles between rows: the open one's details move with it.
|
|
206
|
-
const onResize = () => { if (ui.open) draw() }
|
|
207
|
-
window.addEventListener('resize', onResize)
|
|
208
226
|
draw()
|
|
209
227
|
load()
|
|
210
228
|
loadApps()
|
package/src/ui-server.js
CHANGED
|
@@ -962,7 +962,9 @@ 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
|
-
|
|
965
|
+
const oneApp = p.match(/^\/api\/connections\/apps\/([a-z0-9_-]{1,80})$/)
|
|
966
|
+
if (method === 'GET' && oneApp) return apiCall(c, 'GET', `/v1/connections/apps/${oneApp[1]}`)
|
|
967
|
+
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
968
|
const sc = p.match(/^\/api\/connections\/(org|workspace|session)\/([^/]+)(?:\/([0-9a-f-]{36}))?$/i)
|
|
967
969
|
if (sc && SECRET_SCOPE_ID[sc[1]].test(decodeURIComponent(sc[2]))) {
|
|
968
970
|
const base = `/v1/connections/${sc[1]}/${enc(decodeURIComponent(sc[2]))}`
|