- Generate and rename temporary `t3code/*` worktree branches on first user turn in `ProviderCommandReactor` - Remove websocket/client branch-generation RPCs and related contract/API surface - Update Codex text-generation prompt to include attachment metadata only when attachments exist, with expanded tests
Showing the changes to apps/server/src/wsServer.ts (1 of 12 files). Show all
Unified · Split
| @@ -54,7 +54,6 @@ import { clamp } from "effect/Number"; · 53 unmodified lines | ||
| 54 | 54 | import { Open } from "./open"; |
| 55 | 55 | import { ServerConfig } from "./config"; |
| 56 | 56 | import { GitCore } from "./git/Services/GitCore.ts"; |
| 57 | −import { TextGeneration } from "./git/Services/TextGeneration.ts"; | |
| 58 | 57 | import { ATTACHMENTS_ROUTE_PREFIX, tryHandleProjectFaviconRequest } from "./projectFaviconRoute"; |
| 59 | 58 | |
| 60 | 59 | /** |
| @@ -136,31 +135,6 @@ function stripRequestTag<T extends { _tag: string }>(body: T) { · 75 unmodified lines | ||
| 136 | 135 | return Struct.omit(body, ["_tag"]); |
| 137 | 136 | } |
| 138 | 137 | |
| 139 | −const WORKTREE_BRANCH_PREFIX = "t3code"; | |
| 140 | − | |
| 141 | −function buildGeneratedWorktreeBranchName(raw: string): string { | |
| 142 | − const normalized = raw | |
| 143 | − .trim() | |
| 144 | − .toLowerCase() | |
| 145 | − .replace(/^refs\/heads\//, "") | |
| 146 | − .replace(/['"`]/g, ""); | |
| 147 | − | |
| 148 | − const withoutPrefix = normalized.startsWith(`${WORKTREE_BRANCH_PREFIX}/`) | |
| 149 | − ? normalized.slice(`${WORKTREE_BRANCH_PREFIX}/`.length) | |
| 150 | − : normalized; | |
| 151 | − | |
| 152 | − const branchFragment = withoutPrefix | |
| 153 | − .replace(/[^a-z0-9/_-]+/g, "-") | |
| 154 | − .replace(/\/+/g, "/") | |
| 155 | − .replace(/-+/g, "-") | |
| 156 | − .replace(/^[./_-]+|[./_-]+$/g, "") | |
| 157 | − .slice(0, 64) | |
| 158 | − .replace(/[./_-]+$/g, ""); | |
| 159 | − | |
| 160 | − const safeFragment = branchFragment.length > 0 ? branchFragment : "update"; | |
| 161 | − return `${WORKTREE_BRANCH_PREFIX}/${safeFragment}`; | |
| 162 | −} | |
| 163 | − | |
| 164 | 138 | export type ServerCoreRuntimeServices = |
| 165 | 139 | | OrchestrationEngineService |
| 166 | 140 | | ProjectionSnapshotQuery |
| @@ -172,7 +146,6 @@ export type ServerRuntimeServices = · 5 unmodified lines | ||
| 172 | 146 | | ServerCoreRuntimeServices |
| 173 | 147 | | GitManager |
| 174 | 148 | | GitCore |
| 175 | − | TextGeneration | |
| 176 | 149 | | TerminalManager |
| 177 | 150 | | Keybindings |
| 178 | 151 | | Open; |
| @@ -211,7 +184,6 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return< · 32 unmodified lines | ||
| 211 | 184 | const terminalManager = yield* TerminalManager; |
| 212 | 185 | const keybindingsManager = yield* Keybindings; |
| 213 | 186 | const git = yield* GitCore; |
| 214 | − const textGeneration = yield* TextGeneration; | |
| 215 | 187 | const fileSystem = yield* FileSystem.FileSystem; |
| 216 | 188 | const path = yield* Path.Path; |
| 217 | 189 | |
| @@ -600,32 +572,6 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return< · 382 unmodified lines | ||
| 600 | 572 | return yield* git.createWorktree(body); |
| 601 | 573 | } |
| 602 | 574 | |
| 603 | − case WS_METHODS.gitGenerateBranchName: { | |
| 604 | − const body = stripRequestTag(request.body); | |
| 605 | − return yield* textGeneration.generateBranchName(body); | |
| 606 | − } | |
| 607 | − | |
| 608 | − case WS_METHODS.gitGenerateAndRenameBranch: { | |
| 609 | − const body = stripRequestTag(request.body); | |
| 610 | − const generated = yield* textGeneration.generateBranchName({ | |
| 611 | − cwd: body.cwd, | |
| 612 | − message: body.message, | |
| 613 | − ...(body.attachments !== undefined ? { attachments: body.attachments } : {}), | |
| 614 | − }); | |
| 615 | − if (!generated.branch) { | |
| 616 | − return { branch: null }; | |
| 617 | − } | |
| 618 | − const targetBranch = buildGeneratedWorktreeBranchName(generated.branch); | |
| 619 | − if (targetBranch === body.oldBranch) { | |
| 620 | − return { branch: body.oldBranch }; | |
| 621 | − } | |
| 622 | − return yield* git.renameBranch({ | |
| 623 | − cwd: body.cwd, | |
| 624 | − oldBranch: body.oldBranch, | |
| 625 | − newBranch: targetBranch, | |
| 626 | − }); | |
| 627 | − } | |
| 628 | − | |
| 629 | 575 | case WS_METHODS.gitRenameBranch: { |
| 630 | 576 | const body = stripRequestTag(request.body); |
| 631 | 577 | return yield* git.renameBranch(body); |