prefix-safe-json 0.5.0 → 0.5.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 +234 -283
- package/dist/coordinator/coordinator.d.ts +2 -0
- package/dist/coordinator/coordinator.d.ts.map +1 -1
- package/dist/coordinator/coordinator.js +17 -2
- package/dist/coordinator/coordinator.js.map +1 -1
- package/dist/coordinator/diagnostic-codes.d.ts +4 -0
- package/dist/coordinator/diagnostic-codes.d.ts.map +1 -1
- package/dist/coordinator/diagnostic-codes.js +6 -0
- package/dist/coordinator/diagnostic-codes.js.map +1 -1
- package/dist/providers/anthropic.d.ts +1 -0
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/providers/anthropic.js +34 -11
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/validation/types.d.ts +7 -4
- package/dist/validation/types.d.ts.map +1 -1
- package/dist/validation/types.js +59 -5
- package/dist/validation/types.js.map +1 -1
- package/package.json +12 -7
package/README.md
CHANGED
|
@@ -4,334 +4,265 @@
|
|
|
4
4
|
[](https://github.com/canblmz1/prefix-safe-json/actions/workflows/ci.yml)
|
|
5
5
|
[](#license)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
An incremental JSON parser and execution gate for **streamed LLM tool calls**.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
`prefix-safe-json` keeps incomplete, conflicting, or unconfirmed streamed arguments from being treated as final tool input. It is designed for callers that need to distinguish:
|
|
10
|
+
|
|
11
|
+
1. JSON that can be parsed right now,
|
|
12
|
+
2. values that are stable enough to expose, and
|
|
13
|
+
3. arguments that the provider actually completed and confirmed.
|
|
14
|
+
|
|
15
|
+
It does not execute tools itself.
|
|
14
16
|
|
|
15
17
|
```bash
|
|
16
|
-
pnpm add prefix-safe-json ai
|
|
17
|
-
# or: npm install prefix-safe-json ai
|
|
18
|
+
pnpm add prefix-safe-json ai zod
|
|
19
|
+
# or: npm install prefix-safe-json ai zod
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
##
|
|
22
|
+
## Safe execution example
|
|
21
23
|
|
|
22
24
|
```javascript
|
|
25
|
+
import { writeFile } from "node:fs/promises";
|
|
23
26
|
import { streamText } from "ai";
|
|
24
|
-
import {
|
|
27
|
+
import { z } from "zod";
|
|
28
|
+
import {
|
|
29
|
+
createAiSdkExecutionGuard,
|
|
30
|
+
createAiSdkExecutionLock,
|
|
31
|
+
} from "prefix-safe-json";
|
|
32
|
+
import { fromStandardSchema } from "prefix-safe-json/standard-schema";
|
|
33
|
+
|
|
34
|
+
const writeFileSchema = z.object({ path: z.string(), content: z.string() });
|
|
35
|
+
|
|
36
|
+
const tools = createAiSdkExecutionLock({
|
|
37
|
+
write_file: {
|
|
38
|
+
description: "Write a UTF-8 text file",
|
|
39
|
+
inputSchema: writeFileSchema,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
25
42
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const lockedTools = createAiSdkExecutionLock({
|
|
29
|
-
write_file: { description: "Write a UTF-8 text file", inputSchema: writeFileSchema },
|
|
43
|
+
const guard = createAiSdkExecutionGuard({
|
|
44
|
+
validators: { write_file: fromStandardSchema(writeFileSchema) },
|
|
30
45
|
});
|
|
31
46
|
|
|
32
|
-
|
|
33
|
-
const result = streamText({ model, prompt, tools: lockedTools });
|
|
34
|
-
const guard = createAiSdkExecutionGuard({ schemas: { write_file: writeFileSchema } });
|
|
47
|
+
const result = streamText({ model, prompt, tools });
|
|
35
48
|
for await (const part of result.fullStream) {
|
|
36
49
|
guard.push(part);
|
|
37
50
|
}
|
|
38
51
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
const { decisions, diagnostics } = guard.finish();
|
|
53
|
+
for (const decision of decisions) {
|
|
54
|
+
const authority = guard.takeDecision(decision.internalId);
|
|
55
|
+
if (authority) {
|
|
56
|
+
await writeFile(authority.value.path, authority.value.content);
|
|
57
|
+
} else {
|
|
58
|
+
console.warn(`skipped ${decision.name}: ${decision.action} (${decision.reason})`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (decisions.length === 0 && diagnostics.length > 0) {
|
|
62
|
+
console.warn("no tool call was executed:", diagnostics);
|
|
48
63
|
}
|
|
49
64
|
```
|
|
50
65
|
|
|
51
|
-
`
|
|
52
|
-
The last line above is the only place a side effect happens, and it's
|
|
53
|
-
entirely yours. See [`examples/`](examples/) for full, runnable
|
|
54
|
-
demonstrations against real provider/SDK shapes, no mocked internals.
|
|
55
|
-
|
|
56
|
-
## Why this exists
|
|
57
|
-
|
|
58
|
-
LLM providers stream tool-call arguments as small JSON chunks. During
|
|
59
|
-
streaming, the JSON is frequently incomplete: strings split mid-word,
|
|
60
|
-
UTF-8 characters split mid-byte, containers left unclosed, numbers
|
|
61
|
-
terminated at chunk boundaries — and even once the JSON *looks* complete,
|
|
62
|
-
nothing about its shape says whether the provider actually confirmed the
|
|
63
|
-
call is done, or just stopped for an unrelated reason (a token limit, an
|
|
64
|
-
error, a content filter) partway through.
|
|
65
|
-
|
|
66
|
-
> **The core invariant: parse completion is not execution authority.**
|
|
67
|
-
|
|
68
|
-
Structural validity, confirmed completeness, and execution authority are
|
|
69
|
-
three separate questions. Most streaming JSON helpers — including some
|
|
70
|
-
already used for LLM tool-call arguments in the wild — are built to show
|
|
71
|
-
*something* as early as possible, even if that means guessing. Given a
|
|
72
|
-
stream that has so far delivered `{"city":"Tok` (the model is still
|
|
73
|
-
typing "Tokyo"):
|
|
74
|
-
|
|
75
|
-
| | `city` field after this chunk |
|
|
76
|
-
|---|---|
|
|
77
|
-
| [vercel/ai's `fixJson`](https://github.com/vercel/ai/blob/main/packages/ai/src/util/fix-json.ts) | `"Tok"` — closes the open string as-is, reports a successful parse |
|
|
78
|
-
| [langchain's `parsePartialJson`](https://github.com/langchain-ai/langchainjs/blob/main/libs/langchain-core/src/utils/json.ts) | `"Tok"` — returns whatever string content it collected |
|
|
79
|
-
| **`prefix-safe-json`** (`snapshot().stableValue`) | *(absent — `city` is not committed yet)* |
|
|
80
|
-
|
|
81
|
-
Verified by cloning both projects and running their actual code
|
|
82
|
-
side-by-side with this library. Neither is a bug — they're built for
|
|
83
|
-
progressively rendering a value in a UI, where showing `"Tok"` then
|
|
84
|
-
`"Tokyo"` a moment later is good UX. `prefix-safe-json` answers a
|
|
85
|
-
different question: *is it safe to act on this value yet* — where
|
|
86
|
-
treating `"Tok"` as the city would be wrong. If you need live
|
|
87
|
-
"filling in..." UI text, a partial-JSON renderer is the right tool. If
|
|
88
|
-
you need to know precisely when it's safe to execute a tool call with the
|
|
89
|
-
parsed arguments, that's what this library is for.
|
|
90
|
-
|
|
91
|
-
## What `execute` / `retry` / `reject` mean
|
|
92
|
-
|
|
93
|
-
Every tool call gets exactly one verdict:
|
|
94
|
-
|
|
95
|
-
- **`execute`** — complete, unfabricated, and (if a schema/validator is
|
|
96
|
-
registered) valid. `decision.value` is safe to pass to your tool.
|
|
97
|
-
- **`retry`** — nothing is wrong with what arrived; there just isn't a
|
|
98
|
-
trustworthy complete value yet. Continue generation.
|
|
99
|
-
- **`reject`** — the data itself is the problem (malformed JSON, a schema
|
|
100
|
-
mismatch, a resource limit, a provider error, a content-policy
|
|
101
|
-
termination). Retrying the same input won't help.
|
|
102
|
-
|
|
103
|
-
See [`docs/EXECUTION_GATE.md`](docs/EXECUTION_GATE.md) for the full
|
|
104
|
-
decision table and every `reason` value.
|
|
105
|
-
|
|
106
|
-
## Failure cases
|
|
107
|
-
|
|
108
|
-
The risk above isn't hypothetical. [Cline](https://github.com/cline/cline)
|
|
109
|
-
(a coding agent that writes files and runs terminal commands from LLM tool
|
|
110
|
-
calls — verified by cloning it, commit `81cce3d70e1`) wires a JSON-repair
|
|
111
|
-
step directly into tool execution: whatever
|
|
112
|
-
[`repairMalformedToolCall`](https://github.com/cline/cline/blob/81cce3d70e10244cdde40dbd0eb0bb711c93006d/sdk/packages/llms/src/providers/ai-sdk.ts#L1332)
|
|
113
|
-
returns *is* the tool call that runs, and its repair path closes an
|
|
114
|
-
unterminated string as-is, same as the table above.
|
|
115
|
-
|
|
116
|
-
Feeding both implementations the same truncated `write_file` call — a
|
|
117
|
-
`content` argument cut off mid-value:
|
|
66
|
+
`model` and `prompt` are yours. The lock stops the SDK from running `write_file` itself; the guard checks each streamed call against the same schema and hands out a one-shot decision. The caller owns dispatch, and a call the guard doesn't hand out never runs.
|
|
118
67
|
|
|
119
|
-
|
|
120
|
-
|
|
68
|
+
Using `jsonSchema()` from `ai` instead of Zod? Give the guard the raw schema inside it: `schemas: { write_file: writeFileSchema.jsonSchema }`. The wrapper itself is refused at construction, because it would otherwise validate nothing.
|
|
69
|
+
|
|
70
|
+
## Run a standalone npm demo
|
|
71
|
+
|
|
72
|
+
With Node 22+ and npm, you can run the published-package demo from this checkout
|
|
73
|
+
without installing the repository's development dependencies:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
node scripts/try-npm-demo.mjs
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The launcher creates a separate temporary npm project and leaves it available
|
|
80
|
+
for editing. To connect the guard to your own stream and share a result, follow
|
|
81
|
+
the [integration trial guide](docs/TRY_IN_YOUR_PROJECT.md).
|
|
82
|
+
|
|
83
|
+
Copy [`examples/npm-consumer/`](examples/npm-consumer/) into an empty directory
|
|
84
|
+
outside this checkout, then run these commands there with **Node 22+**:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm install --engine-strict --no-audit --no-fund
|
|
88
|
+
npm ls prefix-safe-json ai zod
|
|
89
|
+
npm start
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The example pins `prefix-safe-json@0.5.1`, `ai@7.0.77`, and `zod@4.4.3`.
|
|
93
|
+
It needs no repository build, workspace aliases, or API key. It drives real
|
|
94
|
+
`streamText().fullStream` using the SDK's official `MockLanguageModelV4` and
|
|
95
|
+
imports the installed package's public entry point and `standard-schema`
|
|
96
|
+
subpath. Its only side effect is a harmless in-memory counter: complete input
|
|
97
|
+
executes once; truncated and schema-invalid input execute zero times. A
|
|
98
|
+
complete, schema-valid call that ends at the token limit also executes zero
|
|
99
|
+
times: parse success cannot override unsafe termination. A
|
|
100
|
+
projection-mismatch case executes the raw `authority.value`, never the SDK
|
|
101
|
+
projection. Every attached SDK callback stays at zero, and a second
|
|
102
|
+
`takeDecision()` returns `undefined`.
|
|
121
103
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
No error, no warning. This is what gets written to disk.
|
|
104
|
+
This is a deterministic mock-provider check, not a live-provider call or
|
|
105
|
+
independent adoption evidence. CI runs the same demo against a freshly packed
|
|
106
|
+
candidate tarball in a separate, isolated npm consumer directory.
|
|
126
107
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
108
|
+
Using LangChain? The [standalone SDK comparison](examples/langchain-consumer/README.md)
|
|
109
|
+
feeds the same original OpenAI-compatible fixture to `ChatOpenAI.stream()` and
|
|
110
|
+
PSJ, checking that token-limit calls produce zero effects. It is a mock-transport
|
|
111
|
+
comparison; your application still needs access to original provider evidence.
|
|
112
|
+
|
|
113
|
+
## Why parse success is not enough
|
|
114
|
+
|
|
115
|
+
Tool-call arguments often arrive as partial JSON. A renderer may reasonably repair or close an unfinished prefix so it can show progressive UI. That is useful for display, but it answers a different question from whether a side effect should run.
|
|
116
|
+
|
|
117
|
+
Given the prefix:
|
|
118
|
+
|
|
119
|
+
```text
|
|
120
|
+
{"city":"Tok
|
|
130
121
|
```
|
|
131
122
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
independently
|
|
139
|
-
|
|
140
|
-
##
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
call(s) (`reason: "sdk_execution_observed"` — the highest-priority
|
|
198
|
-
rejection reason of any). There is no equivalent detection for a bypassed
|
|
199
|
-
`onInputStart`/`onInputDelta`/`onInputAvailable` — those callbacks
|
|
200
|
-
produce no observable evidence of having run at all. Full behavior, the
|
|
201
|
-
exact test matrix, and every verified `ai@5`/`ai@6`/`ai@7` behavioral
|
|
202
|
-
difference:
|
|
203
|
-
[`docs/EXECUTION_GATE.md`](docs/EXECUTION_GATE.md#execution-ownership-tool-resulttool-error-as-evidence).
|
|
204
|
-
|
|
205
|
-
`AiSdkStreamAdapter`/`createAiSdkExecutionGuard()` target the public
|
|
206
|
-
`streamText()`/`generateText()` `fullStream` surface (`finishReason` as a
|
|
207
|
-
plain unified string), not the lower-level `@ai-sdk/provider`
|
|
208
|
-
`doStream()` boundary.
|
|
123
|
+
some partial-JSON helpers can expose `"Tok"` immediately. `prefix-safe-json` keeps that field uncommitted until the stream provides enough evidence that the value is complete.
|
|
124
|
+
|
|
125
|
+
The core distinction is simple:
|
|
126
|
+
|
|
127
|
+
> **Parse completion is not execution authority.**
|
|
128
|
+
|
|
129
|
+
See [`docs/REAL_WORLD_FAILURES.md`](docs/REAL_WORLD_FAILURES.md) for independently reproduced examples and [`docs/EXECUTION_GATE.md`](docs/EXECUTION_GATE.md) for the decision model.
|
|
130
|
+
|
|
131
|
+
## Decisions
|
|
132
|
+
|
|
133
|
+
Every observed tool call ends in one of three actions:
|
|
134
|
+
|
|
135
|
+
- **`execute`** — arguments are complete and, when configured, validator/schema checks pass.
|
|
136
|
+
- **`retry`** — no trustworthy complete value exists yet.
|
|
137
|
+
- **`reject`** — the stream contains malformed, conflicting, invalid, or terminally unsafe evidence.
|
|
138
|
+
|
|
139
|
+
The full reason matrix lives in [`docs/EXECUTION_GATE.md`](docs/EXECUTION_GATE.md).
|
|
140
|
+
|
|
141
|
+
## Resource handling
|
|
142
|
+
|
|
143
|
+
The coordinator retains the first diagnostic for each rejected-push category:
|
|
144
|
+
normalized-event budget exhaustion, input after stream end, and conflicting
|
|
145
|
+
terminal reason. Repeating an already-rejected push does not keep appending
|
|
146
|
+
that category to its diagnostic history or observation queue. Draining the
|
|
147
|
+
queue does not erase the retained evidence or restore execution authority.
|
|
148
|
+
This bounds those three categories, not total application memory or network
|
|
149
|
+
traffic; existing parser/input limits and caller-owned cancellation still apply.
|
|
150
|
+
|
|
151
|
+
## Scope and non-goals
|
|
152
|
+
|
|
153
|
+
The library covers streamed argument evidence, call identity, lifecycle completion, truncation detection, conflicting evidence, validation composition, and one-shot execution decisions.
|
|
154
|
+
|
|
155
|
+
It does **not** provide:
|
|
156
|
+
|
|
157
|
+
- application authorization,
|
|
158
|
+
- human approval workflows,
|
|
159
|
+
- sandboxing,
|
|
160
|
+
- prompt-injection defense,
|
|
161
|
+
- distributed exactly-once semantics,
|
|
162
|
+
- a guarantee that the model selected the correct tool.
|
|
163
|
+
|
|
164
|
+
An `execute` decision means the tool arguments were observed as complete under the configured boundary. Your application still owns permissions, policy, validation, and the side effect itself.
|
|
165
|
+
|
|
166
|
+
See [`docs/PRODUCT_POSITIONING.md`](docs/PRODUCT_POSITIONING.md) and [`docs/THREAT_MODEL.md`](docs/THREAT_MODEL.md) for the detailed boundary.
|
|
167
|
+
|
|
168
|
+
## Vercel AI SDK integration
|
|
169
|
+
|
|
170
|
+
For `streamText()`, the recommended pattern is:
|
|
171
|
+
|
|
172
|
+
1. wrap tool definitions with `createAiSdkExecutionLock()`,
|
|
173
|
+
2. consume `fullStream`,
|
|
174
|
+
3. feed stream parts into `createAiSdkExecutionGuard()`, and
|
|
175
|
+
4. dispatch manually only from `takeDecision()`.
|
|
176
|
+
|
|
177
|
+
`generateText()` returns a non-streaming result, not `fullStream`, so this
|
|
178
|
+
raw-stream guard recipe does not apply to it. The lock can remove callbacks
|
|
179
|
+
from tools supplied to either function, but that alone does not provide the
|
|
180
|
+
raw argument evidence this guard requires. Do not synthesize stream deltas
|
|
181
|
+
from `generateText()`'s parsed tool-call results to claim raw-stream integrity.
|
|
182
|
+
|
|
183
|
+
`createAiSdkExecutionLock()` removes SDK-invoked callbacks that could execute application code before the guard reaches a final decision. A tool definition that bypasses that lock and performs side effects directly is outside the protection boundary.
|
|
184
|
+
|
|
185
|
+
The adapter targets the public AI SDK `fullStream` surface, not the lower-level `@ai-sdk/provider` `doStream()` boundary.
|
|
186
|
+
|
|
187
|
+
Detailed lifecycle behavior and version-specific tests are documented in [`docs/EXECUTION_GATE.md`](docs/EXECUTION_GATE.md).
|
|
209
188
|
|
|
210
189
|
## Provider adapters
|
|
211
190
|
|
|
212
|
-
|
|
213
|
-
`createToolCallExecutionGate()` the same way the high-level AI SDK guard
|
|
214
|
-
does internally:
|
|
191
|
+
Low-level adapters are included for:
|
|
215
192
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
193
|
+
- OpenAI legacy `function_call`,
|
|
194
|
+
- OpenAI Responses API,
|
|
195
|
+
- Anthropic,
|
|
196
|
+
- Gemini,
|
|
197
|
+
- OpenRouter,
|
|
198
|
+
- generic OpenAI-compatible endpoints,
|
|
199
|
+
- Vercel AI SDK.
|
|
219
200
|
|
|
220
201
|
```typescript
|
|
221
|
-
import {
|
|
202
|
+
import {
|
|
203
|
+
createToolCallExecutionGate,
|
|
204
|
+
OpenAIStreamAdapter,
|
|
205
|
+
} from "prefix-safe-json";
|
|
222
206
|
|
|
223
207
|
const adapter = new OpenAIStreamAdapter();
|
|
224
208
|
const gate = createToolCallExecutionGate();
|
|
209
|
+
|
|
225
210
|
for (const rawChunk of stream) {
|
|
226
|
-
for (const event of adapter.push(rawChunk))
|
|
211
|
+
for (const event of adapter.push(rawChunk)) {
|
|
212
|
+
gate.push(event);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
for (const event of adapter.finish({ reason: "complete" })) {
|
|
217
|
+
gate.push(event);
|
|
227
218
|
}
|
|
228
|
-
|
|
219
|
+
|
|
229
220
|
const { decisions } = gate.finish();
|
|
230
221
|
```
|
|
231
222
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
and OpenRouter events require a non-negative integer `choice.index`;
|
|
236
|
-
missing, invalid, or duplicate choice identity fails closed instead of
|
|
237
|
-
guessing zero. Full semantics, the decision table, and provider
|
|
238
|
-
finish-reason mapping: [`docs/EXECUTION_GATE.md`](docs/EXECUTION_GATE.md).
|
|
223
|
+
Gemini exposes structured argument projections at this seam rather than raw argument text, so its adapter does not grant the same strict raw-text execution authority. Provider-specific semantics are documented in [`docs/EXECUTION_GATE.md`](docs/EXECUTION_GATE.md).
|
|
224
|
+
|
|
225
|
+
## Validation
|
|
239
226
|
|
|
240
|
-
|
|
227
|
+
Validation is optional and validator-agnostic. You can use JSON Schema/Ajv, Standard Schema-compatible validators, Zod, TypeBox, Valibot, or a custom validator.
|
|
241
228
|
|
|
242
|
-
Schema
|
|
243
|
-
Zod, TypeBox, Valibot, a Standard Schema-compliant validator, or a
|
|
244
|
-
hand-written check via the separate `validators` option, alongside or
|
|
245
|
-
instead of a raw JSON Schema object via the pre-existing `toolSchemas`/
|
|
246
|
-
`schemas` option (statically compiled through Ajv):
|
|
229
|
+
`schemas` takes plain JSON Schema documents (TypeBox schemas count). Zod and other Standard Schema libraries go through `validators` with `fromStandardSchema()` from `prefix-safe-json/standard-schema`. Handing `schemas` a Zod schema or an AI SDK `jsonSchema()` wrapper throws at construction instead of silently validating nothing.
|
|
247
230
|
|
|
248
231
|
```typescript
|
|
249
232
|
const gate = createToolCallExecutionGate(undefined, undefined, undefined, {
|
|
250
|
-
write_file: {
|
|
233
|
+
write_file: {
|
|
234
|
+
validate: (value) =>
|
|
235
|
+
WriteFileSchema.safeParse(value).success
|
|
236
|
+
? { valid: true }
|
|
237
|
+
: { valid: false },
|
|
238
|
+
},
|
|
251
239
|
});
|
|
252
240
|
```
|
|
253
241
|
|
|
254
|
-
|
|
255
|
-
never both — registering both throws at construction time. No forced
|
|
256
|
-
dependency on any specific validation ecosystem. See
|
|
257
|
-
[`docs/VALIDATION.md`](docs/VALIDATION.md).
|
|
258
|
-
|
|
259
|
-
## Conformance
|
|
260
|
-
|
|
261
|
-
[`conformance/`](conformance/) packages this project's failure corpus as
|
|
262
|
-
a portable, provider-neutral fixture format and a small deterministic
|
|
263
|
-
runner (`prefix-safe-json/conformance`) — useful even to a project that
|
|
264
|
-
never installs this package at runtime, since the fixture format and
|
|
265
|
-
expected outcomes are meaningful against any implementation of this
|
|
266
|
-
problem class. `prefix-safe-json` is the reference implementation and
|
|
267
|
-
dogfoods this exact runner in its own test suite. See
|
|
268
|
-
[`docs/CONFORMANCE.md`](docs/CONFORMANCE.md).
|
|
269
|
-
|
|
270
|
-
## Threat model / non-goals
|
|
271
|
-
|
|
272
|
-
`prefix-safe-json` is honestly scoped as **execution integrity**, not a
|
|
273
|
-
general "AI security platform." The complete guarantee/non-guarantee
|
|
274
|
-
list, trust boundaries, and known internal limitations live in
|
|
275
|
-
[`docs/THREAT_MODEL.md`](docs/THREAT_MODEL.md); the product-level
|
|
276
|
-
owns/does-not-own boundary this is drawn from is
|
|
277
|
-
[`docs/PRODUCT_POSITIONING.md`](docs/PRODUCT_POSITIONING.md).
|
|
278
|
-
|
|
279
|
-
## Supply-chain verification
|
|
280
|
-
|
|
281
|
-
Verify releases independently rather than relying on publisher claims.
|
|
282
|
-
Published artifacts have npm provenance from this repository's GitHub
|
|
283
|
-
Actions publish workflow, and a tarball can be rebuilt and compared
|
|
284
|
-
against its release tag with `npm run verify:published-release -- <version>`
|
|
285
|
-
from a clone with tags fetched. See the command-driven
|
|
286
|
-
[maintainer audit](docs/MAINTAINER_AUDIT.md), the exact
|
|
287
|
-
[release/hash mapping](docs/RELEASE_INTEGRITY.md), the
|
|
288
|
-
[runtime dependency graph](docs/RUNTIME_DEPENDENCIES.md), and the
|
|
289
|
-
[execution-critical source map](docs/EXECUTION_AUDIT_SURFACE.md).
|
|
242
|
+
See [`docs/VALIDATION.md`](docs/VALIDATION.md).
|
|
290
243
|
|
|
291
|
-
##
|
|
244
|
+
## Conformance corpus
|
|
292
245
|
|
|
293
|
-
|
|
294
|
-
end-of-life and no longer receive security patches; this describes the
|
|
295
|
-
package's runtime requirement, not a recommendation to operate an
|
|
296
|
-
unpatched Node release. Repository development and release jobs run on
|
|
297
|
-
newer Node because the toolchain needs it — that requirement does not
|
|
298
|
-
apply to the published package's own runtime dependency graph.
|
|
246
|
+
[`conformance/`](conformance/) contains a provider-neutral fixture format and deterministic runner for this problem class. Projects can use the fixtures without adopting this package as their runtime implementation.
|
|
299
247
|
|
|
300
|
-
|
|
301
|
-
a real `streamText()` lifecycle proof (no API key, no network request, no
|
|
302
|
-
paid model call — `pnpm run example:ai-sdk-lifecycle-proof`, run in CI on
|
|
303
|
-
every push):
|
|
248
|
+
See [`docs/CONFORMANCE.md`](docs/CONFORMANCE.md).
|
|
304
249
|
|
|
305
|
-
|
|
306
|
-
| --- | --- |
|
|
307
|
-
| v5 | verified |
|
|
308
|
-
| v6 | verified |
|
|
309
|
-
| v7 | verified |
|
|
310
|
-
|
|
311
|
-
Not a claim that every version within a major is tested. Full
|
|
312
|
-
per-provider compatibility matrix, exact AI SDK pin requirements, and the
|
|
313
|
-
runtime-vs-toolchain distinction:
|
|
314
|
-
[`docs/COMPATIBILITY.md`](docs/COMPATIBILITY.md).
|
|
315
|
-
|
|
316
|
-
## Development / audit
|
|
250
|
+
## Compatibility
|
|
317
251
|
|
|
318
|
-
|
|
252
|
+
- ESM only. CommonJS code can `require()` it on Node 20.19+ / 22.12+ (Node's `require(esm)`); older runtimes need `import()`.
|
|
253
|
+
- Runtime: Node `>=18.0.0`.
|
|
254
|
+
- Repository development/release tooling uses newer Node versions.
|
|
255
|
+
- CI exercises pinned Vercel AI SDK v5, v6, and v7 integration paths.
|
|
319
256
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
adapters (OpenAI legacy + Responses, Anthropic, Gemini, OpenRouter,
|
|
326
|
-
OpenAI-compatible, Vercel AI SDK) with a coordinator for concurrent
|
|
327
|
-
tool-call streams, validator-agnostic per-tool validation (see
|
|
328
|
-
[`docs/VALIDATION.md`](docs/VALIDATION.md)), `createToolCallExecutionGate()`,
|
|
329
|
-
`createAiSdkExecutionGuard()`, call-scoped one-shot authority via
|
|
330
|
-
`takeDecision(internalId)`, and SDK execution-ownership detection.
|
|
257
|
+
| AI SDK major | CI integration check |
|
|
258
|
+
| --- | --- |
|
|
259
|
+
| v5 | yes |
|
|
260
|
+
| v6 | yes |
|
|
261
|
+
| v7 | yes |
|
|
331
262
|
|
|
332
|
-
|
|
263
|
+
This is not a claim that every patch release inside each major is tested. Exact pins and provider notes live in [`docs/COMPATIBILITY.md`](docs/COMPATIBILITY.md).
|
|
333
264
|
|
|
334
|
-
|
|
265
|
+
## Low-level parser API
|
|
335
266
|
|
|
336
267
|
```typescript
|
|
337
268
|
import { createParser } from "prefix-safe-json";
|
|
@@ -339,20 +270,40 @@ import { createParser } from "prefix-safe-json";
|
|
|
339
270
|
const parser = createParser();
|
|
340
271
|
parser.push('{"tool":"calc",');
|
|
341
272
|
parser.push('"args":{"x":42}}');
|
|
273
|
+
|
|
342
274
|
console.log(parser.snapshot().stableValue);
|
|
275
|
+
|
|
343
276
|
const result = parser.finish({ reason: "complete" });
|
|
344
|
-
console.log(result.executable);
|
|
277
|
+
console.log(result.executable);
|
|
345
278
|
```
|
|
346
279
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
280
|
+
## Development
|
|
281
|
+
|
|
282
|
+
Implemented components include the incremental UTF-8 decoder, lexical/grammar state tracking, semantic events, duplicate-key rejection, configurable resource limits, provider adapters, concurrent call coordination, validation hooks, and execution-gate APIs.
|
|
283
|
+
|
|
284
|
+
Not currently provided: a standalone CLI or network/SSE client.
|
|
285
|
+
|
|
286
|
+
Runnable examples:
|
|
287
|
+
|
|
288
|
+
- [`examples/anthropic-truncation-safety.mjs`](examples/anthropic-truncation-safety.mjs)
|
|
289
|
+
- [`examples/ai-sdk-execution-gate.mjs`](examples/ai-sdk-execution-gate.mjs)
|
|
290
|
+
- [`examples/ai-sdk-lifecycle-proof.mjs`](examples/ai-sdk-lifecycle-proof.mjs)
|
|
291
|
+
|
|
292
|
+
See [`CONTRIBUTING.md`](CONTRIBUTING.md) for the development workflow.
|
|
293
|
+
|
|
294
|
+
## Release verification
|
|
295
|
+
|
|
296
|
+
Published packages use npm provenance from this repository's GitHub Actions release workflow. A release tarball can also be rebuilt and compared with its tag using:
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
npm run verify:published-release -- <version>
|
|
300
|
+
```
|
|
351
301
|
|
|
352
|
-
|
|
302
|
+
Additional release and dependency documentation is available in:
|
|
353
303
|
|
|
354
|
-
|
|
355
|
-
|
|
304
|
+
- [`docs/MAINTAINER_AUDIT.md`](docs/MAINTAINER_AUDIT.md)
|
|
305
|
+
- [`docs/RELEASE_INTEGRITY.md`](docs/RELEASE_INTEGRITY.md)
|
|
306
|
+
- [`docs/RUNTIME_DEPENDENCIES.md`](docs/RUNTIME_DEPENDENCIES.md)
|
|
356
307
|
|
|
357
308
|
## License
|
|
358
309
|
|
|
@@ -12,6 +12,7 @@ export declare class DefaultToolCallStreamCoordinator implements ToolCallStreamC
|
|
|
12
12
|
private callCounter;
|
|
13
13
|
private eventQueue;
|
|
14
14
|
private diagnostics;
|
|
15
|
+
private readonly rejectedPushDiagnosticCodes;
|
|
15
16
|
private eventsProcessed;
|
|
16
17
|
private globalSequence;
|
|
17
18
|
private isFinished;
|
|
@@ -57,6 +58,7 @@ export declare class DefaultToolCallStreamCoordinator implements ToolCallStreamC
|
|
|
57
58
|
private handleProviderDiagnostic;
|
|
58
59
|
private handleStreamEnd;
|
|
59
60
|
private getCall;
|
|
61
|
+
private addRejectedPushDiagnostic;
|
|
60
62
|
private addDiagnostic;
|
|
61
63
|
snapshot(): ToolCallCoordinatorSnapshot;
|
|
62
64
|
drainEvents(): readonly ToolCallCoordinatorEvent[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../src/coordinator/coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAqB,KAAK,kBAAkB,EAA6B,MAAM,wBAAwB,CAAC;AAC/G,OAAO,EAAE,yBAAyB,EAAgB,eAAe,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,8BAA8B,EAC9B,qBAAqB,EACrB,iBAAiB,EAIlB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../src/coordinator/coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAqB,KAAK,kBAAkB,EAA6B,MAAM,wBAAwB,CAAC;A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IvB,OAAO,CAAC,wBAAwB;IAwChC,OAAO,CAAC,eAAe;IA0BvB,OAAO,CAAC,OAAO;IAcf,OAAO,CAAC,yBAAyB;IAWjC,OAAO,CAAC,aAAa;IASrB,QAAQ,IAAI,2BAA2B;IAmBvC,WAAW,IAAI,SAAS,wBAAwB,EAAE;IAMlD,MAAM,CAAC,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,eAAe,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,8BAA8B;CAcrG;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,EACnC,aAAa,CAAC,EAAE,aAAa,EAC7B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAC9C,yBAAyB,CAE3B"}
|
|
@@ -86,6 +86,10 @@ export class DefaultToolCallStreamCoordinator {
|
|
|
86
86
|
callCounter = 0;
|
|
87
87
|
eventQueue = [];
|
|
88
88
|
diagnostics = [];
|
|
89
|
+
// Only the three coordinator-owned rejection categories can enter this
|
|
90
|
+
// set. Keep it separate from provider diagnostics and never reset it on
|
|
91
|
+
// drainEvents(): draining observations must not erase rejection evidence.
|
|
92
|
+
rejectedPushDiagnosticCodes = new Set();
|
|
89
93
|
eventsProcessed = 0;
|
|
90
94
|
globalSequence = 0;
|
|
91
95
|
isFinished = false;
|
|
@@ -140,7 +144,7 @@ export class DefaultToolCallStreamCoordinator {
|
|
|
140
144
|
const isConflictingTerminalReason = event.type === "provider_stream_end" &&
|
|
141
145
|
this.finishedReason !== undefined &&
|
|
142
146
|
event.reason !== this.finishedReason;
|
|
143
|
-
this.
|
|
147
|
+
this.addRejectedPushDiagnostic(isConflictingTerminalReason
|
|
144
148
|
? {
|
|
145
149
|
code: TERMINAL_REASON_CONFLICT_DIAGNOSTIC_CODE,
|
|
146
150
|
severity: "fatal",
|
|
@@ -154,7 +158,7 @@ export class DefaultToolCallStreamCoordinator {
|
|
|
154
158
|
return { accepted: false };
|
|
155
159
|
}
|
|
156
160
|
if (this.eventsProcessed >= this.limits.maxNormalizedEvents) {
|
|
157
|
-
this.
|
|
161
|
+
this.addRejectedPushDiagnostic({
|
|
158
162
|
code: "E_COORDINATOR_LIMIT_EVENTS",
|
|
159
163
|
severity: "fatal",
|
|
160
164
|
message: "Maximum normalized events exceeded",
|
|
@@ -584,6 +588,17 @@ export class DefaultToolCallStreamCoordinator {
|
|
|
584
588
|
}
|
|
585
589
|
return call;
|
|
586
590
|
}
|
|
591
|
+
addRejectedPushDiagnostic(diag) {
|
|
592
|
+
// Rejected pushes do not advance eventsProcessed, so the input budget
|
|
593
|
+
// cannot bound their diagnostics. Retain the first record of each of
|
|
594
|
+
// these three categories, including its original message and severity.
|
|
595
|
+
// Never evict evidence: takeDecision() still needs it after finish() or
|
|
596
|
+
// drainEvents(). Ordinary provider/per-call diagnostics are unaffected.
|
|
597
|
+
if (this.rejectedPushDiagnosticCodes.has(diag.code))
|
|
598
|
+
return;
|
|
599
|
+
this.rejectedPushDiagnosticCodes.add(diag.code);
|
|
600
|
+
this.addDiagnostic(diag);
|
|
601
|
+
}
|
|
587
602
|
addDiagnostic(diag) {
|
|
588
603
|
this.diagnostics.push(diag);
|
|
589
604
|
this.eventQueue.push({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../src/coordinator/coordinator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAsD,MAAM,wBAAwB,CAAC;AAE/G,OAAO,EAOL,0BAA0B,GAG3B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,kCAAkC,EAClC,yCAAyC,EACzC,sCAAsC,EACtC,mCAAmC,EACnC,sCAAsC,EACtC,wCAAwC,GACzC,MA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gBAC3B,QAAQ,EAAE,IAAI,CAAC,eAAe,GAAG,CAAC;gBAClC,QAAQ,EAAE,SAAS;gBACnB,MAAM,EAAE,IAAI,EAAE,MAAM,IAAI,SAAS;gBACjC,cAAc,EAAE,IAAI,EAAE,cAAc;aACrC,CAAC,CAAC;QACL,CAAC;QACD,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK;SAC7B,CAAC;IACJ,CAAC;CACF;AAED,MAAM,UAAU,+BAA+B,CAC7C,MAAmC,EACnC,aAA6B,EAC7B,WAAoC,EACpC,UAA+C;IAE/C,OAAO,IAAI,gCAAgC,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;AAC9F,CAAC"}
|
|
@@ -44,6 +44,10 @@ export declare const TOOL_END_BEFORE_START_DIAGNOSTIC_CODE = "E_TOOL_END_BEFORE_
|
|
|
44
44
|
export declare const TOOL_ARGUMENTS_AFTER_END_DIAGNOSTIC_CODE = "E_TOOL_ARGUMENTS_AFTER_END";
|
|
45
45
|
/** AI SDK emitted more than one end part for the same call. */
|
|
46
46
|
export declare const DUPLICATE_TOOL_END_DIAGNOSTIC_CODE = "E_DUPLICATE_TOOL_END";
|
|
47
|
+
/** Anthropic emitted more than one message_delta carrying a stop_reason. */
|
|
48
|
+
export declare const DUPLICATE_MESSAGE_TERMINAL_DIAGNOSTIC_CODE = "E_DUPLICATE_MESSAGE_TERMINAL";
|
|
49
|
+
/** Anthropic content-block evidence arrived after its message's stop_reason. */
|
|
50
|
+
export declare const MESSAGE_CONTENT_AFTER_STOP_REASON_DIAGNOSTIC_CODE = "E_MESSAGE_CONTENT_AFTER_STOP_REASON";
|
|
47
51
|
/** The coordinator observed more than one start for the same source identity. */
|
|
48
52
|
export declare const DUPLICATE_TOOL_CALL_START_DIAGNOSTIC_CODE = "E_DUPLICATE_TOOL_CALL_START";
|
|
49
53
|
/** An OpenAI-compatible choice omitted a trustworthy explicit index. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostic-codes.d.ts","sourceRoot":"","sources":["../../src/coordinator/diagnostic-codes.ts"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC,uBAAuB,CAAC;AAErE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sCAAsC,6BAA6B,CAAC;AAEjF;;;;;;;;;GASG;AACH,eAAO,MAAM,mCAAmC,0BAA0B,CAAC;AAE3E,gFAAgF;AAChF,eAAO,MAAM,yCAAyC,wCACf,CAAC;AAExC,wEAAwE;AACxE,eAAO,MAAM,2CAA2C,kCACvB,CAAC;AAElC,sEAAsE;AACtE,eAAO,MAAM,qCAAqC,4BAA4B,CAAC;AAE/E,kEAAkE;AAClE,eAAO,MAAM,wCAAwC,+BAA+B,CAAC;AAErF,+DAA+D;AAC/D,eAAO,MAAM,kCAAkC,yBAAyB,CAAC;AAEzE,iFAAiF;AACjF,eAAO,MAAM,yCAAyC,gCACvB,CAAC;AAEhC,wEAAwE;AACxE,eAAO,MAAM,oCAAoC,2BAA2B,CAAC;AAE7E,0EAA0E;AAC1E,eAAO,MAAM,sCAAsC,6BAA6B,CAAC;AAEjF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sCAAsC,6BAA6B,CAAC;AAEjF;;;;;;;GAOG;AACH,eAAO,MAAM,wCAAwC,+BAA+B,CAAC;AAErF;;;;;;;GAOG;AACH,eAAO,MAAM,iDAAiD,wCACvB,CAAC;AAExC,8EAA8E;AAC9E,eAAO,MAAM,kCAAkC,EAAE,WAAW,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"diagnostic-codes.d.ts","sourceRoot":"","sources":["../../src/coordinator/diagnostic-codes.ts"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC,uBAAuB,CAAC;AAErE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sCAAsC,6BAA6B,CAAC;AAEjF;;;;;;;;;GASG;AACH,eAAO,MAAM,mCAAmC,0BAA0B,CAAC;AAE3E,gFAAgF;AAChF,eAAO,MAAM,yCAAyC,wCACf,CAAC;AAExC,wEAAwE;AACxE,eAAO,MAAM,2CAA2C,kCACvB,CAAC;AAElC,sEAAsE;AACtE,eAAO,MAAM,qCAAqC,4BAA4B,CAAC;AAE/E,kEAAkE;AAClE,eAAO,MAAM,wCAAwC,+BAA+B,CAAC;AAErF,+DAA+D;AAC/D,eAAO,MAAM,kCAAkC,yBAAyB,CAAC;AAEzE,4EAA4E;AAC5E,eAAO,MAAM,0CAA0C,iCAAiC,CAAC;AAEzF,gFAAgF;AAChF,eAAO,MAAM,iDAAiD,wCAAwC,CAAC;AAEvG,iFAAiF;AACjF,eAAO,MAAM,yCAAyC,gCACvB,CAAC;AAEhC,wEAAwE;AACxE,eAAO,MAAM,oCAAoC,2BAA2B,CAAC;AAE7E,0EAA0E;AAC1E,eAAO,MAAM,sCAAsC,6BAA6B,CAAC;AAEjF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sCAAsC,6BAA6B,CAAC;AAEjF;;;;;;;GAOG;AACH,eAAO,MAAM,wCAAwC,+BAA+B,CAAC;AAErF;;;;;;;GAOG;AACH,eAAO,MAAM,iDAAiD,wCACvB,CAAC;AAExC,8EAA8E;AAC9E,eAAO,MAAM,kCAAkC,EAAE,WAAW,CAAC,MAAM,CAajE,CAAC"}
|
|
@@ -55,6 +55,10 @@ export const TOOL_END_BEFORE_START_DIAGNOSTIC_CODE = "E_TOOL_END_BEFORE_START";
|
|
|
55
55
|
export const TOOL_ARGUMENTS_AFTER_END_DIAGNOSTIC_CODE = "E_TOOL_ARGUMENTS_AFTER_END";
|
|
56
56
|
/** AI SDK emitted more than one end part for the same call. */
|
|
57
57
|
export const DUPLICATE_TOOL_END_DIAGNOSTIC_CODE = "E_DUPLICATE_TOOL_END";
|
|
58
|
+
/** Anthropic emitted more than one message_delta carrying a stop_reason. */
|
|
59
|
+
export const DUPLICATE_MESSAGE_TERMINAL_DIAGNOSTIC_CODE = "E_DUPLICATE_MESSAGE_TERMINAL";
|
|
60
|
+
/** Anthropic content-block evidence arrived after its message's stop_reason. */
|
|
61
|
+
export const MESSAGE_CONTENT_AFTER_STOP_REASON_DIAGNOSTIC_CODE = "E_MESSAGE_CONTENT_AFTER_STOP_REASON";
|
|
58
62
|
/** The coordinator observed more than one start for the same source identity. */
|
|
59
63
|
export const DUPLICATE_TOOL_CALL_START_DIAGNOSTIC_CODE = "E_DUPLICATE_TOOL_CALL_START";
|
|
60
64
|
/** An OpenAI-compatible choice omitted a trustworthy explicit index. */
|
|
@@ -97,6 +101,8 @@ export const AUTHORITY_PROTOCOL_VIOLATION_CODES = new Set([
|
|
|
97
101
|
TOOL_END_BEFORE_START_DIAGNOSTIC_CODE,
|
|
98
102
|
TOOL_ARGUMENTS_AFTER_END_DIAGNOSTIC_CODE,
|
|
99
103
|
DUPLICATE_TOOL_END_DIAGNOSTIC_CODE,
|
|
104
|
+
DUPLICATE_MESSAGE_TERMINAL_DIAGNOSTIC_CODE,
|
|
105
|
+
MESSAGE_CONTENT_AFTER_STOP_REASON_DIAGNOSTIC_CODE,
|
|
100
106
|
DUPLICATE_TOOL_CALL_START_DIAGNOSTIC_CODE,
|
|
101
107
|
INVALID_CHOICE_INDEX_DIAGNOSTIC_CODE,
|
|
102
108
|
DUPLICATE_CHOICE_INDEX_DIAGNOSTIC_CODE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostic-codes.js","sourceRoot":"","sources":["../../src/coordinator/diagnostic-codes.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,mDAAmD;AACnD,EAAE;AACF,sEAAsE;AACtE,2EAA2E;AAC3E,yEAAyE;AACzE,2EAA2E;AAC3E,0EAA0E;AAC1E,wEAAwE;AACxE,8CAA8C;AAC9C,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,oBAAoB,CAAC;AAErE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AC;AAErF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iDAAiD,GAC5D,qCAAqC,CAAC;AAExC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,kCAAkC,GAAwB,IAAI,GAAG,CAAC;IAC7E,2CAA2C;IAC3C,qCAAqC;IACrC,wCAAwC;IACxC,kCAAkC;IAClC,0CAA0C;IAC1C,iDAAiD;IACjD,yCAAyC;IACzC,oCAAoC;IACpC,sCAAsC;IACtC,sCAAsC;IACtC,wCAAwC;IACxC,iDAAiD;CAClD,CAAC,CAAC"}
|
|
@@ -35,6 +35,7 @@ export declare class AnthropicStreamAdapter implements ProviderStreamAdapter<unk
|
|
|
35
35
|
readonly provider: ProviderName;
|
|
36
36
|
private sequence;
|
|
37
37
|
private finished;
|
|
38
|
+
private terminalReason;
|
|
38
39
|
private terminatedBlockIndices;
|
|
39
40
|
push(rawEvent: unknown): readonly NormalizedToolStreamEvent[];
|
|
40
41
|
finish(meta?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAQrD,UAAU,+BAA+B;IACvC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QACL,IAAI,EAAE,kBAAkB,CAAC;QACzB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,U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_DIAGNOSTIC_CODE, DUPLICATE_TOOL_END_DIAGNOSTIC_CODE, DUPLICATE_MESSAGE_TERMINAL_DIAGNOSTIC_CODE, MESSAGE_CONTENT_AFTER_STOP_REASON_DIAGNOSTIC_CODE, } from "../coordinator/diagnostic-codes.js";
|
|
2
2
|
export class AnthropicStreamAdapter {
|
|
3
3
|
provider = "anthropic";
|
|
4
4
|
sequence = 0;
|
|
5
5
|
finished = false;
|
|
6
|
+
terminalReason;
|
|
6
7
|
// Block-local terminal state (P4.2 / F-1): every content-block index that
|
|
7
8
|
// has already received its own content_block_stop. Uses the adapter's
|
|
8
9
|
// existing `content-block:{index}` sourceKey identity - no second
|
|
@@ -46,6 +47,13 @@ export class AnthropicStreamAdapter {
|
|
|
46
47
|
return events;
|
|
47
48
|
}
|
|
48
49
|
const chunk = rawEvent;
|
|
50
|
+
if (this.terminalReason && !this.finished &&
|
|
51
|
+
(chunk.type === "content_block_start" || chunk.type === "content_block_delta" ||
|
|
52
|
+
chunk.type === "content_block_stop")) {
|
|
53
|
+
events.push({ type: "provider_diagnostic", sequence: ++this.sequence,
|
|
54
|
+
provider: this.provider, code: MESSAGE_CONTENT_AFTER_STOP_REASON_DIAGNOSTIC_CODE,
|
|
55
|
+
severity: "error", message: "Content block evidence arrived after the message's stop_reason" });
|
|
56
|
+
}
|
|
49
57
|
switch (chunk.type) {
|
|
50
58
|
case "content_block_start": {
|
|
51
59
|
if (chunk.content_block?.type === "tool_use") {
|
|
@@ -149,17 +157,30 @@ export class AnthropicStreamAdapter {
|
|
|
149
157
|
else if (sr === "max_tokens") {
|
|
150
158
|
reason = "length";
|
|
151
159
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
sequence: ++this.sequence,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
+
if (this.finished) {
|
|
161
|
+
// Late terminal evidence must reach the coordinator and revoke authority.
|
|
162
|
+
events.push({ type: "provider_stream_end", sequence: ++this.sequence,
|
|
163
|
+
provider: this.provider, reason, providerReason: sr });
|
|
164
|
+
}
|
|
165
|
+
else if (this.terminalReason) {
|
|
166
|
+
events.push({ type: "provider_diagnostic", sequence: ++this.sequence,
|
|
167
|
+
provider: this.provider, code: DUPLICATE_MESSAGE_TERMINAL_DIAGNOSTIC_CODE,
|
|
168
|
+
severity: "error", message: "Multiple message_delta events carried a stop_reason" });
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
// stop_reason is metadata; only message_stop confirms protocol completion.
|
|
172
|
+
this.terminalReason = { reason, providerReason: sr };
|
|
173
|
+
}
|
|
160
174
|
}
|
|
161
175
|
break;
|
|
162
176
|
}
|
|
177
|
+
case "message_stop": {
|
|
178
|
+
events.push({ type: "provider_stream_end", sequence: ++this.sequence,
|
|
179
|
+
provider: this.provider, reason: this.terminalReason?.reason ?? "unknown",
|
|
180
|
+
providerReason: this.terminalReason?.providerReason });
|
|
181
|
+
this.finished = true;
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
163
184
|
case "error": {
|
|
164
185
|
events.push({
|
|
165
186
|
type: "provider_stream_end",
|
|
@@ -181,12 +202,14 @@ export class AnthropicStreamAdapter {
|
|
|
181
202
|
if (this.finished)
|
|
182
203
|
return [];
|
|
183
204
|
this.finished = true;
|
|
205
|
+
// Caller metadata cannot invent a missing message_stop.
|
|
206
|
+
const observedReason = meta?.reason ?? this.terminalReason?.reason ?? "unknown";
|
|
184
207
|
return [{
|
|
185
208
|
type: "provider_stream_end",
|
|
186
209
|
sequence: ++this.sequence,
|
|
187
210
|
provider: this.provider,
|
|
188
|
-
reason:
|
|
189
|
-
providerReason: meta?.providerReason,
|
|
211
|
+
reason: observedReason === "complete" ? "unknown" : observedReason,
|
|
212
|
+
providerReason: meta?.providerReason ?? this.terminalReason?.providerReason,
|
|
190
213
|
}];
|
|
191
214
|
}
|
|
192
215
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,wCAAwC,EACxC,kCAAkC,
|
|
1
|
+
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,wCAAwC,EACxC,kCAAkC,EAClC,0CAA0C,EAC1C,iDAAiD,GAClD,MAAM,oCAAoC,CAAC;AAwC5C,MAAM,OAAO,sBAAsB;IACxB,QAAQ,GAAiB,WAAW,CAAC;IACtC,QAAQ,GAAG,CAAC,CAAC;IACb,QAAQ,GAAG,KAAK,CAAC;IACjB,cAAc,CAAkE;IACxF,0EAA0E;IAC1E,sEAAsE;IACtE,kEAAkE;IAClE,yEAAyE;IACzE,qEAAqE;IACrE,wEAAwE;IACxE,qEAAqE;IACrE,sEAAsE;IACtE,0EAA0E;IAC1E,oEAAoE;IACpE,sEAAsE;IACtE,yEAAyE;IACzE,iEAAiE;IACjE,sEAAsE;IACtE,kEAAkE;IAC1D,sBAAsB,GAAgB,IAAI,GAAG,EAAE,CAAC;IAExD,IAAI,CAAC,QAAiB;QACpB,uEAAuE;QACvE,mEAAmE;QACnE,mEAAmE;QACnE,yEAAyE;QACzE,oEAAoE;QACpE,kEAAkE;QAClE,wEAAwE;QACxE,mEAAmE;QACnE,yEAAyE;QACzE,sEAAsE;QACtE,yEAAyE;QACzE,gEAAgE;QAChE,mEAAmE;QACnE,MAAM,MAAM,GAAgC,EAAE,CAAC;QAE/C,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAC9C,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,qBAAqB;gBAC3B,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ;gBACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,IAAI,EAAE,4BAA4B;gBAClC,QAAQ,EAAE,OAAO;gBACjB,OAAO,EAAE,4BAA4B;aACtC,CAAC,CAAC;YACH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E,qBAAqB;oBAC3B,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ;oBACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,MAAM,EAAE,gBAAgB;oBACxB,cAAc,EAAE,aAAa;iBAC9B,CAAC,CAAC;gBACH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACrB,MAAM;YACR,CAAC;YACD,sDAAsD;YACtD;gBACE,MAAM;QACV,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,IAA4D;QACjE,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,wDAAwD;QACxD,MAAM,cAAc,GAAG,IAAI,EAAE,MAAM,IAAI,IAAI,CAAC,cAAc,EAAE,MAAM,IAAI,SAAS,CAAC;QAChF,OAAO,CAAC;gBACN,IAAI,EAAE,qBAAqB;gBAC3B,QAAQ,EAAE,EAAE,IAAI,CAAC,QAAQ;gBACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,cAAc,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc;gBAClE,cAAc,EAAE,IAAI,EAAE,cAAc,IAAI,IAAI,CAAC,cAAc,EAAE,cAAc;aAC5E,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -47,14 +47,17 @@ export interface ToolInputValidator {
|
|
|
47
47
|
* discrimination anywhere in this path - `schemas` entries are always
|
|
48
48
|
* compiled as JSON Schema, `validators` entries are always used as-is, and
|
|
49
49
|
* a tool name present in both is a construction-time error rather than a
|
|
50
|
-
* silently-resolved precedence rule. See `docs/VALIDATION.md`.
|
|
50
|
+
* silently-resolved precedence rule. See `docs/VALIDATION.md`. The one
|
|
51
|
+
* exception is refusal, never re-routing: `assertJsonSchemaDocument` rejects
|
|
52
|
+
* objects that are recognizably not JSON Schema before Ajv sees them.
|
|
51
53
|
*
|
|
52
54
|
* Collision detection runs *before* any schema is compiled, so a colliding
|
|
53
55
|
* tool name is always reported as a collision - deterministically, even
|
|
54
56
|
* when that same tool's `schemas` entry also happens to be malformed JSON
|
|
55
|
-
* Schema
|
|
56
|
-
*
|
|
57
|
-
*
|
|
57
|
+
* Schema (or one of the objects `assertJsonSchemaDocument` refuses).
|
|
58
|
+
* Without this ordering, whichever check happened to run first would decide
|
|
59
|
+
* which error the caller sees, for reasons unrelated to which problem is
|
|
60
|
+
* actually more fundamental.
|
|
58
61
|
*/
|
|
59
62
|
export declare function buildValidatorMap(schemas: Record<string, object> | undefined, validators: Record<string, ToolInputValidator> | undefined): Map<string, ToolInputValidator>;
|
|
60
63
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/validation/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAAC;CAChD;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/validation/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAAC;CAChD;AA2ED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,SAAS,GACzD,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CA+CjC"}
|
package/dist/validation/types.js
CHANGED
|
@@ -27,6 +27,45 @@ function describeInvalidValidator(value) {
|
|
|
27
27
|
}
|
|
28
28
|
return `${typeof value} ${String(value)}`;
|
|
29
29
|
}
|
|
30
|
+
// Registry key the Vercel AI SDK stamps on the objects `jsonSchema()` and
|
|
31
|
+
// `zodSchema()` return (the same global symbol across ai@5, @6 and @7).
|
|
32
|
+
const AI_SDK_SCHEMA_MARKER = Symbol.for("vercel.ai.schema");
|
|
33
|
+
/**
|
|
34
|
+
* @internal
|
|
35
|
+
* Rejects two schema-library objects that are routinely mistaken for JSON
|
|
36
|
+
* Schema documents. This is not structural discrimination - nothing is
|
|
37
|
+
* converted or re-routed; a recognized non-JSON-Schema object is refused, and
|
|
38
|
+
* everything else is still compiled as JSON Schema exactly as before.
|
|
39
|
+
*
|
|
40
|
+
* - An AI SDK `jsonSchema()`/`zodSchema()` wrapper keeps its schema behind a
|
|
41
|
+
* `jsonSchema` getter, and Ajv (`strict: false`) ignores every field it
|
|
42
|
+
* does not recognize, so the wrapper compiles to an accept-everything
|
|
43
|
+
* validator: every call would pass validation. That is the fail-open case
|
|
44
|
+
* this check exists for.
|
|
45
|
+
* - A Standard Schema object (Zod, Valibot, ArkType, ...) either crashes Ajv
|
|
46
|
+
* with an unrelated-looking meta-schema error or, depending on its own
|
|
47
|
+
* fields, compiles to something that validates the wrong thing.
|
|
48
|
+
*
|
|
49
|
+
* Plain JSON Schema documents, including TypeBox schemas (plain objects that
|
|
50
|
+
* only add symbol keys), carry neither marker and are unaffected.
|
|
51
|
+
*/
|
|
52
|
+
function assertJsonSchemaDocument(toolName, schema) {
|
|
53
|
+
// Functions too: an ArkType schema is a callable Standard Schema.
|
|
54
|
+
if ((typeof schema !== "object" && typeof schema !== "function") || schema === null)
|
|
55
|
+
return;
|
|
56
|
+
const name = JSON.stringify(toolName);
|
|
57
|
+
if (schema[AI_SDK_SCHEMA_MARKER]) {
|
|
58
|
+
throw new Error(`prefix-safe-json: schemas[${name}] is an AI SDK jsonSchema()/zodSchema() wrapper, not a JSON Schema ` +
|
|
59
|
+
`document - compiled as-is it would validate nothing. Register the raw schema it wraps instead, ` +
|
|
60
|
+
`e.g. schemas: { ${name}: wrapper.jsonSchema }.`);
|
|
61
|
+
}
|
|
62
|
+
const standard = schema["~standard"];
|
|
63
|
+
if (typeof standard === "object" && standard !== null && typeof standard.validate === "function") {
|
|
64
|
+
throw new Error(`prefix-safe-json: schemas[${name}] is a Standard Schema (Zod, Valibot, ArkType, ...), not a JSON Schema ` +
|
|
65
|
+
`document. Register it through "validators" instead: validators: { ${name}: fromStandardSchema(schema) }, ` +
|
|
66
|
+
`with fromStandardSchema imported from "prefix-safe-json/standard-schema".`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
30
69
|
/**
|
|
31
70
|
* @internal
|
|
32
71
|
* Builds the coordinator's internal per-tool validator map from the two
|
|
@@ -34,14 +73,17 @@ function describeInvalidValidator(value) {
|
|
|
34
73
|
* discrimination anywhere in this path - `schemas` entries are always
|
|
35
74
|
* compiled as JSON Schema, `validators` entries are always used as-is, and
|
|
36
75
|
* a tool name present in both is a construction-time error rather than a
|
|
37
|
-
* silently-resolved precedence rule. See `docs/VALIDATION.md`.
|
|
76
|
+
* silently-resolved precedence rule. See `docs/VALIDATION.md`. The one
|
|
77
|
+
* exception is refusal, never re-routing: `assertJsonSchemaDocument` rejects
|
|
78
|
+
* objects that are recognizably not JSON Schema before Ajv sees them.
|
|
38
79
|
*
|
|
39
80
|
* Collision detection runs *before* any schema is compiled, so a colliding
|
|
40
81
|
* tool name is always reported as a collision - deterministically, even
|
|
41
82
|
* when that same tool's `schemas` entry also happens to be malformed JSON
|
|
42
|
-
* Schema
|
|
43
|
-
*
|
|
44
|
-
*
|
|
83
|
+
* Schema (or one of the objects `assertJsonSchemaDocument` refuses).
|
|
84
|
+
* Without this ordering, whichever check happened to run first would decide
|
|
85
|
+
* which error the caller sees, for reasons unrelated to which problem is
|
|
86
|
+
* actually more fundamental.
|
|
45
87
|
*/
|
|
46
88
|
export function buildValidatorMap(schemas, validators) {
|
|
47
89
|
if (schemas && validators) {
|
|
@@ -54,12 +96,24 @@ export function buildValidatorMap(schemas, validators) {
|
|
|
54
96
|
}
|
|
55
97
|
const map = new Map();
|
|
56
98
|
if (schemas) {
|
|
99
|
+
// Read every entry exactly once, then use that one snapshot for both the
|
|
100
|
+
// refusal check and compilation. If a `schemas` value were an accessor,
|
|
101
|
+
// iterating `schemas` twice (once here, once inside
|
|
102
|
+
// buildSharedAjvValidators) could let a getter return a plain schema on
|
|
103
|
+
// the checked pass and an AI SDK wrapper on the compiled pass, so the
|
|
104
|
+
// wrapper reaches Ajv unchecked and compiles to accept-everything -
|
|
105
|
+
// exactly what assertJsonSchemaDocument exists to stop.
|
|
106
|
+
const schemaEntries = Object.entries(schemas);
|
|
107
|
+
for (const [toolName, schema] of schemaEntries) {
|
|
108
|
+
assertJsonSchemaDocument(toolName, schema);
|
|
109
|
+
}
|
|
110
|
+
const materializedSchemas = Object.fromEntries(schemaEntries);
|
|
57
111
|
// One shared Ajv instance for every schema in THIS `schemas` object -
|
|
58
112
|
// pre-0.5 behavior, restored here after 0.5's per-schema
|
|
59
113
|
// createAjvValidator() calls regressed it (a schema could no longer
|
|
60
114
|
// $ref another schema registered in the same construction - see
|
|
61
115
|
// buildSharedAjvValidators's own doc comment for the direct proof).
|
|
62
|
-
for (const [toolName, validator] of buildSharedAjvValidators(
|
|
116
|
+
for (const [toolName, validator] of buildSharedAjvValidators(materializedSchemas)) {
|
|
63
117
|
map.set(toolName, validator);
|
|
64
118
|
}
|
|
65
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/validation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AA2C9D;;;;;;;;;;;;;GAaG;AACH,SAAS,0BAA0B,CAAC,KAAc;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAQ,KAAgC,CAAC,QAAQ,KAAK,UAAU,CAAC;AACzH,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAc;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IACD,OAAO,GAAG,OAAO,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAC5C,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/validation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AA2C9D;;;;;;;;;;;;;GAaG;AACH,SAAS,0BAA0B,CAAC,KAAc;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAQ,KAAgC,CAAC,QAAQ,KAAK,UAAU,CAAC;AACzH,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAc;IAC9C,IAAI,OAAO,KAAK,KAAK,QAAQ,E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IAAI,CAAC,0BAA0B,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC3C,MAAM,IAAI,KAAK,CACb,gCAAgC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,wCAAwC;oBAC9F,4DAA4D,wBAAwB,CAAC,SAAS,CAAC,EAAE,CACpG,CAAC;YACJ,CAAC;YACD,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prefix-safe-json",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Fail-closed execution integrity for streamed LLM tool calls — reject truncated or unconfirmed arguments before side effects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"json",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"tool-execution",
|
|
13
13
|
"execution-safety",
|
|
14
14
|
"function-calling",
|
|
15
|
-
"
|
|
15
|
+
"vercel-ai-sdk",
|
|
16
16
|
"json-parser"
|
|
17
17
|
],
|
|
18
18
|
"license": "MIT OR Apache-2.0",
|
|
@@ -30,19 +30,23 @@
|
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
32
|
"types": "./dist/index.d.ts",
|
|
33
|
-
"import": "./dist/index.js"
|
|
33
|
+
"import": "./dist/index.js",
|
|
34
|
+
"default": "./dist/index.js"
|
|
34
35
|
},
|
|
35
36
|
"./ajv": {
|
|
36
37
|
"types": "./dist/ajv.d.ts",
|
|
37
|
-
"import": "./dist/ajv.js"
|
|
38
|
+
"import": "./dist/ajv.js",
|
|
39
|
+
"default": "./dist/ajv.js"
|
|
38
40
|
},
|
|
39
41
|
"./standard-schema": {
|
|
40
42
|
"types": "./dist/standard-schema.d.ts",
|
|
41
|
-
"import": "./dist/standard-schema.js"
|
|
43
|
+
"import": "./dist/standard-schema.js",
|
|
44
|
+
"default": "./dist/standard-schema.js"
|
|
42
45
|
},
|
|
43
46
|
"./conformance": {
|
|
44
47
|
"types": "./dist/conformance.d.ts",
|
|
45
|
-
"import": "./dist/conformance.js"
|
|
48
|
+
"import": "./dist/conformance.js",
|
|
49
|
+
"default": "./dist/conformance.js"
|
|
46
50
|
}
|
|
47
51
|
},
|
|
48
52
|
"files": [
|
|
@@ -110,7 +114,8 @@
|
|
|
110
114
|
"tsx": "^4.16.0",
|
|
111
115
|
"typescript": "^5.5.0",
|
|
112
116
|
"typescript-eslint": "^8.0.0",
|
|
113
|
-
"vitest": "^3.2.6"
|
|
117
|
+
"vitest": "^3.2.6",
|
|
118
|
+
"zod": "4.4.3"
|
|
114
119
|
},
|
|
115
120
|
"pnpm": {
|
|
116
121
|
"overrides": {
|