L4-TOOL-DB接入数控系统仿真证据
结论:L4-TOOL-DB 已接入浏览器/WASM/OPFS 仿真证明链,并纳入 release/host gate;axis/db_demo/base.ngc 仍保持 L4-TOOL-DB locked,promotion_allowed=0,sim-config baseline 保持 28/28/131/0。
This commit is contained in:
@@ -19,12 +19,42 @@ function getRuntimeProvider() {
|
||||
return self.linuxCncToolDbPythonRuntimeProvider ?? null;
|
||||
}
|
||||
|
||||
async function loadRuntimeProvider(moduleUrl) {
|
||||
if (!moduleUrl) {
|
||||
return {
|
||||
status: "blocked_browser_python_wasm_runtime_missing",
|
||||
provider: getRuntimeProvider(),
|
||||
};
|
||||
}
|
||||
try {
|
||||
await import(moduleUrl);
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "blocked_browser_python_wasm_runtime_load_failed",
|
||||
error,
|
||||
provider: getRuntimeProvider(),
|
||||
};
|
||||
}
|
||||
const provider = getRuntimeProvider();
|
||||
if (!provider) {
|
||||
return {
|
||||
status: "blocked_browser_python_wasm_provider_missing",
|
||||
provider,
|
||||
};
|
||||
}
|
||||
return {
|
||||
status: "browser_python_wasm_runtime_ready",
|
||||
provider,
|
||||
};
|
||||
}
|
||||
|
||||
self.addEventListener("message", async (event) => {
|
||||
const message = event.data ?? {};
|
||||
const { id, type, line } = message;
|
||||
try {
|
||||
if (type === "start") {
|
||||
const provider = getRuntimeProvider();
|
||||
const runtimeLoad = await loadRuntimeProvider(message.pythonRuntimeModuleUrl);
|
||||
const provider = runtimeLoad.provider;
|
||||
const providerReady = Boolean(provider?.start && provider?.writeLine && provider?.readLine);
|
||||
const ready = providerReady || pythonRuntimeAvailable();
|
||||
if (providerReady) {
|
||||
@@ -33,9 +63,8 @@ self.addEventListener("message", async (event) => {
|
||||
postReply(id, type, {
|
||||
runtimeMode: "browser-python-wasm-worker",
|
||||
runtimeExecutionReady: ready,
|
||||
status: ready
|
||||
? "browser_python_wasm_runtime_ready"
|
||||
: "blocked_browser_python_wasm_runtime_missing",
|
||||
status: ready ? "browser_python_wasm_runtime_ready" : runtimeLoad.status,
|
||||
error: runtimeLoad.error?.message ?? null,
|
||||
executionEnabled: false,
|
||||
promotionAllowed: false,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user