Skip to content

Commit d6b13a2

Browse files
committed
sync(bfmono): feat(gambit-core): add onTool runtime dispatch for external tools (+19 more) (bfmono@20c4fbf62)
This PR is an automated gambitmono sync of bfmono Gambit packages. - Source: `packages/gambit/` - Core: `packages/gambit-core/` - bfmono rev: 20c4fbf62 Changes: - 1a4c73d61 feat(gambit-core): add onTool runtime dispatch for external tools - 0ad674b31 feat(gambit-core): enforce action execute surface contract - 59b8a8e05 fix(gambit): recover continueSession when snapshot is missing - 9b3a7f77b fix(gambit): reject continueSession without snapshot state - 1a0826c65 feat(gambit): implement opt-in runtime session artifacts with integrity fixes - 75a6f7515 docs(gambit-bot): empty out INTENT.md - 825cc3d6b fix(gambit): propagate deckPath through OpenAI compat model calls - 9f0f9a101 fix(gambit): derive Codex MCP tool surface from active deck - cb163b28d fix(demo): force prompt-driver runs to sandbox bot root - b79453ab9 fix(demo): scope 5m build chat wait to canonical flow only - ae0033df3 chore(demo): extend build chat recovery waits to 5 minutes - 87c4d65ac docs(gambit): add runDeck migration guidance and changelog entries - f290c9346 feat(gambit): add shared defaulted runtime and wrapper - 45e898572 feat(gambit-bot): refine bot prompt and scenario instructions - 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 Do not edit this repo directly; make changes in bfmono and re-run the sync.
1 parent 5356ee6 commit d6b13a2

110 files changed

Lines changed: 23016 additions & 4499 deletions

File tree

Some content is hidden

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

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ since = "849762245925cce325c04da1d604088370ec3723"
77

88
## Unreleased (v0.8.4)
99

10-
- TBD
10+
- feat(gambit): add `createDefaultedRuntime` and defaulted `runDeck` wrapper
11+
with CLI-equivalent provider/model routing for library callers
12+
- refactor(gambit): route CLI runtime/provider setup through shared
13+
`default_runtime` construction path
14+
- feat(demo-runner): migrate demo test-deck prompt generation to Gambit default
15+
runtime wrapper (no hardwired OpenRouter provider)
16+
- docs(gambit): add migration guidance for `runDeck` wrapper and `runDeckCore`
17+
replacement mapping
1118

1219
## v0.8.3
1320

README.md

Lines changed: 70 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.
@@ -173,6 +190,59 @@ Define `contextSchema`/`responseSchema` with Zod to validate IO, and implement\
173190
`ctx.spawnAndWait({ path, input })`. Emit structured trace events with\
174191
`ctx.log(...)`.
175192

193+
### Runtime defaults for programmatic `runDeck`
194+
195+
`runDeck` from `@bolt-foundry/gambit` now uses CLI-equivalent provider/model
196+
defaults (alias expansion, provider routing, fallback behavior).
197+
198+
Before (direct-provider setup in each caller):
199+
200+
```ts
201+
import { createOpenRouterProvider, runDeck } from "jsr:@bolt-foundry/gambit";
202+
203+
const provider = createOpenRouterProvider({
204+
apiKey: Deno.env.get("OPENROUTER_API_KEY")!,
205+
});
206+
await runDeck({
207+
path: "./root.deck.md",
208+
input: { message: "hi" },
209+
modelProvider: provider,
210+
});
211+
```
212+
213+
After (defaulted wrapper):
214+
215+
```ts
216+
import { runDeck } from "jsr:@bolt-foundry/gambit";
217+
218+
await runDeck({
219+
path: "./root.deck.md",
220+
input: { message: "hi" },
221+
});
222+
```
223+
224+
Per-runtime override (shared runtime object):
225+
226+
```ts
227+
import { createDefaultedRuntime, runDeck } from "jsr:@bolt-foundry/gambit";
228+
229+
const runtime = await createDefaultedRuntime({
230+
fallbackProvider: "codex-cli",
231+
});
232+
233+
await runDeck({
234+
runtime,
235+
path: "./root.deck.md",
236+
input: { message: "hi" },
237+
});
238+
```
239+
240+
Replacement mapping:
241+
242+
- Legacy direct core passthrough export: `runDeck` -> `runDeckCore`
243+
- Defaulted wrapper export: `runDeck`
244+
- Runtime builder: `createDefaultedRuntime`
245+
176246
---
177247

178248
## Author your first deck

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
+++

0 commit comments

Comments
 (0)