Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions gateway/runtime/http/static-assets.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const CODEX_REMOTE_FILE_ACTIONS_PATH = "/codex-remote-file-actions.js";
const CODEX_WORKSPACE_ROOT_PICKER_CSS_PATH = "/codex-workspace-root-picker.css";
const CODEX_WORKSPACE_ROOT_PICKER_PATH = "/codex-workspace-root-picker.js";
const CODEX_TOOLTIP_DISMISS_GUARD_PATH = "/codex-tooltip-dismiss-guard.js";
const CODEX_STATSIG_TELEMETRY_GUARD_PATH = "/codex-statsig-telemetry-guard.js";
const FAVICON_PATH = "/favicon.ico";
const PWA_MANIFEST_PATH = "/manifest.webmanifest";
const OFFICIAL_LOADING_SHIMMER_POWER_GUARD = [
Expand Down Expand Up @@ -119,6 +120,7 @@ const BROWSER_PROVIDER_KEY_BY_FILE = new Map([
[path.join(INTERNAL_PROVIDER_DIR, "codex-remote-file-actions.js"), "remote-file-actions"],
[path.join(INTERNAL_PROVIDER_DIR, "codex-workspace-root-picker.js"), "workspace-root-picker"],
[path.join(INTERNAL_PROVIDER_DIR, "codex-tooltip-dismiss-guard.js"), "tooltip-dismiss"],
[path.join(INTERNAL_PROVIDER_DIR, "codex-statsig-telemetry-guard.js"), "statsig-telemetry-guard"],
]);
const OFFICIAL_OPEN_IN_FOLDER_MESSAGE_ID = "artifactTab.preview.openInFolder";
const OPENCODEX_DOWNLOAD_FILE_MESSAGE_ID = "web.remoteFile.downloadFile";
Expand Down Expand Up @@ -289,6 +291,8 @@ const WEB_SHELL_STATIC_FILES = new Map([
OPENCODEX_OFFSCREEN_ANIMATION_GUARD_PATH,
path.join(INTERNAL_PROVIDER_DIR, "codex-offscreen-animation-guard.js"),
],
// Statsig XHR/Beacon 遥测拦截由独立 Provider 承载,上游 bridge polyfill 保持零改动。
[CODEX_STATSIG_TELEMETRY_GUARD_PATH, path.join(INTERNAL_PROVIDER_DIR, "codex-statsig-telemetry-guard.js")],
[CODEX_APP_HOST_MESSAGE_CODEC_PATH, path.join(WEB_SHELL_DIR, "codex-app-host-message-codec.js")],
[CODEX_BRIDGE_POLYFILL_PATH, path.join(INTERNAL_PROVIDER_DIR, "codex-bridge-polyfill.js")],
[CODEX_REMOTE_FILE_ACTIONS_PATH, path.join(INTERNAL_PROVIDER_DIR, "codex-remote-file-actions.js")],
Expand Down Expand Up @@ -703,6 +707,8 @@ function createStaticAssetService({
CODEX_REMOTE_FILE_ACTIONS_PATH,
CODEX_WORKSPACE_ROOT_PICKER_PATH,
CODEX_TOOLTIP_DISMISS_GUARD_PATH,
// 遥测拦截须在 Kernel 激活前装上,保证官方 SDK 初始化时 XHR 原型已被接管。
CODEX_STATSIG_TELEMETRY_GUARD_PATH,
OPENCODEX_MODIFICATION_ACTIVATE_PATH,
].map((reqPath) => WEB_SHELL_STATIC_FILES.get(reqPath)),
};
Expand Down Expand Up @@ -991,6 +997,9 @@ function createStaticAssetService({
runtimeScript(CODEX_REMOTE_FILE_ACTIONS_PATH),
runtimeScript(CODEX_WORKSPACE_ROOT_PICKER_PATH),
runtimeScript(CODEX_TOOLTIP_DISMISS_GUARD_PATH),
// 聚合启动路径之外的逐文件回退加载同样要带上遥测拦截,否则官方 bundle 含 eager script
// 或存在外部插件时该 Provider 根本不加载,修改点会在 locate 阶段被判 unsupported。
runtimeScript(CODEX_STATSIG_TELEMETRY_GUARD_PATH),
runtimeScript(OPENCODEX_MODIFICATION_ACTIVATE_PATH),
];
// manifest 在 Cloudflare Access 等前置认证后面也必须带同源凭据,否则 Chrome 可能拿不到受保护的 manifest。
Expand Down
2 changes: 2 additions & 0 deletions gateway/src/modification/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ export const POINT_DEFINITIONS = Object.freeze([
point("web.runtime.bridge.feature-gates", "注入 Web 环境所需桌面能力开关", "web-shell", G.rendererCore, A.desktopBridge),
point("web.runtime.network.statsig", "本地响应 Statsig 初始化请求", "web-shell", G.webNetwork, A.networkRequest),
point("web.runtime.network.telemetry", "阻止隐藏 Web 环境发送无效遥测", "web-shell", G.webNetwork, A.networkRequest),
// XHR/Beacon 与 fetch 是两条独立上报通道,单独成点才能分别观察是否真被本地吞掉。
point("web.runtime.network.telemetry-guard", "本地吞掉 Statsig XHR 与 Beacon 遥测", "web-shell", G.webNetwork, A.networkRequest),
point("web.runtime.protocol.connector-logo", "合并 connector logo IPC 请求", "web-shell", G.webNetwork, A.semanticProtocol),
point("web.runtime.dom.webview-shim", "使用 iframe 模拟 Electron webview", "web-shell", G.rendererUi, A.semanticView),
point("web.runtime.native.file-picker", "把 Electron 文件选择转换为浏览器文件选择", "web-shell", G.browserPlatform, A.browserNative),
Expand Down
4 changes: 2 additions & 2 deletions gateway/test/compatibility-registry.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function sourceFiles(directory) {
}

test("compatibility catalog declares groups and adapter chains for every stable point", () => {
assert.equal(POINT_DEFINITIONS.length, 103);
assert.equal(POINT_DEFINITIONS.length, 104);
assert.equal(POINT_GROUP_DEFINITIONS.length, 17);
assert.equal(ADAPTER_DEFINITIONS.length, 23);
assert.equal(new Set(POINT_DEFINITIONS.map((point) => point.id)).size, POINT_DEFINITIONS.length);
Expand All @@ -97,7 +97,7 @@ test("compatibility catalog declares groups and adapter chains for every stable
const registry = registerCompatibilityCatalog(createCompatibilityRegistry());
const snapshot = registry.snapshot();
assert.equal(snapshot.schemaVersion, 2);
assert.equal(snapshot.points.length, 103);
assert.equal(snapshot.points.length, 104);
assert.equal(snapshot.groups.length, 17);
assert.equal(snapshot.adapterTypes.length, 23);
assert.equal(snapshot.status, "pending");
Expand Down
6 changes: 3 additions & 3 deletions gateway/test/compatibility-service.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ test("public compatibility API exposes only the read-only sanitized snapshot", (
service,
), true);
assert.equal(getResponse.status, 200);
assert.equal(JSON.parse(getResponse.body).compatibility.points.length, 103);
assert.equal(JSON.parse(getResponse.body).compatibility.points.length, 104);

const reportResponse = responseRecorder();
assert.equal(handlePublicRuntimeCompatibilityApi(
Expand Down Expand Up @@ -399,7 +399,7 @@ test("authenticated API accepts only validated Browser Kernel reports", async ()
service,
), true);
assert.equal(getResponse.status, 200);
assert.equal(JSON.parse(getResponse.body).compatibility.points.length, 103);
assert.equal(JSON.parse(getResponse.body).compatibility.points.length, 104);

const point = browserKernelPoint("web.runtime.bridge.desktop-api", { active: true });
const reportResponse = responseRecorder();
Expand Down Expand Up @@ -470,7 +470,7 @@ test("authenticated Browser reports merge external Plugin SDK points into diagno

assert.equal(response.status, 200);
const snapshot = service.snapshot();
assert.equal(snapshot.points.length, 104);
assert.equal(snapshot.points.length, 105);
assert.deepEqual(
snapshot.points.find((point) => point.id === fixture.point.id).plugin,
fixture.catalog.plugin,
Expand Down
4 changes: 2 additions & 2 deletions gateway/test/modification-equivalence.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function bindPoint(point, operation, snapshots) {
return coordinator.bind(point, operation);
}

test("all 103 modification points preserve synchronous call contracts through the production Kernel", () => {
test("all 104 modification points preserve synchronous call contracts through the production Kernel", () => {
const calls = new Map();
const wrappers = new Map();
const snapshots = new Map();
Expand All @@ -41,7 +41,7 @@ test("all 103 modification points preserve synchronous call contracts through th
}
});

test("all 103 modification points preserve Promise identity and thrown errors in production Kernel", async () => {
test("all 104 modification points preserve Promise identity and thrown errors in production Kernel", async () => {
const contracts = new Map();
const snapshots = new Map();
for (const [index, point] of POINT_DEFINITIONS.entries()) {
Expand Down
16 changes: 8 additions & 8 deletions gateway/test/modification-kernel.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ const {
test("typed modification catalog assigns every point to a group and adapter chain", () => {
assert.equal(POINT_GROUP_DEFINITIONS.length, 17);
assert.equal(ADAPTER_DEFINITIONS.length, 23);
assert.equal(POINT_DEFINITIONS.length, 103);
assert.equal(POINT_TARGETS.length, 103);
assert.equal(MIGRATION_MATRIX.length, 103);
assert.equal(POINT_DEFINITIONS.length, 104);
assert.equal(POINT_TARGETS.length, 104);
assert.equal(MIGRATION_MATRIX.length, 104);
assert.equal(MIGRATION_MATRIX.every((entry) => entry.migrationStatus === "migrated"), true);
assert.deepEqual(
["browser", "gateway", "static", "runner"].map(
(host) => MIGRATION_MATRIX.filter((entry) => entry.host === host).length
),
[37, 36, 25, 5]
[38, 36, 25, 5]
);
assert.equal(new Set(POINT_TARGETS).size, 103);
assert.equal(new Set(POINT_DEFINITIONS.map((point) => point.id)).size, 103);
assert.equal(new Set(POINT_TARGETS).size, 104);
assert.equal(new Set(POINT_DEFINITIONS.map((point) => point.id)).size, 104);
assert.deepEqual(
["web.runtime.", "gateway.runtime.", "static.cache."].map(
(prefix) => POINT_DEFINITIONS.filter((point) => point.id.startsWith(prefix)).length
),
[37, 36, 30]
[38, 36, 30]
);
assert.equal(POINT_DEFINITIONS.every((point) => point.group && point.contributions.length > 0), true);
assert.equal(POINT_DEFINITIONS.every((point) => point.contributions.every((item) => {
Expand Down Expand Up @@ -67,7 +67,7 @@ test("typed modification catalog assigns every point to a group and adapter chai
"mobile-interaction": 5,
"renderer-ui": 6,
"browser-platform": 3,
"web-network": 3,
"web-network": 4,
"gateway-runtime": 9,
"gateway-ipc": 4,
"official-main": 3,
Expand Down
2 changes: 1 addition & 1 deletion gateway/test/official-desktop-compat.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test("gateway compatibility service initializes from configured runtime paths",
});
try {
const snapshot = compatibilityService.snapshot();
assert.equal(snapshot.points.length, 103);
assert.equal(snapshot.points.length, 104);
assert.equal(snapshot.groups.length, 17);
assert.equal(snapshot.adapterTypes.length, 23);
assert.equal(Object.hasOwn(snapshot, "features"), false);
Expand Down
Loading