heyquilt 0.3.147 → 0.3.149
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 +14 -0
- package/bin/quilt.js +26 -0
- package/package.json +1 -1
- package/src/account.js +19 -0
- package/src/api/http.js +5 -0
- package/src/api/routes/agent-wake.js +3 -1
- package/src/api/routes/voice.js +131 -3
- package/src/api/server.js +9 -4
- package/src/inbox.js +2 -2
- package/src/runner.js +2 -0
- package/src/server.js +24 -4
- package/src/session-follow.js +61 -2
- package/src/session.js +23 -0
- package/src/source-live/bring-in.js +116 -8
- package/src/source-live/land-gate.js +99 -0
- package/src/source-live/land.js +443 -0
- package/src/ui/app.css +2 -0
- package/src/ui/seam-model.js +10 -1
- package/src/ui/voice-call.js +62 -0
- package/src/ui/voice.js +20 -6
- package/src/ui-server.js +39 -5
- package/src/voice.js +8 -3
package/src/ui-server.js
CHANGED
|
@@ -20,7 +20,7 @@ import { autowork, autoConfig, publicConfig, AUTO_MODES } from './autowork.js'
|
|
|
20
20
|
import { migrateDir } from './legacy.js'
|
|
21
21
|
import { writePrivateJson } from './private-file.js'
|
|
22
22
|
import { autoToolFor } from './autowork-tools.js'
|
|
23
|
-
import { readAccount, saveAccount, clearAccount, clearAccountIf, resumeAccount, startLink, waitForLink, 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, 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, apiUrl } from './account.js'
|
|
23
|
+
import { readAccount, saveAccount, clearAccount, clearAccountIf, resumeAccount, startLink, waitForLink, 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, 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'
|
|
24
24
|
import { aiName } from './persona.js'
|
|
25
25
|
import { effectiveAccess, builtinType } from './session-access.js'
|
|
26
26
|
import { cleanSessionName, BAD_SESSION_NAME, SESSION_NAME_MAX } from './session-name.js'
|
|
@@ -37,6 +37,9 @@ import { envFilesIn, knownEnvFile, envValues } from './secret-import.js'
|
|
|
37
37
|
import { appWorkspaces } from './app-workspaces.js'
|
|
38
38
|
import { guessTool } from './tool-guess.js'
|
|
39
39
|
|
|
40
|
+
// A route's answer that streams through instead of going as JSON (an agent's speech).
|
|
41
|
+
const STREAMED = Symbol('streamed')
|
|
42
|
+
|
|
40
43
|
const TOOL_NAMES = ['Claude Code', 'Cursor', 'Codex', 'xAI', 'Windsurf', 'GitHub Copilot', 'Zed', 'Aider', 'Other']
|
|
41
44
|
const MAX_WS_FILE_BYTES = 500 * 1024 * 1024
|
|
42
45
|
const COLOR_RE = /^#[0-9a-f]{6}$/i
|
|
@@ -248,7 +251,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
248
251
|
// below — it returns earlier — so it needs no entry here.)
|
|
249
252
|
const UNRECORDED = new Set(['POST /api/report'])
|
|
250
253
|
// Sent many times a call (call setup, each clip of speech): only kept when slow or failed.
|
|
251
|
-
const QUIET_WHEN_OK = new Set(['POST /api/sessions/:id/voice', 'POST /api/sessions/:id/voice/clip', 'GET /api/sessions/:id/voice/speech'])
|
|
254
|
+
const QUIET_WHEN_OK = new Set(['POST /api/sessions/:id/voice', 'POST /api/sessions/:id/voice/clip', 'GET /api/sessions/:id/voice/speech', 'GET /api/sessions/:id/voice/speech-stream'])
|
|
252
255
|
function recordRoute (key, { startedAt, status, body, error }) {
|
|
253
256
|
// The reporter's own `enabled()` is the single gate on the "report" setting.
|
|
254
257
|
if (UNRECORDED.has(key)) return
|
|
@@ -690,10 +693,15 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
690
693
|
const audio = typeof b.audio === 'string' ? b.audio : ''
|
|
691
694
|
const seconds = Number(b.seconds)
|
|
692
695
|
if (!audio || !(seconds > 0) || seconds > 60) throw httpError(400, 'A clip is up to a minute of audio.')
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
+
// Clips transcribe side by side, but their lines go in the order they were said: each waits for
|
|
697
|
+
// the clip before it, so a short clip finishing first never jumps ahead of a long one.
|
|
698
|
+
const turn = asAccount((token) => transcribeVoice({ token, audio, seconds }))
|
|
699
|
+
const before = clipOrder.get(s) || Promise.resolve()
|
|
700
|
+
const added = before.then(() => turn).then((out) => ({ line: out.text ? s.addVoiceLine(out.text) : null, used: out.used, cap: out.cap }))
|
|
701
|
+
clipOrder.set(s, added.catch(() => {}))
|
|
702
|
+
return added
|
|
696
703
|
}
|
|
704
|
+
const clipOrder = new WeakMap() // session -> its last clip's line, once written
|
|
697
705
|
|
|
698
706
|
// An agent's line in the call we're in, as speech from quilt-api (Fluxions): asked once per line,
|
|
699
707
|
// kept a little while so the window asking again (a reload) costs nothing.
|
|
@@ -715,6 +723,25 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
715
723
|
return spoken.get(line.id)
|
|
716
724
|
}
|
|
717
725
|
|
|
726
|
+
// The same, as speech that plays as it renders: Fluxions hears what was said in the call just
|
|
727
|
+
// before (other people's lines since the agent last spoke), and the API renders it once for every
|
|
728
|
+
// app in the call. The PCM goes straight through to the window.
|
|
729
|
+
async function voiceSpeechStream (s, lineId) {
|
|
730
|
+
const v = s.voice()
|
|
731
|
+
if (!v.in) throw httpError(409, 'You are not in the call.')
|
|
732
|
+
const lines = s.voiceTranscript({ call: v.call, limit: 1000 }).lines
|
|
733
|
+
const i = lines.findIndex((l) => l.id === lineId)
|
|
734
|
+
const line = lines[i]
|
|
735
|
+
if (!line || !line.spoken || !v.agents.some((a) => a.name === line.by)) throw httpError(404, 'That is not an agent\'s line in this call.')
|
|
736
|
+
const key = (s.members || []).find((m) => m && m.kind === 'agent' && m.name === line.by)?.key || ''
|
|
737
|
+
const agent = /^agent:[0-9a-f-]{36}$/i.test(key) ? key.slice(6) : ''
|
|
738
|
+
const earlier = lines.slice(0, i)
|
|
739
|
+
const lastOwn = earlier.map((l) => l.by).lastIndexOf(line.by)
|
|
740
|
+
const before = earlier.slice(lastOwn + 1).filter((l) => l.by !== line.by).slice(-8).map((l) => ({ by: l.by, text: l.text }))
|
|
741
|
+
const res = await asAccount((token) => speakVoiceStream({ token, text: line.text, by: line.by, agent, before }))
|
|
742
|
+
return { [STREAMED]: true, type: res.headers.get('content-type') || 'audio/L16; rate=24000; channels=1', body: res.body }
|
|
743
|
+
}
|
|
744
|
+
|
|
718
745
|
// Agent invites and the list of your agents come from the accounts API, as this computer's account.
|
|
719
746
|
// A 401 there is checked against /v1/me before it counts: only a token the API no longer knows
|
|
720
747
|
// signs the app out (an older API that doesn't take the app's token for these yet just errors).
|
|
@@ -1056,6 +1083,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1056
1083
|
'GET /api/voice/ice': () => voiceServers(),
|
|
1057
1084
|
// An agent's line in the call, as speech.
|
|
1058
1085
|
'GET /api/sessions/:id/voice/speech': (b, id, url) => voiceSpeech(get(id), url.searchParams.get('line') || ''),
|
|
1086
|
+
'GET /api/sessions/:id/voice/speech-stream': (b, id, url) => voiceSpeechStream(get(id), url.searchParams.get('line') || ''),
|
|
1059
1087
|
// The composer says while someone types (and stops when they clear it or send).
|
|
1060
1088
|
'POST /api/sessions/:id/typing': (b, id) => get(id).setTyping(b.on !== false, { to: b.to || null }),
|
|
1061
1089
|
'POST /api/sessions/:id/claim': (b, id) => get(id).claim(b.pattern, b.note),
|
|
@@ -1309,6 +1337,12 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1309
1337
|
const startedAt = Date.now()
|
|
1310
1338
|
try {
|
|
1311
1339
|
const out = await handler(body, sid, url, fid || aid || iid)
|
|
1340
|
+
// A reply that streams (an agent's speech): straight through as it comes.
|
|
1341
|
+
if (out && out[STREAMED]) {
|
|
1342
|
+
res.writeHead(200, { 'content-type': out.type, 'cache-control': 'no-store' })
|
|
1343
|
+
Readable.fromWeb(out.body).on('error', () => res.destroy()).pipe(res)
|
|
1344
|
+
return recordRoute(key, { startedAt, status: 200, body })
|
|
1345
|
+
}
|
|
1312
1346
|
json(200, out)
|
|
1313
1347
|
return recordRoute(key, { startedAt, status: 200, body })
|
|
1314
1348
|
} catch (err) {
|
package/src/voice.js
CHANGED
|
@@ -183,10 +183,15 @@ function agentState (doc, call, name, lines, now) {
|
|
|
183
183
|
return { state: '' }
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
// Whether a named agent can hear its name, from how Quilt wakes it (the relay's member list,
|
|
187
|
+
// wake.js): 'yes' at once, 'later' (on a timer, or at its person's next turn), 'no' (nothing wakes
|
|
188
|
+
// it), or '' when the list doesn't say.
|
|
189
|
+
const hearsBy = (method) => method === undefined ? '' : !method || method === 'none' ? 'no' : method === 'schedule' || method === 'turns' ? 'later' : 'yes'
|
|
190
|
+
|
|
186
191
|
/**
|
|
187
192
|
* The agents in call `call` (the one going on), while it is transcribed: those that joined it, and
|
|
188
|
-
* those just named in it that are on their way ('joining', until `joinBy
|
|
189
|
-
* the call shows unmuted until then, while it speaks (0: muted).
|
|
193
|
+
* those just named in it that are on their way ('joining', until `joinBy`, with `hears`: whether
|
|
194
|
+
* Quilt can wake it). `until`: an agent in the call shows unmuted until then, while it speaks (0: muted).
|
|
190
195
|
*/
|
|
191
196
|
export function callAgents (doc, call, members = [], now = Date.now()) {
|
|
192
197
|
if (!call || !takesAgents(doc, call) || !transcribeSetting(doc, members).on) return []
|
|
@@ -198,7 +203,7 @@ export function callAgents (doc, call, members = [], now = Date.now()) {
|
|
|
198
203
|
seen.add(m.name)
|
|
199
204
|
const st = agentState(doc, call, m.name, lines, now)
|
|
200
205
|
if (st.state === 'in') out.push({ name: m.name, state: 'in', until: agentOpenUntil(lines, [m.name]) })
|
|
201
|
-
else if (st.state === 'joining') out.push({ name: m.name, state: 'joining', until: 0, joinBy: st.joinBy })
|
|
206
|
+
else if (st.state === 'joining') out.push({ name: m.name, state: 'joining', until: 0, joinBy: st.joinBy, ...(hearsBy(m.wakeMethod) ? { hears: hearsBy(m.wakeMethod) } : {}) })
|
|
202
207
|
}
|
|
203
208
|
return out.sort((a, b) => a.name.localeCompare(b.name))
|
|
204
209
|
}
|