GeezerVison is showing github.com — keybindings · TheReal-Flo/t3code@734ab39
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/desktop/scripts/dev-electron.mjs +1-4Lines changed: 1 addition & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -46,10 +46,7 @@ async function shutdown(exitCode) { | 46 | 46 | shuttingDown = true; | 47 | 47 |
| 48 | 48 | try { | 49 | | - await Promise.race([ | 50 | | - monitor.destroy(), | 51 | | - new Promise((resolve) => setTimeout(resolve, 1_500)), | 52 | | - ]); | | 49 | + await Promise.race([monitor.destroy(), new Promise((resolve) => setTimeout(resolve, 1_500))]); | 53 | 50 | } catch { | 54 | 51 | // Best effort only; fallback process kill below handles stubborn children. | 55 | 52 | } | |
Collapse file Copy file name to clipboardExpand all lines: apps/desktop/scripts/electron-launcher.mjs +12-41Lines changed: 12 additions & 41 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -25,34 +25,22 @@ const __dirname = dirname(fileURLToPath(import.meta.url)); | 25 | 25 | export const desktopDir = resolve(__dirname, ".."); | 26 | 26 |
| 27 | 27 | function setPlistString(plistPath, key, value) { | 28 | | - const replaceResult = spawnSync( | 29 | | - "plutil", | 30 | | - ["-replace", key, "-string", value, plistPath], | 31 | | - { | 32 | | - encoding: "utf8", | 33 | | - }, | 34 | | - ); | | 28 | + const replaceResult = spawnSync("plutil", ["-replace", key, "-string", value, plistPath], { | | 29 | + encoding: "utf8", | | 30 | + }); | 35 | 31 | if (replaceResult.status === 0) { | 36 | 32 | return; | 37 | 33 | } | 38 | 34 |
| 39 | | - const insertResult = spawnSync( | 40 | | - "plutil", | 41 | | - ["-insert", key, "-string", value, plistPath], | 42 | | - { | 43 | | - encoding: "utf8", | 44 | | - }, | 45 | | - ); | | 35 | + const insertResult = spawnSync("plutil", ["-insert", key, "-string", value, plistPath], { | | 36 | + encoding: "utf8", | | 37 | + }); | 46 | 38 | if (insertResult.status === 0) { | 47 | 39 | return; | 48 | 40 | } | 49 | 41 |
| 50 | | - const details = [replaceResult.stderr, insertResult.stderr] | 51 | | - .filter(Boolean) | 52 | | - .join("\n"); | 53 | | - throw new Error( | 54 | | - `Failed to update plist key "${key}" at ${plistPath}: ${details}`.trim(), | 55 | | - ); | | 42 | + const details = [replaceResult.stderr, insertResult.stderr].filter(Boolean).join("\n"); | | 43 | + throw new Error(`Failed to update plist key "${key}" at ${plistPath}: ${details}`.trim()); | 56 | 44 | } | 57 | 45 |
| 58 | 46 | function patchMainBundleInfoPlist(appBundlePath, iconPath) { | @@ -81,28 +69,16 @@ function patchHelperBundleInfoPlists(appBundlePath) { | 81 | 69 | continue; | 82 | 70 | } | 83 | 71 |
| 84 | | - const helperPlistPath = join( | 85 | | - frameworksDir, | 86 | | - entry.name, | 87 | | - "Contents", | 88 | | - "Info.plist", | 89 | | - ); | | 72 | + const helperPlistPath = join(frameworksDir, entry.name, "Contents", "Info.plist"); | 90 | 73 | if (!existsSync(helperPlistPath)) { | 91 | 74 | continue; | 92 | 75 | } | 93 | 76 |
| 94 | | - const suffix = entry.name | 95 | | - .replace("Electron Helper", "") | 96 | | - .replace(".app", "") | 97 | | - .trim(); | | 77 | + const suffix = entry.name.replace("Electron Helper", "").replace(".app", "").trim(); | 98 | 78 | const helperName = suffix | 99 | 79 | ? `${APP_DISPLAY_NAME} Helper ${suffix}` | 100 | 80 | : `${APP_DISPLAY_NAME} Helper`; | 101 | | - const helperIdSuffix = suffix | 102 | | - .replace(/[()]/g, "") | 103 | | - .trim() | 104 | | - .toLowerCase() | 105 | | - .replace(/\s+/g, "-"); | | 81 | + const helperIdSuffix = suffix.replace(/[()]/g, "").trim().toLowerCase().replace(/\s+/g, "-"); | 106 | 82 | const helperBundleId = helperIdSuffix | 107 | 83 | ? `${APP_BUNDLE_ID}.helper.${helperIdSuffix}` | 108 | 84 | : `${APP_BUNDLE_ID}.helper`; | @@ -125,12 +101,7 @@ function buildMacLauncher(electronBinaryPath) { | 125 | 101 | const sourceAppBundlePath = resolve(electronBinaryPath, "../../.."); | 126 | 102 | const runtimeDir = join(desktopDir, ".electron-runtime"); | 127 | 103 | const targetAppBundlePath = join(runtimeDir, `${APP_DISPLAY_NAME}.app`); | 128 | | - const targetBinaryPath = join( | 129 | | - targetAppBundlePath, | 130 | | - "Contents", | 131 | | - "MacOS", | 132 | | - "Electron", | 133 | | - ); | | 104 | + const targetBinaryPath = join(targetAppBundlePath, "Contents", "MacOS", "Electron"); | 134 | 105 | const iconPath = join(desktopDir, "resources", "icon.icns"); | 135 | 106 | const metadataPath = join(runtimeDir, "metadata.json"); | 136 | 107 |
| |
Collapse file Copy file name to clipboardExpand all lines: apps/desktop/src/main.ts +5-2Lines changed: 5 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -126,7 +126,9 @@ function registerDesktopProtocol(): void { | 126 | 126 |
| 127 | 127 | const staticRoot = resolveDesktopStaticDir(); | 128 | 128 | if (!staticRoot) { | 129 | | - throw new Error("Desktop static bundle missing. Build apps/server (with bundled client) first."); | | 129 | + throw new Error( | | 130 | + "Desktop static bundle missing. Build apps/server (with bundled client) first.", | | 131 | + ); | 130 | 132 | } | 131 | 133 |
| 132 | 134 | const staticRootResolved = path.resolve(staticRoot); | @@ -160,7 +162,8 @@ function registerDesktopProtocol(): void { | 160 | 162 | } | 161 | 163 |
| 162 | 164 | function dispatchMenuAction(action: string): void { | 163 | | - const existingWindow = BrowserWindow.getFocusedWindow() ?? mainWindow ?? BrowserWindow.getAllWindows()[0]; | | 165 | + const existingWindow = | | 166 | + BrowserWindow.getFocusedWindow() ?? mainWindow ?? BrowserWindow.getAllWindows()[0]; | 164 | 167 | const targetWindow = existingWindow ?? createWindow(); | 165 | 168 | if (!existingWindow) { | 166 | 169 | mainWindow = targetWindow; | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/integration/fixtures/providerRuntime.ts +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -13,10 +13,10 @@ const THREAD_ID = ProviderThreadId.makeUnsafe("fixture-thread"); | 13 | 13 | const TURN_ID = ProviderTurnId.makeUnsafe("fixture-turn"); | 14 | 14 | const REQUEST_ID = ApprovalRequestId.makeUnsafe("req-1"); | 15 | 15 |
| 16 | | -function baseEvent(eventId: string, createdAt: string): Pick< | 17 | | - ProviderRuntimeEvent, | 18 | | - "eventId" | "provider" | "sessionId" | "createdAt" | 19 | | -> { | | 16 | +function baseEvent( | | 17 | + eventId: string, | | 18 | + createdAt: string, | | 19 | +): Pick<ProviderRuntimeEvent, "eventId" | "provider" | "sessionId" | "createdAt"> { | 20 | 20 | return { | 21 | 21 | eventId: EventId.makeUnsafe(eventId), | 22 | 22 | provider: PROVIDER, | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/integration/orchestrationEngine.integration.test.ts +45-40Lines changed: 45 additions & 40 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -29,10 +29,12 @@ const asMessageId = (value: string): MessageId => MessageId.makeUnsafe(value); | 29 | 29 | const asProjectId = (value: string): ProjectId => ProjectId.makeUnsafe(value); | 30 | 30 | const asThreadId = (value: string): ThreadId => ThreadId.makeUnsafe(value); | 31 | 31 | const asEventId = (value: string): EventId => EventId.makeUnsafe(value); | 32 | | -const asProviderSessionId = (value: string): ProviderSessionId => ProviderSessionId.makeUnsafe(value); | | 32 | +const asProviderSessionId = (value: string): ProviderSessionId => | | 33 | + ProviderSessionId.makeUnsafe(value); | 33 | 34 | const asProviderThreadId = (value: string): ProviderThreadId => ProviderThreadId.makeUnsafe(value); | 34 | 35 | const asProviderTurnId = (value: string): ProviderTurnId => ProviderTurnId.makeUnsafe(value); | 35 | | -const asApprovalRequestId = (value: string): ApprovalRequestId => ApprovalRequestId.makeUnsafe(value); | | 36 | +const asApprovalRequestId = (value: string): ApprovalRequestId => | | 37 | + ApprovalRequestId.makeUnsafe(value); | 36 | 38 |
| 37 | 39 | const PROJECT_ID = asProjectId("project-1"); | 38 | 40 | const THREAD_ID = asThreadId("thread-1"); | @@ -45,7 +47,8 @@ function nowIso() { | 45 | 47 | return new Date().toISOString(); | 46 | 48 | } | 47 | 49 |
| 48 | | -const sleep = (ms: number) => Effect.promise(() => new Promise<void>((resolve) => setTimeout(resolve, ms))); | | 50 | +const sleep = (ms: number) => | | 51 | + Effect.promise(() => new Promise<void>((resolve) => setTimeout(resolve, ms))); | 49 | 52 |
| 50 | 53 | function waitForSync<A>( | 51 | 54 | read: () => A, | @@ -78,9 +81,7 @@ function runtimeBase(eventId: string, createdAt: string) { | 78 | 81 | }; | 79 | 82 | } | 80 | 83 |
| 81 | | -function withHarness<A, E>( | 82 | | - use: (harness: OrchestrationIntegrationHarness) => Effect.Effect<A, E>, | 83 | | -) { | | 84 | +function withHarness<A, E>(use: (harness: OrchestrationIntegrationHarness) => Effect.Effect<A, E>) { | 84 | 85 | return Effect.acquireUseRelease( | 85 | 86 | makeOrchestrationIntegrationHarness, | 86 | 87 | use, | @@ -176,7 +177,9 @@ it.live("runs a single turn end-to-end and persists checkpoint state in sqlite + | 176 | 177 | THREAD_ID, | 177 | 178 | (entry) => | 178 | 179 | entry.session?.status === "ready" && | 179 | | - entry.messages.some((message) => message.role === "assistant" && message.streaming === false) && | | 180 | + entry.messages.some( | | 181 | + (message) => message.role === "assistant" && message.streaming === false, | | 182 | + ) && | 180 | 183 | entry.checkpoints.length === 1, | 181 | 184 | ); | 182 | 185 | assert.equal(thread.checkpoints[0]?.status, "ready"); | @@ -317,7 +320,10 @@ it.live("runs multi-turn file edits and persists checkpoint diffs", () => | 317 | 320 | const secondCheckpoint = secondTurnThread.checkpoints.find( | 318 | 321 | (checkpoint) => checkpoint.checkpointTurnCount === 2, | 319 | 322 | ); | 320 | | - assert.equal(secondCheckpoint?.files.some((file) => file.path === "README.md"), true); | | 323 | + assert.equal( | | 324 | + secondCheckpoint?.files.some((file) => file.path === "README.md"), | | 325 | + true, | | 326 | + ); | 321 | 327 |
| 322 | 328 | const checkpointRows = yield* harness.checkpointRepository.listByThreadId({ | 323 | 329 | threadId: THREAD_ID, | @@ -394,9 +400,8 @@ it.live("tracks approval requests and resolves pending approvals on user respons | 394 | 400 | text: "Run command needing approval", | 395 | 401 | }); | 396 | 402 |
| 397 | | - const thread = yield* harness.waitForThread( | 398 | | - THREAD_ID, | 399 | | - (entry) => entry.activities.some((activity) => activity.kind === "approval.requested"), | | 403 | + const thread = yield* harness.waitForThread(THREAD_ID, (entry) => | | 404 | + entry.activities.some((activity) => activity.kind === "approval.requested"), | 400 | 405 | ); | 401 | 406 | assert.equal( | 402 | 407 | thread.activities.some((activity) => activity.kind === "approval.requested"), | @@ -687,39 +692,39 @@ it.live("reverts to an earlier checkpoint and trims checkpoint projections + git | 687 | 692 | ), | 688 | 693 | ); | 689 | 694 |
| 690 | | -it.live("appends checkpoint.revert.failed activity when revert is requested without an active session", () => | 691 | | - withHarness((harness) => | 692 | | - Effect.gen(function* () { | 693 | | - yield* seedProjectAndThread(harness); | 694 | | - | 695 | | - yield* harness.engine.dispatch({ | 696 | | - type: "thread.checkpoint.revert", | 697 | | - commandId: asCommandId("cmd-checkpoint-revert-no-session"), | 698 | | - threadId: THREAD_ID, | 699 | | - turnCount: 0, | 700 | | - createdAt: nowIso(), | 701 | | - }); | 702 | | - | 703 | | - const thread = yield* harness.waitForThread( | 704 | | - THREAD_ID, | 705 | | - (entry) => | | 695 | +it.live( | | 696 | + "appends checkpoint.revert.failed activity when revert is requested without an active session", | | 697 | + () => | | 698 | + withHarness((harness) => | | 699 | + Effect.gen(function* () { | | 700 | + yield* seedProjectAndThread(harness); | | 701 | + | | 702 | + yield* harness.engine.dispatch({ | | 703 | + type: "thread.checkpoint.revert", | | 704 | + commandId: asCommandId("cmd-checkpoint-revert-no-session"), | | 705 | + threadId: THREAD_ID, | | 706 | + turnCount: 0, | | 707 | + createdAt: nowIso(), | | 708 | + }); | | 709 | + | | 710 | + const thread = yield* harness.waitForThread(THREAD_ID, (entry) => | 706 | 711 | entry.activities.some( | 707 | 712 | (activity) => | 708 | 713 | activity.kind === "checkpoint.revert.failed" && | 709 | 714 | typeof activity.payload === "object" && | 710 | 715 | activity.payload !== null, | 711 | 716 | ), | 712 | | - ); | 713 | | - const failureActivity = thread.activities.find( | 714 | | - (activity) => activity.kind === "checkpoint.revert.failed", | 715 | | - ); | 716 | | - assert.equal(failureActivity !== undefined, true); | 717 | | - assert.equal( | 718 | | - String((failureActivity?.payload as { readonly detail?: string } | undefined)?.detail).includes( | 719 | | - "No active provider session", | 720 | | - ), | 721 | | - true, | 722 | | - ); | 723 | | - }), | 724 | | - ), | | 717 | + ); | | 718 | + const failureActivity = thread.activities.find( | | 719 | + (activity) => activity.kind === "checkpoint.revert.failed", | | 720 | + ); | | 721 | + assert.equal(failureActivity !== undefined, true); | | 722 | + assert.equal( | | 723 | + String( | | 724 | + (failureActivity?.payload as { readonly detail?: string } | undefined)?.detail, | | 725 | + ).includes("No active provider session"), | | 726 | + true, | | 727 | + ); | | 728 | + }), | | 729 | + ), | 725 | 730 | ); |
Collapse file Copy file name to clipboardExpand all lines: apps/server/integration/providerService.integration.test.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -127,7 +127,7 @@ it.effect("replays typed runtime fixture events", () => | 127 | 127 | harness: fixture.harness, | 128 | 128 | sessionId: session.sessionId, | 129 | 129 | userText: "hello", | 130 | | - response: { events: codexTurnTextFixture }, | | 130 | + response: { events: codexTurnTextFixture }, | 131 | 131 | }); | 132 | 132 |
| 133 | 133 | assert.deepEqual( | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/checkpointing/Diffs.ts +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -6,7 +6,9 @@ export interface TurnDiffFileSummary { | 6 | 6 | readonly deletions: number; | 7 | 7 | } | 8 | 8 |
| 9 | | -export function parseTurnDiffFilesFromUnifiedDiff(diff: string): ReadonlyArray<TurnDiffFileSummary> { | | 9 | +export function parseTurnDiffFilesFromUnifiedDiff( | | 10 | + diff: string, | | 11 | +): ReadonlyArray<TurnDiffFileSummary> { | 10 | 12 | const normalized = diff.replace(/\r\n/g, "\n").trim(); | 11 | 13 | if (normalized.length === 0) { | 12 | 14 | return []; | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/codexAppServerManager.ts +10-9Lines changed: 10 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -383,7 +383,10 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve | 383 | 383 | return this.parseThreadSnapshot("thread/read", response); | 384 | 384 | } | 385 | 385 |
| 386 | | - async rollbackThread(sessionId: ProviderSessionId, numTurns: number): Promise<CodexThreadSnapshot> { | | 386 | + async rollbackThread( | | 387 | + sessionId: ProviderSessionId, | | 388 | + numTurns: number, | | 389 | + ): Promise<CodexThreadSnapshot> { | 387 | 390 | const context = this.requireSession(sessionId); | 388 | 391 | const threadId = context.session.threadId; | 389 | 392 | if (!threadId) { | @@ -822,19 +825,18 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve | 822 | 825 | private parseThreadSnapshot(method: string, response: unknown): CodexThreadSnapshot { | 823 | 826 | const responseRecord = this.readObject(response); | 824 | 827 | const thread = this.readObject(responseRecord, "thread"); | 825 | | - const threadIdRaw = this.readString(thread, "id") ?? | 826 | | - this.readString(responseRecord, "threadId"); | | 828 | + const threadIdRaw = | | 829 | + this.readString(thread, "id") ?? this.readString(responseRecord, "threadId"); | 827 | 830 | if (!threadIdRaw) { | 828 | 831 | throw new Error(`${method} response did not include a thread id.`); | 829 | 832 | } | 830 | 833 | const threadId = ProviderThreadId.makeUnsafe(threadIdRaw); | 831 | 834 |
| 832 | | - const turnsRaw = this.readArray(thread, "turns") ?? this.readArray(responseRecord, "turns") ?? []; | | 835 | + const turnsRaw = | | 836 | + this.readArray(thread, "turns") ?? this.readArray(responseRecord, "turns") ?? []; | 833 | 837 | const turns = turnsRaw.map((turnValue, index) => { | 834 | 838 | const turn = this.readObject(turnValue); | 835 | | - const turnIdRaw = | 836 | | - this.readString(turn, "id") ?? | 837 | | - `${threadIdRaw}:turn:${index + 1}`; | | 839 | + const turnIdRaw = this.readString(turn, "id") ?? `${threadIdRaw}:turn:${index + 1}`; | 838 | 840 | const turnId = ProviderTurnId.makeUnsafe(turnIdRaw); | 839 | 841 | const items = this.readArray(turn, "items") ?? []; | 840 | 842 | return { | @@ -900,8 +902,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve | 900 | 902 | this.readString(params, "turnId") ?? this.readString(this.readObject(params, "turn"), "id"), | 901 | 903 | ); | 902 | 904 | const itemId = toProviderItemId( | 903 | | - this.readString(params, "itemId") ?? | 904 | | - this.readString(this.readObject(params, "item"), "id"), | | 905 | + this.readString(params, "itemId") ?? this.readString(this.readObject(params, "item"), "id"), | 905 | 906 | ); | 906 | 907 |
| 907 | 908 | if (threadId) { | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/config.ts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,6 +10,7 @@ export interface ServerConfigShape { | 10 | 10 | readonly port: number; | 11 | 11 | readonly host: string | undefined; | 12 | 12 | readonly cwd: string; | | 13 | + readonly keybindingsConfigPath: string; | 13 | 14 | readonly stateDir: string; | 14 | 15 | readonly staticDir: string | undefined; | 15 | 16 | readonly devUrl: URL | undefined; | |
|