heyquilt 0.3.165 → 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 +10 -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 -744
- 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/RELEASES.md
CHANGED
|
@@ -11,6 +11,16 @@ 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.167 — 2026-11-13
|
|
15
|
+
|
|
16
|
+
- **Downloading Quilt says how to open it.** Clicking a download button on heyquilt.com now shows, right under it, the steps for your computer: on a Mac, where to click **Open Anyway** the first time (Quilt isn't notarized by Apple while it's in beta); on Windows, **More info → Run anyway**; then signing in. heyquilt.com/download is a page of its own with the same steps.
|
|
17
|
+
- **Creating an account from the app comes back to the app.** **Create an account** on the sign-in screen now signs this computer in once your account is made, instead of leaving you on the website.
|
|
18
|
+
- **A fresh install opens on sign-in, not the release notes.** "What's new" shows after an update, not the first time you open Quilt.
|
|
19
|
+
|
|
20
|
+
## 0.3.166 — 2026-11-13
|
|
21
|
+
|
|
22
|
+
- **The previous design is back.** The session sidebar, chat and tabs, Connections and the rest of the app are as they were before the redesign that started in 0.3.155. App connections through Composio stay.
|
|
23
|
+
|
|
14
24
|
## 0.3.165 — 2026-11-13
|
|
15
25
|
|
|
16
26
|
- **Chat header lines up**: the chat panel's header is now the same height as the session bar beside it, so their bottom lines meet.
|
package/package.json
CHANGED
package/src/api/audit.js
CHANGED
|
@@ -43,7 +43,6 @@ export function endReasonOf (v, revokedAt) {
|
|
|
43
43
|
export function auditTrail ({ visits, actions, revoked = new Map(), appCalls = [] }) {
|
|
44
44
|
const byVisit = new Map()
|
|
45
45
|
for (const a of actions) {
|
|
46
|
-
if (a.action === 'ai') continue // a minute of AI work: the workspace's AI time, not something the member did
|
|
47
46
|
if (!byVisit.has(a.visitStartId)) byVisit.set(a.visitStartId, [])
|
|
48
47
|
byVisit.get(a.visitStartId).push({ at: a.at, action: a.action, target: a.target || '' })
|
|
49
48
|
}
|
package/src/api/composio.js
CHANGED
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
import { HttpError } from './http.js'
|
|
6
6
|
|
|
7
7
|
export const COMPOSIO_API = 'https://backend.composio.dev/api/v3.1'
|
|
8
|
-
// How long the app catalog (1,700+ apps, a few pages from Composio) is kept before it's fetched again.
|
|
9
|
-
export const CATALOG_MS = 6 * 60 * 60 * 1000
|
|
10
8
|
|
|
11
9
|
// Composio tags each action with what it does; only reads run without a person's approval.
|
|
12
10
|
export const READ_TAG = 'readOnlyHint'
|
|
@@ -65,17 +63,6 @@ export function composioClient ({ apiKey = '', base = COMPOSIO_API, fetch: fetch
|
|
|
65
63
|
noAuth: !!t.no_auth
|
|
66
64
|
})
|
|
67
65
|
|
|
68
|
-
/**
|
|
69
|
-
* An app in the catalog: appView with its categories and how one connects it (`how`: 'oneclick', Composio's own
|
|
70
|
-
* sign-in; 'key', the person's own API key or token; 'none', no sign-in), or how '' when it needs an OAuth app of ours.
|
|
71
|
-
*/
|
|
72
|
-
const catalogView = (t) => {
|
|
73
|
-
const a = appView(t)
|
|
74
|
-
const how = a.noAuth ? 'none' : a.managed ? 'oneclick' : a.schemes.some((x) => !/^OAUTH[12]$/.test(x)) ? 'key' : ''
|
|
75
|
-
const categories = ((t.meta && t.meta.categories) || []).map((c) => ({ id: String(c.id || c.slug || c.name || c), name: String(c.name || c.id || c) })).filter((c) => c.id)
|
|
76
|
-
return { ...a, how, categories }
|
|
77
|
-
}
|
|
78
|
-
|
|
79
66
|
/** An action as agents see it: { slug, name, description, app, readOnly, input }. */
|
|
80
67
|
const toolView = (t) => ({
|
|
81
68
|
slug: t.slug,
|
|
@@ -93,27 +80,6 @@ export function composioClient ({ apiKey = '', base = COMPOSIO_API, fetch: fetch
|
|
|
93
80
|
return (r.items || []).filter((t) => !t.deprecated || !t.deprecated.is_deprecated).map(appView)
|
|
94
81
|
}
|
|
95
82
|
|
|
96
|
-
// The whole catalog, cached CATALOG_MS: every app that can be connected without an OAuth app of our own (one-click
|
|
97
|
-
// sign-in through Composio, the person's own API key or token, or none at all), most used first.
|
|
98
|
-
let catalogCache = { at: 0, apps: null, pending: null }
|
|
99
|
-
async function catalog () {
|
|
100
|
-
if (catalogCache.apps && Date.now() - catalogCache.at < CATALOG_MS) return catalogCache.apps
|
|
101
|
-
if (catalogCache.pending) return catalogCache.pending
|
|
102
|
-
catalogCache.pending = (async () => {
|
|
103
|
-
const items = []
|
|
104
|
-
let cursor = ''
|
|
105
|
-
do {
|
|
106
|
-
const r = await call('GET', `/toolkits${q({ sort_by: 'usage', limit: 1000, cursor })}`)
|
|
107
|
-
items.push(...(r.items || []))
|
|
108
|
-
cursor = r.next_cursor || ''
|
|
109
|
-
} while (cursor && items.length < 5000)
|
|
110
|
-
const apps = items.filter((t) => !t.deprecated || !t.deprecated.is_deprecated).map(catalogView).filter((a) => a.how && a.slug !== 'composio')
|
|
111
|
-
catalogCache = { at: Date.now(), apps, pending: null }
|
|
112
|
-
return apps
|
|
113
|
-
})().catch((err) => { catalogCache.pending = null; throw err })
|
|
114
|
-
return catalogCache.pending
|
|
115
|
-
}
|
|
116
|
-
|
|
117
83
|
async function toolkit (slug) {
|
|
118
84
|
return appView(await call('GET', `/toolkits/${encodeURIComponent(slug)}`))
|
|
119
85
|
}
|
|
@@ -124,35 +90,6 @@ export function composioClient ({ apiKey = '', base = COMPOSIO_API, fetch: fetch
|
|
|
124
90
|
return (r.items || []).filter((t) => !t.is_deprecated).map(toolView)
|
|
125
91
|
}
|
|
126
92
|
|
|
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
|
-
// A description cut to `n` characters at a word, with an ellipsis when it was cut.
|
|
131
|
-
const short = (text, n) => text.length <= n ? text : `${text.slice(0, n).replace(/\s+\S*$/, '')}…`
|
|
132
|
-
async function appActions (app, { all = false } = {}) {
|
|
133
|
-
const key = `${app}|${all ? 'all' : 'top'}`
|
|
134
|
-
const hit = actionsCache.get(key)
|
|
135
|
-
if (hit && Date.now() - hit.at < CATALOG_MS) return hit.value
|
|
136
|
-
// The app shows up to 100; its page on the website (all) every one, a page of 500 at a time.
|
|
137
|
-
const items = []
|
|
138
|
-
let cursor = ''
|
|
139
|
-
let total = 0
|
|
140
|
-
do {
|
|
141
|
-
const r = await call('GET', `/tools${q({ toolkit_slug: app, limit: all ? 500 : 100, cursor })}`)
|
|
142
|
-
items.push(...(r.items || []))
|
|
143
|
-
total = r.total_items ?? total
|
|
144
|
-
cursor = all ? (r.next_cursor || '') : ''
|
|
145
|
-
} while (cursor && items.length < 3000)
|
|
146
|
-
const live = items.filter((t) => !t.is_deprecated && !/deprecated/i.test(`${t.name} ${String(t.description || '').slice(0, 40)}`))
|
|
147
|
-
// The ones Composio marks important first, then the rest as it lists them.
|
|
148
|
-
const important = (t) => ((t.tags || []).includes('important') ? 0 : 1)
|
|
149
|
-
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))
|
|
150
|
-
.map((t) => ({ slug: t.slug, name: t.name, description: short(t.description.split(/(?<=\.)\s/)[0], 240), readOnly: t.readOnly }))
|
|
151
|
-
const value = { actions, total: Number(total) || actions.length }
|
|
152
|
-
actionsCache.set(key, { at: Date.now(), value })
|
|
153
|
-
return value
|
|
154
|
-
}
|
|
155
|
-
|
|
156
93
|
async function tool (slug) {
|
|
157
94
|
return toolView(await call('GET', `/tools/${encodeURIComponent(slug)}`))
|
|
158
95
|
}
|
|
@@ -198,5 +135,5 @@ export function composioClient ({ apiKey = '', base = COMPOSIO_API, fetch: fetch
|
|
|
198
135
|
return { ok: r.successful !== false && !r.error, data: r.data ?? null, error: r.error || null }
|
|
199
136
|
}
|
|
200
137
|
|
|
201
|
-
return { on: !!apiKey, toolkits,
|
|
138
|
+
return { on: !!apiKey, toolkits, toolkit, tools, tool, link, account, remove, execute }
|
|
202
139
|
}
|
package/src/api/memory-store.js
CHANGED
|
@@ -62,7 +62,6 @@ export function createMemoryStore ({ now = Date.now } = {}) {
|
|
|
62
62
|
const secretTickets = new Map(); const secretRuns = new Map(); const secretAsks = new Map(); const secretUses = []
|
|
63
63
|
// App connections (20261112000000_app_connections.sql).
|
|
64
64
|
const appConnections = new Map(); const appCalls = new Map()
|
|
65
|
-
const workspaceLinks = new Map() // 20261112100000_workspace_home.sql
|
|
66
65
|
const scopeKey = (scopeType, scopeId) => `${scopeType}\n${scopeId}`
|
|
67
66
|
// A secret as the API's routes see it: never its sealed value (secretSealed reads that, for the vault).
|
|
68
67
|
const secretMeta = (r) => { if (!r) return null; const { sealedValue, ...rest } = copy(r); return rest }
|
|
@@ -580,12 +579,6 @@ export function createMemoryStore ({ now = Date.now } = {}) {
|
|
|
580
579
|
},
|
|
581
580
|
// Mirrors prune_activity.
|
|
582
581
|
// What was done in a session in [from, to), oldest first, at most `limit` (actions_in_room).
|
|
583
|
-
async aiMinutes (rooms, since) {
|
|
584
|
-
return all(actions, (a) => a.action === 'ai' && rooms.includes(a.room) && a.at >= since).sort((a, b) => a.at - b.at).map((a) => ({ room: a.room, account: a.account, at: a.at }))
|
|
585
|
-
},
|
|
586
|
-
async listWorkspaceLinks (workspaceId) { return all(workspaceLinks, (l) => l.workspaceId === workspaceId).sort((a, b) => a.createdAt - b.createdAt).map(copy) },
|
|
587
|
-
async addWorkspaceLink (l) { const row = { id: uuid(), room: null, note: '', ...copy(l), createdAt: now() }; workspaceLinks.set(row.id, row); return copy(row) },
|
|
588
|
-
async deleteWorkspaceLink (workspaceId, id) { const l = workspaceLinks.get(id); if (l && l.workspaceId === workspaceId) workspaceLinks.delete(id) },
|
|
589
582
|
async actionsInRoom (room, { from, to, limit }) {
|
|
590
583
|
return all(actions, (a) => a.room === room && a.at >= from && a.at < to)
|
|
591
584
|
.sort((a, b) => a.at - b.at).slice(0, limit).map(copy) // stable: ties keep arrival order
|
|
@@ -25,52 +25,6 @@ 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
|
-
/** The names of the tabs an app is under, for its page on the website. */
|
|
38
|
-
export const groupNames = (a) => groupsOf(a).map((id) => (APP_GROUPS.find((g) => g.id === id) || { name: 'Other' }).name)
|
|
39
|
-
const groupsOf = (a) => {
|
|
40
|
-
const ids = a.categories.map((c) => c.id)
|
|
41
|
-
const in_ = APP_GROUPS.filter((g) => g.cats.some((c) => ids.includes(c))).map((g) => g.id)
|
|
42
|
-
return in_.length ? in_ : ['other']
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* A page of the catalog for the Connections page: { apps, total, all, groups }. `group`: one of APP_GROUPS (or
|
|
47
|
-
* 'other'), '' for every app. A search matches names first, then descriptions and categories, across every group.
|
|
48
|
-
* `groups`: each tab with how many apps it has.
|
|
49
|
-
*/
|
|
50
|
-
export function pickApps (all, { search = '', group = '', offset = 0, limit = 48 }) {
|
|
51
|
-
const words = String(search).toLowerCase().trim().slice(0, 100).split(/\s+/).filter(Boolean)
|
|
52
|
-
let list = group && !words.length ? all.filter((a) => groupsOf(a).includes(group)) : all
|
|
53
|
-
if (words.length) {
|
|
54
|
-
const score = (a) => {
|
|
55
|
-
const name = a.name.toLowerCase()
|
|
56
|
-
const rest = `${a.slug} ${a.description} ${a.categories.map((c) => c.name).join(' ')}`.toLowerCase()
|
|
57
|
-
if (!words.every((w) => name.includes(w) || rest.includes(w))) return 0
|
|
58
|
-
return words.every((w) => name.includes(w)) ? (name.startsWith(words[0]) ? 3 : 2) : 1
|
|
59
|
-
}
|
|
60
|
-
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)
|
|
61
|
-
}
|
|
62
|
-
const n = new Map()
|
|
63
|
-
for (const a of all) for (const g of groupsOf(a)) n.set(g, (n.get(g) || 0) + 1)
|
|
64
|
-
const from = Math.max(0, offset)
|
|
65
|
-
const size = Math.min(200, Math.max(1, limit))
|
|
66
|
-
return {
|
|
67
|
-
apps: list.slice(from, from + size),
|
|
68
|
-
total: list.length,
|
|
69
|
-
all: all.length,
|
|
70
|
-
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 }]
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
28
|
export function argsLine (args, max = 400) {
|
|
75
29
|
const s = JSON.stringify(args || {})
|
|
76
30
|
return s.length > max ? `${s.slice(0, max)}…` : s
|
|
@@ -221,38 +175,7 @@ export function connectionRoutes (ctx) {
|
|
|
221
175
|
['GET', /^\/v1\/connections\/apps$/, async (req, body, params, url) => {
|
|
222
176
|
await whoCalls(req)
|
|
223
177
|
const u = url || new URL(req.url, 'http://x')
|
|
224
|
-
return
|
|
225
|
-
search: u.searchParams.get('search') || '',
|
|
226
|
-
group: u.searchParams.get('group') || '',
|
|
227
|
-
offset: Number(u.searchParams.get('offset')) || 0,
|
|
228
|
-
limit: Number(u.searchParams.get('limit')) || 48
|
|
229
|
-
})
|
|
230
|
-
}],
|
|
231
|
-
|
|
232
|
-
// The website's integrations pages (heyquilt.com/integrations): the catalog and one app with every action. Public,
|
|
233
|
-
// no sign-in: it is Composio's public catalog, without anyone's connections.
|
|
234
|
-
['GET', /^\/v1\/integrations$/, async (req, body, params, url) => {
|
|
235
|
-
const u = url || new URL(req.url, 'http://x')
|
|
236
|
-
return pickApps(await composio.catalog(), {
|
|
237
|
-
search: u.searchParams.get('search') || '',
|
|
238
|
-
group: u.searchParams.get('group') || '',
|
|
239
|
-
offset: Number(u.searchParams.get('offset')) || 0,
|
|
240
|
-
limit: Number(u.searchParams.get('limit')) || 48
|
|
241
|
-
})
|
|
242
|
-
}],
|
|
243
|
-
['GET', /^\/v1\/integrations\/([a-z0-9_-]{1,80})$/, async (req, body, params) => {
|
|
244
|
-
const app = (await composio.catalog()).find((a) => a.slug === params[0])
|
|
245
|
-
if (!app) throw new HttpError(404, 'No such app.')
|
|
246
|
-
return { app, groups: groupNames(app), ...(await composio.appActions(app.slug, { all: true })) }
|
|
247
|
-
}],
|
|
248
|
-
|
|
249
|
-
// One app's card opened on the Connections page: what it is, how one signs in, and what agents can do with it.
|
|
250
|
-
['GET', /^\/v1\/connections\/apps\/([a-z0-9_-]{1,80})$/, async (req, body, params) => {
|
|
251
|
-
await whoCalls(req)
|
|
252
|
-
const slug = params[0]
|
|
253
|
-
const app = (await composio.catalog()).find((a) => a.slug === slug)
|
|
254
|
-
if (!app) throw new HttpError(404, 'No such app.')
|
|
255
|
-
return { app, ...(await composio.appActions(slug)) }
|
|
178
|
+
return { apps: await composio.toolkits({ search: u.searchParams.get('search') || '', limit: Number(u.searchParams.get('limit')) || 60 }) }
|
|
256
179
|
}],
|
|
257
180
|
|
|
258
181
|
// Composio sends the browser back here once someone signed in (or gave up).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Workspaces: a container owned by a person or an org, holding sessions and members.
|
|
2
2
|
// Behind the QUILT_WORKSPACES flag (startApi({ workspaces })): off, every route answers 404.
|
|
3
|
-
import { HttpError, cleanName
|
|
3
|
+
import { HttpError, cleanName } from '../http.js'
|
|
4
4
|
import { orgAccess } from '../org-access.js'
|
|
5
5
|
import { workspaceAccess, cleanColor, cleanDescription, cleanAccess, autoColor } from '../workspace-access.js'
|
|
6
6
|
import { workspaceReach, canSeeFiles } from '../workspace-reach.js'
|
|
@@ -14,10 +14,6 @@ const ROOM = /^[A-Za-z0-9_-]{1,64}$/
|
|
|
14
14
|
const ACCOUNT = /^(person|agent):[A-Za-z0-9_-]{1,64}$/
|
|
15
15
|
const OPEN_MS = 10 * 60 * 1000
|
|
16
16
|
|
|
17
|
-
const DAY_MS = 24 * 60 * 60 * 1000
|
|
18
|
-
const HOUR_MS = 60 * 60 * 1000
|
|
19
|
-
const linkView = (l) => ({ id: l.id, name: l.name, url: l.url, room: l.room || null, note: l.note || '', by: l.createdBy, at: l.createdAt })
|
|
20
|
-
|
|
21
17
|
export function workspaceRoutes (ctx) {
|
|
22
18
|
const { store, now, files: fileStore, workspaces = false, log = () => {}, policyChanged = null } = ctx
|
|
23
19
|
const { caller, grantsIn, reach } = workspaceReach(ctx)
|
|
@@ -137,7 +133,7 @@ export function workspaceRoutes (ctx) {
|
|
|
137
133
|
const sessions = (await store.listWorkspaceSessions(ws.id)).map((s) => sessionView(s, t))
|
|
138
134
|
const files = canSeeFiles(access) ? await listedFiles(store, await store.listWorkspaceFiles(ws.id)) : []
|
|
139
135
|
const agents = await workspaceAgents(store, ws, { admin: access.admin })
|
|
140
|
-
return { workspace: ws, access, canDelete, owner, members, agents, sessions, files, usage: await usageView(store, ws, ctx)
|
|
136
|
+
return { workspace: ws, access, canDelete, owner, members, agents, sessions, files, usage: await usageView(store, ws, ctx) }
|
|
141
137
|
}],
|
|
142
138
|
|
|
143
139
|
['PATCH', /^\/v1\/workspaces\/([^/]+)$/, async (req, body, [id]) => {
|
|
@@ -230,43 +226,7 @@ export function workspaceRoutes (ctx) {
|
|
|
230
226
|
await store.setSessionWorkspace(room, null, { linkedBy: null, at: now() })
|
|
231
227
|
if (policyChanged) policyChanged(room) // the workspace's rule no longer covers it
|
|
232
228
|
return { ok: true }
|
|
233
|
-
}]
|
|
234
|
-
|
|
235
|
-
// The workspace's home (plans/app-redesign.md): AI time per session, by the hour (each 'ai' action is a
|
|
236
|
-
// minute an AI worked: presence.js), for its charts; the app adds merges from Seam.
|
|
237
|
-
['GET', /^\/v1\/workspaces\/([^/]+)\/insights$/, async (req, body, [id], url) => {
|
|
238
|
-
const { ws } = await reach(req, id)
|
|
239
|
-
const days = Math.min(31, Math.max(1, Number((url || new URL(req.url, 'http://x')).searchParams.get('days')) || 14))
|
|
240
|
-
const t = now()
|
|
241
|
-
const sessions = await store.listWorkspaceSessions(ws.id)
|
|
242
|
-
const minutes = await store.aiMinutes(sessions.map((s) => s.room), t - days * DAY_MS)
|
|
243
|
-
const hours = new Map()
|
|
244
|
-
for (const m of minutes) {
|
|
245
|
-
const k = `${m.room}\n${Math.floor(m.at / HOUR_MS) * HOUR_MS}`
|
|
246
|
-
hours.set(k, (hours.get(k) || 0) + 1)
|
|
247
|
-
}
|
|
248
|
-
return { days, sessions: sessions.map((s) => ({ room: s.room, name: s.name || '' })), aiHours: [...hours].map(([k, n]) => { const [room, at] = k.split('\n'); return { room, at: Number(at), minutes: n } }) }
|
|
249
|
-
}],
|
|
250
|
-
|
|
251
|
-
// Previews: the links a workspace keeps at hand (production, staging, a square's preview, a shared localhost).
|
|
252
|
-
['POST', /^\/v1\/workspaces\/([^/]+)\/links$/, async (req, body, [id]) => {
|
|
253
|
-
const r = await reach(req, id)
|
|
254
|
-
if (r.access.access !== 'edit' && !r.access.admin) throw new HttpError(403, 'Only people who can edit the workspace add its links.')
|
|
255
|
-
const name = String(body.name || '').trim().slice(0, 80)
|
|
256
|
-
const link = String(body.url || '').trim()
|
|
257
|
-
if (!name) throw new HttpError(400, 'Give the link a name.')
|
|
258
|
-
if (!/^https?:\/\/\S{3,490}$/.test(link)) throw new HttpError(400, 'That is not a web address (http:// or https://).')
|
|
259
|
-
const room = typeof body.room === 'string' && body.room ? body.room.slice(0, 64) : null
|
|
260
|
-
if (room && !(await store.listWorkspaceSessions(r.ws.id)).some((s) => s.room === room)) throw new HttpError(400, 'That session is not in this workspace.')
|
|
261
|
-
const who = await caller(req)
|
|
262
|
-
return linkView(await store.addWorkspaceLink({ workspaceId: r.ws.id, room, name, url: link, note: String(body.note || '').slice(0, 200), createdBy: who.account }))
|
|
263
|
-
}],
|
|
264
|
-
['DELETE', /^\/v1\/workspaces\/([^/]+)\/links\/([^/]+)$/, async (req, body, [id, linkId]) => {
|
|
265
|
-
const r = await reach(req, id)
|
|
266
|
-
if (r.access.access !== 'edit' && !r.access.admin) throw new HttpError(403, 'Only people who can edit the workspace remove its links.')
|
|
267
|
-
await store.deleteWorkspaceLink(r.ws.id, needId(linkId, 'link'))
|
|
268
|
-
return { ok: true }
|
|
269
|
-
}],
|
|
229
|
+
}]
|
|
270
230
|
]
|
|
271
231
|
return routes.map(([method, pattern, fn, ...options]) => [method, pattern, gated(fn), ...options])
|
|
272
232
|
}
|
|
@@ -51,8 +51,6 @@ const SECRET_TICKET = 'id, token_hash, scope_type, scope_id, entries, created_by
|
|
|
51
51
|
const SECRET_RUN = 'id, token_hash, room, account, kind, label, created_at, expires_at, revoked_at'
|
|
52
52
|
const SECRET_ASK = 'run_id, secret_id, name, state, asked_at, answered_at'
|
|
53
53
|
const SECRET_USE = 'id, secret_id, run_id, room, account, upstream, at'
|
|
54
|
-
// A workspace's links (20261112100000_workspace_home.sql).
|
|
55
|
-
const WORKSPACE_LINK = 'id, workspace_id, room, name, url, note, created_by, created_at'
|
|
56
54
|
// App connections (20261112000000_app_connections.sql).
|
|
57
55
|
const APP_CONNECTION = 'id, scope_type, scope_id, app, app_name, logo, composio_id, status, who, created_by, created_at, updated_at'
|
|
58
56
|
const APP_CALL = 'id, room, cap_key, connection_id, app, tool, args, read_only, state, account, decided_by, result, error, created_at, decided_at, ran_at'
|
|
@@ -424,15 +422,6 @@ export function createSupabaseStore ({ url, serviceKey, client }) {
|
|
|
424
422
|
// `at` isn't a `*At` column, so it's turned into epoch ms here.
|
|
425
423
|
return (await pages(() => db.rpc('actions_in_room', { p_room: room, p_from: ts(from), p_to: ts(to), p_limit: limit }))).map((r) => ({ ...rowFrom(r), at: ms(r.at) }))
|
|
426
424
|
},
|
|
427
|
-
/** Each minute an AI worked in these rooms since `since` ('ai' actions): [{ room, account, at }]. */
|
|
428
|
-
async aiMinutes (rooms, since) {
|
|
429
|
-
if (!rooms.length) return []
|
|
430
|
-
return (await pages(() => db.from('visit_actions').select('room, account, at').eq('action', 'ai').in('room', rooms).gte('at', ts(since)).order('at'))).map((r) => ({ room: r.room, account: r.account, at: ms(r.at) }))
|
|
431
|
-
},
|
|
432
|
-
// The workspace's links (previews), 20261112100000_workspace_home.sql.
|
|
433
|
-
async listWorkspaceLinks (workspaceId) { return (await one(db.from('workspace_links').select(WORKSPACE_LINK).eq('workspace_id', workspaceId).order('created_at'))).map(rowFrom) },
|
|
434
|
-
async addWorkspaceLink (l) { return rowFrom(await one(db.from('workspace_links').insert(toSnake(l)).select(WORKSPACE_LINK).single())) },
|
|
435
|
-
async deleteWorkspaceLink (workspaceId, id) { await one(db.from('workspace_links').delete().eq('workspace_id', workspaceId).eq('id', id)) },
|
|
436
425
|
async sessionByRoom (room) { return rowFrom(await one(db.from('relay_sessions').select(RELAY_SESSION).eq('room', room).maybeSingle())) },
|
|
437
426
|
async visitsInRooms (rooms) {
|
|
438
427
|
if (!rooms.length) return []
|
package/src/control.js
CHANGED
|
@@ -82,27 +82,6 @@ export async function startControl (session, extras = {}) {
|
|
|
82
82
|
}
|
|
83
83
|
// The app's square panel (ui-server.js) commits and merges through the same tools, as the same member.
|
|
84
84
|
session.seamTool = seamTool
|
|
85
|
-
// GitHub for Session settings: Seam connects to GitHub (through the Seam app on GitHub), never Quilt. What the
|
|
86
|
-
// app reaches and where this quilt's main goes; connecting exports main to a repository it reaches after each merge.
|
|
87
|
-
session.seamGithub = async (b = {}) => {
|
|
88
|
-
const q = session.quilt
|
|
89
|
-
if (!q || !q.id) return { quilt: false }
|
|
90
|
-
const { client } = await seam.client(q.id, [])
|
|
91
|
-
const now = await client.exportStatus(q.id).catch(() => null)
|
|
92
|
-
if (b.repo) await client.setExport(q.id, { target: `https://github.com/${b.repo}.git`, credential: `github.${b.installation}`, enabled: true })
|
|
93
|
-
else if (b.disconnect && now && now.target) await client.setExport(q.id, { target: now.target, enabled: false })
|
|
94
|
-
const [github, exp] = await Promise.all([client.github(), b.repo || b.disconnect ? client.exportStatus(q.id).catch(() => null) : now])
|
|
95
|
-
return { quilt: true, github, export: exp && exp.target ? { target: exp.target, enabled: exp.enabled !== false, status: exp.status || null } : null }
|
|
96
|
-
}
|
|
97
|
-
// The workspace's home: this quilt's merges onto main (each patch on main is one), newest first, as times.
|
|
98
|
-
session.seamMerges = async ({ since = 0 } = {}) => {
|
|
99
|
-
const q = session.quilt
|
|
100
|
-
if (!q || !q.id) return []
|
|
101
|
-
const { client } = await seam.client(q.id, [])
|
|
102
|
-
const r = await client.linePatches(q.id, 'main', { limit: 500 })
|
|
103
|
-
const list = Array.isArray(r) ? r : (r && (r.patches || r.items)) || []
|
|
104
|
-
return list.map((p) => Date.parse(p.at || p.created_at || p.merged_at || p.createdAt || '') || 0).filter((t) => t >= since)
|
|
105
|
-
}
|
|
106
85
|
const routes = {
|
|
107
86
|
'GET /status': (b) => {
|
|
108
87
|
// To one of the AI sessions working through this app, "you" is that session (persona.js).
|
package/src/presence.js
CHANGED
|
@@ -25,8 +25,7 @@ const SYNC_MS = 1000
|
|
|
25
25
|
export const ACT_COALESCE_MS = 60 * 1000
|
|
26
26
|
/** Why a visit ended. The accounts API turns an agent's `pass_expired` or `idle` into `revoked` when its keys were revoked first. */
|
|
27
27
|
export const END_REASONS = ['left', 'disconnected', 'removed', 'pass_expired', 'session_ended', 'relay_restart', 'idle', 'replaced', 'needs_update']
|
|
28
|
-
|
|
29
|
-
export const ACTIONS = ['created', 'edited', 'deleted', 'claimed', 'released', 'requested', 'handed_off', 'withdrew', 'messaged', 'task', 'tool', 'ai']
|
|
28
|
+
export const ACTIONS = ['created', 'edited', 'deleted', 'claimed', 'released', 'requested', 'handed_off', 'withdrew', 'messaged', 'task', 'tool']
|
|
30
29
|
const MAX_TARGET = 300
|
|
31
30
|
const SEND_TIMEOUT_MS = 15 * 1000
|
|
32
31
|
const CLOSE_TIMEOUT_MS = 5 * 1000
|
package/src/server.js
CHANGED
|
@@ -660,20 +660,6 @@ class Room {
|
|
|
660
660
|
}
|
|
661
661
|
|
|
662
662
|
/** The audit trail, for a member by id: the visit of their connection here, or of the hosted agent. */
|
|
663
|
-
/** Every member whose AI is working now: an 'ai' minute on their visit (presence.js coalesces it to one a minute). */
|
|
664
|
-
noteAiWork () {
|
|
665
|
-
if (!this.presence) return
|
|
666
|
-
const states = this.awareness.getStates()
|
|
667
|
-
for (const [ws, ids] of this.conns) {
|
|
668
|
-
if (!ws.visit || !ws.pass) continue
|
|
669
|
-
for (const id of ids) {
|
|
670
|
-
const st = states.get(id)
|
|
671
|
-
const ag = st && st.agent
|
|
672
|
-
if (ag && ag.sharing !== false && (ag.status === 'working' || (st.work && st.work.state === 'working'))) { this.presence.act(ws.visit, 'ai', String(ag.tool || st.tool || '').slice(0, 40)); break }
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
|
|
677
663
|
audit (id, action, target) {
|
|
678
664
|
if (!this.presence || !id) return
|
|
679
665
|
for (const ws of this.conns.keys()) {
|
|
@@ -4999,7 +4985,7 @@ export function startServer ({ port = 4321, host = '0.0.0.0', dataDir = null, lo
|
|
|
4999
4985
|
ws.isAlive = false
|
|
5000
4986
|
ws.ping()
|
|
5001
4987
|
}
|
|
5002
|
-
for (const room of rooms.values()) if (!room.ended) { room.sweepClaims(); room.sweepBoxes(); room.pruneBranches()
|
|
4988
|
+
for (const room of rooms.values()) if (!room.ended) { room.sweepClaims(); room.sweepBoxes(); room.pruneBranches() }
|
|
5003
4989
|
if (sweepHosted) sweepHosted()
|
|
5004
4990
|
}, 30000)
|
|
5005
4991
|
|