feat: expose codex runtime lifecycle events

This commit is contained in:
AI Bot
2026-06-03 12:27:41 +08:00
parent f23ed9f188
commit b31238b6e2
12 changed files with 180 additions and 7 deletions

View File

@@ -38,15 +38,21 @@ if (args[0] === "app-server" && args[1] === "generate-json-schema") {
{ properties: { method: { const: "thread/start" } } },
{ properties: { method: { const: "thread/inject_items" } } },
{ properties: { method: { const: "thread/archive" } } },
{ properties: { method: { const: "thread/archived" } } },
{ properties: { method: { const: "thread/unarchive" } } },
{ properties: { method: { const: "thread/unarchived" } } },
{ properties: { method: { const: "thread/fork" } } },
{ properties: { method: { const: "thread/closed" } } },
{ properties: { method: { const: "thread/compact/start" } } },
{ properties: { method: { const: "thread/rollback" } } },
{ properties: { method: { const: "thread/name/set" } } },
{ properties: { method: { const: "thread/name/updated" } } },
{ properties: { method: { const: "thread/metadata/update" } } },
{ properties: { method: { const: "thread/shellCommand" } } },
{ properties: { method: { const: "thread/unsubscribe" } } },
{ properties: { method: { const: "thread/started" } } },
{ properties: { method: { const: "plugin/install" } } },
{ properties: { method: { const: "plugin/installed" } } },
{ properties: { method: { const: "plugin/uninstall" } } },
{ properties: { method: { const: "plugin/read" } } },
{ properties: { method: { const: "plugin/skill/read" } } },
@@ -99,7 +105,11 @@ if (args[0] === "app-server" && args[1] === "generate-json-schema") {
{ properties: { method: { const: "mcpServer/elicitation/request" } } },
{ properties: { method: { const: "item/tool/requestUserInput" } } },
{ properties: { method: { const: "item/permissions/requestApproval" } } },
{ properties: { method: { const: "process/outputDelta" } } },
{ properties: { method: { const: "process/exited" } } },
{ properties: { method: { const: "rawResponseItem/completed" } } },
{ properties: { method: { const: "thread/approveGuardianDeniedAction" } } },
{ properties: { method: { const: "skills/changed" } } },
{ properties: { method: { const: "skills/extraRoots/set" } } },
{ properties: { method: { const: "hooks/list" } } },
{ properties: { method: { const: "turn/interrupt" } } },
@@ -190,6 +200,11 @@ process.exit(2);
assert.equal(manifest.supports.toolRequestUserInput, true);
assert.equal(manifest.supports.permissionRequestApproval, true);
assert.equal(manifest.supports.guardianDeniedActionApproval, true);
assert.equal(manifest.supports.processEvents, true);
assert.equal(manifest.supports.rawResponseCompleted, true);
assert.equal(manifest.supports.skillsChanged, true);
assert.equal(manifest.supports.pluginInstalledNotification, true);
assert.equal(manifest.supports.threadLifecycleEvents, true);
assert.deepEqual(manifest.methods, [
"account/chatgptAuthTokens/refresh",
"account/login/cancel",
@@ -232,6 +247,7 @@ process.exit(2);
"mcpServer/resource/read",
"mcpServer/tool/call",
"plugin/install",
"plugin/installed",
"plugin/read",
"plugin/share/checkout",
"plugin/share/delete",
@@ -240,20 +256,29 @@ process.exit(2);
"plugin/share/updateTargets",
"plugin/skill/read",
"plugin/uninstall",
"process/exited",
"process/outputDelta",
"rawResponseItem/completed",
"review/start",
"skills/changed",
"skills/config/write",
"skills/extraRoots/set",
"thread/approveGuardianDeniedAction",
"thread/archive",
"thread/archived",
"thread/closed",
"thread/compact/start",
"thread/fork",
"thread/inject_items",
"thread/metadata/update",
"thread/name/set",
"thread/name/updated",
"thread/rollback",
"thread/shellCommand",
"thread/start",
"thread/started",
"thread/unarchive",
"thread/unarchived",
"thread/unsubscribe",
"turn/interrupt",
"turn/start",

View File

@@ -271,6 +271,28 @@ test("device detail exposes Codex App Server discovered model and extension summ
userInitiatedOnly: true,
labels: ["Guardian 放行", "权限请求"],
},
runtimeEventSummary: {
eventCount: 3,
processEventCount: 2,
rawResponseEventAvailable: true,
notificationOnly: true,
labels: ["进程输出", "进程退出", "原始响应完成"],
},
extensionEventSummary: {
eventCount: 2,
skillChangeEventAvailable: true,
pluginInstallEventAvailable: true,
notificationOnly: true,
labels: ["Skill 变更", "插件安装"],
},
threadLifecycleEventSummary: {
eventCount: 5,
archiveEventCount: 2,
nameEventAvailable: true,
closeEventAvailable: true,
notificationOnly: true,
labels: ["线程启动", "线程关闭", "已归档", "已恢复", "改名完成"],
},
},
},
};
@@ -304,6 +326,9 @@ test("device detail exposes Codex App Server discovered model and extension summ
assert.equal(cards.capabilities.items.codexMcpGovernance, "MCP 治理5 项 · OAuth 2 项 · 工具 1 项 · 交互可用");
assert.equal(cards.capabilities.items.codexUserInteractionGovernance, "用户交互1 项 · 输入请求可用");
assert.equal(cards.capabilities.items.codexGuardianGovernance, "Guardian 治理2 项 · 审批 1 项 · 权限事件可用");
assert.equal(cards.capabilities.items.codexRuntimeEvents, "运行事件3 项 · 进程 2 项 · 原始响应可用");
assert.equal(cards.capabilities.items.codexExtensionEvents, "扩展事件2 项 · Skill 变更可用 · 插件安装可用");
assert.equal(cards.capabilities.items.codexThreadLifecycleEvents, "线程生命周期5 项 · 归档 2 项 · 改名可用 · 关闭可用");
});
test("device detail exposes folder and project conflict skeleton from workspace policy", async () => {

View File

@@ -231,6 +231,28 @@ test("codex app-server discovery includes governance and MCP summaries without l
userInitiatedOnly: true,
labels: ["Guardian 放行", "权限请求"],
});
assert.deepEqual(metadata.runtimeEventSummary, {
eventCount: 3,
processEventCount: 2,
rawResponseEventAvailable: true,
notificationOnly: true,
labels: ["进程输出", "进程退出", "原始响应完成"],
});
assert.deepEqual(metadata.extensionEventSummary, {
eventCount: 2,
skillChangeEventAvailable: true,
pluginInstallEventAvailable: true,
notificationOnly: true,
labels: ["Skill 变更", "插件安装"],
});
assert.deepEqual(metadata.threadLifecycleEventSummary, {
eventCount: 5,
archiveEventCount: 2,
nameEventAvailable: true,
closeEventAvailable: true,
notificationOnly: true,
labels: ["线程启动", "线程关闭", "已归档", "已恢复", "改名完成"],
});
const serialized = JSON.stringify(metadata);
assert.equal(serialized.includes("sk-secret-should-not-leak"), false);