@bolt-foundry/gambit 0.6.0 → 0.6.2

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 (55) hide show
  1. package/CHANGELOG.md +15 -3
  2. package/README.md +4 -4
  3. package/esm/mod.d.ts +22 -22
  4. package/esm/mod.d.ts.map +1 -1
  5. package/esm/mod.js +7 -7
  6. package/esm/src/server.d.ts +1 -1
  7. package/esm/src/server.d.ts.map +1 -1
  8. package/esm/src/server.js +2 -2
  9. package/esm/src/trace.d.ts +1 -1
  10. package/esm/src/trace.d.ts.map +1 -1
  11. package/package.json +2 -4
  12. package/script/mod.d.ts +22 -22
  13. package/script/mod.d.ts.map +1 -1
  14. package/script/mod.js +14 -14
  15. package/script/src/server.d.ts +1 -1
  16. package/script/src/server.d.ts.map +1 -1
  17. package/script/src/server.js +12 -12
  18. package/script/src/trace.d.ts +1 -1
  19. package/script/src/trace.d.ts.map +1 -1
  20. package/esm/packages/gambit-core/mod.d.ts +0 -50
  21. package/esm/packages/gambit-core/mod.d.ts.map +0 -1
  22. package/esm/packages/gambit-core/mod.js +0 -19
  23. package/esm/packages/gambit-core/src/definitions.d.ts +0 -11
  24. package/esm/packages/gambit-core/src/definitions.d.ts.map +0 -1
  25. package/esm/packages/gambit-core/src/definitions.js +0 -14
  26. package/esm/packages/gambit-core/src/openai_compat.d.ts +0 -63
  27. package/esm/packages/gambit-core/src/openai_compat.d.ts.map +0 -1
  28. package/esm/packages/gambit-core/src/openai_compat.js +0 -272
  29. package/esm/packages/gambit-core/src/providers/openrouter.d.ts +0 -8
  30. package/esm/packages/gambit-core/src/providers/openrouter.d.ts.map +0 -1
  31. package/esm/packages/gambit-core/src/providers/openrouter.js +0 -168
  32. package/esm/packages/gambit-core/src/render.d.ts +0 -51
  33. package/esm/packages/gambit-core/src/render.d.ts.map +0 -1
  34. package/esm/packages/gambit-core/src/render.js +0 -188
  35. package/esm/packages/gambit-core/src/schema.d.ts +0 -8
  36. package/esm/packages/gambit-core/src/schema.d.ts.map +0 -1
  37. package/esm/packages/gambit-core/src/schema.js +0 -45
  38. package/script/packages/gambit-core/mod.d.ts +0 -50
  39. package/script/packages/gambit-core/mod.d.ts.map +0 -1
  40. package/script/packages/gambit-core/mod.js +0 -29
  41. package/script/packages/gambit-core/src/definitions.d.ts +0 -11
  42. package/script/packages/gambit-core/src/definitions.d.ts.map +0 -1
  43. package/script/packages/gambit-core/src/definitions.js +0 -20
  44. package/script/packages/gambit-core/src/openai_compat.d.ts +0 -63
  45. package/script/packages/gambit-core/src/openai_compat.d.ts.map +0 -1
  46. package/script/packages/gambit-core/src/openai_compat.js +0 -276
  47. package/script/packages/gambit-core/src/providers/openrouter.d.ts +0 -8
  48. package/script/packages/gambit-core/src/providers/openrouter.d.ts.map +0 -1
  49. package/script/packages/gambit-core/src/providers/openrouter.js +0 -207
  50. package/script/packages/gambit-core/src/render.d.ts +0 -51
  51. package/script/packages/gambit-core/src/render.d.ts.map +0 -1
  52. package/script/packages/gambit-core/src/render.js +0 -192
  53. package/script/packages/gambit-core/src/schema.d.ts +0 -8
  54. package/script/packages/gambit-core/src/schema.d.ts.map +0 -1
  55. package/script/packages/gambit-core/src/schema.js +0 -51
@@ -1,188 +0,0 @@
1
- import { RESERVED_TOOL_PREFIX } from "@bolt-foundry/gambit-core/internal/constants";
2
- import { loadDeck } from "@bolt-foundry/gambit-core/internal/loader";
3
- import { assertZodSchema, toJsonSchema } from "./schema.js";
4
- export const logger = console;
5
- function normalizeContent(content) {
6
- if (content === null)
7
- return null;
8
- if (typeof content === "string")
9
- return content;
10
- if (!Array.isArray(content))
11
- return String(content);
12
- return content
13
- .map((c) => (typeof c === "string" ? c : (c.text ?? "")))
14
- .join("");
15
- }
16
- function normalizeMessages(input) {
17
- return input.map((m) => ({
18
- role: m.role,
19
- content: normalizeContent(m.content),
20
- name: m.name,
21
- tool_call_id: m.tool_call_id,
22
- tool_calls: m.tool_calls && m.tool_calls.length > 0
23
- ? m.tool_calls
24
- : undefined,
25
- }));
26
- }
27
- function deckSystemPrompt(deck) {
28
- const parts = [];
29
- const prompt = deck.body ?? deck.prompt;
30
- if (prompt)
31
- parts.push(prompt.trim());
32
- if (!deck.inlineEmbeds) {
33
- for (const card of deck.cards) {
34
- if (card.body)
35
- parts.push(card.body.trim());
36
- }
37
- }
38
- return parts.join("\n\n").trim();
39
- }
40
- function shouldPrependDeckSystem(messages, systemPrompt) {
41
- if (!systemPrompt)
42
- return false;
43
- if (!messages.length)
44
- return true;
45
- const hasExact = messages.some((m) => m.role === "system" && m.content === systemPrompt);
46
- return !hasExact;
47
- }
48
- function warnIfSystemMismatch(args) {
49
- if (!args.systemPrompt)
50
- return;
51
- const existing = args.provided.find((m) => m.role === "system");
52
- if (!existing)
53
- return;
54
- if (existing.content === args.systemPrompt)
55
- return;
56
- logger.warn(`[gambit] renderDeck: request includes a system message that does not match the deck prompt (${args.deckPath})`);
57
- }
58
- function toolName(tool) {
59
- return tool.function?.name ?? "";
60
- }
61
- function assertNoToolNameCollisions(args) {
62
- if (!args.externalTools?.length)
63
- return;
64
- const gambit = new Set(args.gambitTools.map(toolName));
65
- for (const t of args.externalTools) {
66
- const name = toolName(t);
67
- if (!name)
68
- continue;
69
- if (name.startsWith(RESERVED_TOOL_PREFIX)) {
70
- throw new Error(`External tool name ${name} is reserved (prefix ${RESERVED_TOOL_PREFIX})`);
71
- }
72
- if (gambit.has(name)) {
73
- throw new Error(`Tool name collision for ${name} between Gambit deck actions and external tools`);
74
- }
75
- }
76
- }
77
- async function buildDeckActionTools(deckPath) {
78
- const deck = await loadDeck(deckPath);
79
- const tools = [];
80
- const actionPathsByName = {};
81
- for (const action of deck.actionDecks) {
82
- const child = await loadDeck(action.path, deck.path);
83
- if (!child.inputSchema || !child.outputSchema) {
84
- throw new Error(`Deck ${child.path} must declare inputSchema and outputSchema (non-root)`);
85
- }
86
- assertZodSchema(child.inputSchema, "inputSchema");
87
- assertZodSchema(child.outputSchema, "outputSchema");
88
- const params = toJsonSchema(child.inputSchema);
89
- tools.push({
90
- type: "function",
91
- function: {
92
- name: action.name,
93
- description: action.description,
94
- parameters: params,
95
- },
96
- });
97
- actionPathsByName[action.name] = action.path;
98
- }
99
- return { tools, actionPathsByName };
100
- }
101
- function mergeModelParams(req, deckParams) {
102
- const out = { ...req };
103
- if (!deckParams)
104
- return out;
105
- if (out.model === undefined && deckParams.model)
106
- out.model = deckParams.model;
107
- if (out.temperature === undefined && deckParams.temperature !== undefined) {
108
- out.temperature = deckParams.temperature;
109
- }
110
- if (out.top_p === undefined && deckParams.top_p !== undefined) {
111
- out.top_p = deckParams.top_p;
112
- }
113
- if (out.frequency_penalty === undefined &&
114
- deckParams.frequency_penalty !== undefined) {
115
- out.frequency_penalty = deckParams.frequency_penalty;
116
- }
117
- if (out.presence_penalty === undefined &&
118
- deckParams.presence_penalty !== undefined) {
119
- out.presence_penalty = deckParams.presence_penalty;
120
- }
121
- if (out.max_tokens === undefined && deckParams.max_tokens !== undefined) {
122
- out.max_tokens = deckParams.max_tokens;
123
- }
124
- return out;
125
- }
126
- export async function renderDeck(opts) {
127
- const includeDeckSystem = opts.includeDeckSystem ?? true;
128
- const includeDeckTools = opts.includeDeckTools ?? true;
129
- const warnOnSystemMismatch = opts.warnOnSystemMismatch ?? true;
130
- const deck = await loadDeck(opts.deckPath);
131
- const systemPrompt = deckSystemPrompt(deck);
132
- const mergedReq = mergeModelParams(opts.request, deck.modelParams);
133
- const providedMessages = normalizeMessages(mergedReq.messages);
134
- const messages = [];
135
- if (includeDeckSystem) {
136
- if (warnOnSystemMismatch) {
137
- warnIfSystemMismatch({
138
- provided: providedMessages,
139
- systemPrompt,
140
- deckPath: deck.path,
141
- });
142
- }
143
- if (shouldPrependDeckSystem(providedMessages, systemPrompt)) {
144
- messages.push({ role: "system", content: systemPrompt });
145
- }
146
- }
147
- messages.push(...providedMessages);
148
- let tools = undefined;
149
- let actionPathsByName = {};
150
- if (includeDeckTools) {
151
- const built = await buildDeckActionTools(deck.path);
152
- actionPathsByName = built.actionPathsByName;
153
- assertNoToolNameCollisions({
154
- gambitTools: built.tools,
155
- externalTools: mergedReq.tools,
156
- });
157
- tools = mergedReq.tools?.length
158
- ? [...built.tools, ...mergedReq.tools]
159
- : built.tools;
160
- }
161
- else if (mergedReq.tools?.length) {
162
- for (const t of mergedReq.tools) {
163
- const name = toolName(t);
164
- if (name.startsWith(RESERVED_TOOL_PREFIX)) {
165
- throw new Error(`External tool name ${name} is reserved (prefix ${RESERVED_TOOL_PREFIX})`);
166
- }
167
- }
168
- tools = mergedReq.tools;
169
- }
170
- const model = String(mergedReq.model ?? "").trim();
171
- if (!model) {
172
- throw new Error(`renderDeck requires request.model (or deck.modelParams.model): ${deck.path}`);
173
- }
174
- const { messages: _m, tools: _t, ...rest } = mergedReq;
175
- return {
176
- request: {
177
- ...rest,
178
- model,
179
- messages,
180
- tools: tools && tools.length ? tools : undefined,
181
- },
182
- gambit: {
183
- deckPath: deck.path,
184
- systemPrompt,
185
- actionPathsByName,
186
- },
187
- };
188
- }
@@ -1,8 +0,0 @@
1
- import { z } from "zod";
2
- import type { JSONValue } from "@bolt-foundry/gambit-core/internal/types";
3
- import type { ZodTypeAny } from "zod";
4
- export declare function validateWithSchema<T>(schema: z.ZodType<T>, value: unknown): T;
5
- export declare function toJsonSchema(schema: z.ZodTypeAny): Record<string, JSONValue>;
6
- export declare function assertZodSchema(value: unknown, label: string): asserts value is z.ZodTypeAny;
7
- export declare function mergeZodObjects(base: ZodTypeAny | undefined, fragment: ZodTypeAny | undefined): ZodTypeAny | undefined;
8
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/packages/gambit-core/src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,KAAK,EAA0B,UAAU,EAAE,MAAM,KAAK,CAAC;AAE9D,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EACpB,KAAK,EAAE,OAAO,GACb,CAAC,CAUH;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAO5E;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,UAAU,CAQ/B;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,QAAQ,EAAE,UAAU,GAAG,SAAS,GAC/B,UAAU,GAAG,SAAS,CAOxB"}
@@ -1,45 +0,0 @@
1
- import { z } from "zod";
2
- import { zodToJsonSchema } from "zod-to-json-schema";
3
- export function validateWithSchema(schema, value) {
4
- const result = schema.safeParse(value);
5
- if (!result.success) {
6
- const issue = result.error.issues?.[0];
7
- const message = issue
8
- ? `${issue.path.join(".") || "(root)"}: ${issue.message}`
9
- : result.error.message;
10
- throw new Error(`Schema validation failed: ${message}`);
11
- }
12
- return result.data;
13
- }
14
- export function toJsonSchema(schema) {
15
- const converted = zodToJsonSchema(schema, { $refStrategy: "none" });
16
- if (converted && typeof converted === "object") {
17
- return converted;
18
- }
19
- // Fallback to permissive object if conversion fails
20
- return { type: "object" };
21
- }
22
- export function assertZodSchema(value, label) {
23
- if (!value || typeof value !== "object") {
24
- throw new Error(`${label} must be a Zod schema`);
25
- }
26
- // Duck-typing: check for safeParse
27
- if (typeof value.safeParse !== "function") {
28
- throw new Error(`${label} must be a Zod schema (missing safeParse)`);
29
- }
30
- }
31
- export function mergeZodObjects(base, fragment) {
32
- if (!fragment)
33
- return base;
34
- if (!base)
35
- return fragment;
36
- const baseObj = asZodObject(base, "base schema");
37
- const fragObj = asZodObject(fragment, "fragment schema");
38
- const mergedShape = { ...fragObj.shape, ...baseObj.shape };
39
- return z.object(mergedShape);
40
- }
41
- function asZodObject(schema, label) {
42
- if (schema instanceof z.ZodObject)
43
- return schema;
44
- throw new Error(`${label} must be a Zod object schema to merge fragments`);
45
- }
@@ -1,50 +0,0 @@
1
- /**
2
- * Gambit core exports for authoring and running decks/cards with runtime helpers.
3
- *
4
- * @module
5
- */
6
- /** Define a reusable card with shared behavior, tools, or guardrails. */
7
- export { defineCard } from "./src/definitions.js";
8
- /** Define a deck, the primary unit of execution. */
9
- export { defineDeck } from "./src/definitions.js";
10
- /** Action deck definition shape. */
11
- export type { ActionDeckDefinition } from "@bolt-foundry/gambit-core/internal/types";
12
- /** Card definition shape. */
13
- export type { CardDefinition } from "@bolt-foundry/gambit-core/internal/types";
14
- /** Deck definition shape. */
15
- export type { DeckDefinition } from "@bolt-foundry/gambit-core/internal/types";
16
- /** Reference to another deck. */
17
- export type { DeckReferenceDefinition } from "@bolt-foundry/gambit-core/internal/types";
18
- /** Execution context passed to decks. */
19
- export type { ExecutionContext } from "@bolt-foundry/gambit-core/internal/types";
20
- /** Grader deck definition shape. */
21
- export type { GraderDeckDefinition } from "@bolt-foundry/gambit-core/internal/types";
22
- /** Guardrails definition and hooks. */
23
- export type { Guardrails } from "@bolt-foundry/gambit-core/internal/types";
24
- /** JSON-serializable value type used throughout Gambit. */
25
- export type { JSONValue } from "@bolt-foundry/gambit-core/internal/types";
26
- /** Model provider interface for LLM backends. */
27
- export type { ModelProvider } from "@bolt-foundry/gambit-core/internal/types";
28
- /** Test deck definition shape. */
29
- export type { TestDeckDefinition } from "@bolt-foundry/gambit-core/internal/types";
30
- /** Check if a value is an explicit end-of-run signal. */
31
- export { isGambitEndSignal } from "@bolt-foundry/gambit-core/internal/runtime";
32
- /** Run a deck and return its execution result. */
33
- export { runDeck } from "@bolt-foundry/gambit-core/internal/runtime";
34
- /** Signal for explicitly ending a Gambit run. */
35
- export type { GambitEndSignal } from "@bolt-foundry/gambit-core/internal/runtime";
36
- /** OpenAI Chat Completions compatibility helper for a deck. */
37
- export { chatCompletionsWithDeck } from "./src/openai_compat.js";
38
- /** OpenAI-compatible request payload. */
39
- export type { ChatCompletionsRequest } from "./src/openai_compat.js";
40
- /** OpenAI-compatible response payload. */
41
- export type { ChatCompletionsResponse } from "./src/openai_compat.js";
42
- /** Render a deck to a human-readable outline or debug view. */
43
- export { renderDeck } from "./src/render.js";
44
- /** Options for deck rendering. */
45
- export type { RenderDeckOptions } from "./src/render.js";
46
- /** Result data from rendering a deck. */
47
- export type { RenderDeckResult } from "./src/render.js";
48
- /** Provider factory for OpenRouter-backed model calls. */
49
- export { createOpenRouterProvider } from "./src/providers/openrouter.js";
50
- //# sourceMappingURL=mod.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/packages/gambit-core/mod.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,yEAAyE;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,oDAAoD;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,oCAAoC;AACpC,YAAY,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AACrF,6BAA6B;AAC7B,YAAY,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC/E,6BAA6B;AAC7B,YAAY,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC/E,iCAAiC;AACjC,YAAY,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxF,yCAAyC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AACjF,oCAAoC;AACpC,YAAY,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AACrF,uCAAuC;AACvC,YAAY,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAC3E,2DAA2D;AAC3D,YAAY,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAC1E,iDAAiD;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAC9E,kCAAkC;AAClC,YAAY,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AACnF,yDAAyD;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,kDAAkD;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,4CAA4C,CAAC;AACrE,iDAAiD;AACjD,YAAY,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAClF,+DAA+D;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,yCAAyC;AACzC,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,0CAA0C;AAC1C,YAAY,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,+DAA+D;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,kCAAkC;AAClC,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,yCAAyC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,0DAA0D;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC"}
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createOpenRouterProvider = exports.renderDeck = exports.chatCompletionsWithDeck = exports.runDeck = exports.isGambitEndSignal = exports.defineDeck = exports.defineCard = void 0;
4
- /**
5
- * Gambit core exports for authoring and running decks/cards with runtime helpers.
6
- *
7
- * @module
8
- */
9
- /** Define a reusable card with shared behavior, tools, or guardrails. */
10
- var definitions_js_1 = require("./src/definitions.js");
11
- Object.defineProperty(exports, "defineCard", { enumerable: true, get: function () { return definitions_js_1.defineCard; } });
12
- /** Define a deck, the primary unit of execution. */
13
- var definitions_js_2 = require("./src/definitions.js");
14
- Object.defineProperty(exports, "defineDeck", { enumerable: true, get: function () { return definitions_js_2.defineDeck; } });
15
- /** Check if a value is an explicit end-of-run signal. */
16
- var runtime_1 = require("@bolt-foundry/gambit-core/internal/runtime");
17
- Object.defineProperty(exports, "isGambitEndSignal", { enumerable: true, get: function () { return runtime_1.isGambitEndSignal; } });
18
- /** Run a deck and return its execution result. */
19
- var runtime_2 = require("@bolt-foundry/gambit-core/internal/runtime");
20
- Object.defineProperty(exports, "runDeck", { enumerable: true, get: function () { return runtime_2.runDeck; } });
21
- /** OpenAI Chat Completions compatibility helper for a deck. */
22
- var openai_compat_js_1 = require("./src/openai_compat.js");
23
- Object.defineProperty(exports, "chatCompletionsWithDeck", { enumerable: true, get: function () { return openai_compat_js_1.chatCompletionsWithDeck; } });
24
- /** Render a deck to a human-readable outline or debug view. */
25
- var render_js_1 = require("./src/render.js");
26
- Object.defineProperty(exports, "renderDeck", { enumerable: true, get: function () { return render_js_1.renderDeck; } });
27
- /** Provider factory for OpenRouter-backed model calls. */
28
- var openrouter_js_1 = require("./src/providers/openrouter.js");
29
- Object.defineProperty(exports, "createOpenRouterProvider", { enumerable: true, get: function () { return openrouter_js_1.createOpenRouterProvider; } });
@@ -1,11 +0,0 @@
1
- import type { CardDefinition, DeckDefinition } from "@bolt-foundry/gambit-core/internal/types";
2
- import type { z } from "zod";
3
- export declare function defineDeck<InputSchema extends z.ZodTypeAny, OutputSchema extends z.ZodTypeAny | undefined = undefined>(def: Omit<DeckDefinition<z.infer<InputSchema>>, "kind" | "inputSchema" | "outputSchema"> & {
4
- inputSchema: InputSchema;
5
- outputSchema?: OutputSchema;
6
- }): DeckDefinition<z.infer<InputSchema>>;
7
- export declare function defineDeck(def: Omit<DeckDefinition, "kind">): DeckDefinition;
8
- export declare function defineCard(def: Omit<CardDefinition, "kind">): CardDefinition;
9
- export declare function isDeckDefinition(value: unknown): value is DeckDefinition;
10
- export declare function isCardDefinition(value: unknown): value is CardDefinition;
11
- //# sourceMappingURL=definitions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../../src/packages/gambit-core/src/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC/F,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,wBAAgB,UAAU,CACxB,WAAW,SAAS,CAAC,CAAC,UAAU,EAChC,YAAY,SAAS,CAAC,CAAC,UAAU,GAAG,SAAS,GAAG,SAAS,EAEzD,GAAG,EACC,IAAI,CACJ,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,EACpC,MAAM,GAAG,aAAa,GAAG,cAAc,CACxC,GACC;IACA,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,GACF,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;AACxC,wBAAgB,UAAU,CACxB,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAChC,cAAc,CAAC;AAOlB,wBAAgB,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG,cAAc,CAE5E;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAKxE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAKxE"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defineDeck = defineDeck;
4
- exports.defineCard = defineCard;
5
- exports.isDeckDefinition = isDeckDefinition;
6
- exports.isCardDefinition = isCardDefinition;
7
- function defineDeck(def) {
8
- return { kind: "gambit.deck", ...def };
9
- }
10
- function defineCard(def) {
11
- return { kind: "gambit.card", ...def };
12
- }
13
- function isDeckDefinition(value) {
14
- return Boolean(value && typeof value === "object" &&
15
- value.kind === "gambit.deck");
16
- }
17
- function isCardDefinition(value) {
18
- return Boolean(value && typeof value === "object" &&
19
- value.kind === "gambit.card");
20
- }
@@ -1,63 +0,0 @@
1
- import type { Guardrails, ModelMessage, ModelProvider, ToolDefinition } from "@bolt-foundry/gambit-core/internal/types";
2
- export declare const logger: Console;
3
- export type ChatCompletionsRequest = {
4
- model: string;
5
- messages: Array<{
6
- role: "system" | "user" | "assistant" | "tool";
7
- content: string | null | Array<string | {
8
- text?: string;
9
- type?: string;
10
- }>;
11
- name?: string;
12
- tool_call_id?: string;
13
- tool_calls?: ModelMessage["tool_calls"];
14
- }>;
15
- tools?: Array<ToolDefinition>;
16
- stream?: boolean;
17
- temperature?: number;
18
- top_p?: number;
19
- frequency_penalty?: number;
20
- presence_penalty?: number;
21
- max_tokens?: number;
22
- [key: string]: unknown;
23
- };
24
- export type ChatCompletionsResponse = {
25
- id: string;
26
- object: "chat.completion";
27
- created: number;
28
- model: string;
29
- choices: Array<{
30
- index: number;
31
- message: ModelMessage;
32
- finish_reason: "stop" | "tool_calls" | "length";
33
- logprobs: null;
34
- }>;
35
- usage?: {
36
- prompt_tokens: number;
37
- completion_tokens: number;
38
- total_tokens: number;
39
- };
40
- /**
41
- * Non-OpenAI extension field containing the full transcript and metadata.
42
- * Most clients will ignore unknown fields.
43
- */
44
- gambit?: {
45
- deckPath: string;
46
- messages: Array<ModelMessage>;
47
- runId: string;
48
- };
49
- };
50
- export declare function chatCompletionsWithDeck(args: {
51
- deckPath: string;
52
- request: ChatCompletionsRequest;
53
- modelProvider: ModelProvider;
54
- /**
55
- * When true (default), Gambit will execute tool calls that match deck actions.
56
- * Any other tool calls are returned to the caller as normal OpenAI tool calls.
57
- */
58
- executeDeckTools?: boolean;
59
- guardrails?: Partial<Guardrails>;
60
- defaultModel?: string;
61
- onStreamText?: (chunk: string) => void;
62
- }): Promise<ChatCompletionsResponse>;
63
- //# sourceMappingURL=openai_compat.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openai_compat.d.ts","sourceRoot":"","sources":["../../../../src/packages/gambit-core/src/openai_compat.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,UAAU,EAEV,YAAY,EACZ,aAAa,EACb,cAAc,EACf,MAAM,0CAA0C,CAAC;AAElD,eAAO,MAAM,MAAM,SAAU,CAAC;AAO9B,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;QAC/C,OAAO,EACH,MAAM,GACN,IAAI,GACJ,KAAK,CAAC,MAAM,GAAG;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACrD,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,UAAU,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;KACzC,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,KAAK,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,YAAY,CAAC;QACtB,aAAa,EAAE,MAAM,GAAG,YAAY,GAAG,QAAQ,CAAC;QAChD,QAAQ,EAAE,IAAI,CAAC;KAChB,CAAC,CAAC;IACH,KAAK,CAAC,EAAE;QACN,aAAa,EAAE,MAAM,CAAC;QACtB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF;;;OAGG;IACH,MAAM,CAAC,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;QAC9B,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAoKF,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,sBAAsB,CAAC;IAChC,aAAa,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAsJnC"}