源码快照 @ 2026-09-02 (source-only, 剔除非源码素材)
This commit is contained in:
commit
04bac1f6e2
2200 files changed
+489415
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import { localHost, resolveInstalledProductionDesktopState } from "../evals/packages/hosts/src/index.ts";
|
||||
import type { InstalledProductionDesktopState } from "../evals/packages/hosts/src/index.ts";
|
||||
import { liveSharedProductionApp } from "../evals/packages/env/src/desktop-app.ts";
|
||||
import type { App } from "../evals/packages/env/src/desktop-app.ts";
|
||||
import { hold } from "../packages/world/src/hold.ts";
|
||||
|
||||
export interface DesktopProductionLiveOptions {
|
||||
allowSharedState: true;
|
||||
resolveInstalledProductionState?: () => Promise<InstalledProductionDesktopState>;
|
||||
}
|
||||
|
||||
/** Launch source Electron against installed production state after explicit consent. */
|
||||
export async function desktopProductionLive(options: DesktopProductionLiveOptions): Promise<App> {
|
||||
if (options?.allowSharedState !== true) {
|
||||
throw new Error("Refusing LIVE SHARED PRODUCTION STATE launch without explicit allowSharedState: true consent.");
|
||||
}
|
||||
const state = await (
|
||||
options.resolveInstalledProductionState ?? resolveInstalledProductionDesktopState
|
||||
)();
|
||||
return liveSharedProductionApp({
|
||||
host: localHost(),
|
||||
name: "world-desktop-production-live",
|
||||
state,
|
||||
});
|
||||
}
|
||||
|
||||
function parseArgs(argv: readonly string[]): DesktopProductionLiveOptions {
|
||||
if (argv.length !== 1 || argv[0] !== "--allow-shared-state") {
|
||||
throw new Error("Launch desktop-prod-live with exactly --allow-shared-state.");
|
||||
}
|
||||
return { allowSharedState: true };
|
||||
}
|
||||
|
||||
export async function main(argv: readonly string[] = process.argv.slice(2)): Promise<void> {
|
||||
await using desktop = await desktopProductionLive(parseArgs(argv));
|
||||
await hold({ outputs: { cdp: desktop.handle.cdpUrl } });
|
||||
}
|
||||
|
||||
if (import.meta.main) {
|
||||
await main();
|
||||
}
|
||||
Reference in new issue
Block a user