Skip to content

Commit 99bc815

Browse files
committed
sync(bfmono): test(gambit-core): make markdown execute-module test cwd-independent (+19 more) (bfmono@0520f200e)
This PR is an automated gambitmono sync of bfmono Gambit packages. - Source: `packages/gambit/` - Core: `packages/gambit-core/` - bfmono rev: 0520f200e Changes: - 0520f200e test(gambit-core): make markdown execute-module test cwd-independent - 2787fa905 fix(gambit-core): allow builtin snippet embeds in worker sandbox bootstrap - bcc5481e1 fix(gambit): hide .gambit files from simulator build dropdown - 4be03cc0a refactor(simulator-ui): remove recent changes control from Build tab - 89b072a23 fix(simulator-ui): default ratings and flags pane to closed - abc40ef2f fix(gambit): simplify serve defaults and allow plain markdown decks - 142727dda fix(gambit): fail fast on legacy providers.fallback codex value - 9616fbc81 test(gambit): add opt-in live compiled-cli codex integration test - 17bfe24f4 test(gambit): add opt-in live codex CLI integration test - 32ae5bb40 feat(gambit-core): pass through modelParams.verbosity to providers - e619e071d test(gambit): add codex-cli routing and smoke coverage - 564c68256 feat(gambit): cut over Codex provider namespace to codex-cli - 1cfcc1c70 fix(gambit): restore deck-derived MCP tools and codex trace wiring - ec34271da fix(gambit): remove codex debug logs and tidy runtime imports - c751df678 fix(simulator-ui): stabilize build chat ordering and dedupe streamed assistant rows - fadb06e44 fix(gambit): make codex resume turns incremental - 38b54a9b7 feat(gambit-runtime): enrich trace diagnostics and reasoning capture - c847ed42f feat(gambit-simulator): preserve run-addressed URLs across Test/Grade navigation - 07f123e8f feat(gambit): adopt run-addressed workspace routes for test and grade - 749970879 feat(gambit): map codex file_change events into tool traces Do not edit this repo directly; make changes in bfmono and re-run the sync.
1 parent 5356ee6 commit 99bc815

File tree

101 files changed

+20154
-3736
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+20154
-3736
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,23 @@ Tracing and state: 
124124
`--verbose` to print events\
125125
`--state <file>` to persist a session.
126126

127+
### Worker sandbox defaults
128+
129+
- Deck-executing CLI surfaces default to worker sandbox execution.
130+
- Use `--no-worker-sandbox` (or `--legacy-exec`) to force legacy in-process
131+
execution.
132+
- `--worker-sandbox` explicitly forces worker execution on.
133+
- `--sandbox` / `--no-sandbox` are deprecated aliases.
134+
- `gambit.toml` equivalent:
135+
```toml
136+
[execution]
137+
worker_sandbox = false # same as --no-worker-sandbox
138+
# legacy_exec = true # equivalent rollback toggle
139+
```
140+
141+
The npm launcher (`npx @bolt-foundry/gambit ...`) runs the Gambit CLI binary for
142+
your platform, so these defaults and flags apply there as well.
143+
127144
## Using the Simulator
128145

129146
The simulator is the local Debug UI that streams runs and renders traces.

deno.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"bundle:sim:sourcemap": "deno run -A scripts/bundle_simulator_ui.ts --sourcemap=external",
2626
"bundle:sim:web": "deno run -A scripts/bundle_simulator_ui.ts --platform=browser",
2727
"bundle:sim:web:sourcemap": "deno run -A scripts/bundle_simulator_ui.ts --platform=browser --sourcemap=external",
28-
"serve:bot": "mkdir -p /tmp/gambit-bot-root && GAMBIT_BOT_ROOT=/tmp/gambit-bot-root deno run -A src/cli.ts serve src/decks/gambit-bot/PROMPT.md --bundle --port 8000",
28+
"serve:bot": "mkdir -p /tmp/gambit-bot-root && GAMBIT_SIMULATOR_BUILD_BOT_ROOT=/tmp/gambit-bot-root GAMBIT_BOT_ROOT=/tmp/gambit-bot-root deno run -A src/cli.ts serve src/decks/gambit-bot/PROMPT.md --bundle --port 8000",
2929
"serve:bot:sandbox": "deno run -A scripts/serve_bot_sandbox.ts",
3030
"build_npm": "deno run -A scripts/build_npm.ts"
3131
},

docs/external/reference/cli.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ How to run Gambit, the agent harness framework, locally and observe runs.
1111
- Command help: `deno run -A src/cli.ts help <command>` (or
1212
`deno run -A src/cli.ts <command> -h`).
1313
- Run once:
14-
`deno run -A src/cli.ts run <deck> [--context <json|string>] [--message <json|string>] [--model <id>] [--model-force <id>] [--trace <file>] [--state <file>] [--stream] [--responses] [--verbose]`
14+
`deno run -A src/cli.ts run <deck> [--context <json|string>] [--message <json|string>] [--model <id>] [--model-force <id>] [--trace <file>] [--state <file>] [--stream] [--responses] [--verbose] [--worker-sandbox|--no-worker-sandbox|--legacy-exec]`
1515
- Check models: `deno run -A src/cli.ts check <deck>`
1616
- REPL: `deno run -A src/cli.ts repl <deck>` (defaults to
1717
`src/decks/gambit-assistant.deck.md` in a local checkout). Streams by default
1818
and keeps state in memory for the session.
1919
- Test bot (CLI):
20-
`deno run -A src/cli.ts test-bot <root-deck> --test-deck <persona-deck> [--context <json|string>] [--bot-input <json|string>] [--message <json|string>] [--max-turns <n>] [--state <file>] [--grade <grader-deck> ...] [--trace <file>] [--responses] [--verbose]`
20+
`deno run -A src/cli.ts test-bot <root-deck> --test-deck <persona-deck> [--context <json|string>] [--bot-input <json|string>] [--message <json|string>] [--max-turns <n>] [--state <file>] [--grade <grader-deck> ...] [--trace <file>] [--responses] [--verbose] [--worker-sandbox|--no-worker-sandbox|--legacy-exec]`
2121
- Grade (CLI):
22-
`deno run -A src/cli.ts grade <grader-deck> --state <file> [--model <id>] [--model-force <id>] [--trace <file>] [--responses] [--verbose]`
22+
`deno run -A src/cli.ts grade <grader-deck> --state <file> [--model <id>] [--model-force <id>] [--trace <file>] [--responses] [--verbose] [--worker-sandbox|--no-worker-sandbox|--legacy-exec]`
2323
- Export bundle (CLI):
2424
`deno run -A src/cli.ts export [<deck>] --state <file> --out <bundle.tar.gz>`
2525
- Debug UI: `deno run -A src/cli.ts serve <deck> --port 8000` then open
@@ -46,6 +46,15 @@ How to run Gambit, the agent harness framework, locally and observe runs.
4646
- `GAMBIT_RESPONSES_MODE=1`: env alternative to `--responses` for runtime/state.
4747
- `GAMBIT_OPENROUTER_RESPONSES=1`: route OpenRouter calls through the Responses
4848
API (experimental; chat remains the default path).
49+
- Worker execution defaults on for deck-executing surfaces. Use
50+
`--no-worker-sandbox` (or `--legacy-exec`) to roll back to legacy in-process
51+
execution. `--sandbox/--no-sandbox` still work as deprecated aliases.
52+
- `gambit.toml` config equivalent:
53+
```toml
54+
[execution]
55+
worker_sandbox = false # same as --no-worker-sandbox
56+
# legacy_exec = true # equivalent rollback toggle
57+
```
4958

5059
## State and tracing
5160

docs/external/reference/cli/commands/bot.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
+++
22
command = "bot"
33
summary = "Run the Gambit bot assistant"
4-
usage = "gambit bot [<dir>] [--bot-root <dir>] [--model <id>] [--model-force <id>] [--responses] [--verbose]"
4+
usage = "gambit bot [<dir>] [--bot-root <dir>] [--model <id>] [--model-force <id>] [--responses] [--verbose] [--worker-sandbox|--no-worker-sandbox|--legacy-exec]"
55
flags = [
66
"--bot-root <dir> Allowed folder for bot file writes (defaults to workspace.decks if set; overrides <dir>)",
77
"--model <id> Default model id",
88
"--model-force <id> Override model id",
99
"--responses Run runtime/state in Responses mode",
10+
"--worker-sandbox Force worker execution on",
11+
"--no-worker-sandbox Force worker execution off",
12+
"--legacy-exec Alias for --no-worker-sandbox",
13+
"--sandbox Deprecated alias for --worker-sandbox",
14+
"--no-sandbox Deprecated alias for --no-worker-sandbox",
1015
"--verbose Print trace events to console",
1116
]
1217
+++

docs/external/reference/cli/commands/grade.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
+++
22
command = "grade"
33
summary = "Grade a saved state file"
4-
usage = "gambit grade <grader-deck.(ts|md)> --state <file> [--model <id>] [--model-force <id>] [--trace <file>] [--responses] [--verbose]"
4+
usage = "gambit grade <grader-deck.(ts|md)> --state <file> [--model <id>] [--model-force <id>] [--trace <file>] [--responses] [--verbose] [--worker-sandbox|--no-worker-sandbox|--legacy-exec]"
55
flags = [
66
"--grader <path> Grader deck path (overrides positional)",
77
"--state <file> Load/persist state",
88
"--model <id> Default model id",
99
"--model-force <id> Override model id",
1010
"--trace <file> Write trace events to file (JSONL)",
1111
"--responses Run runtime/state in Responses mode",
12+
"--worker-sandbox Force worker execution on",
13+
"--no-worker-sandbox Force worker execution off",
14+
"--legacy-exec Alias for --no-worker-sandbox",
15+
"--sandbox Deprecated alias for --worker-sandbox",
16+
"--no-sandbox Deprecated alias for --no-worker-sandbox",
1217
"--verbose Print trace events to console",
1318
]
1419
+++

docs/external/reference/cli/commands/repl.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
+++
22
command = "repl"
33
summary = "Start an interactive REPL"
4-
usage = "gambit repl <deck.(ts|md)> [--context <json|string>] [--message <json|string>] [--model <id>] [--model-force <id>] [--responses] [--verbose]"
4+
usage = "gambit repl <deck.(ts|md)> [--context <json|string>] [--message <json|string>] [--model <id>] [--model-force <id>] [--responses] [--verbose] [-A|--allow-all|--allow-<kind>] [--worker-sandbox|--no-worker-sandbox|--legacy-exec]"
55
flags = [
66
"--context <json|string> Context payload (seeds gambit_context; legacy --init still works)",
77
"--message <json|string> Initial user message (sent before assistant speaks)",
88
"--model <id> Default model id",
99
"--model-force <id> Override model id",
1010
"--responses Run runtime/state in Responses mode",
1111
"--verbose Print trace events to console",
12+
"-A, --allow-all Allow all session permissions (read/write/run/net/env)",
13+
"--allow-read[=<paths>] Session read override (all when value omitted)",
14+
"--allow-write[=<paths>] Session write override (all when value omitted)",
15+
"--allow-run[=<entries>] Session run override (all when value omitted)",
16+
"--allow-net[=<hosts>] Session net override (all when value omitted)",
17+
"--allow-env[=<names>] Session env override (all when value omitted)",
18+
"--worker-sandbox Force worker execution on",
19+
"--no-worker-sandbox Force worker execution off",
20+
"--legacy-exec Alias for --no-worker-sandbox",
21+
"--sandbox Deprecated alias for --worker-sandbox",
22+
"--no-sandbox Deprecated alias for --no-worker-sandbox",
1223
]
1324
+++
1425

docs/external/reference/cli/commands/run.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
+++
22
command = "run"
33
summary = "Run a deck once"
4-
usage = "gambit run [<deck.(ts|md)>] [--context <json|string>] [--message <json|string>] [--model <id>] [--model-force <id>] [--trace <file>] [--state <file>] [--stream] [--responses] [--verbose]"
4+
usage = "gambit run [<deck.(ts|md)>] [--context <json|string>] [--message <json|string>] [--model <id>] [--model-force <id>] [--trace <file>] [--state <file>] [--stream] [--responses] [--verbose] [-A|--allow-all|--allow-<kind>] [--worker-sandbox|--no-worker-sandbox|--legacy-exec]"
55
flags = [
66
"--context <json|string> Context payload (seeds gambit_context; legacy --init still works)",
77
"--message <json|string> Initial user message (sent before assistant speaks)",
@@ -12,6 +12,17 @@ flags = [
1212
"--stream Enable streaming responses",
1313
"--responses Run runtime/state in Responses mode",
1414
"--verbose Print trace events to console",
15+
"-A, --allow-all Allow all session permissions (read/write/run/net/env)",
16+
"--allow-read[=<paths>] Session read override (all when value omitted)",
17+
"--allow-write[=<paths>] Session write override (all when value omitted)",
18+
"--allow-run[=<entries>] Session run override (all when value omitted)",
19+
"--allow-net[=<hosts>] Session net override (all when value omitted)",
20+
"--allow-env[=<names>] Session env override (all when value omitted)",
21+
"--worker-sandbox Force worker execution on",
22+
"--no-worker-sandbox Force worker execution off",
23+
"--legacy-exec Alias for --no-worker-sandbox",
24+
"--sandbox Deprecated alias for --worker-sandbox",
25+
"--no-sandbox Deprecated alias for --no-worker-sandbox",
1526
]
1627
+++
1728

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
+++
22
command = "serve"
33
summary = "Run the debug UI server"
4-
usage = "gambit serve [<deck.(ts|md)>] [--model <id>] [--model-force <id>] [--port <n>] [--responses] [--verbose] [--watch] [--no-bundle] [--no-sourcemap]"
4+
usage = "gambit serve [<deck.(ts|md)>] [--model <id>] [--model-force <id>] [--port <n>] [--responses] [--verbose] [--watch] [--no-bundle] [--no-sourcemap] [--worker-sandbox|--no-worker-sandbox|--legacy-exec]"
55
flags = [
66
"--model <id> Default model id",
77
"--model-force <id> Override model id",
@@ -13,12 +13,16 @@ flags = [
1313
"--sourcemap Generate external source maps (serve; default in dev)",
1414
"--no-sourcemap Disable source map generation (serve)",
1515
"--platform <platform> Bundle target platform: deno (default) or web (browser)",
16+
"--worker-sandbox Force worker execution on",
17+
"--no-worker-sandbox Force worker execution off",
18+
"--legacy-exec Alias for --no-worker-sandbox",
19+
"--sandbox Deprecated alias for --worker-sandbox",
20+
"--no-sandbox Deprecated alias for --no-worker-sandbox",
1621
"--verbose Print trace events to console",
1722
]
1823
+++
1924

2025
Starts the debug UI server (default at `http://localhost:8000/`).
2126

22-
If no deck path is provided, Gambit creates a new workspace scaffold (root
23-
`PROMPT.md`, `INTENT.md`, plus default scenario/grader decks) and opens the
24-
simulator UI in workspace onboarding mode.
27+
If no deck path is provided, Gambit uses `./PROMPT.md`. If `./PROMPT.md` does
28+
not exist, Gambit creates a minimal `PROMPT.md` and serves it.

docs/external/reference/cli/commands/test-bot.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
+++
22
command = "test-bot"
33
summary = "Run a persona/test-bot loop"
4-
usage = "gambit test-bot <root-deck.(ts|md)> --test-deck <persona-deck.(ts|md)> [--context <json|string>] [--bot-input <json|string>] [--message <json|string>] [--max-turns <n>] [--state <file>] [--grade <grader-deck.(ts|md)> ...] [--trace <file>] [--responses] [--verbose]"
4+
usage = "gambit test-bot <root-deck.(ts|md)> --test-deck <persona-deck.(ts|md)> [--context <json|string>] [--bot-input <json|string>] [--message <json|string>] [--max-turns <n>] [--state <file>] [--grade <grader-deck.(ts|md)> ...] [--trace <file>] [--responses] [--verbose] [--worker-sandbox|--no-worker-sandbox|--legacy-exec]"
55
flags = [
66
"--test-deck <path> Persona/test deck path",
77
"--grade <path> Grader deck path (repeatable)",
@@ -14,6 +14,11 @@ flags = [
1414
"--model-force <id> Override model id",
1515
"--trace <file> Write trace events to file (JSONL)",
1616
"--responses Run runtime/state in Responses mode",
17+
"--worker-sandbox Force worker execution on",
18+
"--no-worker-sandbox Force worker execution off",
19+
"--legacy-exec Alias for --no-worker-sandbox",
20+
"--sandbox Deprecated alias for --worker-sandbox",
21+
"--no-sandbox Deprecated alias for --no-worker-sandbox",
1722
"--verbose Print trace events to console",
1823
]
1924
+++

packages/gambit-core/README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ export default defineCard({
112112
});
113113
```
114114

115+
For built-in Gambit schemas in TypeScript/compute decks, use canonical module
116+
subpaths:
117+
118+
```
119+
import contextSchema from "@bolt-foundry/gambit-core/schemas/scenarios/plain_chat_input_optional.zod.ts";
120+
import responseSchema from "@bolt-foundry/gambit-core/schemas/scenarios/plain_chat_output.zod.ts";
121+
```
122+
115123
## Running decks programmatically
116124

117125
The runtime loads the deck (Markdown or TS) and steps through each pass. Provide
@@ -145,14 +153,33 @@ When the deck defines `run`/`execute`, the runtime hands you an
145153
[`ExecutionContext`](src/types.ts) with:
146154

147155
- `ctx.input`: validated input (narrowable when you type the schema).
148-
- `ctx.spawnAndWait({ path, input })`: call another deck and await the result.
156+
- `ctx.initialUserMessage`: current turn user message when provided by caller.
157+
- `ctx.getSessionMeta(key)`: read persisted run/session metadata.
158+
- `ctx.setSessionMeta(key, value)`: persist metadata for later turns.
159+
- `ctx.appendMessage({ role, content })`: append chat transcript messages from
160+
execute decks.
161+
- `ctx.spawnAndWait({ path, input, initialUserMessage? })`: call another deck
162+
and await the result; user message is inherited by default unless overridden.
149163
- `ctx.return(payload)`: respond early without running guards again.
150164
- `ctx.fail({ message, code?, details? })`: aborts the run (throws).
151165
- `ctx.log(...)`: emit structured trace entries for observability.
152166

153167
Pass `guardrails`, `initialUserMessage`, `modelOverride`, and
154168
`allowRootStringInput` to `runDeck` when scripting custom runtimes.
155169

170+
### Worker sandbox behavior in `runDeck`
171+
172+
`gambit-core` keeps worker sandboxing opt-in:
173+
174+
- `runDeck` enables worker sandboxing only when `workerSandbox: true` is passed.
175+
- You can also opt in via `GAMBIT_DECK_WORKER_SANDBOX=1` (or `true` / `yes`).
176+
- If neither is set, `runDeck` executes without worker sandboxing by default.
177+
178+
Why this is opt-in: `@bolt-foundry/gambit-core` is intended to run in multiple
179+
hosts (Node, Bun, Deno). Worker sandboxing relies on Deno-specific worker
180+
permission controls, so host apps must opt in when they run in an environment
181+
that supports it.
182+
156183
## Loading Markdown decks and cards
157184

158185
Markdown files use front matter for metadata, with the body becoming the prompt.

0 commit comments

Comments
 (0)