@bolt-foundry/gambit-core 0.8.6 → 1.0.0-rc.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.
- package/README.md +22 -18
- package/esm/mod.d.ts +10 -4
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +7 -1
- package/esm/src/markdown.d.ts.map +1 -1
- package/esm/src/markdown.js +1 -0
- package/esm/src/runtime.d.ts +31 -1
- package/esm/src/runtime.d.ts.map +1 -1
- package/esm/src/runtime.js +158 -174
- package/esm/src/state.d.ts.map +1 -1
- package/esm/src/state.js +3 -2
- package/esm/src/text.d.ts +2 -0
- package/esm/src/text.d.ts.map +1 -0
- package/esm/src/text.js +3 -0
- package/esm/src/types.d.ts +4 -33
- package/esm/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/mod.d.ts +10 -4
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +14 -5
- package/script/src/markdown.d.ts.map +1 -1
- package/script/src/markdown.js +1 -0
- package/script/src/runtime.d.ts +31 -1
- package/script/src/runtime.d.ts.map +1 -1
- package/script/src/runtime.js +160 -174
- package/script/src/state.d.ts.map +1 -1
- package/script/src/state.js +3 -2
- package/script/src/text.d.ts +2 -0
- package/script/src/text.d.ts.map +1 -0
- package/script/src/text.js +6 -0
- package/script/src/types.d.ts +4 -33
- package/script/src/types.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ can live in any host.
|
|
|
24
24
|
[`defineCard`](src/definitions.ts) that enforce Zod
|
|
25
25
|
`contextSchema`/`responseSchema`.
|
|
26
26
|
- Loader that understands Markdown decks/cards, inline embeds, and companion
|
|
27
|
-
|
|
27
|
+
deck references (`[[actions]]`, `[[scenarios]]`, `[[graders]]`).
|
|
28
28
|
- Guardrail-aware runtime (`runDeck`) that can mix LLM actions and pure compute
|
|
29
29
|
decks with structured tracing and execution context helpers.
|
|
30
30
|
- Response-first runtime helpers that plug into any model provider implementing
|
|
@@ -70,9 +70,9 @@ etc.).
|
|
|
70
70
|
spawning child decks.
|
|
71
71
|
- **Handlers**: Background decks triggered on busy/idle/error intervals. Paths
|
|
72
72
|
are resolved relative to the parent deck file.
|
|
73
|
-
- **Companion decks**: `
|
|
74
|
-
`
|
|
75
|
-
transcripts.
|
|
73
|
+
- **Companion decks**: `[[actions]]` expose tools (function calls) to the model,
|
|
74
|
+
`[[scenarios]]` house personas or scripted tests, and `[[graders]]` evaluate
|
|
75
|
+
saved transcripts.
|
|
76
76
|
|
|
77
77
|
All actual type definitions live under [`src/types.ts`](src/types.ts). Use them
|
|
78
78
|
when scripting tooling or writing custom providers.
|
|
@@ -127,7 +127,7 @@ any `ModelProvider` implementation; the OpenRouter adapter lives in
|
|
|
127
127
|
`@bolt-foundry/gambit`.
|
|
128
128
|
|
|
129
129
|
```
|
|
130
|
-
import {
|
|
130
|
+
import { runDeckResponses } from "jsr:@bolt-foundry/gambit-core";
|
|
131
131
|
import { createOpenRouterProvider } from "jsr:@bolt-foundry/gambit";
|
|
132
132
|
|
|
133
133
|
const provider = createOpenRouterProvider({
|
|
@@ -136,7 +136,7 @@ const provider = createOpenRouterProvider({
|
|
|
136
136
|
title: "My Gambit Runner",
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
const result = await
|
|
139
|
+
const result = await runDeckResponses({
|
|
140
140
|
path: "./hello.deck.ts",
|
|
141
141
|
input: { user: "Casey" },
|
|
142
142
|
modelProvider: provider,
|
|
@@ -146,7 +146,7 @@ const result = await runDeck({
|
|
|
146
146
|
onStreamText: (chunk) => Deno.stdout.write(new TextEncoder().encode(chunk)),
|
|
147
147
|
});
|
|
148
148
|
|
|
149
|
-
console.log(result);
|
|
149
|
+
console.log(result.output);
|
|
150
150
|
```
|
|
151
151
|
|
|
152
152
|
When the deck defines `run`/`execute`, the runtime hands you an
|
|
@@ -193,12 +193,16 @@ Embedded cards or system hints can be referenced with markdown image syntax.
|
|
|
193
193
|
label: Support Triage
|
|
194
194
|
contextSchema: ./schemas/triage_input.ts
|
|
195
195
|
responseSchema: ./schemas/triage_output.ts
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
196
|
+
[[actions]]
|
|
197
|
+
name = "escalate"
|
|
198
|
+
description = "Escalate to a manager"
|
|
199
|
+
path = "./actions/escalate.deck.md"
|
|
200
|
+
|
|
201
|
+
[[scenarios]]
|
|
202
|
+
path = "./personas/test_bot.deck.md"
|
|
203
|
+
|
|
204
|
+
[[graders]]
|
|
205
|
+
path = "./graders/support_triage.deck.md"
|
|
202
206
|
---
|
|
203
207
|

|
|
204
208
|
|
|
@@ -209,11 +213,11 @@ clarifying questions before choosing an action.
|
|
|
209
213
|
```
|
|
210
214
|
|
|
211
215
|
`loadDeck` normalizes relative paths, merges card fragments, enforces unique
|
|
212
|
-
action names, and warns about deprecated fields (`
|
|
213
|
-
`handlers.onInterval`, `intervalMs`). The Markdown loader also
|
|
214
|
-
text for built-in tools like `gambit_context` when you add
|
|
215
|
-
Legacy `gambit_respond` and `gambit_end` markers are
|
|
216
|
-
hard-fail in default runtime paths.
|
|
216
|
+
action names, and warns about deprecated fields (`actionDecks`, `testDecks`,
|
|
217
|
+
`graderDecks`, `handlers.onInterval`, `intervalMs`). The Markdown loader also
|
|
218
|
+
injects helper text for built-in tools like `gambit_context` when you add
|
|
219
|
+
`gambit://` markers. Legacy `gambit_respond` and `gambit_end` markers are
|
|
220
|
+
migration-only and now hard-fail in default runtime paths.
|
|
217
221
|
|
|
218
222
|
## Compatibility and utilities
|
|
219
223
|
|
package/esm/mod.d.ts
CHANGED
|
@@ -40,14 +40,18 @@ export type { PermissionDeclaration, PermissionDeclarationInput, PermissionTrace
|
|
|
40
40
|
export { canRunCommand, canRunPath, intersectPermissions, normalizePermissionDeclaration, resolveEffectivePermissions, } from "./src/permissions.js";
|
|
41
41
|
/** Check if a value is an explicit end-of-run signal. */
|
|
42
42
|
export { isGambitEndSignal } from "./src/runtime.js";
|
|
43
|
-
/**
|
|
43
|
+
/** Legacy compatibility wrapper that returns the deck's presentation result. */
|
|
44
44
|
export { runDeck } from "./src/runtime.js";
|
|
45
|
+
/** Run a deck and return the structured Responses-shaped runtime result. */
|
|
46
|
+
export { runDeckResponses } from "./src/runtime.js";
|
|
47
|
+
/** Project assistant output text from Responses items for presentation. */
|
|
48
|
+
export { stringifyResponseOutput } from "./src/runtime.js";
|
|
45
49
|
/** Cancellation error type surfaced when a run is aborted. */
|
|
46
50
|
export { isRunCanceledError, RunCanceledError } from "./src/runtime.js";
|
|
47
51
|
/** Signal for explicitly ending a Gambit run. */
|
|
48
52
|
export type { GambitEndSignal } from "./src/runtime.js";
|
|
49
|
-
/** Runtime run options accepted by
|
|
50
|
-
export type { RunOptions } from "./src/runtime.js";
|
|
53
|
+
/** Runtime run options accepted by runtime entrypoints. */
|
|
54
|
+
export type { RunOptions, StructuredRuntimeEffect, StructuredRuntimeResult, StructuredRuntimeStatus, } from "./src/runtime.js";
|
|
51
55
|
/** Default guardrail settings applied to deck runs. */
|
|
52
56
|
export { DEFAULT_GUARDRAILS } from "./src/constants.js";
|
|
53
57
|
/** Reserved tool name prefix for Gambit tools. */
|
|
@@ -58,6 +62,8 @@ export { renderDeck } from "./src/render.js";
|
|
|
58
62
|
export type { RenderDeckOptions } from "./src/render.js";
|
|
59
63
|
/** Result data from rendering a deck. */
|
|
60
64
|
export type { RenderDeckResult } from "./src/render.js";
|
|
65
|
+
/** Join structured text parts into readable text. */
|
|
66
|
+
export { joinTextParts } from "./src/text.js";
|
|
61
67
|
/** Schema helpers for ensuring Zod input/output shapes. */
|
|
62
68
|
export { assertZodSchema, toJsonSchema } from "./src/schema.js";
|
|
63
69
|
/** Gambit CLI helpers and internal primitives. */
|
|
@@ -75,7 +81,7 @@ export type { LoadedDeck } from "./src/types.js";
|
|
|
75
81
|
/** Model message exchanged with providers. */
|
|
76
82
|
export type { ModelMessage } from "./src/types.js";
|
|
77
83
|
/** Model provider interface for LLM backends. */
|
|
78
|
-
export type { ModelProvider } from "./src/types.js";
|
|
84
|
+
export type { ModelProvider, ModelResolver } from "./src/types.js";
|
|
79
85
|
/** Tool definition passed to model providers. */
|
|
80
86
|
export type { ToolDefinition } from "./src/types.js";
|
|
81
87
|
/** Trace events emitted during execution. */
|
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,sBAAsB,CAAC;AAClD,oDAAoD;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,oCAAoC;AACpC,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,6BAA6B;AAC7B,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,6BAA6B;AAC7B,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,iCAAiC;AACjC,YAAY,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,yCAAyC;AACzC,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,8CAA8C;AAC9C,YAAY,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,oCAAoC;AACpC,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,uCAAuC;AACvC,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,8CAA8C;AAC9C,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,2DAA2D;AAC3D,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,4CAA4C;AAC5C,YAAY,EACV,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,qBAAqB,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CAAC;AACjD,4CAA4C;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,sDAAsD;AACtD,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,8CAA8C;AAC9C,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,iDAAiD;AACjD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACnE,iDAAiD;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,6CAA6C;AAC7C,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
|
package/esm/mod.js
CHANGED
|
@@ -13,8 +13,12 @@ export { isOpenResponsesRunEventPayload, isOpenResponsesRunEventV0, serializeOpe
|
|
|
13
13
|
export { canRunCommand, canRunPath, intersectPermissions, normalizePermissionDeclaration, resolveEffectivePermissions, } from "./src/permissions.js";
|
|
14
14
|
/** Check if a value is an explicit end-of-run signal. */
|
|
15
15
|
export { isGambitEndSignal } from "./src/runtime.js";
|
|
16
|
-
/**
|
|
16
|
+
/** Legacy compatibility wrapper that returns the deck's presentation result. */
|
|
17
17
|
export { runDeck } from "./src/runtime.js";
|
|
18
|
+
/** Run a deck and return the structured Responses-shaped runtime result. */
|
|
19
|
+
export { runDeckResponses } from "./src/runtime.js";
|
|
20
|
+
/** Project assistant output text from Responses items for presentation. */
|
|
21
|
+
export { stringifyResponseOutput } from "./src/runtime.js";
|
|
18
22
|
/** Cancellation error type surfaced when a run is aborted. */
|
|
19
23
|
export { isRunCanceledError, RunCanceledError } from "./src/runtime.js";
|
|
20
24
|
/** Default guardrail settings applied to deck runs. */
|
|
@@ -23,6 +27,8 @@ export { DEFAULT_GUARDRAILS } from "./src/constants.js";
|
|
|
23
27
|
export { RESERVED_TOOL_PREFIX } from "./src/constants.js";
|
|
24
28
|
/** Render a deck to a human-readable outline or debug view. */
|
|
25
29
|
export { renderDeck } from "./src/render.js";
|
|
30
|
+
/** Join structured text parts into readable text. */
|
|
31
|
+
export { joinTextParts } from "./src/text.js";
|
|
26
32
|
/** Schema helpers for ensuring Zod input/output shapes. */
|
|
27
33
|
export { assertZodSchema, toJsonSchema } from "./src/schema.js";
|
|
28
34
|
/** Gambit CLI helpers and internal primitives. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/src/markdown.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAKV,UAAU,EACV,UAAU,EAGX,MAAM,YAAY,CAAC;AAwdpB,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,KAAK,GAAE,KAAK,CAAC,MAAM,CAAM,GACxB,OAAO,CAAC,UAAU,CAAC,CAsGrB;AAED,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/src/markdown.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAKV,UAAU,EACV,UAAU,EAGX,MAAM,YAAY,CAAC;AAwdpB,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,KAAK,GAAE,KAAK,CAAC,MAAM,CAAM,GACxB,OAAO,CAAC,UAAU,CAAC,CAsGrB;AAED,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC,CAwPrB;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAExD"}
|
package/esm/src/markdown.js
CHANGED
|
@@ -577,6 +577,7 @@ export async function loadMarkdownDeck(filePath, parentPath) {
|
|
|
577
577
|
graderDecks: mergeDeckRefs(graderDecks, rootGraderDecks, embeddedGraderDecks),
|
|
578
578
|
cards: allCards,
|
|
579
579
|
label: deckMeta.label,
|
|
580
|
+
workloop: deckMeta.workloop,
|
|
580
581
|
startMode: deckMeta.startMode,
|
|
581
582
|
modelParams: deckMeta.modelParams,
|
|
582
583
|
guardrails: deckMeta.guardrails,
|
package/esm/src/runtime.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExternalToolDefinition, Guardrails, ModelProvider, ResponseItem } from "./types.js";
|
|
1
|
+
import type { ExternalToolDefinition, Guardrails, ModelProvider, ModelResolver, ResponseItem, ResponseUsage, TraceEvent } from "./types.js";
|
|
2
2
|
import type { SavedState } from "./state.js";
|
|
3
3
|
import type { NormalizedPermissionSet, PermissionDeclarationInput } from "./permissions.js";
|
|
4
4
|
export type GambitEndSignal = {
|
|
@@ -28,6 +28,7 @@ export type RunOptions = {
|
|
|
28
28
|
inputProvided?: boolean;
|
|
29
29
|
initialUserMessage?: unknown;
|
|
30
30
|
modelProvider: ModelProvider;
|
|
31
|
+
modelResolver?: ModelResolver;
|
|
31
32
|
isRoot?: boolean;
|
|
32
33
|
guardrails?: Partial<Guardrails>;
|
|
33
34
|
depth?: number;
|
|
@@ -68,10 +69,39 @@ export type RunOptions = {
|
|
|
68
69
|
}) => unknown | Promise<unknown>;
|
|
69
70
|
runtimeTools?: ReadonlyArray<ExternalToolDefinition>;
|
|
70
71
|
};
|
|
72
|
+
export type StructuredRuntimeStatus = "completed";
|
|
73
|
+
export type StructuredRuntimeEffect = Extract<TraceEvent, {
|
|
74
|
+
type: "action.start";
|
|
75
|
+
} | {
|
|
76
|
+
type: "action.end";
|
|
77
|
+
} | {
|
|
78
|
+
type: "tool.call";
|
|
79
|
+
} | {
|
|
80
|
+
type: "tool.result";
|
|
81
|
+
}>;
|
|
82
|
+
export type StructuredRuntimeResult = {
|
|
83
|
+
runId: string;
|
|
84
|
+
status: StructuredRuntimeStatus;
|
|
85
|
+
output: Array<ResponseItem>;
|
|
86
|
+
traceEvents: Array<TraceEvent>;
|
|
87
|
+
responseEvents: Array<TraceEvent>;
|
|
88
|
+
state?: SavedState;
|
|
89
|
+
usage?: ResponseUsage;
|
|
90
|
+
finishReason?: "stop" | "tool_calls" | "length";
|
|
91
|
+
effects: Array<StructuredRuntimeEffect>;
|
|
92
|
+
/**
|
|
93
|
+
* Compatibility value returned by the legacy `runDeck` entrypoint.
|
|
94
|
+
* Presentation layers may use this only as a fallback while they migrate to
|
|
95
|
+
* `output`.
|
|
96
|
+
*/
|
|
97
|
+
legacyResult: unknown;
|
|
98
|
+
};
|
|
99
|
+
export declare function stringifyResponseOutput(output: ReadonlyArray<ResponseItem>): string;
|
|
71
100
|
export declare class RunCanceledError extends Error {
|
|
72
101
|
code: string;
|
|
73
102
|
constructor(message?: string);
|
|
74
103
|
}
|
|
75
104
|
export declare function isRunCanceledError(err: unknown): boolean;
|
|
76
105
|
export declare function runDeck(opts: RunOptions): Promise<unknown>;
|
|
106
|
+
export declare function runDeckResponses(opts: RunOptions): Promise<StructuredRuntimeResult>;
|
|
77
107
|
//# sourceMappingURL=runtime.d.ts.map
|
package/esm/src/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/src/runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/src/runtime.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAIV,sBAAsB,EACtB,UAAU,EAIV,aAAa,EACb,aAAa,EAEb,YAAY,EAGZ,aAAa,EAIb,UAAU,EACX,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EACV,uBAAuB,EACvB,0BAA0B,EAE3B,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,eAAe,GAAG;IAC5B,W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