Skip to content

Commit cd74f09

Browse files
committed
sync(bfmono): fix(gambit): stabilize workspace test reset and log workspace bot roots (+19 more) (bfmono@f7bccb07f)
This PR is an automated gambitmono sync of bfmono Gambit packages. - Source: `packages/gambit/` - Core: `packages/gambit-core/` - bfmono rev: f7bccb07f Changes: - 8fe4fb52e fix(gambit): stabilize workspace test reset and log workspace bot roots - a0406602d chore(gambit): remove ollama model fallback from gambit-bot decks - d37a89cb3 fix(gambit): stabilize workspace tab routing and grading diagnostics - aad9515bc feat(gambit): cut over test and grade to workspace root context - 16394aa3f feat(gambit): move simulator routing to /workspaces - 7017bbb2b fix(gambit-ui): stop grade tab from dropping workspace id - acd73ce42 fix(gambit): separate workspace state dir and fail simulator on invalid workspace state - af6ff55c8 fix(gambit): require explicit workspaceId in API routes - 2a5896703 docs(gambit): clarify worker sandbox defaults for CLI and core - 60bcfd54b fix(gambit-core): harden worker bridge and sandboxed orchestration - 550a858e0 fix(gambit-core): deny symlink-mediated run.path execution - 259a15030 feat(gambit-core): publish canonical schema subpath exports - dfc85a562 fix(gambit-core): harden runtime trust boundaries and schema import guards - 2967fb893 test(gambit): align sandbox assertion + extend runtime coverage - b746e6453 fix(gambit-core): honor directory permission scopes - 2dcd5f19d fix(gambit-core): include orchestration worker in bootstrap reads - 52d54d3c7 fix(gambit-core): constrain inspect worker bootstrap reads - a4b617849 fix(gambit-core): tighten worker bootstrap reads and child deadlines - 9b8b6fa96 fix(gambit-core): harden worker bootstrap import parsing - 3966dcbb8 fix(gambit-core): preserve nested sandboxing in orchestration worker Do not edit this repo directly; make changes in bfmono and re-run the sync.
1 parent 5356ee6 commit cd74f09

54 files changed

Lines changed: 8894 additions & 1409 deletions

Some content is hidden

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

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.

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

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

Lines changed: 6 additions & 1 deletion
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,6 +13,11 @@ 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
+++

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: 21 additions & 0 deletions
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
@@ -153,6 +161,19 @@ When the deck defines `run`/`execute`, the runtime hands you an
153161
Pass `guardrails`, `initialUserMessage`, `modelOverride`, and
154162
`allowRootStringInput` to `runDeck` when scripting custom runtimes.
155163

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

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

packages/gambit-core/deno.json

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,39 @@
88
"url": "git+https://github.com/bolt-foundry/gambit.git"
99
},
1010
"exports": {
11-
".": "./mod.ts"
11+
".": "./mod.ts",
12+
"./schemas/graders/respond.ts": "./schemas/graders/respond.ts",
13+
"./schemas/graders/respond.zod.ts": "./schemas/graders/respond.zod.ts",
14+
"./schemas/graders/grader_output.ts": "./schemas/graders/grader_output.ts",
15+
"./schemas/graders/grader_output.zod.ts":
16+
"./schemas/graders/grader_output.zod.ts",
17+
"./schemas/graders/contexts/turn.ts": "./schemas/graders/contexts/turn.ts",
18+
"./schemas/graders/contexts/turn.zod.ts":
19+
"./schemas/graders/contexts/turn.zod.ts",
20+
"./schemas/graders/contexts/turn_tools.ts":
21+
"./schemas/graders/contexts/turn_tools.ts",
22+
"./schemas/graders/contexts/turn_tools.zod.ts":
23+
"./schemas/graders/contexts/turn_tools.zod.ts",
24+
"./schemas/graders/contexts/conversation.ts":
25+
"./schemas/graders/contexts/conversation.ts",
26+
"./schemas/graders/contexts/conversation.zod.ts":
27+
"./schemas/graders/contexts/conversation.zod.ts",
28+
"./schemas/graders/contexts/conversation_tools.ts":
29+
"./schemas/graders/contexts/conversation_tools.ts",
30+
"./schemas/graders/contexts/conversation_tools.zod.ts":
31+
"./schemas/graders/contexts/conversation_tools.zod.ts",
32+
"./schemas/graders/contexts/tools.ts":
33+
"./schemas/graders/contexts/tools.ts",
34+
"./schemas/graders/contexts/tools.zod.ts":
35+
"./schemas/graders/contexts/tools.zod.ts",
36+
"./schemas/scenarios/plain_chat_input_optional.ts":
37+
"./schemas/scenarios/plain_chat_input_optional.ts",
38+
"./schemas/scenarios/plain_chat_input_optional.zod.ts":
39+
"./schemas/scenarios/plain_chat_input_optional.zod.ts",
40+
"./schemas/scenarios/plain_chat_output.ts":
41+
"./schemas/scenarios/plain_chat_output.ts",
42+
"./schemas/scenarios/plain_chat_output.zod.ts":
43+
"./schemas/scenarios/plain_chat_output.zod.ts"
1244
},
1345
"tasks": {
1446
"fmt": "deno fmt",

0 commit comments

Comments
 (0)