@bolt-foundry/gambit 0.7.0 → 0.8.1

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.
package/CHANGELOG.md CHANGED
@@ -1,8 +1,20 @@
1
1
  +++
2
2
  [release]
3
- since = "225456917f75e92cc095af525201373c4be37944"
3
+ since = "769d3de436e4542ed7d0d80201f665657d93efb2"
4
4
  +++
5
5
 
6
6
  # Changelog
7
7
 
8
+ ## Unreleased (v0.8.2)
9
+
10
+ - TBD
11
+
12
+ ## v0.8.1
13
+
14
+ - fix(gambit): include gambit-core cards/schemas in compiled binary
15
+
16
+ ## v0.8.0
17
+
18
+ - chore(gambit): prepare 0.8.0 changelog
19
+
8
20
  ## 0.7.0 — Show HN launch
package/README.md CHANGED
@@ -1,23 +1,35 @@
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: Node.js 18+ and `OPENROUTER_API_KEY` (set `OPENROUTER_BASE_URL`
10
- if\
11
+ Requirements: Node.js 18+ and `OPENROUTER_API_KEY` (set `OPENROUTER_BASE_URL` if
11
12
  you proxy OpenRouter-style APIs).
12
13
 
13
14
  Run the CLI directly with npx (no install):
14
15
 
15
16
  ```
16
17
  export OPENROUTER_API_KEY=...
17
- npx @bolt-foundry/gambit init
18
+ npx @bolt-foundry/gambit demo
19
+ ```
20
+
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
18
28
  ```
19
29
 
20
- Downloads example files and sets environment variables.
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.
21
33
 
22
34
  Run an example in the terminal (`repl`):
23
35
 
@@ -75,9 +87,12 @@ npx @bolt-foundry/gambit <command>
75
87
  Run a deck once:
76
88
 
77
89
  ```
78
- npx @bolt-foundry/gambit run <deck> --init <json|string> --message <json|string>
90
+ npx @bolt-foundry/gambit run <deck> --context <json|string> --message <json|string>
79
91
  ```
80
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
+
81
96
  Drop into a REPL (streams by default):
82
97
 
83
98
  ```
@@ -177,7 +192,7 @@ You are a concise assistant. Greet the user and echo the input.
177
192
  Run it:
178
193
 
179
194
  ```
180
- npx @bolt-foundry/gambit run ./hello_world.deck.md --init '"Gambit"' --stream
195
+ npx @bolt-foundry/gambit run ./hello_world.deck.md --context '"Gambit"' --stream
181
196
  ```
182
197
 
183
198
  ### Compute deck in TypeScript (no model call): `echo.deck.ts`
@@ -200,7 +215,7 @@ export default defineDeck({
200
215
  Run it:
201
216
 
202
217
  ```
203
- npx @bolt-foundry/gambit run ./echo.deck.ts --init '{"text":"ping"}'
218
+ npx @bolt-foundry/gambit run ./echo.deck.ts --context '{"text":"ping"}'
204
219
  ```
205
220
 
206
221
  ### Deck with a child action (calls a TypeScript tool): `agent_with_time.deck.md`
@@ -238,7 +253,7 @@ export default defineDeck({
238
253
  Run it:
239
254
 
240
255
  ```
241
- npx @bolt-foundry/gambit run ./agent_with_time.deck.md --init '"hello"' --stream
256
+ npx @bolt-foundry/gambit run ./agent_with_time.deck.md --context '"hello"' --stream
242
257
  ```
243
258
 
244
259
  ## Deno
@@ -249,13 +264,19 @@ Quickstart:
249
264
 
250
265
  ```
251
266
  export OPENROUTER_API_KEY=...
252
- deno run -A jsr:@bolt-foundry/gambit/cli init
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
253
274
  ```
254
275
 
255
276
  Run a deck:
256
277
 
257
278
  ```
258
- deno run -A jsr:@bolt-foundry/gambit/cli run <deck> --init <json|string> --message <json|string>
279
+ deno run -A jsr:@bolt-foundry/gambit/cli run <deck> --context <json|string> --message <json|string>
259
280
  ```
260
281
 
261
282
  Start the Debug UI:
@@ -6,9 +6,9 @@ export declare function slugifyDeckPath(deckPath: string): string;
6
6
  export declare function defaultSessionRoot(deckPath: string): string;
7
7
  export declare function defaultTestBotStatePath(deckPath: string): string;
8
8
  export declare function enrichStateMeta(state: SavedState, deckPath: string): SavedState;
9
- export declare function parseInit(raw?: string): unknown;
9
+ export declare function parseContext(raw?: string): unknown;
10
10
  export declare function parseMessage(raw?: string): unknown;
11
11
  export declare function parseBotInput(raw?: string): unknown;
12
12
  export declare function findLastAssistantMessage(messages: Array<ModelMessage>): string | undefined;
13
- export declare function extractInitInput(state?: SavedState): unknown;
13
+ export declare function extractContextInput(state?: SavedState): unknown;
14
14
  //# sourceMappingURL=cli_utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli_utils.d.ts","sourceRoot":"","sources":["../../src/src/cli_utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,KAAK,SAAS,GACb,MAAM,GAAG,SAAS,CAOpB;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,GACxC,KAAK,CAAC,MAAM,CAAC,CAGf;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQxD;AAuBD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM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ACf,UAAU,CAOZ;AAED,wBAAgB,YAAY,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAOlD;AAED,wBAAgB,YAAY,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAOlD;AAED,wBAAgB,aAAa,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAC5B,MAAM,GAAG,SAAS,CAUpB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAe/D"}
@@ -64,7 +64,7 @@ export function enrichStateMeta(state, deckPath) {
64
64
  }
65
65
  return { ...state, meta };
66
66
  }
67
- export function parseInit(raw) {
67
+ export function parseContext(raw) {
68
68
  if (raw === undefined)
69
69
  return undefined;
70
70
  try {
@@ -105,7 +105,7 @@ export function findLastAssistantMessage(messages) {
105
105
  }
106
106
  return undefined;
107
107
  }
108
- export function extractInitInput(state) {
108
+ export function extractContextInput(state) {
109
109
  if (!state?.messages)
110
110
  return undefined;
111
111
  for (let i = state.messages.length - 1; i >= 0; i--) {
@@ -8,6 +8,8 @@ export declare function startWebSocketSimulator(opts: {
8
8
  modelProvider: ModelProvider;
9
9
  model?: string;
10
10
  modelForce?: string;
11
+ initialContext?: unknown;
12
+ contextProvided?: boolean;
11
13
  port?: number;
12
14
  verbose?: boolean;
13
15
  signal?: AbortSignal;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/src/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAY5C,OAAO,KAAK,EAGV,aAAa,EAEd,MAAM,2BAA2B,CAAC;AAuanC;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CA8wExC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/src/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAY5C,OAAO,KAAK,EAGV,aAAa,EAEd,MAAM,2BAA2B,CAAC;AAuanC;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CA2xExC"}
package/esm/src/server.js CHANGED
@@ -312,6 +312,9 @@ function deriveInitialFromSchema(schema) {
312
312
  */
313
313
  export function startWebSocketSimulator(opts) {
314
314
  const port = opts.port ?? 8000;
315
+ const initialContext = opts.initialContext;
316
+ const hasInitialContext = opts.contextProvided ??
317
+ (initialContext !== undefined);
315
318
  const consoleTracer = opts.verbose ? makeConsoleTracer() : undefined;
316
319
  let resolvedDeckPath = resolveDeckPath(opts.deckPath);
317
320
  const sessionsRoot = (() => {
@@ -958,8 +961,14 @@ export function startWebSocketSimulator(opts) {
958
961
  return null;
959
962
  });
960
963
  const schemaPromise = deckLoadPromise
961
- .then((deck) => deck ? describeZodSchema(deck.inputSchema) : {
962
- error: "Deck failed to load",
964
+ .then((deck) => {
965
+ const desc = deck ? describeZodSchema(deck.inputSchema) : {
966
+ error: "Deck failed to load",
967
+ };
968
+ if (hasInitialContext) {
969
+ return { ...desc, defaults: initialContext };
970
+ }
971
+ return desc;
963
972
  })
964
973
  .catch((err) => {
965
974
  const message = err instanceof Error ? err.message : String(err);
@@ -1467,7 +1476,10 @@ export function startWebSocketSimulator(opts) {
1467
1476
  if (typeof body.maxTurns === "number" && Number.isFinite(body.maxTurns)) {
1468
1477
  maxTurnsOverride = body.maxTurns;
1469
1478
  }
1470
- deckInput = body.init;
1479
+ deckInput = body.context ?? body.init;
1480
+ if (body.init !== undefined && body.context === undefined) {
1481
+ logger.warn('[gambit] Received deprecated "init" field in test-bot API; use "context" instead.');
1482
+ }
1471
1483
  botInput = body.botInput;
1472
1484
  await deckLoadPromise.catch(() => null);
1473
1485
  if (typeof body.botDeckPath === "string") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolt-foundry/gambit",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "description": "Agent harness framework for building, running, and verifying LLM workflows in Markdown and code.",
5
5
  "homepage": "https://github.com/bolt-foundry/gambit",
6
6
  "repository": {
@@ -24,7 +24,7 @@
24
24
  "gambit": "bin/gambit.cjs"
25
25
  },
26
26
  "dependencies": {
27
- "@bolt-foundry/gambit-core": "^0.7.0",
27
+ "@bolt-foundry/gambit-core": "^0.8.1",
28
28
  "zod": "^3.23.8",
29
29
  "@deno/shim-deno": "~0.18.0"
30
30
  },
@@ -6,9 +6,9 @@ export declare function slugifyDeckPath(deckPath: string): string;
6
6
  export declare function defaultSessionRoot(deckPath: string): string;
7
7
  export declare function defaultTestBotStatePath(deckPath: string): string;
8
8
  export declare function enrichStateMeta(state: SavedState, deckPath: string): SavedState;
9
- export declare function parseInit(raw?: string): unknown;
9
+ export declare function parseContext(raw?: string): unknown;
10
10
  export declare function parseMessage(raw?: string): unknown;
11
11
  export declare function parseBotInput(raw?: string): unknown;
12
12
  export declare function findLastAssistantMessage(messages: Array<ModelMessage>): string | undefined;
13
- export declare function extractInitInput(state?: SavedState): unknown;
13
+ export declare function extractContextInput(state?: SavedState): unknown;
14
14
  //# sourceMappingURL=cli_utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli_utils.d.ts","sourceRoot":"","sources":["../../src/src/cli_utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,KAAK,SAAS,GACb,MAAM,GAAG,SAAS,CAOpB;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,GACxC,KAAK,CAAC,MAAM,CAAC,CAGf;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQxD;AAuBD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM3D;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQhE;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,MAA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AAED,wBAAgB,aAAa,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAC5B,MAAM,GAAG,SAAS,CAUpB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAe/D"}
@@ -39,11 +39,11 @@ exports.slugifyDeckPath = slugifyDeckPath;
39
39
  exports.defaultSessionRoot = defaultSessionRoot;
40
40
  exports.defaultTestBotStatePath = defaultTestBotStatePath;
41
41
  exports.enrichStateMeta = enrichStateMeta;
42
- exports.parseInit = parseInit;
42
+ exports.parseContext = parseContext;
43
43
  exports.parseMessage = parseMessage;
44
44
  exports.parseBotInput = parseBotInput;
45
45
  exports.findLastAssistantMessage = findLastAssistantMessage;
46
- exports.extractInitInput = extractInitInput;
46
+ exports.extractContextInput = extractContextInput;
47
47
  const dntShim = __importStar(require("../_dnt.shims.js"));
48
48
  const path = __importStar(require("../deps/jsr.io/@std/path/1.1.4/mod.js"));
49
49
  const gambit_core_1 = require("@bolt-foundry/gambit-core");
@@ -110,7 +110,7 @@ function enrichStateMeta(state, deckPath) {
110
110
  }
111
111
  return { ...state, meta };
112
112
  }
113
- function parseInit(raw) {
113
+ function parseContext(raw) {
114
114
  if (raw === undefined)
115
115
  return undefined;
116
116
  try {
@@ -151,7 +151,7 @@ function findLastAssistantMessage(messages) {
151
151
  }
152
152
  return undefined;
153
153
  }
154
- function extractInitInput(state) {
154
+ function extractContextInput(state) {
155
155
  if (!state?.messages)
156
156
  return undefined;
157
157
  for (let i = state.messages.length - 1; i >= 0; i--) {
@@ -8,6 +8,8 @@ export declare function startWebSocketSimulator(opts: {
8
8
  modelProvider: ModelProvider;
9
9
  model?: string;
10
10
  modelForce?: string;
11
+ initialContext?: unknown;
12
+ contextProvided?: boolean;
11
13
  port?: number;
12
14
  verbose?: boolean;
13
15
  signal?: AbortSignal;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/src/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAY5C,OAAO,KAAK,EAGV,aAAa,EAEd,MAAM,2BAA2B,CAAC;AAuanC;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CA8wExC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/src/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAY5C,OAAO,KAAK,EAGV,aAAa,EAEd,MAAM,2BAA2B,CAAC;AAuanC;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,aAAa,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CA2xExC"}
@@ -348,6 +348,9 @@ function deriveInitialFromSchema(schema) {
348
348
  */
349
349
  function startWebSocketSimulator(opts) {
350
350
  const port = opts.port ?? 8000;
351
+ const initialContext = opts.initialContext;
352
+ const hasInitialContext = opts.contextProvided ??
353
+ (initialContext !== undefined);
351
354
  const consoleTracer = opts.verbose ? (0, trace_js_1.makeConsoleTracer)() : undefined;
352
355
  let resolvedDeckPath = resolveDeckPath(opts.deckPath);
353
356
  const sessionsRoot = (() => {
@@ -994,8 +997,14 @@ function startWebSocketSimulator(opts) {
994
997
  return null;
995
998
  });
996
999
  const schemaPromise = deckLoadPromise
997
- .then((deck) => deck ? describeZodSchema(deck.inputSchema) : {
998
- error: "Deck failed to load",
1000
+ .then((deck) => {
1001
+ const desc = deck ? describeZodSchema(deck.inputSchema) : {
1002
+ error: "Deck failed to load",
1003
+ };
1004
+ if (hasInitialContext) {
1005
+ return { ...desc, defaults: initialContext };
1006
+ }
1007
+ return desc;
999
1008
  })
1000
1009
  .catch((err) => {
1001
1010
  const message = err instanceof Error ? err.message : String(err);
@@ -1503,7 +1512,10 @@ function startWebSocketSimulator(opts) {
1503
1512
  if (typeof body.maxTurns === "number" && Number.isFinite(body.maxTurns)) {
1504
1513
  maxTurnsOverride = body.maxTurns;
1505
1514
  }
1506
- deckInput = body.init;
1515
+ deckInput = body.context ?? body.init;
1516
+ if (body.init !== undefined && body.context === undefined) {
1517
+ logger.warn('[gambit] Received deprecated "init" field in test-bot API; use "context" instead.');
1518
+ }
1507
1519
  botInput = body.botInput;
1508
1520
  await deckLoadPromise.catch(() => null);
1509
1521
  if (typeof body.botDeckPath === "string") {