@bolt-foundry/gambit-core 0.8.1 → 0.8.5-rc.3
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 +60 -34
- package/cards/context.card.md +5 -5
- package/cards/generate-test-input.card.md +12 -0
- package/{script/deps/jsr.io/@std/collections/1.1.4 → esm/deps/jsr.io/@std/collections/1.1.5}/deep_merge.d.ts +2 -2
- package/esm/deps/jsr.io/@std/collections/{1.1.4 → 1.1.5}/deep_merge.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/collections/{1.1.4 → 1.1.5}/deep_merge.js +29 -19
- package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.js +1 -1
- package/esm/mod.d.ts +20 -10
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +11 -5
- package/esm/schemas/graders/contexts/conversation.d.ts +22 -0
- package/esm/schemas/graders/contexts/conversation.d.ts.map +1 -0
- package/esm/schemas/graders/contexts/conversation.js +17 -0
- package/esm/schemas/graders/contexts/conversation.zod.d.ts +3 -0
- package/esm/schemas/graders/contexts/conversation.zod.d.ts.map +1 -0
- package/esm/schemas/graders/contexts/conversation.zod.js +2 -0
- package/esm/schemas/graders/contexts/conversation_tools.d.ts +31 -0
- package/esm/schemas/graders/contexts/conversation_tools.d.ts.map +1 -0
- package/esm/schemas/graders/contexts/conversation_tools.js +25 -0
- package/esm/schemas/graders/contexts/conversation_tools.zod.d.ts +3 -0
- package/esm/schemas/graders/contexts/conversation_tools.zod.d.ts.map +1 -0
- package/esm/schemas/graders/contexts/conversation_tools.zod.js +2 -0
- package/esm/schemas/graders/contexts/tools.d.ts +4 -0
- package/esm/schemas/graders/contexts/tools.d.ts.map +1 -0
- package/esm/schemas/graders/contexts/tools.js +3 -0
- package/esm/schemas/graders/contexts/tools.zod.d.ts +3 -0
- package/esm/schemas/graders/contexts/tools.zod.d.ts.map +1 -0
- package/esm/schemas/graders/contexts/tools.zod.js +2 -0
- package/esm/schemas/graders/contexts/turn.d.ts +10 -0
- package/esm/schemas/graders/contexts/turn.d.ts.map +1 -0
- package/esm/schemas/graders/contexts/turn.js +8 -0
- package/esm/schemas/graders/contexts/turn.zod.d.ts +3 -0
- package/esm/schemas/graders/contexts/turn.zod.d.ts.map +1 -0
- package/esm/schemas/graders/contexts/turn.zod.js +2 -0
- package/esm/schemas/graders/contexts/turn_tools.d.ts +32 -0
- package/esm/schemas/graders/contexts/turn_tools.d.ts.map +1 -0
- package/esm/schemas/graders/contexts/turn_tools.js +28 -0
- package/esm/schemas/graders/contexts/turn_tools.zod.d.ts +3 -0
- package/esm/schemas/graders/contexts/turn_tools.zod.d.ts.map +1 -0
- package/esm/schemas/graders/contexts/turn_tools.zod.js +2 -0
- package/esm/schemas/graders/grader_output.d.ts +10 -0
- package/esm/schemas/graders/grader_output.d.ts.map +1 -0
- package/esm/schemas/graders/grader_output.js +8 -0
- package/esm/schemas/graders/grader_output.zod.d.ts +3 -0
- package/esm/schemas/graders/grader_output.zod.d.ts.map +1 -0
- package/esm/schemas/graders/grader_output.zod.js +2 -0
- package/esm/schemas/graders/respond.d.ts +12 -0
- package/esm/schemas/graders/respond.d.ts.map +1 -0
- package/esm/schemas/graders/respond.js +10 -0
- package/esm/schemas/graders/respond.zod.d.ts +3 -0
- package/esm/schemas/graders/respond.zod.d.ts.map +1 -0
- package/esm/schemas/graders/respond.zod.js +2 -0
- package/esm/schemas/scenarios/plain_chat_input_optional.d.ts +5 -0
- package/esm/schemas/scenarios/plain_chat_input_optional.d.ts.map +1 -0
- package/esm/schemas/scenarios/plain_chat_input_optional.js +5 -0
- package/esm/schemas/scenarios/plain_chat_input_optional.zod.d.ts +3 -0
- package/esm/schemas/scenarios/plain_chat_input_optional.zod.d.ts.map +1 -0
- package/esm/schemas/scenarios/plain_chat_input_optional.zod.js +2 -0
- package/esm/schemas/scenarios/plain_chat_output.d.ts +5 -0
- package/esm/schemas/scenarios/plain_chat_output.d.ts.map +1 -0
- package/esm/schemas/scenarios/plain_chat_output.js +4 -0
- package/esm/schemas/scenarios/plain_chat_output.zod.d.ts +3 -0
- package/esm/schemas/scenarios/plain_chat_output.zod.d.ts.map +1 -0
- package/esm/schemas/scenarios/plain_chat_output.zod.js +2 -0
- package/esm/src/builtins.d.ts +2 -0
- package/esm/src/builtins.d.ts.map +1 -1
- package/esm/src/builtins.js +45 -1
- package/esm/src/constants.d.ts +4 -0
- package/esm/src/constants.d.ts.map +1 -1
- package/esm/src/constants.js +5 -0
- package/esm/src/definitions.d.ts +5 -1
- package/esm/src/definitions.d.ts.map +1 -1
- package/esm/src/loader.d.ts.map +1 -1
- package/esm/src/loader.js +119 -13
- package/esm/src/markdown.d.ts.map +1 -1
- package/esm/src/markdown.js +222 -53
- package/esm/src/permissions.d.ts +143 -0
- package/esm/src/permissions.d.ts.map +1 -0
- package/esm/src/permissions.js +406 -0
- package/esm/src/render.d.ts.map +1 -1
- package/esm/src/render.js +22 -8
- package/esm/src/runtime.d.ts +28 -2
- package/esm/src/runtime.d.ts.map +1 -1
- package/esm/src/runtime.js +3051 -100
- package/esm/src/runtime_exec_host.d.ts +6 -0
- package/esm/src/runtime_exec_host.d.ts.map +1 -0
- package/esm/src/runtime_exec_host.js +17 -0
- package/esm/src/runtime_exec_host_contract.d.ts +23 -0
- package/esm/src/runtime_exec_host_contract.d.ts.map +1 -0
- package/esm/src/runtime_exec_host_contract.js +14 -0
- package/esm/src/runtime_exec_host_deno.d.ts +3 -0
- package/esm/src/runtime_exec_host_deno.d.ts.map +1 -0
- package/esm/src/runtime_exec_host_deno.js +35 -0
- package/esm/src/runtime_exec_host_unsupported.d.ts +3 -0
- package/esm/src/runtime_exec_host_unsupported.d.ts.map +1 -0
- package/esm/src/runtime_exec_host_unsupported.js +8 -0
- package/esm/src/runtime_worker_host.d.ts +6 -0
- package/esm/src/runtime_worker_host.d.ts.map +1 -0
- package/esm/src/runtime_worker_host.js +17 -0
- package/esm/src/runtime_worker_host_contract.d.ts +33 -0
- package/esm/src/runtime_worker_host_contract.d.ts.map +1 -0
- package/esm/src/runtime_worker_host_contract.js +14 -0
- package/esm/src/runtime_worker_host_deno.d.ts +3 -0
- package/esm/src/runtime_worker_host_deno.d.ts.map +1 -0
- package/esm/src/runtime_worker_host_deno.js +26 -0
- package/esm/src/runtime_worker_host_unsupported.d.ts +3 -0
- package/esm/src/runtime_worker_host_unsupported.d.ts.map +1 -0
- package/esm/src/runtime_worker_host_unsupported.js +8 -0
- package/esm/src/state.d.ts +4 -1
- package/esm/src/state.d.ts.map +1 -1
- package/esm/src/state.js +48 -2
- package/esm/src/types.d.ts +381 -1
- package/esm/src/types.d.ts.map +1 -1
- package/esm/src/types.js +102 -1
- package/package.json +73 -2
- package/schemas/graders/contexts/conversation.ts +32 -9
- package/schemas/graders/contexts/conversation.zod.ts +1 -0
- package/schemas/graders/contexts/conversation_tools.ts +63 -0
- package/schemas/graders/contexts/conversation_tools.zod.ts +1 -0
- package/schemas/graders/contexts/tools.ts +5 -0
- package/schemas/graders/contexts/tools.zod.ts +1 -0
- package/schemas/graders/contexts/turn.ts +8 -1
- package/schemas/graders/contexts/turn.zod.ts +1 -0
- package/schemas/graders/contexts/turn_tools.ts +63 -0
- package/schemas/graders/contexts/turn_tools.zod.ts +1 -0
- package/schemas/graders/grader_output.ts +15 -0
- package/schemas/graders/grader_output.zod.ts +1 -0
- package/schemas/graders/respond.ts +13 -3
- package/schemas/graders/respond.zod.ts +1 -0
- package/schemas/scenarios/plain_chat_input_optional.ts +6 -0
- package/schemas/scenarios/plain_chat_input_optional.zod.ts +1 -0
- package/schemas/scenarios/plain_chat_output.ts +5 -0
- package/schemas/scenarios/plain_chat_output.zod.ts +1 -0
- package/{esm/deps/jsr.io/@std/collections/1.1.4 → script/deps/jsr.io/@std/collections/1.1.5}/deep_merge.d.ts +2 -2
- package/script/deps/jsr.io/@std/collections/{1.1.4 → 1.1.5}/deep_merge.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/collections/{1.1.4 → 1.1.5}/deep_merge.js +29 -19
- package/script/deps/jsr.io/@std/toml/1.0.11/_parser.js +1 -1
- package/script/mod.d.ts +20 -10
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +25 -9
- package/script/schemas/graders/contexts/conversation.d.ts +22 -0
- package/script/schemas/graders/contexts/conversation.d.ts.map +1 -0
- package/script/schemas/graders/contexts/conversation.js +20 -0
- package/script/schemas/graders/contexts/conversation.zod.d.ts +3 -0
- package/script/schemas/graders/contexts/conversation.zod.d.ts.map +1 -0
- package/script/schemas/graders/contexts/conversation.zod.js +9 -0
- package/script/schemas/graders/contexts/conversation_tools.d.ts +31 -0
- package/script/schemas/graders/contexts/conversation_tools.d.ts.map +1 -0
- package/script/schemas/graders/contexts/conversation_tools.js +28 -0
- package/script/schemas/graders/contexts/conversation_tools.zod.d.ts +3 -0
- package/script/schemas/graders/contexts/conversation_tools.zod.d.ts.map +1 -0
- package/script/schemas/graders/contexts/conversation_tools.zod.js +9 -0
- package/script/schemas/graders/contexts/tools.d.ts +4 -0
- package/script/schemas/graders/contexts/tools.d.ts.map +1 -0
- package/script/schemas/graders/contexts/tools.js +12 -0
- package/script/schemas/graders/contexts/tools.zod.d.ts +3 -0
- package/script/schemas/graders/contexts/tools.zod.d.ts.map +1 -0
- package/script/schemas/graders/contexts/tools.zod.js +9 -0
- package/script/schemas/graders/contexts/turn.d.ts +10 -0
- package/script/schemas/graders/contexts/turn.d.ts.map +1 -0
- package/script/schemas/graders/contexts/turn.js +10 -0
- package/script/schemas/graders/contexts/turn.zod.d.ts +3 -0
- package/script/schemas/graders/contexts/turn.zod.d.ts.map +1 -0
- package/script/schemas/graders/contexts/turn.zod.js +9 -0
- package/script/schemas/graders/contexts/turn_tools.d.ts +32 -0
- package/script/schemas/graders/contexts/turn_tools.d.ts.map +1 -0
- package/script/schemas/graders/contexts/turn_tools.js +31 -0
- package/script/schemas/graders/contexts/turn_tools.zod.d.ts +3 -0
- package/script/schemas/graders/contexts/turn_tools.zod.d.ts.map +1 -0
- package/script/schemas/graders/contexts/turn_tools.zod.js +9 -0
- package/script/schemas/graders/grader_output.d.ts +10 -0
- package/script/schemas/graders/grader_output.d.ts.map +1 -0
- package/script/schemas/graders/grader_output.js +10 -0
- package/script/schemas/graders/grader_output.zod.d.ts +3 -0
- package/script/schemas/graders/grader_output.zod.d.ts.map +1 -0
- package/script/schemas/graders/grader_output.zod.js +9 -0
- package/script/schemas/graders/respond.d.ts +12 -0
- package/script/schemas/graders/respond.d.ts.map +1 -0
- package/script/schemas/graders/respond.js +12 -0
- package/script/schemas/graders/respond.zod.d.ts +3 -0
- package/script/schemas/graders/respond.zod.d.ts.map +1 -0
- package/script/schemas/graders/respond.zod.js +9 -0
- package/script/schemas/scenarios/plain_chat_input_optional.d.ts +5 -0
- package/script/schemas/scenarios/plain_chat_input_optional.d.ts.map +1 -0
- package/script/schemas/scenarios/plain_chat_input_optional.js +7 -0
- package/script/schemas/scenarios/plain_chat_input_optional.zod.d.ts +3 -0
- package/script/schemas/scenarios/plain_chat_input_optional.zod.d.ts.map +1 -0
- package/script/schemas/scenarios/plain_chat_input_optional.zod.js +9 -0
- package/script/schemas/scenarios/plain_chat_output.d.ts +5 -0
- package/script/schemas/scenarios/plain_chat_output.d.ts.map +1 -0
- package/script/schemas/scenarios/plain_chat_output.js +6 -0
- package/script/schemas/scenarios/plain_chat_output.zod.d.ts +3 -0
- package/script/schemas/scenarios/plain_chat_output.zod.d.ts.map +1 -0
- package/script/schemas/scenarios/plain_chat_output.zod.js +9 -0
- package/script/src/builtins.d.ts +2 -0
- package/script/src/builtins.d.ts.map +1 -1
- package/script/src/builtins.js +47 -1
- package/script/src/constants.d.ts +4 -0
- package/script/src/constants.d.ts.map +1 -1
- package/script/src/constants.js +6 -1
- package/script/src/definitions.d.ts +5 -1
- package/script/src/definitions.d.ts.map +1 -1
- package/script/src/loader.d.ts.map +1 -1
- package/script/src/loader.js +118 -12
- package/script/src/markdown.d.ts.map +1 -1
- package/script/src/markdown.js +221 -52
- package/script/src/permissions.d.ts +143 -0
- package/script/src/permissions.d.ts.map +1 -0
- package/script/src/permissions.js +453 -0
- package/script/src/render.d.ts.map +1 -1
- package/script/src/render.js +22 -8
- package/script/src/runtime.d.ts +28 -2
- package/script/src/runtime.d.ts.map +1 -1
- package/script/src/runtime.js +3053 -99
- package/script/src/runtime_exec_host.d.ts +6 -0
- package/script/src/runtime_exec_host.d.ts.map +1 -0
- package/script/src/runtime_exec_host.js +56 -0
- package/script/src/runtime_exec_host_contract.d.ts +23 -0
- package/script/src/runtime_exec_host_contract.d.ts.map +1 -0
- package/script/src/runtime_exec_host_contract.js +18 -0
- package/script/src/runtime_exec_host_deno.d.ts +3 -0
- package/script/src/runtime_exec_host_deno.d.ts.map +1 -0
- package/script/src/runtime_exec_host_deno.js +71 -0
- package/script/src/runtime_exec_host_unsupported.d.ts +3 -0
- package/script/src/runtime_exec_host_unsupported.d.ts.map +1 -0
- package/script/src/runtime_exec_host_unsupported.js +11 -0
- package/script/src/runtime_worker_host.d.ts +6 -0
- package/script/src/runtime_worker_host.d.ts.map +1 -0
- package/script/src/runtime_worker_host.js +56 -0
- package/script/src/runtime_worker_host_contract.d.ts +33 -0
- package/script/src/runtime_worker_host_contract.d.ts.map +1 -0
- package/script/src/runtime_worker_host_contract.js +18 -0
- package/script/src/runtime_worker_host_deno.d.ts +3 -0
- package/script/src/runtime_worker_host_deno.d.ts.map +1 -0
- package/script/src/runtime_worker_host_deno.js +62 -0
- package/script/src/runtime_worker_host_unsupported.d.ts +3 -0
- package/script/src/runtime_worker_host_unsupported.d.ts.map +1 -0
- package/script/src/runtime_worker_host_unsupported.js +11 -0
- package/script/src/state.d.ts +4 -1
- package/script/src/state.d.ts.map +1 -1
- package/script/src/state.js +48 -2
- package/script/src/types.d.ts +381 -1
- package/script/src/types.d.ts.map +1 -1
- package/script/src/types.js +103 -0
- package/esm/deps/jsr.io/@std/collections/1.1.4/_utils.d.ts +0 -6
- package/esm/deps/jsr.io/@std/collections/1.1.4/_utils.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/collections/1.1.4/_utils.js +0 -18
- package/esm/src/openai_compat.d.ts +0 -63
- package/esm/src/openai_compat.d.ts.map +0 -1
- package/esm/src/openai_compat.js +0 -272
- package/esm/src/providers/openrouter.d.ts +0 -8
- package/esm/src/providers/openrouter.d.ts.map +0 -1
- package/esm/src/providers/openrouter.js +0 -168
- package/script/deps/jsr.io/@std/collections/1.1.4/_utils.d.ts +0 -6
- package/script/deps/jsr.io/@std/collections/1.1.4/_utils.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/collections/1.1.4/_utils.js +0 -21
- package/script/src/openai_compat.d.ts +0 -63
- package/script/src/openai_compat.d.ts.map +0 -1
- package/script/src/openai_compat.js +0 -276
- package/script/src/providers/openrouter.d.ts +0 -8
- package/script/src/providers/openrouter.d.ts.map +0 -1
- package/script/src/providers/openrouter.js +0 -207
package/README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Core runtime, definitions, and utilities for building Gambit decks outside of
|
|
4
4
|
the CLI. It includes the loader for Markdown/TypeScript decks, guardrail-aware
|
|
5
|
-
execution,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
execution, and helpers for persisting local run state. The
|
|
6
|
+
[`@bolt-foundry/gambit`](../gambit/README.md) package re-exports these APIs plus
|
|
7
|
+
the CLI, but `gambit-core` stays focused on the authoring/runtime pieces that
|
|
8
|
+
can live in any host.
|
|
9
9
|
|
|
10
10
|
> **Gambit vs. Gambit Core**
|
|
11
11
|
>
|
|
@@ -22,13 +22,13 @@ authoring/runtime pieces that can live in any host.
|
|
|
22
22
|
|
|
23
23
|
- Typed deck/card definitions with [`defineDeck`](src/definitions.ts) and
|
|
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
|
decks (`actionDecks`, `testDecks`, `graderDecks`).
|
|
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
|
-
-
|
|
31
|
-
|
|
30
|
+
- Response-first runtime helpers that plug into any model provider implementing
|
|
31
|
+
the core `ModelProvider` interface.
|
|
32
32
|
- State utilities (`loadState`/`saveState`) used by the Gambit simulator for
|
|
33
33
|
local-first transcripts, feedback, and notes.
|
|
34
34
|
|
|
@@ -58,13 +58,13 @@ etc.).
|
|
|
58
58
|
|
|
59
59
|
## Core concepts
|
|
60
60
|
|
|
61
|
-
- **Decks**: The primary executable unit. Decks declare a label,
|
|
62
|
-
`
|
|
63
|
-
(actions/tests/graders). Decks with `modelParams` render
|
|
64
|
-
with `run`/`execute` are compute-only.
|
|
61
|
+
- **Decks**: The primary executable unit. Decks declare a label,
|
|
62
|
+
`contextSchema`, `responseSchema`, optional `body`/`prompt`, handler hooks,
|
|
63
|
+
and companion decks (actions/tests/graders). Decks with `modelParams` render
|
|
64
|
+
prompts, while decks with `run`/`execute` are compute-only.
|
|
65
65
|
- **Cards**: Reusable prompt fragments or schema fragments that can be embedded
|
|
66
66
|
within decks or other cards. Cards can contribute
|
|
67
|
-
`
|
|
67
|
+
`contextFragment`/`responseFragment` that merge into a parent deck’s schema.
|
|
68
68
|
- **Guardrails**: Limit recursion with `maxDepth`, `maxPasses`, and `timeoutMs`.
|
|
69
69
|
Decks can override guardrails per definition; `runDeck` enforces them while
|
|
70
70
|
spawning child decks.
|
|
@@ -86,8 +86,8 @@ import { z } from "zod";
|
|
|
86
86
|
|
|
87
87
|
export default defineDeck({
|
|
88
88
|
label: "Hello World",
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
contextSchema: z.object({ user: z.string() }),
|
|
90
|
+
responseSchema: z.object({ reply: z.string() }),
|
|
91
91
|
body: `
|
|
92
92
|
You are a helpful assistant that greets the user by name.
|
|
93
93
|
`,
|
|
@@ -107,11 +107,19 @@ import { z } from "zod";
|
|
|
107
107
|
|
|
108
108
|
export default defineCard({
|
|
109
109
|
label: "Shared context",
|
|
110
|
-
|
|
110
|
+
contextFragment: z.object({ customerId: z.string().uuid() }),
|
|
111
111
|
body: "Always double check the account number before responding.",
|
|
112
112
|
});
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
+
For built-in Gambit schemas in TypeScript/compute decks, use canonical module
|
|
116
|
+
subpaths:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
import contextSchema from "@bolt-foundry/gambit-core/schemas/scenarios/plain_chat_input_optional.zod.ts";
|
|
120
|
+
import responseSchema from "@bolt-foundry/gambit-core/schemas/scenarios/plain_chat_output.zod.ts";
|
|
121
|
+
```
|
|
122
|
+
|
|
115
123
|
## Running decks programmatically
|
|
116
124
|
|
|
117
125
|
The runtime loads the deck (Markdown or TS) and steps through each pass. Provide
|
|
@@ -145,7 +153,13 @@ When the deck defines `run`/`execute`, the runtime hands you an
|
|
|
145
153
|
[`ExecutionContext`](src/types.ts) with:
|
|
146
154
|
|
|
147
155
|
- `ctx.input`: validated input (narrowable when you type the schema).
|
|
148
|
-
- `ctx.
|
|
156
|
+
- `ctx.initialUserMessage`: current turn user message when provided by caller.
|
|
157
|
+
- `ctx.getSessionMeta(key)`: read persisted run/session metadata.
|
|
158
|
+
- `ctx.setSessionMeta(key, value)`: persist metadata for later turns.
|
|
159
|
+
- `ctx.appendMessage({ role, content })`: append chat transcript messages from
|
|
160
|
+
execute decks.
|
|
161
|
+
- `ctx.spawnAndWait({ path, input, initialUserMessage? })`: call another deck
|
|
162
|
+
and await the result; user message is inherited by default unless overridden.
|
|
149
163
|
- `ctx.return(payload)`: respond early without running guards again.
|
|
150
164
|
- `ctx.fail({ message, code?, details? })`: aborts the run (throws).
|
|
151
165
|
- `ctx.log(...)`: emit structured trace entries for observability.
|
|
@@ -153,6 +167,22 @@ When the deck defines `run`/`execute`, the runtime hands you an
|
|
|
153
167
|
Pass `guardrails`, `initialUserMessage`, `modelOverride`, and
|
|
154
168
|
`allowRootStringInput` to `runDeck` when scripting custom runtimes.
|
|
155
169
|
|
|
170
|
+
### Worker sandbox behavior in `runDeck`
|
|
171
|
+
|
|
172
|
+
`gambit-core` keeps worker sandboxing opt-in and host-scoped:
|
|
173
|
+
|
|
174
|
+
- `runDeck` enables worker sandboxing only when `workerSandbox: true` is passed
|
|
175
|
+
(or when `GAMBIT_DECK_WORKER_SANDBOX=1|true|yes` is set in Deno).
|
|
176
|
+
- In Deno hosts, worker sandboxing keeps the current worker permission
|
|
177
|
+
enforcement model.
|
|
178
|
+
- In npm/Node/Bun hosts, requesting `workerSandbox: true` throws
|
|
179
|
+
`WorkerSandboxUnsupportedHostError`
|
|
180
|
+
(`code: "worker_sandbox_unsupported_host"`).
|
|
181
|
+
- `workerSandbox: true` with `signal` also throws
|
|
182
|
+
(`code: "worker_sandbox_signal_unsupported"`), because abort signaling is not
|
|
183
|
+
bridged into worker runtimes yet.
|
|
184
|
+
- If sandboxing is not requested, `runDeck` executes in-process.
|
|
185
|
+
|
|
156
186
|
## Loading Markdown decks and cards
|
|
157
187
|
|
|
158
188
|
Markdown files use front matter for metadata, with the body becoming the prompt.
|
|
@@ -161,8 +191,8 @@ Embedded cards or system hints can be referenced with markdown image syntax.
|
|
|
161
191
|
```
|
|
162
192
|
---
|
|
163
193
|
label: Support Triage
|
|
164
|
-
|
|
165
|
-
|
|
194
|
+
contextSchema: ./schemas/triage_input.ts
|
|
195
|
+
responseSchema: ./schemas/triage_output.ts
|
|
166
196
|
actionDecks:
|
|
167
197
|
- name: escalate
|
|
168
198
|
description: Escalate to a manager
|
|
@@ -181,25 +211,22 @@ clarifying questions before choosing an action.
|
|
|
181
211
|
`loadDeck` normalizes relative paths, merges card fragments, enforces unique
|
|
182
212
|
action names, and warns about deprecated fields (`actions`,
|
|
183
213
|
`handlers.onInterval`, `intervalMs`). The Markdown loader also injects helper
|
|
184
|
-
text for built-in tools like `
|
|
185
|
-
when you add `gambit://` markers.
|
|
214
|
+
text for built-in tools like `gambit_context`, `gambit_respond`, and
|
|
215
|
+
`gambit_end` when you add `gambit://` markers.
|
|
186
216
|
|
|
187
217
|
## Compatibility and utilities
|
|
188
218
|
|
|
189
|
-
- **Chat Completions bridge**: [`chatCompletionsWithDeck`](src/openai_compat.ts)
|
|
190
|
-
lets you present a single deck as an OpenAI-compatible endpoint. It normalizes
|
|
191
|
-
tool calls, enforces deck schemas, and returns Chat Completions–shaped
|
|
192
|
-
responses with a `gambit` metadata extension.
|
|
193
219
|
- **Request rendering**: [`renderDeck`](src/render.ts) merges an existing Chat
|
|
194
220
|
Completions request with the deck’s system prompt and tool schema, so you can
|
|
195
221
|
debug what will actually reach the model or feed it into another orchestrator.
|
|
196
|
-
- **Model providers**:
|
|
197
|
-
|
|
198
|
-
|
|
222
|
+
- **Model providers**: adapters live in `@bolt-foundry/gambit` (see
|
|
223
|
+
`packages/gambit/src/providers/openrouter.ts`). Implement your own provider by
|
|
224
|
+
conforming to the `responses()` signature in `ModelProvider`.
|
|
199
225
|
- **Constants**:
|
|
200
|
-
[`
|
|
201
|
-
|
|
202
|
-
responds, and explicitly
|
|
226
|
+
[`GAMBIT_TOOL_CONTEXT`, `GAMBIT_TOOL_RESPOND`, `GAMBIT_TOOL_END`](src/constants.ts)
|
|
227
|
+
(`GAMBIT_TOOL_INIT` remains as a deprecated alias). define the reserved tool
|
|
228
|
+
names the runtime expects when the assistant starts, responds, and explicitly
|
|
229
|
+
ends runs.
|
|
203
230
|
|
|
204
231
|
## Persisted state and traces
|
|
205
232
|
|
|
@@ -214,7 +241,7 @@ stream them to your own observability stack.
|
|
|
214
241
|
|
|
215
242
|
## Local development
|
|
216
243
|
|
|
217
|
-
From
|
|
244
|
+
From this package directory:
|
|
218
245
|
|
|
219
246
|
```
|
|
220
247
|
deno task fmt # format sources
|
|
@@ -223,6 +250,5 @@ deno task test # run unit tests (allowing net/fs as required)
|
|
|
223
250
|
deno task build_npm # emit the npm bundle via dnt
|
|
224
251
|
```
|
|
225
252
|
|
|
226
|
-
Tests exercise the Markdown loader, renderer,
|
|
227
|
-
|
|
228
|
-
necessary.
|
|
253
|
+
Tests exercise the Markdown loader, renderer, and runtime guardrails. Update
|
|
254
|
+
snapshots/fixtures via `deno test -- --update` when necessary.
|
package/cards/context.card.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
label = "Gambit context primer"
|
|
3
3
|
+++
|
|
4
4
|
|
|
5
|
-
You will automatically receive a `
|
|
6
|
-
run whenever the caller supplies `--context` (formerly `--init`). This
|
|
7
|
-
contains run metadata or seeded inputs. Read it before you respond,
|
|
8
|
-
trusted context, and keep it on hand throughout the workflow so
|
|
9
|
-
actions have the right data.
|
|
5
|
+
You will automatically receive a `gambit_context` tool result at the start of
|
|
6
|
+
the run whenever the caller supplies `--context` (formerly `--init`). This
|
|
7
|
+
payload contains run metadata or seeded inputs. Read it before you respond,
|
|
8
|
+
treat it as trusted context, and keep it on hand throughout the workflow so
|
|
9
|
+
downstream actions have the right data.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
+++
|
|
2
|
+
label = "Generate test input"
|
|
3
|
+
+++
|
|
4
|
+
|
|
5
|
+
When you receive a user message with:
|
|
6
|
+
|
|
7
|
+
{ "type": "gambit_test_bot_init_fill", "missing": ["path.to.field", "..."],
|
|
8
|
+
"current": { ... }, "schemaHints": [ ... ] }
|
|
9
|
+
|
|
10
|
+
Return ONLY valid JSON that supplies values for the missing fields. Do not
|
|
11
|
+
include any fields that are not listed in "missing". If the only missing path is
|
|
12
|
+
"(root)", return the full init JSON value.
|
|
@@ -280,7 +280,7 @@ export type MergeAllSets<T, U, X = PartialByType<T, Set<unknown>>, Y = PartialBy
|
|
|
280
280
|
}> = Z;
|
|
281
281
|
/** Get array values type */
|
|
282
282
|
export type ArrayValueType<T> = T extends Array<infer V> ? V : never;
|
|
283
|
-
/** Merge all
|
|
283
|
+
/** Merge all arrays types definitions from keys present in both objects */
|
|
284
284
|
export type MergeAllArrays<T, U, X = PartialByType<T, Array<unknown>>, Y = PartialByType<U, Array<unknown>>, Z = {
|
|
285
285
|
[K in keyof X & keyof Y]: Array<ArrayValueType<X[K]> | ArrayValueType<Y[K]>>;
|
|
286
286
|
}> = Z;
|
|
@@ -288,7 +288,7 @@ export type MergeAllArrays<T, U, X = PartialByType<T, Array<unknown>>, Y = Parti
|
|
|
288
288
|
export type MapKeyType<T> = T extends Map<infer K, unknown> ? K : never;
|
|
289
289
|
/** Get map values types */
|
|
290
290
|
export type MapValueType<T> = T extends Map<unknown, infer V> ? V : never;
|
|
291
|
-
/** Merge all
|
|
291
|
+
/** Merge all maps types definitions from keys present in both objects */
|
|
292
292
|
export type MergeAllMaps<T, U, X = PartialByType<T, Map<unknown, unknown>>, Y = PartialByType<U, Map<unknown, unknown>>, Z = {
|
|
293
293
|
[K in keyof X & keyof Y]: Map<MapKeyType<X[K]> | MapKeyType<Y[K]>, MapValueType<X[K]> | MapValueType<Y[K]>>;
|
|
294
294
|
}> = Z;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep_merge.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/collections/1.1.
|
|
1
|
+
{"version":3,"file":"deep_merge.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/collections/1.1.5/deep_merge.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AACH,wBAAgB,SAAS,CACvB,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EAEtC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAC5B,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAC3B,OAAO,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GACnC,CAAC,CAAC;AAC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AAI,EAAE,SAAS,CAAA;CAAE,GAClC,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,GACvC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IACvB,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAEzB,+BAA+B;AAC/B,MAAM,MAAM,SAAS,CACnB,CAAC,EACD,CAAC,EACD,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,IAGzC;IAAC,CAAC;IAAE,CAAC;CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,GACvE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,GAEpB,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
2
|
// This module is browser compatible.
|
|
3
|
-
|
|
3
|
+
/** Default merging options - cached to avoid object allocation on each call */
|
|
4
|
+
const DEFAULT_OPTIONS = {
|
|
5
|
+
arrays: "merge",
|
|
6
|
+
sets: "merge",
|
|
7
|
+
maps: "merge",
|
|
8
|
+
};
|
|
4
9
|
export function deepMerge(record, other, options) {
|
|
5
|
-
return deepMergeInternal(record, other, new Set(), options);
|
|
10
|
+
return deepMergeInternal(record, other, new Set(), options ?? DEFAULT_OPTIONS);
|
|
6
11
|
}
|
|
7
12
|
function deepMergeInternal(record, other, seen, options) {
|
|
8
13
|
const result = {};
|
|
@@ -33,11 +38,7 @@ function deepMergeInternal(record, other, seen, options) {
|
|
|
33
38
|
}
|
|
34
39
|
return result;
|
|
35
40
|
}
|
|
36
|
-
function mergeObjects(left, right, seen, options
|
|
37
|
-
arrays: "merge",
|
|
38
|
-
sets: "merge",
|
|
39
|
-
maps: "merge",
|
|
40
|
-
}) {
|
|
41
|
+
function mergeObjects(left, right, seen, options) {
|
|
41
42
|
// Recursively merge mergeable objects
|
|
42
43
|
if (isMergeable(left) && isMergeable(right)) {
|
|
43
44
|
return deepMergeInternal(left, right, seen, options);
|
|
@@ -53,20 +54,22 @@ function mergeObjects(left, right, seen, options = {
|
|
|
53
54
|
// Handle maps
|
|
54
55
|
if ((left instanceof Map) && (right instanceof Map)) {
|
|
55
56
|
if (options.maps === "merge") {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
const result = new Map(left);
|
|
58
|
+
for (const [k, v] of right) {
|
|
59
|
+
result.set(k, v);
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
60
62
|
}
|
|
61
63
|
return right;
|
|
62
64
|
}
|
|
63
65
|
// Handle sets
|
|
64
66
|
if ((left instanceof Set) && (right instanceof Set)) {
|
|
65
67
|
if (options.sets === "merge") {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
const result = new Set(left);
|
|
69
|
+
for (const v of right) {
|
|
70
|
+
result.add(v);
|
|
71
|
+
}
|
|
72
|
+
return result;
|
|
70
73
|
}
|
|
71
74
|
return right;
|
|
72
75
|
}
|
|
@@ -88,8 +91,15 @@ function isNonNullObject(value) {
|
|
|
88
91
|
return value !== null && typeof value === "object";
|
|
89
92
|
}
|
|
90
93
|
function getKeys(record) {
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
const keys = Object.keys(record);
|
|
95
|
+
const symbols = Object.getOwnPropertySymbols(record);
|
|
96
|
+
// Fast path: most objects have no symbol keys
|
|
97
|
+
if (symbols.length === 0)
|
|
98
|
+
return keys;
|
|
99
|
+
for (const sym of symbols) {
|
|
100
|
+
if (Object.prototype.propertyIsEnumerable.call(record, sym)) {
|
|
101
|
+
keys.push(sym);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return keys;
|
|
95
105
|
}
|
|
@@ -12,7 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
13
13
|
};
|
|
14
14
|
var _Scanner_whitespace, _Scanner_position, _Scanner_source;
|
|
15
|
-
import { deepMerge } from "../../collections/1.1.
|
|
15
|
+
import { deepMerge } from "../../collections/1.1.5/deep_merge.js";
|
|
16
16
|
/**
|
|
17
17
|
* Copy of `import { isLeap } from "@std/datetime";` because it cannot be impoted as long as it is unstable.
|
|
18
18
|
*/
|
package/esm/mod.d.ts
CHANGED
|
@@ -26,30 +26,38 @@ export type { Guardrails } from "./src/types.js";
|
|
|
26
26
|
export type { HandlersConfig } from "./src/types.js";
|
|
27
27
|
/** JSON-serializable value type used throughout Gambit. */
|
|
28
28
|
export type { JSONValue } from "./src/types.js";
|
|
29
|
+
/** Open Responses content payload types. */
|
|
30
|
+
export type { CreateResponseRequest, CreateResponseResponse, ResponseEvent, ResponseFunctionCallItem, ResponseFunctionCallOutputItem, ResponseItem, ResponseMessageItem, ResponseTextContent, ResponseToolChoice, ResponseToolDefinition, ResponseUsage, } from "./src/types.js";
|
|
29
31
|
/** Test deck definition shape. */
|
|
30
32
|
export type { TestDeckDefinition } from "./src/types.js";
|
|
33
|
+
/** Permission declaration shape used by deck metadata and config layers. */
|
|
34
|
+
export type { PermissionDeclaration, PermissionDeclarationInput, PermissionTrace, } from "./src/permissions.js";
|
|
35
|
+
/** Permission contract helpers (normalization/intersection/matching). */
|
|
36
|
+
export { canRunCommand, canRunPath, intersectPermissions, normalizePermissionDeclaration, resolveEffectivePermissions, } from "./src/permissions.js";
|
|
31
37
|
/** Check if a value is an explicit end-of-run signal. */
|
|
32
38
|
export { isGambitEndSignal } from "./src/runtime.js";
|
|
33
39
|
/** Run a deck and return its execution result. */
|
|
34
40
|
export { runDeck } from "./src/runtime.js";
|
|
41
|
+
/** Cancellation error type surfaced when a run is aborted. */
|
|
42
|
+
export { isRunCanceledError, RunCanceledError } from "./src/runtime.js";
|
|
35
43
|
/** Signal for explicitly ending a Gambit run. */
|
|
36
44
|
export type { GambitEndSignal } from "./src/runtime.js";
|
|
37
|
-
/**
|
|
38
|
-
export {
|
|
39
|
-
/**
|
|
40
|
-
export
|
|
41
|
-
/**
|
|
42
|
-
export
|
|
45
|
+
/** Runtime run options accepted by `runDeck`. */
|
|
46
|
+
export type { RunOptions } from "./src/runtime.js";
|
|
47
|
+
/** Default guardrail settings applied to deck runs. */
|
|
48
|
+
export { DEFAULT_GUARDRAILS } from "./src/constants.js";
|
|
49
|
+
/** Reserved tool name prefix for Gambit tools. */
|
|
50
|
+
export { RESERVED_TOOL_PREFIX } from "./src/constants.js";
|
|
43
51
|
/** Render a deck to a human-readable outline or debug view. */
|
|
44
52
|
export { renderDeck } from "./src/render.js";
|
|
45
53
|
/** Options for deck rendering. */
|
|
46
54
|
export type { RenderDeckOptions } from "./src/render.js";
|
|
47
55
|
/** Result data from rendering a deck. */
|
|
48
56
|
export type { RenderDeckResult } from "./src/render.js";
|
|
49
|
-
/**
|
|
50
|
-
export {
|
|
57
|
+
/** Schema helpers for ensuring Zod input/output shapes. */
|
|
58
|
+
export { assertZodSchema, toJsonSchema } from "./src/schema.js";
|
|
51
59
|
/** Gambit CLI helpers and internal primitives. */
|
|
52
|
-
export { GAMBIT_TOOL_INIT } from "./src/constants.js";
|
|
60
|
+
export { GAMBIT_TOOL_CONTEXT, GAMBIT_TOOL_INIT } from "./src/constants.js";
|
|
53
61
|
/** Load a deck definition from disk. */
|
|
54
62
|
export { loadDeck } from "./src/loader.js";
|
|
55
63
|
/** Persisted run state stored on disk. */
|
|
@@ -64,6 +72,8 @@ export type { LoadedDeck } from "./src/types.js";
|
|
|
64
72
|
export type { ModelMessage } from "./src/types.js";
|
|
65
73
|
/** Model provider interface for LLM backends. */
|
|
66
74
|
export type { ModelProvider } from "./src/types.js";
|
|
75
|
+
/** Tool definition passed to model providers. */
|
|
76
|
+
export type { ToolDefinition } from "./src/types.js";
|
|
67
77
|
/** Trace events emitted during execution. */
|
|
68
|
-
export type { TraceEvent } from "./src/types.js";
|
|
78
|
+
export type { ProviderTraceEvent, TraceEvent } from "./src/types.js";
|
|
69
79
|
//# 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,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,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,kCAAkC;AAClC,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,yDAAyD;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,kDAAkD;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAk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gB,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,MAAM,gBAAgB,CAAC;AACpD,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
|
@@ -8,18 +8,24 @@ import "./_dnt.polyfills.js";
|
|
|
8
8
|
export { defineCard } from "./src/definitions.js";
|
|
9
9
|
/** Define a deck, the primary unit of execution. */
|
|
10
10
|
export { defineDeck } from "./src/definitions.js";
|
|
11
|
+
/** Permission contract helpers (normalization/intersection/matching). */
|
|
12
|
+
export { canRunCommand, canRunPath, intersectPermissions, normalizePermissionDeclaration, resolveEffectivePermissions, } from "./src/permissions.js";
|
|
11
13
|
/** Check if a value is an explicit end-of-run signal. */
|
|
12
14
|
export { isGambitEndSignal } from "./src/runtime.js";
|
|
13
15
|
/** Run a deck and return its execution result. */
|
|
14
16
|
export { runDeck } from "./src/runtime.js";
|
|
15
|
-
/**
|
|
16
|
-
export {
|
|
17
|
+
/** Cancellation error type surfaced when a run is aborted. */
|
|
18
|
+
export { isRunCanceledError, RunCanceledError } from "./src/runtime.js";
|
|
19
|
+
/** Default guardrail settings applied to deck runs. */
|
|
20
|
+
export { DEFAULT_GUARDRAILS } from "./src/constants.js";
|
|
21
|
+
/** Reserved tool name prefix for Gambit tools. */
|
|
22
|
+
export { RESERVED_TOOL_PREFIX } from "./src/constants.js";
|
|
17
23
|
/** Render a deck to a human-readable outline or debug view. */
|
|
18
24
|
export { renderDeck } from "./src/render.js";
|
|
19
|
-
/**
|
|
20
|
-
export {
|
|
25
|
+
/** Schema helpers for ensuring Zod input/output shapes. */
|
|
26
|
+
export { assertZodSchema, toJsonSchema } from "./src/schema.js";
|
|
21
27
|
/** Gambit CLI helpers and internal primitives. */
|
|
22
|
-
export { GAMBIT_TOOL_INIT } from "./src/constants.js";
|
|
28
|
+
export { GAMBIT_TOOL_CONTEXT, GAMBIT_TOOL_INIT } from "./src/constants.js";
|
|
23
29
|
/** Load a deck definition from disk. */
|
|
24
30
|
export { loadDeck } from "./src/loader.js";
|
|
25
31
|
/** Persisted run state stored on disk. */
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "../../../_dnt.polyfills.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
type GraderMessage = {
|
|
4
|
+
role: string;
|
|
5
|
+
content?: unknown;
|
|
6
|
+
name?: string;
|
|
7
|
+
};
|
|
8
|
+
type GraderConversation = {
|
|
9
|
+
messages?: Array<GraderMessage>;
|
|
10
|
+
meta?: Record<string, unknown>;
|
|
11
|
+
notes?: {
|
|
12
|
+
text?: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
type GraderConversationContext = {
|
|
16
|
+
session: GraderConversation;
|
|
17
|
+
};
|
|
18
|
+
export declare const graderMessageSchema: z.ZodType<GraderMessage>;
|
|
19
|
+
export declare const graderConversationSchema: z.ZodType<GraderConversation>;
|
|
20
|
+
declare const graderConversationContextSchema: z.ZodType<GraderConversationContext>;
|
|
21
|
+
export default graderConversationContextSchema;
|
|
22
|
+
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/schemas/graders/contexts/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,kBAAkB,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAIvD,CAAC;AAEH,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAMlE,CAAC;AAEF,QAAA,MAAM,+BAA+B,EAAE,CAAC,CAAC,OAAO,CAAC,yBAAyB,CAGtE,CAAC;AAEL,eAAe,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "../../../_dnt.polyfills.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export const graderMessageSchema = z.object({
|
|
4
|
+
role: z.string(),
|
|
5
|
+
content: z.any().optional(),
|
|
6
|
+
name: z.string().optional(),
|
|
7
|
+
});
|
|
8
|
+
export const graderConversationSchema = z.object({
|
|
9
|
+
messages: z.array(graderMessageSchema).optional(),
|
|
10
|
+
meta: z.record(z.any()).optional(),
|
|
11
|
+
notes: z.object({ text: z.string().optional() }).optional(),
|
|
12
|
+
});
|
|
13
|
+
const graderConversationContextSchema = z
|
|
14
|
+
.object({
|
|
15
|
+
session: graderConversationSchema,
|
|
16
|
+
});
|
|
17
|
+
export default graderConversationContextSchema;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation.zod.d.ts","sourceRoot":"","sources":["../../../../src/schemas/graders/contexts/conversation.zod.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import "../../../_dnt.polyfills.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
type GraderToolCall = {
|
|
4
|
+
id?: string;
|
|
5
|
+
type?: string;
|
|
6
|
+
function: {
|
|
7
|
+
name: string;
|
|
8
|
+
arguments?: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
type GraderConversationMessageWithTools = {
|
|
12
|
+
role: string;
|
|
13
|
+
content?: unknown;
|
|
14
|
+
name?: string;
|
|
15
|
+
tool_calls?: Array<GraderToolCall>;
|
|
16
|
+
};
|
|
17
|
+
type GraderConversationWithTools = {
|
|
18
|
+
messages?: Array<GraderConversationMessageWithTools>;
|
|
19
|
+
meta?: Record<string, unknown>;
|
|
20
|
+
notes?: {
|
|
21
|
+
text?: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
type GraderConversationToolsContext = {
|
|
25
|
+
session: GraderConversationWithTools;
|
|
26
|
+
};
|
|
27
|
+
export declare const graderConversationMessageWithToolsSchema: z.ZodType<GraderConversationMessageWithTools>;
|
|
28
|
+
export declare const graderConversationWithToolsSchema: z.ZodType<GraderConversationWithTools>;
|
|
29
|
+
declare const graderConversationToolsContextSchema: z.ZodType<GraderConversationToolsContext>;
|
|
30
|
+
export default graderConversationToolsContextSchema;
|
|
31
|
+
//# sourceMappingURL=conversation_tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation_tools.d.ts","sourceRoot":"","sources":["../../../../src/schemas/graders/contexts/conversation_tools.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,KAAK,cAAc,GAAG;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF,KAAK,kCAAkC,GAAG;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;CACpC,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,KAAK,8BAA8B,GAAG;IACpC,OAAO,EAAE,2BAA2B,CAAC;CACtC,CAAC;AAWF,eAAO,MAAM,wCAAwC,EAAE,CAAC,CAAC,OAAO,CAC9D,kCAAkC,CAMlC,CAAC;AAEH,eAAO,MAAM,iCAAiC,EAAE,CAAC,CAAC,OAAO,CACvD,2BAA2B,CAK3B,CAAC;AAEH,QAAA,MAAM,oCAAoC,EAAE,CAAC,CAAC,OAAO,CACnD,8BAA8B,CAG9B,CAAC;AAEH,eAAe,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "../../../_dnt.polyfills.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const graderToolCallSchema = z.object({
|
|
4
|
+
id: z.string().optional(),
|
|
5
|
+
type: z.string().optional(),
|
|
6
|
+
function: z.object({
|
|
7
|
+
name: z.string(),
|
|
8
|
+
arguments: z.string().optional(),
|
|
9
|
+
}),
|
|
10
|
+
});
|
|
11
|
+
export const graderConversationMessageWithToolsSchema = z.object({
|
|
12
|
+
role: z.string(),
|
|
13
|
+
content: z.any().optional(),
|
|
14
|
+
name: z.string().optional(),
|
|
15
|
+
tool_calls: z.array(graderToolCallSchema).optional(),
|
|
16
|
+
});
|
|
17
|
+
export const graderConversationWithToolsSchema = z.object({
|
|
18
|
+
messages: z.array(graderConversationMessageWithToolsSchema).optional(),
|
|
19
|
+
meta: z.record(z.any()).optional(),
|
|
20
|
+
notes: z.object({ text: z.string().optional() }).optional(),
|
|
21
|
+
});
|
|
22
|
+
const graderConversationToolsContextSchema = z.object({
|
|
23
|
+
session: graderConversationWithToolsSchema,
|
|
24
|
+
});
|
|
25
|
+
export default graderConversationToolsContextSchema;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation_tools.zod.d.ts","sourceRoot":"","sources":["../../../../src/schemas/graders/contexts/conversation_tools.zod.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../src/schemas/graders/contexts/tools.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EACL,iCAAiC,EACjC,4BAA4B,GAC7B,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.zod.d.ts","sourceRoot":"","sources":["../../../../src/schemas/graders/contexts/tools.zod.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "../../../_dnt.polyfills.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { graderConversationSchema, graderMessageSchema } from "./conversation.js";
|
|
4
|
+
type GraderTurnContext = {
|
|
5
|
+
session: z.infer<typeof graderConversationSchema>;
|
|
6
|
+
messageToGrade: z.infer<typeof graderMessageSchema>;
|
|
7
|
+
};
|
|
8
|
+
declare const graderTurnContextSchema: z.ZodType<GraderTurnContext>;
|
|
9
|
+
export default graderTurnContextSchema;
|
|
10
|
+
//# sourceMappingURL=turn.d.ts.map
|