mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 11:30:43 +00:00
* fix(scripts): find codex protocol source from worktrees * fix(test): keep codex harness docker caches writable * fix(test): relax live codex cache mount permissions * test(codex): add live docker harness debug output * fix(test): detect numeric ci env in codex docker harness * fix(codex): skip duplicate agent-command telemetry * fix(tooling): skip sparse-missing oxlint tsconfig * fix(tooling): route changed checks through testbox * fix(qa): keep coverage json source-clean * fix(test): preflight codex docker auth * fix(codex): validate bind option values * fix(codex): parse quoted command arguments * fix(codex): reject extra control args * fix(codex): use content for blank bound prompts * fix(codex): decode local image file urls * fix(codex): treat local media urls as images * fix(codex): keep windows media paths local * fix(codex): reject malformed diagnostics confirmations * fix(codex): reject malformed resume commands * fix(codex): reject malformed thread actions * fix(codex): reject malformed turn controls * fix(codex): reject malformed model controls * fix(codex): resolve empty user input prompts * fix(codex): enforce user input options * fix(codex): reject ambiguous computer-use actions * fix(codex): ignore stale bound turn notifications * test(gateway): close task registries in gateway harness * test(gateway): route cleanup through task seams * fix(codex): describe current permission approvals * fix(codex): disclose command approval amendments * fix(codex): preserve approval detail under truncation * fix(codex): propagate dynamic tool failures * test(codex): align dynamic tool block contract * fix(codex): reject extra read-only command operands * fix(codex): escape command readout fields * fix(codex): escape status probe errors * fix(codex): narrow formatted thread details * fix(codex): escape successful status summaries * fix(codex): escape bound control replies * fix(codex): escape user input prompts * fix(codex): escape control failure replies * fix(codex): escape approval prompt text * test(codex): narrow escaped reply assertions * test(codex): complete strict reply fixtures * test(codex): preserve account fixture literals * test(codex): align status probe fixtures * fix(codex): satisfy sanitizer regex lint * fix(codex): harden command readouts * fix(codex): harden bound image inputs * fix(codex): sanitize command failure replies * test(codex): complete rate limit fixture * test(tooling): isolate postinstall compile cache fixture * fix(codex): keep app-server event ownership explicit --------- Co-authored-by: pashpashpash <nik@vault77.ai>
59 lines
2.0 KiB
TypeScript
59 lines
2.0 KiB
TypeScript
import fs from "node:fs/promises";
|
|
import path from "node:path";
|
|
import { resolveCodexAppServerProtocolSource } from "./lib/codex-app-server-protocol-source.js";
|
|
|
|
const { sourceRoot } = await resolveCodexAppServerProtocolSource(process.cwd());
|
|
const targetRoot = path.resolve(
|
|
process.cwd(),
|
|
"extensions/codex/src/app-server/protocol-generated",
|
|
);
|
|
|
|
const selectedJsonSchemas = [
|
|
"DynamicToolCallParams.json",
|
|
"v2/ErrorNotification.json",
|
|
"v2/GetAccountResponse.json",
|
|
"v2/ModelListResponse.json",
|
|
"v2/ThreadResumeResponse.json",
|
|
"v2/ThreadStartResponse.json",
|
|
"v2/TurnCompletedNotification.json",
|
|
"v2/TurnStartResponse.json",
|
|
] as const;
|
|
|
|
await fs.rm(targetRoot, { recursive: true, force: true });
|
|
await fs.mkdir(targetRoot, { recursive: true });
|
|
await fs.cp(path.join(sourceRoot, "typescript"), path.join(targetRoot, "typescript"), {
|
|
recursive: true,
|
|
});
|
|
await rewriteTypeScriptImports(path.join(targetRoot, "typescript"));
|
|
|
|
for (const schema of selectedJsonSchemas) {
|
|
await fs.mkdir(path.dirname(path.join(targetRoot, "json", schema)), { recursive: true });
|
|
await fs.copyFile(path.join(sourceRoot, "json", schema), path.join(targetRoot, "json", schema));
|
|
}
|
|
|
|
console.log(`Synced Codex app-server generated protocol from ${sourceRoot}`);
|
|
|
|
async function rewriteTypeScriptImports(root: string): Promise<void> {
|
|
const entries = await fs.readdir(root, { withFileTypes: true });
|
|
await Promise.all(
|
|
entries.map(async (entry) => {
|
|
const fullPath = path.join(root, entry.name);
|
|
if (entry.isDirectory()) {
|
|
await rewriteTypeScriptImports(fullPath);
|
|
return;
|
|
}
|
|
if (!entry.isFile() || !entry.name.endsWith(".ts")) {
|
|
return;
|
|
}
|
|
const text = await fs.readFile(fullPath, "utf8");
|
|
await fs.writeFile(
|
|
fullPath,
|
|
text
|
|
.replace(/(from\s+["'])(\.{1,2}\/[^"']+?)(\.js)?(["'])/g, "$1$2.js$4")
|
|
.replace('export * as v2 from "./v2.js";', 'export * as v2 from "./v2/index.js";')
|
|
.replaceAll("| null | null", "| null"),
|
|
);
|
|
}),
|
|
);
|
|
}
|