Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6606e8cc1 | ||
|
|
def996f40a | ||
|
|
e25264bc8d | ||
|
|
7ca09fd996 |
No files matched your search
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxfmt/configuration_schema.json",
|
||||
"ignorePatterns": [
|
||||
".plans",
|
||||
"dist",
|
||||
"dist-electron",
|
||||
"node_modules",
|
||||
"bun.lock",
|
||||
"*.tsbuildinfo"
|
||||
],
|
||||
"experimentalSortPackageJson": {}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||
"ignorePatterns": ["dist", "dist-electron", "node_modules", "bun.lock", "*.tsbuildinfo"],
|
||||
"plugins": ["eslint", "oxc", "react", "unicorn", "typescript"],
|
||||
"categories": {
|
||||
"correctness": "warn",
|
||||
"suspicious": "warn",
|
||||
"perf": "warn"
|
||||
},
|
||||
"rules": {
|
||||
"react-in-jsx-scope": "off"
|
||||
}
|
||||
}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["oxc.oxc-vscode"]
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "oxc.oxc-vscode",
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.oxc": "always"
|
||||
},
|
||||
"oxc.unusedDisableDirectives": "warn"
|
||||
}
|
||||
@@ -49,6 +49,7 @@ Mode changes apply across all threads. Existing live sessions are restarted so o
|
||||
- `.github/workflows/ci.yml` runs `bun run lint`, `bun run typecheck`, and `bun run test` on pull requests and pushes to `main`.
|
||||
|
||||
Optional:
|
||||
|
||||
- `ELECTRON_RENDERER_PORT=5180 bun run dev` if `5173` is already in use.
|
||||
|
||||
## Provider architecture
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
"private": true,
|
||||
"main": "dist-electron/main.js",
|
||||
"scripts": {
|
||||
"dev": "concurrently -k -n BUNDLE,ELECTRON \"bun run dev:bundle\" \"bun run dev:electron\"",
|
||||
"dev": "bun run --parallel dev:bundle dev:electron",
|
||||
"dev:bundle": "tsup --watch",
|
||||
"dev:electron": "bun run scripts/dev-electron.mjs",
|
||||
"build": "tsup",
|
||||
"start": "electron dist-electron/main.js",
|
||||
"postinstall": "electron-rebuild",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"lint": "biome check src/",
|
||||
"test": "vitest run",
|
||||
"smoke-test": "node scripts/smoke-test.mjs"
|
||||
},
|
||||
@@ -23,7 +22,6 @@
|
||||
"devDependencies": {
|
||||
"@electron/rebuild": "^3.7.0",
|
||||
"@types/node": "^22.10.2",
|
||||
"concurrently": "^9.1.2",
|
||||
"electronmon": "^2.0.2",
|
||||
"tsup": "^8.3.5",
|
||||
"typescript": "^5.7.3",
|
||||
|
||||
@@ -6,15 +6,10 @@ const port = Number(process.env.ELECTRON_RENDERER_PORT ?? 5173);
|
||||
const devServerUrl = `http://localhost:${port}`;
|
||||
|
||||
await waitOn({
|
||||
resources: [
|
||||
`tcp:${port}`,
|
||||
"file:dist-electron/main.js",
|
||||
"file:dist-electron/preload.js",
|
||||
],
|
||||
resources: [`tcp:${port}`, "file:dist-electron/main.js", "file:dist-electron/preload.js"],
|
||||
});
|
||||
|
||||
const command =
|
||||
process.platform === "win32" ? "electronmon.cmd" : "electronmon";
|
||||
const command = process.platform === "win32" ? "electronmon.cmd" : "electronmon";
|
||||
const child = spawn(command, ["dist-electron/main.js"], {
|
||||
stdio: "inherit",
|
||||
env: {
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
classifyCodexStderrLine,
|
||||
normalizeCodexModelSlug,
|
||||
} from "./codexAppServerManager";
|
||||
import { classifyCodexStderrLine, normalizeCodexModelSlug } from "./codexAppServerManager";
|
||||
|
||||
describe("classifyCodexStderrLine", () => {
|
||||
it("ignores empty lines", () => {
|
||||
@@ -23,8 +20,7 @@ describe("classifyCodexStderrLine", () => {
|
||||
});
|
||||
|
||||
it("keeps unknown structured errors", () => {
|
||||
const line =
|
||||
"2026-02-08T04:24:20.085687Z ERROR codex_core::runtime: unrecoverable failure";
|
||||
const line = "2026-02-08T04:24:20.085687Z ERROR codex_core::runtime: unrecoverable failure";
|
||||
expect(classifyCodexStderrLine(line)).toEqual({
|
||||
message: line,
|
||||
});
|
||||
@@ -45,9 +41,7 @@ describe("normalizeCodexModelSlug", () => {
|
||||
});
|
||||
|
||||
it("prefers codex id when model differs", () => {
|
||||
expect(normalizeCodexModelSlug("gpt-5.3", "gpt-5.3-codex")).toBe(
|
||||
"gpt-5.3-codex",
|
||||
);
|
||||
expect(normalizeCodexModelSlug("gpt-5.3", "gpt-5.3-codex")).toBe("gpt-5.3-codex");
|
||||
});
|
||||
|
||||
it("keeps non-aliased models as-is", () => {
|
||||
|
||||
@@ -91,9 +91,7 @@ export function normalizeCodexModelSlug(
|
||||
return normalized;
|
||||
}
|
||||
|
||||
export function classifyCodexStderrLine(
|
||||
rawLine: string,
|
||||
): { message: string } | null {
|
||||
export function classifyCodexStderrLine(rawLine: string): { message: string } | null {
|
||||
const line = rawLine.replaceAll(ANSI_ESCAPE_REGEX, "").trim();
|
||||
if (!line) {
|
||||
return null;
|
||||
@@ -106,9 +104,7 @@ export function classifyCodexStderrLine(
|
||||
return null;
|
||||
}
|
||||
|
||||
const isBenignError = BENIGN_ERROR_LOG_SNIPPETS.some((snippet) =>
|
||||
line.includes(snippet),
|
||||
);
|
||||
const isBenignError = BENIGN_ERROR_LOG_SNIPPETS.some((snippet) => line.includes(snippet));
|
||||
if (isBenignError) {
|
||||
return null;
|
||||
}
|
||||
@@ -124,9 +120,7 @@ export interface CodexAppServerManagerEvents {
|
||||
export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEvents> {
|
||||
private readonly sessions = new Map<string, CodexSessionContext>();
|
||||
|
||||
async startSession(
|
||||
input: ProviderSessionStartInput,
|
||||
): Promise<ProviderSession> {
|
||||
async startSession(input: ProviderSessionStartInput): Promise<ProviderSession> {
|
||||
const sessionId = randomUUID();
|
||||
const now = new Date().toISOString();
|
||||
|
||||
@@ -160,11 +154,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
this.sessions.set(sessionId, context);
|
||||
this.attachProcessListeners(context);
|
||||
|
||||
this.emitLifecycleEvent(
|
||||
context,
|
||||
"session/connecting",
|
||||
"Starting codex app-server",
|
||||
);
|
||||
this.emitLifecycleEvent(context, "session/connecting", "Starting codex app-server");
|
||||
|
||||
try {
|
||||
await this.sendRequest(context, "initialize", {
|
||||
@@ -188,10 +178,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
experimentalRawEvents: false,
|
||||
});
|
||||
|
||||
const threadId = this.readString(
|
||||
this.readObject(threadStart)?.thread,
|
||||
"id",
|
||||
);
|
||||
const threadId = this.readString(this.readObject(threadStart)?.thread, "id");
|
||||
if (!threadId) {
|
||||
throw new Error("thread/start response did not include a thread id.");
|
||||
}
|
||||
@@ -200,30 +187,21 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
status: "ready",
|
||||
threadId,
|
||||
});
|
||||
this.emitLifecycleEvent(
|
||||
context,
|
||||
"session/ready",
|
||||
`Connected to thread ${threadId}`,
|
||||
);
|
||||
this.emitLifecycleEvent(context, "session/ready", `Connected to thread ${threadId}`);
|
||||
return { ...context.session };
|
||||
} catch (error) {
|
||||
const message =
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: "Failed to start Codex session.";
|
||||
const message = error instanceof Error ? error.message : "Failed to start Codex session.";
|
||||
this.updateSession(context, {
|
||||
status: "error",
|
||||
lastError: message,
|
||||
});
|
||||
this.emitErrorEvent(context, "session/startFailed", message);
|
||||
this.stopSession(sessionId);
|
||||
throw new Error(message);
|
||||
throw new Error(message, { cause: error });
|
||||
}
|
||||
}
|
||||
|
||||
async sendTurn(
|
||||
input: ProviderSendTurnInput,
|
||||
): Promise<ProviderTurnStartResult> {
|
||||
async sendTurn(input: ProviderSendTurnInput): Promise<ProviderTurnStartResult> {
|
||||
const context = this.requireSession(input.sessionId);
|
||||
if (!context.session.threadId) {
|
||||
throw new Error("Session is missing a thread id.");
|
||||
@@ -252,11 +230,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
turnStartParams.effort = input.effort;
|
||||
}
|
||||
|
||||
const response = await this.sendRequest(
|
||||
context,
|
||||
"turn/start",
|
||||
turnStartParams,
|
||||
);
|
||||
const response = await this.sendRequest(context, "turn/start", turnStartParams);
|
||||
|
||||
const turn = this.readObject(this.readObject(response), "turn");
|
||||
const turnId = this.readString(turn, "id");
|
||||
@@ -498,10 +472,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
});
|
||||
|
||||
if (notification.method === "thread/started") {
|
||||
const threadId = this.readString(
|
||||
this.readObject(notification.params)?.thread,
|
||||
"id",
|
||||
);
|
||||
const threadId = this.readString(this.readObject(notification.params)?.thread, "id");
|
||||
if (threadId) {
|
||||
this.updateSession(context, { threadId });
|
||||
}
|
||||
@@ -509,10 +480,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
}
|
||||
|
||||
if (notification.method === "turn/started") {
|
||||
const turnId = this.readString(
|
||||
this.readObject(notification.params)?.turn,
|
||||
"id",
|
||||
);
|
||||
const turnId = this.readString(this.readObject(notification.params)?.turn, "id");
|
||||
this.updateSession(context, {
|
||||
status: "running",
|
||||
activeTurnId: turnId,
|
||||
@@ -523,10 +491,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
if (notification.method === "turn/completed") {
|
||||
const turn = this.readObject(notification.params, "turn");
|
||||
const status = this.readString(turn, "status");
|
||||
const errorMessage = this.readString(
|
||||
this.readObject(turn, "error"),
|
||||
"message",
|
||||
);
|
||||
const errorMessage = this.readString(this.readObject(turn, "error"), "message");
|
||||
this.updateSession(context, {
|
||||
status: status === "failed" ? "error" : "ready",
|
||||
activeTurnId: undefined,
|
||||
@@ -536,10 +501,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
}
|
||||
|
||||
if (notification.method === "error") {
|
||||
const message = this.readString(
|
||||
this.readObject(notification.params)?.error,
|
||||
"message",
|
||||
);
|
||||
const message = this.readString(this.readObject(notification.params)?.error, "message");
|
||||
const willRetry = this.readBoolean(notification.params, "willRetry");
|
||||
|
||||
this.updateSession(context, {
|
||||
@@ -549,10 +511,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
}
|
||||
}
|
||||
|
||||
private handleServerRequest(
|
||||
context: CodexSessionContext,
|
||||
request: JsonRpcRequest,
|
||||
): void {
|
||||
private handleServerRequest(context: CodexSessionContext, request: JsonRpcRequest): void {
|
||||
const route = this.readRouteFields(request.params);
|
||||
const requestKind = this.requestKindForMethod(request.method);
|
||||
let requestId: string | undefined;
|
||||
@@ -609,10 +568,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
});
|
||||
}
|
||||
|
||||
private handleResponse(
|
||||
context: CodexSessionContext,
|
||||
response: JsonRpcResponse,
|
||||
): void {
|
||||
private handleResponse(context: CodexSessionContext, response: JsonRpcResponse): void {
|
||||
const key = String(response.id);
|
||||
const pending = context.pending.get(key);
|
||||
if (!pending) {
|
||||
@@ -623,11 +579,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
context.pending.delete(key);
|
||||
|
||||
if (response.error?.message) {
|
||||
pending.reject(
|
||||
new Error(
|
||||
`${pending.method} failed: ${String(response.error.message)}`,
|
||||
),
|
||||
);
|
||||
pending.reject(new Error(`${pending.method} failed: ${String(response.error.message)}`));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -674,11 +626,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
context.child.stdin.write(`${encoded}\n`);
|
||||
}
|
||||
|
||||
private emitLifecycleEvent(
|
||||
context: CodexSessionContext,
|
||||
method: string,
|
||||
message: string,
|
||||
): void {
|
||||
private emitLifecycleEvent(context: CodexSessionContext, method: string, message: string): void {
|
||||
this.emitEvent({
|
||||
id: randomUUID(),
|
||||
kind: "session",
|
||||
@@ -690,11 +638,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
});
|
||||
}
|
||||
|
||||
private emitErrorEvent(
|
||||
context: CodexSessionContext,
|
||||
method: string,
|
||||
message: string,
|
||||
): void {
|
||||
private emitErrorEvent(context: CodexSessionContext, method: string, message: string): void {
|
||||
this.emitEvent({
|
||||
id: randomUUID(),
|
||||
kind: "error",
|
||||
@@ -710,10 +654,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
this.emit("event", event);
|
||||
}
|
||||
|
||||
private updateSession(
|
||||
context: CodexSessionContext,
|
||||
updates: Partial<ProviderSession>,
|
||||
): void {
|
||||
private updateSession(context: CodexSessionContext, updates: Partial<ProviderSession>): void {
|
||||
context.session = {
|
||||
...context.session,
|
||||
...updates,
|
||||
@@ -762,8 +703,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
}
|
||||
|
||||
const candidate = value as Record<string, unknown>;
|
||||
const hasId =
|
||||
typeof candidate.id === "string" || typeof candidate.id === "number";
|
||||
const hasId = typeof candidate.id === "string" || typeof candidate.id === "number";
|
||||
const hasMethod = typeof candidate.method === "string";
|
||||
return hasId && !hasMethod;
|
||||
}
|
||||
@@ -783,11 +723,9 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
this.readString(params, "threadId") ??
|
||||
this.readString(this.readObject(params, "thread"), "id");
|
||||
const turnId =
|
||||
this.readString(params, "turnId") ??
|
||||
this.readString(this.readObject(params, "turn"), "id");
|
||||
this.readString(params, "turnId") ?? this.readString(this.readObject(params, "turn"), "id");
|
||||
const itemId =
|
||||
this.readString(params, "itemId") ??
|
||||
this.readString(this.readObject(params, "item"), "id");
|
||||
this.readString(params, "itemId") ?? this.readString(this.readObject(params, "item"), "id");
|
||||
|
||||
if (threadId) {
|
||||
route.threadId = threadId;
|
||||
@@ -804,10 +742,7 @@ export class CodexAppServerManager extends EventEmitter<CodexAppServerManagerEve
|
||||
return route;
|
||||
}
|
||||
|
||||
private readObject(
|
||||
value: unknown,
|
||||
key?: string,
|
||||
): Record<string, unknown> | undefined {
|
||||
private readObject(value: unknown, key?: string): Record<string, unknown> | undefined {
|
||||
const target =
|
||||
key === undefined
|
||||
? value
|
||||
|
||||
@@ -55,11 +55,9 @@ describe("withParsedPayload", () => {
|
||||
|
||||
describe("withParsedArgs", () => {
|
||||
it("parses tuple arguments before invoking handler", () => {
|
||||
const handler = vi.fn(
|
||||
(_event: unknown, sessionId: string, data: string) => {
|
||||
return `${sessionId}:${data}`;
|
||||
},
|
||||
);
|
||||
const handler = vi.fn((_event: unknown, sessionId: string, data: string) => {
|
||||
return `${sessionId}:${data}`;
|
||||
});
|
||||
const wrapped = withParsedArgs(
|
||||
{
|
||||
parse(args: unknown[]): [string, string] {
|
||||
|
||||
+12
-26
@@ -105,8 +105,7 @@ function registerIpcHandlers(): void {
|
||||
);
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.dialogPickFolder, async () => {
|
||||
const owner =
|
||||
BrowserWindow.getFocusedWindow() ?? BrowserWindow.getAllWindows()[0];
|
||||
const owner = BrowserWindow.getFocusedWindow() ?? BrowserWindow.getAllWindows()[0];
|
||||
const result = owner
|
||||
? await dialog.showOpenDialog(owner, {
|
||||
properties: ["openDirectory", "createDirectory"],
|
||||
@@ -175,12 +174,9 @@ function registerIpcHandlers(): void {
|
||||
// Provider handlers
|
||||
ipcMain.handle(
|
||||
IPC_CHANNELS.providerSessionStart,
|
||||
withParsedPayload(
|
||||
providerSessionStartInputSchema,
|
||||
async (_event, payload) => {
|
||||
return providerManager.startSession(payload);
|
||||
},
|
||||
),
|
||||
withParsedPayload(providerSessionStartInputSchema, async (_event, payload) => {
|
||||
return providerManager.startSession(payload);
|
||||
}),
|
||||
);
|
||||
|
||||
ipcMain.handle(
|
||||
@@ -192,12 +188,9 @@ function registerIpcHandlers(): void {
|
||||
|
||||
ipcMain.handle(
|
||||
IPC_CHANNELS.providerTurnInterrupt,
|
||||
withParsedPayload(
|
||||
providerInterruptTurnInputSchema,
|
||||
async (_event, payload) => {
|
||||
await providerManager.interruptTurn(payload);
|
||||
},
|
||||
),
|
||||
withParsedPayload(providerInterruptTurnInputSchema, async (_event, payload) => {
|
||||
await providerManager.interruptTurn(payload);
|
||||
}),
|
||||
);
|
||||
|
||||
ipcMain.handle(
|
||||
@@ -212,12 +205,9 @@ function registerIpcHandlers(): void {
|
||||
|
||||
ipcMain.handle(
|
||||
IPC_CHANNELS.providerSessionStop,
|
||||
withParsedPayload(
|
||||
providerStopSessionInputSchema,
|
||||
async (_event, payload) => {
|
||||
providerManager.stopSession(payload);
|
||||
},
|
||||
),
|
||||
withParsedPayload(providerStopSessionInputSchema, async (_event, payload) => {
|
||||
providerManager.stopSession(payload);
|
||||
}),
|
||||
);
|
||||
|
||||
ipcMain.handle(IPC_CHANNELS.providerSessionList, async () => {
|
||||
@@ -225,18 +215,14 @@ function registerIpcHandlers(): void {
|
||||
});
|
||||
}
|
||||
|
||||
async function runTerminalCommand(
|
||||
input: TerminalCommandInput,
|
||||
): Promise<TerminalCommandResult> {
|
||||
async function runTerminalCommand(input: TerminalCommandInput): Promise<TerminalCommandResult> {
|
||||
const shellPath =
|
||||
process.platform === "win32"
|
||||
? (process.env.ComSpec ?? "cmd.exe")
|
||||
: (process.env.SHELL ?? "/bin/sh");
|
||||
|
||||
const args =
|
||||
process.platform === "win32"
|
||||
? ["/d", "/s", "/c", input.command]
|
||||
: ["-lc", input.command];
|
||||
process.platform === "win32" ? ["/d", "/s", "/c", input.command] : ["-lc", input.command];
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = spawn(shellPath, args, {
|
||||
|
||||
@@ -18,14 +18,12 @@ const nativeApi: NativeApi = {
|
||||
agent: {
|
||||
spawn: (config) => ipcRenderer.invoke(IPC_CHANNELS.agentSpawn, config),
|
||||
kill: (sessionId) => ipcRenderer.invoke(IPC_CHANNELS.agentKill, sessionId),
|
||||
write: (sessionId, data) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.agentWrite, sessionId, data),
|
||||
write: (sessionId, data) => ipcRenderer.invoke(IPC_CHANNELS.agentWrite, sessionId, data),
|
||||
onOutput: (callback) => {
|
||||
const listener = (_event: Electron.IpcRendererEvent, chunk: unknown) =>
|
||||
callback(chunk as Parameters<typeof callback>[0]);
|
||||
ipcRenderer.on(IPC_CHANNELS.agentOutput, listener);
|
||||
return () =>
|
||||
ipcRenderer.removeListener(IPC_CHANNELS.agentOutput, listener);
|
||||
return () => ipcRenderer.removeListener(IPC_CHANNELS.agentOutput, listener);
|
||||
},
|
||||
onExit: (callback) => {
|
||||
const listener = (_event: Electron.IpcRendererEvent, exit: unknown) =>
|
||||
@@ -35,23 +33,17 @@ const nativeApi: NativeApi = {
|
||||
},
|
||||
},
|
||||
providers: {
|
||||
startSession: (input) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.providerSessionStart, input),
|
||||
sendTurn: (input) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.providerTurnStart, input),
|
||||
interruptTurn: (input) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.providerTurnInterrupt, input),
|
||||
respondToRequest: (input) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.providerRequestRespond, input),
|
||||
stopSession: (input) =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.providerSessionStop, input),
|
||||
startSession: (input) => ipcRenderer.invoke(IPC_CHANNELS.providerSessionStart, input),
|
||||
sendTurn: (input) => ipcRenderer.invoke(IPC_CHANNELS.providerTurnStart, input),
|
||||
interruptTurn: (input) => ipcRenderer.invoke(IPC_CHANNELS.providerTurnInterrupt, input),
|
||||
respondToRequest: (input) => ipcRenderer.invoke(IPC_CHANNELS.providerRequestRespond, input),
|
||||
stopSession: (input) => ipcRenderer.invoke(IPC_CHANNELS.providerSessionStop, input),
|
||||
listSessions: () => ipcRenderer.invoke(IPC_CHANNELS.providerSessionList),
|
||||
onEvent: (callback) => {
|
||||
const listener = (_event: Electron.IpcRendererEvent, payload: unknown) =>
|
||||
callback(payload as Parameters<typeof callback>[0]);
|
||||
ipcRenderer.on(IPC_CHANNELS.providerEvent, listener);
|
||||
return () =>
|
||||
ipcRenderer.removeListener(IPC_CHANNELS.providerEvent, listener);
|
||||
return () => ipcRenderer.removeListener(IPC_CHANNELS.providerEvent, listener);
|
||||
},
|
||||
},
|
||||
shell: {
|
||||
|
||||
@@ -68,7 +68,6 @@ export class ProcessManager extends EventEmitter<ProcessManagerEvents> {
|
||||
}
|
||||
|
||||
private spawnPty(sessionId: string, config: AgentConfig): string {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const pty = require("node-pty") as typeof import("node-pty");
|
||||
|
||||
const ptyProcess = pty.spawn(config.command, config.args, {
|
||||
@@ -76,9 +75,7 @@ export class ProcessManager extends EventEmitter<ProcessManagerEvents> {
|
||||
cols: 120,
|
||||
rows: 30,
|
||||
cwd: config.cwd ?? process.cwd(),
|
||||
env: (config.env
|
||||
? { ...process.env, ...config.env }
|
||||
: process.env) as Record<string, string>,
|
||||
env: (config.env ? { ...process.env, ...config.env } : process.env) as Record<string, string>,
|
||||
});
|
||||
|
||||
this.ptySessions.set(sessionId, ptyProcess);
|
||||
|
||||
@@ -82,11 +82,7 @@ export class TodoStore {
|
||||
}
|
||||
|
||||
private async persist(): Promise<void> {
|
||||
await fs.writeFile(
|
||||
this.filePath,
|
||||
JSON.stringify(this.todos, null, 2),
|
||||
"utf8",
|
||||
);
|
||||
await fs.writeFile(this.filePath, JSON.stringify(this.todos, null, 2), "utf8");
|
||||
}
|
||||
|
||||
private async runExclusive<T>(operation: () => Promise<T>): Promise<T> {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"types": ["node", "electron"],
|
||||
"lib": ["ES2022", "DOM"]
|
||||
"lib": ["ES2023", "DOM"]
|
||||
},
|
||||
"include": ["src", "tsup.config.ts"]
|
||||
}
|
||||
@@ -8,15 +8,14 @@
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"lint": "biome check src/",
|
||||
"test": "vitest run --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@acme/contracts": "workspace:*",
|
||||
"highlight.js": "^11.11.1",
|
||||
"react-markdown": "^10.1.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"react-markdown": "^10.1.0",
|
||||
"rehype-highlight": "^7.0.2",
|
||||
"remark-gfm": "^4.0.1",
|
||||
"zod": "^3.24.1"
|
||||
|
||||
@@ -18,9 +18,7 @@ export default function ChatMarkdown({ text }: ChatMarkdownProps) {
|
||||
<div className="chat-markdown text-sm leading-relaxed text-[#d0d0d0]">
|
||||
<ReactMarkdown
|
||||
remarkPlugins={[remarkGfm]}
|
||||
rehypePlugins={[
|
||||
[rehypeHighlight, { detect: true, ignoreMissing: true }],
|
||||
]}
|
||||
rehypePlugins={[[rehypeHighlight, { detect: true, ignoreMissing: true }]]}
|
||||
components={markdownComponents}
|
||||
>
|
||||
{text}
|
||||
|
||||
@@ -144,9 +144,7 @@ export default function ChatView() {
|
||||
const editorMenuRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const activeThread = state.threads.find((t) => t.id === state.activeThreadId);
|
||||
const activeProject = state.projects.find(
|
||||
(p) => p.id === activeThread?.projectId,
|
||||
);
|
||||
const activeProject = state.projects.find((p) => p.id === activeThread?.projectId);
|
||||
const selectedModel = resolveModelSlug(
|
||||
activeThread?.model ?? activeProject?.model ?? DEFAULT_MODEL,
|
||||
);
|
||||
@@ -164,7 +162,7 @@ export default function ChatView() {
|
||||
);
|
||||
const assistantCompletionByItemId = useMemo(() => {
|
||||
const map = new Map<string, string>();
|
||||
const ordered = [...(activeThread?.events ?? [])].reverse();
|
||||
const ordered = [...(activeThread?.events ?? [])].toReversed();
|
||||
for (const event of ordered) {
|
||||
if (event.method !== "item/completed") continue;
|
||||
if (!event.itemId) continue;
|
||||
@@ -264,18 +262,15 @@ export default function ChatView() {
|
||||
// Auto-scroll on new messages
|
||||
const messageCount = activeThread?.messages.length ?? 0;
|
||||
const workLogCount = workLogEntries.length;
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: trigger on message count change
|
||||
useEffect(() => {
|
||||
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
||||
}, [messageCount]);
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: auto-scroll while active work-log events stream in
|
||||
useEffect(() => {
|
||||
if (phase !== "running") return;
|
||||
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
||||
}, [phase, workLogCount]);
|
||||
|
||||
// Auto-resize textarea
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: trigger on prompt change
|
||||
useEffect(() => {
|
||||
const ta = textareaRef.current;
|
||||
if (!ta) return;
|
||||
@@ -298,10 +293,7 @@ export default function ChatView() {
|
||||
|
||||
const handleClickOutside = (event: MouseEvent) => {
|
||||
if (!modelMenuRef.current) return;
|
||||
if (
|
||||
event.target instanceof Node &&
|
||||
!modelMenuRef.current.contains(event.target)
|
||||
) {
|
||||
if (event.target instanceof Node && !modelMenuRef.current.contains(event.target)) {
|
||||
setIsModelMenuOpen(false);
|
||||
}
|
||||
};
|
||||
@@ -394,8 +386,7 @@ export default function ChatView() {
|
||||
|
||||
// Auto-title from first message
|
||||
if (activeThread.messages.length === 0) {
|
||||
const title =
|
||||
trimmed.length > 50 ? `${trimmed.slice(0, 50)}...` : trimmed;
|
||||
const title = trimmed.length > 50 ? `${trimmed.slice(0, 50)}...` : trimmed;
|
||||
dispatch({
|
||||
type: "SET_THREAD_TITLE",
|
||||
threadId: activeThread.id,
|
||||
@@ -501,9 +492,7 @@ export default function ChatView() {
|
||||
<div className="drag-region h-[52px] shrink-0" />
|
||||
<div className="flex flex-1 items-center justify-center">
|
||||
<div className="text-center">
|
||||
<p className="text-sm">
|
||||
Select a thread or create a new one to get started.
|
||||
</p>
|
||||
<p className="text-sm">Select a thread or create a new one to get started.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -513,7 +502,7 @@ export default function ChatView() {
|
||||
return (
|
||||
<div className="flex flex-1 flex-col bg-[#0c0c0c]">
|
||||
{/* Top bar */}
|
||||
<header className="drag-region flex items-center justify-between border-b border-white/[0.08] px-5 pt-[28px] pb-3">
|
||||
<header className="drag-region flex items-center justify-between border-b border-white/8 px-5 pt-[28px] pb-3">
|
||||
<div className="flex items-center gap-3">
|
||||
<h2 className="text-sm font-medium text-[#e0e0e0]">
|
||||
{activeThread.title}
|
||||
@@ -654,9 +643,7 @@ export default function ChatView() {
|
||||
<div className="flex-1 overflow-y-auto px-5 py-4">
|
||||
{activeThread.messages.length === 0 && !isWorking ? (
|
||||
<div className="flex h-full items-center justify-center">
|
||||
<p className="text-sm text-[#a0a0a0]/30">
|
||||
Send a message to start the conversation.
|
||||
</p>
|
||||
<p className="text-sm text-[#a0a0a0]/30">Send a message to start the conversation.</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="mx-auto max-w-3xl space-y-4">
|
||||
@@ -770,7 +757,7 @@ export default function ChatView() {
|
||||
{/* Input bar */}
|
||||
<div className="px-5 pb-4 pt-2">
|
||||
<form onSubmit={onSend} className="mx-auto max-w-3xl">
|
||||
<div className="group rounded-[20px] border border-white/[0.08] bg-[#141416] transition-colors duration-200 focus-within:border-white/[0.16]">
|
||||
<div className="group rounded-[20px] border border-white/8 bg-[#141416] transition-colors duration-200 focus-within:border-white/16">
|
||||
{/* Textarea area */}
|
||||
<div className="px-4 pt-4 pb-2">
|
||||
<textarea
|
||||
@@ -781,9 +768,7 @@ export default function ChatView() {
|
||||
onChange={(e) => setPrompt(e.target.value)}
|
||||
onKeyDown={onKeyDown}
|
||||
placeholder={
|
||||
phase === "disconnected"
|
||||
? "Ask for follow-up changes"
|
||||
: "Ask anything..."
|
||||
phase === "disconnected" ? "Ask for follow-up changes" : "Ask anything..."
|
||||
}
|
||||
disabled={isSending || isConnecting}
|
||||
/>
|
||||
@@ -796,12 +781,10 @@ export default function ChatView() {
|
||||
<div className="relative" ref={modelMenuRef}>
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[13px] text-[#a0a0a0]/70 transition-colors duration-150 hover:bg-white/[0.06] hover:text-[#d0d0d0]"
|
||||
className="inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[13px] text-[#a0a0a0]/70 transition-colors duration-150 hover:bg-white/6 hover:text-[#d0d0d0]"
|
||||
onClick={() => setIsModelMenuOpen((open) => !open)}
|
||||
>
|
||||
<span className="max-w-[180px] truncate">
|
||||
{selectedModel}
|
||||
</span>
|
||||
<span className="max-w-[180px] truncate">{selectedModel}</span>
|
||||
<svg
|
||||
width="10"
|
||||
height="10"
|
||||
@@ -820,10 +803,8 @@ export default function ChatView() {
|
||||
</svg>
|
||||
</button>
|
||||
{isModelMenuOpen && (
|
||||
<div className="absolute bottom-full left-0 z-20 mb-2 w-[320px] rounded-2xl border border-white/[0.1] bg-[#1b1b1d]/95 p-2 shadow-[0_16px_40px_rgba(0,0,0,0.55)] backdrop-blur">
|
||||
<p className="px-2 py-1 text-[11px] text-[#a0a0a0]/70">
|
||||
Select model
|
||||
</p>
|
||||
<div className="absolute bottom-full left-0 z-20 mb-2 w-[320px] rounded-2xl border border-white/10 bg-[#1b1b1d]/95 p-2 shadow-[0_16px_40px_rgba(0,0,0,0.55)] backdrop-blur">
|
||||
<p className="px-2 py-1 text-[11px] text-[#a0a0a0]/70">Select model</p>
|
||||
<div className="max-h-72 overflow-y-auto">
|
||||
{modelOptions.map((model) => {
|
||||
const isSelected = model === selectedModel;
|
||||
@@ -833,8 +814,8 @@ export default function ChatView() {
|
||||
type="button"
|
||||
className={`mb-0.5 flex w-full items-center justify-between gap-2 rounded-xl px-2 py-2 text-left font-mono text-sm transition-colors duration-150 ${
|
||||
isSelected
|
||||
? "bg-white/[0.08] text-white"
|
||||
: "text-[#d4d4d4] hover:bg-white/[0.05]"
|
||||
? "bg-white/8 text-white"
|
||||
: "text-[#d4d4d4] hover:bg-white/5"
|
||||
}`}
|
||||
onClick={() => onModelSelect(model)}
|
||||
>
|
||||
@@ -855,17 +836,14 @@ export default function ChatView() {
|
||||
</div>
|
||||
|
||||
{/* Divider */}
|
||||
<div className="mx-0.5 h-4 w-px bg-white/[0.08]" />
|
||||
<div className="mx-0.5 h-4 w-px bg-white/8" />
|
||||
|
||||
{/* Reasoning effort */}
|
||||
<label
|
||||
className="inline-flex cursor-pointer items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[13px] text-[#a0a0a0]/70 transition-colors duration-150 hover:bg-white/[0.06] hover:text-[#d0d0d0]"
|
||||
className="inline-flex cursor-pointer items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[13px] text-[#a0a0a0]/70 transition-colors duration-150 hover:bg-white/6 hover:text-[#d0d0d0]"
|
||||
htmlFor="reasoning-effort"
|
||||
>
|
||||
<span>
|
||||
{selectedEffort.charAt(0).toUpperCase() +
|
||||
selectedEffort.slice(1)}
|
||||
</span>
|
||||
<span>{selectedEffort.charAt(0).toUpperCase() + selectedEffort.slice(1)}</span>
|
||||
<select
|
||||
id="reasoning-effort"
|
||||
className="absolute opacity-0 w-0 h-0"
|
||||
@@ -873,11 +851,7 @@ export default function ChatView() {
|
||||
onChange={(event) => setSelectedEffort(event.target.value)}
|
||||
>
|
||||
{REASONING_OPTIONS.map((effort) => (
|
||||
<option
|
||||
key={effort}
|
||||
value={effort}
|
||||
className="bg-[#1b1b1d]"
|
||||
>
|
||||
<option key={effort} value={effort} className="bg-[#1b1b1d]">
|
||||
{effort}
|
||||
{effort === DEFAULT_REASONING ? " (default)" : ""}
|
||||
</option>
|
||||
@@ -1004,11 +978,7 @@ export default function ChatView() {
|
||||
className="flex h-8 w-8 items-center justify-center rounded-full bg-white/90 text-[#0c0c0c] transition-all duration-150 hover:bg-white hover:scale-105 disabled:opacity-30 disabled:hover:scale-100"
|
||||
disabled={isSending || isConnecting || !prompt.trim()}
|
||||
aria-label={
|
||||
isConnecting
|
||||
? "Connecting"
|
||||
: isSending
|
||||
? "Sending"
|
||||
: "Send message"
|
||||
isConnecting ? "Connecting" : isSending ? "Sending" : "Send message"
|
||||
}
|
||||
>
|
||||
{isConnecting || isSending ? (
|
||||
|
||||
@@ -7,9 +7,7 @@ export default function DiffPanel() {
|
||||
<aside className="flex h-full w-[400px] shrink-0 flex-col border-l border-white/[0.08] bg-[#141414]">
|
||||
{/* Header */}
|
||||
<div className="drag-region flex items-center justify-between border-b border-white/[0.08] px-4 pt-[28px] pb-3">
|
||||
<h3 className="text-xs font-medium text-[#e0e0e0]">
|
||||
Uncommitted changes
|
||||
</h3>
|
||||
<h3 className="text-xs font-medium text-[#e0e0e0]">Uncommitted changes</h3>
|
||||
<button
|
||||
type="button"
|
||||
className="text-[#a0a0a0]/40 transition-colors duration-150 hover:text-[#a0a0a0]/70"
|
||||
@@ -27,15 +25,11 @@ export default function DiffPanel() {
|
||||
<span className="rounded bg-emerald-500/20 px-1.5 py-0.5 text-[9px] font-medium text-emerald-400">
|
||||
M
|
||||
</span>
|
||||
<span className="font-mono text-xs text-[#a0a0a0]/60">
|
||||
src/App.tsx
|
||||
</span>
|
||||
<span className="font-mono text-xs text-[#a0a0a0]/60">src/App.tsx</span>
|
||||
</div>
|
||||
<div className="space-y-0.5 font-mono text-[11px]">
|
||||
<div className="text-red-400/60">- const oldValue = "hello";</div>
|
||||
<div className="text-emerald-400/60">
|
||||
+ const newValue = "world";
|
||||
</div>
|
||||
<div className="text-emerald-400/60">+ const newValue = "world";</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -44,9 +38,7 @@ export default function DiffPanel() {
|
||||
<span className="rounded bg-blue-500/20 px-1.5 py-0.5 text-[9px] font-medium text-blue-400">
|
||||
A
|
||||
</span>
|
||||
<span className="font-mono text-xs text-[#a0a0a0]/60">
|
||||
src/utils.ts
|
||||
</span>
|
||||
<span className="font-mono text-xs text-[#a0a0a0]/60">src/utils.ts</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -120,7 +120,7 @@ export default function Sidebar() {
|
||||
}, [handleNewThread, state.activeThreadId, state.projects, state.threads]);
|
||||
|
||||
return (
|
||||
<aside className="sidebar flex h-full w-[260px] shrink-0 flex-col border-r border-white/[0.08] bg-[#141414]">
|
||||
<aside className="sidebar flex h-full w-[260px] shrink-0 flex-col border-r border-white/8 bg-[#141414]">
|
||||
{/* Drag region / traffic light space */}
|
||||
<div className="drag-region h-[52px] shrink-0" />
|
||||
{/* Branding */}
|
||||
@@ -128,16 +128,14 @@ export default function Sidebar() {
|
||||
<div className="flex h-7 w-7 items-center justify-center rounded-lg bg-white text-xs font-bold text-[#0c0c0c]">
|
||||
CT
|
||||
</div>
|
||||
<span className="text-sm font-semibold tracking-tight text-[#e0e0e0]">
|
||||
CodeThing
|
||||
</span>
|
||||
<span className="text-sm font-semibold tracking-tight text-[#e0e0e0]">CodeThing</span>
|
||||
</div>
|
||||
|
||||
{/* New thread (global) */}
|
||||
<div className="px-3 pb-3">
|
||||
<button
|
||||
type="button"
|
||||
className="flex w-full items-center gap-2 rounded-lg border border-white/[0.08] bg-white/[0.04] px-3 py-2 text-xs text-[#a0a0a0]/80 transition-colors duration-150 hover:bg-white/[0.07]"
|
||||
className="flex w-full items-center gap-2 rounded-lg border border-white/8 bg-white/4 px-3 py-2 text-xs text-[#a0a0a0]/80 transition-colors duration-150 hover:bg-white/[0.07]"
|
||||
onClick={() => {
|
||||
if (state.projects.length === 0) {
|
||||
setAddingProject(true);
|
||||
@@ -169,10 +167,8 @@ export default function Sidebar() {
|
||||
{/* Project header */}
|
||||
<button
|
||||
type="button"
|
||||
className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors duration-150 hover:bg-white/[0.05]"
|
||||
onClick={() =>
|
||||
dispatch({ type: "TOGGLE_PROJECT", projectId: project.id })
|
||||
}
|
||||
className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors duration-150 hover:bg-white/5"
|
||||
onClick={() => dispatch({ type: "TOGGLE_PROJECT", projectId: project.id })}
|
||||
>
|
||||
<span className="text-[10px] text-[#a0a0a0]/50">
|
||||
{project.expanded ? "▼" : "▶"}
|
||||
@@ -180,14 +176,12 @@ export default function Sidebar() {
|
||||
<span className="flex-1 truncate text-xs font-medium text-[#e0e0e0]/90">
|
||||
{project.name}
|
||||
</span>
|
||||
<span className="text-[10px] text-[#a0a0a0]/40">
|
||||
{threads.length}
|
||||
</span>
|
||||
<span className="text-[10px] text-[#a0a0a0]/40">{threads.length}</span>
|
||||
</button>
|
||||
|
||||
{/* Threads */}
|
||||
{project.expanded && (
|
||||
<div className="ml-2 border-l border-white/[0.06] pl-2">
|
||||
<div className="ml-2 border-l border-white/6 pl-2">
|
||||
{threads.map((thread) => {
|
||||
const isActive = state.activeThreadId === thread.id;
|
||||
const threadStatus = threadStatusLabel(
|
||||
@@ -198,9 +192,7 @@ export default function Sidebar() {
|
||||
key={thread.id}
|
||||
type="button"
|
||||
className={`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors duration-150 ${
|
||||
isActive
|
||||
? "bg-white/10 text-white"
|
||||
: "text-[#a0a0a0]/70 hover:bg-white/[0.04]"
|
||||
isActive ? "bg-white/10 text-white" : "text-[#a0a0a0]/70 hover:bg-white/4"
|
||||
}`}
|
||||
onClick={() =>
|
||||
dispatch({
|
||||
@@ -254,12 +246,12 @@ export default function Sidebar() {
|
||||
|
||||
{/* Add project form */}
|
||||
{addingProject ? (
|
||||
<div className="border-t border-white/[0.08] p-3">
|
||||
<div className="border-t border-white/8 p-3">
|
||||
<p className="mb-2 text-[10px] font-medium uppercase tracking-wider text-[#a0a0a0]/50">
|
||||
Add project
|
||||
</p>
|
||||
<input
|
||||
className="mb-2 w-full rounded-md border border-white/[0.1] bg-white/[0.04] px-2 py-1.5 font-mono text-xs text-[#e0e0e0] placeholder:text-[#a0a0a0]/30 focus:border-white/30 focus:outline-none"
|
||||
className="mb-2 w-full rounded-md border border-white/10 bg-white/4 px-2 py-1.5 font-mono text-xs text-[#e0e0e0] placeholder:text-[#a0a0a0]/30 focus:border-white/30 focus:outline-none"
|
||||
placeholder="/path/to/project"
|
||||
value={newCwd}
|
||||
onChange={(e) => setNewCwd(e.target.value)}
|
||||
@@ -271,7 +263,7 @@ export default function Sidebar() {
|
||||
{api && (
|
||||
<button
|
||||
type="button"
|
||||
className="mb-2 flex w-full items-center justify-center rounded-md border border-white/[0.1] px-2 py-1.5 text-xs text-[#a0a0a0]/70 transition-colors duration-150 hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-60"
|
||||
className="mb-2 flex w-full items-center justify-center rounded-md border border-white/10 px-2 py-1.5 text-xs text-[#a0a0a0]/70 transition-colors duration-150 hover:bg-white/4 disabled:cursor-not-allowed disabled:opacity-60"
|
||||
onClick={() => void handlePickFolder()}
|
||||
disabled={isPickingFolder}
|
||||
>
|
||||
@@ -288,7 +280,7 @@ export default function Sidebar() {
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="flex-1 rounded-md border border-white/[0.1] px-2 py-1 text-xs text-[#a0a0a0]/60 transition-colors duration-150 hover:bg-white/[0.04]"
|
||||
className="flex-1 rounded-md border border-white/10 px-2 py-1 text-xs text-[#a0a0a0]/60 transition-colors duration-150 hover:bg-white/4"
|
||||
onClick={() => setAddingProject(false)}
|
||||
>
|
||||
Cancel
|
||||
@@ -296,10 +288,10 @@ export default function Sidebar() {
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="border-t border-white/[0.08] p-3">
|
||||
<div className="border-t border-white/8 p-3">
|
||||
<button
|
||||
type="button"
|
||||
className="flex w-full items-center justify-center gap-1 rounded-md border border-dashed border-white/[0.12] py-2 text-xs text-[#a0a0a0]/50 transition-colors duration-150 hover:border-white/[0.2] hover:text-[#a0a0a0]/70"
|
||||
className="flex w-full items-center justify-center gap-1 rounded-md border border-dashed border-white/12 py-2 text-xs text-[#a0a0a0]/50 transition-colors duration-150 hover:border-white/20 hover:text-[#a0a0a0]/70"
|
||||
onClick={() => setAddingProject(true)}
|
||||
>
|
||||
+ Add project
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
||||
"Helvetica Neue", Arial, sans-serif;
|
||||
font-family:
|
||||
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
min-height: 100vh;
|
||||
@@ -29,8 +29,7 @@ pre,
|
||||
code,
|
||||
textarea,
|
||||
input {
|
||||
font-family: "SF Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo,
|
||||
monospace;
|
||||
font-family: "SF Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
|
||||
}
|
||||
|
||||
/* Window drag region (frameless titlebar) */
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
DEFAULT_MODEL,
|
||||
normalizeModelSlug,
|
||||
resolveModelSlug,
|
||||
} from "./model-logic";
|
||||
import { DEFAULT_MODEL, normalizeModelSlug, resolveModelSlug } from "./model-logic";
|
||||
|
||||
describe("normalizeModelSlug", () => {
|
||||
it("maps 5.3 aliases to canonical codex slug", () => {
|
||||
|
||||
@@ -69,10 +69,7 @@ export interface PersistedStoreSnapshot {
|
||||
runtimeMode: RuntimeMode;
|
||||
}
|
||||
|
||||
function maybeMigrateLegacyModel(
|
||||
model: string,
|
||||
isLegacyPayload: boolean,
|
||||
): string {
|
||||
function maybeMigrateLegacyModel(model: string, isLegacyPayload: boolean): string {
|
||||
if (!isLegacyPayload) {
|
||||
return model;
|
||||
}
|
||||
@@ -86,9 +83,7 @@ function hydrateProject(
|
||||
): Project {
|
||||
return {
|
||||
...project,
|
||||
model: resolveModelSlug(
|
||||
maybeMigrateLegacyModel(project.model, isLegacyPayload),
|
||||
),
|
||||
model: resolveModelSlug(maybeMigrateLegacyModel(project.model, isLegacyPayload)),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -100,9 +95,7 @@ function hydrateThread(
|
||||
id: thread.id,
|
||||
projectId: thread.projectId,
|
||||
title: thread.title,
|
||||
model: resolveModelSlug(
|
||||
maybeMigrateLegacyModel(thread.model, isLegacyPayload),
|
||||
),
|
||||
model: resolveModelSlug(maybeMigrateLegacyModel(thread.model, isLegacyPayload)),
|
||||
session: null,
|
||||
messages: thread.messages.map((message) => ({
|
||||
...message,
|
||||
@@ -139,7 +132,7 @@ export function hydratePersistedState(
|
||||
.filter((thread) => projectIds.has(thread.projectId));
|
||||
const hasActiveThread = Boolean(
|
||||
parsedState.data.activeThreadId &&
|
||||
threads.some((thread) => thread.id === parsedState.data.activeThreadId),
|
||||
threads.some((thread) => thread.id === parsedState.data.activeThreadId),
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
@@ -22,9 +22,7 @@ function makeEvent(overrides: Partial<ProviderEvent>): ProviderEvent {
|
||||
};
|
||||
}
|
||||
|
||||
function makeSession(
|
||||
overrides: Partial<ProviderSession> = {},
|
||||
): ProviderSession {
|
||||
function makeSession(overrides: Partial<ProviderSession> = {}): ProviderSession {
|
||||
return {
|
||||
sessionId: "sess-1",
|
||||
provider: "codex",
|
||||
@@ -99,10 +97,7 @@ describe("deriveTimelineEntries", () => {
|
||||
|
||||
const timeline = deriveTimelineEntries(messages, workEntries);
|
||||
|
||||
expect(timeline.map((entry) => entry.id)).toEqual([
|
||||
"work:w-1",
|
||||
"message:m-1",
|
||||
]);
|
||||
expect(timeline.map((entry) => entry.id)).toEqual(["work:w-1", "message:m-1"]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import type {
|
||||
ProviderEvent,
|
||||
ProviderKind,
|
||||
ProviderSession,
|
||||
} from "@acme/contracts";
|
||||
import type { ProviderEvent, ProviderKind, ProviderSession } from "@acme/contracts";
|
||||
import type { ChatMessage, SessionPhase } from "./types";
|
||||
|
||||
export const PROVIDER_OPTIONS: Array<{
|
||||
@@ -49,10 +45,7 @@ export function formatDuration(durationMs: number): string {
|
||||
return `${minutes}m ${seconds}s`;
|
||||
}
|
||||
|
||||
export function formatElapsed(
|
||||
startIso: string,
|
||||
endIso: string | undefined,
|
||||
): string | null {
|
||||
export function formatElapsed(startIso: string, endIso: string | undefined): string | null {
|
||||
if (!endIso) return null;
|
||||
|
||||
const startedAt = Date.parse(startIso);
|
||||
@@ -304,7 +297,7 @@ export function deriveWorkLogEntries(
|
||||
events: ProviderEvent[],
|
||||
turnId: string | undefined,
|
||||
): WorkLogEntry[] {
|
||||
const ordered = [...events].reverse();
|
||||
const ordered = [...events].toReversed();
|
||||
const entries: WorkLogEntry[] = [];
|
||||
const turnStartedAtIso = turnId
|
||||
? ordered.find((event) => {
|
||||
@@ -312,9 +305,7 @@ export function deriveWorkLogEntries(
|
||||
return eventTurnId(event) === turnId;
|
||||
})?.createdAt
|
||||
: undefined;
|
||||
const turnStartedAt = turnStartedAtIso
|
||||
? Date.parse(turnStartedAtIso)
|
||||
: Number.NaN;
|
||||
const turnStartedAt = turnStartedAtIso ? Date.parse(turnStartedAtIso) : Number.NaN;
|
||||
|
||||
for (const event of ordered) {
|
||||
if (turnId) {
|
||||
@@ -428,10 +419,7 @@ export function derivePhase(session: ProviderSession | null): SessionPhase {
|
||||
return "ready";
|
||||
}
|
||||
|
||||
export function evolveSession(
|
||||
previous: ProviderSession,
|
||||
event: ProviderEvent,
|
||||
): ProviderSession {
|
||||
export function evolveSession(previous: ProviderSession, event: ProviderEvent): ProviderSession {
|
||||
const payload = asObject(event.payload);
|
||||
|
||||
if (event.method === "thread/started") {
|
||||
|
||||
@@ -116,10 +116,7 @@ function updateThread(
|
||||
return threads.map((t) => (t.id === threadId ? updater(t) : t));
|
||||
}
|
||||
|
||||
function findThreadBySessionId(
|
||||
threads: Thread[],
|
||||
sessionId: string,
|
||||
): Thread | undefined {
|
||||
function findThreadBySessionId(threads: Thread[], sessionId: string): Thread | undefined {
|
||||
return threads.find((t) => t.session?.sessionId === sessionId);
|
||||
}
|
||||
|
||||
@@ -325,11 +322,7 @@ export function StoreProvider({ children }: { children: ReactNode }) {
|
||||
persistState(state);
|
||||
}, [state]);
|
||||
|
||||
return createElement(
|
||||
StoreContext.Provider,
|
||||
{ value: { state, dispatch } },
|
||||
children,
|
||||
);
|
||||
return createElement(StoreContext.Provider, { value: { state, dispatch } }, children);
|
||||
}
|
||||
|
||||
export function useStore() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"jsx": "react-jsx",
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
||||
"types": ["vite/client"]
|
||||
},
|
||||
"include": ["src", "vite.config.ts"]
|
||||
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.9.0/schema.json",
|
||||
"organizeImports": {
|
||||
"enabled": true
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true,
|
||||
"correctness": {
|
||||
"noUnusedImports": "warn",
|
||||
"noUnusedVariables": "warn"
|
||||
}
|
||||
}
|
||||
},
|
||||
"formatter": {
|
||||
"indentStyle": "space",
|
||||
"indentWidth": 2
|
||||
},
|
||||
"files": {
|
||||
"ignore": [
|
||||
"dist",
|
||||
"dist-electron",
|
||||
"node_modules",
|
||||
"bun.lock",
|
||||
"*.tsbuildinfo"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,8 @@
|
||||
"": {
|
||||
"name": "ct-round-5",
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^1.9.0",
|
||||
"oxfmt": "^0.28.0",
|
||||
"oxlint": "^1.43.0",
|
||||
"turbo": "^2.3.3",
|
||||
"typescript": "^5.7.3",
|
||||
"vitest": "^3.0.0",
|
||||
@@ -22,7 +23,6 @@
|
||||
"devDependencies": {
|
||||
"@electron/rebuild": "^3.7.0",
|
||||
"@types/node": "^22.10.2",
|
||||
"concurrently": "^9.1.2",
|
||||
"electronmon": "^2.0.2",
|
||||
"tsup": "^8.3.5",
|
||||
"typescript": "^5.7.3",
|
||||
@@ -110,24 +110,6 @@
|
||||
|
||||
"@babel/types": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="],
|
||||
|
||||
"@biomejs/biome": ["@biomejs/[email protected]", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "1.9.4", "@biomejs/cli-darwin-x64": "1.9.4", "@biomejs/cli-linux-arm64": "1.9.4", "@biomejs/cli-linux-arm64-musl": "1.9.4", "@biomejs/cli-linux-x64": "1.9.4", "@biomejs/cli-linux-x64-musl": "1.9.4", "@biomejs/cli-win32-arm64": "1.9.4", "@biomejs/cli-win32-x64": "1.9.4" }, "bin": { "biome": "bin/biome" } }, "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog=="],
|
||||
|
||||
"@biomejs/cli-darwin-arm64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw=="],
|
||||
|
||||
"@biomejs/cli-darwin-x64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg=="],
|
||||
|
||||
"@biomejs/cli-linux-arm64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g=="],
|
||||
|
||||
"@biomejs/cli-linux-arm64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA=="],
|
||||
|
||||
"@biomejs/cli-linux-x64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg=="],
|
||||
|
||||
"@biomejs/cli-linux-x64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg=="],
|
||||
|
||||
"@biomejs/cli-win32-arm64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg=="],
|
||||
|
||||
"@biomejs/cli-win32-x64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA=="],
|
||||
|
||||
"@electron/get": ["@electron/[email protected]", "", { "dependencies": { "debug": "^4.1.1", "env-paths": "^2.2.0", "fs-extra": "^8.1.0", "got": "^11.8.5", "progress": "^2.0.3", "semver": "^6.2.0", "sumchecker": "^3.0.1" }, "optionalDependencies": { "global-agent": "^3.0.0" } }, "sha512-Qkzpg2s9GnVV2I2BjRksUi43U5e6+zaQMcjoJy0C+C5oxaKl+fmckGDQFtRpZpZV0NQekuZZ+tGz7EA9TVnQtQ=="],
|
||||
|
||||
"@electron/node-gyp": ["@electron/node-gyp@github:electron/node-gyp#06b29aa", { "dependencies": { "env-paths": "^2.2.0", "exponential-backoff": "^3.1.1", "glob": "^8.1.0", "graceful-fs": "^4.2.6", "make-fetch-happen": "^10.2.1", "nopt": "^6.0.0", "proc-log": "^2.0.1", "semver": "^7.3.5", "tar": "^6.2.1", "which": "^2.0.2" }, "bin": "./bin/node-gyp.js" }, "electron-node-gyp-06b29aa"],
|
||||
@@ -216,6 +198,38 @@
|
||||
|
||||
"@npmcli/move-file": ["@npmcli/[email protected]", "", { "dependencies": { "mkdirp": "^1.0.4", "rimraf": "^3.0.2" } }, "sha512-mJd2Z5TjYWq/ttPLLGqArdtnC74J6bOzg4rMDnN+p1xTacZ2yPRCk2y0oSWQtygLR9YVQXgOcONrwtnk3JupxQ=="],
|
||||
|
||||
"@oxfmt/darwin-arm64": ["@oxfmt/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-jmUfF7cNJPw57bEK7sMIqrYRgn4LH428tSgtgLTCtjuGuu1ShREyrkeB7y8HtkXRfhBs4lVY+HMLhqElJvZ6ww=="],
|
||||
|
||||
"@oxfmt/darwin-x64": ["@oxfmt/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-S6vlV8S7jbjzJOSjfVg2CimUC0r7/aHDLdUm/3+/B/SU/s1jV7ivqWkMv1/8EB43d1BBwT9JQ60ZMTkBqeXSFA=="],
|
||||
|
||||
"@oxfmt/linux-arm64-gnu": ["@oxfmt/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-TfJkMZjePbLiskmxFXVAbGI/OZtD+y+fwS0wyW8O6DWG0ARTf0AipY9zGwGoOdpFuXOJceXvN4SHGLbYNDMY4Q=="],
|
||||
|
||||
"@oxfmt/linux-arm64-musl": ["@oxfmt/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-7fyQUdW203v4WWGr1T3jwTz4L7KX9y5DeATryQ6fLT6QQp9GEuct8/k0lYhd+ys42iTV/IkJF20e3YkfSOOILg=="],
|
||||
|
||||
"@oxfmt/linux-x64-gnu": ["@oxfmt/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-sRKqAvEonuz0qr1X1ncUZceOBJerKzkO2gZIZmosvy/JmqyffpIFL3OE2tqacFkeDhrC+dNYQpusO8zsfHo3pw=="],
|
||||
|
||||
"@oxfmt/linux-x64-musl": ["@oxfmt/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-fW6czbXutX/tdQe8j4nSIgkUox9RXqjyxwyWXUDItpoDkoXllq17qbD7GVc0whrEhYQC6hFE1UEAcDypLJoSzw=="],
|
||||
|
||||
"@oxfmt/win32-arm64": ["@oxfmt/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-D/HDeQBAQRjTbD9OLV6kRDcStrIfO+JsUODDCdGmhRfNX8LPCx95GpfyybpZfn3wVF8Jq/yjPXV1xLkQ+s7RcA=="],
|
||||
|
||||
"@oxfmt/win32-x64": ["@oxfmt/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-4+S2j4OxOIyo8dz5osm5dZuL0yVmxXvtmNdHB5xyGwAWVvyWNvf7tCaQD7w2fdSsAXQLOvK7KFQrHFe33nJUCA=="],
|
||||
|
||||
"@oxlint/darwin-arm64": ["@oxlint/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-C/GhObv/pQZg34NOzB6Mk8x0wc9AKj8fXzJF8ZRKTsBPyHusC6AZ6bba0QG0TUufw1KWuD0j++oebQfWeiFXNw=="],
|
||||
|
||||
"@oxlint/darwin-x64": ["@oxlint/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-4NjfUtEEH8ewRQ2KlZGmm6DyrvypMdHwBnQT92vD0dLScNOQzr0V9O8Ua4IWXdeCNl/XMVhAV3h4/3YEYern5A=="],
|
||||
|
||||
"@oxlint/linux-arm64-gnu": ["@oxlint/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-75tf1HvwdZ3ebk83yMbSB+moAEWK98mYqpXiaFAi6Zshie7r+Cx5PLXZFUEqkscenoZ+fcNXakHxfn94V6nf1g=="],
|
||||
|
||||
"@oxlint/linux-arm64-musl": ["@oxlint/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-BHV4fb36T2p/7bpA9fiJ5ayt7oJbiYX10nklW5arYp4l9/9yG/FQC5J4G1evzbJ/YbipF9UH0vYBAm5xbqGrvw=="],
|
||||
|
||||
"@oxlint/linux-x64-gnu": ["@oxlint/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-1l3nvnzWWse1YHibzZ4HQXdF/ibfbKZhp9IguElni3bBqEyPEyurzZ0ikWynDxKGXqZa+UNXTFuU1NRVX1RJ3g=="],
|
||||
|
||||
"@oxlint/linux-x64-musl": ["@oxlint/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-+jNYgLGRFTJxJuaSOZJBwlYo5M0TWRw0+3y5MHOL4ArrIdHyCthg6r4RbVWrsR1qUfUE1VSSHQ2bfbC99RXqMg=="],
|
||||
|
||||
"@oxlint/win32-arm64": ["@oxlint/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-dvs1C/HCjCyGTURMagiHprsOvVTT3omDiSzi5Qw0D4QFJ1pEaNlfBhVnOUYgUfS6O7Mcmj4+G+sidRsQcWQ/kA=="],
|
||||
|
||||
"@oxlint/win32-x64": ["@oxlint/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-bSuItSU8mTSDsvmmLTepTdCL2FkJI6dwt9tot/k0EmiYF+ArRzmsl4lXVLssJNRV5lJEc5IViyTrh7oiwrjUqA=="],
|
||||
|
||||
"@rolldown/pluginutils": ["@rolldown/[email protected]", "", {}, "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA=="],
|
||||
|
||||
"@rollup/rollup-android-arm-eabi": ["@rollup/[email protected]", "", { "os": "android", "cpu": "arm" }, "sha512-A6ehUVSiSaaliTxai040ZpZ2zTevHYbvu/lDoeAteHI8QnaosIzm4qwtezfRg1jOYaUmnzLX1AOD6Z+UJjtifg=="],
|
||||
@@ -470,8 +484,6 @@
|
||||
|
||||
"concat-map": ["[email protected]", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="],
|
||||
|
||||
"concurrently": ["[email protected]", "", { "dependencies": { "chalk": "4.1.2", "rxjs": "7.8.2", "shell-quote": "1.8.3", "supports-color": "8.1.1", "tree-kill": "1.2.2", "yargs": "17.7.2" }, "bin": { "conc": "dist/bin/concurrently.js", "concurrently": "dist/bin/concurrently.js" } }, "sha512-fsfrO0MxV64Znoy8/l1vVIjjHa29SZyyqPgQBwhiDcaW8wJc2W3XWVOGx4M3oJBnv/zdUZIIp1gDeS98GzP8Ng=="],
|
||||
|
||||
"confbox": ["[email protected]", "", {}, "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w=="],
|
||||
|
||||
"consola": ["[email protected]", "", {}, "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA=="],
|
||||
@@ -904,6 +916,10 @@
|
||||
|
||||
"ora": ["[email protected]", "", { "dependencies": { "bl": "^4.1.0", "chalk": "^4.1.0", "cli-cursor": "^3.1.0", "cli-spinners": "^2.5.0", "is-interactive": "^1.0.0", "is-unicode-supported": "^0.1.0", "log-symbols": "^4.1.0", "strip-ansi": "^6.0.0", "wcwidth": "^1.0.1" } }, "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ=="],
|
||||
|
||||
"oxfmt": ["[email protected]", "", { "dependencies": { "tinypool": "2.1.0" }, "optionalDependencies": { "@oxfmt/darwin-arm64": "0.28.0", "@oxfmt/darwin-x64": "0.28.0", "@oxfmt/linux-arm64-gnu": "0.28.0", "@oxfmt/linux-arm64-musl": "0.28.0", "@oxfmt/linux-x64-gnu": "0.28.0", "@oxfmt/linux-x64-musl": "0.28.0", "@oxfmt/win32-arm64": "0.28.0", "@oxfmt/win32-x64": "0.28.0" }, "bin": { "oxfmt": "bin/oxfmt" } }, "sha512-3+hhBqPE6Kp22KfJmnstrZbl+KdOVSEu1V0ABaFIg1rYLtrMgrupx9znnHgHLqKxAVHebjTdiCJDk30CXOt6cw=="],
|
||||
|
||||
"oxlint": ["[email protected]", "", { "optionalDependencies": { "@oxlint/darwin-arm64": "1.43.0", "@oxlint/darwin-x64": "1.43.0", "@oxlint/linux-arm64-gnu": "1.43.0", "@oxlint/linux-arm64-musl": "1.43.0", "@oxlint/linux-x64-gnu": "1.43.0", "@oxlint/linux-x64-musl": "1.43.0", "@oxlint/win32-arm64": "1.43.0", "@oxlint/win32-x64": "1.43.0" }, "peerDependencies": { "oxlint-tsgolint": ">=0.11.2" }, "optionalPeers": ["oxlint-tsgolint"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-xiqTCsKZch+R61DPCjyqUVP2MhkQlRRYxLRBeBDi+dtQJ90MOgdcjIktvDCgXz0bgtx94EQzHEndsizZjMX2OA=="],
|
||||
|
||||
"p-cancelable": ["[email protected]", "", {}, "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg=="],
|
||||
|
||||
"p-map": ["[email protected]", "", { "dependencies": { "aggregate-error": "^3.0.0" } }, "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ=="],
|
||||
@@ -1014,8 +1030,6 @@
|
||||
|
||||
"shebang-regex": ["[email protected]", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="],
|
||||
|
||||
"shell-quote": ["[email protected]", "", {}, "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw=="],
|
||||
|
||||
"siginfo": ["[email protected]", "", {}, "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g=="],
|
||||
|
||||
"signal-exit": ["[email protected]", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="],
|
||||
@@ -1058,7 +1072,7 @@
|
||||
|
||||
"sumchecker": ["[email protected]", "", { "dependencies": { "debug": "^4.1.0" } }, "sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg=="],
|
||||
|
||||
"supports-color": ["supports-color@8.1.1", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
|
||||
"supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
||||
|
||||
"tailwindcss": ["[email protected]", "", {}, "sha512-4+Z+0yiYyEtUVCScyfHCxOYP06L5Ne+JiHhY2IjR2KWMIWhJOYZKLSGZaP5HkZ8+bY0cxfzwDE5uOmzFXyIwxw=="],
|
||||
|
||||
@@ -1076,7 +1090,7 @@
|
||||
|
||||
"tinyglobby": ["[email protected]", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.3" } }, "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ=="],
|
||||
|
||||
"tinypool": ["tinypool@1.1.1", "", {}, "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg=="],
|
||||
"tinypool": ["tinypool@2.1.0", "", {}, "sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw=="],
|
||||
|
||||
"tinyrainbow": ["[email protected]", "", {}, "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw=="],
|
||||
|
||||
@@ -1210,8 +1224,6 @@
|
||||
|
||||
"cacache/minipass": ["[email protected]", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="],
|
||||
|
||||
"chalk/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
||||
|
||||
"clone-response/mimic-response": ["[email protected]", "", {}, "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ=="],
|
||||
|
||||
"electron/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-Rs1bVAIdBs5gbTIKza/tgpMuG1k3U/UMJLWecIMxNdJFDMzcM5LOiLVRYh3PilWEYDIeUDv7bpiHPLPsbydGcw=="],
|
||||
@@ -1246,14 +1258,14 @@
|
||||
|
||||
"vite/esbuild": ["[email protected]", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.12", "@esbuild/android-arm": "0.25.12", "@esbuild/android-arm64": "0.25.12", "@esbuild/android-x64": "0.25.12", "@esbuild/darwin-arm64": "0.25.12", "@esbuild/darwin-x64": "0.25.12", "@esbuild/freebsd-arm64": "0.25.12", "@esbuild/freebsd-x64": "0.25.12", "@esbuild/linux-arm": "0.25.12", "@esbuild/linux-arm64": "0.25.12", "@esbuild/linux-ia32": "0.25.12", "@esbuild/linux-loong64": "0.25.12", "@esbuild/linux-mips64el": "0.25.12", "@esbuild/linux-ppc64": "0.25.12", "@esbuild/linux-riscv64": "0.25.12", "@esbuild/linux-s390x": "0.25.12", "@esbuild/linux-x64": "0.25.12", "@esbuild/netbsd-arm64": "0.25.12", "@esbuild/netbsd-x64": "0.25.12", "@esbuild/openbsd-arm64": "0.25.12", "@esbuild/openbsd-x64": "0.25.12", "@esbuild/openharmony-arm64": "0.25.12", "@esbuild/sunos-x64": "0.25.12", "@esbuild/win32-arm64": "0.25.12", "@esbuild/win32-ia32": "0.25.12", "@esbuild/win32-x64": "0.25.12" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg=="],
|
||||
|
||||
"vitest/tinypool": ["[email protected]", "", {}, "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg=="],
|
||||
|
||||
"@babel/helper-compilation-targets/lru-cache/yallist": ["[email protected]", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="],
|
||||
|
||||
"@electron/get/fs-extra/jsonfile": ["[email protected]", "", { "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg=="],
|
||||
|
||||
"@electron/get/fs-extra/universalify": ["[email protected]", "", {}, "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="],
|
||||
|
||||
"electronmon/chalk/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
||||
|
||||
"rimraf/glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="],
|
||||
|
||||
"vite/esbuild/@esbuild/aix-ppc64": ["@esbuild/[email protected]", "", { "os": "aix", "cpu": "ppc64" }, "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA=="],
|
||||
|
||||
+13
-7
@@ -1,23 +1,29 @@
|
||||
{
|
||||
"name": "ct-round-5",
|
||||
"private": true,
|
||||
"packageManager": "[email protected]",
|
||||
"workspaces": ["apps/*", "packages/*"],
|
||||
"workspaces": [
|
||||
"apps/*",
|
||||
"packages/*"
|
||||
],
|
||||
"scripts": {
|
||||
"dev": "bun run build:contracts && turbo run dev --parallel",
|
||||
"build": "turbo run build",
|
||||
"typecheck": "turbo run typecheck",
|
||||
"lint": "turbo run lint",
|
||||
"lint": "oxlint --report-unused-disable-directives",
|
||||
"test": "turbo run test",
|
||||
"format": "biome format --write .",
|
||||
"check": "biome check .",
|
||||
"fmt": "oxfmt",
|
||||
"smoke-test": "turbo run smoke-test",
|
||||
"build:contracts": "bun run --cwd packages/contracts build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^1.9.0",
|
||||
"oxfmt": "^0.28.0",
|
||||
"oxlint": "^1.43.0",
|
||||
"turbo": "^2.3.3",
|
||||
"typescript": "^5.7.3",
|
||||
"vitest": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"engines": {
|
||||
"bun": ">=1.3.9"
|
||||
},
|
||||
"packageManager": "[email protected]"
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
"name": "@acme/contracts",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
@@ -13,12 +16,10 @@
|
||||
"require": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"files": ["dist"],
|
||||
"scripts": {
|
||||
"dev": "tsup src/index.ts --format esm,cjs --dts --watch --clean",
|
||||
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"lint": "biome check src/",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -62,12 +62,8 @@ export interface NativeApi {
|
||||
onExit: (callback: (exit: AgentExit) => void) => () => void;
|
||||
};
|
||||
providers: {
|
||||
startSession: (
|
||||
input: ProviderSessionStartInput,
|
||||
) => Promise<ProviderSession>;
|
||||
sendTurn: (
|
||||
input: ProviderSendTurnInput,
|
||||
) => Promise<ProviderTurnStartResult>;
|
||||
startSession: (input: ProviderSessionStartInput) => Promise<ProviderSession>;
|
||||
sendTurn: (input: ProviderSendTurnInput) => Promise<ProviderTurnStartResult>;
|
||||
interruptTurn: (input: ProviderInterruptTurnInput) => Promise<void>;
|
||||
respondToRequest: (input: ProviderRespondToRequestInput) => Promise<void>;
|
||||
stopSession: (input: ProviderStopSessionInput) => Promise<void>;
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
DEFAULT_MODEL,
|
||||
MODEL_OPTIONS,
|
||||
normalizeModelSlug,
|
||||
resolveModelSlug,
|
||||
} from "./model";
|
||||
import { DEFAULT_MODEL, MODEL_OPTIONS, normalizeModelSlug, resolveModelSlug } from "./model";
|
||||
|
||||
describe("normalizeModelSlug", () => {
|
||||
it("maps known aliases to canonical slugs", () => {
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
export const MODEL_OPTIONS = [
|
||||
"gpt-5.3-codex",
|
||||
"gpt-5.2-codex",
|
||||
"gpt-5.2",
|
||||
] as const;
|
||||
export const MODEL_OPTIONS = ["gpt-5.3-codex", "gpt-5.2-codex", "gpt-5.2"] as const;
|
||||
|
||||
export const DEFAULT_MODEL = "gpt-5.3-codex";
|
||||
|
||||
@@ -11,9 +7,7 @@ export const MODEL_SLUG_ALIASES: Record<string, string> = {
|
||||
"gpt-5.3": "gpt-5.3-codex",
|
||||
};
|
||||
|
||||
export function normalizeModelSlug(
|
||||
model: string | null | undefined,
|
||||
): string | null {
|
||||
export function normalizeModelSlug(model: string | null | undefined): string | null {
|
||||
if (typeof model !== "string") {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -105,9 +105,7 @@ export const providerEventSchema = z.object({
|
||||
});
|
||||
|
||||
export type ProviderKind = z.infer<typeof providerKindSchema>;
|
||||
export type ProviderApprovalPolicy = z.infer<
|
||||
typeof providerApprovalPolicySchema
|
||||
>;
|
||||
export type ProviderApprovalPolicy = z.infer<typeof providerApprovalPolicySchema>;
|
||||
export type ProviderSandboxMode = z.infer<typeof providerSandboxModeSchema>;
|
||||
export type ProviderRequestKind = z.infer<typeof providerRequestKindSchema>;
|
||||
export type ProviderApprovalDecision = z.infer<
|
||||
@@ -115,9 +113,7 @@ export type ProviderApprovalDecision = z.infer<
|
||||
>;
|
||||
export type ProviderSessionStatus = z.infer<typeof providerSessionStatusSchema>;
|
||||
export type ProviderSession = z.infer<typeof providerSessionSchema>;
|
||||
export type ProviderSessionStartInput = z.input<
|
||||
typeof providerSessionStartInputSchema
|
||||
>;
|
||||
export type ProviderSessionStartInput = z.input<typeof providerSessionStartInputSchema>;
|
||||
export type ProviderSendTurnInput = z.input<typeof providerSendTurnInputSchema>;
|
||||
export type ProviderTurnStartResult = z.infer<
|
||||
typeof providerTurnStartResultSchema
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"target": "ES2023",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"strict": true,
|
||||
|
||||
@@ -14,10 +14,6 @@
|
||||
"dependsOn": ["^typecheck"],
|
||||
"outputs": []
|
||||
},
|
||||
"lint": {
|
||||
"dependsOn": ["^lint"],
|
||||
"outputs": []
|
||||
},
|
||||
"test": {
|
||||
"dependsOn": ["^build"],
|
||||
"outputs": []
|
||||
|
||||
Reference in new issue
Block a user