Skip to content

Commit 81e7b65

Browse files
committed
sync(bfmono): fix(gambit-core): support non-file import.meta.url at runtime init (+19 more) (bfmono@175e49006)
This PR is an automated gambitmono sync of bfmono Gambit packages. - Source: `packages/gambit/` - Core: `packages/gambit/packages/gambit-core/` - bfmono rev: 175e49006 Changes: - 175e49006 fix(gambit-core): support non-file import.meta.url at runtime init - 3c44ef51a fix(gambit): include core snippets/decks/workers in compile assets - 591734506 fix(gambit): exclude .codex from Build file listing - 4fe56b200 chore(gambit): cut 0.8.5-rc.12 - 2bfffaaae fix(gambit): add codex trust preflight for workbench chat - 9c16505d6 chore(gambit): cut 0.8.5-rc.11 - b4d5cdaef fix(simulator-ui): prevent feedback reason text from being clobbered - 84952a652 fix(gambit-verify): align verify turn labels and stabilize initial run filtering - c56b7f52f feat(gambit): improve verify report controls and harden concurrent calibrate persistence - beb9435c0 feat(gambit-simulator-ui): extend listbox trigger and popover options - 25f9fdcfc fix(gambit-simulator-ui): align verify outlier chip semantics and display - a010b0ee1 feat(gambit-simulator-ui): add verify outliers to workbench chat chips - 383f2500a refactor(simulator-ui): replace nested ternaries in main routing - 13c4c8c22 fix(gambit): preserve shared references in safe session serialization - ae392aa24 feat(gambit-simulator-ui): add grader error chips to workbench chat - 1de6b335c fix(gambit): clamp deck-level maxTurns bounds in test run selection - 01d7abbb9 fix(gambit): default verify tab bootstrap flag to enabled - f3d186c7b fix(gambit): include extension schemas in exports and default serve to restored workspace - a83b7cbe7 fix(gambit): move unbounded build timeout to deck opt-in - acb2de627 fix(gambit): avoid strict json_schema 400s in openrouter responses Do not edit this repo directly; make changes in bfmono and re-run the sync.
1 parent ea06c11 commit 81e7b65

2 files changed

Lines changed: 38 additions & 12 deletions

File tree

packages/gambit-core/src/runtime.ts

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3022,21 +3022,30 @@ function collectLocalImportGraph(entryPath: string): Set<string> {
30223022
return visited;
30233023
}
30243024

3025-
const WORKER_ENTRY_PATHS = [
3026-
"./runtime_worker.ts",
3027-
"./runtime_orchestration_worker.ts",
3028-
].map((relative) => path.fromFileUrl(new URL(relative, import.meta.url)));
3029-
const BUILTIN_SCHEMAS_DIR = path.resolve(
3030-
path.dirname(path.fromFileUrl(import.meta.url)),
3031-
"../schemas",
3032-
);
3033-
const BUILTIN_SNIPPETS_DIR = path.resolve(
3034-
path.dirname(path.fromFileUrl(import.meta.url)),
3035-
"../snippets",
3036-
);
3025+
const moduleBaseFilePath = (() => {
3026+
try {
3027+
return path.fromFileUrl(import.meta.url);
3028+
} catch {
3029+
return undefined;
3030+
}
3031+
})();
3032+
3033+
const WORKER_ENTRY_PATHS = moduleBaseFilePath
3034+
? [
3035+
"./runtime_worker.ts",
3036+
"./runtime_orchestration_worker.ts",
3037+
].map((relative) => path.fromFileUrl(new URL(relative, import.meta.url)))
3038+
: [];
3039+
const BUILTIN_SCHEMAS_DIR = moduleBaseFilePath
3040+
? path.resolve(path.dirname(moduleBaseFilePath), "../schemas")
3041+
: undefined;
3042+
const BUILTIN_SNIPPETS_DIR = moduleBaseFilePath
3043+
? path.resolve(path.dirname(moduleBaseFilePath), "../snippets")
3044+
: undefined;
30373045

30383046
let builtinSchemaBootstrapCache: Array<string> | undefined;
30393047
function builtinSchemaBootstrapReads(): Array<string> {
3048+
if (!BUILTIN_SCHEMAS_DIR) return [];
30403049
if (builtinSchemaBootstrapCache) return builtinSchemaBootstrapCache;
30413050
const schemaModules: Array<string> = [];
30423051
const stack: Array<string> = [BUILTIN_SCHEMAS_DIR];
@@ -3072,6 +3081,7 @@ function builtinSchemaBootstrapReads(): Array<string> {
30723081

30733082
let builtinSnippetBootstrapCache: Array<string> | undefined;
30743083
function builtinSnippetBootstrapReads(): Array<string> {
3084+
if (!BUILTIN_SNIPPETS_DIR) return [];
30753085
if (builtinSnippetBootstrapCache) return builtinSnippetBootstrapCache;
30763086
const snippetFiles: Array<string> = [];
30773087
const stack: Array<string> = [BUILTIN_SNIPPETS_DIR];
@@ -3115,6 +3125,10 @@ function workerBootstrapReadAllowlist(deckPath: string): Array<string> {
31153125
let trustedWorkerBootstrapCache: Array<string> | undefined;
31163126
function trustedWorkerBootstrapReads(): Array<string> {
31173127
if (trustedWorkerBootstrapCache) return trustedWorkerBootstrapCache;
3128+
if (!moduleBaseFilePath) {
3129+
trustedWorkerBootstrapCache = [];
3130+
return trustedWorkerBootstrapCache;
3131+
}
31183132
const definitionsPath = path.fromFileUrl(
31193133
new URL("./definitions.ts", import.meta.url),
31203134
);

scripts/compile.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ const resolveCoreDir = async (): Promise<string> => {
3232
const coreDir = await resolveCoreDir();
3333
const coreRel = normalizePath(path.relative(packageRoot, coreDir));
3434
const coreCards = normalizePath(path.join(coreRel, "cards"));
35+
const coreSnippets = normalizePath(path.join(coreRel, "snippets"));
3536
const coreSchemas = normalizePath(path.join(coreRel, "schemas"));
37+
const coreDecks = normalizePath(path.join(coreRel, "decks"));
38+
const coreRuntimeWorker = normalizePath(
39+
path.join(coreRel, "src", "runtime_worker.ts"),
40+
);
41+
const coreRuntimeOrchestrationWorker = normalizePath(
42+
path.join(coreRel, "src", "runtime_orchestration_worker.ts"),
43+
);
3644

3745
const docIncludeCandidates = [
3846
"docs/cli/commands",
@@ -54,7 +62,11 @@ const includePaths = [
5462
"deno.jsonc",
5563
...docIncludes,
5664
coreCards,
65+
coreSnippets,
5766
coreSchemas,
67+
coreDecks,
68+
coreRuntimeWorker,
69+
coreRuntimeOrchestrationWorker,
5870
"src/decks",
5971
"scaffolds",
6072
"simulator-ui/dist",

0 commit comments

Comments
 (0)