heyquilt 0.3.152 → 0.3.154
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 +4 -0
- package/package.json +1 -1
- package/src/account.js +7 -0
- package/src/protocol.js +1 -1
- package/src/runner.js +16 -4
- package/src/server.js +52 -6
- package/src/session.js +16 -0
- package/src/ui/account-sessions.js +90 -0
- package/src/ui/app.css +8 -0
- package/src/ui/app.js +2 -2
- package/src/ui/home.js +11 -3
- package/src/ui/invite.js +8 -0
- package/src/ui/session.js +6 -3
- package/src/ui-server.js +26 -7
package/RELEASES.md
CHANGED
|
@@ -11,6 +11,10 @@ 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.154 — 2026-11-06
|
|
15
|
+
|
|
16
|
+
- **Your sessions follow your account.** On a new computer, Home now lists the sessions you've been in that aren't on this computer yet. Click **Join here** and choose a folder, or pick the folder you already have the project in. You don't need an invite link: the session lets you back in because you're its owner or one of its members. Once you're in, the session's invite links come to this computer too. Anyone who was never in the session still needs an invite link.
|
|
17
|
+
|
|
14
18
|
## 0.3.152 — 2026-11-06
|
|
15
19
|
|
|
16
20
|
- **Agents no longer join calls.** Calls are for people again: saying an agent's name in a call doesn't bring it in or send it anything. Agents can still read what was said in a transcribed call.
|
package/package.json
CHANGED
package/src/account.js
CHANGED
|
@@ -149,6 +149,13 @@ export async function fetchMe ({ token, api = apiUrl(), fetch: fetchImpl = globa
|
|
|
149
149
|
return (await call(fetchImpl, api, 'GET', '/v1/me', null, token)).profile
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
/** The sessions you've been in, newest first: [{ room, name, owner: { name }, mine, lastActiveAt, live, people, … }]. */
|
|
153
|
+
export async function listMySessions ({ token, api = apiUrl(), fetch: fetchImpl = globalThis.fetch }) {
|
|
154
|
+
const r = await call(fetchImpl, api, 'GET', '/v1/me/sessions', null, token)
|
|
155
|
+
if (!Array.isArray(r.sessions)) throw new Error(BAD_REPLY)
|
|
156
|
+
return r.sessions
|
|
157
|
+
}
|
|
158
|
+
|
|
152
159
|
/**
|
|
153
160
|
* The owner renames a session on heyquilt.com: { session: { room, name } }. Throws with
|
|
154
161
|
* .status: 404 until the relay has reported the session, 403 for anyone but the owner.
|
package/src/protocol.js
CHANGED
|
@@ -12,7 +12,7 @@ export const MSG_QUERY_AWARENESS = 3
|
|
|
12
12
|
export const MSG_AUTH = 10 // relay -> client: nonce; client -> relay: signature
|
|
13
13
|
export const MSG_CLAIM = 11 // client -> relay: JSON { id, op: 'claim'|'release', pattern, note }
|
|
14
14
|
export const MSG_CLAIMS = 12 // relay -> client: JSON { claims, reply?: { id, ok, error, released } }
|
|
15
|
-
export const MSG_ACCESS = 13 // relay -> client: JSON { state: 'pending'|'approved', role, scopes, scopesExcept, talk, owner, controlled, refresh?, refused?, why? }
|
|
15
|
+
export const MSG_ACCESS = 13 // relay -> client: JSON { state: 'pending'|'approved', role, scopes, scopesExcept, talk, owner, controlled, refresh?, refused?, why?, secret?, viewSecret? } (the last two: the room's links, for someone let in by their account)
|
|
16
16
|
export const MSG_ADMIN = 14 // client (owner) -> relay: JSON { id, op: 'approve'|'deny'|'set'|'remove'|'end'|'name', key, role, scopes, access?, typeId?, name }
|
|
17
17
|
export const MSG_MEMBERS = 15 // relay -> client: JSON { members, sessionName, pending?, reply?: { id, ok, error } }
|
|
18
18
|
export const MSG_PASS = 16 // client -> relay: JSON { pass }: a fresh session pass, sent at least every 5 minutes
|
package/src/runner.js
CHANGED
|
@@ -120,9 +120,10 @@ export async function runSession ({ dir, conn, name, tool, color = null, shareBy
|
|
|
120
120
|
if (p && p.kind === 'agent') kind = 'agent'
|
|
121
121
|
name = (name || os.userInfo().username).trim()
|
|
122
122
|
tool = tool || 'unknown'
|
|
123
|
-
|
|
123
|
+
// No secret: back by your account on a computer without the link; the relay hands it over once you're in (the 'links' below).
|
|
124
|
+
let invite = conn.secret ? encodeInvite({ ...conn, server: inviteServer || conn.server }) : null
|
|
124
125
|
// Only the person who made the room has the view-only secret.
|
|
125
|
-
|
|
126
|
+
let viewInvite = conn.viewSecret ? encodeInvite({ ...conn, secret: conn.viewSecret, server: inviteServer || conn.server }) : null
|
|
126
127
|
const previous = readConfig(dir)
|
|
127
128
|
// Sharing your AI chat follows your setting; a pause or resume is remembered for this folder.
|
|
128
129
|
const shareAgent = previous && previous.room === conn.room && typeof previous.shareAgent === 'boolean' ? previous.shareAgent : shareByDefault !== false
|
|
@@ -148,6 +149,15 @@ export async function runSession ({ dir, conn, name, tool, color = null, shareBy
|
|
|
148
149
|
if (onLog) session.on('log', onLog)
|
|
149
150
|
if (onDebug) session.on('debug', onDebug)
|
|
150
151
|
session.on('fatal', (err) => onFatal && onFatal(err))
|
|
152
|
+
// The room's links, from the relay when you came in by your account: kept here, and they're this session's invites from now on.
|
|
153
|
+
let run = null
|
|
154
|
+
let extras = null
|
|
155
|
+
session.on('links', ({ secret, viewSecret }) => {
|
|
156
|
+
try { writePrivateJson(configFile, { ...JSON.parse(fs.readFileSync(configFile, 'utf8')), secret, ...(viewSecret ? { viewSecret } : {}) }) } catch {}
|
|
157
|
+
invite = encodeInvite({ ...conn, secret, server: inviteServer || conn.server })
|
|
158
|
+
if (viewSecret) viewInvite = encodeInvite({ ...conn, secret: viewSecret, server: inviteServer || conn.server })
|
|
159
|
+
for (const o of [run, extras]) if (o) Object.assign(o, { invite, viewInvite })
|
|
160
|
+
})
|
|
151
161
|
const statusFile = path.join(dir, '.quilt', 'STATUS.md')
|
|
152
162
|
// Written at most every STATUS_FILE_MS: each write works out the whole status again.
|
|
153
163
|
let statusWrite = null
|
|
@@ -179,7 +189,8 @@ export async function runSession ({ dir, conn, name, tool, color = null, shareBy
|
|
|
179
189
|
if (session.name !== name) saveName(session.name)
|
|
180
190
|
session.on('identity', ({ name }) => saveName(name))
|
|
181
191
|
// apiAuth: { api, token } for the accounts API as this session's person or agent (secrets, `quilt run`).
|
|
182
|
-
|
|
192
|
+
extras = { invite, viewInvite, joined, apiAuth }
|
|
193
|
+
const control = await startControl(session, extras)
|
|
183
194
|
remember({ dir, room: conn.room, server: conn.server, name: session.name, tool, kind, workspace: savedWorkspace })
|
|
184
195
|
|
|
185
196
|
// Every AI tool on this computer can reach Quilt (its MCP server, by absolute path), with nothing to set up.
|
|
@@ -202,7 +213,7 @@ export async function runSession ({ dir, conn, name, tool, color = null, shareBy
|
|
|
202
213
|
: null
|
|
203
214
|
|
|
204
215
|
let stopped = false
|
|
205
|
-
|
|
216
|
+
run = {
|
|
206
217
|
session,
|
|
207
218
|
invite,
|
|
208
219
|
viewInvite,
|
|
@@ -217,6 +228,7 @@ export async function runSession ({ dir, conn, name, tool, color = null, shareBy
|
|
|
217
228
|
await session.stop()
|
|
218
229
|
}
|
|
219
230
|
}
|
|
231
|
+
return run
|
|
220
232
|
}
|
|
221
233
|
|
|
222
234
|
/** Keep .quilt/ and this person's hook settings out of git without editing the (synced) .gitignore. */
|
package/src/server.js
CHANGED
|
@@ -356,13 +356,48 @@ class Room {
|
|
|
356
356
|
if (publicKey) this.meta.creator = publicKey
|
|
357
357
|
this.meta.createdAt = Date.now()
|
|
358
358
|
this.touch()
|
|
359
|
+
this.keepLinks(secret, viewSecret)
|
|
360
|
+
return 'editor'
|
|
361
|
+
}
|
|
362
|
+
if (sameSecret(hash(secret || ''), Buffer.from(this.meta.secretHash, 'hex'))) {
|
|
363
|
+
this.keepLinks(secret, viewSecret)
|
|
359
364
|
return 'editor'
|
|
360
365
|
}
|
|
361
|
-
if (sameSecret(hash(secret || ''), Buffer.from(this.meta.secretHash, 'hex'))) return 'editor'
|
|
362
366
|
if (this.controlled && sameSecret(hash(secret || ''), Buffer.from(this.meta.viewSecretHash, 'hex'))) return 'viewer'
|
|
363
367
|
return 'bad-secret'
|
|
364
368
|
}
|
|
365
369
|
|
|
370
|
+
/**
|
|
371
|
+
* Keeps the room's invite secrets once someone shows them, so a member who comes back by their
|
|
372
|
+
* account on a new computer (with no link of their own, see letsInByAccount) is handed them and
|
|
373
|
+
* can invite people from there too. They guard this relay's copy of the room, on this same disk.
|
|
374
|
+
*/
|
|
375
|
+
keepLinks (secret, viewSecret) {
|
|
376
|
+
let changed = false
|
|
377
|
+
if (secret && this.meta.joinSecret !== secret) { this.meta.joinSecret = secret; changed = true }
|
|
378
|
+
if (viewSecret && this.controlled && this.meta.viewSecret !== viewSecret && sameSecret(hash(viewSecret), Buffer.from(this.meta.viewSecretHash, 'hex'))) { this.meta.viewSecret = viewSecret; changed = true }
|
|
379
|
+
if (changed) this.saveMeta()
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* True when this room pass's account is let straight in here (the owner, a member, someone
|
|
384
|
+
* with a grant, a member's cloud AI): your sessions follow your account, so on a computer
|
|
385
|
+
* that never had the invite link you come back in without it. Older rooms, with no owner
|
|
386
|
+
* to approve anyone, still need the link.
|
|
387
|
+
*/
|
|
388
|
+
letsInByAccount (pass) {
|
|
389
|
+
if (!this.controlled || !pass || pass.room !== this.name) return false
|
|
390
|
+
const account = `${pass.kind}:${pass.sub}`
|
|
391
|
+
if (this.meta.ownerSub === account) return true
|
|
392
|
+
return !!(this.passGrant(pass) || this.storedMember(account, pass) || this.cloudAiStanding(pass))
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/** authorize for a session's HTTP routes: with no secret, only someone let in by their account, and never a new room. */
|
|
396
|
+
authorizeRoute (secret, key, pass) {
|
|
397
|
+
if (secret) return this.authorize(secret, key)
|
|
398
|
+
return this.exists && this.letsInByAccount(pass) ? 'viewer' : 'bad-secret'
|
|
399
|
+
}
|
|
400
|
+
|
|
366
401
|
/**
|
|
367
402
|
* Where someone stands when they sign in: let in now (with a role), or wait
|
|
368
403
|
* for the owner. `account` is '<kind>:<sub>' from their pass when sign-in is
|
|
@@ -3617,7 +3652,9 @@ class Room {
|
|
|
3617
3652
|
if (this.cloudAiWaker) this.cloudAiWaker.personActive(this, ws).catch(() => {})
|
|
3618
3653
|
// Back with a pass from before the owner's last change: a newer one may allow more.
|
|
3619
3654
|
const refresh = !a.owner && this.passPredatesChange(ws.pass) ? { refresh: true } : {}
|
|
3620
|
-
|
|
3655
|
+
// In by their account, with no link of their own: the room's links, to invite people from there.
|
|
3656
|
+
const links = ws.byAccount ? { ...(this.meta.joinSecret ? { secret: this.meta.joinSecret } : {}), ...(a.owner && this.meta.viewSecret ? { viewSecret: this.meta.viewSecret } : {}) } : {}
|
|
3657
|
+
send(ws, jsonMessage(MSG_ACCESS, { ...this.accessMessage(a), ...refresh, ...links }))
|
|
3621
3658
|
this.join(ws, a.name)
|
|
3622
3659
|
this.broadcastMembers()
|
|
3623
3660
|
}
|
|
@@ -4719,7 +4756,7 @@ export function startServer ({ port = 4321, host = '0.0.0.0', dataDir = null, lo
|
|
|
4719
4756
|
if (!room) return text(...refused(name))
|
|
4720
4757
|
const creating = !room.exists
|
|
4721
4758
|
if (creating && !canCreate(starter)) { dropIfUnused(room); return text(429, TOO_MANY) }
|
|
4722
|
-
const auth = room.
|
|
4759
|
+
const auth = room.authorizeRoute(req.headers['x-quilt-secret'] || '', req.headers['x-quilt-key'] || '', pass)
|
|
4723
4760
|
if (auth === 'need-key' || auth === 'bad-secret') {
|
|
4724
4761
|
dropIfUnused(room)
|
|
4725
4762
|
return text(auth === 'need-key' ? 403 : 401, auth === 'need-key' ? 'this relay needs a key to create rooms' : 'wrong room secret')
|
|
@@ -4765,7 +4802,7 @@ export function startServer ({ port = 4321, host = '0.0.0.0', dataDir = null, lo
|
|
|
4765
4802
|
if (!room) return text(...refused(name))
|
|
4766
4803
|
const creating = !room.exists
|
|
4767
4804
|
if (creating && !canCreate(starter)) { dropIfUnused(room); return text(429, TOO_MANY) }
|
|
4768
|
-
const auth = room.
|
|
4805
|
+
const auth = room.authorizeRoute(req.headers['x-quilt-secret'] || req.headers['x-cowove-secret'] || '', req.headers['x-quilt-key'] || req.headers['x-cowove-key'] || '', pass)
|
|
4769
4806
|
if (creating && auth !== 'need-key' && auth !== 'bad-secret') noteCreated(starter)
|
|
4770
4807
|
if (auth === 'need-key' || auth === 'bad-secret') {
|
|
4771
4808
|
dropIfUnused(room)
|
|
@@ -4852,12 +4889,18 @@ export function startServer ({ port = 4321, host = '0.0.0.0', dataDir = null, lo
|
|
|
4852
4889
|
const room = getRoom(name)
|
|
4853
4890
|
if (!room) return reject(socket, ...refused(name))
|
|
4854
4891
|
const creating = !room.exists
|
|
4892
|
+
// No secret is someone coming back by their account, and that never makes a session.
|
|
4893
|
+
if (creating && !secret) { dropIfUnused(room); return reject(socket, 401, NOT_IN_SESSION) }
|
|
4855
4894
|
if (creating && !canCreate(starter)) { dropIfUnused(room); return reject(socket, 429, 'Too many new sessions') }
|
|
4856
|
-
|
|
4895
|
+
let auth = room.authorize(secret, relayKey, viewSecret, publicKey)
|
|
4896
|
+
// Let in by their account (letsInByAccount). Should the owner take that away before they sign
|
|
4897
|
+
// in, they wait like anyone else, offered view only.
|
|
4898
|
+
const byAccount = auth === 'bad-secret' && !secret && room.letsInByAccount(pass)
|
|
4899
|
+
if (byAccount) auth = 'viewer'
|
|
4857
4900
|
if (creating && auth !== 'need-key' && auth !== 'bad-secret') noteCreated(starter)
|
|
4858
4901
|
if (auth === 'need-key' || auth === 'bad-secret') {
|
|
4859
4902
|
dropIfUnused(room)
|
|
4860
|
-
return reject(socket, auth === 'need-key' ? 403 : 401, auth === 'need-key' ? 'Relay key required to create rooms' : 'Wrong room secret')
|
|
4903
|
+
return reject(socket, auth === 'need-key' ? 403 : 401, auth === 'need-key' ? 'Relay key required to create rooms' : secret ? 'Wrong room secret' : NOT_IN_SESSION)
|
|
4861
4904
|
}
|
|
4862
4905
|
// Checked after the secret, so only members learn what the session needs.
|
|
4863
4906
|
const noQuilt = room.meta.layout === LAYOUT_QUILT && !(features.includes('quilts') && features.includes('quilt-folders'))
|
|
@@ -4872,6 +4915,7 @@ export function startServer ({ port = 4321, host = '0.0.0.0', dataDir = null, lo
|
|
|
4872
4915
|
ws.on('error', (err) => log(`[${name}] dropping ${person}: ${err.message}`))
|
|
4873
4916
|
ws.roomName = name
|
|
4874
4917
|
ws.features = features
|
|
4918
|
+
ws.byAccount = byAccount
|
|
4875
4919
|
// Which app or AI tool this is ("Quilt app", "Cursor"), for the audit trail; the app says so if it knows.
|
|
4876
4920
|
ws.tool = header('x-quilt-tool').replace(/[^\w .()/+-]/g, '').trim().slice(0, 40)
|
|
4877
4921
|
if (pass) { ws.passKey = passKey; trackPass(ws, pass) }
|
|
@@ -5131,6 +5175,8 @@ function receiveBlob (req, file, limit, done) {
|
|
|
5131
5175
|
const TOO_BIG = 'Session over the size limit'
|
|
5132
5176
|
const UNREADABLE = "This session's data can't be read on the relay right now"
|
|
5133
5177
|
const ENDED_MESSAGE = 'The owner ended this session'
|
|
5178
|
+
// Coming back by account (no invite link) to a session that doesn't let this account in, or isn't here.
|
|
5179
|
+
const NOT_IN_SESSION = "You aren't in this session any more. Ask its owner for an invite link"
|
|
5134
5180
|
const NEEDS_UPDATE = needsUpdateWords()
|
|
5135
5181
|
// How many of a branch's moves to its next square the relay remembers, to send a late edit on (movedOnTo).
|
|
5136
5182
|
const MOVED_ON_KEPT = 50
|
package/src/session.js
CHANGED
|
@@ -748,6 +748,11 @@ export class Session extends EventEmitter {
|
|
|
748
748
|
// --------------------------------------------------------------- access --
|
|
749
749
|
|
|
750
750
|
setAccess (a) {
|
|
751
|
+
if (a.secret || a.viewSecret) {
|
|
752
|
+
const { secret, viewSecret, ...rest } = a
|
|
753
|
+
this.adoptLinks({ secret, viewSecret })
|
|
754
|
+
a = rest
|
|
755
|
+
}
|
|
751
756
|
const was = this.access
|
|
752
757
|
this.access = a
|
|
753
758
|
if (a.state === 'approved' && a.owner) this.sendStartName()
|
|
@@ -769,6 +774,17 @@ export class Session extends EventEmitter {
|
|
|
769
774
|
this.scheduleStatusWrite()
|
|
770
775
|
}
|
|
771
776
|
|
|
777
|
+
/**
|
|
778
|
+
* The room's links, from the relay to someone let in by their account on a computer that never
|
|
779
|
+
* had them (the room's secrets: large files and invites need them). runner.js saves them.
|
|
780
|
+
*/
|
|
781
|
+
adoptLinks ({ secret, viewSecret }) {
|
|
782
|
+
const was = `${this.secret}\n${this.viewSecret}`
|
|
783
|
+
if (typeof secret === 'string' && secret && !this.secret) this.secret = secret
|
|
784
|
+
if (typeof viewSecret === 'string' && viewSecret && !this.viewSecret) this.viewSecret = viewSecret
|
|
785
|
+
if (`${this.secret}\n${this.viewSecret}` !== was) this.emit('links', { secret: this.secret, viewSecret: this.viewSecret })
|
|
786
|
+
}
|
|
787
|
+
|
|
772
788
|
setMembers ({ members, pending, sessionName, admitBy }) {
|
|
773
789
|
this.members = members || []
|
|
774
790
|
if (typeof sessionName === 'string') this.sessionName = sessionName
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Your sessions follow your account: the ones you've been in (from the accounts API) that
|
|
2
|
+
// aren't on this computer yet, listed on Home under your own, to join here without a link.
|
|
3
|
+
// The relay lets you back in by your account; Join here asks only where the files go.
|
|
4
|
+
import { I, state, esc, ago, api } from './common.js'
|
|
5
|
+
import { quiltMark } from './mark.js'
|
|
6
|
+
import { joinFolderName } from './invite.js'
|
|
7
|
+
|
|
8
|
+
// Shown before "Show all": the newest first.
|
|
9
|
+
const SHOWN = 5
|
|
10
|
+
|
|
11
|
+
function rowHtml (s) {
|
|
12
|
+
const room = esc(s.room)
|
|
13
|
+
const whose = s.mine ? 'Yours' : s.owner ? `${esc(s.owner)}’s` : 'Shared with you'
|
|
14
|
+
return `
|
|
15
|
+
<div class="session-row acct-row" data-acct="${room}">
|
|
16
|
+
<div class="folder-ico">${I.globe}</div>
|
|
17
|
+
<div class="meta">
|
|
18
|
+
<div class="name">${esc(s.name || s.room)}${s.live ? '<span class="pill ok"><span class="dot"></span>Live</span>' : ''}</div>
|
|
19
|
+
<div class="sub">${whose} · not on this computer yet</div>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="facts">
|
|
22
|
+
${s.people ? `<span title="People you worked with there">${I.users}${s.people} other${s.people === 1 ? '' : 's'}</span>` : ''}
|
|
23
|
+
<span>${esc(ago(s.lastActiveAt))}</span>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="acts"><button class="btn sm" type="button" data-acct-join="${room}">Join here</button></div>
|
|
26
|
+
<form class="acct-join" autocomplete="off" hidden>
|
|
27
|
+
<label for="aj-${room}">Put the files in</label>
|
|
28
|
+
<div class="row">
|
|
29
|
+
<input class="input grow" id="aj-${room}" placeholder="${esc(state.profile.joinDir)}/${esc(joinFolderName(s.name) || s.room)}">
|
|
30
|
+
<button type="button" class="btn icon" data-acct-browse title="Browse" aria-label="Browse">${I.folder}</button>
|
|
31
|
+
<button type="button" class="btn ghost" data-acct-cancel>Cancel</button>
|
|
32
|
+
<button class="btn primary" type="submit">Join</button>
|
|
33
|
+
</div>
|
|
34
|
+
<span class="hint">Leave it empty for a new folder in ${esc(state.profile.joinDir)}, or pick the folder you already have the project in.</span>
|
|
35
|
+
<p class="error"></p>
|
|
36
|
+
</form>
|
|
37
|
+
</div>`
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Rows for Home's session list (after this computer's own). */
|
|
41
|
+
export function accountRowsHtml () {
|
|
42
|
+
const list = state.accountSessions || []
|
|
43
|
+
const shown = state.accountSessionsAll ? list : list.slice(0, SHOWN)
|
|
44
|
+
const more = list.length - shown.length
|
|
45
|
+
return shown.map(rowHtml).join('') + (more > 0
|
|
46
|
+
? `<div class="session-row acct-more"><button class="btn sm ghost" type="button" data-acct-all>Show ${more} more of your sessions</button></div>`
|
|
47
|
+
: '')
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Fetches your sessions not on this computer; true when the list changed. Quiet when signed out or offline. */
|
|
51
|
+
export async function loadAccountSessions () {
|
|
52
|
+
try {
|
|
53
|
+
const { sessions } = await api('GET', '/api/account-sessions')
|
|
54
|
+
const before = JSON.stringify(state.accountSessions || [])
|
|
55
|
+
state.accountSessions = sessions
|
|
56
|
+
return JSON.stringify(sessions) !== before
|
|
57
|
+
} catch { return false }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Answers the rows' buttons. `pickFolder(input)` browses; `opened(sum)` goes to the joined session; `rerender()` draws Home again. */
|
|
61
|
+
export function bindAccountSessions (root, { pickFolder, opened, rerender }) {
|
|
62
|
+
root.querySelector('[data-acct-all]')?.addEventListener('click', () => { state.accountSessionsAll = true; rerender() })
|
|
63
|
+
root.querySelectorAll('.acct-row').forEach((row) => {
|
|
64
|
+
const room = row.dataset.acct
|
|
65
|
+
const form = row.querySelector('.acct-join')
|
|
66
|
+
const open = row.querySelector('[data-acct-join]')
|
|
67
|
+
const input = form.querySelector('input')
|
|
68
|
+
open.onclick = () => { form.hidden = false; open.hidden = true; input.focus() }
|
|
69
|
+
form.querySelector('[data-acct-cancel]').onclick = () => { form.hidden = true; open.hidden = false; open.focus() }
|
|
70
|
+
form.querySelector('[data-acct-browse]').onclick = () => pickFolder(input)
|
|
71
|
+
form.onsubmit = async (e) => {
|
|
72
|
+
e.preventDefault()
|
|
73
|
+
const btn = form.querySelector('button[type=submit]')
|
|
74
|
+
const err = form.querySelector('.error')
|
|
75
|
+
btn.disabled = true
|
|
76
|
+
btn.innerHTML = `${quiltMark({ word: false, loop: true, cls: 'qm-inline' })}<span>Joining…</span>`
|
|
77
|
+
err.textContent = ''
|
|
78
|
+
try {
|
|
79
|
+
const s = (state.accountSessions || []).find((x) => x.room === room)
|
|
80
|
+
const sum = await api('POST', '/api/sessions', { mode: 'join', room, name: s?.name || '', dir: input.value.trim() || undefined })
|
|
81
|
+
state.accountSessions = (state.accountSessions || []).filter((s) => s.room !== room)
|
|
82
|
+
await opened(sum)
|
|
83
|
+
} catch (x) {
|
|
84
|
+
err.textContent = x.message
|
|
85
|
+
btn.disabled = false
|
|
86
|
+
btn.textContent = 'Join'
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
}
|
package/src/ui/app.css
CHANGED
|
@@ -1029,6 +1029,12 @@ details.choice-foot .hint { display: block; margin-top: 6px; }
|
|
|
1029
1029
|
.session-row .facts svg { width: 13px; height: 13px; color: var(--faint); }
|
|
1030
1030
|
.session-row .acts { display: flex; gap: 4px; align-items: center; }
|
|
1031
1031
|
.session-row.gone .sub { white-space: normal; font-family: var(--sans); }
|
|
1032
|
+
/* Your sessions from your account that aren't on this computer yet (account-sessions.js): Join here opens under the row. */
|
|
1033
|
+
.session-row.acct-row .sub { font-family: var(--sans); }
|
|
1034
|
+
.acct-join { grid-column: 1 / -1; display: grid; gap: 6px; }
|
|
1035
|
+
.acct-join label { font-size: 12.5px; font-weight: 600; }
|
|
1036
|
+
.acct-join .error:empty { display: none; }
|
|
1037
|
+
.session-row.acct-more { display: flex; justify-content: center; padding: 8px 18px; }
|
|
1032
1038
|
.folder-ico.live { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--panel)); }
|
|
1033
1039
|
.empty-card { display: flex; gap: 14px; align-items: center; padding: 20px 22px; color: var(--muted); }
|
|
1034
1040
|
.empty-card > svg { width: 22px; height: 22px; flex: none; color: var(--faint); }
|
|
@@ -1117,6 +1123,8 @@ details.choice-foot .hint { display: block; margin-top: 6px; }
|
|
|
1117
1123
|
.choices { grid-template-columns: 1fr; }
|
|
1118
1124
|
.session-row { grid-template-columns: auto minmax(0, 1fr) auto; }
|
|
1119
1125
|
.session-row .facts { grid-column: 2 / -1; grid-row: 2; }
|
|
1126
|
+
.acct-join .row { flex-wrap: wrap; }
|
|
1127
|
+
.acct-join .row > .grow { flex-basis: 100%; }
|
|
1120
1128
|
.settings-sec { gap: 14px; padding: 18px 16px; }
|
|
1121
1129
|
.choice-cards { grid-template-columns: 1fr; }
|
|
1122
1130
|
.sec-actions { flex-direction: column; align-items: stretch; }
|
package/src/ui/app.js
CHANGED
|
@@ -9,7 +9,7 @@ import { renderSignIn } from './signin.js'
|
|
|
9
9
|
import { checkRelease, openReleaseNotes } from './releases.js'
|
|
10
10
|
import { loadWorkspaces, openWorkspace, wsIdOf } from './workspaces.js'
|
|
11
11
|
import { previewBusy } from './files.js'
|
|
12
|
-
import { agentPaste } from './invite.js'
|
|
12
|
+
import { agentPaste, NO_LINK_YET } from './invite.js'
|
|
13
13
|
import { openKindMenu, kindLineHtml } from './agent-kinds.js'
|
|
14
14
|
import { messageSound, letInSound, taskSound, soundOn, playSound, unlockSounds } from './sounds.js'
|
|
15
15
|
import { watchSecretAsks } from './secrets.js'
|
|
@@ -461,7 +461,7 @@ export function openInvite (id) {
|
|
|
461
461
|
<h3 id="inv-title">Invite someone</h3>
|
|
462
462
|
<p class="lead">Send them a link. Clicking it opens the session in Quilt (after signing in). It also works with <code>quilt join <link></code>.</p>
|
|
463
463
|
<div class="label" style="margin-bottom:6px">${s.viewInvite ? 'Can edit' : 'Invite link'}</div>
|
|
464
|
-
|
|
464
|
+
${s.invite ? `<div class="codebox"><code id="inv-code">${esc(s.invite)}</code><button class="btn icon" data-copy="inv-code" title="Copy" aria-label="Copy invite link">${I.copy}</button></div>` : `<p class="hint">${esc(NO_LINK_YET)}</p>`}
|
|
465
465
|
${s.viewInvite ? `<div class="label" style="margin-bottom:6px">View only</div>
|
|
466
466
|
<div class="codebox"><code id="inv-view">${esc(s.viewInvite)}</code><button class="btn icon" data-copy="inv-view" title="Copy" aria-label="Copy view-only link">${I.copy}</button></div>` : ''}
|
|
467
467
|
${d ? `<p class="hint">Room <code>${esc(d.room)}</code> via <code>${esc(d.server)}</code></p>` : ''}
|
package/src/ui/home.js
CHANGED
|
@@ -9,6 +9,7 @@ import { updateControl } from './releases.js'
|
|
|
9
9
|
import { workspacesHtml, bindWorkspaces, workspacePageHtml, bindWorkspacePage, loadWorkspaces, openWorkspace, COLORS } from './workspaces.js'
|
|
10
10
|
import { allFilesHtml, bindAllFiles } from './files.js'
|
|
11
11
|
import { invitesHtml, bindInvites } from './invites.js'
|
|
12
|
+
import { accountRowsHtml, loadAccountSessions, bindAccountSessions } from './account-sessions.js'
|
|
12
13
|
import { agentCardHtml, bindPlacement, placeableWorkspaces } from './agent-place.js'
|
|
13
14
|
import { bindSandboxKeys } from './sandbox-keys.js'
|
|
14
15
|
import { agentsTableHtml, agentDetailsHtml } from './agents-table.js'
|
|
@@ -252,6 +253,8 @@ function sessionRowHtml (r) {
|
|
|
252
253
|
|
|
253
254
|
function homeHtml () {
|
|
254
255
|
const rows = sessionRows()
|
|
256
|
+
// Your sessions from your account that aren't on this computer yet (account-sessions.js).
|
|
257
|
+
const elsewhere = (state.accountSessions || []).length
|
|
255
258
|
return `
|
|
256
259
|
<header class="page-head">
|
|
257
260
|
<h1>${greeting()}, ${esc(firstName())}</h1>
|
|
@@ -259,14 +262,14 @@ function homeHtml () {
|
|
|
259
262
|
</header>
|
|
260
263
|
<section class="invites" id="invites-slot"${(state.invites || []).length ? '' : ' hidden'}>${invitesHtml()}</section>
|
|
261
264
|
|
|
262
|
-
${state.workspacesOn ? workspacesHtml() : rows.length ? `
|
|
265
|
+
${state.workspacesOn ? workspacesHtml() : rows.length || elsewhere ? `
|
|
263
266
|
<section class="sessions">
|
|
264
|
-
<div class="sec-head"><h2>Your sessions</h2><span class="count">${rows.length}</span>
|
|
267
|
+
<div class="sec-head"><h2>Your sessions</h2><span class="count">${rows.length + elsewhere}</span>
|
|
265
268
|
<span class="spacer"></span>
|
|
266
269
|
<button class="btn sm" data-join-session>${I.link}<span>Join</span></button>
|
|
267
270
|
<button class="btn sm primary" data-new-session>${I.plus}<span>New session</span></button>
|
|
268
271
|
</div>
|
|
269
|
-
<div class="card session-list">${rows.map(sessionRowHtml).join('')}</div>
|
|
272
|
+
<div class="card session-list">${rows.map(sessionRowHtml).join('')}${accountRowsHtml()}</div>
|
|
270
273
|
</section>` : `
|
|
271
274
|
<section class="card welcome">
|
|
272
275
|
<div class="welcome-steps">
|
|
@@ -287,6 +290,11 @@ function bindHome () {
|
|
|
287
290
|
page.querySelectorAll('.session-list [data-go]').forEach((b) => { b.onclick = () => go(b.dataset.go) })
|
|
288
291
|
if (state.workspacesOn) bindWorkspaces(page, { go, rerender: () => renderShell('home') })
|
|
289
292
|
bindInvites(page, { joinDialog: joinSessionDialog, after: async () => { await loadWorkspaces(); if (state.view === 'home') renderShell('home') } })
|
|
293
|
+
if (!state.workspacesOn) {
|
|
294
|
+
bindAccountSessions(page, { pickFolder, opened: async (sum) => { state.sessions.set(sum.id, sum); await go(sum.id) }, rerender: () => renderShell('home') })
|
|
295
|
+
// Drawn again only when the list changed, so a Join here being filled in isn't lost.
|
|
296
|
+
loadAccountSessions().then((changed) => { if (changed && state.view === 'home' && !page.querySelector('.acct-join:not([hidden])')) renderShell('home') })
|
|
297
|
+
}
|
|
290
298
|
page.querySelectorAll('[data-forget]').forEach((b) => {
|
|
291
299
|
b.onclick = async () => {
|
|
292
300
|
try {
|
package/src/ui/invite.js
CHANGED
|
@@ -9,6 +9,14 @@ export const JOIN_URL = `https://${JOIN_HOST}`
|
|
|
9
9
|
|
|
10
10
|
export const MISSING_SECRET = 'This link is missing part of it. Ask for a new invite.'
|
|
11
11
|
export const INVALID_INVITE = 'That invite link is not valid. Copy the whole link they sent.'
|
|
12
|
+
// Back in a session by your account on a computer that never had its link: the relay hands it over
|
|
13
|
+
// once someone who has it has opened the session since.
|
|
14
|
+
export const NO_LINK_YET = "This session's invite link isn't on this computer yet. It arrives once someone who has it opens the session."
|
|
15
|
+
|
|
16
|
+
/** A session's name as a folder name (one plain path segment), or '' when nothing of it is left. */
|
|
17
|
+
export function joinFolderName (name) {
|
|
18
|
+
return String(name || '').trim().replace(/[^A-Za-z0-9._ -]+/g, '-').replace(/^[.\s-]+|[\s-]+$/g, '').slice(0, 60)
|
|
19
|
+
}
|
|
12
20
|
|
|
13
21
|
// A room name becomes a folder name when joining, so it may never carry a path.
|
|
14
22
|
const ROOM = /^[A-Za-z0-9_-]{1,64}$/
|
package/src/ui/session.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { mountSecrets } from './secrets.js'
|
|
5
5
|
import { TOKEN, I, state, $, esc, basename, bytes, clock, ago, avatar, colorFor, toast, api, ask, remember, recall, toolsOf, NO_POSTING, ACCOUNT_KEY, loadAccessTypes, typeOptions, accessLine, loadingHtml, loadingNote } from './common.js'
|
|
6
6
|
import { openInvite, renderTabs, markRead, go } from './app.js'
|
|
7
|
+
import { NO_LINK_YET } from './invite.js'
|
|
7
8
|
import { renderFeed } from './feed.js'
|
|
8
9
|
import { renderLoom, resetLoom, focusFile, showsLoom } from './loom.js'
|
|
9
10
|
import { buildLoom, foldAiLanes, aiWorking } from './loom-model.js'
|
|
@@ -1462,7 +1463,9 @@ function bindMain () {
|
|
|
1462
1463
|
const copy = e.target.closest('[data-copy-invite]')
|
|
1463
1464
|
if (copy) {
|
|
1464
1465
|
const view = copy.dataset.copyInvite === 'view'
|
|
1465
|
-
|
|
1466
|
+
const link = view ? sum().viewInvite : sum().invite
|
|
1467
|
+
if (!link) return toast(NO_LINK_YET)
|
|
1468
|
+
try { await navigator.clipboard.writeText(link); toast(view ? 'View-only link copied' : 'Invite link copied') } catch { openInvite(current) }
|
|
1466
1469
|
return
|
|
1467
1470
|
}
|
|
1468
1471
|
const b = e.target.closest('[data-person]')
|
|
@@ -2244,9 +2247,9 @@ function renderMain () {
|
|
|
2244
2247
|
<div class="invite-pair">
|
|
2245
2248
|
<div><div class="label">Can edit</div><div class="codebox"><code>${esc(invite)}</code></div><button class="btn primary" data-copy-invite="edit">${I.copy}<span>Copy edit link</span></button></div>
|
|
2246
2249
|
<div><div class="label">View only</div><div class="codebox"><code>${esc(viewInvite)}</code></div><button class="btn" data-copy-invite="view">${I.copy}<span>Copy view link</span></button></div>
|
|
2247
|
-
</div>` : `
|
|
2250
|
+
</div>` : invite ? `
|
|
2248
2251
|
<div class="codebox"><code id="empty-invite">${esc(invite)}</code></div>
|
|
2249
|
-
<button class="btn primary" data-copy-invite="edit">${I.copy}<span>Copy invite link</span></button>`}
|
|
2252
|
+
<button class="btn primary" data-copy-invite="edit">${I.copy}<span>Copy invite link</span></button>` : `<p class="hint">${esc(NO_LINK_YET)}</p>`}
|
|
2250
2253
|
<p class="hint small">Once they join, you'll see their AI chat here as it happens.</p>
|
|
2251
2254
|
</div>`
|
|
2252
2255
|
return
|
package/src/ui-server.js
CHANGED
|
@@ -20,12 +20,12 @@ 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, speakVoiceStream, 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, 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'
|
|
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'
|
|
27
27
|
import { personPasses, personApiAuth } from './pass-source.js'
|
|
28
|
-
import { INVALID_INVITE } from './ui/invite.js'
|
|
28
|
+
import { INVALID_INVITE, NO_LINK_YET, joinFolderName } from './ui/invite.js'
|
|
29
29
|
import { seamResultWords } from './ui/seam-model.js'
|
|
30
30
|
import { loadIdentity } from './identity.js'
|
|
31
31
|
import { currentVersion, localReleases, latestRelease, compareVersions, downloadUrl, seenVersion, markSeen, hiddenUpdate, hideUpdate } from './releases.js'
|
|
@@ -197,6 +197,7 @@ export const STATIC = {
|
|
|
197
197
|
'/schedule.js': ['schedule.js', 'text/javascript; charset=utf-8'],
|
|
198
198
|
'/workspaces.js': ['workspaces.js', 'text/javascript; charset=utf-8'],
|
|
199
199
|
'/invites.js': ['invites.js', 'text/javascript; charset=utf-8'],
|
|
200
|
+
'/account-sessions.js': ['account-sessions.js', 'text/javascript; charset=utf-8'],
|
|
200
201
|
'/agent-place.js': ['agent-place.js', 'text/javascript; charset=utf-8'],
|
|
201
202
|
'/agent-kinds.js': ['agent-kinds.js', 'text/javascript; charset=utf-8'],
|
|
202
203
|
'/agents-table.js': ['agents-table.js', 'text/javascript; charset=utf-8'],
|
|
@@ -411,7 +412,19 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
411
412
|
pushTimers.set(id, t)
|
|
412
413
|
}
|
|
413
414
|
|
|
414
|
-
|
|
415
|
+
// One of your sessions that isn't on this computer yet: joined by its room, with no link (accountSessions).
|
|
416
|
+
const byRoom = (room) => {
|
|
417
|
+
if (!/^[A-Za-z0-9_-]{1,64}$/.test(String(room))) throw httpError(400, 'Which session?')
|
|
418
|
+
return { server: relayUrl(), room: String(room), secret: '' }
|
|
419
|
+
}
|
|
420
|
+
// Its folder is named after the session when that folder is free, otherwise after its room.
|
|
421
|
+
const byRoomFolder = (joinDir, room, name) => {
|
|
422
|
+
const base = joinFolderName(name)
|
|
423
|
+
const dir = base && underJoinDir(joinDir, base)
|
|
424
|
+
return dir && !fs.existsSync(dir) ? dir : underJoinDir(joinDir, room)
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
async function start ({ mode, dir, tool, invite, room, name, prefer, workspace }) {
|
|
415
428
|
// New session from GitHub went in 16's R2: new sessions are quilts (quilt-default.js), and a repository's history comes into Seam by its import.
|
|
416
429
|
if (mode === 'github') throw httpError(410, GITHUB_GONE)
|
|
417
430
|
const me = profile()
|
|
@@ -425,8 +438,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
425
438
|
tool = tool || me.tool
|
|
426
439
|
prefer = prefer || (me.preferLocal ? 'local' : 'remote')
|
|
427
440
|
if (mode === 'join' && !dir) {
|
|
428
|
-
|
|
429
|
-
dir = underJoinDir(me.joinDir, inv.room)
|
|
441
|
+
dir = room ? byRoomFolder(me.joinDir, byRoom(room).room, name) : underJoinDir(me.joinDir, decodeInvite(invite || '').room)
|
|
430
442
|
}
|
|
431
443
|
if (!dir) throw new Error('Choose a project folder.')
|
|
432
444
|
dir = path.resolve(expandHome(dir))
|
|
@@ -436,7 +448,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
436
448
|
let conn
|
|
437
449
|
let inviteServer
|
|
438
450
|
if (mode === 'join') {
|
|
439
|
-
conn = decodeInvite(invite || '')
|
|
451
|
+
conn = room ? byRoom(room) : decodeInvite(invite || '')
|
|
440
452
|
} else if (mode === 'rejoin') {
|
|
441
453
|
const saved = readConfig(dir)
|
|
442
454
|
if (!saved) throw new Error('No previous session in that folder.')
|
|
@@ -522,7 +534,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
522
534
|
s.doc.getArray('voiceLines').observe(pushVoice)
|
|
523
535
|
s.doc.getMap('voiceAgents').observe(pushVoice)
|
|
524
536
|
// The person's cloud AI, when they connected one, joins the sessions they join.
|
|
525
|
-
followWithCloudAi(entry.run.invite, log)
|
|
537
|
+
if (entry.run.invite) followWithCloudAi(entry.run.invite, log)
|
|
526
538
|
if (workspace && mode === 'create') {
|
|
527
539
|
// Put the new room in its workspace before anyone else connects. A failure is logged, never
|
|
528
540
|
// fatal, and the session is outside any workspace here too, as it is on the API.
|
|
@@ -912,6 +924,7 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
912
924
|
return asAccount(async (token) => {
|
|
913
925
|
const type = await typeById(token, typeId)
|
|
914
926
|
const link = type.files === 'view' && run.viewInvite ? run.viewInvite : run.invite
|
|
927
|
+
if (!link) throw httpError(409, NO_LINK_YET)
|
|
915
928
|
return { invite: await inviteToSession({ token, room: s.room, typeId, to, link }) }
|
|
916
929
|
})
|
|
917
930
|
}
|
|
@@ -1037,6 +1050,12 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1037
1050
|
}),
|
|
1038
1051
|
'POST /api/workspaces/:id/invites/:iid/cancel': (b, id, url, iid) => asAccount(async (token) => { await cancelWorkspaceInvite({ token, id: needWorkspaceId(id), inviteId: needInviteId(iid) }); return { ok: true } }),
|
|
1039
1052
|
// Invites waiting for you (workspaces, and sessions with their link); accept or decline them.
|
|
1053
|
+
// Your sessions (from your account) that aren't on this computer, to join here from Home: your sessions follow your account.
|
|
1054
|
+
'GET /api/account-sessions': () => asAccount(async (token) => {
|
|
1055
|
+
const here = new Set([...[...runs.values()].map((r) => r.run.session.room), ...recentSessions().map((r) => r.room)])
|
|
1056
|
+
const sessions = (await listMySessions({ token })).filter((s) => !here.has(s.room))
|
|
1057
|
+
return { sessions: sessions.map((s) => ({ room: s.room, name: s.name || '', owner: s.owner?.name || '', mine: !!s.mine, lastActiveAt: s.lastActiveAt || 0, live: !!s.live, people: (s.people || []).length })) }
|
|
1058
|
+
}),
|
|
1040
1059
|
'GET /api/invites': () => asAccount(async (token) => ({ invites: (await listMyInvites({ token })).filter((i) => i.kind !== 'workspace' || appWorkspaces()) })),
|
|
1041
1060
|
'POST /api/invites/:id/accept': (b, id) => asAccount(async (token) => answerMyInvite({ token, id: needInviteId(id), how: 'accept' })),
|
|
1042
1061
|
'POST /api/invites/:id/decline': (b, id) => asAccount(async (token) => answerMyInvite({ token, id: needInviteId(id), how: 'decline' })),
|