heyquilt 0.3.183 → 0.3.185
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/account.js +15 -0
- package/src/api/memory-store.js +22 -1
- package/src/api/routes/connections.js +54 -13
- package/src/api/routes/workspace-chat.js +77 -0
- package/src/api/routes/workspaces.js +2 -0
- package/src/api/server.js +2 -1
- package/src/api/supabase-store.js +25 -1
- package/src/app-tools.js +2 -2
- package/src/app-workspaces.js +21 -0
- package/src/ui/app.css +27 -7
- package/src/ui/connections.js +48 -8
- package/src/ui/home.js +8 -3
- package/src/ui/loom.js +3 -17
- package/src/ui/project-channel.js +93 -0
- package/src/ui/project-model.js +27 -0
- package/src/ui/project-pop.js +1 -1
- package/src/ui/projects.js +83 -25
- package/src/ui/session.js +25 -17
- package/src/ui/voice.js +8 -5
- package/src/ui-server.js +27 -4
package/src/ui/voice.js
CHANGED
|
@@ -65,8 +65,8 @@ function endPicking (id) {
|
|
|
65
65
|
* A session is on screen: wire the call into its chat. `who()`: { owner, me, colorOf(name) } now;
|
|
66
66
|
* `chatChanged()`: the chat's calls changed, draw its messages again.
|
|
67
67
|
*/
|
|
68
|
-
export function mountCall (id, signal, who, chatChanged = () => {}) {
|
|
69
|
-
shown = { id, who, chatChanged }
|
|
68
|
+
export function mountCall (id, signal, who, chatChanged = () => {}, callChanged = () => {}) {
|
|
69
|
+
shown = { id, who, chatChanged, callChanged, count: 0 }
|
|
70
70
|
asking = false
|
|
71
71
|
options = false
|
|
72
72
|
drawn = ''
|
|
@@ -297,6 +297,9 @@ function paintTalk () {
|
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
+
/** How many people are in the call of the codebase on screen (0: no call). */
|
|
301
|
+
export const callCount = () => (shown && shown.count) || 0
|
|
302
|
+
|
|
300
303
|
/** The chat's call button and the pinned call, for the session on screen. */
|
|
301
304
|
export function renderCall () {
|
|
302
305
|
const btn = $('#chat-call')
|
|
@@ -310,6 +313,9 @@ export function renderCall () {
|
|
|
310
313
|
const elsewhere = !!(live && live.sid !== id)
|
|
311
314
|
const others = view.peers
|
|
312
315
|
const c = here ? live.call : null
|
|
316
|
+
// How many are in the call, for whoever shows it elsewhere (the channel's row in the sidebar).
|
|
317
|
+
const count = others.length + (here ? 1 : 0)
|
|
318
|
+
if (count !== shown.count) { shown.count = count; shown.callChanged(count) }
|
|
313
319
|
btn.hidden = here || joining || asking || others.length > 0
|
|
314
320
|
btn.disabled = elsewhere
|
|
315
321
|
pin.hidden = !(here || joining || asking || others.length)
|
|
@@ -483,6 +489,3 @@ export function callCards (id) {
|
|
|
483
489
|
}
|
|
484
490
|
})
|
|
485
491
|
}
|
|
486
|
-
|
|
487
|
-
/** Whether this window is in a call now (for the people list). */
|
|
488
|
-
export const inCallHere = (id) => !!(live && live.sid === id)
|
package/src/ui-server.js
CHANGED
|
@@ -21,6 +21,7 @@ import { autowork, autoConfig, publicConfig, AUTO_MODES } from './autowork.js'
|
|
|
21
21
|
import { migrateDir } from './legacy.js'
|
|
22
22
|
import { writePrivateJson } from './private-file.js'
|
|
23
23
|
import { autoToolFor } from './autowork-tools.js'
|
|
24
|
+
import { workspaceMessages, sayInWorkspace, readWorkspaceMessages } from './account.js'
|
|
24
25
|
import { readAccount, saveAccount, clearAccount, clearAccountIf, resumeAccount, startLink, waitForLink, signUpForLink, confirmSignUpForLink, fetchMe, signOut, revokeToken, accountFromProfile, renameSession, createAgentInvite, listAgents, agentDetails, listAccessTypes, listCollaborators, listGrants, putGrant, deleteGrant, inviteToSession, listSessionInvites, cancelSessionInvite, listWorkspaces, listOrgs, createWorkspace, getWorkspace, updateWorkspace, deleteWorkspace, putWorkspaceMember, removeWorkspaceMember, getAgentPlacement, putAgentPlacement, listOrgAgents, putWorkspaceAgent, deleteWorkspaceAgent, createWorkspaceAgentInvite, excludeSessionAgent, listExcludedSessionAgents, listSessionAgents, includeSessionAgent, setSessionWorkspace, moveSessionToWorkspace, listWorkspaceInvites, inviteToWorkspace, cancelWorkspaceInvite, listMyInvites, answerMyInvite, listMySessions, announceSessionStarted, announceWhenReported, listWorkspaceFiles, createWorkspaceFile, confirmWorkspaceFile, workspaceFileDownload, updateWorkspaceFile, deleteWorkspaceFile, createWorkspaceFolder, listWorkspaceFileVersions, listSandboxKeys, createSandboxKey, rotateSandboxKey, revokeSandboxKey, removeSandboxKey, aiVmFollow, aiVmUnfollow, aiVmStatus, aiVmConnect, aiVmUpdate, aiVmSignIn, aiVmWake, aiVmDisconnect, voiceIce, transcribeVoice, speakVoice, speakVoiceStream, apiUrl } from './account.js'
|
|
25
26
|
import { aiName } from './persona.js'
|
|
26
27
|
import { effectiveAccess, builtinType } from './session-access.js'
|
|
@@ -34,7 +35,7 @@ import { queryHistory } from './history.js'
|
|
|
34
35
|
import { contentDisposition } from './api/file-paths.js'
|
|
35
36
|
import { apiCall, getSecrets, putSecretSettings, setSecretWho, deleteSecret, secretUses, saveSecrets, secretAsks, answerAsk } from './secrets-client.js'
|
|
36
37
|
import { envFilesIn, knownEnvFile, envValues } from './secret-import.js'
|
|
37
|
-
import { appWorkspaces } from './app-workspaces.js'
|
|
38
|
+
import { appWorkspaces, projectsToLearn } from './app-workspaces.js'
|
|
38
39
|
import { guessTool } from './tool-guess.js'
|
|
39
40
|
|
|
40
41
|
// A route's answer that streams through instead of going as JSON (an agent's speech).
|
|
@@ -186,6 +187,7 @@ export const STATIC = {
|
|
|
186
187
|
'/project-model.js': ['project-model.js', 'text/javascript; charset=utf-8'],
|
|
187
188
|
'/project-board.js': ['project-board.js', 'text/javascript; charset=utf-8'],
|
|
188
189
|
'/project-pop.js': ['project-pop.js', 'text/javascript; charset=utf-8'],
|
|
190
|
+
'/project-channel.js': ['project-channel.js', 'text/javascript; charset=utf-8'],
|
|
189
191
|
'/prail.js': ['prail.js', 'text/javascript; charset=utf-8'],
|
|
190
192
|
'/prail-model.js': ['prail-model.js', 'text/javascript; charset=utf-8'],
|
|
191
193
|
'/rail-model.js': ['rail-model.js', 'text/javascript; charset=utf-8'],
|
|
@@ -561,6 +563,8 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
561
563
|
}
|
|
562
564
|
runs.set(id, entry)
|
|
563
565
|
const s = entry.run.session
|
|
566
|
+
// A codebase joined with an invite may be in a project: ask the account's list, which says (learnProjects).
|
|
567
|
+
if (appWorkspaces() && !readConfig(entry.run.dir)?.workspace) Promise.resolve().then(() => workspaceList()).catch(() => {})
|
|
564
568
|
// What the person said they want to build is the project's first ticket, for their AI to pick up.
|
|
565
569
|
const first = project && briefTicket(project.brief)
|
|
566
570
|
if (first) {
|
|
@@ -836,6 +840,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
836
840
|
try {
|
|
837
841
|
const workspaces = await listWorkspaces({ token })
|
|
838
842
|
workspacesOn = true
|
|
843
|
+
learnProjects(workspaces)
|
|
839
844
|
return { on: true, workspaces }
|
|
840
845
|
} catch (err) {
|
|
841
846
|
if (err.status === 404) { workspacesOn = false; return { on: false, workspaces: [] } }
|
|
@@ -863,6 +868,19 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
863
868
|
for (const r of recentList()) if (!r.unsupported) add(r.dir, '', '')
|
|
864
869
|
return out
|
|
865
870
|
}
|
|
871
|
+
// A codebase here that the account's projects list in a project is in that project here too
|
|
872
|
+
// (app-workspaces.js projectsToLearn): saved in its folder, so its page, its row and the project's page agree.
|
|
873
|
+
function learnProjects (workspaces) {
|
|
874
|
+
const folders = [...[...runs.values()].map((r) => ({ dir: r.run.dir, room: r.run.session.room, workspace: readConfig(r.run.dir)?.workspace || '' })), ...recentList().map((r) => ({ dir: r.dir, room: r.room, workspace: r.workspace || '' }))]
|
|
875
|
+
for (const { dir, workspace } of projectsToLearn(workspaces, folders)) {
|
|
876
|
+
const saved = readConfig(dir)
|
|
877
|
+
if (!saved) continue
|
|
878
|
+
writePrivateJson(path.join(dir, '.quilt', 'config.json'), { ...saved, workspace })
|
|
879
|
+
rememberWorkspace(dir, workspace)
|
|
880
|
+
const id = idFor(dir)
|
|
881
|
+
if (runs.has(id)) { runs.get(id).run.session.setWorkspace(workspace); pushStatus(id) }
|
|
882
|
+
}
|
|
883
|
+
}
|
|
866
884
|
const needOrgSlug = (slug) => { if (!/^[a-z0-9][a-z0-9-]{0,63}$/i.test(String(slug || ''))) throw httpError(400, 'Which org?'); return slug }
|
|
867
885
|
const ofWorkspace = (id) => ({
|
|
868
886
|
running: [...runs.keys()].filter((k) => (readConfig(runs.get(k).run.dir) || {}).workspace === id),
|
|
@@ -1010,12 +1028,13 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1010
1028
|
return asAccount(async (token) => {
|
|
1011
1029
|
const c = secretsApi(token)
|
|
1012
1030
|
if (method === 'GET' && p === '/api/connections/apps') return apiCall(c, 'GET', `/v1/connections/apps?search=${enc(url.searchParams.get('search') || '')}&limit=${enc(url.searchParams.get('limit') || '60')}`)
|
|
1013
|
-
const sc = p.match(/^\/api\/connections\/(org|workspace|session)\/([^/]+)(?:\/([0-9a-f-]{36}))?$/i)
|
|
1014
|
-
|
|
1031
|
+
const sc = p.match(/^\/api\/connections\/(org|workspace|session|account)\/([^/]+)(?:\/([0-9a-f-]{36}))?$/i)
|
|
1032
|
+
// A person's own connections are always "me": the accounts API reads who from the sign-in.
|
|
1033
|
+
if (sc && (sc[1] === 'account' ? sc[2] === 'me' : SECRET_SCOPE_ID[sc[1]].test(decodeURIComponent(sc[2])))) {
|
|
1015
1034
|
const base = `/v1/connections/${sc[1]}/${enc(decodeURIComponent(sc[2]))}`
|
|
1016
1035
|
if (!sc[3] && method === 'GET') return apiCall(c, 'GET', base)
|
|
1017
1036
|
if (!sc[3] && method === 'POST') return apiCall(c, 'POST', base, { app: String(body.app || ''), ...(body.who ? { who: String(body.who) } : {}) })
|
|
1018
|
-
if (sc[3] && method === 'PATCH') return apiCall(c, 'PATCH', `${base}/${sc[3]}`, { who: String(body.who || '') })
|
|
1037
|
+
if (sc[3] && method === 'PATCH') return apiCall(c, 'PATCH', `${base}/${sc[3]}`, { who: String(body.who || ''), ...(Array.isArray(body.agents) ? { agents: body.agents.map(String).slice(0, 100) } : {}) })
|
|
1019
1038
|
if (sc[3] && method === 'DELETE') return apiCall(c, 'DELETE', `${base}/${sc[3]}`)
|
|
1020
1039
|
}
|
|
1021
1040
|
const calls = p.match(/^\/api\/app-calls\/([A-Za-z0-9_-]{1,64})(?:\/([0-9a-f-]{36}))?$/i)
|
|
@@ -1150,6 +1169,10 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1150
1169
|
'GET /api/invites': () => asAccount(async (token) => ({ invites: (await listMyInvites({ token })).filter((i) => i.kind !== 'workspace' || appWorkspaces()) })),
|
|
1151
1170
|
'POST /api/invites/:id/accept': (b, id) => asAccount(async (token) => answerMyInvite({ token, id: needInviteId(id), how: 'accept' })),
|
|
1152
1171
|
'POST /api/invites/:id/decline': (b, id) => asAccount(async (token) => answerMyInvite({ token, id: needInviteId(id), how: 'decline' })),
|
|
1172
|
+
// A project's channel: kept by the accounts API, so it is there with no codebase open.
|
|
1173
|
+
'GET /api/workspaces/:id/messages': (b, id, url) => asAccount((token) => workspaceMessages({ token, id: needWorkspaceId(id), after: Number(url.searchParams.get('after')) || 0 })),
|
|
1174
|
+
'POST /api/workspaces/:id/messages': (b, id) => asAccount((token) => sayInWorkspace({ token, id: needWorkspaceId(id), text: String(b.text || '').slice(0, 8000) })),
|
|
1175
|
+
'POST /api/workspaces/:id/messages/read': (b, id) => asAccount((token) => readWorkspaceMessages({ token, id: needWorkspaceId(id) })),
|
|
1153
1176
|
'GET /api/workspaces/:id/files': (b, id, url) => asAccount(async (token) => ({ files: await listWorkspaceFiles({ token, id: needWorkspaceId(id), folder: url.searchParams.get('folder') ?? undefined }) })),
|
|
1154
1177
|
'GET /api/workspaces/:id/files/:fid/versions': (b, id, url, fid) => asAccount(async (token) => ({ versions: await listWorkspaceFileVersions({ token, id: needWorkspaceId(id), fileId: fid }) })),
|
|
1155
1178
|
// The address an HTML artifact's frame loads (serveSealed): asked for by the page, with its token.
|