@bolt-foundry/gambit 0.6.8 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +6 -37
  2. package/README.md +76 -25
  3. package/esm/gambit/simulator-ui/dist/bundle.js +1010 -333
  4. package/esm/gambit/simulator-ui/dist/bundle.js.map +3 -3
  5. package/esm/mod.d.ts +4 -4
  6. package/esm/mod.d.ts.map +1 -1
  7. package/esm/mod.js +2 -2
  8. package/esm/src/cli_utils.d.ts +4 -5
  9. package/esm/src/cli_utils.d.ts.map +1 -1
  10. package/esm/src/cli_utils.js +27 -7
  11. package/esm/src/compat/openai.d.ts +2 -0
  12. package/esm/src/compat/openai.d.ts.map +1 -0
  13. package/esm/src/compat/openai.js +1 -0
  14. package/esm/src/providers/openrouter.d.ts +9 -0
  15. package/esm/src/providers/openrouter.d.ts.map +1 -0
  16. package/esm/src/providers/openrouter.js +595 -0
  17. package/esm/src/server.d.ts.map +1 -1
  18. package/esm/src/server.js +261 -6
  19. package/esm/src/trace.d.ts.map +1 -1
  20. package/esm/src/trace.js +4 -1
  21. package/package.json +3 -2
  22. package/script/gambit/simulator-ui/dist/bundle.js +1010 -333
  23. package/script/gambit/simulator-ui/dist/bundle.js.map +3 -3
  24. package/script/mod.d.ts +4 -4
  25. package/script/mod.d.ts.map +1 -1
  26. package/script/mod.js +6 -6
  27. package/script/src/cli_utils.d.ts +4 -5
  28. package/script/src/cli_utils.d.ts.map +1 -1
  29. package/script/src/cli_utils.js +29 -9
  30. package/script/src/compat/openai.d.ts +2 -0
  31. package/script/src/compat/openai.d.ts.map +1 -0
  32. package/script/src/compat/openai.js +5 -0
  33. package/script/src/providers/openrouter.d.ts +9 -0
  34. package/script/src/providers/openrouter.d.ts.map +1 -0
  35. package/script/src/providers/openrouter.js +634 -0
  36. package/script/src/server.d.ts.map +1 -1
  37. package/script/src/server.js +261 -6
  38. package/script/src/trace.d.ts.map +1 -1
  39. package/script/src/trace.js +4 -1
package/CHANGELOG.md CHANGED
@@ -1,47 +1,16 @@
1
1
  +++
2
2
  [release]
3
- since = "225456917f75e92cc095af525201373c4be37944"
3
+ since = "692534996df73790229b8303516d48be66136fce"
4
4
  +++
5
5
 
6
6
  # Changelog
7
7
 
8
- ## Unreleased (v0.6.8)
8
+ ## Unreleased (v0.8.1)
9
9
 
10
- - Repl fixes.
11
- - Replaced voice front desk graders and expanded FAQ persona/grading coverage.
10
+ - TBD
12
11
 
13
- ### CLI and UX
12
+ ## v0.8.0
14
13
 
15
- - Added a grading command with test-bot hooks in the CLI.
16
- - `--message` now works without `--init` for object root schemas.
17
- - REPL/serve/CLI flags refreshed; `--verbose` logs tool call args/results.
14
+ - chore(gambit): prepare 0.8.0 changelog
18
15
 
19
- ### Fixes
20
-
21
- - Avoid extra assistant turn on test-bot resume; skip empty assistant turns in
22
- grading; keep grader respond blocks last.
23
- - Fixed test-bot sidebar loading, grader score reads, and booking confirmation
24
- placement.
25
- - Simulator UI polish: full-height layout, sourcemap adverts, locked init panel
26
- behavior, and reconnect/permalink reloads.
27
-
28
- ## v0.0
29
-
30
- - Authoring: TypeScript/Markdown decks and cards via `defineDeck`/`defineCard`;
31
- embeds with cycle detection; card actions merge into decks (deck wins); card
32
- schema fragments merge into deck schemas; non-root decks require input/output
33
- schemas (root defaults to string-ish).
34
- - Runtime: compute and LLM decks share the surface; assistant-first flow seeds a
35
- synthetic `gambit_init` tool; helpers `spawnAndWait`, `return`, `fail`; action
36
- names validated against reserved prefix/pattern/length; default guardrails
37
- depth=3/passes=3/timeout≈120s with per-deck overrides.
38
- - Handlers/events: optional `onError`/`onBusy`/`onIdle` decks emit structured
39
- events (`gambit_complete` for handled errors, busy/idle updates) with default
40
- delay 800ms and traces for fire/result (`onInterval` is deprecated alias for
41
- `onBusy`).
42
- - IO/host: CLI supports `run`, `repl`, `serve` (WebSocket simulator UI); flags
43
- for streaming, turn order via user message, trace to console/JSONL, state
44
- load/save, model overrides; `deno task compile` builds a binary; OpenRouter
45
- chat provider with streaming/tool calls.
46
- - Runtime + server tests for schemas/embeds/streaming/handlers; tasks for
47
- fmt/lint/test/ci; root README with quick start.
16
+ ## 0.7.0 — Show HN launch
package/README.md CHANGED
@@ -1,27 +1,40 @@
1
- # Gambit
1
+ # <img src="./gambit_1color_bg.png" alt="Gambit logo" height="50" />
2
2
 
3
3
  Gambit helps you build reliable LLM workflows by composing small, typed “decks”\
4
4
  with clear inputs/outputs and guardrails. Run decks locally, stream traces, and\
5
5
  debug with a built-in UI.
6
6
 
7
+ [Watch the demo video](https://youtu.be/J_hQ2L_yy60).
8
+
7
9
  ## Quickstart
8
10
 
9
- Requirements: Deno 2.2+ and `OPENROUTER_API_KEY` (set `OPENROUTER_BASE_URL` if\
11
+ Requirements: Node.js 18+ and `OPENROUTER_API_KEY` (set `OPENROUTER_BASE_URL` if
10
12
  you proxy OpenRouter-style APIs).
11
13
 
12
- Run the CLI directly from JSR (no install):
14
+ Run the CLI directly with npx (no install):
13
15
 
14
16
  ```
15
17
  export OPENROUTER_API_KEY=...
16
- deno run -A jsr:@bolt-foundry/gambit/cli init
18
+ npx @bolt-foundry/gambit demo
17
19
  ```
18
20
 
19
- Downloads example files and sets environment variables.
21
+ Downloads example files (hello decks plus the `examples/` gallery) and sets
22
+ environment variables.
23
+
24
+ To scaffold a starter project that you can customize, run:
25
+
26
+ ```
27
+ npx @bolt-foundry/gambit init my-project
28
+ ```
29
+
30
+ This creates a structured skeleton (`decks/`, `actions/`, `graders/`, `tests/`,
31
+ `schemas/`, `.gambit/`) with README guides so you can start authoring your own
32
+ workflows immediately.
20
33
 
21
34
  Run an example in the terminal (`repl`):
22
35
 
23
36
  ```
24
- deno run -A jsr:@bolt-foundry/gambit/cli repl examples/init/hello.deck.md
37
+ npx @bolt-foundry/gambit repl gambit/hello.deck.md
25
38
  ```
26
39
 
27
40
  This example just says "hello" and repeats your message back to you.
@@ -29,7 +42,7 @@ This example just says "hello" and repeats your message back to you.
29
42
  Run an example in the browser (`serve`):
30
43
 
31
44
  ```
32
- deno run -A jsr:@bolt-foundry/gambit/cli serve examples/init/hello.deck.md
45
+ npx @bolt-foundry/gambit serve gambit/hello.deck.md
33
46
  open http://localhost:8000/debug
34
47
  ```
35
48
 
@@ -65,40 +78,43 @@ open http://localhost:8000/debug
65
78
 
66
79
  Use the CLI to run decks locally, stream output, and capture traces/state.
67
80
 
68
- Install the CLI:
81
+ Run with npx (no install):
69
82
 
70
83
  ```
71
- deno install -A -n gambit jsr:@bolt-foundry/gambit/cli
84
+ npx @bolt-foundry/gambit <command>
72
85
  ```
73
86
 
74
87
  Run a deck once:
75
88
 
76
89
  ```
77
- gambit run <deck> --init <json|string> --message <json|string>
90
+ npx @bolt-foundry/gambit run <deck> --context <json|string> --message <json|string>
78
91
  ```
79
92
 
93
+ > `--context` replaces the old `--init` flag. The CLI still accepts `--init` as
94
+ > a deprecated alias for now so existing scripts keep working.
95
+
80
96
  Drop into a REPL (streams by default):
81
97
 
82
98
  ```
83
- gambit repl <deck>
99
+ npx @bolt-foundry/gambit repl <deck>
84
100
  ```
85
101
 
86
102
  Run a persona against a root deck (test bot):
87
103
 
88
104
  ```
89
- gambit test-bot <root-deck> --test-deck <persona-deck>
105
+ npx @bolt-foundry/gambit test-bot <root-deck> --test-deck <persona-deck>
90
106
  ```
91
107
 
92
108
  Grade a saved session:
93
109
 
94
110
  ```
95
- gambit grade <grader-deck> --state <file>
111
+ npx @bolt-foundry/gambit grade <grader-deck> --state <file>
96
112
  ```
97
113
 
98
114
  Start the Debug UI server:
99
115
 
100
116
  ```
101
- gambit serve <deck> --port 8000
117
+ npx @bolt-foundry/gambit serve <deck> --port 8000
102
118
  ```
103
119
 
104
120
  Tracing and state: 
@@ -111,16 +127,16 @@ Tracing and state: 
111
127
 
112
128
  The simulator is the local Debug UI that streams runs and renders traces.
113
129
 
114
- Install the CLI:
130
+ Run with npx (no install):
115
131
 
116
132
  ```
117
- deno install -A -n gambit jsr:@bolt-foundry/gambit/cli
133
+ npx @bolt-foundry/gambit <command>
118
134
  ```
119
135
 
120
136
  Start it:
121
137
 
122
138
  ```
123
- gambit serve <deck> --port 8000
139
+ npx @bolt-foundry/gambit serve <deck> --port 8000
124
140
  ```
125
141
 
126
142
  Then open:
@@ -159,7 +175,7 @@ Define `inputSchema`/`outputSchema` with Zod to validate IO, and implement\
159
175
 
160
176
  ## Author your first deck
161
177
 
162
- ### Minimal Markdown deck (model-powered):
178
+ ### Minimal Markdown deck (model-powered): `hello_world.deck.md`
163
179
 
164
180
  ```
165
181
  +++
@@ -176,12 +192,12 @@ You are a concise assistant. Greet the user and echo the input.
176
192
  Run it:
177
193
 
178
194
  ```
179
- deno run -A src/cli.ts run ./hello_world.deck.md --init '"Gambit"' --stream
195
+ npx @bolt-foundry/gambit run ./hello_world.deck.md --context '"Gambit"' --stream
180
196
  ```
181
197
 
182
- ### Compute deck in TypeScript (no model call):
198
+ ### Compute deck in TypeScript (no model call): `echo.deck.ts`
183
199
 
184
- ```
200
+ ```typescript
185
201
  // echo.deck.ts
186
202
  import { defineDeck } from "jsr:@bolt-foundry/gambit";
187
203
  import { z } from "zod";
@@ -199,10 +215,10 @@ export default defineDeck({
199
215
  Run it:
200
216
 
201
217
  ```
202
- deno run -A src/cli.ts run ./echo.deck.ts --init '{"text":"ping"}'
218
+ npx @bolt-foundry/gambit run ./echo.deck.ts --context '{"text":"ping"}'
203
219
  ```
204
220
 
205
- ### Deck with a child action (calls a TypeScript tool):
221
+ ### Deck with a child action (calls a TypeScript tool): `agent_with_time.deck.md`
206
222
 
207
223
  ```
208
224
  +++
@@ -217,9 +233,9 @@ description = "Return the current ISO timestamp."
217
233
  A tiny agent that calls get_time, then replies with the timestamp and the input.
218
234
  ```
219
235
 
220
- And the child action:
236
+ And the child action: `get_time.deck.ts`
221
237
 
222
- ```
238
+ ```typescript
223
239
  // get_time.deck.ts
224
240
  import { defineDeck } from "jsr:@bolt-foundry/gambit";
225
241
  import { z } from "zod";
@@ -233,3 +249,38 @@ export default defineDeck({
233
249
  },
234
250
  });
235
251
  ```
252
+
253
+ Run it:
254
+
255
+ ```
256
+ npx @bolt-foundry/gambit run ./agent_with_time.deck.md --context '"hello"' --stream
257
+ ```
258
+
259
+ ## Deno
260
+
261
+ If you prefer Deno, use the Deno commands below.
262
+
263
+ Quickstart:
264
+
265
+ ```
266
+ export OPENROUTER_API_KEY=...
267
+ deno run -A jsr:@bolt-foundry/gambit/cli demo
268
+ ```
269
+
270
+ Starter project:
271
+
272
+ ```
273
+ deno run -A jsr:@bolt-foundry/gambit/cli init my-project
274
+ ```
275
+
276
+ Run a deck:
277
+
278
+ ```
279
+ deno run -A jsr:@bolt-foundry/gambit/cli run <deck> --context <json|string> --message <json|string>
280
+ ```
281
+
282
+ Start the Debug UI:
283
+
284
+ ```
285
+ deno run -A jsr:@bolt-foundry/gambit/cli serve <deck> --port 8000
286
+ ```