Integrations

Codex Adapter

Capture Codex hooks and JSONL events, classify tools, consult fixture gateways, generate plugin files, and understand managed replay limits.

@isplay/adapter-codex targets Codex-style managed runtime surfaces.

Exports

ExportPurpose
createCodexAdapter(options?)Returns capabilities, hook handler, JSONL line ingestor, and JSON event ingestor.
codexCapabilitiesCapability manifest for Codex.
CodexHookHandlerHandles prompt, pre-tool, permission, post-tool, and stop hook inputs.
CodexJsonlIngestorConverts JSONL turn/item events to model and tool records.
createCodexPluginFiles(command?)Generates plugin files for hook wiring.
threadFork, threadRollback, injectAssistantContextApp-server request helper payloads.

Setup

import { init } from "@isplay/sdk";
import { createCodexAdapter } from "@isplay/adapter-codex";

init({
  projectId: process.env.ISPLAY_PROJECT_ID!,
  baseUrl: process.env.ISPLAY_API_URL,
});

const codex = createCodexAdapter({
  runKey: (event) => String(event.thread_id ?? event.session_id ?? "codex"),
});

Hook Handling

const output = await codex.handleHook(input);

Handled hook events:

EventCaptured behavior
UserPromptSubmitRecords hook event and annotates user prompt. Can return additional context.
PreToolUseRecords proposal and starts tool execution. Consults fixture gateway.
PermissionRequestStarts tool execution and can deny permission through hook-specific output.
PostToolUseFinishes tool execution with output. Can add replacement context when configured.
StopAnnotates final assistant message when present.

postToolReplacement controls whether injected fixtures can be returned as post-tool context. It cannot undo a built-in side effect that already happened.

JSONL Ingestion

await codex.ingestJsonLine(line);
await codex.ingestJsonEvent(event);

Mapped events:

JSONL eventCapture
turn.startedStarts model call with provider openai and operation stream.
turn.completed / turn.failedFinishes model call with output, usage, or error.
item.startedCaptures tool proposal and tool start for known tool item types.
item.completedFinishes the matching tool execution.

Tool name mapping:

Item typeTool name
command_executionBash
file_changeapply_patch
mcp_tool_calltool_name, name, or mcp
web_searchWebSearch

Capabilities

Codex is managed_replay.

PrimitiveStatusMode
Context inventorymanaged_replayobserve_only
Prompt patchmanaged_replaynative_replace
Model capturemanaged_replayproxy_replace
Model replaymanaged_replayproxy_replace
Tool capturemanaged_replayobserve_only
Tool fixture replaymanaged_replaypost_result_replace
Checkpointingmanaged_replayobserve_only

Warnings

  • Public Codex hooks do not provide pre-execution synthetic results for every built-in tool.
  • Full built-in shell or apply_patch replay needs a fork or upstream pre-dispatch replacement hook.
  • Use isplay-owned MCP or proxy tools when fixture-safe replay matters.
  • Treat Bash, write, edit, patch, send, deploy, and delete tools as side-effecting unless proven otherwise.

On this page