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.
- package/README.md +101 -97
- package/RELEASES.md +8 -0
- package/bin/quilt.js +32 -32
- package/desktop/main.js +1 -1
- package/package.json +1 -1
- package/src/account.js +2 -2
- package/src/admit-policy.js +2 -2
- package/src/agent-join.js +3 -3
- package/src/agent-task-workflow.js +14 -14
- package/src/ai-vm.js +1 -1
- package/src/api/agent-placement.js +2 -2
- package/src/api/audit.js +1 -1
- package/src/api/file-paths.js +1 -1
- package/src/api/file-store.js +1 -1
- package/src/api/invite-email.js +4 -4
- package/src/api/join-text.js +5 -5
- package/src/api/notify.js +7 -7
- package/src/api/permissions.js +1 -1
- package/src/api/routes/agent-wake.js +1 -1
- package/src/api/routes/agents.js +2 -2
- package/src/api/routes/ai-vm.js +5 -5
- package/src/api/routes/connections.js +13 -13
- package/src/api/routes/grants.js +2 -2
- package/src/api/routes/mail.js +10 -10
- package/src/api/routes/relay.js +1 -1
- package/src/api/routes/secrets.js +11 -11
- package/src/api/routes/session-invites.js +5 -5
- package/src/api/routes/sessions.js +3 -3
- package/src/api/routes/workspace-agents.js +14 -14
- package/src/api/routes/workspace-files.js +12 -12
- package/src/api/routes/workspace-invites.js +5 -5
- package/src/api/routes/workspaces.js +11 -11
- package/src/api/secrets-access.js +1 -1
- package/src/api/server.js +3 -3
- package/src/api/team-access.js +1 -1
- package/src/api/workspace-access.js +1 -1
- package/src/api/workspace-reach.js +3 -3
- package/src/app-tools.js +10 -10
- package/src/autowork.js +4 -4
- package/src/branch-view.js +1 -1
- package/src/catchup.js +5 -5
- package/src/chat-links.js +18 -18
- package/src/connection.js +11 -11
- package/src/control.js +5 -5
- package/src/conversation.js +1 -1
- package/src/doctor.js +2 -2
- package/src/duties.js +1 -1
- package/src/fsutil.js +1 -1
- package/src/held.js +4 -4
- package/src/hooks.js +3 -3
- package/src/hosted-client.js +2 -2
- package/src/identity.js +1 -1
- package/src/inbox.js +1 -1
- package/src/key-cli.js +1 -1
- package/src/mail-tools.js +11 -11
- package/src/mcp-proxy.js +1 -1
- package/src/mcp.js +59 -59
- package/src/new-session.js +6 -6
- package/src/project-rules.js +2 -2
- package/src/relay-ask.js +2 -2
- package/src/relay-cluster.js +3 -3
- package/src/relay-live-write.js +3 -3
- package/src/relay-mcp.js +56 -56
- package/src/relay-prune.js +1 -1
- package/src/relay-turn-sync.js +1 -1
- package/src/secret-import.js +1 -1
- package/src/secret-names.js +6 -6
- package/src/secret-run.js +3 -3
- package/src/server.js +41 -41
- package/src/session-access.js +3 -3
- package/src/session-name.js +1 -1
- package/src/session.js +50 -50
- package/src/setup.js +7 -7
- package/src/status.js +2 -2
- package/src/tasks.js +1 -1
- package/src/turn-sync.js +4 -4
- package/src/ui/account-sessions.js +2 -2
- package/src/ui/agent-env-key.js +1 -1
- package/src/ui/agent-guide.js +35 -35
- package/src/ui/agent-kinds.js +8 -8
- package/src/ui/agent-place.js +16 -16
- package/src/ui/agents-table.js +6 -6
- package/src/ui/app.css +331 -0
- package/src/ui/app.js +28 -13
- package/src/ui/board.js +2 -2
- package/src/ui/catchup.js +5 -5
- package/src/ui/changes-seen.js +2 -2
- package/src/ui/changes.js +3 -3
- package/src/ui/cloud-ai.js +12 -12
- package/src/ui/common.js +1 -1
- package/src/ui/connections.js +1 -1
- package/src/ui/diffview.js +2 -2
- package/src/ui/feed.js +1 -1
- package/src/ui/feedback.js +4 -4
- package/src/ui/files.js +120 -14
- package/src/ui/fileview.js +3 -3
- package/src/ui/git-rule.js +3 -3
- package/src/ui/home.js +92 -47
- package/src/ui/index.html +1 -1
- package/src/ui/invite.js +8 -8
- package/src/ui/invites.js +3 -3
- package/src/ui/new-session.js +3 -3
- package/src/ui/prail-model.js +22 -0
- package/src/ui/prail.js +43 -0
- package/src/ui/project-board.js +359 -0
- package/src/ui/project-model.js +197 -0
- package/src/ui/project-pop.js +451 -0
- package/src/ui/projects.js +406 -0
- package/src/ui/sandbox-keys.js +3 -3
- package/src/ui/secrets-view.js +5 -5
- package/src/ui/session-words.js +2 -2
- package/src/ui/session.js +156 -43
- package/src/ui/tree.js +3 -3
- package/src/ui/voice.js +6 -6
- package/src/ui/workspaces.js +23 -23
- package/src/ui-server.js +78 -24
- package/src/update-check.js +2 -2
- package/src/voice.js +7 -7
- package/src/wake-tool.js +1 -1
- package/src/webhooks.js +1 -1
- package/src/workspace-cli.js +12 -12
- package/src/workspace-tools.js +33 -33
package/src/server.js
CHANGED
|
@@ -172,7 +172,7 @@ class Room {
|
|
|
172
172
|
if (fs.existsSync(this.metaFile)) this.meta = JSON.parse(fs.readFileSync(this.metaFile, 'utf8'))
|
|
173
173
|
} catch (err) {
|
|
174
174
|
this.doc.destroy()
|
|
175
|
-
throw Object.assign(new Error(`could not read the
|
|
175
|
+
throw Object.assign(new Error(`could not read the codebase's data: ${err.message}`), { unreadable: true })
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
this.meta.identities = this.meta.identities || {} // name -> public key
|
|
@@ -768,7 +768,7 @@ class Room {
|
|
|
768
768
|
if (!refused.length) return
|
|
769
769
|
const why = posts.length === refused.length
|
|
770
770
|
? TALK_WHY
|
|
771
|
-
: a && a.role === 'viewer' ? 'you can only view this
|
|
771
|
+
: a && a.role === 'viewer' ? 'you can only view this codebase' : 'that is outside the folders you may change'
|
|
772
772
|
send(ws, jsonMessage(MSG_ACCESS, { ...this.accessMessage(a), refused: refused.slice(0, 20), why }))
|
|
773
773
|
})
|
|
774
774
|
return false
|
|
@@ -1076,8 +1076,8 @@ class Room {
|
|
|
1076
1076
|
const to = this.resolveKey(key)
|
|
1077
1077
|
const from = this.hostedBranch(id)
|
|
1078
1078
|
const exists = !!this.meta.branches[to]
|
|
1079
|
-
if (!exists && !create) throw new Error(`${key} isn't in this
|
|
1080
|
-
if (exists && create) throw new Error(`${key} is already in this
|
|
1079
|
+
if (!exists && !create) throw new Error(`${key} isn't in this codebase. Pass create: true to start it from a copy of the files on ${from}.`)
|
|
1080
|
+
if (exists && create) throw new Error(`${key} is already in this codebase: switch to it without create.`)
|
|
1081
1081
|
if (!exists) { } else if (!exists) {
|
|
1082
1082
|
this.assertMigrated()
|
|
1083
1083
|
this.assertBranchRoom(editor, this.store.size(from)) // a copy of `from`'s files
|
|
@@ -1113,18 +1113,18 @@ class Room {
|
|
|
1113
1113
|
* disconnects anyone: the folder stays on its branch.
|
|
1114
1114
|
*/
|
|
1115
1115
|
assertBranchRoom (editor = true, adding = 0) {
|
|
1116
|
-
if (this.unsavable) throw new Error("The relay can't save this
|
|
1116
|
+
if (this.unsavable) throw new Error("The relay can't save this codebase right now, so it can't take another branch.")
|
|
1117
1117
|
// Merged and week-idle branches make room first (relay-prune.js), then the limits are checked.
|
|
1118
1118
|
if (this.totalBytes() + adding > this.cfg.maxRoomBytes * MAX_TOTAL_FACTOR) this.pruneBranches()
|
|
1119
|
-
if (this.totalBytes() + adding > this.cfg.maxRoomBytes * MAX_TOTAL_FACTOR) throw new Error("This
|
|
1119
|
+
if (this.totalBytes() + adding > this.cfg.maxRoomBytes * MAX_TOTAL_FACTOR) throw new Error("This codebase is at its size limit across all its branches, so it can't take another branch. Merged branches, and branches nobody worked on for a week, leave the codebase by themselves.")
|
|
1120
1120
|
if (Object.keys(this.meta.branches).length >= MAX_BRANCHES) this.pruneBranches() // idle branches make room first
|
|
1121
|
-
if (Object.keys(this.meta.branches).length >= MAX_BRANCHES) throw new Error(`This
|
|
1122
|
-
if (!editor) throw new Error('you can only view this
|
|
1121
|
+
if (Object.keys(this.meta.branches).length >= MAX_BRANCHES) throw new Error(`This codebase already has ${MAX_BRANCHES} branches, its limit; an existing one has to go before another can start.`)
|
|
1122
|
+
if (!editor) throw new Error('you can only view this codebase, so you cannot start a new branch')
|
|
1123
1123
|
}
|
|
1124
1124
|
|
|
1125
1125
|
/** A room whose move to branch documents failed on the relay's disk (migrateLegacy) stays read-only: no branch document is used. */
|
|
1126
1126
|
assertMigrated () {
|
|
1127
|
-
if (this.meta.layout !== 2) throw new Error("The relay couldn't finish updating how it stores this
|
|
1127
|
+
if (this.meta.layout !== 2) throw new Error("The relay couldn't finish updating how it stores this codebase (its disk refused), so the codebase is read-only until the relay is fixed.")
|
|
1128
1128
|
}
|
|
1129
1129
|
|
|
1130
1130
|
/** The session's branches, for everyone's branch menu (hosted: the hosted agents on each). */
|
|
@@ -1164,7 +1164,7 @@ class Room {
|
|
|
1164
1164
|
this.assertMigrated()
|
|
1165
1165
|
// A document an earlier version kept beside the branches (dropOldLayout) is never a branch: an app
|
|
1166
1166
|
// from then that still asks for one is refused, rather than starting a branch of that name.
|
|
1167
|
-
if (OLD_DOC_KEY.test(key)) throw new Error("That document isn't in this
|
|
1167
|
+
if (OLD_DOC_KEY.test(key)) throw new Error("That document isn't in this codebase any more: update Quilt")
|
|
1168
1168
|
// An app from before branch documents names the branch the old document was; else the first real branch takes ∅.
|
|
1169
1169
|
let adopted = false
|
|
1170
1170
|
if (validBranchKey(String(req.adopt || ''))) adopted = this.adoptDefault(String(req.adopt))
|
|
@@ -1217,10 +1217,10 @@ class Room {
|
|
|
1217
1217
|
}
|
|
1218
1218
|
if (req.op === 'remove') {
|
|
1219
1219
|
const a = this.access.get(ws)
|
|
1220
|
-
if (!a || (this.controlled && !a.owner)) throw new Error(
|
|
1220
|
+
if (!a || (this.controlled && !a.owner)) throw new Error("only the codebase's owner can remove a branch")
|
|
1221
1221
|
const k = this.resolveKey(key)
|
|
1222
|
-
if (!this.meta.branches[k]) throw new Error(`${key} isn't in this
|
|
1223
|
-
if (k === this.defaultKey) throw new Error(`${key} is the
|
|
1222
|
+
if (!this.meta.branches[k]) throw new Error(`${key} isn't in this codebase`)
|
|
1223
|
+
if (k === this.defaultKey) throw new Error(`${key} is the codebase's default branch; it stays`)
|
|
1224
1224
|
const on = [...this.conns.keys()].filter((c) => c.branch === k).map((c) => this.names.get(c))
|
|
1225
1225
|
if (on.length) throw new Error(`${[...new Set(on)].join(', ')} ${on.length === 1 ? 'is' : 'are'} on ${key}; it can be removed once nobody is`)
|
|
1226
1226
|
this.removeBranch(k)
|
|
@@ -1305,9 +1305,9 @@ class Room {
|
|
|
1305
1305
|
/** Changes to who's in the room. Letting people in follows admitBy; the rest is owner-only. Returns the reply fields. */
|
|
1306
1306
|
adminRequest (ws, req) {
|
|
1307
1307
|
const me = this.access.get(ws)
|
|
1308
|
-
if (!me) throw new Error(
|
|
1308
|
+
if (!me) throw new Error("only the codebase's owner can do that")
|
|
1309
1309
|
if (req.op === 'admitBy') {
|
|
1310
|
-
if (!me.owner) throw new Error(
|
|
1310
|
+
if (!me.owner) throw new Error("only the codebase's owner can do that")
|
|
1311
1311
|
const next = cleanAdmitBy(req.admitBy)
|
|
1312
1312
|
if (!next) throw new Error(BAD_ADMIT_BY)
|
|
1313
1313
|
if (next !== this.admitBy) {
|
|
@@ -1320,7 +1320,7 @@ class Room {
|
|
|
1320
1320
|
}
|
|
1321
1321
|
if (req.op === 'workspace') {
|
|
1322
1322
|
// Which workspace the session is in (the owner's app knows): webhook events say so, so an agent in several can tell them apart.
|
|
1323
|
-
if (!me.owner) throw new Error(
|
|
1323
|
+
if (!me.owner) throw new Error("only the codebase's owner can do that")
|
|
1324
1324
|
const id = String(req.id || '').slice(0, 64)
|
|
1325
1325
|
if ((this.meta.workspace || '') !== id) {
|
|
1326
1326
|
this.meta.workspace = id || undefined
|
|
@@ -1330,9 +1330,9 @@ class Room {
|
|
|
1330
1330
|
}
|
|
1331
1331
|
// A chat link lets a chat AI in, so whoever may let people in may make one, and set how long it lasts.
|
|
1332
1332
|
if (req.op === 'approve' || req.op === 'deny' || req.op === 'chatlink' || req.op === 'chatextend') {
|
|
1333
|
-
if (!this.personCanAdmit(me)) throw new Error('you cannot let people into this
|
|
1333
|
+
if (!this.personCanAdmit(me)) throw new Error('you cannot let people into this codebase')
|
|
1334
1334
|
} else if (!me.owner) {
|
|
1335
|
-
throw new Error(
|
|
1335
|
+
throw new Error("only the codebase's owner can do that")
|
|
1336
1336
|
}
|
|
1337
1337
|
if (req.op === 'name') {
|
|
1338
1338
|
// The owner's app names the session after its folder, and the owner can rename it.
|
|
@@ -1408,7 +1408,7 @@ class Room {
|
|
|
1408
1408
|
this.pending.delete(pws)
|
|
1409
1409
|
// A hosted agent finds out on its next tool call; relay.hosted remembers it, across restarts.
|
|
1410
1410
|
if (pws.hosted) { if (this.onHostedDenied) this.onHostedDenied(w.id); continue }
|
|
1411
|
-
pws.close(CLOSE_DENIED,
|
|
1411
|
+
pws.close(CLOSE_DENIED, "The codebase's owner did not let you in")
|
|
1412
1412
|
}
|
|
1413
1413
|
return { ok: true }
|
|
1414
1414
|
}
|
|
@@ -1442,7 +1442,7 @@ class Room {
|
|
|
1442
1442
|
const removed = Object.entries({ ...(this.meta.removed || {}), [key]: Date.now() }).filter(([, at]) => at > cutoff).sort((a, b) => a[1] - b[1])
|
|
1443
1443
|
this.meta.removed = Object.fromEntries(removed.slice(-MAX_REMOVED))
|
|
1444
1444
|
this.saveMeta()
|
|
1445
|
-
for (const [cws, a] of this.access) if (gone.includes(a.id)) { cws.endReason = 'removed'; cws.close(CLOSE_DENIED,
|
|
1445
|
+
for (const [cws, a] of this.access) if (gone.includes(a.id)) { cws.endReason = 'removed'; cws.close(CLOSE_DENIED, "The codebase's owner removed you") }
|
|
1446
1446
|
for (const id of gone) { this.hostedSeen.delete(id); this.forgetHostedBranch(id); if (this.onHostedGone) this.onHostedGone(id, 'removed') }
|
|
1447
1447
|
return { ok: true }
|
|
1448
1448
|
}
|
|
@@ -1803,7 +1803,7 @@ class Room {
|
|
|
1803
1803
|
* it into the room. Nothing else is accepted until then.
|
|
1804
1804
|
*/
|
|
1805
1805
|
admit (ws, name, publicKey, key, { kind = 'human', invitedAs = 'editor', account = '' } = {}, onJoin) {
|
|
1806
|
-
if (this.ended) return ws.close(CLOSE_ENDED, 'The owner ended this
|
|
1806
|
+
if (this.ended) return ws.close(CLOSE_ENDED, 'The owner ended this codebase')
|
|
1807
1807
|
clearTimeout(this.unloadTimer)
|
|
1808
1808
|
const nonce = crypto.randomBytes(32)
|
|
1809
1809
|
let joined = false
|
|
@@ -1833,7 +1833,7 @@ class Room {
|
|
|
1833
1833
|
this.log(`[${this.name}] refused ${name}: ${err.message}`)
|
|
1834
1834
|
return ws.close(CLOSE_AUTH_FAILED, 'Could not verify who you are')
|
|
1835
1835
|
}
|
|
1836
|
-
if (this.ended) return ws.close(CLOSE_ENDED, 'The owner ended this
|
|
1836
|
+
if (this.ended) return ws.close(CLOSE_ENDED, 'The owner ended this codebase')
|
|
1837
1837
|
// Its messages are the relay's own (relay-ask.js): nobody may write as it.
|
|
1838
1838
|
if (isRelay(name)) return ws.close(CLOSE_NAME_TAKEN, `"${RELAY_BY}" is the relay's own name; pick another name`)
|
|
1839
1839
|
// The session may have started storing files while this app signed in.
|
|
@@ -2035,7 +2035,7 @@ class Room {
|
|
|
2035
2035
|
const id = req.id
|
|
2036
2036
|
const a = this.access.get(ws)
|
|
2037
2037
|
const api = this.webhookApi
|
|
2038
|
-
const run = !a || ws.hosted ? Promise.reject(new Error('not in this
|
|
2038
|
+
const run = !a || ws.hosted ? Promise.reject(new Error('not in this codebase')) : !api ? Promise.reject(new Error('this relay keeps no webhooks')) : api.request(this, ws, a, req)
|
|
2039
2039
|
run.then((out) => ({ id, ok: true, webhook: out }), (err) => ({ id, ok: false, error: err.message }))
|
|
2040
2040
|
.then((r) => { if (this.conns.has(ws)) send(ws, jsonMessage(MSG_MEMBERS, { members: this.memberList(), sessionName: this.meta.name || '', admitBy: this.admitBy, pending: this.personCanAdmit(this.access.get(ws)) ? this.pendingList() : [], reply: r })) })
|
|
2041
2041
|
return
|
|
@@ -2084,7 +2084,7 @@ class Room {
|
|
|
2084
2084
|
}
|
|
2085
2085
|
}
|
|
2086
2086
|
|
|
2087
|
-
const TALK_WHY = "you can't post in this
|
|
2087
|
+
const TALK_WHY = "you can't post in this codebase"
|
|
2088
2088
|
// What an app's activity entries look like (session.js recordActivity, relay-mcp.js quilt_write).
|
|
2089
2089
|
const ACTIVITY_FIELDS = ['by', 'path', 'kind', 'detail', 'ts', 'branch', 'from']
|
|
2090
2090
|
const ACTIVITY_KINDS = ['created', 'edited', 'deleted', 'switched']
|
|
@@ -2164,7 +2164,7 @@ export function startServer ({ port = 4321, host = '0.0.0.0', dataDir = null, lo
|
|
|
2164
2164
|
// Who a new session counts against: their account with sign-in on, otherwise their address.
|
|
2165
2165
|
const starterOf = (pass, req) => pass && pass.sub ? `${pass.kind}:${pass.sub}` : clientIp(req)
|
|
2166
2166
|
// Without sign-in the limit is per address, and the message says so (as before).
|
|
2167
|
-
const TOO_MANY = passKey ? 'too many new
|
|
2167
|
+
const TOO_MANY = passKey ? 'too many new codebases; try again later' : 'too many new codebases from this address; try again later'
|
|
2168
2168
|
if (dataDir) fs.mkdirSync(dataDir, { recursive: true })
|
|
2169
2169
|
// Whether the accounts API has workspaces on, for hosted agents' library tools: asked in
|
|
2170
2170
|
// the background (never holding up the start) and again every 10 minutes.
|
|
@@ -2297,7 +2297,7 @@ export function startServer ({ port = 4321, host = '0.0.0.0', dataDir = null, lo
|
|
|
2297
2297
|
room.onEnd = () => {
|
|
2298
2298
|
if (room.ended) return
|
|
2299
2299
|
room.ended = true
|
|
2300
|
-
for (const ws of [...room.conns.keys(), ...room.pending.keys()]) if (!ws.hosted) { ws.endReason = 'session_ended'; ws.close(CLOSE_ENDED, 'The owner ended this
|
|
2300
|
+
for (const ws of [...room.conns.keys(), ...room.pending.keys()]) if (!ws.hosted) { ws.endReason = 'session_ended'; ws.close(CLOSE_ENDED, 'The owner ended this codebase') }
|
|
2301
2301
|
// Hosted agents in it have no connection to close: their visits end here.
|
|
2302
2302
|
if (endHostedVisits) endHostedVisits(name, 'session_ended')
|
|
2303
2303
|
clearTimeout(room.unloadTimer)
|
|
@@ -2569,7 +2569,7 @@ export function startServer ({ port = 4321, host = '0.0.0.0', dataDir = null, lo
|
|
|
2569
2569
|
const room = rooms.get(name)
|
|
2570
2570
|
if (!room) return
|
|
2571
2571
|
// Everyone on it, including sockets still proving who they are.
|
|
2572
|
-
for (const ws of wss.clients) if (ws.roomName === name) { ws.endReason = 'relay_restart'; closeSoon(ws, 1012, 'This
|
|
2572
|
+
for (const ws of wss.clients) if (ws.roomName === name) { ws.endReason = 'relay_restart'; closeSoon(ws, 1012, 'This codebase is moving to another relay machine', 1000) }
|
|
2573
2573
|
if (endHostedVisits) endHostedVisits(name, 'relay_restart')
|
|
2574
2574
|
clearTimeout(room.unloadTimer)
|
|
2575
2575
|
room.destroy()
|
|
@@ -2659,7 +2659,7 @@ export function startServer ({ port = 4321, host = '0.0.0.0', dataDir = null, lo
|
|
|
2659
2659
|
if (!room) return handle(req, res, url, body)
|
|
2660
2660
|
const basic = /^Basic\s+([A-Za-z0-9+/=]+)$/i.exec(String(req.headers.authorization || '')) // git sends the pass as its password
|
|
2661
2661
|
const w = await whereTo(room, req, req.headers['x-quilt-pass'] || (basic ? Buffer.from(basic[1], 'base64').toString('utf8').replace(/^[^:]*:/, '') : ''))
|
|
2662
|
-
if (w.none) return plain(404, 'no such
|
|
2662
|
+
if (w.none) return plain(404, 'no such codebase')
|
|
2663
2663
|
if (w.here) {
|
|
2664
2664
|
const r = rooms.get(room)
|
|
2665
2665
|
if (r) r.meter.in(body ? body.length : Number(req.headers['content-length']) || 0)
|
|
@@ -2699,12 +2699,12 @@ export function startServer ({ port = 4321, host = '0.0.0.0', dataDir = null, lo
|
|
|
2699
2699
|
return readJson(req, 16 * 1024, (err, b) => {
|
|
2700
2700
|
const name = !err && b && typeof b.room === 'string' ? b.room : ''
|
|
2701
2701
|
const m = !err && b && b.mail && typeof b.mail === 'object' ? b.mail : null
|
|
2702
|
-
if (!ROOM_RE.test(name) || !m || typeof m.id !== 'string') return json(400, { error: 'say which
|
|
2702
|
+
if (!ROOM_RE.test(name) || !m || typeof m.id !== 'string') return json(400, { error: 'say which codebase and which mail' })
|
|
2703
2703
|
if (roomEnded(name)) return json(410, { error: ENDED_MESSAGE })
|
|
2704
2704
|
const known = rooms.has(name) || (dataDir && fs.existsSync(path.join(dataDir, `${name}.ydoc`)))
|
|
2705
2705
|
const room = known ? getRoom(name) : null
|
|
2706
|
-
if (!room) return json(404, { error: 'that
|
|
2707
|
-
if (!room.exists) { dropIfUnused(room); return json(404, { error: 'that
|
|
2706
|
+
if (!room) return json(404, { error: 'that codebase is not on this machine' })
|
|
2707
|
+
if (!room.exists) { dropIfUnused(room); return json(404, { error: 'that codebase is not on this machine' }) }
|
|
2708
2708
|
const one = (v, max) => String(v || '').replace(/[\r\n]+/g, ' ').slice(0, max)
|
|
2709
2709
|
const files = Number(m.attachments) > 0 ? ` (${Number(m.attachments)} attachment${Number(m.attachments) === 1 ? '' : 's'})` : ''
|
|
2710
2710
|
const wake = Array.isArray(m.wake) ? m.wake.filter((w) => typeof w === 'string' && w).slice(0, 25).map((w) => w.slice(0, 64)) : []
|
|
@@ -2719,12 +2719,12 @@ export function startServer ({ port = 4321, host = '0.0.0.0', dataDir = null, lo
|
|
|
2719
2719
|
if (!fromApi(req)) return json(401, { error: 'only the accounts API may say this' })
|
|
2720
2720
|
return readJson(req, 16 * 1024, (err, b) => {
|
|
2721
2721
|
const name = !err && b && typeof b.room === 'string' ? b.room : ''
|
|
2722
|
-
if (!ROOM_RE.test(name) || typeof b.text !== 'string' || !b.text) return json(400, { error: 'say which
|
|
2722
|
+
if (!ROOM_RE.test(name) || typeof b.text !== 'string' || !b.text) return json(400, { error: 'say which codebase and what' })
|
|
2723
2723
|
if (roomEnded(name)) return json(410, { error: ENDED_MESSAGE })
|
|
2724
2724
|
const known = rooms.has(name) || (dataDir && fs.existsSync(path.join(dataDir, `${name}.ydoc`)))
|
|
2725
2725
|
const room = known ? getRoom(name) : null
|
|
2726
|
-
if (!room) return json(404, { error: 'that
|
|
2727
|
-
if (!room.exists) { dropIfUnused(room); return json(404, { error: 'that
|
|
2726
|
+
if (!room) return json(404, { error: 'that codebase is not on this machine' })
|
|
2727
|
+
if (!room.exists) { dropIfUnused(room); return json(404, { error: 'that codebase is not on this machine' }) }
|
|
2728
2728
|
const approval = typeof b.approval === 'string' && /^[0-9a-f-]{36}$/i.test(b.approval) ? b.approval : undefined
|
|
2729
2729
|
const to = typeof b.to === 'string' && b.to ? b.to.slice(0, 64) : null
|
|
2730
2730
|
const msg = room.postChat({ by: RELAY_BY, to, kind: approval ? 'app-approval' : 'app-call', approval, text: b.text.slice(0, 2000) })
|
|
@@ -2910,7 +2910,7 @@ export function startServer ({ port = 4321, host = '0.0.0.0', dataDir = null, lo
|
|
|
2910
2910
|
}
|
|
2911
2911
|
// The room secret and, with sign-in on, the person's own access: a view-only grant
|
|
2912
2912
|
// with the edit link may not use up the room's storage.
|
|
2913
|
-
if (auth !== 'editor' || (passKey && room.httpAccess(pass)?.role === 'viewer')) return text(403, 'you can only view this
|
|
2913
|
+
if (auth !== 'editor' || (passKey && room.httpAccess(pass)?.role === 'viewer')) return text(403, 'you can only view this codebase')
|
|
2914
2914
|
const size = Number(body && body.size)
|
|
2915
2915
|
if (!(size >= 0)) return text(400, 'size required')
|
|
2916
2916
|
if (size > cfg.maxStoredFileBytes) return text(413, `files over ${Math.round(cfg.maxStoredFileBytes / MB)} MB can't be shared`)
|
|
@@ -3027,7 +3027,7 @@ export function startServer ({ port = 4321, host = '0.0.0.0', dataDir = null, lo
|
|
|
3027
3027
|
const creating = !room.exists
|
|
3028
3028
|
// No secret is someone coming back by their account, and that never makes a session.
|
|
3029
3029
|
if (creating && !secret) { dropIfUnused(room); return reject(socket, 401, NOT_IN_SESSION) }
|
|
3030
|
-
if (creating && !canCreate(starter)) { dropIfUnused(room); return reject(socket, 429, 'Too many new
|
|
3030
|
+
if (creating && !canCreate(starter)) { dropIfUnused(room); return reject(socket, 429, 'Too many new codebases') }
|
|
3031
3031
|
let auth = room.authorize(secret, relayKey, viewSecret, publicKey)
|
|
3032
3032
|
// Let in by their account (letsInByAccount). Should the owner take that away before they sign
|
|
3033
3033
|
// in, they wait like anyone else, offered view only.
|
|
@@ -3325,14 +3325,14 @@ function receiveBlob (req, file, limit, done) {
|
|
|
3325
3325
|
req.pipe(out)
|
|
3326
3326
|
}
|
|
3327
3327
|
|
|
3328
|
-
const TOO_BIG = '
|
|
3329
|
-
const UNREADABLE = "This
|
|
3330
|
-
const ENDED_MESSAGE = 'The owner ended this
|
|
3328
|
+
const TOO_BIG = 'Codebase over the size limit'
|
|
3329
|
+
const UNREADABLE = "This codebase's data can't be read on the relay right now"
|
|
3330
|
+
const ENDED_MESSAGE = 'The owner ended this codebase'
|
|
3331
3331
|
// Coming back by account (no invite link) to a session that doesn't let this account in, or isn't here.
|
|
3332
|
-
const NOT_IN_SESSION = "You aren't in this
|
|
3332
|
+
const NOT_IN_SESSION = "You aren't in this codebase any more. Ask its owner for an invite link"
|
|
3333
3333
|
const NEEDS_UPDATE = needsUpdateWords()
|
|
3334
3334
|
const SIGN_IN = 'Update Quilt and sign in to continue'
|
|
3335
|
-
const NOT_LET_IN = "The
|
|
3335
|
+
const NOT_LET_IN = "The codebase's owner hasn't let you in yet."
|
|
3336
3336
|
const PASS_EXPIRED = 'Your sign-in expired. Reconnecting.'
|
|
3337
3337
|
|
|
3338
3338
|
function reject (socket, code, message) {
|
package/src/session-access.js
CHANGED
|
@@ -21,8 +21,8 @@ export const MAX_TYPES = 50
|
|
|
21
21
|
export const MAX_FOLDERS = 20
|
|
22
22
|
export const MAX_FOLDER_LENGTH = 200
|
|
23
23
|
export const TYPE_NAME_MAX = 40
|
|
24
|
-
export const TALK_REFUSED = "You can't post in this
|
|
25
|
-
export const BAD_FOLDER = 'Folders must be paths inside the
|
|
24
|
+
export const TALK_REFUSED = "You can't post in this codebase."
|
|
25
|
+
export const BAD_FOLDER = 'Folders must be paths inside the codebase, like src or docs.'
|
|
26
26
|
export const TOO_MANY_FOLDERS = 'An access type can list at most 20 folders.'
|
|
27
27
|
|
|
28
28
|
// Control and format characters (zero-width, bidi overrides) never belong in a name or a folder.
|
|
@@ -148,7 +148,7 @@ export function mayChange (a, rel) {
|
|
|
148
148
|
|
|
149
149
|
/** Why someone with this relay access may not change `rel`, in words, or null. */
|
|
150
150
|
export function changeRefusal (a, rel) {
|
|
151
|
-
if (!a || a.role === 'viewer') return 'you can only view this
|
|
151
|
+
if (!a || a.role === 'viewer') return 'you can only view this codebase'
|
|
152
152
|
if (a.scopes && a.scopes.length && !a.scopes.some((s) => inside(rel, s))) return `you may only change files in ${a.scopes.join(', ')}`
|
|
153
153
|
const except = (a.scopesExcept || []).find((s) => inside(rel, s))
|
|
154
154
|
return except ? `you may not change files in ${except}` : null
|
package/src/session-name.js
CHANGED