heyquilt 0.3.181 → 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 +17 -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/gitstate.js +117 -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 +112 -0
- 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/repo-ref.js +54 -0
- 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 +118 -52
- 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 +357 -0
- package/src/ui/app.js +29 -14
- 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 +95 -67
- 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 +151 -0
- 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 +104 -26
- 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/mcp.js
CHANGED
|
@@ -68,32 +68,32 @@ export const CHANNEL_METHOD = 'notifications/claude/channel'
|
|
|
68
68
|
// The inbox as an MCP resource: any client may subscribe to hear when something new arrives.
|
|
69
69
|
export const INBOX_URI = 'quilt://inbox'
|
|
70
70
|
|
|
71
|
-
const NOT_RUNNING = 'There is no live quilt
|
|
72
|
-
'quilt_join_session. To start a new
|
|
71
|
+
const NOT_RUNNING = 'There is no live quilt codebase for this folder. If the user gave you an invite link, join with ' +
|
|
72
|
+
'quilt_join_session. To start a new codebase, use quilt_start_session. A person can also run `quilt join` or `quilt ui`.'
|
|
73
73
|
|
|
74
74
|
export const MCP_INSTRUCTIONS =
|
|
75
|
-
'quilt lets several people (and their AI agents) edit one
|
|
76
|
-
'If you are given a quilt invite link, join with quilt_join_session. In a
|
|
75
|
+
'quilt lets several people (and their AI agents) edit one codebase live, each in their own tool. ' +
|
|
76
|
+
'If you are given a quilt invite link, join with quilt_join_session. In a live codebase, files may change underneath ' +
|
|
77
77
|
'you at any time. Call quilt_status before starting a task; use quilt_partner_feed to see what a partner\'s AI is ' +
|
|
78
|
-
'doing; announce your task with quilt_set_focus. The
|
|
78
|
+
'doing; announce your task with quilt_set_focus. The codebase has a shared task board: read it with quilt_tasks ' +
|
|
79
79
|
'(open tasks assigned to you are listed first), add work with quilt_add_task, assign it with quilt_assign_task, ' +
|
|
80
80
|
'and move a task with quilt_move_task when you start or finish it; quilt_task reads one in full with its comments, and quilt_comment_task leaves a note or handoff on it. ' +
|
|
81
81
|
'quilt_history tells you who changed which file, when, with the diff: read it for the files you are about to touch. ' +
|
|
82
82
|
'If the person you work for lets their AI pick up work by itself (their cloud AI, on the cloud machine they connected), finishing (quilt_set_work done, a task to QA or Done) hands you your next task from the board: start it. ' +
|
|
83
83
|
'Before you change files, call quilt_before_edit with their paths: it shows what people said about those files in chat and who else changed them lately, ' +
|
|
84
84
|
'so you know what was asked or planned before you change them. It never refuses: nobody holds files. ' +
|
|
85
|
-
'Edit any file you may change: edits merge as they arrive, and if your change clashes with someone\'s on the same lines, Quilt tells you. In your own folder the clash is in the file itself: your save is not shared, and the file has both versions of those lines between conflict markers ("<<<<<<< mine", "=======", ">>>>>>> session"). Edit them to what they should be, delete the marker lines and save: it is shared then. A conflict listed at the top of a Quilt answer instead (an agent with no folder made it, or an older app) is resolved at once with quilt_resolve_merge. A conflict must not sit: until you resolve your own, moving a task to QA or Done, quilt_set_work done and commits refuse, and a conflict whose writer\'s AI is gone is handed to another AI in the
|
|
85
|
+
'Edit any file you may change: edits merge as they arrive, and if your change clashes with someone\'s on the same lines, Quilt tells you. In your own folder the clash is in the file itself: your save is not shared, and the file has both versions of those lines between conflict markers ("<<<<<<< mine", "=======", ">>>>>>> session"). Edit them to what they should be, delete the marker lines and save: it is shared then. A conflict listed at the top of a Quilt answer instead (an agent with no folder made it, or an older app) is resolved at once with quilt_resolve_merge. A conflict must not sit: until you resolve your own, moving a task to QA or Done, quilt_set_work done and commits refuse, and a conflict whose writer\'s AI is gone is handed to another AI in the codebase. ' +
|
|
86
86
|
'For an agent of its own (not a person\'s AI session), every quilt answer starts with anything new for it (direct messages, mentions, tasks handed to it): act on it. ' +
|
|
87
87
|
'These rules are enforced for agents: while someone who messaged or mentioned you is waiting for an answer, the tools that move work on (tasks, focus, quilt_set_work) refuse until you answer them with quilt_message. ' +
|
|
88
88
|
'When you start a piece of work, call quilt_set_work with "working" and a note of what it is (with quilt_set_focus), so the loom shows you stitching; when you finish, call it with "done". ' +
|
|
89
89
|
'Always re-read a file right before you edit it. ' +
|
|
90
|
-
'If quilt_status starts with While you were away, the
|
|
90
|
+
'If quilt_status starts with While you were away, the codebase changed since this folder last synced: read quilt_history for those files before editing them. ' +
|
|
91
91
|
'For an agent of its own, mentions of it (@yourname) in chat, direct messages to it and tasks handed to it wait in quilt_inbox: read it when you start, and act on each one. ' +
|
|
92
92
|
'Each comes with the conversation before it with its sender; when a message refers to something earlier you do not have, read back with quilt_conversation before you answer, never guess. ' +
|
|
93
93
|
'When you are about to answer someone in chat, quilt_typing shows them you are typing; sending clears it. ' +
|
|
94
94
|
'Chat: ' + CHAT_RULES.replace(/^Send a chat message\. /, '') + ' A message that needs nothing back is settled with quilt_inbox (no_reply: [its id]), not answered. ' +
|
|
95
95
|
WAKE_STEP + ' On a computer the ways include a command Quilt runs on each event (`quilt join --on-mention`), `quilt inbox --wait`, the quilt://inbox resource (MCP push), a webhook, email and a schedule. ' +
|
|
96
|
-
'In the
|
|
96
|
+
'In the codebase you are your person: your messages and tasks are theirs, and people see you as them. "<person>\'s AI" ("Daniel\'s AI") is only that person\'s cloud AI, when they connected one (Quilt runs their own AI tool for them on their own cloud machine): write to it by that name. Nothing written or handed to "<person>\'s AI" comes to you; when your person asks you to work on tasks, take them from the board (quilt_tasks). ' +
|
|
97
97
|
PERSON_CHAT + ' ' +
|
|
98
98
|
'Share what you are doing with quilt_share: when you start on a request (request and your plan) and when you finish (what you did and the files you changed). Partners see it in their feed, and it puts your work on the task board. ' +
|
|
99
99
|
'When Claude Code is started with the quilt channel, they arrive on their own as <channel source="quilt"> events while you work: treat each like a request from that person, answer with quilt_message, and take a task with quilt_move_task. ' +
|
|
@@ -132,7 +132,7 @@ export async function runMcp () {
|
|
|
132
132
|
const introduce = () => {
|
|
133
133
|
if (!hello.name || hello.told) return ''
|
|
134
134
|
hello.told = true
|
|
135
|
-
return `You are **${hello.name}** in this Quilt
|
|
135
|
+
return `You are **${hello.name}** in this Quilt codebase: partners write to you by that name.\n\n`
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
// A session this MCP server runs itself, when the agent joined or started one.
|
|
@@ -203,7 +203,7 @@ export async function runMcp () {
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
server.registerTool('quilt_status', {
|
|
206
|
-
description: 'See who else is in the live
|
|
206
|
+
description: 'See who else is in the live codebase, what they are working on, which files they recently edited, recent messages, and which open tasks are assigned to you. Call this before starting work.',
|
|
207
207
|
inputSchema: {}
|
|
208
208
|
}, () => withDaemon(async (d) => {
|
|
209
209
|
const st = await call(d, 'GET', '/status')
|
|
@@ -221,7 +221,7 @@ export async function runMcp () {
|
|
|
221
221
|
}, ({ path: p, id, how } = {}) => withDaemon(async (d) => {
|
|
222
222
|
const ref = id || p
|
|
223
223
|
const { held } = await call(d, 'GET', '/held')
|
|
224
|
-
if (!ref) return held.filter((r) => r.state === 'open').map(describeHeld).join('\n\n') || 'There are no open held conflicts in this
|
|
224
|
+
if (!ref) return held.filter((r) => r.state === 'open').map(describeHeld).join('\n\n') || 'There are no open held conflicts in this codebase.'
|
|
225
225
|
if (!how) {
|
|
226
226
|
const r = findHeldIn(held, ref)
|
|
227
227
|
return r ? describeHeld(r) : `There is no held conflict for ${ref}.`
|
|
@@ -245,7 +245,7 @@ export async function runMcp () {
|
|
|
245
245
|
title: z.string().describe('What needs doing, in a few words'),
|
|
246
246
|
assignee: z.string().optional().describe('Who should do it: a person\'s name, or "me". Omit to leave it unassigned.'),
|
|
247
247
|
to_ai: z.boolean().optional().describe('Assign it to that person\'s AI (their cloud AI, when they connected one) instead of the person. To take a task yourself, set assignee to your own name.'),
|
|
248
|
-
files: z.array(z.string()).max(20).optional().describe('
|
|
248
|
+
files: z.array(z.string()).max(20).optional().describe('Files in the codebase this task is about, relative paths such as src/app.js')
|
|
249
249
|
}
|
|
250
250
|
}, ({ title, assignee, to_ai, files }) => withDaemon(async (d) => {
|
|
251
251
|
const body = { title }
|
|
@@ -259,7 +259,7 @@ export async function runMcp () {
|
|
|
259
259
|
}, { gate: gateFor('quilt_add_task') }))
|
|
260
260
|
|
|
261
261
|
server.registerTool('quilt_move_task', {
|
|
262
|
-
description: 'Move a task on the shared board. "doing" when you start it: you get a briefing (its files, recent changes to them, the
|
|
262
|
+
description: 'Move a task on the shared board. "doing" when you start it: you get a briefing (its files, recent changes to them, the codebase\'s checks), and an agent that is a member of its own is moved onto the ticket\'s own git branch (quilt/<ticket>); a person\'s folder stays where it is. ' +
|
|
263
263
|
'"qa" when you finish implementing and testing: requires `qaNotes` (what changed and how you self-validated); without it the move is refused, and so is an agent\'s move while the ticket\'s branch is not committed and pushed. ' +
|
|
264
264
|
'"done" after QA: requires `verified`, what you ran and what you saw; without it the move is refused.',
|
|
265
265
|
inputSchema: {
|
|
@@ -363,7 +363,7 @@ export async function runMcp () {
|
|
|
363
363
|
inputSchema: {
|
|
364
364
|
text: z.string(),
|
|
365
365
|
to: z.string().optional().describe('Name of one collaborator for a direct message'),
|
|
366
|
-
everyone: z.boolean().optional().describe('Only for a real announcement to the
|
|
366
|
+
everyone: z.boolean().optional().describe('Only for a real announcement to everyone in the codebase: lets a message that @mentions nobody go out'),
|
|
367
367
|
re: z.string().max(40).optional().describe(RE_HELP),
|
|
368
368
|
also: z.boolean().optional().describe('Only when another of your AI sessions already wrote to them, or their message was already answered, and yours is about something different they need')
|
|
369
369
|
}
|
|
@@ -411,8 +411,8 @@ export async function runMcp () {
|
|
|
411
411
|
|
|
412
412
|
server.registerTool('quilt_webhook_subscribe', {
|
|
413
413
|
description: 'Be told as it happens, by an HTTP POST to a URL of yours, when you are mentioned in chat (@yourname), sent a direct message or handed a task: ' +
|
|
414
|
-
'no need to poll quilt_inbox. The Quilt relay keeps it and sends it, so it reaches you even while this computer is asleep or offline, from every
|
|
415
|
-
'One webhook per agent; calling again replaces it. Each POST is JSON that names its
|
|
414
|
+
'no need to poll quilt_inbox. The Quilt relay keeps it and sends it, so it reaches you even while this computer is asleep or offline, from every codebase you join as this agent. ' +
|
|
415
|
+
'One webhook per agent; calling again replaces it. Each POST is JSON that names its codebase, signed with the secret ' +
|
|
416
416
|
'(x-quilt-signature: sha256=HMAC-SHA256(secret, "<x-quilt-timestamp>.<body>")); answer 2xx. Give a secret of your own or get one back (shown once). ' +
|
|
417
417
|
'quilt_webhook_test checks it. (http to this computer works too, sent by this computer while it is awake.)',
|
|
418
418
|
inputSchema: {
|
|
@@ -542,9 +542,9 @@ export async function runMcp () {
|
|
|
542
542
|
}
|
|
543
543
|
|
|
544
544
|
server.registerTool('quilt_send_file', {
|
|
545
|
-
description: 'Send a file from this
|
|
545
|
+
description: 'Send a file from this folder to collaborators through chat, without adding it to the shared codebase (useful for screenshots, logs, exports, or drafts). The file must be inside the codebase\'s folder.',
|
|
546
546
|
inputSchema: {
|
|
547
|
-
path: z.string().describe('Path relative to the
|
|
547
|
+
path: z.string().describe('Path relative to the codebase\'s root'),
|
|
548
548
|
to: z.string().optional().describe('Send only to this collaborator'),
|
|
549
549
|
message: z.string().optional().describe('Optional note to go with the file')
|
|
550
550
|
}
|
|
@@ -555,10 +555,10 @@ export async function runMcp () {
|
|
|
555
555
|
}, { gate: gateFor('quilt_send_file') }))
|
|
556
556
|
|
|
557
557
|
server.registerTool('quilt_get_file', {
|
|
558
|
-
description: 'Download a file someone shared in chat. Received files are normally saved automatically (see quilt_read_messages); use this to fetch one again or save it into the
|
|
558
|
+
description: 'Download a file someone shared in chat. Received files are normally saved automatically (see quilt_read_messages); use this to fetch one again or save it into the codebase.',
|
|
559
559
|
inputSchema: {
|
|
560
560
|
id: z.string().describe('The message id shown next to the file'),
|
|
561
|
-
dest: z.string().optional().describe('Destination path or folder inside the
|
|
561
|
+
dest: z.string().optional().describe('Destination path or folder inside the codebase (default: the "Chat files" folder)')
|
|
562
562
|
}
|
|
563
563
|
}, ({ id, dest }) => withDaemon(async (d) => {
|
|
564
564
|
const r = await call(d, 'POST', '/get', { id, dest: dest ? insideProject(d.dir, dest) : undefined })
|
|
@@ -568,7 +568,7 @@ export async function runMcp () {
|
|
|
568
568
|
// ------------------------------------------------ joining as an agent --
|
|
569
569
|
|
|
570
570
|
const startAs = async ({ conn, folder, agent, inviteServer, starting = false, workspace = '' }) => {
|
|
571
|
-
if (joined) throw new Error(`Already in
|
|
571
|
+
if (joined) throw new Error(`Already in the codebase ${path.basename(joined.dir)} (${joined.dir}). Call quilt_leave_session first.`)
|
|
572
572
|
const cwd = process.env.QUILT_DIR || process.cwd()
|
|
573
573
|
let dir = folder ? path.resolve(cwd, folder) : null
|
|
574
574
|
if (!dir) {
|
|
@@ -585,7 +585,7 @@ export async function runMcp () {
|
|
|
585
585
|
joined = { dir, attached: true }
|
|
586
586
|
return { dir, attached: true }
|
|
587
587
|
}
|
|
588
|
-
throw new Error(`${dir} is already synced
|
|
588
|
+
throw new Error(`${dir} is already synced with another quilt codebase. Choose another folder.`)
|
|
589
589
|
}
|
|
590
590
|
// A person's folder that isn't being synced right now (they left, or closed the app) is
|
|
591
591
|
// still theirs: taking it over would lock them out of their own session until the agent
|
|
@@ -595,7 +595,7 @@ export async function runMcp () {
|
|
|
595
595
|
const auth = sessionPasses({ agent: agentKey })
|
|
596
596
|
let aside = null
|
|
597
597
|
if (!dir || personsFolder(dir, auth.name)) {
|
|
598
|
-
if (starting) throw new Error(`${dir} already belongs to a
|
|
598
|
+
if (starting) throw new Error(`${dir} already belongs to a codebase a person started on this computer. Ask them for its invite link and join that, or start from another folder.`)
|
|
599
599
|
aside = dir || cwd
|
|
600
600
|
dir = agentCopyFolder(conn.room, auth.name)
|
|
601
601
|
}
|
|
@@ -644,8 +644,8 @@ export async function runMcp () {
|
|
|
644
644
|
log: (line) => run.session.log(line)
|
|
645
645
|
}).catch(() => {})
|
|
646
646
|
} catch (err) {
|
|
647
|
-
workspaceError = `Could not add it to
|
|
648
|
-
run.session.log(`could not add this
|
|
647
|
+
workspaceError = `Could not add it to project ${workspace}: ${err.message}`
|
|
648
|
+
run.session.log(`could not add this codebase to project ${workspace}: ${err.message}`)
|
|
649
649
|
forgetWorkspace(dir)
|
|
650
650
|
}
|
|
651
651
|
}
|
|
@@ -665,25 +665,25 @@ export async function runMcp () {
|
|
|
665
665
|
const st = d ? await call(d, 'GET', '/status') : null
|
|
666
666
|
const info = d ? await call(d, 'GET', '/info') : null
|
|
667
667
|
const lines = [extra]
|
|
668
|
-
if (info) lines.push(`
|
|
668
|
+
if (info) lines.push(`Codebase folder: ${info.dir}`, `You appear as: ${info.name}${info.kind === 'agent' ? ' (AI agent)' : ''}`)
|
|
669
669
|
// Only the id is known locally in phase 1 (its name comes from the accounts API later).
|
|
670
670
|
const cfg = readConfig(dir)
|
|
671
|
-
if (cfg && cfg.workspace) lines.push(`
|
|
671
|
+
if (cfg && cfg.workspace) lines.push(`Project: ${cfg.workspace}`)
|
|
672
672
|
if (st) lines.push(`Shared files: ${st.fileCount}`, `People online: ${st.peers.map((p) => p.name).join(', ') || 'nobody else yet'}`)
|
|
673
673
|
const acc = info && info.access
|
|
674
|
-
if (acc && acc.state === 'pending') lines.push('⏳ Waiting for the
|
|
674
|
+
if (acc && acc.state === 'pending') lines.push('⏳ Waiting for the codebase\'s owner to let you in. Nothing syncs until they approve you; check again with quilt_session_info.')
|
|
675
675
|
else if (acc && acc.controlled) lines.push(`Your access: ${acc.owner ? 'owner' : acc.role === 'viewer' ? 'view only (your file changes are undone)' : acc.scopes && acc.scopes.length ? `may change files only in ${acc.scopes.join(', ')}` : 'may change any file'}`)
|
|
676
676
|
if (info && info.invite) lines.push(`Invite link to edit (for others to join): ${info.invite}`)
|
|
677
677
|
if (info && info.viewInvite) lines.push(`Invite link to view only: ${info.viewInvite}`)
|
|
678
|
-
if (joined && joined.run) lines.push('
|
|
678
|
+
if (joined && joined.run) lines.push('Your connection to the codebase runs inside this MCP server and ends when it stops, or with quilt_leave_session.')
|
|
679
679
|
return lines.filter(Boolean).join('\n')
|
|
680
680
|
}
|
|
681
681
|
|
|
682
682
|
server.registerTool('quilt_join_session', {
|
|
683
|
-
description: 'Join a live quilt
|
|
683
|
+
description: 'Join a live quilt codebase from an invite link, as an AI agent. Its files are synced into a folder (the current folder if it is empty or already this codebase\'s, otherwise a new "quilt-<room>" subfolder) and kept in sync live. Other people see you in the codebase.',
|
|
684
684
|
inputSchema: {
|
|
685
685
|
invite: z.string().describe('The invite link, like https://join.heyquilt.com/<room>#<secret> (or the full "quilt join <link>" command)'),
|
|
686
|
-
folder: z.string().optional().describe('Where to put the
|
|
686
|
+
folder: z.string().optional().describe('Where to put the codebase, relative to the current folder'),
|
|
687
687
|
agent: z.string().optional().describe('Which Quilt agent to join as (saved with `quilt agent join`). Optional when this computer has only one.')
|
|
688
688
|
}
|
|
689
689
|
}, async ({ invite, folder, agent }) => {
|
|
@@ -691,8 +691,8 @@ export async function runMcp () {
|
|
|
691
691
|
const conn = decodeInvite(invite)
|
|
692
692
|
const r = await startAs({ conn, folder, agent })
|
|
693
693
|
const text = await describeSession(r.dir, r.attached
|
|
694
|
-
? `This folder is already in the
|
|
695
|
-
: `Joined room ${conn.room}. Files are synced into ${r.dir}; edit them there.${r.aside ? ` (${r.aside} is a person's own copy of this
|
|
694
|
+
? `This folder is already in the codebase (someone runs quilt here), so you're working through their connection to it.`
|
|
695
|
+
: `Joined room ${conn.room}. Files are synced into ${r.dir}; edit them there.${r.aside ? ` (${r.aside} is a person's own copy of this codebase on this computer and stays theirs: don't sync or edit it from here.)` : ''}`)
|
|
696
696
|
return { content: [{ type: 'text', text }] }
|
|
697
697
|
} catch (err) {
|
|
698
698
|
return { content: [{ type: 'text', text: `Could not join: ${err.message}` }], isError: true }
|
|
@@ -700,31 +700,31 @@ export async function runMcp () {
|
|
|
700
700
|
})
|
|
701
701
|
|
|
702
702
|
server.registerTool('quilt_start_session', {
|
|
703
|
-
description: 'Start a new live quilt
|
|
703
|
+
description: 'Start a new live quilt codebase from a folder, as an AI agent, and get an invite link for others.',
|
|
704
704
|
inputSchema: {
|
|
705
705
|
folder: z.string().optional().describe('Folder to share, relative to the current folder (default: current folder)'),
|
|
706
706
|
agent: z.string().optional().describe('Which Quilt agent to join as (saved with `quilt agent join`). Optional when this computer has only one.'),
|
|
707
|
-
workspace: z.string().optional().describe('The id of the
|
|
707
|
+
workspace: z.string().optional().describe('The id of the project this codebase belongs to, if the person gave you one.')
|
|
708
708
|
}
|
|
709
709
|
}, async ({ folder, agent, workspace }) => {
|
|
710
710
|
if (workspace && !WORKSPACE_ID.test(workspace)) {
|
|
711
|
-
return { content: [{ type: 'text', text: `Could not start: "${workspace}" is not a
|
|
711
|
+
return { content: [{ type: 'text', text: `Could not start: "${workspace}" is not a project id. A project id looks like 6f1d2c3b-4a5e-4f60-8a9b-0c1d2e3f4a5b; ask the person for it, or leave workspace out.` }], isError: true }
|
|
712
712
|
}
|
|
713
713
|
try {
|
|
714
714
|
const r = await startAs({ conn: newConn(), folder: folder || '.', agent, starting: true, workspace: workspace || '' })
|
|
715
|
-
const started = `Started a
|
|
716
|
-
return { content: [{ type: 'text', text: await describeSession(r.dir, r.workspaceError ? `${started}\n${r.workspaceError}. It is outside any
|
|
715
|
+
const started = `Started a codebase for ${r.dir}. Share the invite link below with collaborators.`
|
|
716
|
+
return { content: [{ type: 'text', text: await describeSession(r.dir, r.workspaceError ? `${started}\n${r.workspaceError}. It is outside any project.` : started) }] }
|
|
717
717
|
} catch (err) {
|
|
718
718
|
return { content: [{ type: 'text', text: `Could not start: ${err.message}` }], isError: true }
|
|
719
719
|
}
|
|
720
720
|
})
|
|
721
721
|
|
|
722
722
|
server.registerTool('quilt_leave_session', {
|
|
723
|
-
description: 'Leave the
|
|
723
|
+
description: 'Leave the codebase this agent joined or started. Files stay on disk.',
|
|
724
724
|
inputSchema: {}
|
|
725
725
|
}, async () => {
|
|
726
726
|
const left = await leave()
|
|
727
|
-
return { content: [{ type: 'text', text: left ? 'Left the
|
|
727
|
+
return { content: [{ type: 'text', text: left ? 'Left the codebase. The files stay where they are.' : 'You have not joined a codebase from here.' }] }
|
|
728
728
|
})
|
|
729
729
|
|
|
730
730
|
server.registerTool('quilt_set_work', {
|
|
@@ -751,33 +751,33 @@ export async function runMcp () {
|
|
|
751
751
|
inputSchema: {
|
|
752
752
|
request: z.string().max(2000).optional().describe('What your user asked for, in a sentence (only when starting a new request)'),
|
|
753
753
|
summary: z.string().max(4000).describe('Your plan, progress or result, in one to three sentences'),
|
|
754
|
-
files: z.array(z.string().max(300)).max(30).optional().describe('
|
|
754
|
+
files: z.array(z.string().max(300)).max(30).optional().describe('Files you changed in the codebase, relative paths')
|
|
755
755
|
}
|
|
756
756
|
}, ({ request, summary, files }) => withDaemon(async (d) => {
|
|
757
757
|
const r = await call(d, 'POST', '/share-work', { tool: clientTool(), request, summary, files })
|
|
758
|
-
if (r.automatic) return 'Quilt already shares your chat with the
|
|
759
|
-
return r.shared ? 'Shared with the
|
|
758
|
+
if (r.automatic) return 'Quilt already shares your chat with the codebase as you work, so nothing more to do.'
|
|
759
|
+
return r.shared ? 'Shared with the codebase.' : 'Nothing to share: give a summary.'
|
|
760
760
|
}))
|
|
761
761
|
|
|
762
762
|
server.registerTool('quilt_chat_link', {
|
|
763
|
-
description: '
|
|
763
|
+
description: 'Codebase owner only: make a link for an AI that only has a chat window (ChatGPT, claude.ai, Grok and the like). ' +
|
|
764
764
|
'Your user pastes it into that chat; the AI then reads and sends messages, reads and adds tasks, reads files, and adds pictures, documents and notes ' +
|
|
765
765
|
'by opening links, with nothing to install. It joins as its own member (removing it ends the link). ' +
|
|
766
766
|
'It works for ten minutes unless extended with quilt_extend_chat_link; once it runs out, a new link is needed.',
|
|
767
767
|
inputSchema: {
|
|
768
|
-
name: z.string().max(40).optional().describe('How it appears in the
|
|
768
|
+
name: z.string().max(40).optional().describe('How it appears in the codebase, e.g. "ChatGPT"'),
|
|
769
769
|
minutes: z.number().int().min(1).max(43200).optional().describe('How long the link works (default 10 minutes, at most 30 days)')
|
|
770
770
|
}
|
|
771
771
|
}, ({ name, minutes }) => withDaemon(async (d) => {
|
|
772
772
|
const r = await call(d, 'POST', '/chat-link', { name, minutes })
|
|
773
773
|
return `Chat link for ${r.name} (works until ${new Date(r.expiresAt).toISOString().slice(0, 16).replace('T', ' ')} UTC):\n${r.url}\n\n` +
|
|
774
|
-
'Give it to your user to paste into the chat AI, with a line like "Open this link and follow it to join our Quilt
|
|
774
|
+
'Give it to your user to paste into the chat AI, with a line like "Open this link and follow it to join our Quilt codebase." Anyone with the link can act as that member, so share it only there.'
|
|
775
775
|
}))
|
|
776
776
|
|
|
777
777
|
server.registerTool('quilt_extend_chat_link', {
|
|
778
|
-
description: '
|
|
778
|
+
description: 'Codebase owner only: set how long a chat link still works, from now (shorter or longer). Only a link that still works can be extended; one that ran out needs a new link (quilt_chat_link).',
|
|
779
779
|
inputSchema: {
|
|
780
|
-
who: z.string().max(80).describe('The chat AI\'s name in the
|
|
780
|
+
who: z.string().max(80).describe('The chat AI\'s name in the codebase, e.g. "ChatGPT"'),
|
|
781
781
|
minutes: z.number().int().min(1).max(43200).describe('Minutes from now, e.g. 60 for an hour')
|
|
782
782
|
}
|
|
783
783
|
}, ({ who, minutes }) => withDaemon(async (d) => {
|
|
@@ -789,7 +789,7 @@ export async function runMcp () {
|
|
|
789
789
|
description: 'Call before you change files (with your own edit tools), with the paths you are about to change. For each file: who else changed it lately, ' +
|
|
790
790
|
'and what people said about those files in chat (what they asked for, warned about or planned). It never refuses: nobody holds files, and edits merge as they arrive. Works in every tool.',
|
|
791
791
|
inputSchema: {
|
|
792
|
-
paths: z.array(z.string().min(1).max(500)).min(1).max(50).describe('Files you are about to change: relative to the
|
|
792
|
+
paths: z.array(z.string().min(1).max(500)).min(1).max(50).describe('Files you are about to change: relative to the codebase\'s folder, or absolute inside it')
|
|
793
793
|
}
|
|
794
794
|
}, ({ paths }) => withDaemon(async (d) => {
|
|
795
795
|
const outside = []
|
|
@@ -805,14 +805,14 @@ export async function runMcp () {
|
|
|
805
805
|
if (!f.shared) lines.push(`- ${f.path}: not shared by Quilt (ignored or private): edit it as you like.`)
|
|
806
806
|
else lines.push(`- ${f.path}: ✅ go ahead.`)
|
|
807
807
|
}
|
|
808
|
-
for (const p of outside) lines.push(`- ${p}: not inside the
|
|
808
|
+
for (const p of outside) lines.push(`- ${p}: not inside the codebase's folder (${d.dir}).`)
|
|
809
809
|
const recent = renderRecent(r.files)
|
|
810
810
|
const said = renderChatAbout(r.chat)
|
|
811
811
|
return lines.join('\n') + (recent ? `\n\n${recent}` : '') + (said ? `\n\n${said}` : '') + '\n\nRe-read each file right before you edit it.'
|
|
812
812
|
}))
|
|
813
813
|
|
|
814
814
|
server.registerTool('quilt_project_rules', {
|
|
815
|
-
description: 'The
|
|
815
|
+
description: 'The codebase\'s rules for AI and its design system, the same whatever tool you run in: AGENTS.md (root and folders, else CLAUDE.md), Cursor rules that always apply, and DESIGN.md (or the file AGENTS.md names). Read it before your first change in a codebase.',
|
|
816
816
|
inputSchema: {}
|
|
817
817
|
}, () => withDaemon(async (d) => (await call(d, 'GET', '/rules')).text))
|
|
818
818
|
|
|
@@ -835,14 +835,14 @@ export async function runMcp () {
|
|
|
835
835
|
}
|
|
836
836
|
|
|
837
837
|
server.registerTool('quilt_session_info', {
|
|
838
|
-
description: 'Where the shared
|
|
838
|
+
description: 'Where the shared codebase lives on disk, how you appear to others, who is online, and the invite link.',
|
|
839
839
|
inputSchema: {}
|
|
840
840
|
}, () => withDaemon(async (d) => describeSession(d.dir)))
|
|
841
841
|
|
|
842
842
|
// ------------------------------------------------- the workspace, for agents --
|
|
843
843
|
|
|
844
844
|
server.registerTool('quilt_history', {
|
|
845
|
-
description: 'The chronology of the
|
|
845
|
+
description: 'The chronology of the codebase: who changed which file, when, what changed (diff) and for which task. ' +
|
|
846
846
|
'Filter by path or glob, person, task or time. Use it to understand recent changes before building on them, or to find what broke something.',
|
|
847
847
|
inputSchema: {
|
|
848
848
|
path: z.string().max(500).optional().describe('A file, a folder ending in "/", or a glob like src/ui/**'),
|
|
@@ -866,7 +866,7 @@ export async function runMcp () {
|
|
|
866
866
|
}, ({ who, limit }) => withDaemon(async (d) => {
|
|
867
867
|
const st = await call(d, 'GET', '/status')
|
|
868
868
|
if (!who) {
|
|
869
|
-
if (!st.peers.length) return 'Nobody else is in the
|
|
869
|
+
if (!st.peers.length) return 'Nobody else is in the codebase right now.'
|
|
870
870
|
return st.peers.map((p) => {
|
|
871
871
|
const a = p.agent || {}
|
|
872
872
|
const reported = p.work && p.work.state === 'working' ? `working${p.work.note ? `: ${p.work.note}` : ''}` : null
|
|
@@ -893,7 +893,7 @@ export async function runMcp () {
|
|
|
893
893
|
}))
|
|
894
894
|
|
|
895
895
|
server.registerTool('quilt_list_files', {
|
|
896
|
-
description: 'List the shared
|
|
896
|
+
description: 'List the shared codebase\'s files with who edited each one recently, so you can see where others are working.',
|
|
897
897
|
inputSchema: { prefix: z.string().optional().describe('Only paths under this folder, e.g. "src/auth"') }
|
|
898
898
|
}, ({ prefix }) => withDaemon(async (d) => {
|
|
899
899
|
const { files } = await call(d, 'GET', '/tree')
|
|
@@ -971,7 +971,7 @@ export function workspaceActor ({ dirs = [process.cwd()] } = {}) {
|
|
|
971
971
|
return signedIn ? { person: true } : null
|
|
972
972
|
}
|
|
973
973
|
|
|
974
|
-
const NOBODY = 'Sign in to Quilt on this computer (the Quilt app, or quilt login), or join as an agent, to use
|
|
974
|
+
const NOBODY = 'Sign in to Quilt on this computer (the Quilt app, or quilt login), or join as an agent, to use a project\'s artifacts.'
|
|
975
975
|
|
|
976
976
|
/**
|
|
977
977
|
* How the library reaches the API from this computer, for the local MCP and the CLI: as
|
|
@@ -1063,9 +1063,9 @@ const realOr = async (p) => { try { return await fs.promises.realpath(p) } catch
|
|
|
1063
1063
|
export async function readLocalFile (p, dirs = [process.cwd()]) {
|
|
1064
1064
|
const abs = await fs.promises.realpath(path.resolve(dirs[0] || process.cwd(), String(p)))
|
|
1065
1065
|
const roots = await Promise.all([...dirs, os.tmpdir()].map(realOr))
|
|
1066
|
-
if (!roots.some((root) => isInside(root, abs))) throw new Error(`${p} is outside this
|
|
1066
|
+
if (!roots.some((root) => isInside(root, abs))) throw new Error(`${p} is outside this codebase. Copy it into the codebase's folder first, then send it from there.`)
|
|
1067
1067
|
const home = await realOr(quiltHome())
|
|
1068
|
-
if (abs === home || isInside(home, abs)) throw new Error('Quilt\'s own files (keys and settings) are not
|
|
1068
|
+
if (abs === home || isInside(home, abs)) throw new Error('Quilt\'s own files (keys and settings) are not added to a project\'s artifacts.')
|
|
1069
1069
|
const base = path.basename(abs)
|
|
1070
1070
|
if (/^\.env(\..*)?$/.test(base) && base !== '.env.example') throw new Error('refusing to send environment/secret files')
|
|
1071
1071
|
const st = await fs.promises.stat(abs)
|
|
@@ -1080,7 +1080,7 @@ function insideProject (root, p, { reading = false } = {}) {
|
|
|
1080
1080
|
const abs = path.resolve(root, p)
|
|
1081
1081
|
const check = (base, target) => {
|
|
1082
1082
|
const rel = path.relative(base, target)
|
|
1083
|
-
if (rel === '' || rel.startsWith('..') || path.isAbsolute(rel)) throw new Error('path must be inside the
|
|
1083
|
+
if (rel === '' || rel.startsWith('..') || path.isAbsolute(rel)) throw new Error('path must be inside the codebase\'s folder')
|
|
1084
1084
|
}
|
|
1085
1085
|
check(root, abs)
|
|
1086
1086
|
if (reading) {
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// Where a new session's project comes from, and its folder made ready before the session starts:
|
|
2
|
+
// cloned from a repository, a folder already on this computer, or something new. Whichever it is,
|
|
3
|
+
// the folder has git when the session starts in it (Daniel, 2026-11-19: every session comes with git).
|
|
4
|
+
import fs from 'node:fs'
|
|
5
|
+
import path from 'node:path'
|
|
6
|
+
import { parseRepo, folderName } from './repo-ref.js'
|
|
7
|
+
import { gitDir, repoAbove, cloneRepo, startRepo, keepQuiltOut } from './gitstate.js'
|
|
8
|
+
import { loadIgnore, walk } from './fsutil.js'
|
|
9
|
+
|
|
10
|
+
export const SOURCES = ['folder', 'github', 'scratch']
|
|
11
|
+
const MAX_NAME = 80
|
|
12
|
+
const MAX_BRIEF = 8000
|
|
13
|
+
|
|
14
|
+
const fail = (message) => Object.assign(new Error(message), { status: 400 })
|
|
15
|
+
const empty = (dir) => { try { return fs.readdirSync(dir).length === 0 } catch { return true } }
|
|
16
|
+
|
|
17
|
+
/** `base/name`, or `base/name-2`, `-3`… when a folder with something in it is already there. */
|
|
18
|
+
function freeUnder (base, name) {
|
|
19
|
+
for (let n = 1; n < 200; n++) {
|
|
20
|
+
const dir = path.join(base, n === 1 ? name : `${name}-${n}`)
|
|
21
|
+
if (!fs.existsSync(dir) || empty(dir)) return dir
|
|
22
|
+
}
|
|
23
|
+
throw fail(`There are too many folders called ${name} in ${base}. Choose another folder.`)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** What was typed for a repository or a new project, checked: { url?, name } or a 400 with what to fix. */
|
|
27
|
+
function named ({ source, repo, name }) {
|
|
28
|
+
if (source === 'github') {
|
|
29
|
+
const r = parseRepo(repo)
|
|
30
|
+
if (!r) throw fail('Give the repository as owner/name, or its address (https://github.com/owner/name).')
|
|
31
|
+
return r
|
|
32
|
+
}
|
|
33
|
+
const clean = String(name || '').replace(/\s+/g, ' ').trim().slice(0, MAX_NAME)
|
|
34
|
+
if (!clean || !folderName(clean)) throw fail('Give the codebase a name.')
|
|
35
|
+
return { name: clean }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The folder a new session's project would go in when the person names none: under `base` (their folder for sessions). */
|
|
39
|
+
export function whereFor ({ source, repo, name, base }) {
|
|
40
|
+
if (source !== 'github' && source !== 'scratch') throw fail('Choose where the codebase comes from.')
|
|
41
|
+
const n = named({ source, repo, name })
|
|
42
|
+
return freeUnder(base, source === 'github' ? n.name : folderName(n.name))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* What starting from this would do, shown as the person fills the form in, with nothing made or
|
|
47
|
+
* changed: { dir, name } and, for a folder already here, whether it has git yet (`git`) and
|
|
48
|
+
* whether it is there at all (`exists`). Throws with what to fix.
|
|
49
|
+
*/
|
|
50
|
+
export function lookAt ({ source = 'folder', dir = '', repo = '', name = '', base }) {
|
|
51
|
+
if (!SOURCES.includes(source)) throw fail('Choose where the codebase comes from.')
|
|
52
|
+
if (source === 'folder') {
|
|
53
|
+
if (!dir) throw fail('Choose a folder.')
|
|
54
|
+
let st = null
|
|
55
|
+
try { st = fs.statSync(dir) } catch {}
|
|
56
|
+
if (st && !st.isDirectory()) throw fail(`${dir} is a file, not a folder.`)
|
|
57
|
+
return { dir, name: path.basename(dir), exists: !!st, git: !!((st && gitDir(dir)) || repoAbove(dir)) }
|
|
58
|
+
}
|
|
59
|
+
return { dir: whereFor({ source, repo, name, base }), name: named({ source, repo, name }).name }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Makes the folder of a new session ready. `source`: 'folder' (`dir`, there already), 'github'
|
|
64
|
+
* (`repo`, cloned into `dir` or a folder under `base`), 'scratch' (`name` and what to build,
|
|
65
|
+
* `brief`, in a new folder). `who`: { name, email } for a first commit made by someone whose git has
|
|
66
|
+
* no name. Returns { dir, name?, brief? }: where the session starts, what it is called, and what
|
|
67
|
+
* becomes its first ticket; `made`: this call made the folder (a clone, something new), so it may
|
|
68
|
+
* be removed again if the session can't start. Throws with what to tell the person.
|
|
69
|
+
*/
|
|
70
|
+
export async function prepareFolder ({ source = 'folder', dir = '', repo = '', name = '', brief = '', base, who = null }) {
|
|
71
|
+
if (!SOURCES.includes(source)) throw fail('Choose where the codebase comes from.')
|
|
72
|
+
if (source === 'folder') {
|
|
73
|
+
if (!dir) throw fail('Choose a folder.')
|
|
74
|
+
let st = null
|
|
75
|
+
try { st = fs.statSync(dir) } catch {}
|
|
76
|
+
if (st && !st.isDirectory()) throw fail(`${dir} is a file, not a folder.`)
|
|
77
|
+
fs.mkdirSync(dir, { recursive: true })
|
|
78
|
+
if (gitDir(dir)) { keepQuiltOut(dir); return { dir } }
|
|
79
|
+
// A folder inside a repository's checkout is that repository's: no second one is made inside it.
|
|
80
|
+
if (repoAbove(dir)) return { dir }
|
|
81
|
+
// No git yet: a repository of its own, with the files the session will share as its first commit.
|
|
82
|
+
const said = await startRepo(dir, { rels: [...walk(dir, loadIgnore(dir))], message: `Start of ${path.basename(dir)}`, who })
|
|
83
|
+
if (said) throw fail(`Quilt could not set up git in ${dir}: ${said}.`)
|
|
84
|
+
return { dir }
|
|
85
|
+
}
|
|
86
|
+
const n = named({ source, repo, name })
|
|
87
|
+
const target = dir || whereFor({ source, repo, name, base })
|
|
88
|
+
if (fs.existsSync(target) && !empty(target)) throw fail(`${target} already has files in it. Choose an empty folder, or start from that folder instead.`)
|
|
89
|
+
if (source === 'github') {
|
|
90
|
+
const said = await cloneRepo(n.url, target)
|
|
91
|
+
if (said) {
|
|
92
|
+
try { if (empty(target)) fs.rmSync(target, { recursive: true, force: true }) } catch {}
|
|
93
|
+
throw fail(`Quilt could not clone ${String(repo).trim()}: ${said}.`)
|
|
94
|
+
}
|
|
95
|
+
return { dir: target, name: n.name, made: true }
|
|
96
|
+
}
|
|
97
|
+
const text = String(brief || '').replace(/\r\n?/g, '\n').trim().slice(0, MAX_BRIEF)
|
|
98
|
+
fs.mkdirSync(target, { recursive: true })
|
|
99
|
+
fs.writeFileSync(path.join(target, 'README.md'), `# ${n.name}\n${text ? `\n${text}\n` : ''}`)
|
|
100
|
+
const said = await startRepo(target, { rels: ['README.md'], message: `Start ${n.name}`, who })
|
|
101
|
+
if (said) throw fail(`Quilt could not set up git in ${target}: ${said}.`)
|
|
102
|
+
return { dir: target, name: n.name, made: true, ...(text ? { brief: text } : {}) }
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** The first ticket of a project started from what someone wants to build: its title (one line) and, when there is more, the rest as its first comment. */
|
|
106
|
+
export function briefTicket (brief, maxTitle = 120) {
|
|
107
|
+
const text = String(brief || '').trim()
|
|
108
|
+
if (!text) return null
|
|
109
|
+
const first = text.split('\n')[0].replace(/\s+/g, ' ').trim()
|
|
110
|
+
const title = first.length > maxTitle ? `${first.slice(0, maxTitle - 1).trimEnd()}…` : first
|
|
111
|
+
return { title, ...(text !== title ? { comment: text } : {}) }
|
|
112
|
+
}
|
package/src/project-rules.js
CHANGED
|
@@ -86,9 +86,9 @@ const depth = (p) => p.split('/').length
|
|
|
86
86
|
/** The rules as one text for an agent. */
|
|
87
87
|
export function renderRules (r) {
|
|
88
88
|
if (!r.files.length && !r.design && !r.scoped.length) {
|
|
89
|
-
return 'This
|
|
89
|
+
return 'This codebase has no rules for AI yet (no AGENTS.md, CLAUDE.md or Cursor rules) and no design system file. Follow the code around what you change.'
|
|
90
90
|
}
|
|
91
|
-
const out = ['The
|
|
91
|
+
const out = ['The codebase\'s rules for AI, the same for every tool. Folder AGENTS.md files apply to the files under that folder.', '']
|
|
92
92
|
for (const f of r.files) out.push(`## ${f.path}`, '', f.text, '')
|
|
93
93
|
if (r.scoped.length) {
|
|
94
94
|
out.push('## Rules for some files only (Cursor)', '')
|
package/src/relay-ask.js
CHANGED
|
@@ -55,7 +55,7 @@ function membersAnswer (room) {
|
|
|
55
55
|
for (const h of room.hostedOnline()) people.add(h.name)
|
|
56
56
|
const total = Object.keys(room.meta.members || {}).length + 1 // members, and the owner
|
|
57
57
|
const names = [...people].sort()
|
|
58
|
-
if (!names.length) return `Nobody is connected right now (${plural(total, 'member')} in the
|
|
58
|
+
if (!names.length) return `Nobody is connected right now (${plural(total, 'member')} in the codebase).`
|
|
59
59
|
return `${plural(names.length, 'member')} connected of ${total}: ${list(names)}.`
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -86,7 +86,7 @@ export function unusedBranches (room, now = Date.now()) {
|
|
|
86
86
|
|
|
87
87
|
/** Branch names that are never trimmed for being merged: the trunk itself, whatever the session calls its default. */
|
|
88
88
|
function trimAnswer (room, asker, now) {
|
|
89
|
-
if (!asker.mayTrim) return 'Only the
|
|
89
|
+
if (!asker.mayTrim) return 'Only the codebase\'s owner can trim branches.'
|
|
90
90
|
const gone = unusedBranches(room, now)
|
|
91
91
|
if (!gone.length) return 'Nothing to trim: every branch is in use or was used in the last day.'
|
|
92
92
|
for (const k of gone) room.removeBranch(k, { save: false })
|
package/src/relay-cluster.js
CHANGED
|
@@ -26,9 +26,9 @@ const ROOM_RE = /^[A-Za-z0-9_-]{1,64}$/
|
|
|
26
26
|
const MACHINE_RE = /^[A-Za-z0-9_-]{1,64}$/
|
|
27
27
|
// Files in the data folder that look like rooms (`<name>.json`) and aren't.
|
|
28
28
|
export const NOT_ROOMS = new Set(['agent-links', 'hosted-agents', 'leases'])
|
|
29
|
-
export const MOVING = 'This
|
|
30
|
-
export const ELSEWHERE = 'This
|
|
31
|
-
export const NO_PLACEMENT = "The relay can't find which machine holds this
|
|
29
|
+
export const MOVING = 'This codebase is moving to another relay machine; try again in a moment'
|
|
30
|
+
export const ELSEWHERE = 'This codebase lives on another relay machine; try again in a moment'
|
|
31
|
+
export const NO_PLACEMENT = "The relay can't find which machine holds this codebase right now; try again in a moment"
|
|
32
32
|
|
|
33
33
|
/** Cluster settings, from options or the environment (Fly sets FLY_MACHINE_ID, FLY_REGION, FLY_APP_NAME). */
|
|
34
34
|
export function clusterConfig (opts = {}, env = process.env) {
|
package/src/relay-live-write.js
CHANGED
|
@@ -66,10 +66,10 @@ export function liveWrite (room, ws, req, { origin = WRITE_ORIGIN, now = Date.no
|
|
|
66
66
|
const e = k === ws.branch ? room.store.get(k) : null
|
|
67
67
|
if (!e) throw new Error(`you are not on ${key}`)
|
|
68
68
|
const a = room.access.get(ws)
|
|
69
|
-
if (!a || (a.state && a.state !== 'approved')) throw new Error('not in this
|
|
70
|
-
if (a.role === 'viewer') throw new Error('You can only view this
|
|
69
|
+
if (!a || (a.state && a.state !== 'approved')) throw new Error('not in this codebase')
|
|
70
|
+
if (a.role === 'viewer') throw new Error('You can only view this codebase; file changes are refused.')
|
|
71
71
|
const rel = String(req.path ?? '').trim().replace(/^\.\//, '')
|
|
72
|
-
if (!isSafeRelPath(rel)) throw new Error('That is not a path inside the
|
|
72
|
+
if (!isSafeRelPath(rel)) throw new Error('That is not a path inside the codebase.')
|
|
73
73
|
if (typeof req.text !== 'string' || req.text.length > MAX_WRITE_TEXT) throw new Error('a live write is a text of at most 2 MiB')
|
|
74
74
|
// What the relay would refuse or treat apart from a plain edit goes the old way: the folder edits the
|
|
75
75
|
// text as before and the relay's checks (checkChange, read-only branches, size limits) apply as ever.
|