feat: surface codex thread collaboration capabilities

This commit is contained in:
AI Bot
2026-06-04 14:34:34 +08:00
parent de9f85bd21
commit 5bf2216cb0
12 changed files with 359 additions and 121 deletions

View File

@@ -28,7 +28,7 @@ if (args.includes("--version")) {
}
if (args[0] === "app-server" && args.includes("--help")) {
console.log("Usage: codex app-server [OPTIONS]");
console.log("--listen <URL> stdio:// unix:// ws://IP:PORT off");
console.log("--listen <URL> stdio:// unix:// ws://IP:PORT off ");
process.exit(0);
}
if (args[0] === "app-server" && args[1] === "generate-json-schema") {
@@ -36,6 +36,9 @@ if (args[0] === "app-server" && args[1] === "generate-json-schema") {
writeGenerated(out, "codex_app_server_protocol.schemas.json", JSON.stringify({
anyOf: [
{ properties: { method: { const: "thread/start" } } },
{ properties: { method: { const: "thread/resume" } } },
{ properties: { method: { const: "thread/read" } } },
{ properties: { method: { const: "thread/turns/list" } } },
{ properties: { method: { const: "thread/inject_items" } } },
{ properties: { method: { const: "thread/archive" } } },
{ properties: { method: { const: "thread/archived" } } },
@@ -93,6 +96,11 @@ if (args[0] === "app-server" && args[1] === "generate-json-schema") {
{ properties: { method: { const: "marketplace/upgrade" } } },
{ properties: { method: { const: "experimentalFeature/list" } } },
{ properties: { method: { const: "experimentalFeature/enablement/set" } } },
{ properties: { method: { const: "app/list" } } },
{ properties: { method: { const: "app/list/updated" } } },
{ properties: { method: { const: "collaborationMode/list" } } },
{ properties: { method: { const: "configRequirements/read" } } },
{ properties: { method: { const: "mcpServerStatus/list" } } },
{ properties: { method: { const: "review/start" } } },
{ properties: { method: { const: "windowsSandbox/readiness" } } },
{ properties: { method: { const: "windowsSandbox/setupStart" } } },
@@ -123,13 +131,22 @@ if (args[0] === "app-server" && args[1] === "generate-json-schema") {
{ properties: { method: { const: "hooks/list" } } },
{ properties: { method: { const: "turn/interrupt" } } },
{ properties: { method: { const: "turn/start" } } }
]
],
definitions: {
ThreadItem: {
anyOf: [
{ properties: { type: { const: "agentMessage" } } },
{ properties: { type: { const: "collabToolCall" } } },
{ properties: { type: { const: "contextCompaction" } } }
]
}
}
}, null, 2));
process.exit(0);
}
if (args[0] === "app-server" && args[1] === "generate-ts") {
const out = args[args.indexOf("--out") + 1];
writeGenerated(out, "ClientRequest.ts", 'export type ClientRequest = { "method": "thread/start" } | { "method": "skills/extraRoots/set" } | { "method": "hooks/list" } | { "method": "turn/start" };\\n');
writeGenerated(out, "ClientRequest.ts", 'export type ClientRequest = { "method": "thread/start" } | { "method": "app/list" } | { "method": "collaborationMode/list" } | { "method": "mcpServerStatus/list" } | { "method": "configRequirements/read" } | { "method": "skills/extraRoots/set" } | { "method": "hooks/list" } | { "method": "turn/start" }; export type ThreadItem = { type: "collabToolCall" } | { type: "contextCompaction" };\\n');
process.exit(0);
}
console.error("unexpected args " + args.join(" "));
@@ -160,6 +177,10 @@ process.exit(2);
assert.equal(manifest.codexVersion, "0.135.0-alpha.1");
assert.equal(manifest.supports.wsTransport, true);
assert.equal(manifest.supports.unixTransport, true);
assert.equal(manifest.supports.threadStart, true);
assert.equal(manifest.supports.threadResume, true);
assert.equal(manifest.supports.threadRead, true);
assert.equal(manifest.supports.threadTurnHistory, true);
assert.equal(manifest.supports.threadInjectItems, true);
assert.equal(manifest.supports.skillsExtraRoots, true);
assert.equal(manifest.supports.hooksList, true);
@@ -198,6 +219,13 @@ process.exit(2);
assert.equal(manifest.supports.marketplaceRemove, true);
assert.equal(manifest.supports.marketplaceUpgrade, true);
assert.equal(manifest.supports.experimentalFeatureEnablementSet, true);
assert.equal(manifest.supports.appList, true);
assert.equal(manifest.supports.appListUpdated, true);
assert.equal(manifest.supports.collaborationModeList, true);
assert.equal(manifest.supports.configRequirementsRead, true);
assert.equal(manifest.supports.mcpServerStatusList, true);
assert.equal(manifest.supports.threadCollaborationItems, true);
assert.equal(manifest.supports.contextCompactionItem, true);
assert.equal(manifest.supports.reviewStart, true);
assert.equal(manifest.supports.windowsSandboxReadiness, true);
assert.equal(manifest.supports.windowsSandboxSetupStart, true);
@@ -228,6 +256,9 @@ process.exit(2);
"account/login/start",
"account/logout",
"account/sendAddCreditsNudgeEmail",
"app/list",
"app/list/updated",
"collaborationMode/list",
"command/exec",
"command/exec/outputDelta",
"command/exec/resize",
@@ -236,6 +267,7 @@ process.exit(2);
"config/batchWrite",
"config/mcpServer/reload",
"config/value/write",
"configRequirements/read",
"experimentalFeature/enablement/set",
"experimentalFeature/list",
"externalAgentConfig/detect",
@@ -271,6 +303,7 @@ process.exit(2);
"mcpServer/oauthLogin/completed",
"mcpServer/resource/read",
"mcpServer/tool/call",
"mcpServerStatus/list",
"plugin/install",
"plugin/installed",
"plugin/read",
@@ -298,10 +331,13 @@ process.exit(2);
"thread/metadata/update",
"thread/name/set",
"thread/name/updated",
"thread/read",
"thread/resume",
"thread/rollback",
"thread/shellCommand",
"thread/start",
"thread/started",
"thread/turns/list",
"thread/unarchive",
"thread/unarchived",
"thread/unsubscribe",
@@ -311,10 +347,9 @@ process.exit(2);
"windowsSandbox/setupCompleted",
"windowsSandbox/setupStart",
]);
assert.match(
await readFile(path.join(outDir, "0.135.0-alpha.1", "app-server-help.txt"), "utf8"),
/ws:\/\/IP:PORT/,
);
const helpText = await readFile(path.join(outDir, "0.135.0-alpha.1", "app-server-help.txt"), "utf8");
assert.match(helpText, /ws:\/\/IP:PORT/);
assert.doesNotMatch(helpText, /[ \t]$/m);
} finally {
await rm(runtimeRoot, { recursive: true, force: true });
}