Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/server/src/environment/Layers/ServerEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export const makeServerEnvironment = Effect.fn("makeServerEnvironment")(function
threadMoveQueue: true,
threadMoveBatch: true,
threadMoveStagedApproval: true,
threadMoveState: true,
projectSetup: true,
stallReports: true,
pullRequestObservations: true,
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/guide/topics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Linking is two-way, with a permission for each direction: "<A>'s agents can star

With a link allowed, an agent can start a thread on the other computer in that computer's copy of the project, read it and message it, and its reply comes back. A computer you only open from this app (Settings › Connections › Computers you use from here) is not a link: you see its threads here, but agents can't work across. This app's sign-in to it renews whenever they connect and ends after 90 days without one, or when that computer removes it. Fleet's All computers page and its own page then say the sign-in ended and offer to connect again with a new code; its threads stay on it.

To carry on a thread on a linked computer, for example before shutting this one down, click its title at the top of the chat or right-click it in the sidebar (or use the command palette), and pick Move to another computer. The thread goes with its messages and its code changes, including files not yet committed; staged changes arrive unstaged. It lands in a new worktree of that computer's copy of the project; the dialog offers to set the project up there when it's missing. When that computer's permission for this one is Ask first, its user allows the move there. The copy left here stays, read-only, with a link to the new one. With Claude, Codex or Pi, and the same kind of agent picked on the other computer, the agent keeps its full memory: its own session moves too (up to 50 MB) and picks up where it was. Otherwise, or if that session can't be resumed there, the agent gets a summary of the conversation; the dialog and the moved thread's timeline say which. Turns from before the move can't be undone there. A working thread can move too: Move when it's done starts the move once its turn and background work finish, and Stop and move now stops its agent first. While it waits, a notice above the message box says what for, with Cancel, and the thread takes no new messages. An agent can move its own thread with thread_move; it goes when that turn ends. To clear a computer before shutting it down, Move threads (on a computer's page in Fleet, or in the command palette) moves several at once, and quitting the desktop app while threads work offers to move them first, quitting once each has gone. When the other computer asks first, it takes each move's files right away and holds them until its user allows them (all the moves from one computer together, or one at a time), so this computer counts them as sent and can shut down; a move that isn't allowed unfreezes here the next time the two connect. A thread in a room, that started other threads, or that has a goal, a check-back, queued messages or pull request auto-fix on can't move yet; the dialog says what to finish first. General Chats don't move.`,
To carry on a thread on a linked computer, for example before shutting this one down, click its title at the top of the chat or right-click it in the sidebar (or use the command palette), and pick Move to another computer. The thread goes with its messages and its code changes, including files not yet committed; staged changes arrive unstaged. It lands in a new worktree of that computer's copy of the project; the dialog offers to set the project up there when it's missing. When that computer's permission for this one is Ask first, its user allows the move there. The copy left here stays, read-only, with a link to the new one. With Claude, Codex or Pi, and the same kind of agent picked on the other computer, the agent keeps its full memory: its own session moves too (up to 50 MB) and picks up where it was. Otherwise, or if that session can't be resumed there, the agent gets a summary of the conversation; the dialog and the moved thread's timeline say which. Turns from before the move can't be undone there. A working thread can move too: Move when it's done starts the move once its turn and background work finish, and Stop and move now stops its agent first. While it waits, a notice above the message box says what for, with Cancel, and the thread takes no new messages. An agent can move its own thread with thread_move; it goes when that turn ends. To clear a computer before shutting it down, Move threads (on a computer's page in Fleet, or in the command palette) moves several at once, and quitting the desktop app while threads work offers to move them first, quitting once each has gone. When the other computer asks first, it takes each move's files right away and holds them until its user allows them (all the moves from one computer together, or one at a time), so this computer counts them as sent and can shut down; a move that isn't allowed unfreezes here the next time the two connect. What a thread had going comes along when the other computer runs a current Threadlines, and runs there by itself: a goal that was working carries on, the agent is told its check-backs and sets them again, your queued messages are sent in order, pull request auto-fix and auto-merge keep watching from there (switched off, with why, when its branch had to be renamed there), and its plans come along, the waiting one with Implement. A General Chats thread moves with every file in its folder, up to 100 MB. The dialog says what comes along and what won't work there; the "Moved here" line on the other computer says what arrived and what didn't. If a move doesn't happen, the thread gets back here what the move stopped: its goal and its check-backs, and its queued messages go. A thread in a room, that started other threads, or with a message queued by a scheduled task, another thread or an assistant can't move yet; the dialog says what to finish first.`,
},
{
id: "devices",
Expand Down
38 changes: 36 additions & 2 deletions apps/server/src/links/LinkMoveRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,19 @@ export const LinkMoveStatus = Schema.Literals([
]);
export type LinkMoveStatus = typeof LinkMoveStatus.Type;

/** How far an import got; each stage is recorded before the next starts. */
export const LinkMoveStage = Schema.Literals(["fetched", "worktree", "applied"]);
/**
* How far an import got; each stage is recorded before the next starts. A
* thread with a checkout goes fetched, worktree, applied; a General Chats
* thread goes folder, applied. `arrived`, on a committed move: its arrival
* was sent (the queue's head), so a restart doesn't send it again.
*/
export const LinkMoveStage = Schema.Literals([
"fetched",
"worktree",
"folder",
"applied",
"arrived",
]);
export type LinkMoveStage = typeof LinkMoveStage.Type;

export const LinkMoveRow = Schema.Struct({
Expand Down Expand Up @@ -136,6 +147,14 @@ export interface LinkMoveRepositoryShape {
readonly transferId: string;
readonly now: string;
}) => Effect.Effect<void, LinkMoveRepositoryError>;
/** A committed move's arrival was sent (stage `arrived`). */
readonly markArrived: (input: {
readonly linkDeviceId: string;
readonly transferId: string;
readonly now: string;
}) => Effect.Effect<void, LinkMoveRepositoryError>;
/** Committed moves whose arrival may not have been sent yet, oldest first. */
readonly listUnarrived: Effect.Effect<ReadonlyArray<LinkMoveRow>, LinkMoveRepositoryError>;
}

export class LinkMoveRepository extends Context.Service<
Expand Down Expand Up @@ -272,8 +291,23 @@ const make = Effect.gen(function* () {
WHERE link_device_id = ${input.linkDeviceId} AND transfer_id = ${input.transferId}
`.pipe(Effect.asVoid, wrap("markCleaned"));

const markArrived: LinkMoveRepositoryShape["markArrived"] = (input) =>
sql`
UPDATE link_moves SET stage = 'arrived', updated_at = ${input.now}
WHERE link_device_id = ${input.linkDeviceId} AND transfer_id = ${input.transferId}
AND status = 'committed'
`.pipe(Effect.asVoid, wrap("markArrived"));

const listUnarrived: LinkMoveRepositoryShape["listUnarrived"] = findMany(
`status = 'committed' AND (stage IS NULL OR stage <> 'arrived')`,
[],
).pipe(wrap("listUnarrived"));

return LinkMoveRepository.of({
markArrived,
listUnarrived,
insert,

get,
listOpen,
listCleanupOwed,
Expand Down
Loading
Loading