Initial codex-flows monorepo
This commit is contained in:
commit
3c446b11a4
642 changed files with 19676 additions and 0 deletions
133
packages/codex-client/src/app-server/browser-client.ts
Normal file
133
packages/codex-client/src/app-server/browser-client.ts
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
import type { v2 } from "./generated/index.ts";
|
||||
import { CodexEventEmitter } from "./events.ts";
|
||||
import type { JsonRpcId } from "./rpc.ts";
|
||||
import {
|
||||
CodexWebSocketTransport,
|
||||
type CodexWebSocketTransportOptions,
|
||||
} from "./websocket-transport.ts";
|
||||
|
||||
export type CodexBrowserAppServerTransport = CodexEventEmitter & {
|
||||
readonly requestTimeoutMs: number;
|
||||
start(): void;
|
||||
close(): void;
|
||||
request<T = unknown>(method: string, params?: unknown): Promise<T>;
|
||||
notify(method: string, params?: unknown): void;
|
||||
respond(id: JsonRpcId, result: unknown): void;
|
||||
respondError(id: JsonRpcId, code: number, message: string, data?: unknown): void;
|
||||
};
|
||||
|
||||
export type CodexBrowserAppServerClientOptions = {
|
||||
transport?: CodexBrowserAppServerTransport;
|
||||
webSocketTransportOptions?: CodexWebSocketTransportOptions;
|
||||
clientName?: string;
|
||||
clientTitle?: string;
|
||||
clientVersion?: string;
|
||||
};
|
||||
|
||||
export class CodexBrowserAppServerClient extends CodexEventEmitter {
|
||||
readonly transport: CodexBrowserAppServerTransport;
|
||||
#clientName: string;
|
||||
#clientTitle: string | null;
|
||||
#clientVersion: string;
|
||||
#connected = false;
|
||||
|
||||
constructor(options: CodexBrowserAppServerClientOptions = {}) {
|
||||
super();
|
||||
const url = options.webSocketTransportOptions?.url;
|
||||
if (!options.transport && !url) {
|
||||
throw new Error("A Codex app-server WebSocket URL is required");
|
||||
}
|
||||
this.transport =
|
||||
options.transport ??
|
||||
new CodexWebSocketTransport({
|
||||
url: url!,
|
||||
requestTimeoutMs: options.webSocketTransportOptions?.requestTimeoutMs,
|
||||
});
|
||||
this.#clientName = options.clientName ?? "bare-web";
|
||||
this.#clientTitle = options.clientTitle ?? "Codex Bare Web";
|
||||
this.#clientVersion = options.clientVersion ?? "0.1.0";
|
||||
|
||||
this.transport.on("notification", (message) =>
|
||||
this.emit("notification", message),
|
||||
);
|
||||
this.transport.on("request", (message) => this.emit("request", message));
|
||||
this.transport.on("close", (code, reason) => this.emit("close", code, reason));
|
||||
this.transport.on("error", (error) => this.emit("error", error));
|
||||
}
|
||||
|
||||
async connect(): Promise<void> {
|
||||
if (this.#connected) {
|
||||
return;
|
||||
}
|
||||
this.transport.start();
|
||||
await this.request("initialize", {
|
||||
clientInfo: {
|
||||
name: this.#clientName,
|
||||
title: this.#clientTitle,
|
||||
version: this.#clientVersion,
|
||||
},
|
||||
capabilities: {
|
||||
experimentalApi: true,
|
||||
},
|
||||
});
|
||||
this.transport.notify("initialized");
|
||||
this.#connected = true;
|
||||
}
|
||||
|
||||
close(): void {
|
||||
this.#connected = false;
|
||||
this.transport.close();
|
||||
}
|
||||
|
||||
request<T = unknown>(method: string, params?: unknown): Promise<T> {
|
||||
return this.transport.request<T>(method, params);
|
||||
}
|
||||
|
||||
respond(id: JsonRpcId, result: unknown): void {
|
||||
this.transport.respond(id, result);
|
||||
}
|
||||
|
||||
respondError(id: JsonRpcId, code: number, message: string, data?: unknown): void {
|
||||
this.transport.respondError(id, code, message, data);
|
||||
}
|
||||
|
||||
startThread(
|
||||
params: v2.ThreadStartParams,
|
||||
): Promise<v2.ThreadStartResponse> {
|
||||
return this.request<v2.ThreadStartResponse>("thread/start", params);
|
||||
}
|
||||
|
||||
resumeThread(
|
||||
params: v2.ThreadResumeParams,
|
||||
): Promise<v2.ThreadResumeResponse> {
|
||||
return this.request<v2.ThreadResumeResponse>("thread/resume", params);
|
||||
}
|
||||
|
||||
listThreads(params: v2.ThreadListParams): Promise<v2.ThreadListResponse> {
|
||||
return this.request<v2.ThreadListResponse>("thread/list", params);
|
||||
}
|
||||
|
||||
readThread(params: v2.ThreadReadParams): Promise<v2.ThreadReadResponse> {
|
||||
return this.request<v2.ThreadReadResponse>("thread/read", params);
|
||||
}
|
||||
|
||||
startTurn(params: v2.TurnStartParams): Promise<v2.TurnStartResponse> {
|
||||
return this.request<v2.TurnStartResponse>("turn/start", params);
|
||||
}
|
||||
|
||||
steerTurn(params: v2.TurnSteerParams): Promise<v2.TurnSteerResponse> {
|
||||
return this.request<v2.TurnSteerResponse>("turn/steer", params);
|
||||
}
|
||||
|
||||
interruptTurn(
|
||||
params: v2.TurnInterruptParams,
|
||||
): Promise<v2.TurnInterruptResponse> {
|
||||
return this.request<v2.TurnInterruptResponse>("turn/interrupt", params);
|
||||
}
|
||||
|
||||
getAccount(
|
||||
params: v2.GetAccountParams = { refreshToken: false },
|
||||
): Promise<v2.GetAccountResponse> {
|
||||
return this.request<v2.GetAccountResponse>("account/read", params);
|
||||
}
|
||||
}
|
||||
244
packages/codex-client/src/app-server/client.ts
Normal file
244
packages/codex-client/src/app-server/client.ts
Normal file
|
|
@ -0,0 +1,244 @@
|
|||
import type { v2 } from "./generated/index.ts";
|
||||
import { CodexEventEmitter } from "./events.ts";
|
||||
import type { JsonRpcId } from "./rpc.ts";
|
||||
import {
|
||||
CodexStdioTransport,
|
||||
type CodexStdioTransportOptions,
|
||||
} from "./stdio-transport.ts";
|
||||
import {
|
||||
CodexWebSocketTransport,
|
||||
type CodexWebSocketTransportOptions,
|
||||
} from "./websocket-transport.ts";
|
||||
|
||||
export type CodexAppServerTransport = CodexEventEmitter & {
|
||||
readonly requestTimeoutMs: number;
|
||||
start(): void;
|
||||
close(): void;
|
||||
request<T = unknown>(method: string, params?: unknown): Promise<T>;
|
||||
notify(method: string, params?: unknown): void;
|
||||
respond(id: JsonRpcId, result: unknown): void;
|
||||
respondError(id: JsonRpcId, code: number, message: string, data?: unknown): void;
|
||||
};
|
||||
|
||||
export type CodexAppServerClientOptions = {
|
||||
transport?: CodexAppServerTransport;
|
||||
transportOptions?: CodexStdioTransportOptions;
|
||||
webSocketTransportOptions?: CodexWebSocketTransportOptions;
|
||||
clientName?: string;
|
||||
clientTitle?: string;
|
||||
clientVersion?: string;
|
||||
};
|
||||
|
||||
export class CodexAppServerClient extends CodexEventEmitter {
|
||||
readonly transport: CodexAppServerTransport;
|
||||
#clientName: string;
|
||||
#clientTitle: string | null;
|
||||
#clientVersion: string;
|
||||
#connected = false;
|
||||
|
||||
constructor(options: CodexAppServerClientOptions = {}) {
|
||||
super();
|
||||
this.transport =
|
||||
options.transport ?? defaultTransport(options);
|
||||
this.#clientName = options.clientName ?? "@peezy-tech/codex-flows";
|
||||
this.#clientTitle = options.clientTitle ?? "Codex Client";
|
||||
this.#clientVersion = options.clientVersion ?? "0.1.0";
|
||||
|
||||
this.transport.on("notification", (message) =>
|
||||
this.emit("notification", message),
|
||||
);
|
||||
this.transport.on("request", (message) => this.emit("request", message));
|
||||
this.transport.on("stderr", (line) => this.emit("stderr", line));
|
||||
this.transport.on("close", (code, signal) =>
|
||||
this.emit("close", code, signal),
|
||||
);
|
||||
this.transport.on("error", (error) => this.emit("error", error));
|
||||
}
|
||||
|
||||
async connect(): Promise<void> {
|
||||
if (this.#connected) {
|
||||
return;
|
||||
}
|
||||
this.transport.start();
|
||||
await this.request("initialize", {
|
||||
clientInfo: {
|
||||
name: this.#clientName,
|
||||
title: this.#clientTitle,
|
||||
version: this.#clientVersion,
|
||||
},
|
||||
capabilities: {
|
||||
experimentalApi: true,
|
||||
},
|
||||
});
|
||||
this.transport.notify("initialized");
|
||||
this.#connected = true;
|
||||
}
|
||||
|
||||
close(): void {
|
||||
this.#connected = false;
|
||||
this.transport.close();
|
||||
}
|
||||
|
||||
request<T = unknown>(method: string, params?: unknown): Promise<T> {
|
||||
return this.transport.request<T>(method, params);
|
||||
}
|
||||
|
||||
respond(id: JsonRpcId, result: unknown): void {
|
||||
this.transport.respond(id, result);
|
||||
}
|
||||
|
||||
respondError(id: JsonRpcId, code: number, message: string, data?: unknown): void {
|
||||
this.transport.respondError(id, code, message, data);
|
||||
}
|
||||
|
||||
startThread(
|
||||
params: v2.ThreadStartParams,
|
||||
): Promise<v2.ThreadStartResponse> {
|
||||
return this.request<v2.ThreadStartResponse>("thread/start", params);
|
||||
}
|
||||
|
||||
resumeThread(
|
||||
params: v2.ThreadResumeParams,
|
||||
): Promise<v2.ThreadResumeResponse> {
|
||||
return this.request<v2.ThreadResumeResponse>("thread/resume", params);
|
||||
}
|
||||
|
||||
forkThread(
|
||||
params: v2.ThreadForkParams,
|
||||
): Promise<v2.ThreadForkResponse> {
|
||||
return this.request<v2.ThreadForkResponse>("thread/fork", params);
|
||||
}
|
||||
|
||||
listThreads(params: v2.ThreadListParams): Promise<v2.ThreadListResponse> {
|
||||
return this.request<v2.ThreadListResponse>("thread/list", params);
|
||||
}
|
||||
|
||||
readThread(params: v2.ThreadReadParams): Promise<v2.ThreadReadResponse> {
|
||||
return this.request<v2.ThreadReadResponse>("thread/read", params);
|
||||
}
|
||||
|
||||
listThreadTurns(
|
||||
params: v2.ThreadTurnsListParams,
|
||||
): Promise<v2.ThreadTurnsListResponse> {
|
||||
return this.request<v2.ThreadTurnsListResponse>("thread/turns/list", params);
|
||||
}
|
||||
|
||||
listThreadTurnItems(
|
||||
params: v2.ThreadTurnsItemsListParams,
|
||||
): Promise<v2.ThreadTurnsItemsListResponse> {
|
||||
return this.request<v2.ThreadTurnsItemsListResponse>(
|
||||
"thread/turns/items/list",
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
setThreadName(params: v2.ThreadSetNameParams): Promise<v2.ThreadSetNameResponse> {
|
||||
return this.request<v2.ThreadSetNameResponse>("thread/name/set", params);
|
||||
}
|
||||
|
||||
startTurn(params: v2.TurnStartParams): Promise<v2.TurnStartResponse> {
|
||||
return this.request<v2.TurnStartResponse>("turn/start", params);
|
||||
}
|
||||
|
||||
steerTurn(params: v2.TurnSteerParams): Promise<v2.TurnSteerResponse> {
|
||||
return this.request<v2.TurnSteerResponse>("turn/steer", params);
|
||||
}
|
||||
|
||||
interruptTurn(
|
||||
params: v2.TurnInterruptParams,
|
||||
): Promise<v2.TurnInterruptResponse> {
|
||||
return this.request<v2.TurnInterruptResponse>("turn/interrupt", params);
|
||||
}
|
||||
|
||||
commandExec(params: v2.CommandExecParams): Promise<v2.CommandExecResponse> {
|
||||
return this.request<v2.CommandExecResponse>("command/exec", params);
|
||||
}
|
||||
|
||||
commandExecWrite(
|
||||
params: v2.CommandExecWriteParams,
|
||||
): Promise<v2.CommandExecWriteResponse> {
|
||||
return this.request<v2.CommandExecWriteResponse>("command/exec/write", params);
|
||||
}
|
||||
|
||||
commandExecTerminate(
|
||||
params: v2.CommandExecTerminateParams,
|
||||
): Promise<v2.CommandExecTerminateResponse> {
|
||||
return this.request<v2.CommandExecTerminateResponse>(
|
||||
"command/exec/terminate",
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
setThreadGoal(
|
||||
params: v2.ThreadGoalSetParams,
|
||||
): Promise<v2.ThreadGoalSetResponse> {
|
||||
return this.request<v2.ThreadGoalSetResponse>("thread/goal/set", params);
|
||||
}
|
||||
|
||||
getThreadGoal(
|
||||
params: v2.ThreadGoalGetParams,
|
||||
): Promise<v2.ThreadGoalGetResponse> {
|
||||
return this.request<v2.ThreadGoalGetResponse>("thread/goal/get", params);
|
||||
}
|
||||
|
||||
clearThreadGoal(
|
||||
params: v2.ThreadGoalClearParams,
|
||||
): Promise<v2.ThreadGoalClearResponse> {
|
||||
return this.request<v2.ThreadGoalClearResponse>("thread/goal/clear", params);
|
||||
}
|
||||
|
||||
listPlugins(params: v2.PluginListParams): Promise<v2.PluginListResponse> {
|
||||
return this.request<v2.PluginListResponse>("plugin/list", params);
|
||||
}
|
||||
|
||||
readPlugin(params: v2.PluginReadParams): Promise<v2.PluginReadResponse> {
|
||||
return this.request<v2.PluginReadResponse>("plugin/read", params);
|
||||
}
|
||||
|
||||
listPluginShares(): Promise<v2.PluginShareListResponse> {
|
||||
return this.request<v2.PluginShareListResponse>("plugin/share/list", {});
|
||||
}
|
||||
|
||||
updatePluginShareTargets(
|
||||
params: v2.PluginShareUpdateTargetsParams,
|
||||
): Promise<v2.PluginShareUpdateTargetsResponse> {
|
||||
return this.request<v2.PluginShareUpdateTargetsResponse>(
|
||||
"plugin/share/updateTargets",
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
readPluginSkill(
|
||||
params: v2.PluginSkillReadParams,
|
||||
): Promise<v2.PluginSkillReadResponse> {
|
||||
return this.request<v2.PluginSkillReadResponse>("plugin/skill/read", params);
|
||||
}
|
||||
|
||||
getAccountRateLimits(): Promise<v2.GetAccountRateLimitsResponse> {
|
||||
return this.request<v2.GetAccountRateLimitsResponse>("account/rateLimits/read");
|
||||
}
|
||||
|
||||
getAccount(
|
||||
params: v2.GetAccountParams = { refreshToken: false },
|
||||
): Promise<v2.GetAccountResponse> {
|
||||
return this.request<v2.GetAccountResponse>("account/read", params);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function defaultTransport(
|
||||
options: CodexAppServerClientOptions,
|
||||
): CodexAppServerTransport {
|
||||
const webSocketUrl =
|
||||
options.webSocketTransportOptions?.url ??
|
||||
process.env.CODEX_WORKSPACE_APP_SERVER_WS_URL;
|
||||
if (webSocketUrl) {
|
||||
return new CodexWebSocketTransport({
|
||||
url: webSocketUrl,
|
||||
requestTimeoutMs:
|
||||
options.webSocketTransportOptions?.requestTimeoutMs ??
|
||||
options.transportOptions?.requestTimeoutMs,
|
||||
});
|
||||
}
|
||||
return new CodexStdioTransport(options.transportOptions);
|
||||
}
|
||||
39
packages/codex-client/src/app-server/events.ts
Normal file
39
packages/codex-client/src/app-server/events.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
type Listener = (...args: any[]) => void;
|
||||
|
||||
export class CodexEventEmitter {
|
||||
#listeners = new Map<string, Set<Listener>>();
|
||||
|
||||
on(event: string, listener: Listener): this {
|
||||
let listeners = this.#listeners.get(event);
|
||||
if (!listeners) {
|
||||
listeners = new Set();
|
||||
this.#listeners.set(event, listeners);
|
||||
}
|
||||
listeners.add(listener);
|
||||
return this;
|
||||
}
|
||||
|
||||
off(event: string, listener: Listener): this {
|
||||
this.#listeners.get(event)?.delete(listener);
|
||||
return this;
|
||||
}
|
||||
|
||||
once(event: string, listener: Listener): this {
|
||||
const wrapped: Listener = (...args) => {
|
||||
this.off(event, wrapped);
|
||||
listener(...args);
|
||||
};
|
||||
return this.on(event, wrapped);
|
||||
}
|
||||
|
||||
emit(event: string, ...args: any[]): boolean {
|
||||
const listeners = this.#listeners.get(event);
|
||||
if (!listeners || listeners.size === 0) {
|
||||
return false;
|
||||
}
|
||||
for (const listener of [...listeners]) {
|
||||
listener(...args);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
526
packages/codex-client/src/app-server/flows.ts
Normal file
526
packages/codex-client/src/app-server/flows.ts
Normal file
|
|
@ -0,0 +1,526 @@
|
|||
import {
|
||||
CodexAppServerClient,
|
||||
type CodexAppServerClientOptions,
|
||||
} from "./client.ts";
|
||||
import type { v2 } from "./generated/index.ts";
|
||||
import type { JsonRpcNotification } from "./rpc.ts";
|
||||
|
||||
type JsonValue = NonNullable<v2.TurnStartParams["outputSchema"]>;
|
||||
type ThreadConfig = NonNullable<v2.ThreadStartParams["config"]>;
|
||||
type ThreadResumeConfig = NonNullable<v2.ThreadResumeParams["config"]>;
|
||||
|
||||
export type CodexFlowAppServerClient = {
|
||||
connect(): Promise<void>;
|
||||
close(): void;
|
||||
startThread(params: v2.ThreadStartParams): Promise<v2.ThreadStartResponse>;
|
||||
resumeThread(params: v2.ThreadResumeParams): Promise<v2.ThreadResumeResponse>;
|
||||
readThread(params: v2.ThreadReadParams): Promise<v2.ThreadReadResponse>;
|
||||
startTurn(params: v2.TurnStartParams): Promise<v2.TurnStartResponse>;
|
||||
on?(event: string, listener: (...args: any[]) => void): unknown;
|
||||
off?(event: string, listener: (...args: any[]) => void): unknown;
|
||||
};
|
||||
|
||||
export type CodexFlowClientOptions = {
|
||||
client?: CodexFlowAppServerClient;
|
||||
appServerUrl?: string;
|
||||
requestTimeoutMs?: number;
|
||||
clientName?: string;
|
||||
clientTitle?: string;
|
||||
clientVersion?: string;
|
||||
closeInjectedClient?: boolean;
|
||||
};
|
||||
|
||||
export type CodexFlowInputItem =
|
||||
| v2.UserInput
|
||||
| {
|
||||
type: "text";
|
||||
text: string;
|
||||
text_elements?: v2.TextElement[];
|
||||
};
|
||||
|
||||
export type CodexFlowInput =
|
||||
| string
|
||||
| CodexFlowInputItem
|
||||
| CodexFlowInputItem[];
|
||||
|
||||
export type CodexFlowThreadOptions = Partial<
|
||||
Omit<v2.ThreadStartParams, "experimentalRawEvents" | "persistExtendedHistory">
|
||||
> & {
|
||||
experimentalRawEvents?: boolean;
|
||||
persistExtendedHistory?: boolean;
|
||||
};
|
||||
|
||||
export type CodexFlowResumeOptions = Partial<
|
||||
Omit<v2.ThreadResumeParams, "threadId" | "persistExtendedHistory">
|
||||
> & {
|
||||
persistExtendedHistory?: boolean;
|
||||
};
|
||||
|
||||
export type CodexFlowTurnOptions = Partial<
|
||||
Omit<v2.TurnStartParams, "threadId" | "input">
|
||||
>;
|
||||
|
||||
export type CodexFlowWaitOptions = {
|
||||
timeoutMs?: number;
|
||||
pollIntervalMs?: number;
|
||||
signal?: AbortSignal;
|
||||
throwOnFailure?: boolean;
|
||||
};
|
||||
|
||||
export type StartCodexFlowParams = {
|
||||
threadId?: string;
|
||||
prompt?: string;
|
||||
input?: CodexFlowInput;
|
||||
cwd?: string | null;
|
||||
model?: string | null;
|
||||
modelProvider?: string | null;
|
||||
serviceTier?: string | null;
|
||||
approvalPolicy?: v2.AskForApproval | null;
|
||||
approvalsReviewer?: v2.ApprovalsReviewer | null;
|
||||
sandbox?: v2.SandboxMode | null;
|
||||
permissions?: v2.PermissionProfileSelectionParams | null;
|
||||
config?: ThreadConfig | ThreadResumeConfig | null;
|
||||
baseInstructions?: string | null;
|
||||
developerInstructions?: string | null;
|
||||
personality?: v2.ThreadStartParams["personality"];
|
||||
outputSchema?: JsonValue | null;
|
||||
thread?: CodexFlowThreadOptions;
|
||||
resume?: CodexFlowResumeOptions | false;
|
||||
turn?: CodexFlowTurnOptions;
|
||||
wait?: boolean | CodexFlowWaitOptions;
|
||||
};
|
||||
|
||||
export type CodexFlowStartResult = {
|
||||
thread: v2.Thread;
|
||||
turn: v2.Turn;
|
||||
threadId: string;
|
||||
turnId: string;
|
||||
completedTurn?: v2.Turn;
|
||||
};
|
||||
|
||||
export type WaitForTurnParams = {
|
||||
threadId: string;
|
||||
turnId: string;
|
||||
timeoutMs?: number;
|
||||
pollIntervalMs?: number;
|
||||
signal?: AbortSignal;
|
||||
throwOnFailure?: boolean;
|
||||
};
|
||||
|
||||
const DEFAULT_WAIT_TIMEOUT_MS = 120_000;
|
||||
const DEFAULT_POLL_INTERVAL_MS = 1_000;
|
||||
|
||||
export class CodexFlowTimeoutError extends Error {
|
||||
readonly threadId: string;
|
||||
readonly turnId: string;
|
||||
readonly timeoutMs: number;
|
||||
|
||||
constructor(params: { threadId: string; turnId: string; timeoutMs: number }) {
|
||||
super(
|
||||
`Timed out waiting for Codex turn ${params.turnId} on thread ${params.threadId}`,
|
||||
);
|
||||
this.name = "CodexFlowTimeoutError";
|
||||
this.threadId = params.threadId;
|
||||
this.turnId = params.turnId;
|
||||
this.timeoutMs = params.timeoutMs;
|
||||
}
|
||||
}
|
||||
|
||||
export class CodexFlowTurnFailedError extends Error {
|
||||
readonly threadId: string;
|
||||
readonly turn: v2.Turn;
|
||||
|
||||
constructor(threadId: string, turn: v2.Turn) {
|
||||
super(turn.error?.message ?? `Codex turn ${turn.id} failed`);
|
||||
this.name = "CodexFlowTurnFailedError";
|
||||
this.threadId = threadId;
|
||||
this.turn = turn;
|
||||
}
|
||||
}
|
||||
|
||||
export class CodexFlowClient {
|
||||
readonly client: CodexFlowAppServerClient;
|
||||
#connected = false;
|
||||
#closeClient: boolean;
|
||||
|
||||
constructor(options: CodexFlowClientOptions = {}) {
|
||||
this.client =
|
||||
options.client ??
|
||||
new CodexAppServerClient({
|
||||
...clientIdentityOptions(options),
|
||||
webSocketTransportOptions: options.appServerUrl
|
||||
? {
|
||||
url: options.appServerUrl,
|
||||
requestTimeoutMs: options.requestTimeoutMs,
|
||||
}
|
||||
: undefined,
|
||||
transportOptions: options.requestTimeoutMs
|
||||
? { requestTimeoutMs: options.requestTimeoutMs }
|
||||
: undefined,
|
||||
});
|
||||
this.#closeClient = options.client
|
||||
? options.closeInjectedClient === true
|
||||
: true;
|
||||
}
|
||||
|
||||
async connect(): Promise<void> {
|
||||
if (this.#connected) {
|
||||
return;
|
||||
}
|
||||
await this.client.connect();
|
||||
this.#connected = true;
|
||||
}
|
||||
|
||||
close(): void {
|
||||
this.#connected = false;
|
||||
if (this.#closeClient) {
|
||||
this.client.close();
|
||||
}
|
||||
}
|
||||
|
||||
async startFlow(params: StartCodexFlowParams): Promise<CodexFlowStartResult> {
|
||||
await this.connect();
|
||||
|
||||
const input = [
|
||||
...toCodexUserInput(params.prompt),
|
||||
...toCodexUserInput(params.input),
|
||||
];
|
||||
if (input.length === 0) {
|
||||
throw new Error("Codex flow input is required");
|
||||
}
|
||||
|
||||
const thread = await this.#openThread(params);
|
||||
const turnResponse = await this.client.startTurn(
|
||||
turnStartParams(thread.id, input, params),
|
||||
);
|
||||
|
||||
const result: CodexFlowStartResult = {
|
||||
thread,
|
||||
turn: turnResponse.turn,
|
||||
threadId: thread.id,
|
||||
turnId: turnResponse.turn.id,
|
||||
};
|
||||
|
||||
const waitOptions = normalizeWait(params.wait);
|
||||
if (waitOptions) {
|
||||
result.completedTurn = await this.waitForTurn({
|
||||
threadId: thread.id,
|
||||
turnId: turnResponse.turn.id,
|
||||
...waitOptions,
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
async waitForTurn(params: WaitForTurnParams): Promise<v2.Turn> {
|
||||
await this.connect();
|
||||
|
||||
const timeoutMs = params.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS;
|
||||
const pollIntervalMs = params.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
||||
const signal = params.signal;
|
||||
const throwOnFailure = params.throwOnFailure === true;
|
||||
|
||||
return new Promise<v2.Turn>((resolve, reject) => {
|
||||
let settled = false;
|
||||
let polling = false;
|
||||
let timeout: ReturnType<typeof setTimeout> | undefined;
|
||||
let interval: ReturnType<typeof setInterval> | undefined;
|
||||
|
||||
const settle = (turn: v2.Turn): void => {
|
||||
if (settled) {
|
||||
return;
|
||||
}
|
||||
settled = true;
|
||||
cleanup();
|
||||
try {
|
||||
resolve(maybeThrowForFailedTurn(params.threadId, turn, throwOnFailure));
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
};
|
||||
|
||||
const fail = (error: Error): void => {
|
||||
if (settled) {
|
||||
return;
|
||||
}
|
||||
settled = true;
|
||||
cleanup();
|
||||
reject(error);
|
||||
};
|
||||
|
||||
const onNotification = (message: JsonRpcNotification): void => {
|
||||
const turn = completedTurnFromNotification(
|
||||
message,
|
||||
params.threadId,
|
||||
params.turnId,
|
||||
);
|
||||
if (turn) {
|
||||
settle(turn);
|
||||
}
|
||||
};
|
||||
|
||||
const onClose = (): void => {
|
||||
fail(new Error("Codex app-server connection closed while waiting for a turn"));
|
||||
};
|
||||
|
||||
const onAbort = (): void => {
|
||||
fail(new Error("Codex flow wait aborted"));
|
||||
};
|
||||
|
||||
const poll = (): void => {
|
||||
if (polling || settled) {
|
||||
return;
|
||||
}
|
||||
polling = true;
|
||||
void this.#findTurn(params.threadId, params.turnId)
|
||||
.then((turn) => {
|
||||
if (turn && isTerminalTurn(turn)) {
|
||||
settle(turn);
|
||||
}
|
||||
})
|
||||
.catch((error: unknown) => fail(asError(error)))
|
||||
.finally(() => {
|
||||
polling = false;
|
||||
});
|
||||
};
|
||||
|
||||
const cleanup = (): void => {
|
||||
if (timeout) clearTimeout(timeout);
|
||||
if (interval) clearInterval(interval);
|
||||
this.client.off?.("notification", onNotification);
|
||||
this.client.off?.("close", onClose);
|
||||
signal?.removeEventListener("abort", onAbort);
|
||||
};
|
||||
|
||||
this.client.on?.("notification", onNotification);
|
||||
this.client.on?.("close", onClose);
|
||||
signal?.addEventListener("abort", onAbort, { once: true });
|
||||
if (signal?.aborted) {
|
||||
onAbort();
|
||||
return;
|
||||
}
|
||||
|
||||
timeout = setTimeout(
|
||||
() =>
|
||||
fail(
|
||||
new CodexFlowTimeoutError({
|
||||
threadId: params.threadId,
|
||||
turnId: params.turnId,
|
||||
timeoutMs,
|
||||
}),
|
||||
),
|
||||
timeoutMs,
|
||||
);
|
||||
if (pollIntervalMs > 0) {
|
||||
interval = setInterval(poll, pollIntervalMs);
|
||||
}
|
||||
poll();
|
||||
});
|
||||
}
|
||||
|
||||
async readThread(
|
||||
threadId: string,
|
||||
options: { includeTurns?: boolean } = {},
|
||||
): Promise<v2.Thread> {
|
||||
await this.connect();
|
||||
const response = await this.client.readThread({
|
||||
threadId,
|
||||
includeTurns: options.includeTurns === true,
|
||||
});
|
||||
return response.thread;
|
||||
}
|
||||
|
||||
async #openThread(params: StartCodexFlowParams): Promise<v2.Thread> {
|
||||
if (params.threadId) {
|
||||
if (params.resume === false) {
|
||||
return this.readThread(params.threadId, { includeTurns: false });
|
||||
}
|
||||
const response = await this.client.resumeThread(
|
||||
threadResumeParams(params.threadId, params),
|
||||
);
|
||||
return response.thread;
|
||||
}
|
||||
|
||||
const response = await this.client.startThread(threadStartParams(params));
|
||||
return response.thread;
|
||||
}
|
||||
|
||||
async #findTurn(threadId: string, turnId: string): Promise<v2.Turn | undefined> {
|
||||
const thread = await this.readThread(threadId, { includeTurns: true });
|
||||
return thread.turns.find((turn) => turn.id === turnId);
|
||||
}
|
||||
}
|
||||
|
||||
export function createCodexFlowClient(
|
||||
options: CodexFlowClientOptions = {},
|
||||
): CodexFlowClient {
|
||||
return new CodexFlowClient(options);
|
||||
}
|
||||
|
||||
export function toCodexUserInput(
|
||||
input: string | CodexFlowInput | undefined,
|
||||
): v2.UserInput[] {
|
||||
if (!input) {
|
||||
return [];
|
||||
}
|
||||
if (typeof input === "string") {
|
||||
return [{ type: "text", text: input, text_elements: [] }];
|
||||
}
|
||||
const items = Array.isArray(input) ? input : [input];
|
||||
return items.map((item) => {
|
||||
if (item.type === "text") {
|
||||
return {
|
||||
type: "text",
|
||||
text: item.text,
|
||||
text_elements: item.text_elements ?? [],
|
||||
};
|
||||
}
|
||||
return item;
|
||||
}) as v2.UserInput[];
|
||||
}
|
||||
|
||||
export function isTerminalTurn(turn: v2.Turn): boolean {
|
||||
return turn.status !== "inProgress";
|
||||
}
|
||||
|
||||
function clientIdentityOptions(
|
||||
options: CodexFlowClientOptions,
|
||||
): Pick<
|
||||
CodexAppServerClientOptions,
|
||||
"clientName" | "clientTitle" | "clientVersion"
|
||||
> {
|
||||
return compactUndefined({
|
||||
clientName: options.clientName ?? "peezy-tech-codex-flows",
|
||||
clientTitle: options.clientTitle ?? "Codex Flows SDK",
|
||||
clientVersion: options.clientVersion ?? "0.1.0",
|
||||
});
|
||||
}
|
||||
|
||||
function threadStartParams(params: StartCodexFlowParams): v2.ThreadStartParams {
|
||||
const thread = params.thread ?? {};
|
||||
return compactUndefined({
|
||||
...thread,
|
||||
model: params.model ?? thread.model,
|
||||
modelProvider: params.modelProvider ?? thread.modelProvider,
|
||||
serviceTier: params.serviceTier ?? thread.serviceTier,
|
||||
cwd: params.cwd ?? thread.cwd,
|
||||
approvalPolicy: params.approvalPolicy ?? thread.approvalPolicy,
|
||||
approvalsReviewer: params.approvalsReviewer ?? thread.approvalsReviewer,
|
||||
sandbox: params.sandbox ?? thread.sandbox,
|
||||
permissions: params.permissions ?? thread.permissions,
|
||||
config: params.config ?? thread.config,
|
||||
baseInstructions: params.baseInstructions ?? thread.baseInstructions,
|
||||
developerInstructions:
|
||||
params.developerInstructions ?? thread.developerInstructions,
|
||||
personality: params.personality ?? thread.personality,
|
||||
experimentalRawEvents: thread.experimentalRawEvents ?? false,
|
||||
persistExtendedHistory: thread.persistExtendedHistory ?? false,
|
||||
});
|
||||
}
|
||||
|
||||
function threadResumeParams(
|
||||
threadId: string,
|
||||
params: StartCodexFlowParams,
|
||||
): v2.ThreadResumeParams {
|
||||
const resume =
|
||||
params.resume === undefined || params.resume === false ? {} : params.resume;
|
||||
return compactUndefined({
|
||||
...resume,
|
||||
threadId,
|
||||
model: params.model ?? resume.model,
|
||||
modelProvider: params.modelProvider ?? resume.modelProvider,
|
||||
serviceTier: params.serviceTier ?? resume.serviceTier,
|
||||
cwd: params.cwd ?? resume.cwd,
|
||||
approvalPolicy: params.approvalPolicy ?? resume.approvalPolicy,
|
||||
approvalsReviewer: params.approvalsReviewer ?? resume.approvalsReviewer,
|
||||
sandbox: params.sandbox ?? resume.sandbox,
|
||||
permissions: params.permissions ?? resume.permissions,
|
||||
config: params.config ?? resume.config,
|
||||
baseInstructions: params.baseInstructions ?? resume.baseInstructions,
|
||||
developerInstructions:
|
||||
params.developerInstructions ?? resume.developerInstructions,
|
||||
personality: params.personality ?? resume.personality,
|
||||
excludeTurns: resume.excludeTurns ?? true,
|
||||
persistExtendedHistory: resume.persistExtendedHistory ?? false,
|
||||
});
|
||||
}
|
||||
|
||||
function turnStartParams(
|
||||
threadId: string,
|
||||
input: v2.UserInput[],
|
||||
params: StartCodexFlowParams,
|
||||
): v2.TurnStartParams {
|
||||
const turn = params.turn ?? {};
|
||||
return compactUndefined({
|
||||
...turn,
|
||||
threadId,
|
||||
input,
|
||||
cwd: params.cwd ?? turn.cwd,
|
||||
approvalPolicy: params.approvalPolicy ?? turn.approvalPolicy,
|
||||
approvalsReviewer: params.approvalsReviewer ?? turn.approvalsReviewer,
|
||||
permissions: params.permissions ?? turn.permissions,
|
||||
model: params.model ?? turn.model,
|
||||
serviceTier: params.serviceTier ?? turn.serviceTier,
|
||||
personality: params.personality ?? turn.personality,
|
||||
outputSchema: params.outputSchema ?? turn.outputSchema,
|
||||
});
|
||||
}
|
||||
|
||||
function normalizeWait(
|
||||
wait: StartCodexFlowParams["wait"],
|
||||
): CodexFlowWaitOptions | undefined {
|
||||
if (wait === true) {
|
||||
return {};
|
||||
}
|
||||
if (!wait) {
|
||||
return undefined;
|
||||
}
|
||||
return wait;
|
||||
}
|
||||
|
||||
function completedTurnFromNotification(
|
||||
message: JsonRpcNotification,
|
||||
threadId: string,
|
||||
turnId: string,
|
||||
): v2.Turn | undefined {
|
||||
if (message.method !== "turn/completed" || !isRecord(message.params)) {
|
||||
return undefined;
|
||||
}
|
||||
if (message.params.threadId !== threadId || !isRecord(message.params.turn)) {
|
||||
return undefined;
|
||||
}
|
||||
const turn = message.params.turn as Partial<v2.Turn>;
|
||||
return turn.id === turnId && typeof turn.status === "string"
|
||||
? (turn as v2.Turn)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
function maybeThrowForFailedTurn(
|
||||
threadId: string,
|
||||
turn: v2.Turn,
|
||||
throwOnFailure: boolean,
|
||||
): v2.Turn {
|
||||
if (throwOnFailure && turn.status === "failed") {
|
||||
throw new CodexFlowTurnFailedError(threadId, turn);
|
||||
}
|
||||
return turn;
|
||||
}
|
||||
|
||||
function compactUndefined<T extends Record<string, unknown>>(value: T): T {
|
||||
const result: Record<string, unknown> = {};
|
||||
for (const [key, entry] of Object.entries(value)) {
|
||||
if (entry !== undefined) {
|
||||
result[key] = entry;
|
||||
}
|
||||
}
|
||||
return result as T;
|
||||
}
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value);
|
||||
}
|
||||
|
||||
function asError(error: unknown): Error {
|
||||
return error instanceof Error ? error : new Error(String(error));
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
/**
|
||||
* A path that is guaranteed to be absolute and normalized (though it is not
|
||||
* guaranteed to be canonicalized or exist on the filesystem).
|
||||
*
|
||||
* IMPORTANT: When deserializing an `AbsolutePathBuf`, a base path must be set
|
||||
* using [AbsolutePathBufGuard::new]. If no base path is set, the
|
||||
* deserialization will fail unless the path being deserialized is already
|
||||
* absolute.
|
||||
*/
|
||||
export type AbsolutePathBuf = string;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type AgentPath = string;
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { FileChange } from "./FileChange";
|
||||
import type { ThreadId } from "./ThreadId";
|
||||
|
||||
export type ApplyPatchApprovalParams = { conversationId: ThreadId,
|
||||
/**
|
||||
* Use to correlate this with [codex_protocol::protocol::PatchApplyBeginEvent]
|
||||
* and [codex_protocol::protocol::PatchApplyEndEvent].
|
||||
*/
|
||||
callId: string, fileChanges: { [key in string]?: FileChange },
|
||||
/**
|
||||
* Optional explanatory reason (e.g. request for extra write access).
|
||||
*/
|
||||
reason: string | null,
|
||||
/**
|
||||
* When set, the agent is asking the user to allow writes under this root
|
||||
* for the remainder of the session (unclear if this is honored today).
|
||||
*/
|
||||
grantRoot: string | null, };
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ReviewDecision } from "./ReviewDecision";
|
||||
|
||||
export type ApplyPatchApprovalResponse = { decision: ReviewDecision, };
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
/**
|
||||
* Authentication mode for OpenAI-backed providers.
|
||||
*/
|
||||
export type AuthMode = "apikey" | "chatgpt" | "chatgptAuthTokens" | "agentIdentity";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ClientInfo = { name: string, title: string | null, version: string, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ClientNotification = { "method": "initialized" };
|
||||
105
packages/codex-client/src/app-server/generated/ClientRequest.ts
Normal file
105
packages/codex-client/src/app-server/generated/ClientRequest.ts
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,10 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ModeKind } from "./ModeKind";
|
||||
import type { Settings } from "./Settings";
|
||||
|
||||
/**
|
||||
* Collaboration mode for a Codex session.
|
||||
*/
|
||||
export type CollaborationMode = { mode: ModeKind, settings: Settings, };
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ImageDetail } from "./ImageDetail";
|
||||
|
||||
export type ContentItem = { "type": "input_text", text: string, } | { "type": "input_image", image_url: string, detail?: ImageDetail, } | { "type": "output_text", text: string, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ConversationGitInfo = { sha: string | null, branch: string | null, origin_url: string | null, };
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ConversationGitInfo } from "./ConversationGitInfo";
|
||||
import type { SessionSource } from "./SessionSource";
|
||||
import type { ThreadId } from "./ThreadId";
|
||||
|
||||
export type ConversationSummary = { conversationId: ThreadId, path: string, preview: string, timestamp: string | null, updatedAt: string | null, modelProvider: string, cwd: string, cliVersion: string, source: SessionSource, gitInfo: ConversationGitInfo | null, };
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ParsedCommand } from "./ParsedCommand";
|
||||
import type { ThreadId } from "./ThreadId";
|
||||
|
||||
export type ExecCommandApprovalParams = { conversationId: ThreadId,
|
||||
/**
|
||||
* Use to correlate this with [codex_protocol::protocol::ExecCommandBeginEvent]
|
||||
* and [codex_protocol::protocol::ExecCommandEndEvent].
|
||||
*/
|
||||
callId: string,
|
||||
/**
|
||||
* Identifier for this specific approval callback.
|
||||
*/
|
||||
approvalId: string | null, command: Array<string>, cwd: string, reason: string | null, parsedCmd: Array<ParsedCommand>, };
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ReviewDecision } from "./ReviewDecision";
|
||||
|
||||
export type ExecCommandApprovalResponse = { decision: ReviewDecision, };
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
/**
|
||||
* Proposed execpolicy change to allow commands starting with this prefix.
|
||||
*
|
||||
* The `command` tokens form the prefix that would be added as an execpolicy
|
||||
* `prefix_rule(..., decision="allow")`, letting the agent bypass approval for
|
||||
* commands that start with this token sequence.
|
||||
*/
|
||||
export type ExecPolicyAmendment = Array<string>;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type FileChange = { "type": "add", content: string, } | { "type": "delete", content: string, } | { "type": "update", unified_diff: string, move_path: string | null, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ForcedLoginMethod = "chatgpt" | "api";
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { FunctionCallOutputContentItem } from "./FunctionCallOutputContentItem";
|
||||
|
||||
export type FunctionCallOutputBody = string | Array<FunctionCallOutputContentItem>;
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ImageDetail } from "./ImageDetail";
|
||||
|
||||
/**
|
||||
* Responses API compatible content items that can be returned by a tool call.
|
||||
* This is a subset of ContentItem with the types we support as function call outputs.
|
||||
*/
|
||||
export type FunctionCallOutputContentItem = { "type": "input_text", text: string, } | { "type": "input_image", image_url: string, detail?: ImageDetail, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type FuzzyFileSearchMatchType = "file" | "directory";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type FuzzyFileSearchParams = { query: string, roots: Array<string>, cancellationToken: string | null, };
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { FuzzyFileSearchResult } from "./FuzzyFileSearchResult";
|
||||
|
||||
export type FuzzyFileSearchResponse = { files: Array<FuzzyFileSearchResult>, };
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { FuzzyFileSearchMatchType } from "./FuzzyFileSearchMatchType";
|
||||
|
||||
/**
|
||||
* Superset of [`codex_file_search::FileMatch`]
|
||||
*/
|
||||
export type FuzzyFileSearchResult = { root: string, path: string, match_type: FuzzyFileSearchMatchType, file_name: string, score: number, indices: Array<number> | null, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type FuzzyFileSearchSessionCompletedNotification = { sessionId: string, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type FuzzyFileSearchSessionStartParams = { sessionId: string, roots: Array<string>, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type FuzzyFileSearchSessionStartResponse = Record<string, never>;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type FuzzyFileSearchSessionStopParams = { sessionId: string, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type FuzzyFileSearchSessionStopResponse = Record<string, never>;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type FuzzyFileSearchSessionUpdateParams = { sessionId: string, query: string, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type FuzzyFileSearchSessionUpdateResponse = Record<string, never>;
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { FuzzyFileSearchResult } from "./FuzzyFileSearchResult";
|
||||
|
||||
export type FuzzyFileSearchSessionUpdatedNotification = { sessionId: string, query: string, files: Array<FuzzyFileSearchResult>, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type GetAuthStatusParams = { includeToken: boolean | null, refreshToken: boolean | null, };
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { AuthMode } from "./AuthMode";
|
||||
|
||||
export type GetAuthStatusResponse = { authMethod: AuthMode | null, authToken: string | null, requiresOpenaiAuth: boolean | null, };
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ThreadId } from "./ThreadId";
|
||||
|
||||
export type GetConversationSummaryParams = { rolloutPath: string, } | { conversationId: ThreadId, };
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ConversationSummary } from "./ConversationSummary";
|
||||
|
||||
export type GetConversationSummaryResponse = { summary: ConversationSummary, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type GitDiffToRemoteParams = { cwd: string, };
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { GitSha } from "./GitSha";
|
||||
|
||||
export type GitDiffToRemoteResponse = { sha: GitSha, diff: string, };
|
||||
5
packages/codex-client/src/app-server/generated/GitSha.ts
Normal file
5
packages/codex-client/src/app-server/generated/GitSha.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type GitSha = string;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ImageDetail = "auto" | "low" | "high" | "original";
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
/**
|
||||
* Client-declared capabilities negotiated during initialize.
|
||||
*/
|
||||
export type InitializeCapabilities = {
|
||||
/**
|
||||
* Opt into receiving experimental API methods and fields.
|
||||
*/
|
||||
experimentalApi: boolean,
|
||||
/**
|
||||
* Exact notification method names that should be suppressed for this
|
||||
* connection (for example `thread/started`).
|
||||
*/
|
||||
optOutNotificationMethods?: Array<string> | null, };
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ClientInfo } from "./ClientInfo";
|
||||
import type { InitializeCapabilities } from "./InitializeCapabilities";
|
||||
|
||||
export type InitializeParams = { clientInfo: ClientInfo, capabilities: InitializeCapabilities | null, };
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { AbsolutePathBuf } from "./AbsolutePathBuf";
|
||||
|
||||
export type InitializeResponse = { userAgent: string,
|
||||
/**
|
||||
* Absolute path to the server's $CODEX_HOME directory.
|
||||
*/
|
||||
codexHome: AbsolutePathBuf,
|
||||
/**
|
||||
* Platform family for the running app-server target, for example
|
||||
* `"unix"` or `"windows"`.
|
||||
*/
|
||||
platformFamily: string,
|
||||
/**
|
||||
* Operating system for the running app-server target, for example
|
||||
* `"macos"`, `"linux"`, or `"windows"`.
|
||||
*/
|
||||
platformOs: string, };
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
/**
|
||||
* Canonical user-input modality tags advertised by a model.
|
||||
*/
|
||||
export type InputModality = "text" | "image";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type InternalSessionSource = "memory_consolidation";
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { LocalShellExecAction } from "./LocalShellExecAction";
|
||||
|
||||
export type LocalShellAction = { "type": "exec" } & LocalShellExecAction;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type LocalShellExecAction = { command: Array<string>, timeout_ms: bigint | null, working_directory: string | null, env: { [key in string]?: string } | null, user: string | null, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type LocalShellStatus = "completed" | "in_progress" | "incomplete";
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
/**
|
||||
* Classifies an assistant message as interim commentary or final answer text.
|
||||
*
|
||||
* Providers do not emit this consistently, so callers must treat `None` as
|
||||
* "phase unknown" and keep compatibility behavior for legacy models.
|
||||
*/
|
||||
export type MessagePhase = "commentary" | "final_answer";
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
/**
|
||||
* Initial collaboration mode to use when the TUI starts.
|
||||
*/
|
||||
export type ModeKind = "plan" | "default";
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { NetworkPolicyRuleAction } from "./NetworkPolicyRuleAction";
|
||||
|
||||
export type NetworkPolicyAmendment = { host: string, action: NetworkPolicyRuleAction, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type NetworkPolicyRuleAction = "allow" | "deny";
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ParsedCommand = { "type": "read", cmd: string, name: string,
|
||||
/**
|
||||
* (Best effort) Path to the file being read by the command. When
|
||||
* possible, this is an absolute path, though when relative, it should
|
||||
* be resolved against the `cwd`` that will be used to run the command
|
||||
* to derive the absolute path.
|
||||
*/
|
||||
path: string, } | { "type": "list_files", cmd: string, path: string | null, } | { "type": "search", cmd: string, query: string | null, path: string | null, } | { "type": "unknown", cmd: string, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type Personality = "none" | "friendly" | "pragmatic";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type PlanType = "free" | "go" | "plus" | "pro" | "prolite" | "team" | "self_serve_business_usage_based" | "business" | "enterprise_cbp_usage_based" | "enterprise" | "edu" | "unknown";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type RealtimeConversationVersion = "v1" | "v2";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type RealtimeOutputModality = "text" | "audio";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type RealtimeVoice = "alloy" | "arbor" | "ash" | "ballad" | "breeze" | "cedar" | "coral" | "cove" | "echo" | "ember" | "juniper" | "maple" | "marin" | "sage" | "shimmer" | "sol" | "spruce" | "vale" | "verse";
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { RealtimeVoice } from "./RealtimeVoice";
|
||||
|
||||
export type RealtimeVoicesList = { v1: Array<RealtimeVoice>, v2: Array<RealtimeVoice>, defaultV1: RealtimeVoice, defaultV2: RealtimeVoice, };
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
/**
|
||||
* See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#get-started-with-reasoning
|
||||
*/
|
||||
export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ReasoningItemContent = { "type": "reasoning_text", text: string, } | { "type": "text", text: string, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ReasoningItemReasoningSummary = { "type": "summary_text", text: string, };
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
/**
|
||||
* A summary of the reasoning performed by the model. This can be useful for
|
||||
* debugging and understanding the model's reasoning process.
|
||||
* See https://platform.openai.com/docs/guides/reasoning?api-mode=responses#reasoning-summaries
|
||||
*/
|
||||
export type ReasoningSummary = "auto" | "concise" | "detailed" | "none";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type RequestId = string | number;
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { JsonValue } from "./serde_json/JsonValue";
|
||||
|
||||
/**
|
||||
* A known resource that the server is capable of reading.
|
||||
*/
|
||||
export type Resource = { annotations?: JsonValue, description?: string, mimeType?: string, name: string, size?: number, title?: string, uri: string, icons?: Array<JsonValue>, _meta?: JsonValue, };
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { JsonValue } from "./serde_json/JsonValue";
|
||||
|
||||
/**
|
||||
* Contents returned when reading a resource from an MCP server.
|
||||
*/
|
||||
export type ResourceContent = {
|
||||
/**
|
||||
* The URI of this resource.
|
||||
*/
|
||||
uri: string, mimeType?: string, text: string, _meta?: JsonValue, } | {
|
||||
/**
|
||||
* The URI of this resource.
|
||||
*/
|
||||
uri: string, mimeType?: string, blob: string, _meta?: JsonValue, };
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { JsonValue } from "./serde_json/JsonValue";
|
||||
|
||||
/**
|
||||
* A template description for resources available on the server.
|
||||
*/
|
||||
export type ResourceTemplate = { annotations?: JsonValue, uriTemplate: string, name: string, title?: string, description?: string, mimeType?: string, };
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ContentItem } from "./ContentItem";
|
||||
import type { FunctionCallOutputBody } from "./FunctionCallOutputBody";
|
||||
import type { LocalShellAction } from "./LocalShellAction";
|
||||
import type { LocalShellStatus } from "./LocalShellStatus";
|
||||
import type { MessagePhase } from "./MessagePhase";
|
||||
import type { ReasoningItemContent } from "./ReasoningItemContent";
|
||||
import type { ReasoningItemReasoningSummary } from "./ReasoningItemReasoningSummary";
|
||||
import type { WebSearchAction } from "./WebSearchAction";
|
||||
|
||||
export type ResponseItem = { "type": "message", role: string, content: Array<ContentItem>, phase?: MessagePhase, } | { "type": "reasoning", summary: Array<ReasoningItemReasoningSummary>, content?: Array<ReasoningItemContent>, encrypted_content: string | null, } | { "type": "local_shell_call",
|
||||
/**
|
||||
* Set when using the Responses API.
|
||||
*/
|
||||
call_id: string | null, status: LocalShellStatus, action: LocalShellAction, } | { "type": "function_call", name: string, namespace?: string, arguments: string, call_id: string, } | { "type": "tool_search_call", call_id: string | null, status?: string, execution: string, arguments: unknown, } | { "type": "function_call_output", call_id: string, output: FunctionCallOutputBody, } | { "type": "custom_tool_call", status?: string, call_id: string, name: string, input: string, } | { "type": "custom_tool_call_output", call_id: string, name?: string, output: FunctionCallOutputBody, } | { "type": "tool_search_output", call_id: string | null, status: string, execution: string, tools: unknown[], } | { "type": "web_search_call", status?: string, action?: WebSearchAction, } | { "type": "image_generation_call", id: string, status: string, revised_prompt?: string, result: string, } | { "type": "compaction", encrypted_content: string, } | { "type": "context_compaction", encrypted_content?: string, } | { "type": "other" };
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ExecPolicyAmendment } from "./ExecPolicyAmendment";
|
||||
import type { NetworkPolicyAmendment } from "./NetworkPolicyAmendment";
|
||||
|
||||
/**
|
||||
* User's decision in response to an ExecApprovalRequest.
|
||||
*/
|
||||
export type ReviewDecision = "approved" | { "approved_execpolicy_amendment": { proposed_execpolicy_amendment: ExecPolicyAmendment, } } | "approved_for_session" | { "network_policy_amendment": { network_policy_amendment: NetworkPolicyAmendment, } } | "denied" | "timed_out" | "abort";
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,18 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ApplyPatchApprovalParams } from "./ApplyPatchApprovalParams";
|
||||
import type { ExecCommandApprovalParams } from "./ExecCommandApprovalParams";
|
||||
import type { RequestId } from "./RequestId";
|
||||
import type { ChatgptAuthTokensRefreshParams } from "./v2/ChatgptAuthTokensRefreshParams";
|
||||
import type { CommandExecutionRequestApprovalParams } from "./v2/CommandExecutionRequestApprovalParams";
|
||||
import type { DynamicToolCallParams } from "./v2/DynamicToolCallParams";
|
||||
import type { FileChangeRequestApprovalParams } from "./v2/FileChangeRequestApprovalParams";
|
||||
import type { McpServerElicitationRequestParams } from "./v2/McpServerElicitationRequestParams";
|
||||
import type { PermissionsRequestApprovalParams } from "./v2/PermissionsRequestApprovalParams";
|
||||
import type { ToolRequestUserInputParams } from "./v2/ToolRequestUserInputParams";
|
||||
|
||||
/**
|
||||
* Request initiated from the server and sent to the client.
|
||||
*/
|
||||
export type ServerRequest = { "method": "item/commandExecution/requestApproval", id: RequestId, params: CommandExecutionRequestApprovalParams, } | { "method": "item/fileChange/requestApproval", id: RequestId, params: FileChangeRequestApprovalParams, } | { "method": "item/tool/requestUserInput", id: RequestId, params: ToolRequestUserInputParams, } | { "method": "mcpServer/elicitation/request", id: RequestId, params: McpServerElicitationRequestParams, } | { "method": "item/permissions/requestApproval", id: RequestId, params: PermissionsRequestApprovalParams, } | { "method": "item/tool/call", id: RequestId, params: DynamicToolCallParams, } | { "method": "account/chatgptAuthTokens/refresh", id: RequestId, params: ChatgptAuthTokensRefreshParams, } | { "method": "applyPatchApproval", id: RequestId, params: ApplyPatchApprovalParams, } | { "method": "execCommandApproval", id: RequestId, params: ExecCommandApprovalParams, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ServiceTier = "fast" | "flex";
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { InternalSessionSource } from "./InternalSessionSource";
|
||||
import type { SubAgentSource } from "./SubAgentSource";
|
||||
|
||||
export type SessionSource = "cli" | "vscode" | "exec" | "mcp" | { "custom": string } | { "internal": InternalSessionSource } | { "subagent": SubAgentSource } | "unknown";
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ReasoningEffort } from "./ReasoningEffort";
|
||||
|
||||
/**
|
||||
* Settings for a collaboration mode.
|
||||
*/
|
||||
export type Settings = { model: string, reasoning_effort: ReasoningEffort | null, developer_instructions: string | null, };
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { AgentPath } from "./AgentPath";
|
||||
import type { ThreadId } from "./ThreadId";
|
||||
|
||||
export type SubAgentSource = "review" | "compact" | { "thread_spawn": { parent_thread_id: ThreadId, depth: number, agent_path: AgentPath | null, agent_nickname: string | null, agent_role: string | null, } } | "memory_consolidation" | { "other": string };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ThreadId = string;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ThreadMemoryMode = "enabled" | "disabled";
|
||||
9
packages/codex-client/src/app-server/generated/Tool.ts
Normal file
9
packages/codex-client/src/app-server/generated/Tool.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { JsonValue } from "./serde_json/JsonValue";
|
||||
|
||||
/**
|
||||
* Definition for a tool the client can call.
|
||||
*/
|
||||
export type Tool = { name: string, title?: string, description?: string, inputSchema: JsonValue, outputSchema?: JsonValue, annotations?: JsonValue, icons?: Array<JsonValue>, _meta?: JsonValue, };
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
/**
|
||||
* Controls output length/detail on GPT-5 models via the Responses API.
|
||||
* Serialized with lowercase values to match the OpenAI API.
|
||||
*/
|
||||
export type Verbosity = "low" | "medium" | "high";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type WebSearchAction = { "type": "search", query?: string, queries?: Array<string>, } | { "type": "open_page", url?: string, } | { "type": "find_in_page", url?: string, pattern?: string, } | { "type": "other" };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type WebSearchContextSize = "low" | "medium" | "high";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type WebSearchLocation = { country: string | null, region: string | null, city: string | null, timezone: string | null, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type WebSearchMode = "disabled" | "cached" | "live";
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { WebSearchContextSize } from "./WebSearchContextSize";
|
||||
import type { WebSearchLocation } from "./WebSearchLocation";
|
||||
|
||||
export type WebSearchToolConfig = { context_size: WebSearchContextSize | null, allowed_domains: Array<string> | null, location: WebSearchLocation | null, };
|
||||
86
packages/codex-client/src/app-server/generated/index.ts
Normal file
86
packages/codex-client/src/app-server/generated/index.ts
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
export type { AbsolutePathBuf } from "./AbsolutePathBuf";
|
||||
export type { AgentPath } from "./AgentPath";
|
||||
export type { ApplyPatchApprovalParams } from "./ApplyPatchApprovalParams";
|
||||
export type { ApplyPatchApprovalResponse } from "./ApplyPatchApprovalResponse";
|
||||
export type { AuthMode } from "./AuthMode";
|
||||
export type { ClientInfo } from "./ClientInfo";
|
||||
export type { ClientNotification } from "./ClientNotification";
|
||||
export type { ClientRequest } from "./ClientRequest";
|
||||
export type { CollaborationMode } from "./CollaborationMode";
|
||||
export type { ContentItem } from "./ContentItem";
|
||||
export type { ConversationGitInfo } from "./ConversationGitInfo";
|
||||
export type { ConversationSummary } from "./ConversationSummary";
|
||||
export type { ExecCommandApprovalParams } from "./ExecCommandApprovalParams";
|
||||
export type { ExecCommandApprovalResponse } from "./ExecCommandApprovalResponse";
|
||||
export type { ExecPolicyAmendment } from "./ExecPolicyAmendment";
|
||||
export type { FileChange } from "./FileChange";
|
||||
export type { ForcedLoginMethod } from "./ForcedLoginMethod";
|
||||
export type { FunctionCallOutputBody } from "./FunctionCallOutputBody";
|
||||
export type { FunctionCallOutputContentItem } from "./FunctionCallOutputContentItem";
|
||||
export type { FuzzyFileSearchMatchType } from "./FuzzyFileSearchMatchType";
|
||||
export type { FuzzyFileSearchParams } from "./FuzzyFileSearchParams";
|
||||
export type { FuzzyFileSearchResponse } from "./FuzzyFileSearchResponse";
|
||||
export type { FuzzyFileSearchResult } from "./FuzzyFileSearchResult";
|
||||
export type { FuzzyFileSearchSessionCompletedNotification } from "./FuzzyFileSearchSessionCompletedNotification";
|
||||
export type { FuzzyFileSearchSessionStartParams } from "./FuzzyFileSearchSessionStartParams";
|
||||
export type { FuzzyFileSearchSessionStartResponse } from "./FuzzyFileSearchSessionStartResponse";
|
||||
export type { FuzzyFileSearchSessionStopParams } from "./FuzzyFileSearchSessionStopParams";
|
||||
export type { FuzzyFileSearchSessionStopResponse } from "./FuzzyFileSearchSessionStopResponse";
|
||||
export type { FuzzyFileSearchSessionUpdateParams } from "./FuzzyFileSearchSessionUpdateParams";
|
||||
export type { FuzzyFileSearchSessionUpdateResponse } from "./FuzzyFileSearchSessionUpdateResponse";
|
||||
export type { FuzzyFileSearchSessionUpdatedNotification } from "./FuzzyFileSearchSessionUpdatedNotification";
|
||||
export type { GetAuthStatusParams } from "./GetAuthStatusParams";
|
||||
export type { GetAuthStatusResponse } from "./GetAuthStatusResponse";
|
||||
export type { GetConversationSummaryParams } from "./GetConversationSummaryParams";
|
||||
export type { GetConversationSummaryResponse } from "./GetConversationSummaryResponse";
|
||||
export type { GitDiffToRemoteParams } from "./GitDiffToRemoteParams";
|
||||
export type { GitDiffToRemoteResponse } from "./GitDiffToRemoteResponse";
|
||||
export type { GitSha } from "./GitSha";
|
||||
export type { ImageDetail } from "./ImageDetail";
|
||||
export type { InitializeCapabilities } from "./InitializeCapabilities";
|
||||
export type { InitializeParams } from "./InitializeParams";
|
||||
export type { InitializeResponse } from "./InitializeResponse";
|
||||
export type { InputModality } from "./InputModality";
|
||||
export type { InternalSessionSource } from "./InternalSessionSource";
|
||||
export type { LocalShellAction } from "./LocalShellAction";
|
||||
export type { LocalShellExecAction } from "./LocalShellExecAction";
|
||||
export type { LocalShellStatus } from "./LocalShellStatus";
|
||||
export type { MessagePhase } from "./MessagePhase";
|
||||
export type { ModeKind } from "./ModeKind";
|
||||
export type { NetworkPolicyAmendment } from "./NetworkPolicyAmendment";
|
||||
export type { NetworkPolicyRuleAction } from "./NetworkPolicyRuleAction";
|
||||
export type { ParsedCommand } from "./ParsedCommand";
|
||||
export type { Personality } from "./Personality";
|
||||
export type { PlanType } from "./PlanType";
|
||||
export type { RealtimeConversationVersion } from "./RealtimeConversationVersion";
|
||||
export type { RealtimeOutputModality } from "./RealtimeOutputModality";
|
||||
export type { RealtimeVoice } from "./RealtimeVoice";
|
||||
export type { RealtimeVoicesList } from "./RealtimeVoicesList";
|
||||
export type { ReasoningEffort } from "./ReasoningEffort";
|
||||
export type { ReasoningItemContent } from "./ReasoningItemContent";
|
||||
export type { ReasoningItemReasoningSummary } from "./ReasoningItemReasoningSummary";
|
||||
export type { ReasoningSummary } from "./ReasoningSummary";
|
||||
export type { RequestId } from "./RequestId";
|
||||
export type { Resource } from "./Resource";
|
||||
export type { ResourceContent } from "./ResourceContent";
|
||||
export type { ResourceTemplate } from "./ResourceTemplate";
|
||||
export type { ResponseItem } from "./ResponseItem";
|
||||
export type { ReviewDecision } from "./ReviewDecision";
|
||||
export type { ServerNotification } from "./ServerNotification";
|
||||
export type { ServerRequest } from "./ServerRequest";
|
||||
export type { ServiceTier } from "./ServiceTier";
|
||||
export type { SessionSource } from "./SessionSource";
|
||||
export type { Settings } from "./Settings";
|
||||
export type { SubAgentSource } from "./SubAgentSource";
|
||||
export type { ThreadId } from "./ThreadId";
|
||||
export type { ThreadMemoryMode } from "./ThreadMemoryMode";
|
||||
export type { Tool } from "./Tool";
|
||||
export type { Verbosity } from "./Verbosity";
|
||||
export type { WebSearchAction } from "./WebSearchAction";
|
||||
export type { WebSearchContextSize } from "./WebSearchContextSize";
|
||||
export type { WebSearchLocation } from "./WebSearchLocation";
|
||||
export type { WebSearchMode } from "./WebSearchMode";
|
||||
export type { WebSearchToolConfig } from "./WebSearchToolConfig";
|
||||
export * as v2 from "./v2/index.ts";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type JsonValue = number | string | boolean | Array<JsonValue> | { [key in string]?: JsonValue } | null;
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { PlanType } from "../PlanType";
|
||||
|
||||
export type Account = { "type": "apiKey", } | { "type": "chatgpt", email: string, planType: PlanType, } | { "type": "amazonBedrock", };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type AccountLoginCompletedNotification = { loginId: string | null, success: boolean, error: string | null, };
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { RateLimitSnapshot } from "./RateLimitSnapshot";
|
||||
|
||||
export type AccountRateLimitsUpdatedNotification = { rateLimits: RateLimitSnapshot, };
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { AuthMode } from "../AuthMode";
|
||||
import type { PlanType } from "../PlanType";
|
||||
|
||||
export type AccountUpdatedNotification = { authMode: AuthMode | null, planType: PlanType | null, };
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ActivePermissionProfileModification } from "./ActivePermissionProfileModification";
|
||||
|
||||
export type ActivePermissionProfile = {
|
||||
/**
|
||||
* Identifier from `default_permissions` or the implicit built-in default,
|
||||
* such as `:workspace` or a user-defined `[permissions.<id>]` profile.
|
||||
*/
|
||||
id: string,
|
||||
/**
|
||||
* Parent profile identifier once permissions profiles support
|
||||
* inheritance. This is currently always `null`.
|
||||
*/
|
||||
extends: string | null,
|
||||
/**
|
||||
* Bounded user-requested modifications applied on top of the named
|
||||
* profile, if any.
|
||||
*/
|
||||
modifications: Array<ActivePermissionProfileModification>, };
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { AbsolutePathBuf } from "../AbsolutePathBuf";
|
||||
|
||||
export type ActivePermissionProfileModification = { "type": "additionalWritableRoot", path: AbsolutePathBuf, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type AddCreditsNudgeCreditType = "credits" | "usage_limit";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type AddCreditsNudgeEmailStatus = "sent" | "cooldown_active";
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { AbsolutePathBuf } from "../AbsolutePathBuf";
|
||||
import type { FileSystemSandboxEntry } from "./FileSystemSandboxEntry";
|
||||
|
||||
export type AdditionalFileSystemPermissions = {
|
||||
/**
|
||||
* This will be removed in favor of `entries`.
|
||||
*/
|
||||
read: Array<AbsolutePathBuf> | null,
|
||||
/**
|
||||
* This will be removed in favor of `entries`.
|
||||
*/
|
||||
write: Array<AbsolutePathBuf> | null, globScanMaxDepth?: number, entries?: Array<FileSystemSandboxEntry>, };
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type AdditionalNetworkPermissions = { enabled: boolean | null, };
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { AdditionalFileSystemPermissions } from "./AdditionalFileSystemPermissions";
|
||||
import type { AdditionalNetworkPermissions } from "./AdditionalNetworkPermissions";
|
||||
|
||||
export type AdditionalPermissionProfile = {
|
||||
/**
|
||||
* Partial overlay used for per-command permission requests.
|
||||
*/
|
||||
network: AdditionalNetworkPermissions | null, fileSystem: AdditionalFileSystemPermissions | null, };
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue