@bolt-foundry/gambit 0.8.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,14 +1,18 @@
1
1
  +++
2
2
  [release]
3
- since = "692534996df73790229b8303516d48be66136fce"
3
+ since = "769d3de436e4542ed7d0d80201f665657d93efb2"
4
4
  +++
5
5
 
6
6
  # Changelog
7
7
 
8
- ## Unreleased (v0.8.1)
8
+ ## Unreleased (v0.8.2)
9
9
 
10
10
  - TBD
11
11
 
12
+ ## v0.8.1
13
+
14
+ - fix(gambit): include gambit-core cards/schemas in compiled binary
15
+
12
16
  ## v0.8.0
13
17
 
14
18
  - chore(gambit): prepare 0.8.0 changelog
package/esm/mod.d.ts CHANGED
@@ -35,11 +35,11 @@ export { runDeck } from "@bolt-foundry/gambit-core";
35
35
  /** Signal for explicitly ending a Gambit run. */
36
36
  export type { GambitEndSignal } from "@bolt-foundry/gambit-core";
37
37
  /** OpenAI Chat Completions compatibility helper for a deck. */
38
- export { chatCompletionsWithDeck } from "./src/compat/openai.js";
38
+ export { chatCompletionsWithDeck } from "@bolt-foundry/gambit-core";
39
39
  /** OpenAI-compatible request payload. */
40
- export type { ChatCompletionsRequest } from "./src/compat/openai.js";
40
+ export type { ChatCompletionsRequest } from "@bolt-foundry/gambit-core";
41
41
  /** OpenAI-compatible response payload. */
42
- export type { ChatCompletionsResponse } from "./src/compat/openai.js";
42
+ export type { ChatCompletionsResponse } from "@bolt-foundry/gambit-core";
43
43
  /** Render a deck to a human-readable outline or debug view. */
44
44
  export { renderDeck } from "@bolt-foundry/gambit-core";
45
45
  /** Options for deck rendering. */
@@ -47,7 +47,7 @@ export type { RenderDeckOptions } from "@bolt-foundry/gambit-core";
47
47
  /** Result data from rendering a deck. */
48
48
  export type { RenderDeckResult } from "@bolt-foundry/gambit-core";
49
49
  /** Provider factory for OpenRouter-backed model calls. */
50
- export { createOpenRouterProvider } from "./src/providers/openrouter.js";
50
+ export { createOpenRouterProvider } from "@bolt-foundry/gambit-core";
51
51
  /** Start the WebSocket simulator server for the Gambit UI. */
52
52
  export { startWebSocketSimulator } from "./src/server.js";
53
53
  //# sourceMappingURL=mod.d.ts.map
package/esm/mod.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,yEAAyE;AACzE,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,oDAAoD;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,oCAAoC;AACpC,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,6BAA6B;AAC7B,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,6BAA6B;AAC7B,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,iCAAiC;AACjC,YAAY,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,yCAAyC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,oCAAoC;AACpC,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,uCAAuC;AACvC,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,2DAA2D;AAC3D,YAAY,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,iDAAiD;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,kCAAkC;AAClC,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,yDAAyD;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,kDAAkD;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,C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AE,MAAM,2BAA2B,CAAC;AACtE,uCAAuC;AACvC,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,2DAA2D;AAC3D,YAAY,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,iDAAiD;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,kCAAkC;AAClC,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,yDAAyD;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,kDAAkD;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,iDAAiD;AACjD,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,+DAA+D;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,yCAAyC;AACzC,YAAY,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,0CAA0C;AAC1C,YAAY,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,+DAA+D;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,kCAAkC;AAClC,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,yCAAyC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,0DAA0D;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,8DAA8D;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC"}
package/esm/mod.js CHANGED
@@ -13,10 +13,10 @@ export { isGambitEndSignal } from "@bolt-foundry/gambit-core";
13
13
  /** Run a deck and return its execution result. */
14
14
  export { runDeck } from "@bolt-foundry/gambit-core";
15
15
  /** OpenAI Chat Completions compatibility helper for a deck. */
16
- export { chatCompletionsWithDeck } from "./src/compat/openai.js";
16
+ export { chatCompletionsWithDeck } from "@bolt-foundry/gambit-core";
17
17
  /** Render a deck to a human-readable outline or debug view. */
18
18
  export { renderDeck } from "@bolt-foundry/gambit-core";
19
19
  /** Provider factory for OpenRouter-backed model calls. */
20
- export { createOpenRouterProvider } from "./src/providers/openrouter.js";
20
+ export { createOpenRouterProvider } from "@bolt-foundry/gambit-core";
21
21
  /** Start the WebSocket simulator server for the Gambit UI. */
22
22
  export { startWebSocketSimulator } from "./src/server.js";
@@ -1,4 +1,5 @@
1
- import type { OpenResponseItem, SavedState } from "@bolt-foundry/gambit-core";
1
+ import type { ModelMessage } from "@bolt-foundry/gambit-core";
2
+ import type { SavedState } from "@bolt-foundry/gambit-core";
2
3
  export declare function parsePortValue(value: unknown, label?: string): number | undefined;
3
4
  export declare function normalizeFlagList(value: string | Array<string> | undefined): Array<string>;
4
5
  export declare function slugifyDeckPath(deckPath: string): string;
@@ -8,6 +9,6 @@ export declare function enrichStateMeta(state: SavedState, deckPath: string): Sa
8
9
  export declare function parseContext(raw?: string): unknown;
9
10
  export declare function parseMessage(raw?: string): unknown;
10
11
  export declare function parseBotInput(raw?: string): unknown;
11
- export declare function findLastAssistantMessage(messages: Array<OpenResponseItem>): string | undefined;
12
+ export declare function findLastAssistantMessage(messages: Array<ModelMessage>): string | undefined;
12
13
  export declare function extractContextInput(state?: SavedState): unknown;
13
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,EAEV,gBAAgB,EAChB,UAAU,EACX,MAAM,2BAA2B,CAAC;AAEnC,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,SA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GAAG,MAAM,CAM3D;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQhE;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,MAAM,GACf,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"}
@@ -94,32 +94,13 @@ export function parseBotInput(raw) {
94
94
  return raw;
95
95
  }
96
96
  }
97
- function contentText(parts) {
98
- return parts.map((part) => {
99
- switch (part.type) {
100
- case "input_text":
101
- case "output_text":
102
- case "text":
103
- case "summary_text":
104
- case "reasoning_text":
105
- return part.text;
106
- case "refusal":
107
- return part.refusal;
108
- default:
109
- return "";
110
- }
111
- }).join("");
112
- }
113
97
  export function findLastAssistantMessage(messages) {
114
98
  for (let i = messages.length - 1; i >= 0; i--) {
115
99
  const msg = messages[i];
116
- if (msg?.type === "message" && msg.role === "assistant") {
117
- if (typeof msg.content === "string")
118
- return msg.content;
119
- if (Array.isArray(msg.content)) {
120
- return contentText(msg.content);
121
- }
122
- return JSON.stringify(msg.content ?? "");
100
+ if (msg?.role === "assistant") {
101
+ return typeof msg.content === "string"
102
+ ? msg.content
103
+ : JSON.stringify(msg.content ?? "");
123
104
  }
124
105
  }
125
106
  return undefined;
@@ -129,8 +110,7 @@ export function extractContextInput(state) {
129
110
  return undefined;
130
111
  for (let i = state.messages.length - 1; i >= 0; i--) {
131
112
  const msg = state.messages[i];
132
- if (msg.type === "message" && msg.role === "tool" &&
133
- msg.name === GAMBIT_TOOL_INIT) {
113
+ if (msg.role === "tool" && msg.name === GAMBIT_TOOL_INIT) {
134
114
  const content = msg.content;
135
115
  if (typeof content !== "string")
136
116
  return undefined;
@@ -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,EAEV,aAAa,EAKd,MAAM,2BAA2B,CAAC;AAogBnC;;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,CA60ExC"}
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
@@ -62,87 +62,6 @@ function randomId(prefix) {
62
62
  const suffix = crypto.randomUUID().replace(/-/g, "").slice(0, 24);
63
63
  return `${prefix}-${suffix}`;
64
64
  }
65
- async function parseOpenResponseRequest(req) {
66
- try {
67
- return await req.json();
68
- }
69
- catch {
70
- return null;
71
- }
72
- }
73
- function formatOpenResponseSseEvent(event) {
74
- return `event: ${event.type}\ndata: ${JSON.stringify(event)}\n\n`;
75
- }
76
- function formatOpenResponseDoneEvent() {
77
- return "data: [DONE]\n\n";
78
- }
79
- function createOpenResponseStream(req, provider, payload) {
80
- const encoder = new TextEncoder();
81
- const stream = new ReadableStream({
82
- start(controller) {
83
- let closed = false;
84
- let completed = false;
85
- const close = () => {
86
- if (closed)
87
- return;
88
- closed = true;
89
- controller.close();
90
- };
91
- const send = (chunk) => {
92
- if (closed)
93
- return;
94
- controller.enqueue(encoder.encode(chunk));
95
- };
96
- const sendDone = () => {
97
- if (closed)
98
- return;
99
- send(formatOpenResponseDoneEvent());
100
- close();
101
- };
102
- const sendEvent = (event) => {
103
- if (closed)
104
- return;
105
- send(formatOpenResponseSseEvent(event));
106
- if (event.type === "response.completed") {
107
- completed = true;
108
- sendDone();
109
- }
110
- };
111
- req.signal.addEventListener("abort", () => {
112
- close();
113
- });
114
- (async () => {
115
- try {
116
- const response = await provider.responses({
117
- ...payload,
118
- stream: true,
119
- onStreamEvent: sendEvent,
120
- });
121
- if (!completed) {
122
- sendEvent({ type: "response.completed", response });
123
- sendDone();
124
- }
125
- }
126
- catch (err) {
127
- const message = err instanceof Error ? err.message : String(err);
128
- sendEvent({
129
- type: "error",
130
- error: { code: "server_error", message },
131
- });
132
- sendDone();
133
- }
134
- })();
135
- },
136
- });
137
- return new Response(stream, {
138
- status: 200,
139
- headers: {
140
- "Content-Type": "text/event-stream",
141
- "Cache-Control": "no-cache",
142
- "Connection": "keep-alive",
143
- },
144
- });
145
- }
146
65
  function resolveDefaultValue(raw) {
147
66
  if (typeof raw === "function") {
148
67
  try {
@@ -393,6 +312,9 @@ function deriveInitialFromSchema(schema) {
393
312
  */
394
313
  export function startWebSocketSimulator(opts) {
395
314
  const port = opts.port ?? 8000;
315
+ const initialContext = opts.initialContext;
316
+ const hasInitialContext = opts.contextProvided ??
317
+ (initialContext !== undefined);
396
318
  const consoleTracer = opts.verbose ? makeConsoleTracer() : undefined;
397
319
  let resolvedDeckPath = resolveDeckPath(opts.deckPath);
398
320
  const sessionsRoot = (() => {
@@ -610,12 +532,6 @@ export function startWebSocketSimulator(opts) {
610
532
  return "";
611
533
  if (typeof value === "string")
612
534
  return value;
613
- if (Array.isArray(value)) {
614
- return value
615
- .map((part) => typeof part === "string" ? part : part.text ??
616
- "")
617
- .join("");
618
- }
619
535
  try {
620
536
  return JSON.stringify(value);
621
537
  }
@@ -675,8 +591,7 @@ export function startWebSocketSimulator(opts) {
675
591
  const fallbackToolInserts = [];
676
592
  for (let i = 0; i < rawMessages.length; i++) {
677
593
  const msg = rawMessages[i];
678
- if (msg?.type === "message" &&
679
- (msg.role === "assistant" || msg.role === "user")) {
594
+ if (msg?.role === "assistant" || msg?.role === "user") {
680
595
  const content = stringifyContent(msg.content).trim();
681
596
  if (!content)
682
597
  continue;
@@ -689,7 +604,7 @@ export function startWebSocketSimulator(opts) {
689
604
  });
690
605
  continue;
691
606
  }
692
- if (msg?.type === "message" && msg.role === "tool") {
607
+ if (msg?.role === "tool") {
693
608
  const actionCallId = typeof msg.tool_call_id === "string"
694
609
  ? msg.tool_call_id
695
610
  : undefined;
@@ -825,7 +740,7 @@ export function startWebSocketSimulator(opts) {
825
740
  const getLastAssistantMessage = (history) => {
826
741
  for (let i = history.length - 1; i >= 0; i--) {
827
742
  const msg = history[i];
828
- if (msg?.type === "message" && msg.role === "assistant") {
743
+ if (msg?.role === "assistant") {
829
744
  return stringifyContent(msg.content);
830
745
  }
831
746
  }
@@ -1046,8 +961,14 @@ export function startWebSocketSimulator(opts) {
1046
961
  return null;
1047
962
  });
1048
963
  const schemaPromise = deckLoadPromise
1049
- .then((deck) => deck ? describeZodSchema(deck.inputSchema) : {
1050
- 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;
1051
972
  })
1052
973
  .catch((err) => {
1053
974
  const message = err instanceof Error ? err.message : String(err);
@@ -1088,43 +1009,6 @@ export function startWebSocketSimulator(opts) {
1088
1009
  }
1089
1010
  const server = dntShim.Deno.serve({ port, signal: opts.signal, onListen: () => { } }, async (req) => {
1090
1011
  const url = new URL(req.url);
1091
- if (url.pathname === "/v1/responses") {
1092
- if (req.method !== "POST") {
1093
- return new Response("Method not allowed", { status: 405 });
1094
- }
1095
- const payload = await parseOpenResponseRequest(req);
1096
- if (!payload) {
1097
- return new Response("Invalid JSON payload", { status: 400 });
1098
- }
1099
- const model = payload.model ?? opts.model;
1100
- if (!model) {
1101
- return new Response("Missing model", { status: 400 });
1102
- }
1103
- const requestPayload = {
1104
- ...payload,
1105
- model,
1106
- input: payload.input ?? null,
1107
- };
1108
- if (payload.stream) {
1109
- return createOpenResponseStream(req, opts.modelProvider, requestPayload);
1110
- }
1111
- try {
1112
- const response = await opts.modelProvider.responses({
1113
- ...requestPayload,
1114
- stream: false,
1115
- });
1116
- return new Response(JSON.stringify(response), {
1117
- headers: { "content-type": "application/json" },
1118
- });
1119
- }
1120
- catch (err) {
1121
- const message = err instanceof Error ? err.message : String(err);
1122
- return new Response(JSON.stringify({ error: message }), {
1123
- status: 500,
1124
- headers: { "content-type": "application/json" },
1125
- });
1126
- }
1127
- }
1128
1012
  if (url.pathname.startsWith("/api/durable-streams/stream/")) {
1129
1013
  return handleDurableStreamRequest(req);
1130
1014
  }
@@ -1175,9 +1059,7 @@ export function startWebSocketSimulator(opts) {
1175
1059
  })();
1176
1060
  const sessionPayload = {
1177
1061
  messages: Array.isArray(sessionState.messages)
1178
- ? sessionState.messages
1179
- .filter((msg) => msg.type === "message")
1180
- .map((msg) => ({
1062
+ ? sessionState.messages.map((msg) => ({
1181
1063
  role: msg.role,
1182
1064
  content: msg.content,
1183
1065
  name: msg.name,
@@ -2205,13 +2087,7 @@ export function startWebSocketSimulator(opts) {
2205
2087
  Array.isArray(state.messages)) {
2206
2088
  const idx = state.messageRefs.findIndex((ref) => ref?.id === messageRefId);
2207
2089
  if (idx >= 0) {
2208
- const item = state.messages[idx];
2209
- if (item?.type === "message") {
2210
- messageContent = stringifyContent(item.content);
2211
- }
2212
- else {
2213
- messageContent = undefined;
2214
- }
2090
+ messageContent = state.messages[idx]?.content;
2215
2091
  }
2216
2092
  }
2217
2093
  items.push({
@@ -1 +1 @@
1
- {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/src/trace.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAI5D,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAQ7E;AAED,wBAAgB,iBAAiB,IAAI,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAsI/D"}
1
+ {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/src/trace.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAI5D,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAQ7E;AAED,wBAAgB,iBAAiB,IAAI,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAmI/D"}
package/esm/src/trace.js CHANGED
@@ -31,10 +31,7 @@ export function makeConsoleTracer() {
31
31
  break;
32
32
  }
33
33
  case "message.user": {
34
- const messageContent = event.message?.type === "message"
35
- ? event.message.content
36
- : event.message;
37
- logger.log(`[trace] message.user runId=${event.runId} actionCallId=${event.actionCallId} deck=${event.deckPath} content=${JSON.stringify(messageContent ?? "")}`);
34
+ logger.log(`[trace] message.user runId=${event.runId} actionCallId=${event.actionCallId} deck=${event.deckPath} content=${JSON.stringify(event.message?.content ?? "")}`);
38
35
  break;
39
36
  }
40
37
  case "deck.start":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolt-foundry/gambit",
3
- "version": "0.8.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,8 +24,7 @@
24
24
  "gambit": "bin/gambit.cjs"
25
25
  },
26
26
  "dependencies": {
27
- "@bolt-foundry/gambit-core": "^0.8.0",
28
- "openai": "^4.78.1",
27
+ "@bolt-foundry/gambit-core": "^0.8.1",
29
28
  "zod": "^3.23.8",
30
29
  "@deno/shim-deno": "~0.18.0"
31
30
  },
package/script/mod.d.ts CHANGED
@@ -35,11 +35,11 @@ export { runDeck } from "@bolt-foundry/gambit-core";
35
35
  /** Signal for explicitly ending a Gambit run. */
36
36
  export type { GambitEndSignal } from "@bolt-foundry/gambit-core";
37
37
  /** OpenAI Chat Completions compatibility helper for a deck. */
38
- export { chatCompletionsWithDeck } from "./src/compat/openai.js";
38
+ export { chatCompletionsWithDeck } from "@bolt-foundry/gambit-core";
39
39
  /** OpenAI-compatible request payload. */
40
- export type { ChatCompletionsRequest } from "./src/compat/openai.js";
40
+ export type { ChatCompletionsRequest } from "@bolt-foundry/gambit-core";
41
41
  /** OpenAI-compatible response payload. */
42
- export type { ChatCompletionsResponse } from "./src/compat/openai.js";
42
+ export type { ChatCompletionsResponse } from "@bolt-foundry/gambit-core";
43
43
  /** Render a deck to a human-readable outline or debug view. */
44
44
  export { renderDeck } from "@bolt-foundry/gambit-core";
45
45
  /** Options for deck rendering. */
@@ -47,7 +47,7 @@ export type { RenderDeckOptions } from "@bolt-foundry/gambit-core";
47
47
  /** Result data from rendering a deck. */
48
48
  export type { RenderDeckResult } from "@bolt-foundry/gambit-core";
49
49
  /** Provider factory for OpenRouter-backed model calls. */
50
- export { createOpenRouterProvider } from "./src/providers/openrouter.js";
50
+ export { createOpenRouterProvider } from "@bolt-foundry/gambit-core";
51
51
  /** Start the WebSocket simulator server for the Gambit UI. */
52
52
  export { startWebSocketSimulator } from "./src/server.js";
53
53
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,yEAAyE;AACzE,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,oDAAoD;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,oCAAoC;AACpC,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,6B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,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,yCAAyC;AACzC,YAAY,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,0CAA0C;AAC1C,YAAY,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,+DAA+D;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,kCAAkC;AAClC,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,yCAAyC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,0DAA0D;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,8DAA8D;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC"}
package/script/mod.js CHANGED
@@ -20,14 +20,14 @@ Object.defineProperty(exports, "isGambitEndSignal", { enumerable: true, get: fun
20
20
  var gambit_core_4 = require("@bolt-foundry/gambit-core");
21
21
  Object.defineProperty(exports, "runDeck", { enumerable: true, get: function () { return gambit_core_4.runDeck; } });
22
22
  /** OpenAI Chat Completions compatibility helper for a deck. */
23
- var openai_js_1 = require("./src/compat/openai.js");
24
- Object.defineProperty(exports, "chatCompletionsWithDeck", { enumerable: true, get: function () { return openai_js_1.chatCompletionsWithDeck; } });
25
- /** Render a deck to a human-readable outline or debug view. */
26
23
  var gambit_core_5 = require("@bolt-foundry/gambit-core");
27
- Object.defineProperty(exports, "renderDeck", { enumerable: true, get: function () { return gambit_core_5.renderDeck; } });
24
+ Object.defineProperty(exports, "chatCompletionsWithDeck", { enumerable: true, get: function () { return gambit_core_5.chatCompletionsWithDeck; } });
25
+ /** Render a deck to a human-readable outline or debug view. */
26
+ var gambit_core_6 = require("@bolt-foundry/gambit-core");
27
+ Object.defineProperty(exports, "renderDeck", { enumerable: true, get: function () { return gambit_core_6.renderDeck; } });
28
28
  /** Provider factory for OpenRouter-backed model calls. */
29
- var openrouter_js_1 = require("./src/providers/openrouter.js");
30
- Object.defineProperty(exports, "createOpenRouterProvider", { enumerable: true, get: function () { return openrouter_js_1.createOpenRouterProvider; } });
29
+ var gambit_core_7 = require("@bolt-foundry/gambit-core");
30
+ Object.defineProperty(exports, "createOpenRouterProvider", { enumerable: true, get: function () { return gambit_core_7.createOpenRouterProvider; } });
31
31
  /** Start the WebSocket simulator server for the Gambit UI. */
32
32
  var server_js_1 = require("./src/server.js");
33
33
  Object.defineProperty(exports, "startWebSocketSimulator", { enumerable: true, get: function () { return server_js_1.startWebSocketSimulator; } });
@@ -1,4 +1,5 @@
1
- import type { OpenResponseItem, SavedState } from "@bolt-foundry/gambit-core";
1
+ import type { ModelMessage } from "@bolt-foundry/gambit-core";
2
+ import type { SavedState } from "@bolt-foundry/gambit-core";
2
3
  export declare function parsePortValue(value: unknown, label?: string): number | undefined;
3
4
  export declare function normalizeFlagList(value: string | Array<string> | undefined): Array<string>;
4
5
  export declare function slugifyDeckPath(deckPath: string): string;
@@ -8,6 +9,6 @@ export declare function enrichStateMeta(state: SavedState, deckPath: string): Sa
8
9
  export declare function parseContext(raw?: string): unknown;
9
10
  export declare function parseMessage(raw?: string): unknown;
10
11
  export declare function parseBotInput(raw?: string): unknown;
11
- export declare function findLastAssistantMessage(messages: Array<OpenResponseItem>): string | undefined;
12
+ export declare function findLastAssistantMessage(messages: Array<ModelMessage>): string | undefined;
12
13
  export declare function extractContextInput(state?: SavedState): unknown;
13
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,EAEV,gBAAgB,EAChB,UAAU,EACX,MAAM,2BAA2B,CAAC;AAEnC,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,KAAK,SAAS,GACb,MAAM,GAAG,SAAS,CAOpB;AAED,wBAAgB,iBAAiB,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,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,MAAM,GACf,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"}
@@ -140,32 +140,13 @@ function parseBotInput(raw) {
140
140
  return raw;
141
141
  }
142
142
  }
143
- function contentText(parts) {
144
- return parts.map((part) => {
145
- switch (part.type) {
146
- case "input_text":
147
- case "output_text":
148
- case "text":
149
- case "summary_text":
150
- case "reasoning_text":
151
- return part.text;
152
- case "refusal":
153
- return part.refusal;
154
- default:
155
- return "";
156
- }
157
- }).join("");
158
- }
159
143
  function findLastAssistantMessage(messages) {
160
144
  for (let i = messages.length - 1; i >= 0; i--) {
161
145
  const msg = messages[i];
162
- if (msg?.type === "message" && msg.role === "assistant") {
163
- if (typeof msg.content === "string")
164
- return msg.content;
165
- if (Array.isArray(msg.content)) {
166
- return contentText(msg.content);
167
- }
168
- return JSON.stringify(msg.content ?? "");
146
+ if (msg?.role === "assistant") {
147
+ return typeof msg.content === "string"
148
+ ? msg.content
149
+ : JSON.stringify(msg.content ?? "");
169
150
  }
170
151
  }
171
152
  return undefined;
@@ -175,8 +156,7 @@ function extractContextInput(state) {
175
156
  return undefined;
176
157
  for (let i = state.messages.length - 1; i >= 0; i--) {
177
158
  const msg = state.messages[i];
178
- if (msg.type === "message" && msg.role === "tool" &&
179
- msg.name === gambit_core_1.GAMBIT_TOOL_INIT) {
159
+ if (msg.role === "tool" && msg.name === gambit_core_1.GAMBIT_TOOL_INIT) {
180
160
  const content = msg.content;
181
161
  if (typeof content !== "string")
182
162
  return undefined;
@@ -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,EAEV,aAAa,EAKd,MAAM,2BAA2B,CAAC;AAogBnC;;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,CA60ExC"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/src/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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