Official
codex
Codex agent provider: runs the Codex CLI's app-server for each account.
The app opens the listing; nothing installs until an agent in your Plugins workspace has read the files and you enable the plugin. In a terminal: dvg install divergence/codex@0.2.3
Permissions in 0.2.3
Files
types.ts3.4 KB
// Provider state and boundary schemas. Output types come directly from
// the Divergence agent protocol; app-server input types live in wire.ts.
import * as z from "zod";
import type * as Deferred from "effect/Deferred";
import type { Thread, Turn } from "./wire.ts";
import { contextSchema } from "../sdk/context.ts";
export type {
ConfigChoice as Choice,
ConfigOption,
ToolContent,
ToolCall,
QuestionOption,
QuestionField,
TaskInfo as Task,
Usage,
UsageWindow,
UsageLimits,
TranscriptItem,
AgentInfo,
} from "divergence/protocol";
import type { TaskInfo as Task, Usage } from "divergence/protocol";
export const answerSchema = z.object({
cancelled: z.boolean().optional(),
values: z
.record(z.string(), z.union([z.string(), z.boolean(), z.number(), z.array(z.string()), z.null()]))
.optional(),
});
export type QuestionAnswer = z.infer<typeof answerSchema>;
export interface History {
thread: Thread;
turns: Turn[];
/// The thread has older turns than `turns` holds.
cut?: boolean;
}
export interface Facts {
toolCallId?: string | null;
prompt?: string | null;
model?: string | null;
effort?: string | null;
name?: string | null;
taskName?: string | null;
startedAt?: string | null;
}
export interface Session {
workspace: string;
options: Record<string, unknown>;
run: string | null;
turn: string | null;
starting?: Deferred.Deferred<string | null>;
inputs: Map<string, { inputId: string; attemptId: string; runId: string; contextId?: string }>;
endedTurns: Set<string>;
turns: Map<string, string>;
streamed: Set<string>;
startedTools: Set<string>;
held: Map<string, string>;
unloaded?: boolean;
/// The `thread/unsubscribe` that released the thread, while it is out.
releasing?: Deferred.Deferred<void>;
/// A Stop whose interrupt Codex has not answered: the run it ended and
/// that run's native turn, null until Codex names it. The thread is kept
/// loaded until then.
stopping?: { run: string; turn: string | null };
}
export interface Child {
root: string;
turn: string | null;
endedTurns: Set<string>;
task: Task;
taskName: string | null;
tools: Set<string>;
streamed: Set<string>;
held: Map<string, string>;
}
export type { AgentEvent as Event } from "divergence/protocol";
export const sessionSchema = z.looseObject({
workspace: z.string().optional(),
options: z.record(z.string(), z.unknown()).optional(),
instructions: z.string().optional(),
tools: z
.array(z.object({ name: z.string(), description: z.string().nullish(), inputSchema: z.unknown().optional() }))
.optional(),
});
export interface SessionOptions {
workspace?: string;
options?: Record<string, unknown>;
instructions?: string;
tools?: { name: string; description?: string | null; inputSchema?: unknown }[];
}
export const promptSchema = z.object({
itemId: z.string().optional(),
context: contextSchema.optional(),
delivery: z
.object({ inputId: z.string(), attemptId: z.string(), intent: z.enum(["send", "steer", "queue"]) })
.optional(),
blocks: z
.array(
z.looseObject({
type: z.string().optional(),
text: z.string().optional(),
path: z.string().optional(),
mimeType: z.string().optional(),
data: z.string().optional(),
name: z.string().optional(),
input: z.string().optional(),
}),
)
.optional(),
});
export type PromptInput = z.infer<typeof promptSchema>;
No comments yet.