heyquilt 0.3.182 → 0.3.183

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.
Files changed (122) hide show
  1. package/README.md +101 -97
  2. package/RELEASES.md +8 -0
  3. package/bin/quilt.js +32 -32
  4. package/desktop/main.js +1 -1
  5. package/package.json +1 -1
  6. package/src/account.js +2 -2
  7. package/src/admit-policy.js +2 -2
  8. package/src/agent-join.js +3 -3
  9. package/src/agent-task-workflow.js +14 -14
  10. package/src/ai-vm.js +1 -1
  11. package/src/api/agent-placement.js +2 -2
  12. package/src/api/audit.js +1 -1
  13. package/src/api/file-paths.js +1 -1
  14. package/src/api/file-store.js +1 -1
  15. package/src/api/invite-email.js +4 -4
  16. package/src/api/join-text.js +5 -5
  17. package/src/api/notify.js +7 -7
  18. package/src/api/permissions.js +1 -1
  19. package/src/api/routes/agent-wake.js +1 -1
  20. package/src/api/routes/agents.js +2 -2
  21. package/src/api/routes/ai-vm.js +5 -5
  22. package/src/api/routes/connections.js +13 -13
  23. package/src/api/routes/grants.js +2 -2
  24. package/src/api/routes/mail.js +10 -10
  25. package/src/api/routes/relay.js +1 -1
  26. package/src/api/routes/secrets.js +11 -11
  27. package/src/api/routes/session-invites.js +5 -5
  28. package/src/api/routes/sessions.js +3 -3
  29. package/src/api/routes/workspace-agents.js +14 -14
  30. package/src/api/routes/workspace-files.js +12 -12
  31. package/src/api/routes/workspace-invites.js +5 -5
  32. package/src/api/routes/workspaces.js +11 -11
  33. package/src/api/secrets-access.js +1 -1
  34. package/src/api/server.js +3 -3
  35. package/src/api/team-access.js +1 -1
  36. package/src/api/workspace-access.js +1 -1
  37. package/src/api/workspace-reach.js +3 -3
  38. package/src/app-tools.js +10 -10
  39. package/src/autowork.js +4 -4
  40. package/src/branch-view.js +1 -1
  41. package/src/catchup.js +5 -5
  42. package/src/chat-links.js +18 -18
  43. package/src/connection.js +11 -11
  44. package/src/control.js +5 -5
  45. package/src/conversation.js +1 -1
  46. package/src/doctor.js +2 -2
  47. package/src/duties.js +1 -1
  48. package/src/fsutil.js +1 -1
  49. package/src/held.js +4 -4
  50. package/src/hooks.js +3 -3
  51. package/src/hosted-client.js +2 -2
  52. package/src/identity.js +1 -1
  53. package/src/inbox.js +1 -1
  54. package/src/key-cli.js +1 -1
  55. package/src/mail-tools.js +11 -11
  56. package/src/mcp-proxy.js +1 -1
  57. package/src/mcp.js +59 -59
  58. package/src/new-session.js +6 -6
  59. package/src/project-rules.js +2 -2
  60. package/src/relay-ask.js +2 -2
  61. package/src/relay-cluster.js +3 -3
  62. package/src/relay-live-write.js +3 -3
  63. package/src/relay-mcp.js +56 -56
  64. package/src/relay-prune.js +1 -1
  65. package/src/relay-turn-sync.js +1 -1
  66. package/src/secret-import.js +1 -1
  67. package/src/secret-names.js +6 -6
  68. package/src/secret-run.js +3 -3
  69. package/src/server.js +41 -41
  70. package/src/session-access.js +3 -3
  71. package/src/session-name.js +1 -1
  72. package/src/session.js +50 -50
  73. package/src/setup.js +7 -7
  74. package/src/status.js +2 -2
  75. package/src/tasks.js +1 -1
  76. package/src/turn-sync.js +4 -4
  77. package/src/ui/account-sessions.js +2 -2
  78. package/src/ui/agent-env-key.js +1 -1
  79. package/src/ui/agent-guide.js +35 -35
  80. package/src/ui/agent-kinds.js +8 -8
  81. package/src/ui/agent-place.js +16 -16
  82. package/src/ui/agents-table.js +6 -6
  83. package/src/ui/app.css +331 -0
  84. package/src/ui/app.js +28 -13
  85. package/src/ui/board.js +2 -2
  86. package/src/ui/catchup.js +5 -5
  87. package/src/ui/changes-seen.js +2 -2
  88. package/src/ui/changes.js +3 -3
  89. package/src/ui/cloud-ai.js +12 -12
  90. package/src/ui/common.js +1 -1
  91. package/src/ui/connections.js +1 -1
  92. package/src/ui/diffview.js +2 -2
  93. package/src/ui/feed.js +1 -1
  94. package/src/ui/feedback.js +4 -4
  95. package/src/ui/files.js +120 -14
  96. package/src/ui/fileview.js +3 -3
  97. package/src/ui/git-rule.js +3 -3
  98. package/src/ui/home.js +92 -47
  99. package/src/ui/index.html +1 -1
  100. package/src/ui/invite.js +8 -8
  101. package/src/ui/invites.js +3 -3
  102. package/src/ui/new-session.js +3 -3
  103. package/src/ui/prail-model.js +22 -0
  104. package/src/ui/prail.js +43 -0
  105. package/src/ui/project-board.js +359 -0
  106. package/src/ui/project-model.js +197 -0
  107. package/src/ui/project-pop.js +451 -0
  108. package/src/ui/projects.js +406 -0
  109. package/src/ui/sandbox-keys.js +3 -3
  110. package/src/ui/secrets-view.js +5 -5
  111. package/src/ui/session-words.js +2 -2
  112. package/src/ui/session.js +156 -43
  113. package/src/ui/tree.js +3 -3
  114. package/src/ui/voice.js +6 -6
  115. package/src/ui/workspaces.js +23 -23
  116. package/src/ui-server.js +78 -24
  117. package/src/update-check.js +2 -2
  118. package/src/voice.js +7 -7
  119. package/src/wake-tool.js +1 -1
  120. package/src/webhooks.js +1 -1
  121. package/src/workspace-cli.js +12 -12
  122. package/src/workspace-tools.js +33 -33
@@ -322,7 +322,7 @@ export function aiVmRoutes ({ store, person, agentAuth, bearer, now, apiUrl, log
322
322
  out.sessionsMode = b.sessionsMode
323
323
  }
324
324
  if (b.rooms !== undefined) {
325
- if (!Array.isArray(b.rooms) || b.rooms.length > 200 || !b.rooms.every((r) => ROOM.test(String(r)))) throw new HttpError(400, 'rooms: session names')
325
+ if (!Array.isArray(b.rooms) || b.rooms.length > 200 || !b.rooms.every((r) => ROOM.test(String(r)))) throw new HttpError(400, 'rooms: codebase names')
326
326
  out.rooms = [...new Set(b.rooms.map(String))]
327
327
  }
328
328
  if (b.tool !== undefined) {
@@ -431,13 +431,13 @@ export function aiVmRoutes ({ store, person, agentAuth, bearer, now, apiUrl, log
431
431
  const { u, vm } = await mine(req)
432
432
  const f = liveOf(u.userId).forVm
433
433
  if (body.leave === true) {
434
- if (!ROOM.test(String(body.room || ''))) throw new HttpError(400, 'room must be a session name')
434
+ if (!ROOM.test(String(body.room || ''))) throw new HttpError(400, 'room must be a codebase name')
435
435
  f.follow = f.follow.filter((l) => parseInvite(l, { allowRelay: () => true }).room !== body.room)
436
436
  if (!f.leave.includes(body.room)) f.leave = [...f.leave, body.room].slice(-MAX_PENDING)
437
437
  } else {
438
438
  let invite
439
- try { invite = parseInvite(String(body.link || ''), { allowRelay: (s) => isHostedRelay(s) || String(s).replace(/\/+$/, '') === ownRelay }) } catch { throw new HttpError(400, "link must be a Quilt session's invite link") }
440
- if (!invite.secret) throw new HttpError(400, "link must be a Quilt session's invite link")
439
+ try { invite = parseInvite(String(body.link || ''), { allowRelay: (s) => isHostedRelay(s) || String(s).replace(/\/+$/, '') === ownRelay }) } catch { throw new HttpError(400, "link must be a Quilt codebase's invite link") }
440
+ if (!invite.secret) throw new HttpError(400, "link must be a Quilt codebase's invite link")
441
441
  // A session its person didn't choose for it: not joined (its app hands over every session).
442
442
  if (!joins(vm, invite.room)) return { ok: true, joins: false }
443
443
  const link = buildInvite({ server: invite.relay || HOSTED_RELAY, room: invite.room, secret: invite.secret }, isHostedRelay)
@@ -561,7 +561,7 @@ export function aiVmRoutes ({ store, person, agentAuth, bearer, now, apiUrl, log
561
561
  if (now() - last < RELAY_WAKE_MS) return { ok: true, already: true }
562
562
  relayWokeAt.set(agentId, now())
563
563
  if (relayWokeAt.size > 10_000) relayWokeAt.delete(relayWokeAt.keys().next().value)
564
- await wake(vm, `waiting in ${ROOM.test(String(body.room)) ? body.room : 'a session'}`)
564
+ await wake(vm, `waiting in ${ROOM.test(String(body.room)) ? body.room : 'a codebase'}`)
565
565
  return { ok: true }
566
566
  }]
567
567
  ]
@@ -70,18 +70,18 @@ export function connectionRoutes (ctx) {
70
70
  return { type, id: a.org.id, name: a.org.name, levels: [{ type, id: a.org.id, name: a.org.name }], canManage: a.can('org', 'u'), me }
71
71
  }
72
72
  if (type === 'workspace') {
73
- const r = await reach(req, needId(rawId, 'workspace'))
73
+ const r = await reach(req, needId(rawId, 'project'))
74
74
  return { type, id: r.ws.id, name: r.ws.name, levels: await workspaceLevels(store, r.ws), canManage: !!r.access.admin, me }
75
75
  }
76
76
  const room = String(rawId)
77
- if (!ROOM.test(room)) throw new HttpError(404, 'no such session')
77
+ if (!ROOM.test(room)) throw new HttpError(404, 'no such codebase')
78
78
  const found = await roomLevels(store, room)
79
- if (!found || !(await sessionMember(store, room, me.account))) throw new HttpError(404, 'no such session')
79
+ if (!found || !(await sessionMember(store, room, me.account))) throw new HttpError(404, 'no such codebase')
80
80
  // Anyone in the session connects apps for it (the owner removes any; others their own).
81
81
  return { type, id: room, name: found.session.name || '', levels: found.levels, canManage: true, owner: found.session.ownerAccount === me.account, me, session: found.session }
82
82
  }
83
83
 
84
- const needManage = (s) => { if (!s.canManage) throw new HttpError(403, s.type === 'org' ? 'Only the team\'s owner, or a role with Org settings: Update, connects apps for the team.' : 'Only the workspace\'s admins connect apps for it.') }
84
+ const needManage = (s) => { if (!s.canManage) throw new HttpError(403, s.type === 'org' ? 'Only the team\'s owner, or a role with Org settings: Update, connects apps for the team.' : 'Only the project\'s admins connect apps for it.') }
85
85
  const mayChange = (s, c) => s.type !== 'session' ? s.canManage : (s.owner || c.createdBy === s.me.account)
86
86
 
87
87
  /** A connection still pending at Composio: asked again, so one finished without the callback shows. */
@@ -121,11 +121,11 @@ export function connectionRoutes (ctx) {
121
121
 
122
122
  /** The caller, when a member of the session: { me, found }; otherwise 404. */
123
123
  async function member (req, room) {
124
- if (!ROOM.test(room)) throw new HttpError(404, 'no such session')
124
+ if (!ROOM.test(room)) throw new HttpError(404, 'no such codebase')
125
125
  const me = await whoCalls(req)
126
- if (!(await sessionMember(store, room, me.account, { agent: me.agent }))) throw new HttpError(404, 'no such session')
126
+ if (!(await sessionMember(store, room, me.account, { agent: me.agent }))) throw new HttpError(404, 'no such codebase')
127
127
  const found = await roomLevels(store, room)
128
- if (!found) throw new HttpError(404, 'no such session')
128
+ if (!found) throw new HttpError(404, 'no such codebase')
129
129
  return { me, found }
130
130
  }
131
131
 
@@ -155,7 +155,7 @@ export function connectionRoutes (ctx) {
155
155
  Object.assign(out, { ok: call.state === 'ran', data: s.length > MAX_ANSWER ? { truncated: true, start: s.slice(0, MAX_ANSWER) } : data, error: call.error || null })
156
156
  }
157
157
  if (call.decidedBy) out.decidedBy = await nameOf(call.decidedBy)
158
- if (call.state === 'waiting') out.message = `Waiting for a person in the session to approve ${call.tool} on ${appName || call.app}: they see it in the session's chat. Call quilt_app_call again with approval "${call.id}" to get the result.`
158
+ if (call.state === 'waiting') out.message = `Waiting for a person in the codebase to approve ${call.tool} on ${appName || call.app}: they see it in the codebase's chat. Call quilt_app_call again with approval "${call.id}" to get the result.`
159
159
  if (call.state === 'declined') out.message = `${out.decidedBy || 'A person'} declined ${call.tool}: don't run it again unless they ask you to.`
160
160
  return out
161
161
  }
@@ -210,7 +210,7 @@ export function connectionRoutes (ctx) {
210
210
  const s = await scopeOf(req, type, id)
211
211
  const c = await store.appConnectionById(needId(cid, 'connection'))
212
212
  if (!c || c.scopeType !== s.type || c.scopeId !== s.id) throw new HttpError(404, 'no such connection')
213
- if (!mayChange(s, c)) throw new HttpError(403, 'Only whoever connected it, or the session\'s owner, changes it.')
213
+ if (!mayChange(s, c)) throw new HttpError(403, 'Only whoever connected it, or the codebase\'s owner, changes it.')
214
214
  if (body.who !== 'all' && body.who !== 'people') throw new HttpError(400, 'who is "all" or "people"')
215
215
  return view(await store.updateAppConnection(c.id, { who: body.who }), s.levels[0])
216
216
  }],
@@ -219,7 +219,7 @@ export function connectionRoutes (ctx) {
219
219
  const s = await scopeOf(req, type, id)
220
220
  const c = await store.appConnectionById(needId(cid, 'connection'))
221
221
  if (!c || c.scopeType !== s.type || c.scopeId !== s.id) throw new HttpError(404, 'no such connection')
222
- if (!mayChange(s, c)) throw new HttpError(403, 'Only whoever connected it, or the session\'s owner, removes it.')
222
+ if (!mayChange(s, c)) throw new HttpError(403, 'Only whoever connected it, or the codebase\'s owner, removes it.')
223
223
  await composio.remove(c.composioId)
224
224
  await store.deleteAppConnection(c.id)
225
225
  return { ok: true }
@@ -260,14 +260,14 @@ export function connectionRoutes (ctx) {
260
260
  const t = await composio.tool(toolSlug)
261
261
  const options = (await usable(me, found)).filter((x) => x.connection.app === t.app)
262
262
  const pick = body.connection ? options.find((x) => x.connection.id === body.connection) : options[0]
263
- if (!pick) throw new HttpError(400, `No ${t.app} connection you may use in this session. A person connects it in Session settings → Connections.`)
263
+ if (!pick) throw new HttpError(400, `No ${t.app} connection you may use in this codebase. A person connects it in Codebase settings → Connections.`)
264
264
  const session = found.session
265
265
  const key = capKey({ ...session, room })
266
- if (await store.countAppCalls(key, now() - DAY_MS) >= callsPerDay) throw new HttpError(429, `This ${session.workspaceId ? 'workspace' : 'session'} made its ${callsPerDay} app calls for the last day. Try again later.`)
266
+ if (await store.countAppCalls(key, now() - DAY_MS) >= callsPerDay) throw new HttpError(429, `This ${session.workspaceId ? 'project' : 'codebase'} made its ${callsPerDay} app calls for the last day. Try again later.`)
267
267
  const call = await store.addAppCall({ room, capKey: key, connectionId: pick.connection.id, app: t.app, tool: t.slug, args, readOnly: t.readOnly, state: 'waiting', account: me.account })
268
268
  if (t.readOnly) return answer(await run(call, pick.connection))
269
269
  const who = await nameOf(me.account)
270
- await sayInRoom(room, { approval: call.id, text: `${who} asks to run ${t.slug} on ${pick.connection.appName || t.app} (${LEVEL_WORDS[pick.level.type].toLowerCase()} connection): ${argsLine(args)}. A person in the session approves or declines it here.` }).catch((err) => log(`connections: tell ${room}: ${err.message}`))
270
+ await sayInRoom(room, { approval: call.id, text: `${who} asks to run ${t.slug} on ${pick.connection.appName || t.app} (${LEVEL_WORDS[pick.level.type].toLowerCase()} connection): ${argsLine(args)}. A person in the codebase approves or declines it here.` }).catch((err) => log(`connections: tell ${room}: ${err.message}`))
271
271
  return answer(await waitFor(call.id) || call, pick.connection.appName)
272
272
  }],
273
273
 
@@ -7,13 +7,13 @@ import { ownType, grantView } from '../access.js'
7
7
  export const ROOM = /^[A-Za-z0-9_-]{1,64}$/
8
8
  export const ACCOUNT = /^(person|agent):[A-Za-z0-9_-]{1,64}$/
9
9
  const EMAIL_KEY = /^[^\s@,;<>"()\\]+@[^\s@,;<>"()\\]+$/
10
- export const NOT_YET = "That session hasn't reached heyquilt.com yet. Try again in a minute."
10
+ export const NOT_YET = "That codebase hasn't reached heyquilt.com yet. Try again in a minute."
11
11
 
12
12
  /**
13
13
  * The session's owner, from their request: { me: 'person:<id>', userId, session }. 404 for a
14
14
  * session the API hasn't heard of (the relay reports new ones within seconds), 403 for anyone else.
15
15
  */
16
- export async function sessionOwner (store, person, req, room, forbidden = 'Only the session owner can change who gets in.') {
16
+ export async function sessionOwner (store, person, req, room, forbidden = "Only the codebase's owner can change who gets in.") {
17
17
  const { userId } = await person(req)
18
18
  const me = `person:${userId}`
19
19
  if (!ROOM.test(room)) throw new HttpError(404, NOT_YET)
@@ -99,9 +99,9 @@ export function mailRoutes (ctx) {
99
99
 
100
100
  /** The caller, when they are a member of the session; otherwise 404 (no hint the session exists). */
101
101
  async function member (req, room) {
102
- if (!ROOM.test(room)) throw new HttpError(404, 'no such session')
102
+ if (!ROOM.test(room)) throw new HttpError(404, 'no such codebase')
103
103
  const me = await whoCalls(req)
104
- if (!(await sessionMember(store, room, me.account, { agent: me.agent }))) throw new HttpError(404, 'no such session')
104
+ if (!(await sessionMember(store, room, me.account, { agent: me.agent }))) throw new HttpError(404, 'no such codebase')
105
105
  return me
106
106
  }
107
107
 
@@ -173,7 +173,7 @@ export function mailRoutes (ctx) {
173
173
  })
174
174
 
175
175
  async function send (room, me, b, body) {
176
- if (!b.sending) throw new HttpError(403, "The session's owner turned sending off for this session.")
176
+ if (!b.sending) throw new HttpError(403, "The codebase's owner turned sending off for this codebase.")
177
177
  let original = null
178
178
  if (body.replyTo !== undefined) {
179
179
  if (!UUID.test(String(body.replyTo)) || !(original = await store.mailById(room, String(body.replyTo)))) throw new HttpError(404, 'no such message to reply to')
@@ -198,7 +198,7 @@ export function mailRoutes (ctx) {
198
198
  if (bytes > MAX_SEND_BYTES) throw new HttpError(413, 'A message is at most 5 MiB with its attachments.')
199
199
  // Counted before sending, so messages sent at once can't slip past the day's limit together.
200
200
  const sent = await store.countSentMail(room, now() - DAY_MS)
201
- if (sent >= sendPerDay) throw new HttpError(429, `This session has sent its ${sendPerDay} emails for today; try again tomorrow.`)
201
+ if (sent >= sendPerDay) throw new HttpError(429, `This codebase has sent its ${sendPerDay} emails for today; try again tomorrow.`)
202
202
 
203
203
  const from = mailAddress(b.localPart)
204
204
  const headers = { 'X-Quilt-Session': room }
@@ -326,7 +326,7 @@ export function mailRoutes (ctx) {
326
326
  if (!address) return { sent: false, why: 'not woken by email' }
327
327
  const events = Array.isArray(payload && payload.events) && payload.events.length ? payload.events : [payload]
328
328
  const room = String((events[0] && events[0].session) || '')
329
- if (!ROOM.test(room)) throw new HttpError(400, 'which session')
329
+ if (!ROOM.test(room)) throw new HttpError(400, 'which codebase')
330
330
  if (!cf) throw new HttpError(503, 'Sending email is not set up on this server.')
331
331
  limitWakeMail(account)
332
332
  const session = await store.sessionByRoom(room)
@@ -338,7 +338,7 @@ export function mailRoutes (ctx) {
338
338
  if (p.event === 'chat.mention') return `${who} mentioned you: ${text}`
339
339
  if (p.event === 'chat.dm') return `${who} wrote to you: ${text}`
340
340
  if (p.event === 'task.assigned') return `${who} handed you a task: "${text}"${p.task && p.task.id ? ` (task ${p.task.id})` : ''}`
341
- if (p.event === 'email.received') return `New email for the session: ${text}${p.mail && p.mail.id ? ` (read it with quilt_mail, read: "${p.mail.id}")` : ''}`
341
+ if (p.event === 'email.received') return `New email for the codebase: ${text}${p.mail && p.mail.id ? ` (read it with quilt_mail, read: "${p.mail.id}")` : ''}`
342
342
  if (p.event === 'webhook.test') return 'A test from Quilt: email wake works.'
343
343
  return `${who}: ${text}`
344
344
  }
@@ -352,8 +352,8 @@ export function mailRoutes (ctx) {
352
352
  const text = [
353
353
  ...events.map((p) => `- ${line(p)}`),
354
354
  '',
355
- `Answer in Quilt, in session ${room} (${sessionName}): quilt_message with session "${room}", or quilt_inbox to see what waits for you there.`,
356
- 'A reply to this email goes to the session\'s mailbox, not into its chat.'
355
+ `Answer in Quilt, in codebase ${room} (${sessionName}): quilt_message with session "${room}", or quilt_inbox to see what waits for you there.`,
356
+ 'A reply to this email goes to the codebase\'s mailbox, not into its chat.'
357
357
  ].join('\n')
358
358
  await cf.send({ from: { address: mailAddress(b.localPart), name: `Quilt · ${sessionName}`.slice(0, 100) }, to: [address], subject: subject.replace(/[\r\n]+/g, ' ').slice(0, 300), text, headers: { 'X-Quilt-Session': room } })
359
359
  return { sent: true, count: events.length }
@@ -403,7 +403,7 @@ export function mailRoutes (ctx) {
403
403
  const b = await mailboxOf(room, me.account)
404
404
  const rest = (b.wake || []).filter((n) => n.toLowerCase() !== name.toLowerCase())
405
405
  const wake = body.on === false ? rest : [...rest, name]
406
- if (wake.length > MAX_WAKE) throw new HttpError(400, `At most ${MAX_WAKE} email agents a session.`)
406
+ if (wake.length > MAX_WAKE) throw new HttpError(400, `At most ${MAX_WAKE} email agents a codebase.`)
407
407
  const sent = await store.countSentMail(room, now() - DAY_MS)
408
408
  return boxView(await store.updateMailbox(b.localPart, { wake }), sent)
409
409
  }],
@@ -411,7 +411,7 @@ export function mailRoutes (ctx) {
411
411
  ['PUT', /^\/v1\/sessions\/([^/]+)\/mail\/sending$/, async (req, body, [room]) => {
412
412
  const me = await member(req, room)
413
413
  const session = await store.sessionByRoom(room)
414
- if (!session || session.ownerAccount !== me.account) throw new HttpError(403, "Only the session's owner can turn sending on or off.")
414
+ if (!session || session.ownerAccount !== me.account) throw new HttpError(403, "Only the codebase's owner can turn sending on or off.")
415
415
  const b = await mailboxOf(room, me.account)
416
416
  const sent = await store.countSentMail(room, now() - DAY_MS)
417
417
  return boxView(await store.updateMailbox(b.localPart, { sending: body.on !== false }), sent)
@@ -80,7 +80,7 @@ export function relayRoutes ({ store, now, log, bearer, relaySecret }) {
80
80
  if (t - prunedAt >= DAY_MS) {
81
81
  prunedAt = t
82
82
  await store.pruneActivity({ before: t - KEEP_MS, seenBefore: t - SEEN_MS })
83
- .catch((err) => log(`could not prune session activity: ${err?.message || err}`))
83
+ .catch((err) => log(`could not prune codebase activity: ${err?.message || err}`))
84
84
  }
85
85
  return { ok: true, applied, skipped: body.events.length - events.length }
86
86
  }, { maxBody: PRESENCE_BODY }],
@@ -94,17 +94,17 @@ export function secretRoutes (ctx) {
94
94
  return { type, id: a.org.id, name: a.org.name, slug: a.org.slug, levels: [{ type, id: a.org.id, name: a.org.name, slug: a.org.slug }], canManage: a.can('org', 'u'), me }
95
95
  }
96
96
  if (type === 'workspace') {
97
- const r = await reach(req, needId(rawId, 'workspace'))
97
+ const r = await reach(req, needId(rawId, 'project'))
98
98
  return { type, id: r.ws.id, name: r.ws.name, levels: await workspaceLevels(store, r.ws), canManage: !!r.access.admin, me, ws: r.ws }
99
99
  }
100
100
  const room = String(rawId)
101
- if (!ROOM.test(room)) throw new HttpError(404, 'no such session')
101
+ if (!ROOM.test(room)) throw new HttpError(404, 'no such codebase')
102
102
  const found = await roomLevels(store, room)
103
- if (!found || !(await sessionMember(store, room, me.account))) throw new HttpError(404, 'no such session')
103
+ if (!found || !(await sessionMember(store, room, me.account))) throw new HttpError(404, 'no such codebase')
104
104
  return { type, id: room, name: found.session.name || '', levels: found.levels, canManage: found.session.ownerAccount === me.account, me, session: found.session }
105
105
  }
106
106
 
107
- const needManage = (s) => { if (!s.canManage) throw new HttpError(403, s.type === 'org' ? 'Only the team\'s owner, or a role with Org settings: Update, manages team secrets.' : s.type === 'workspace' ? 'Only the workspace\'s admins manage its secrets.' : 'Only the session owner manages its secrets.') }
107
+ const needManage = (s) => { if (!s.canManage) throw new HttpError(403, s.type === 'org' ? 'Only the team\'s owner, or a role with Org settings: Update, manages team secrets.' : s.type === 'workspace' ? 'Only the project\'s admins manage its secrets.' : "Only the codebase's owner manages its secrets.") }
108
108
 
109
109
  const rowView = (s, level, extra = {}) => ({
110
110
  id: s.id, name: s.name, level: level.type, levelName: level.name || '', digest: shortDigest(s.digest), upstream: s.upstream,
@@ -223,7 +223,7 @@ export function secretRoutes (ctx) {
223
223
  needManage(s)
224
224
  const patch = {}
225
225
  if (body.inheritOff !== undefined) {
226
- if (s.levels.length < 2) throw new HttpError(400, s.type === 'org' ? 'A team has nothing above it to switch off.' : 'Nothing above this to switch off: it is not in a workspace or team.')
226
+ if (s.levels.length < 2) throw new HttpError(400, s.type === 'org' ? 'A team has nothing above it to switch off.' : 'Nothing above this to switch off: it is not in a project or team.')
227
227
  patch.inheritOff = body.inheritOff === true
228
228
  patch.inheritOffBy = patch.inheritOff ? s.me.account : null
229
229
  patch.inheritOffAt = patch.inheritOff ? now() : null
@@ -291,9 +291,9 @@ export function secretRoutes (ctx) {
291
291
  // `quilt run` sets. Never a value.
292
292
  ['GET', /^\/v1\/sessions\/([^/]+)\/secret-names$/, async (req, body, [room]) => {
293
293
  const me = await whoCalls(req, { pass: /^QuiltPass\s/i.test(String(req.headers.authorization || '')) })
294
- if (!ROOM.test(room) || !(await sessionMember(store, room, me.account, { agent: me.agent }))) throw new HttpError(404, 'no such session')
294
+ if (!ROOM.test(room) || !(await sessionMember(store, room, me.account, { agent: me.agent }))) throw new HttpError(404, 'no such codebase')
295
295
  const names = await namesFor(room, me)
296
- if (!names) throw new HttpError(404, 'no such session')
296
+ if (!names) throw new HttpError(404, 'no such codebase')
297
297
  return { room, kind: me.kind, hosted: !!me.hosted, names: publicNames(names) }
298
298
  }],
299
299
 
@@ -303,10 +303,10 @@ export function secretRoutes (ctx) {
303
303
  const me = await whoCalls(req)
304
304
  if (me.hosted) throw new HttpError(403, 'Hosted agents run no commands, so they use no secrets.')
305
305
  const room = String(body.room || '')
306
- if (!ROOM.test(room) || !(await sessionMember(store, room, me.account, { agent: me.agent }))) throw new HttpError(404, 'no such session')
306
+ if (!ROOM.test(room) || !(await sessionMember(store, room, me.account, { agent: me.agent }))) throw new HttpError(404, 'no such codebase')
307
307
  limit(`run:${me.account}`, 120, 'too many runs; wait a minute')
308
308
  const names = await namesFor(room, me)
309
- if (!names) throw new HttpError(404, 'no such session')
309
+ if (!names) throw new HttpError(404, 'no such codebase')
310
310
  const label = String(body.label || '').replace(/[\u0000-\u001f\u007f]/g, ' ').slice(0, MAX_LABEL) // eslint-disable-line no-control-regex
311
311
  const token = newToken('qrun_')
312
312
  const run = await store.createSecretRun({ tokenHash: hashToken(token), room, account: me.account, kind: me.kind, label, expiresAt: now() + RUN_TTL_MS })
@@ -414,11 +414,11 @@ export function secretRoutes (ctx) {
414
414
  const [kind, id] = run.account.split(':')
415
415
  const agent = kind === 'agent' ? await store.agentById(id).catch(() => null) : null
416
416
  if (kind === 'agent' && (!agent || agent.revokedAt)) throw new HttpError(401, 'this agent was revoked')
417
- if (!(await sessionMember(store, run.room, run.account, { agent }))) throw new HttpError(403, 'not in this session any more')
417
+ if (!(await sessionMember(store, run.room, run.account, { agent }))) throw new HttpError(403, 'not in this codebase any more')
418
418
  const found = await roomLevels(store, run.room)
419
419
  const { effective } = await resolveLevels(store, found ? found.levels : [])
420
420
  const hit = effective.get(name)
421
- if (!hit) throw new HttpError(404, `${name.slice(0, 64)} is not a secret in this session (or it is switched off here)`)
421
+ if (!hit) throw new HttpError(404, `${name.slice(0, 64)} is not a secret in this codebase (or it is switched off here)`)
422
422
  const ask = run.kind === 'person' && hit.secret.who === 'people' ? (await store.listSecretRunAsks(run.id)).find((a) => a.secretId === hit.secret.id) || null : undefined
423
423
  const verdict = mayUse({ kind: run.kind, agentId: agent?.id || null, secret: hit.secret, level: hit.level, ask })
424
424
  if (!verdict.ok) throw new HttpError(403, `${name}: ${verdict.why}`)
@@ -12,7 +12,7 @@ import { sessionOwner, ACCOUNT, letAgentBackIn } from './grants.js'
12
12
  import { collaboratorsOf } from './sessions.js'
13
13
 
14
14
  export const SESSION_INVITE_TTL_MS = 7 * 24 * 60 * 60 * 1000
15
- const FORBIDDEN = 'Only the session owner can invite people.'
15
+ const FORBIDDEN = "Only the codebase's owner can invite people."
16
16
  // One address, nothing a mail header could split (the same rule as org invites).
17
17
  const STRICT_EMAIL = /^[^\s@,;<>"()\\]+@[^\s@,;<>"()\\]+$/
18
18
 
@@ -48,11 +48,11 @@ export function sessionInviteRoutes ({ store, person, now, site, mailer, log, li
48
48
  async function send (to, { userId, session, link }) {
49
49
  const inviter = await store.profile(userId)
50
50
  const inviterName = stripInvisible(inviter?.name || '').join('').trim() || undefined
51
- const msg = sessionInviteEmail({ inviterName, sessionName: session.name || 'Untitled session', link, site })
51
+ const msg = sessionInviteEmail({ inviterName, sessionName: session.name || 'Untitled codebase', link, site })
52
52
  try {
53
53
  await mailer.send({ to, ...msg })
54
54
  } catch (err) {
55
- log(`session invite email failed: ${err?.stack || err?.message || err}`)
55
+ log(`codebase invite email failed: ${err?.stack || err?.message || err}`)
56
56
  throw new HttpError(502, "The invite was saved, but the email didn't send. Cancel it and invite them again.")
57
57
  }
58
58
  }
@@ -70,7 +70,7 @@ export function sessionInviteRoutes ({ store, person, now, site, mailer, log, li
70
70
  if (!type) throw new HttpError(400, 'no such access type')
71
71
  let inv = null
72
72
  try { inv = parseInvite(body.link, { allowRelay: () => true }) } catch {}
73
- if (!inv || inv.room !== room) throw new HttpError(400, "Send this session's invite link.")
73
+ if (!inv || inv.room !== room) throw new HttpError(400, "Send this codebase's invite link.")
74
74
  const link = String(body.link).trim()
75
75
  const to = body.to && typeof body.to === 'object' ? body.to : {}
76
76
 
@@ -93,7 +93,7 @@ export function sessionInviteRoutes ({ store, person, now, site, mailer, log, li
93
93
  if (await store.openSessionInvite(room, { account }, now())) throw new HttpError(409, taken)
94
94
  // Inviting them again would overwrite the access they have, and cancelling that invite
95
95
  // would then take it all away.
96
- if (await store.grantFor(room, account)) throw new HttpError(409, 'They already have access to this session. Change it in Session settings.')
96
+ if (await store.grantFor(room, account)) throw new HttpError(409, 'They already have access to this codebase. Change it in Codebase settings.')
97
97
  const invite = await createInvite({ room, account, accountName: who.name, typeId: type.id, invitedBy: owner.me, expiresAt: now() + SESSION_INVITE_TTL_MS, link }, taken,
98
98
  { room, account, typeId: type.id, grantedBy: owner.me })
99
99
  // A person hears about it at their sign-in email (looked up here, never sent back). An
@@ -7,7 +7,7 @@ import { summarize, collaborators, myVisits, isTimeZone, weekStart, monthStart,
7
7
  import { cleanSessionName, BAD_SESSION_NAME } from '../../session-name.js'
8
8
 
9
9
  const ROOM = /^[A-Za-z0-9_-]{1,64}$/
10
- const NO_SESSION = 'no such session'
10
+ const NO_SESSION = 'no such codebase'
11
11
 
12
12
  /** An account's dashboard: its sessions, with the people in each, and the totals. */
13
13
  export async function overviewOf (store, account, tz, t) {
@@ -57,7 +57,7 @@ export function sessionRoutes ({ store, now, person }) {
57
57
  const name = cleanSessionName(body.name)
58
58
  if (!name) throw new HttpError(400, BAD_SESSION_NAME)
59
59
  const { session } = await mine(account, room)
60
- if (session.ownerAccount !== account) throw new HttpError(403, 'Only the session owner can rename it.')
60
+ if (session.ownerAccount !== account) throw new HttpError(403, "Only the codebase's owner can rename it.")
61
61
  const renamed = await store.renameSession(room, name, now())
62
62
  return { session: { room, name: renamed.name } }
63
63
  }],
@@ -67,7 +67,7 @@ export function sessionRoutes ({ store, now, person }) {
67
67
  ['GET', /^\/v1\/me\/sessions\/([^/]+)\/audit$/, async (req, body, [room]) => {
68
68
  const account = await me(req)
69
69
  const { session, visits } = await mine(account, room)
70
- if (session.ownerAccount !== account) throw new HttpError(403, 'Only the session owner can see its audit trail.')
70
+ if (session.ownerAccount !== account) throw new HttpError(403, "Only the codebase's owner can see its audit trail.")
71
71
  const q = new URL(req.url, 'http://x').searchParams
72
72
  const t = now()
73
73
  const num = (k, d) => { const n = Number(q.get(k)); return q.has(k) && Number.isFinite(n) ? n : d }
@@ -17,7 +17,7 @@ import { isHostedRelay, HOSTED_RELAY } from '../../settings.js'
17
17
  const ROOM = /^[A-Za-z0-9_-]{1,64}$/
18
18
  export const AGENT_WEBHOOK_EVENTS = ['session.started']
19
19
  /** Why someone else's agent in a workspace is never invited to every session there. */
20
- export const FOREIGN_JOINS = 'Only its owner can have an agent invited to every session.'
20
+ export const FOREIGN_JOINS = 'Only its owner can have an agent invited to every codebase.'
21
21
 
22
22
  /** A placement as the routes answer it; an agent with none is 'manual' (it works only where it is added). */
23
23
  export function placementView (agentId, p) {
@@ -28,7 +28,7 @@ export function placementView (agentId, p) {
28
28
  /** A member agent's `sessions`: 'all' or 'invited', and only for an agent. Undefined keeps what the member has. */
29
29
  export function cleanMemberSessions (value, kind) {
30
30
  if (value === undefined) return undefined
31
- if (kind !== 'agent') throw new HttpError(400, 'Only an agent joins sessions by itself.')
31
+ if (kind !== 'agent') throw new HttpError(400, 'Only an agent joins codebases by itself.')
32
32
  if (!SESSIONS.includes(value)) throw new HttpError(400, 'Sessions is all or invited.')
33
33
  return value
34
34
  }
@@ -94,7 +94,7 @@ export function workspaceAgentRoutes (ctx) {
94
94
  const p = cleanPlacement(body)
95
95
  for (const id of p.workspaceIds) {
96
96
  const ws = await store.workspaceById(id)
97
- if (!ws || !owns(ws)) throw new HttpError(400, 'An agent can only be placed in its owner\'s own workspaces.')
97
+ if (!ws || !owns(ws)) throw new HttpError(400, 'An agent can only be placed in its owner\'s own projects.')
98
98
  }
99
99
  return p
100
100
  }
@@ -121,10 +121,10 @@ export function workspaceAgentRoutes (ctx) {
121
121
  /** The room's session when the caller owns it (as the relay reports it). */
122
122
  async function ownRoom (req, room) {
123
123
  const me = await caller(req)
124
- if (!ROOM.test(room)) throw new HttpError(404, 'no such session')
124
+ if (!ROOM.test(room)) throw new HttpError(404, 'no such codebase')
125
125
  const session = await store.sessionByRoom(room)
126
- if (!session) throw new HttpError(404, 'no such session')
127
- if (!session.ownerAccount || session.ownerAccount !== me.account) throw new HttpError(403, 'Only the session owner can do that.')
126
+ if (!session) throw new HttpError(404, 'no such codebase')
127
+ if (!session.ownerAccount || session.ownerAccount !== me.account) throw new HttpError(403, "Only the codebase's owner can do that.")
128
128
  return { me, session }
129
129
  }
130
130
 
@@ -200,7 +200,7 @@ export function workspaceAgentRoutes (ctx) {
200
200
  ['PUT', /^\/v1\/workspaces\/([^/]+)\/agents\/([^/]+)$/, async (req, body, [id, agentId]) => {
201
201
  const r = await reach(req, id)
202
202
  r.needAdmin()
203
- if (!(await placementIn(store, r.ws, agentId))) throw new HttpError(404, 'that agent is not placed in this workspace')
203
+ if (!(await placementIn(store, r.ws, agentId))) throw new HttpError(404, 'that agent is not placed in this project')
204
204
  const b = body && typeof body === 'object' ? body : {}
205
205
  if (b.sessions !== undefined && b.sessions !== null && !SESSIONS.includes(b.sessions)) throw new HttpError(400, 'Sessions is all, invited or null.')
206
206
  if (b.excluded !== undefined && typeof b.excluded !== 'boolean') throw new HttpError(400, 'excluded is true or false.')
@@ -278,15 +278,15 @@ export function workspaceAgentRoutes (ctx) {
278
278
  // who owns the session (the app tries again shortly).
279
279
  ['POST', /^\/v1\/workspaces\/([^/]+)\/sessions\/([^/]+)\/started$/, async (req, body, [id, room]) => {
280
280
  const r = await reach(req, id)
281
- if (!ROOM.test(room)) throw new HttpError(404, 'that session is not in this workspace')
281
+ if (!ROOM.test(room)) throw new HttpError(404, 'that codebase is not in this project')
282
282
  const session = await store.sessionByRoom(room)
283
- if (!session || session.workspaceId !== r.ws.id) throw new HttpError(404, 'that session is not in this workspace')
284
- if (session.workspaceLinkedBy !== r.me.account) throw new HttpError(403, 'Only the session owner can do that.')
285
- if (!session.ownerAccount) throw new HttpError(409, 'Quilt has not heard who owns this session yet; try again in a moment.')
286
- if (session.ownerAccount !== r.me.account) throw new HttpError(403, 'Only the session owner can do that.')
283
+ if (!session || session.workspaceId !== r.ws.id) throw new HttpError(404, 'that codebase is not in this project')
284
+ if (session.workspaceLinkedBy !== r.me.account) throw new HttpError(403, "Only the codebase's owner can do that.")
285
+ if (!session.ownerAccount) throw new HttpError(409, 'Quilt has not heard who owns this codebase yet; try again in a moment.')
286
+ if (session.ownerAccount !== r.me.account) throw new HttpError(403, "Only the codebase's owner can do that.")
287
287
  let invite
288
- try { invite = parseInvite(String(body.link || ''), { allowRelay: (s) => isHostedRelay(s) || relayForm(s) === ownRelay }) } catch { throw new HttpError(400, 'link must be this session\'s Quilt invite link') }
289
- if (invite.room !== room || !invite.secret) throw new HttpError(400, 'link must be this session\'s Quilt invite link')
288
+ try { invite = parseInvite(String(body.link || ''), { allowRelay: (s) => isHostedRelay(s) || relayForm(s) === ownRelay }) } catch { throw new HttpError(400, 'link must be this codebase\'s Quilt invite link') }
289
+ if (invite.room !== room || !invite.secret) throw new HttpError(400, 'link must be this codebase\'s Quilt invite link')
290
290
  // `agents` (optional): only these of the agents it invites, e.g. one invited again.
291
291
  const only = body.agents === undefined ? null : body.agents
292
292
  if (only !== null && (!Array.isArray(only) || only.length > 100 || only.some((x) => typeof x !== 'string'))) throw new HttpError(400, 'agents must be a list of agent ids.')
@@ -78,11 +78,11 @@ export function workspaceFileRoutes (ctx) {
78
78
  }
79
79
 
80
80
  async function fileIn (r, id) {
81
- const f = await store.workspaceFileById(needId(id, 'file'))
82
- if (!f || f.workspaceId !== r.ws.id || f.deletedAt) throw new HttpError(404, 'no such file')
81
+ const f = await store.workspaceFileById(needId(id, 'artifact'))
82
+ if (!f || f.workspaceId !== r.ws.id || f.deletedAt) throw new HttpError(404, 'no such artifact')
83
83
  return f
84
84
  }
85
- const needEdit = (r) => { if (r.access.access !== 'edit') throw new HttpError(403, 'you can only view this workspace') }
85
+ const needEdit = (r) => { if (r.access.access !== 'edit') throw new HttpError(403, 'you can only view this project') }
86
86
 
87
87
  async function refreshUsage (wsId) {
88
88
  const u = await store.workspaceUsage(wsId)
@@ -96,7 +96,7 @@ export function workspaceFileRoutes (ctx) {
96
96
  for (let i = 1; i <= parts.length; i++) {
97
97
  const fp = parts.slice(0, i).join('/')
98
98
  const row = await store.workspaceFileByPath(ws.id, fp)
99
- if (row && row.kind !== 'folder') throw new HttpError(409, `${fp} is a file, not a folder`)
99
+ if (row && row.kind !== 'folder') throw new HttpError(409, `${fp} is an artifact, not a folder`)
100
100
  if (!row) await store.createWorkspaceFile({ workspaceId: ws.id, path: fp, kind: 'folder', uploadedBy: by })
101
101
  }
102
102
  }
@@ -138,8 +138,8 @@ export function workspaceFileRoutes (ctx) {
138
138
  needEdit(r)
139
139
  const p = cleanFilePath(body.path)
140
140
  const size = Number(body.size)
141
- if (!Number.isInteger(size) || size <= 0) throw new HttpError(400, 'Say how many bytes the file is.')
142
- if (size > maxFileBytes) throw new HttpError(413, 'file too large')
141
+ if (!Number.isInteger(size) || size <= 0) throw new HttpError(400, 'Say how many bytes the artifact is.')
142
+ if (size > maxFileBytes) throw new HttpError(413, 'artifact too large')
143
143
  const note = cleanNote(body.note)
144
144
  // A type/subtype and nothing else (no parameters, spaces or line breaks), or the one the name suggests.
145
145
  const given = String(body.mime || '')
@@ -152,12 +152,12 @@ export function workspaceFileRoutes (ctx) {
152
152
  // behind. Before then someone may still be uploading it: they go first.
153
153
  if (existing && !existing.confirmedAt) {
154
154
  // The same person may take over their own attempt (a retry after a dropped upload).
155
- if (existing.uploadedBy !== r.me.account && now() - existing.uploadedAt <= LINK_MS) throw new HttpError(409, 'someone is uploading this file right now; try again in a moment')
155
+ if (existing.uploadedBy !== r.me.account && now() - existing.uploadedAt <= LINK_MS) throw new HttpError(409, 'someone is uploading this artifact right now; try again in a moment')
156
156
  existing = await abandon(existing)
157
157
  }
158
158
  const usage = await store.workspaceUsage(r.ws.id)
159
- if (!existing && usage.fileCount >= maxWorkspaceFiles) throw new HttpError(413, 'this workspace has too many files')
160
- if (usage.usedBytes + size > quotaOf(r.ws, workspaceQuotaBytes)) throw new HttpError(413, 'this workspace has used its storage')
159
+ if (!existing && usage.fileCount >= maxWorkspaceFiles) throw new HttpError(413, 'this project has too many artifacts')
160
+ if (usage.usedBytes + size > quotaOf(r.ws, workspaceQuotaBytes)) throw new HttpError(413, 'this project has used its storage')
161
161
  await ensureFolders(r.ws, p, r.me.account)
162
162
  let file
163
163
  if (existing) {
@@ -179,7 +179,7 @@ export function workspaceFileRoutes (ctx) {
179
179
  const r = await reach(req, id)
180
180
  needEdit(r)
181
181
  const f = await fileIn(r, fid)
182
- if (f.kind !== 'file') throw new HttpError(404, 'no such file')
182
+ if (f.kind !== 'file') throw new HttpError(404, 'no such artifact')
183
183
  // Done twice (a client retrying after a lost answer): nothing to do; the checks below
184
184
  // would otherwise count the file's own bytes against the quota and abandon a landed file.
185
185
  if (f.confirmedAt) return { file: fileView(f) }
@@ -189,8 +189,8 @@ export function workspaceFileRoutes (ctx) {
189
189
  // (or fewer) bytes than that: check what actually landed, against the same limits.
190
190
  // Usage counts confirmed bytes only, so this row's pending upload is not in it yet.
191
191
  const usage = await store.workspaceUsage(r.ws.id)
192
- const refusal = there.size > maxFileBytes ? new HttpError(413, 'file too large')
193
- : usage.usedBytes + there.size > quotaOf(r.ws, workspaceQuotaBytes) ? new HttpError(413, 'this workspace has used its storage')
192
+ const refusal = there.size > maxFileBytes ? new HttpError(413, 'artifact too large')
193
+ : usage.usedBytes + there.size > quotaOf(r.ws, workspaceQuotaBytes) ? new HttpError(413, 'this project has used its storage')
194
194
  : there.size !== f.size ? new HttpError(409, 'the upload did not match its declared size')
195
195
  : null
196
196
  if (refusal) {
@@ -56,7 +56,7 @@ export function workspaceInviteRoutes (ctx) {
56
56
  try {
57
57
  await mailer.send({ to, ...msg })
58
58
  } catch (err) {
59
- log(`workspace invite email failed: ${err?.stack || err?.message || err}`)
59
+ log(`project invite email failed: ${err?.stack || err?.message || err}`)
60
60
  throw new HttpError(502, "The invite was saved, but the email didn't send. It still shows in their Quilt; cancel and invite again to resend it.")
61
61
  }
62
62
  }
@@ -116,7 +116,7 @@ export function workspaceInviteRoutes (ctx) {
116
116
  const known = (await collaboratorsOf(store, r.me.account, now())).find((c) => c.account === account)
117
117
  const inOrg = r.ws.orgId && await store.memberOf(r.ws.orgId, userId)
118
118
  if (!known && !inOrg) throw new HttpError(404, "You can invite people you've worked with, or anyone by email.")
119
- if (await alreadyIn(r.ws, account)) throw new HttpError(409, 'They are already in this workspace.')
119
+ if (await alreadyIn(r.ws, account)) throw new HttpError(409, 'They are already in this project.')
120
120
  if (await store.openWorkspaceInvite(r.ws.id, { account }, now())) throw new HttpError(409, TAKEN)
121
121
  const name = known?.name || await nameOf(account)
122
122
  const invite = await create({ ...base, account, accountName: String(name || '').slice(0, 64) })
@@ -151,7 +151,7 @@ export function workspaceInviteRoutes (ctx) {
151
151
  for (const i of await store.sessionInvitesFor(me, t)) {
152
152
  // An invite made before links were kept can't be joined from here: it's in their email.
153
153
  const type = await typeOfGrant(store, { typeId: i.typeId })
154
- out.push({ kind: 'session', id: i.id, session: { room: i.room, name: i.sessionName || 'Untitled session' }, link: i.link || null, access: type.name, from: { account: i.invitedBy, name: await nameOf(i.invitedBy) }, createdAt: i.createdAt, expiresAt: i.expiresAt })
154
+ out.push({ kind: 'session', id: i.id, session: { room: i.room, name: i.sessionName || 'Untitled codebase' }, link: i.link || null, access: type.name, from: { account: i.invitedBy, name: await nameOf(i.invitedBy) }, createdAt: i.createdAt, expiresAt: i.expiresAt })
155
155
  }
156
156
  return { invites: out.sort((a, b) => b.createdAt - a.createdAt) }
157
157
  }],
@@ -162,10 +162,10 @@ export function workspaceInviteRoutes (ctx) {
162
162
  const me = await mine(req)
163
163
  const i = await waitingFor(me, id)
164
164
  const ws = await store.workspaceById(i.workspaceId)
165
- if (!ws) throw new HttpError(404, 'That workspace was deleted.')
165
+ if (!ws) throw new HttpError(404, 'That project was deleted.')
166
166
  if (ws.orgId && !(await store.memberOf(ws.orgId, me.userId))) {
167
167
  const org = await store.orgById(ws.orgId)
168
- throw new HttpError(403, `This workspace belongs to ${org?.name || 'an org'}. Ask them to add you to the org, then accept again.`)
168
+ throw new HttpError(403, `This project belongs to ${org?.name || 'an org'}. Ask them to add you to the org, then accept again.`)
169
169
  }
170
170
  if (!await store.answerWorkspaceInvite(i.id, 'accepted', me.account)) throw new HttpError(410, 'This invite was already answered.')
171
171
  // Never lower the access someone already has.