heyquilt 0.3.192 → 0.3.194
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/desktop/main.js +21 -4
- package/package.json +1 -1
- package/src/account.js +19 -6
- package/src/api/memory-store.js +31 -0
- package/src/api/routes/connections.js +9 -0
- package/src/api/routes/workspace-chat.js +75 -3
- package/src/api/supabase-store.js +36 -0
- package/src/ui/app.css +64 -19
- package/src/ui/app.js +1 -1
- package/src/ui/connections.js +124 -39
- package/src/ui/home.js +14 -1
- package/src/ui/project-channel.js +69 -21
- package/src/ui/projects.js +58 -15
- package/src/ui/releases.js +30 -5
- package/src/ui/session.js +2 -2
- package/src/ui-server.js +17 -2
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.194 — 2026-11-23
|
|
15
|
+
|
|
16
|
+
- **Make channels in a project.** A plus beside Channels in a project's sidebar: name the channel in the list and press Enter. Everyone in the project and its agents can read and write it, as with the project's own channel, and its row says how much is new. Anyone who can change the project can make one.
|
|
17
|
+
|
|
18
|
+
## 0.3.193 — 2026-11-23
|
|
19
|
+
|
|
20
|
+
- **The Connections page, redrawn.** A project's and a codebase's Connections page (and the Connections cards in the pop-ups) show what is connected as the same tiles as a project's Overview: the app's logo, who connected it, where it is from, and who may use it. "Connect an app" opens the apps to pick from in the page, with the search across it. With nothing connected yet, the apps are there to pick from straight away.
|
|
21
|
+
- **See what an app does before you connect it.** In the apps to pick from, click an app's name: its page says what it is and lists what agents could do with it, the things they would do at once (reads) apart from the ones they would ask a person about first (anything that sends, changes or deletes).
|
|
22
|
+
- **Download updates automatically.** A new switch in Settings, under Account, in About Quilt. With it on, a newer Quilt is downloaded as soon as it is out, and the update button becomes "Restart to update": the restart is all that is left. Nothing is installed without you.
|
|
23
|
+
|
|
14
24
|
## 0.3.192 — 2026-11-23
|
|
15
25
|
|
|
16
26
|
- **A preview's own pages look like Quilt.** What a preview's address shows by itself (open it from Quilt, starting, it did not start, nothing running) was bare text on grey. They now carry Quilt's mark, type and colours, in light and dark, and the starting page shows the mark piecing itself while it waits. The pages that send you back to Quilt have the Open in Quilt button.
|
package/desktop/main.js
CHANGED
|
@@ -15,7 +15,7 @@ import { registerProcess } from '../src/procs.js'
|
|
|
15
15
|
import { decodeInvite } from '../src/runner.js'
|
|
16
16
|
import { quiltHome, adoptLegacyEnv } from '../src/legacy.js'
|
|
17
17
|
import { downloadUrl } from '../src/releases.js'
|
|
18
|
-
import { installUpdate } from './updater.js'
|
|
18
|
+
import { installUpdate, downloadUpdate } from './updater.js'
|
|
19
19
|
import { registerOnStart } from '../src/integrations.js'
|
|
20
20
|
import { adoptLoginShellPath } from '../src/shell-path.js'
|
|
21
21
|
import { getSettings } from '../src/settings.js'
|
|
@@ -140,7 +140,8 @@ async function start () {
|
|
|
140
140
|
return r.canceled ? null : r.filePaths[0]
|
|
141
141
|
})
|
|
142
142
|
|
|
143
|
-
ipcMain.handle('install-update', () => update())
|
|
143
|
+
ipcMain.handle('install-update', (e, version) => update(typeof version === 'string' ? version : ''))
|
|
144
|
+
ipcMain.handle('download-update', (e, version) => downloadAhead(typeof version === 'string' ? version : ''))
|
|
144
145
|
ipcMain.handle('dev-restart', () => devRestart())
|
|
145
146
|
|
|
146
147
|
// The title bar follows the app's theme (Settings → Appearance), from the saved one at launch, then as the
|
|
@@ -165,14 +166,30 @@ const windowIcon = () => path.join(HERE, 'icons', (nativeTheme.shouldUseDarkColo
|
|
|
165
166
|
|
|
166
167
|
// ---------------------------------------------------------------- update --
|
|
167
168
|
// "Update Quilt" in the app: download the newest build, install it, restart.
|
|
169
|
+
// With "Download updates automatically" on, the page asks for the newest build ahead of time
|
|
170
|
+
// (downloadAhead): "Restart to update" then installs that file without fetching it again.
|
|
168
171
|
let updating = null
|
|
169
|
-
|
|
172
|
+
const ahead = new Map() // a version -> its download ahead of time, while it runs and once it is there
|
|
173
|
+
function downloadAhead (version) {
|
|
174
|
+
if (!app.isPackaged) return Promise.reject(new Error('Updates install into the packaged app only; from source, pull and restart.'))
|
|
175
|
+
if (updating) return Promise.reject(new Error('It is being installed.'))
|
|
176
|
+
if (!ahead.has(version)) {
|
|
177
|
+
ahead.set(version, downloadUpdate(downloadUrl(), { version, tempDir: app.getPath('temp') }).then(() => ({ ok: true }), (err) => {
|
|
178
|
+
ahead.delete(version)
|
|
179
|
+
throw new Error(err.message || 'The download failed.')
|
|
180
|
+
}))
|
|
181
|
+
}
|
|
182
|
+
return ahead.get(version)
|
|
183
|
+
}
|
|
184
|
+
function update (version = '') {
|
|
170
185
|
if (updating) return updating
|
|
171
186
|
updating = (async () => {
|
|
172
187
|
if (!app.isPackaged) throw new Error('Updates install into the packaged app only; from source, pull and restart.')
|
|
173
188
|
const progress = (p) => { if (win && !win.isDestroyed()) win.webContents.send('update-progress', p) }
|
|
174
189
|
try {
|
|
175
|
-
|
|
190
|
+
// A download ahead of time that is still running is waited for, not started a second time.
|
|
191
|
+
if (ahead.has(version)) await ahead.get(version).catch(() => {})
|
|
192
|
+
const next = await installUpdate(downloadUrl(), { version, tempDir: app.getPath('temp'), onProgress: progress })
|
|
176
193
|
quitting = true
|
|
177
194
|
// An AppImage relaunches from its file, not from the mount it runs in now.
|
|
178
195
|
if (next === 'relaunch') app.relaunch(process.env.APPIMAGE ? { execPath: process.env.APPIMAGE, args: process.argv.slice(1) } : undefined)
|
package/package.json
CHANGED
package/src/account.js
CHANGED
|
@@ -351,18 +351,31 @@ export async function moveSessionToWorkspace ({ token, id, room, api = apiUrl(),
|
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
// A project's channel (routes/workspace-chat.js): its messages, saying something, and marking it read.
|
|
354
|
-
|
|
355
|
-
|
|
354
|
+
// `channel`: one of the channels people made in the project, by its id; none is the project's own.
|
|
355
|
+
const chan$ = (channel) => (channel ? `/channels/${encodeURIComponent(channel)}` : '')
|
|
356
|
+
export async function workspaceMessages ({ token, id, channel = '', after = 0, api = apiUrl(), fetch: fetchImpl = globalThis.fetch }) {
|
|
357
|
+
const r = await call(fetchImpl, api, 'GET', `${ws$(id)}${chan$(channel)}/messages${after ? `?after=${encodeURIComponent(after)}` : ''}`, null, token)
|
|
356
358
|
if (!Array.isArray(r.messages)) throw new Error(BAD_REPLY)
|
|
357
359
|
return r
|
|
358
360
|
}
|
|
359
|
-
export async function sayInWorkspace ({ token, id, text, api = apiUrl(), fetch: fetchImpl = globalThis.fetch }) {
|
|
360
|
-
const r = await call(fetchImpl, api, 'POST', `${ws$(id)}/messages`, { text }, token)
|
|
361
|
+
export async function sayInWorkspace ({ token, id, channel = '', text, api = apiUrl(), fetch: fetchImpl = globalThis.fetch }) {
|
|
362
|
+
const r = await call(fetchImpl, api, 'POST', `${ws$(id)}${chan$(channel)}/messages`, { text }, token)
|
|
361
363
|
if (!r.message) throw new Error(BAD_REPLY)
|
|
362
364
|
return r
|
|
363
365
|
}
|
|
364
|
-
export async function readWorkspaceMessages ({ token, id, api = apiUrl(), fetch: fetchImpl = globalThis.fetch }) {
|
|
365
|
-
return call(fetchImpl, api, 'POST', `${ws$(id)}/messages/read`, {}, token)
|
|
366
|
+
export async function readWorkspaceMessages ({ token, id, channel = '', api = apiUrl(), fetch: fetchImpl = globalThis.fetch }) {
|
|
367
|
+
return call(fetchImpl, api, 'POST', `${ws$(id)}${chan$(channel)}/messages/read`, {}, token)
|
|
368
|
+
}
|
|
369
|
+
// The channels people made in a project: listing them, making one.
|
|
370
|
+
export async function workspaceChannels ({ token, id, api = apiUrl(), fetch: fetchImpl = globalThis.fetch }) {
|
|
371
|
+
const r = await call(fetchImpl, api, 'GET', `${ws$(id)}/channels`, null, token)
|
|
372
|
+
if (!Array.isArray(r.channels)) throw new Error(BAD_REPLY)
|
|
373
|
+
return r
|
|
374
|
+
}
|
|
375
|
+
export async function addWorkspaceChannel ({ token, id, name, api = apiUrl(), fetch: fetchImpl = globalThis.fetch }) {
|
|
376
|
+
const r = await call(fetchImpl, api, 'POST', `${ws$(id)}/channels`, { name }, token)
|
|
377
|
+
if (!r.channel) throw new Error(BAD_REPLY)
|
|
378
|
+
return r
|
|
366
379
|
}
|
|
367
380
|
|
|
368
381
|
// Workspace invites: an admin invites a person ({ account } or { email }); they accept in their Quilt.
|
package/src/api/memory-store.js
CHANGED
|
@@ -64,6 +64,7 @@ export function createMemoryStore ({ now = Date.now } = {}) {
|
|
|
64
64
|
// App connections (20261112000000_app_connections.sql).
|
|
65
65
|
const appConnections = new Map(); const appCalls = new Map()
|
|
66
66
|
const workspaceMessages = new Map(); const workspaceReads = new Map() // a project's channel, and each account's place in it
|
|
67
|
+
const workspaceChannels = new Map(); const channelMessages = new Map(); const channelReads = new Map() // the channels people made in a project, their messages, each account's place
|
|
67
68
|
const scopeKey = (scopeType, scopeId) => `${scopeType}\n${scopeId}`
|
|
68
69
|
// A secret as the API's routes see it: never its sealed value (secretSealed reads that, for the vault).
|
|
69
70
|
const secretMeta = (r) => { if (!r) return null; const { sealedValue, ...rest } = copy(r); return rest }
|
|
@@ -993,6 +994,12 @@ export function createMemoryStore ({ now = Date.now } = {}) {
|
|
|
993
994
|
for (const [k, i] of workspaceInvites) if (i.workspaceId === id) workspaceInvites.delete(k)
|
|
994
995
|
for (const [k, m] of workspaceMessages) if (m.workspaceId === id) workspaceMessages.delete(k)
|
|
995
996
|
for (const k of [...workspaceReads.keys()]) if (k.startsWith(`${id}|`)) workspaceReads.delete(k)
|
|
997
|
+
for (const [cid, c] of workspaceChannels) {
|
|
998
|
+
if (c.workspaceId !== id) continue
|
|
999
|
+
workspaceChannels.delete(cid)
|
|
1000
|
+
for (const [k, m] of channelMessages) if (m.channelId === cid) channelMessages.delete(k)
|
|
1001
|
+
for (const k of [...channelReads.keys()]) if (k.startsWith(`${cid}|`)) channelReads.delete(k)
|
|
1002
|
+
}
|
|
996
1003
|
for (const [k, f] of workspaceFiles) {
|
|
997
1004
|
if (f.workspaceId !== id) continue
|
|
998
1005
|
for (const vk of [...workspaceFileVersions.keys()]) if (vk.startsWith(`${f.id}\n`)) workspaceFileVersions.delete(vk)
|
|
@@ -1336,6 +1343,30 @@ export function createMemoryStore ({ now = Date.now } = {}) {
|
|
|
1336
1343
|
async workspaceReadAt (workspaceId, account) { return workspaceReads.get(`${workspaceId}|${account}`) || 0 },
|
|
1337
1344
|
async setWorkspaceReadAt (workspaceId, account, at) { workspaceReads.set(`${workspaceId}|${account}`, Math.max(at, workspaceReads.get(`${workspaceId}|${account}`) || 0)) },
|
|
1338
1345
|
|
|
1346
|
+
// More channels in a project (20261123010000_project_channels.sql).
|
|
1347
|
+
async listWorkspaceChannels (workspaceId) { return all(workspaceChannels, (c) => c.workspaceId === workspaceId).sort((a, b) => a.createdAt - b.createdAt).map(copy) },
|
|
1348
|
+
async addWorkspaceChannel ({ workspaceId, name, createdBy = '' }) {
|
|
1349
|
+
if (!workspaces.has(workspaceId)) throw fkViolation('workspace', 'does not exist')
|
|
1350
|
+
if (all(workspaceChannels, (c) => c.workspaceId === workspaceId && c.name.toLowerCase() === name.toLowerCase()).length) return null
|
|
1351
|
+
const last = Math.max(0, ...all(workspaceChannels, (c) => c.workspaceId === workspaceId).map((c) => c.createdAt))
|
|
1352
|
+
const row = { id: uuid(), workspaceId, name, createdBy, createdAt: Math.max(now(), last + 1) }
|
|
1353
|
+
workspaceChannels.set(row.id, row); return copy(row)
|
|
1354
|
+
},
|
|
1355
|
+
async workspaceChannelById (id) { const c = workspaceChannels.get(id); return c ? copy(c) : null },
|
|
1356
|
+
async addChannelMessage ({ channelId, account, name = '', text }) {
|
|
1357
|
+
if (!workspaceChannels.has(channelId)) throw fkViolation('channel', 'does not exist')
|
|
1358
|
+
const last = Math.max(0, ...all(channelMessages, (m) => m.channelId === channelId).map((m) => m.createdAt))
|
|
1359
|
+
const row = { id: uuid(), channelId, account, name, text, createdAt: Math.max(now(), last + 1) }
|
|
1360
|
+
channelMessages.set(row.id, row); return copy(row)
|
|
1361
|
+
},
|
|
1362
|
+
async listChannelMessages (channelId, { after = 0, limit = 100 } = {}) {
|
|
1363
|
+
const mine = all(channelMessages, (m) => m.channelId === channelId && m.createdAt > after).sort((a, b) => a.createdAt - b.createdAt)
|
|
1364
|
+
return (after ? mine.slice(0, limit) : mine.slice(-limit)).map(copy)
|
|
1365
|
+
},
|
|
1366
|
+
async countChannelMessages (channelId, { after = 0, notBy = '' } = {}) { return all(channelMessages, (m) => m.channelId === channelId && m.createdAt > after && m.account !== notBy).length },
|
|
1367
|
+
async channelReadAt (channelId, account) { return channelReads.get(`${channelId}|${account}`) || 0 },
|
|
1368
|
+
async setChannelReadAt (channelId, account, at) { channelReads.set(`${channelId}|${account}`, Math.max(at, channelReads.get(`${channelId}|${account}`) || 0)) },
|
|
1369
|
+
|
|
1339
1370
|
// App connections (20261112000000_app_connections.sql): Composio holds the tokens.
|
|
1340
1371
|
async addAppConnection (c) {
|
|
1341
1372
|
if (all(appConnections, (r) => r.composioId === c.composioId).length) throw duplicate('connection')
|
|
@@ -220,6 +220,15 @@ export function connectionRoutes (ctx) {
|
|
|
220
220
|
return { apps: await composio.toolkits({ search: u.searchParams.get('search') || '', limit: Number(u.searchParams.get('limit')) || 60 }) }
|
|
221
221
|
}],
|
|
222
222
|
|
|
223
|
+
// One app, before anyone connects it: what it is, and what agents could do with it (each action
|
|
224
|
+
// says whether it only reads, so the page can tell what would run at once from what would ask first).
|
|
225
|
+
['GET', /^\/v1\/connections\/apps\/([a-z0-9][a-z0-9_-]{0,79})$/i, async (req, body, [slug]) => {
|
|
226
|
+
await whoCalls(req)
|
|
227
|
+
const [app, tools] = await Promise.all([composio.toolkit(slug.toLowerCase()), composio.tools({ app: slug.toLowerCase(), limit: 100 })])
|
|
228
|
+
const actions = tools.map((t) => ({ name: t.name, description: String(t.description || '').replace(/\s+/g, ' ').trim().slice(0, 240), readOnly: !!t.readOnly }))
|
|
229
|
+
return { app, actions }
|
|
230
|
+
}],
|
|
231
|
+
|
|
223
232
|
// Composio sends the browser back here once someone signed in (or gave up).
|
|
224
233
|
['GET', /^\/v1\/connections\/done$/, async (req, body, params, url) => {
|
|
225
234
|
const u = url || new URL(req.url, 'http://x')
|
|
@@ -4,12 +4,23 @@
|
|
|
4
4
|
//
|
|
5
5
|
// Everyone who reaches the project reads and writes it: its people, and agents placed in it.
|
|
6
6
|
// Each account's place in it (what it has read) is kept, so the app can say how much is new.
|
|
7
|
+
//
|
|
8
|
+
// Beside it, a project has the channels its people make: named, for the same people, made by
|
|
9
|
+
// someone who may change the project. They are kept apart from the project's own channel (their
|
|
10
|
+
// own tables), so that one works whether or not their database change has been applied.
|
|
7
11
|
import { HttpError, needId, stripInvisible } from '../http.js'
|
|
8
12
|
import { workspaceReach, canSeeFiles } from '../workspace-reach.js'
|
|
9
13
|
|
|
10
14
|
export const MAX_MESSAGE = 8000
|
|
11
15
|
const PAGE = 100
|
|
12
16
|
const PER_MINUTE = 30
|
|
17
|
+
export const MAX_CHANNELS = 50
|
|
18
|
+
export const MAX_CHANNEL_NAME = 40
|
|
19
|
+
// The database has no such table yet (the channels' change is not applied): Postgres, or PostgREST's cache.
|
|
20
|
+
const noTable = (err) => !!err && (err.code === '42P01' || err.code === 'PGRST205')
|
|
21
|
+
|
|
22
|
+
/** A channel's name as it is kept: one line, no leading #, at most 40 characters; '' when there is nothing left. */
|
|
23
|
+
export const channelName = (raw) => stripInvisible(String(raw ?? '')).join('').replace(/\s+/g, ' ').replace(/^[#\s]+/, '').trim().slice(0, MAX_CHANNEL_NAME).trim()
|
|
13
24
|
|
|
14
25
|
export function workspaceChatRoutes (ctx) {
|
|
15
26
|
const { store, now = Date.now, workspaces = false } = ctx
|
|
@@ -42,7 +53,70 @@ export function workspaceChatRoutes (ctx) {
|
|
|
42
53
|
if (recent.size > 5000) for (const [k, v] of recent) if (!v.some((t) => at - t < 60_000)) recent.delete(k)
|
|
43
54
|
}
|
|
44
55
|
|
|
56
|
+
/** A channel someone made in this project, or a 404. */
|
|
57
|
+
async function channelIn (ws, cid) {
|
|
58
|
+
const ch = await store.workspaceChannelById(needId(cid, 'channel')).catch((err) => { if (noTable(err)) return null; throw err })
|
|
59
|
+
if (!ch || ch.workspaceId !== ws.id) throw new HttpError(404, 'no such channel')
|
|
60
|
+
return ch
|
|
61
|
+
}
|
|
62
|
+
const said = (body) => {
|
|
63
|
+
const text = String(body.text || '').replace(/\r\n/g, '\n').trim()
|
|
64
|
+
if (!text) throw new HttpError(400, 'Say something.')
|
|
65
|
+
if (text.length > MAX_MESSAGE) throw new HttpError(413, 'That message is too long.')
|
|
66
|
+
return text
|
|
67
|
+
}
|
|
68
|
+
|
|
45
69
|
return [
|
|
70
|
+
// The channels people made in the project, oldest first, each with how much is new for the caller.
|
|
71
|
+
// `canAdd`: the caller may make one. `ready: false`: this server's database cannot keep them yet.
|
|
72
|
+
['GET', /^\/v1\/workspaces\/([^/]+)\/channels$/, gated(async (req, body, [id]) => {
|
|
73
|
+
const r = await inProject(req, id)
|
|
74
|
+
let list
|
|
75
|
+
try { list = await store.listWorkspaceChannels(r.ws.id) } catch (err) { if (noTable(err)) return { channels: [], canAdd: false, ready: false }; throw err }
|
|
76
|
+
const channels = await Promise.all(list.map(async (c) => ({ id: c.id, name: c.name, unread: await store.countChannelMessages(c.id, { after: await store.channelReadAt(c.id, r.me.account), notBy: r.me.account }) })))
|
|
77
|
+
return { channels, canAdd: r.access.access === 'edit' && list.length < MAX_CHANNELS, ready: true }
|
|
78
|
+
})],
|
|
79
|
+
|
|
80
|
+
// A new channel, by someone who may change the project. One of a name, whatever its capitals.
|
|
81
|
+
['POST', /^\/v1\/workspaces\/([^/]+)\/channels$/, gated(async (req, body, [id]) => {
|
|
82
|
+
const r = await inProject(req, id)
|
|
83
|
+
if (r.access.access !== 'edit') throw new HttpError(403, 'Only people who can change this project make channels.')
|
|
84
|
+
const name = channelName(body.name)
|
|
85
|
+
if (!name) throw new HttpError(400, 'Give the channel a name.')
|
|
86
|
+
let list
|
|
87
|
+
try { list = await store.listWorkspaceChannels(r.ws.id) } catch (err) { if (noTable(err)) throw new HttpError(503, 'Channels can\'t be made on this server yet.'); throw err }
|
|
88
|
+
if (list.length >= MAX_CHANNELS) throw new HttpError(400, `A project has at most ${MAX_CHANNELS} channels.`)
|
|
89
|
+
const made = list.some((c) => c.name.toLowerCase() === name.toLowerCase()) ? null : await store.addWorkspaceChannel({ workspaceId: r.ws.id, name, createdBy: r.me.account })
|
|
90
|
+
if (!made) throw new HttpError(409, `There is already a channel called ${name}.`)
|
|
91
|
+
return { channel: { id: made.id, name: made.name, unread: 0 } }
|
|
92
|
+
})],
|
|
93
|
+
|
|
94
|
+
// One of those channels: the same three calls as the project's own channel below.
|
|
95
|
+
['GET', /^\/v1\/workspaces\/([^/]+)\/channels\/([^/]+)\/messages$/, gated(async (req, body, [id, cid], url) => {
|
|
96
|
+
const { me, ws } = await inProject(req, id)
|
|
97
|
+
const ch = await channelIn(ws, cid)
|
|
98
|
+
const u = url || new URL(req.url, 'http://x')
|
|
99
|
+
const messages = await store.listChannelMessages(ch.id, { after: Number(u.searchParams.get('after')) || 0, limit: PAGE })
|
|
100
|
+
const readAt = await store.channelReadAt(ch.id, me.account)
|
|
101
|
+
return { messages: messages.map((m) => view(m, me.account)), readAt, unread: await store.countChannelMessages(ch.id, { after: readAt, notBy: me.account }) }
|
|
102
|
+
})],
|
|
103
|
+
['POST', /^\/v1\/workspaces\/([^/]+)\/channels\/([^/]+)\/messages$/, gated(async (req, body, [id, cid]) => {
|
|
104
|
+
const { me, ws } = await inProject(req, id)
|
|
105
|
+
const ch = await channelIn(ws, cid)
|
|
106
|
+
const text = said(body)
|
|
107
|
+
limit(me.account)
|
|
108
|
+
const m = await store.addChannelMessage({ channelId: ch.id, account: me.account, name: await nameOf(me.account), text })
|
|
109
|
+
await store.setChannelReadAt(ch.id, me.account, m.createdAt)
|
|
110
|
+
return { message: view(m, me.account) }
|
|
111
|
+
})],
|
|
112
|
+
['POST', /^\/v1\/workspaces\/([^/]+)\/channels\/([^/]+)\/messages\/read$/, gated(async (req, body, [id, cid]) => {
|
|
113
|
+
const { me, ws } = await inProject(req, id)
|
|
114
|
+
const ch = await channelIn(ws, cid)
|
|
115
|
+
const at = now()
|
|
116
|
+
await store.setChannelReadAt(ch.id, me.account, at)
|
|
117
|
+
return { readAt: at }
|
|
118
|
+
})],
|
|
119
|
+
|
|
46
120
|
// The channel's messages, oldest first: the newest page, or what came after `after` (a time in ms).
|
|
47
121
|
// `unread`: how many others wrote since the caller last read it; `readAt`: when that was.
|
|
48
122
|
['GET', /^\/v1\/workspaces\/([^/]+)\/messages$/, gated(async (req, body, [id], url) => {
|
|
@@ -56,9 +130,7 @@ export function workspaceChatRoutes (ctx) {
|
|
|
56
130
|
|
|
57
131
|
['POST', /^\/v1\/workspaces\/([^/]+)\/messages$/, gated(async (req, body, [id]) => {
|
|
58
132
|
const { me, ws } = await inProject(req, id)
|
|
59
|
-
const text =
|
|
60
|
-
if (!text) throw new HttpError(400, 'Say something.')
|
|
61
|
-
if (text.length > MAX_MESSAGE) throw new HttpError(413, 'That message is too long.')
|
|
133
|
+
const text = said(body)
|
|
62
134
|
limit(me.account)
|
|
63
135
|
const m = await store.addWorkspaceMessage({ workspaceId: ws.id, account: me.account, name: await nameOf(me.account), text })
|
|
64
136
|
// Whoever writes has read up to here.
|
|
@@ -54,6 +54,8 @@ const SECRET_ASK = 'run_id, secret_id, name, state, asked_at, answered_at'
|
|
|
54
54
|
const SECRET_USE = 'id, secret_id, run_id, room, account, upstream, at'
|
|
55
55
|
// App connections (20261112000000_app_connections.sql).
|
|
56
56
|
const WORKSPACE_MESSAGE = 'id, workspace_id, account, name, text, created_at'
|
|
57
|
+
const WORKSPACE_CHANNEL = 'id, workspace_id, name, created_by, created_at'
|
|
58
|
+
const CHANNEL_MESSAGE = 'id, channel_id, account, name, text, created_at'
|
|
57
59
|
const APP_CONNECTION = 'id, scope_type, scope_id, app, app_name, logo, composio_id, status, who, agents, created_by, created_at, updated_at'
|
|
58
60
|
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'
|
|
59
61
|
// How Quilt wakes each agent (20261025000000_agent_wake.sql).
|
|
@@ -527,6 +529,40 @@ export function createSupabaseStore ({ url, serviceKey, client, fetch: authFetch
|
|
|
527
529
|
async setWorkspaceReadAt (workspaceId, account, at) {
|
|
528
530
|
await one(db.from('workspace_message_reads').upsert({ workspace_id: workspaceId, account, read_at: ts(at) }, { onConflict: 'workspace_id,account' }))
|
|
529
531
|
},
|
|
532
|
+
// More channels in a project (20261123010000_project_channels.sql): the ones people made, their messages, and what each account has read.
|
|
533
|
+
async listWorkspaceChannels (workspaceId) {
|
|
534
|
+
return (await one(db.from('workspace_channels').select(WORKSPACE_CHANNEL).eq('workspace_id', workspaceId).order('created_at'))).map(rowFrom)
|
|
535
|
+
},
|
|
536
|
+
// One of a name in a project (a unique index; a second is a 23505): null then.
|
|
537
|
+
async addWorkspaceChannel ({ workspaceId, name, createdBy = '' }) {
|
|
538
|
+
const { data, error } = await db.from('workspace_channels').insert({ workspace_id: workspaceId, name, created_by: createdBy }).select(WORKSPACE_CHANNEL).single()
|
|
539
|
+
if (error) { if (error.code === '23505') return null; throw error }
|
|
540
|
+
return rowFrom(data)
|
|
541
|
+
},
|
|
542
|
+
async workspaceChannelById (id) {
|
|
543
|
+
const row = await one(db.from('workspace_channels').select(WORKSPACE_CHANNEL).eq('id', id).maybeSingle())
|
|
544
|
+
return row ? rowFrom(row) : null
|
|
545
|
+
},
|
|
546
|
+
async addChannelMessage ({ channelId, account, name = '', text }) {
|
|
547
|
+
return rowFrom(await one(db.from('workspace_channel_messages').insert({ channel_id: channelId, account, name, text }).select(CHANNEL_MESSAGE).single()))
|
|
548
|
+
},
|
|
549
|
+
async listChannelMessages (channelId, { after = 0, limit = 100 } = {}) {
|
|
550
|
+
const q = db.from('workspace_channel_messages').select(CHANNEL_MESSAGE).eq('channel_id', channelId)
|
|
551
|
+
if (after) return (await one(q.gt('created_at', ts(after)).order('created_at').limit(limit))).map(rowFrom)
|
|
552
|
+
return (await one(q.order('created_at', { ascending: false }).limit(limit))).map(rowFrom).reverse()
|
|
553
|
+
},
|
|
554
|
+
async countChannelMessages (channelId, { after = 0, notBy = '' } = {}) {
|
|
555
|
+
const { count, error } = await db.from('workspace_channel_messages').select('id', { count: 'exact', head: true }).eq('channel_id', channelId).gt('created_at', ts(after)).neq('account', notBy)
|
|
556
|
+
if (error) throw error
|
|
557
|
+
return count || 0
|
|
558
|
+
},
|
|
559
|
+
async channelReadAt (channelId, account) {
|
|
560
|
+
const row = await one(db.from('workspace_channel_reads').select('read_at').eq('channel_id', channelId).eq('account', account).maybeSingle())
|
|
561
|
+
return row ? ms(row.read_at) : 0
|
|
562
|
+
},
|
|
563
|
+
async setChannelReadAt (channelId, account, at) {
|
|
564
|
+
await one(db.from('workspace_channel_reads').upsert({ channel_id: channelId, account, read_at: ts(at) }, { onConflict: 'channel_id,account' }))
|
|
565
|
+
},
|
|
530
566
|
|
|
531
567
|
async listWorkspaceInvites (workspaceId) {
|
|
532
568
|
return (await one(db.from('workspace_invites').select(WORKSPACE_INVITE).eq('workspace_id', workspaceId).order('created_at', { ascending: false }).limit(50))).map(rowFrom)
|
package/src/ui/app.css
CHANGED
|
@@ -1767,6 +1767,11 @@ body.has-asks .prail { margin-top: calc(var(--update-bar, 0px) + var(--asks-bar)
|
|
|
1767
1767
|
.pj-hash { flex: none; display: inline-grid; place-items: center; width: 16px; font-weight: 600; font-size: 15px; color: var(--muted); }
|
|
1768
1768
|
.pj-side .side-sessions.pj-rooms button.on { background: var(--panel-2); font-weight: 600; }
|
|
1769
1769
|
.pj-side .pj-rooms button.on .pj-hash { color: var(--text); }
|
|
1770
|
+
/* naming a new channel, in the list where it will be */
|
|
1771
|
+
.pj-newchan { display: flex; align-items: center; gap: 10px; height: 28px; margin: 1px 0; padding: 0 10px; border-radius: 4px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--border-strong); }
|
|
1772
|
+
.pj-newchan:focus-within { box-shadow: inset 0 0 0 1.5px var(--accent); }
|
|
1773
|
+
.pj-newchan input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 13px; }
|
|
1774
|
+
.pj-newchan input::placeholder { color: var(--faint); }
|
|
1770
1775
|
.pj-side .ct.new, .pj-side .side-nav button.on .ct.new, .pj-side .side-nav button:hover .ct.new { background: var(--accent); color: light-dark(#fff, #1d1b2e); }
|
|
1771
1776
|
.ws.pj-cb .ws-body { grid-template-columns: 244px minmax(0, 1fr); transition: grid-template-columns var(--side-slide); }
|
|
1772
1777
|
.ws.pj-cb[data-side="shut"] .ws-body { grid-template-columns: 0px minmax(0, 1fr); }
|
|
@@ -3109,28 +3114,68 @@ label.radio:has(input:disabled) { cursor: default; opacity: .75; }
|
|
|
3109
3114
|
.ss-secrets { padding: 4px 0; }
|
|
3110
3115
|
/* App connections (connections.js): cards that fill their container, and the approval card in the chat */
|
|
3111
3116
|
.ss-connections { padding: 4px 0; }
|
|
3117
|
+
/* Connections (connections.js): what is connected as the Overview's tiles, each with who may use it;
|
|
3118
|
+
"Connect an app" opens the apps to pick from in the page. */
|
|
3112
3119
|
.cn { display: flex; flex-direction: column; gap: 18px; }
|
|
3113
|
-
.cn .
|
|
3120
|
+
.cn > .files-head { margin-bottom: 0; }
|
|
3114
3121
|
.cn-sec { display: flex; flex-direction: column; gap: 10px; }
|
|
3115
|
-
.cn-sec
|
|
3116
|
-
.cn-
|
|
3117
|
-
.cn-
|
|
3118
|
-
.cn-
|
|
3119
|
-
.cn-
|
|
3120
|
-
.cn-
|
|
3121
|
-
.cn-
|
|
3122
|
-
.cn-
|
|
3123
|
-
.cn-
|
|
3124
|
-
.cn-
|
|
3122
|
+
.cn-sec h3, .cn-add h3 { margin: 0; font-size: 14px; font-weight: 600; }
|
|
3123
|
+
.cn-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 10px; align-items: start; }
|
|
3124
|
+
.cn-tiles > .pj-slot { align-self: stretch; }
|
|
3125
|
+
.cn-tile { grid-template-rows: auto 12px auto auto; min-height: 0; }
|
|
3126
|
+
.cn-tile.off { background: none; box-shadow: 0 0 0 1px var(--border); }
|
|
3127
|
+
.cn-tile.off .pj-face { opacity: .55; }
|
|
3128
|
+
.cn-corner { grid-area: 1 / 2; align-self: start; justify-self: end; display: flex; align-items: center; min-height: 26px; }
|
|
3129
|
+
.cn-remove { width: 26px; height: 26px; margin: -3px -5px 0 0; color: var(--faint); opacity: 0; transition: opacity .12s; }
|
|
3130
|
+
.cn-tile:hover .cn-remove, .cn-tile:focus-within .cn-remove { opacity: 1; }
|
|
3131
|
+
.cn-remove:hover { color: var(--bad); }
|
|
3132
|
+
@media (hover: none) { .cn-remove { opacity: 1; } }
|
|
3125
3133
|
.cn-state { font-size: 11.5px; font-weight: 600; color: var(--warn); white-space: nowrap; } .cn-state.failed { color: var(--bad); }
|
|
3126
|
-
.cn-
|
|
3127
|
-
.cn-confirm {
|
|
3128
|
-
.cn-
|
|
3129
|
-
.cn-
|
|
3130
|
-
.cn-
|
|
3131
|
-
.cn-
|
|
3132
|
-
.cn-
|
|
3133
|
-
.cn-
|
|
3134
|
+
.cn-who, .cn-confirm, .cn-agents { grid-column: 1 / 3; margin-top: 12px; min-width: 0; }
|
|
3135
|
+
.cn-who, .cn-confirm { grid-row: 6; } .cn-agents { grid-row: 7; }
|
|
3136
|
+
.cn-who .input, .cn-who .dd-btn { width: 100%; }
|
|
3137
|
+
.cn-who .dd-btn { padding: 0 10px; font-size: 13px; }
|
|
3138
|
+
.cn-who .btn { width: 100%; justify-content: center; }
|
|
3139
|
+
.cn-confirm { display: flex; align-items: center; gap: 6px; font-size: 12.5px; } .cn-confirm span { flex: 1; min-width: 0; font-weight: 600; }
|
|
3140
|
+
.cn-agents { display: flex; flex-direction: column; gap: 7px; padding-top: 12px; border-top: 1px solid var(--border); }
|
|
3141
|
+
.cn-agent { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; cursor: pointer; } .cn-agent span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3142
|
+
/* the apps to pick from */
|
|
3143
|
+
.cn-add { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 12px; background: var(--panel); box-shadow: 0 0 0 1px light-dark(rgba(29, 27, 46, .08), var(--border)); }
|
|
3144
|
+
.cn-add.enter { animation: cn-in .2s cubic-bezier(.3, .7, .2, 1); }
|
|
3145
|
+
@keyframes cn-in { from { opacity: 0; transform: translateY(-6px); } }
|
|
3146
|
+
@media (prefers-reduced-motion: reduce) { .cn-add.enter { animation: none; } }
|
|
3147
|
+
.cn-add-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; } .cn-add-head .spacer { flex: 1; } .cn-add-head .btn { align-self: center; margin: -4px -4px -4px 0; }
|
|
3148
|
+
.cn-add-head .hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3149
|
+
.cn-search { position: relative; display: block; }
|
|
3150
|
+
.cn-search svg { position: absolute; left: 12px; top: 50%; width: 15px; height: 15px; margin-top: -7.5px; color: var(--muted); pointer-events: none; }
|
|
3151
|
+
.cn-search .input { width: 100%; height: 38px; padding-left: 36px; }
|
|
3152
|
+
.cn-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
|
|
3153
|
+
.cn-app { display: flex; align-items: center; gap: 4px; min-width: 0; padding: 4px 6px 4px 4px; border-radius: 10px; background: var(--panel-2); transition: background .12s; }
|
|
3154
|
+
.cn-app:hover { background: color-mix(in srgb, var(--text) 9%, var(--panel)); }
|
|
3155
|
+
.cn-app-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 5px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
|
|
3156
|
+
.cn-app-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
|
|
3157
|
+
.cn-app .pj-face.md { width: 32px; height: 32px; border-radius: 9px; }
|
|
3158
|
+
.cn-app b { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3159
|
+
.cn-go { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); }
|
|
3160
|
+
.cn-go:hover:not(:disabled) { color: var(--accent); background: none; }
|
|
3161
|
+
/* one app, opened: what it is, and what agents could do with it */
|
|
3162
|
+
.cn-back { margin: -4px 0 -4px -6px; color: var(--muted); } .cn-back svg { width: 14px; height: 14px; }
|
|
3163
|
+
.cn-app-top { display: flex; align-items: center; gap: 14px; min-width: 0; }
|
|
3164
|
+
.cn-app-top .pj-face.md { width: 48px; height: 48px; border-radius: 13px; }
|
|
3165
|
+
.cn-app-top .t { flex: 1; min-width: 0; } .cn-app-top h3 { font-size: 17px; } .cn-app-top .hint { margin: 2px 0 0; }
|
|
3166
|
+
.cn-acts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
|
|
3167
|
+
.cn-acts { min-width: 0; padding: 14px; border-radius: 10px; background: var(--panel-2); }
|
|
3168
|
+
.cn-acts h4 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 600; }
|
|
3169
|
+
.cn-acts h4 i { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--panel); border-radius: 999px; padding: 0 7px; line-height: 18px; }
|
|
3170
|
+
.cn-acts > .hint { margin: 2px 0 0; }
|
|
3171
|
+
.cn-acts ul { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; }
|
|
3172
|
+
.cn-acts li { display: flex; flex-direction: column; min-width: 0; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
|
|
3173
|
+
.cn-acts li b { font-weight: 600; } .cn-acts li span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3174
|
+
.cn-acts .cn-none { margin-top: 10px; }
|
|
3175
|
+
@media (max-width: 760px) { .cn-acts-grid { grid-template-columns: minmax(0, 1fr); } .cn-app-top { flex-wrap: wrap; } }
|
|
3176
|
+
.cn-more { align-self: flex-start; }
|
|
3177
|
+
.cn-note { display: flex; align-items: flex-start; gap: 8px; margin: 2px 0 0; }
|
|
3178
|
+
.cn-note svg { flex: none; width: 14px; height: 14px; margin-top: 2px; }
|
|
3134
3179
|
.cn-calls { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); }
|
|
3135
3180
|
.cn-call { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 12.5px; min-width: 0; } .cn-call + .cn-call { border-top: 1px solid var(--border); }
|
|
3136
3181
|
.cn-call code { font: 12px var(--mono); } .cn-call .hint { margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
package/src/ui/app.js
CHANGED
|
@@ -258,7 +258,7 @@ export async function go (view) {
|
|
|
258
258
|
state.pending = []
|
|
259
259
|
state.to = ''
|
|
260
260
|
if (view !== 'home') state.addingWorkspace = false
|
|
261
|
-
if (!isWorkspace(view) || wsIdOf(view) !== state.workspace?.workspace?.id) state.projectPage = '' // another project opens on its overview
|
|
261
|
+
if (!isWorkspace(view) || wsIdOf(view) !== state.workspace?.workspace?.id) { state.projectPage = ''; state.projectChannel = ''; state.newChannel = null } // another project opens on its overview
|
|
262
262
|
drawRail() // where you are going shows on the strip at once, while its page loads
|
|
263
263
|
if (isWorkspace(view)) {
|
|
264
264
|
if (state.workspace?.workspace?.id !== wsIdOf(view)) {
|