Skip to content

Commit 63d282a

Browse files
committed
sync(bfmono): docs(gambit): retire synthetic respond/end guidance and align deck authoring surfaces (+19 more) (bfmono@2d14cdf2b)
This PR is an automated gambitmono sync of bfmono Gambit packages. - Source: `packages/gambit/` - Core: `packages/gambit/packages/gambit-core/` - bfmono rev: 2d14cdf2b Changes: - 498708844 docs(gambit): retire synthetic respond/end guidance and align deck authoring surfaces - 35ad1d5b5 feat(gambit-core): add OpenResponses convergence runtime, extensions, and async action semantics - b2d78cfb3 chore(gambit): cut 0.8.5-rc.9 - a0029f933 revert(gambit-ci): restore shell-based nix develop in ci-gambit-core - 1b2930064 fix(gambit-ci): create nix profile parent dir in ci-gambit-core - 168538d09 chore(gambit): cut 0.8.5-rc.8 - 9f2dd2186 Switch ci-gambit-core to run nix develop via step commands with a profile instead of custom shell overrides. This avoids both workflow-parse failures and literal path resolution failures. - bd91e87f1 chore(gambit): cut 0.8.5-rc.7 - 63a27a8a4 fix(gambit-ci): stop using github.workspace in shell field - e923eabdd chore(gambit): cut 0.8.5-rc.6 - b6f5d2c1f feat(gambit): add workbench composer chip and chat flow updates - 9ebc474b8 fix(gambit): invalidate build deck label cache on frontmatter changes - 04f032d28 feat(simulator-ui): use icon remove action for error context chip - 71a94654b fix(gambit): validate explicit deck path and stabilize stop test - 77fa7f139 refactor(gambit-simulator-ui): replace placeholders with reusable callout - d90d57c08 feat(gambit-simulator-ui): send scenario run errors to workbench chat - dc7d93a08 refactor(gambit): Fix left drawer - bdad96a86 chore(repo): pin jsx-runtime imports to react 19.2.4 - 0c787f96d chore(gambit): cut 0.8.5-rc.5 and pin React to 19.2.4 - 0fdcdf864 fix(gambit): unblock npm dnt build for 0.8.5-rc.4 Do not edit this repo directly; make changes in bfmono and re-run the sync.
1 parent b3ed815 commit 63d282a

48 files changed

Lines changed: 6596 additions & 767 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: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,11 @@ Run it:
327327
npx @bolt-foundry/gambit run ./agent_with_time.deck.md --context '"hello"' --stream
328328
```
329329

330-
### Respond flow demo (non-root decks + grading)
330+
### Legacy respond-flow demo (historical compatibility)
331331

332-
Need a turnkey scenario that hits personas → init → non-root `gambit_respond`
333-
payloads → graders? Use the example in `packages/gambit/examples/respond_flow/`.
332+
`packages/gambit/examples/respond_flow/` is kept as a legacy compatibility
333+
example for historical transcript/grader behavior. New decks should return
334+
schema-valid assistant output directly instead of calling `gambit_respond`.
334335

335336
```
336337
cd packages/gambit
@@ -342,10 +343,10 @@ Then:
342343
1. Open `http://localhost:8000/test`, pick the **Escalation persona**, and run
343344
it. Leave the “Use scenario deck input for init” toggle on to see persona
344345
data seed the init form automatically.
345-
2. Switch to the Debug tab to inspect the session—the child deck emits a
346-
`gambit_respond` payload that now shows up as a structured assistant turn.
347-
3. Head to the Calibrate tab and run the **Respond payload grader** to exercise
348-
grading on the non-root respond output.
346+
2. Switch to the Debug tab to inspect the session; this scenario still emits
347+
legacy `gambit_respond` payloads for compatibility testing.
348+
3. Head to the Calibrate tab and run the **Respond payload grader** to validate
349+
historical non-root respond-output handling.
349350

350351
## Deno
351352

docs/external/concepts/runtime.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,14 @@ safe/observable.
2121
- `gambit_context`: sent once when `--context` (formerly `--init`) is provided;
2222
payload is the raw input. Useful for assistant-first flows so the model can
2323
read input without a user turn. `gambit_init` remains as a deprecated alias.
24-
- `gambit_respond`: enable with the `gambit://snippets/respond.md` marker in
25-
Markdown (or `respond: true` in TypeScript decks). Required for LLM decks that
26-
should finish with a structured envelope
27-
`{ payload, status?, message?, code?, meta? }`.
28-
- `gambit_complete`: emitted automatically for child completions and handled
29-
errors so the parent can see
24+
- `gambit_respond` / `gambit_end`: removed from runtime defaults. Do not add
25+
`gambit://snippets/respond.md`, `gambit://snippets/end.md`, `respond: true`,
26+
or `allowEnd: true` in new decks. Return normal assistant output that matches
27+
`responseSchema`; model status/code/meta fields directly in that schema when
28+
needed.
29+
- Child action results are returned through the action tool result payload.
30+
Handled errors use the same envelope shape:
3031
`{ runId, actionCallId, source, status?, payload?, message?, code?, meta? }`.
31-
- `gambit_end`: enable with `![end](gambit://snippets/end.md)` in Markdown (or
32-
`allowEnd: true` in TypeScript decks). Calling it returns a sentinel
33-
`{ __gambitEnd: true, payload?, status?, message?, code?, meta? }` so
34-
CLI/scenario loops stop reinjecting the closing assistant turn.
3532

3633
## State and turn order
3734

@@ -54,8 +51,8 @@ safe/observable.
5451
repeats if `repeatMs` is set. Input mirrors busy with `kind:"idle"` and no
5552
`childInput`.
5653
- Error (`handlers.onError`): wraps child errors; should return
57-
`{ payload?, status?, message?, code?, meta? }` which becomes a
58-
`gambit_complete` envelope. If the handler itself fails, the runtime still
54+
`{ payload?, status?, message?, code?, meta? }` which becomes the structured
55+
action tool result envelope. If the handler itself fails, the runtime still
5956
returns a structured error envelope.
6057
- Handler failures are swallowed so they never crash the main run.
6158

docs/external/examples/handlers_md.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
What it shows
44

55
- Busy/idle/error handlers authored in Markdown decks, paired with TS actions.
6-
- Using `gambit://snippets/respond.md` in an error handler to force structured
7-
completion.
6+
- Returning structured, schema-valid handler outputs without synthetic respond
7+
tools.
88

99
Key files
1010

@@ -22,9 +22,10 @@ Why it’s structured this way
2222
- Markdown handlers keep prompts readable while still validating IO via schemas.
2323
- `onBusy` uses `repeatMs` to stream periodic status messages; `onIdle` fires
2424
after inactivity.
25-
- `onError` returns a fixed envelope via `gambit_respond`, ensuring the parent
26-
sees a consistent `{status, code, message, meta, payload}` even when children
27-
fail.
25+
- `onError` returns a fixed structured object that matches `responseSchema`,
26+
ensuring the parent sees a consistent
27+
`{status, code, message, meta,
28+
payload}` shape even when children fail.
2829

2930
How to run
3031

docs/external/examples/handlers_ts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
What it shows
44

55
- Busy/idle/error handlers written in TypeScript with explicit Zod schemas.
6-
- Demonstrates handled errors producing `gambit_complete` envelopes and status
7-
streaming.
6+
- Demonstrates handled errors producing structured action tool-result envelopes
7+
and status streaming.
88

99
Key files
1010

docs/external/examples/internal_monolog.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ without tool calls) before completing its work.
55

66
- `internal_monolog_parent.deck.md`: root deck that calls the child tool and
77
relays its answer.
8-
- `monolog_child.deck.md`: LLM child with the `gambit://snippets/respond.md`
9-
marker that first thinks aloud (monolog), then calls a compute action, then
10-
responds.
8+
- `monolog_child.deck.md`: LLM child that first thinks aloud (monolog), then
9+
calls a compute action, then returns schema-valid assistant output.
1110
- `lookup_fact.deck.ts`: simple compute action the child calls.
1211

1312
Run in the debug UI to see monolog traces:
@@ -21,5 +20,5 @@ Send a question (e.g., "What is Rust?"). In the Traces & Tools panel you’ll se
2120
- `model.result` from the child showing a content-only assistant turn (monolog).
2221
- A `monolog` trace entry (emitted because the child is non-root and spoke
2322
without tool calls).
24-
- Subsequent tool call/result for `lookup_fact`, then the final respond
25-
envelope.
23+
- Subsequent tool call/result for `lookup_fact`, then final schema-valid
24+
assistant output.

docs/external/examples/policy_support_bot.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Key ideas:
1212
manual confidence scores (no external vector store required).
1313
2. **Policy-aware orchestration**`policy_support_bot.deck.md` embeds persona,
1414
grounding, and refusal snippets, calls `search_faq`, enforces citation
15-
formatting, and uses `gambit://snippets/respond.md` with a schema so the
16-
UI/CLI always receives structured envelopes.
15+
formatting, and returns schema-valid structured output so the UI/CLI always
16+
receives consistent envelopes.
1717
3. **Tests + demos**`tests/faq_dataset.test.ts` guards the FAQ knowledge base
1818
(category headings, IDs, entry counts), while `demo-script.md` lists prompts
1919
for grounded answers, refusals, and edge cases that you can replay in the

docs/external/guides/authoring.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,11 @@ deno run -A packages/gambit/scripts/migrate-schema-terms.ts <repo-root>
142142
- `gambit_context`: injected automatically when `--context` (formerly `--init`)
143143
is provided; carries the raw input as the first tool result. `gambit_init`
144144
remains as a deprecated alias.
145-
- `gambit_respond`: enable by inserting the
146-
`![respond](gambit://snippets/respond.md)` marker in Markdown decks (or
147-
`respond: true` in TypeScript). Required for LLM decks finish via a structured
148-
envelope: `{ status?, payload, message?, code?, meta? }`.
149-
- `gambit_complete`: emitted by child actions and handled errors to wrap their
150-
results for the parent.
145+
- `gambit_respond` / `gambit_end`: removed from runtime defaults. Do not add
146+
`gambit://snippets/respond.md`, `gambit://snippets/end.md`, `respond: true`,
147+
or `allowEnd: true` in new decks.
148+
- Child action and handled-error metadata (`status`, `code`, `meta`, `payload`)
149+
are returned via the action tool result payload envelope.
151150
- Optional handlers (deck-only): `handlers.onBusy`, `handlers.onIdle`,
152151
`handlers.onError` point to other decks. Inputs are structured (see
153152
`../reference/handlers.md`); errors inside handlers are swallowed.
@@ -157,9 +156,9 @@ deno run -A packages/gambit/scripts/migrate-schema-terms.ts <repo-root>
157156
- In Markdown, use image syntax to embed snippets:
158157
`![behavior](./cards/behavior.card.md)`. Local snippet files often still live
159158
under `cards/` with a `.card.md` suffix for legacy compatibility. Special
160-
markers: `gambit://snippets/context.md` hints init tool,
161-
`gambit://snippets/respond.md` injects respond instructions, and
162-
`gambit://snippets/end.md` enables the `gambit_end` hang-up tool.
159+
markers: `gambit://snippets/context.md` hints init tool, while
160+
`gambit://snippets/respond.md` and `gambit://snippets/end.md` are legacy
161+
migration markers and should not be used for new deck behavior.
163162
- Snippets can also be TS files exported with `defineCard`. They may contain
164163
action/scenario/grader deck references and schema fragments, but no handlers.
165164

docs/external/reference/handlers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ Notes:
6565
childInput?: Record<string, unknown>,
6666
}
6767
```
68-
Return `{ message?, code?, status?, meta?, payload? }` to populate a
69-
`gambit_complete` envelope.
68+
Return `{ message?, code?, status?, meta?, payload? }` to populate the
69+
structured action tool result envelope.
7070

7171
## Outputs and streaming
7272

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Intermediate Child Delta Demo
2+
3+
This demo is designed to exercise canonical intermediate child output-item
4+
semantics (Project 08 delta path).
5+
6+
## Files
7+
8+
- `child_progress.deck.ts`: compute child deck emitting intermediate
9+
`gambit:action_progress` items via `ctx.emitOutputItem(...)`.
10+
- `parent_compute_harness.deck.ts`: compute parent deck that calls the child via
11+
`ctx.spawnAndWait(...)`.
12+
- `md_llm_parent/PROMPT.md`: markdown parent LLM deck that calls markdown child
13+
action deck.
14+
- `md_llm_child/PROMPT.md`: markdown child LLM deck (with
15+
`schemas/input.zod.ts`, `schemas/output.zod.ts`, and
16+
`schemas/progress.zod.ts`) that emits `gambit:action_progress` via
17+
`gambit_emit_output_item`.
18+
19+
## Run (CLI)
20+
21+
From `packages/gambit`:
22+
23+
```bash
24+
deno run -A src/cli.ts run \
25+
examples/dev/intermediate-child-delta/parent_compute_harness.deck.ts \
26+
--context '"exercise delta path"' \
27+
--trace /tmp/intermediate-child-delta.trace.jsonl \
28+
--no-worker-sandbox
29+
```
30+
31+
Inspect canonical child response events:
32+
33+
```bash
34+
rg '"type":"response\.(created|output_item.added|output_item.done|completed|failed)"' \
35+
/tmp/intermediate-child-delta.trace.jsonl
36+
```
37+
38+
## Run Markdown LLM -> Action(LLM)
39+
40+
From `packages/gambit`:
41+
42+
```bash
43+
deno run -A src/cli.ts run \
44+
examples/dev/intermediate-child-delta/md_llm_parent/PROMPT.md \
45+
--context '"exercise llm action deltas"' \
46+
--responses \
47+
--stream \
48+
--model openai/gpt-4o-mini \
49+
--trace /tmp/llm-to-llm-openai-md-clean.trace.jsonl \
50+
--no-worker-sandbox
51+
```
52+
53+
Inspect child deck trace records:
54+
55+
```bash
56+
rg 'md_llm_child/PROMPT.md|gambit_emit_output_item|response\.output_item\.(added|done)|response\.created|response\.completed' \
57+
/tmp/llm-to-llm-openai-md-clean.trace.jsonl
58+
```
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { defineDeck } from "../../../mod.ts";
2+
import { z } from "zod";
3+
4+
export default defineDeck({
5+
contextSchema: z.object({
6+
task: z.string().default("unspecified-task"),
7+
}),
8+
responseSchema: z.object({
9+
done: z.boolean(),
10+
task: z.string(),
11+
}),
12+
responseItemExtensions: [
13+
{
14+
type: "gambit:action_progress",
15+
dataSchema: z.object({
16+
step: z.string(),
17+
percent: z.number(),
18+
}),
19+
description: "Intermediate child progress updates",
20+
},
21+
],
22+
async run(ctx) {
23+
await ctx.emitOutputItem({
24+
type: "gambit:action_progress",
25+
data: { step: "start", percent: 10 },
26+
});
27+
await new Promise((resolve) => setTimeout(resolve, 15));
28+
await ctx.emitOutputItem({
29+
type: "gambit:action_progress",
30+
data: { step: "middle", percent: 60 },
31+
});
32+
await new Promise((resolve) => setTimeout(resolve, 15));
33+
await ctx.emitOutputItem({
34+
type: "gambit:action_progress",
35+
data: { step: "finalizing", percent: 90 },
36+
});
37+
return {
38+
done: true,
39+
task: ctx.input.task,
40+
};
41+
},
42+
});

0 commit comments

Comments
 (0)