Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
import * as Schema from "effect/Schema";
import * as CodexErrors from "effect-codex-app-server/errors";
import * as CodexRpc from "effect-codex-app-server/rpc";
import * as EffectCodexSchema from "effect-codex-app-server/schema";
export const isCodexAppServerRequestError = Schema.is(CodexErrors.CodexAppServerRequestError);
export function makeThreadOpenResponse(
threadId: string,
): CodexRpc.ClientRequestResponsesByMethod["thread/start"] {
return {
cwd: "/tmp/project",
model: "gpt-5.3-codex",
modelProvider: "openai",
approvalPolicy: "never",
approvalsReviewer: "user",
sandbox: { type: "dangerFullAccess" },
thread: {
id: threadId,
createdAt: 1776470400,
updatedAt: 1776470400,
cliVersion: "0.0.0",
cwd: "/tmp/project",
ephemeral: true,
modelProvider: "openai",
preview: "",
sessionId: threadId,
source: "cli",
turns: [],
status: {
type: "idle",
},
},
};
}
export const request = {
mode: "form",
message: "Allow ChatGPT to use Safari?",
serverName: "computer-use",
threadId: "provider-thread-1",
turnId: "turn-1",
_meta: {
app_name: "Safari",
persist: ["session", "always"],
},
requestedSchema: {
type: "object",
properties: {
approval: {
type: "string",
oneOf: [
{ const: "once", title: "Allow once" },
{ const: "session", title: "Allow for this session" },
{ const: "always", title: "Always allow Safari" },
],
},
},
required: ["approval"],
},
} satisfies EffectCodexSchema.McpServerElicitationRequestParams;
export function makeThreadStartedNotification(
threadId: string,
source: EffectCodexSchema.V2ThreadStartedNotification["thread"]["source"],
threadSource?: string,
) {
return {
method: "thread/started" as const,
params: {
thread: {
cliVersion: "0.0.0",
createdAt: 0,
cwd: "/tmp/project",
ephemeral: true,
id: threadId,
modelProvider: "openai",
preview: "",
sessionId: threadId,
source,
status: { type: "idle" as const },
...(threadSource ? { threadSource } : {}),
turns: [],
updatedAt: 0,
},
},
};
}