stitchkit 0.90.7 → 0.91.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +107 -0
- package/dist/agent-runtime-coding-tools.js +4 -4
- package/dist/agent-runtime-harness.js +6 -6
- package/dist/agent-runtime-sandbox.js +4 -4
- package/dist/agent-runtime.js +18 -17
- package/dist/application-grammy.js +1 -1
- package/dist/application.js +3 -3
- package/dist/cli.js +7 -7
- package/dist/contract/errors-factory.d.ts +12 -0
- package/dist/contract/errors-factory.d.ts.map +1 -1
- package/dist/contract/errors.d.ts +35 -1
- package/dist/contract/errors.d.ts.map +1 -1
- package/dist/contract/index.d.ts +1 -1
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/contract/index.js +4 -2
- package/dist/{index-nrqg8tks.js → index-0a349c33.js} +3 -3
- package/dist/index-0j3vcp5m.js +28 -0
- package/dist/{index-vy2nxwg8.js → index-137jjs4v.js} +2 -2
- package/dist/{index-2hryh65w.js → index-13cjtmrw.js} +54 -13
- package/dist/{index-7gqx71yd.js → index-13e1k7v9.js} +9 -3
- package/dist/{index-1bnkzq95.js → index-1qvdwnp2.js} +10 -3
- package/dist/{index-scs3f1eg.js → index-2vtcmrj9.js} +8 -2
- package/dist/{index-xbppf54a.js → index-6kyksz9y.js} +12 -7
- package/dist/{index-aj9geeez.js → index-709nh7z7.js} +37 -17
- package/dist/{index-zkcqhxx8.js → index-a11g2kry.js} +1 -1
- package/dist/{index-1txvygak.js → index-b971qjes.js} +1 -1
- package/dist/{index-tgh3ksfh.js → index-bh70rk41.js} +3 -3
- package/dist/{index-bva395we.js → index-bv7mytab.js} +2 -2
- package/dist/{index-s208wab5.js → index-bx6yq2m4.js} +23 -495
- package/dist/{index-83fafqw8.js → index-f4p4b8f6.js} +10 -11
- package/dist/index-kw9t5ayn.js +507 -0
- package/dist/{index-8pjqv3zh.js → index-mqhjmadk.js} +43 -21
- package/dist/{index-3yqgj323.js → index-qjeyx5t2.js} +2 -2
- package/dist/{index-gte38nbm.js → index-qmy6zq75.js} +1 -1
- package/dist/{index-zsdgd1tz.js → index-qrbdq8jk.js} +1 -1
- package/dist/{index-fqg5mfk7.js → index-ya611vx3.js} +4 -4
- package/dist/{index-640tz39q.js → index-zsqy3xfn.js} +5 -5
- package/dist/index.js +8 -6
- package/dist/internal/canonical-json.d.ts +20 -0
- package/dist/internal/canonical-json.d.ts.map +1 -0
- package/dist/internal/errors.d.ts +13 -4
- package/dist/internal/errors.d.ts.map +1 -1
- package/dist/node.js +6 -6
- package/dist/observability/bounded-logger.d.ts +2 -0
- package/dist/observability/bounded-logger.d.ts.map +1 -1
- package/dist/observability/index.js +7 -4
- package/dist/observability/sanitize.d.ts +15 -0
- package/dist/observability/sanitize.d.ts.map +1 -1
- package/dist/primitives.js +2 -2
- package/dist/realtime/rejected-frame.d.ts +6 -0
- package/dist/realtime/rejected-frame.d.ts.map +1 -1
- package/dist/remote.js +5 -5
- package/dist/server/implement.d.ts +33 -7
- package/dist/server/implement.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +8 -8
- package/dist/testing/surface-manifest.d.ts +2 -1
- package/dist/testing/surface-manifest.d.ts.map +1 -1
- package/dist/testing.js +11 -27
- package/dist/tool-invoker.js +6 -6
- package/dist/tools/agent.d.ts +12 -0
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/cli-format.d.ts +1 -1
- package/dist/tools/connections/index.js +1 -1
- package/dist/tools/durability-context.d.ts +1 -1
- package/dist/tools/durability-context.d.ts.map +1 -1
- package/dist/tools/durability-port.d.ts +55 -0
- package/dist/tools/durability-port.d.ts.map +1 -0
- package/dist/tools/execute.d.ts +59 -1
- package/dist/tools/execute.d.ts.map +1 -1
- package/dist/tools/mcp-catalog.d.ts +68 -0
- package/dist/tools/mcp-catalog.d.ts.map +1 -0
- package/dist/tools/mcp.d.ts +3 -0
- package/dist/tools/mcp.d.ts.map +1 -1
- package/dist/tools/mount.d.ts +2 -2
- package/dist/tools/mount.d.ts.map +1 -1
- package/dist/tools/native-mcp.d.ts +3 -0
- package/dist/tools/native-mcp.d.ts.map +1 -1
- package/dist/tools/runtime-tool.d.ts +1 -1
- package/dist/tools/runtime-tool.d.ts.map +1 -1
- package/dist/tools.d.ts +5 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +99 -20
- package/dist/tracking.js +2 -2
- package/llms-full.txt +258 -8
- package/package.json +2 -2
- package/dist/index-7rkhw9ec.js +0 -34
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,113 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
|
|
|
15
15
|
|
|
16
16
|
## [Unreleased]
|
|
17
17
|
|
|
18
|
+
## [0.91.0] — 2026-09-22
|
|
19
|
+
|
|
20
|
+
### ⚠️ Breaking changes
|
|
21
|
+
|
|
22
|
+
- **`STITCH_ERROR_STATUS` gained `NOT_IMPLEMENTED` (501).** An exhaustive error
|
|
23
|
+
vocabulary must name it; without the row `defineErrors({ mapping: { exhaustive:
|
|
24
|
+
true } })` stops compiling and then throws at startup. The code is thrown only
|
|
25
|
+
by the new dev-only `onMissingHandler: 'stub'` policy, and it is registered
|
|
26
|
+
rather than thrown ad hoc on purpose: the framework must not emit a code its
|
|
27
|
+
own registry does not know, or the code travels in stitchkit's spelling past
|
|
28
|
+
every consumer `codeMap`.
|
|
29
|
+
`// before: map: { …, WAIT_TIMEOUT: 'timeout' }` →
|
|
30
|
+
`// after: map: { …, NOT_IMPLEMENTED: 'not_implemented', WAIT_TIMEOUT: 'timeout' }`
|
|
31
|
+
|
|
32
|
+
**Who must act:** any consumer declaring an exhaustive error vocabulary. Nobody
|
|
33
|
+
else: every other change in this release is additive.
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
|
|
37
|
+
- **`beforeToolCall` may return replacement arguments.** The pipeline was
|
|
38
|
+
asymmetric: `lifecycle.afterHandle` could already transform the output, while
|
|
39
|
+
the only way to affect the input was to throw — so expanding a reference into a
|
|
40
|
+
value *before* validation had nowhere to stand. A returned record replaces the
|
|
41
|
+
arguments and is validated by the contract schema like any other input. Only a
|
|
42
|
+
plain object is read as a replacement: `undefined`, `null`, a `Map` from a
|
|
43
|
+
one-line `audit.set(...)`, the number a `push` returns — everything an existing
|
|
44
|
+
hook already returns — keeps today's behaviour byte for byte. `afterToolCall` reports
|
|
45
|
+
the caller's arguments as `args` and the replacement as `effectiveArgs`, so a
|
|
46
|
+
rewrite is visible as a rewrite rather than by overwriting the evidence.
|
|
47
|
+
- **The model-facing tool refusal carries `retryable`.** One bit decides the
|
|
48
|
+
model's next move — wait and retry, fix the input, or stop — and until now it
|
|
49
|
+
was read off the code NAME. It is resolved on the failure itself, declared or
|
|
50
|
+
derived from the status of the normalized error, so an application's own
|
|
51
|
+
`status: 429` is retryable exactly like the framework's and the answer survives
|
|
52
|
+
a process hop; `ErrorDefinition` may declare `retryable` where the status class
|
|
53
|
+
is wrong in either direction. The rule is deliberately not "any `5xx`":
|
|
54
|
+
`REALTIME_CONTRACT_VIOLATION` and `STREAM_ITEM_INVALID` are 500 and
|
|
55
|
+
deterministic. `isRetryableStatus` is exported. The field is on **every**
|
|
56
|
+
failed tool envelope — the CLI's JSON error and the MCP error text block gained
|
|
57
|
+
a key; the HTTP envelope did not.
|
|
58
|
+
- **`toolCallId` travels as ordinary tool-call context.** A consumer running its
|
|
59
|
+
own agent loop already received the outcome of every call through
|
|
60
|
+
`afterToolCall` — with no way to say which call it belonged to, so it
|
|
61
|
+
reconstructed the answer from serialized text instead. One consumer measured
|
|
62
|
+
five places asking "did this call fail" and getting five different answers.
|
|
63
|
+
`AgentToolError` and `isAgentToolError` are now exported too, so the failure can
|
|
64
|
+
be brand-checked instead of parsed.
|
|
65
|
+
- **`mountAgent({ durability })` — restartable tool bodies without
|
|
66
|
+
`agent-runtime`, engine included.** `step` / `sleep` / `waitFor` appear in the
|
|
67
|
+
handler context. The `ToolDurability` port is what a body sees; the engine,
|
|
68
|
+
`createLocalStepDurability`, now ships from `stitchkit/tools` beside it, with
|
|
69
|
+
`StepDurabilityLedger` and the ledger's row types — an application supplies two
|
|
70
|
+
methods over storage it already has and gets replay, absolute deadlines,
|
|
71
|
+
park/deliver and decode refusal instead of writing them. The engine is
|
|
72
|
+
self-contained, and a build check over the real chunk graph holds that the
|
|
73
|
+
runtime proper never follows it into `stitchkit/tools`.
|
|
74
|
+
- **`onMissingHandler: 'stub'` for every binding form.** A contract endpoint with
|
|
75
|
+
no handler is mounted as a `501` refusal instead of taking the whole application
|
|
76
|
+
down. For one measured situation: a dev stand under a file watcher, where adding
|
|
77
|
+
an endpoint is two edits by construction and the editor saves one file at a
|
|
78
|
+
time, so the stand is down between them for everyone using it. Both save orders
|
|
79
|
+
are covered — a contract ahead of its handler and a handler ahead of its
|
|
80
|
+
contract. `'throw'` remains the default and the only production answer, and the
|
|
81
|
+
compile-time exactness check is untouched.
|
|
82
|
+
|
|
83
|
+
- **A string bound for one key, wherever it sits.** `redact` / `sanitizePayload`
|
|
84
|
+
take `maxStringLengthByKey` and `createBoundedLogger` takes
|
|
85
|
+
`bounds.stringLengthByKey`. One bound for the whole record cut an error's
|
|
86
|
+
stack from the bottom — where the consumer's own frames are; now the ceiling
|
|
87
|
+
for `stack` alone can be raised. Keyed by name, not path, because the same
|
|
88
|
+
field sits at the top of one record and under `errorDetail` in the next. The
|
|
89
|
+
byte ceiling keeps the last word.
|
|
90
|
+
|
|
91
|
+
→ ADR 0187.
|
|
92
|
+
|
|
93
|
+
## [0.90.8] — 2026-09-21
|
|
94
|
+
|
|
95
|
+
### Added
|
|
96
|
+
|
|
97
|
+
- **Every advertised MCP tool and every tool result now carries a catalog
|
|
98
|
+
stamp** — `_meta["stitchkit/catalog"] = { digest, tools }`, the fingerprint of
|
|
99
|
+
the exact advertised surface. A long-lived consumer stores it when it lists the
|
|
100
|
+
tools and compares it on responses it was already receiving, so it learns its
|
|
101
|
+
own copy of the contract is stale **without making a request to find out** —
|
|
102
|
+
including on the refusal that a stale copy causes, which is when the question
|
|
103
|
+
actually gets asked. `mcpCatalogStamp`, `readMcpCatalogStamp`,
|
|
104
|
+
`mcpCatalogMeta`, `MCP_CATALOG_META_KEY` and `McpCatalogStamp` are exported
|
|
105
|
+
from `stitchkit/tools`. `notifications/tools/list_changed` is the push-shaped
|
|
106
|
+
answer to the same problem and `createMcpHandler` cannot send it — it is
|
|
107
|
+
stateless by construction, so there is no retained session to notify; that
|
|
108
|
+
boundary is stated in `docs/architecture/mcp-semantics.md` rather than papered
|
|
109
|
+
over.
|
|
110
|
+
|
|
111
|
+
### Fixed
|
|
112
|
+
|
|
113
|
+
- **A refused union now names the branch and the field instead of only
|
|
114
|
+
`(root)`.** Zod reports a failed `z.union` as one issue — code
|
|
115
|
+
`invalid_union`, path `(root)`, message `Invalid input` — and every per-branch
|
|
116
|
+
reason it computed was discarded on the way to the wire. The refusal therefore
|
|
117
|
+
said that a request was wrong and nothing about what would have been right, so
|
|
118
|
+
whoever hit it blamed the source. `zodIssues` now descends into the branches:
|
|
119
|
+
the union's own issue carries a message naming each branch and where it
|
|
120
|
+
failed, and each branch failure arrives as its own issue with a full path and
|
|
121
|
+
a `branch` number. `formatZodError` and realtime rejection reports carry the
|
|
122
|
+
same detail. Additive — the issue shape gained an optional field and lost
|
|
123
|
+
nothing.
|
|
124
|
+
|
|
18
125
|
## [0.90.7] — 2026-09-21
|
|
19
126
|
|
|
20
127
|
### Fixed
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
AgentCodingToolLimitsSchema,
|
|
4
4
|
AgentCodingToolPathAuthorizationSchema,
|
|
5
5
|
createAgentCodingTools
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-qjeyx5t2.js";
|
|
7
7
|
import"./index-bn2cjajt.js";
|
|
8
|
-
import"./index-
|
|
9
|
-
import"./index-
|
|
8
|
+
import"./index-qmy6zq75.js";
|
|
9
|
+
import"./index-0a349c33.js";
|
|
10
10
|
import"./index-rxfy4cq7.js";
|
|
11
11
|
import"./index-6k1937bx.js";
|
|
12
12
|
import"./index-8z9we758.js";
|
|
13
13
|
import"./index-fenaekmk.js";
|
|
14
14
|
import"./index-cby4ar3v.js";
|
|
15
|
-
import"./index-
|
|
15
|
+
import"./index-2vtcmrj9.js";
|
|
16
16
|
import"./index-kzfs85xp.js";
|
|
17
17
|
import"./index-77fekveh.js";
|
|
18
18
|
export {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
composeAgentPrompt,
|
|
7
7
|
createAgentRuntime,
|
|
8
8
|
createAgentRuntimeEventSink
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-bx6yq2m4.js";
|
|
10
10
|
import"./index-p13mwz16.js";
|
|
11
11
|
import"./index-y64k3s0h.js";
|
|
12
12
|
import {
|
|
@@ -18,12 +18,12 @@ import"./index-wnfk50r0.js";
|
|
|
18
18
|
import {
|
|
19
19
|
walkContainedFiles
|
|
20
20
|
} from "./index-bn2cjajt.js";
|
|
21
|
-
import"./index-
|
|
22
|
-
import"./index-
|
|
21
|
+
import"./index-kw9t5ayn.js";
|
|
22
|
+
import"./index-mqhjmadk.js";
|
|
23
23
|
import"./index-vsbzgd7b.js";
|
|
24
24
|
import"./index-f9mb610r.js";
|
|
25
|
-
import"./index-
|
|
26
|
-
import"./index-
|
|
25
|
+
import"./index-13cjtmrw.js";
|
|
26
|
+
import"./index-0a349c33.js";
|
|
27
27
|
import"./index-rxfy4cq7.js";
|
|
28
28
|
import"./index-6k1937bx.js";
|
|
29
29
|
import"./index-zcgf3gqf.js";
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
} from "./index-8z9we758.js";
|
|
34
34
|
import"./index-fenaekmk.js";
|
|
35
35
|
import"./index-cby4ar3v.js";
|
|
36
|
-
import"./index-
|
|
36
|
+
import"./index-2vtcmrj9.js";
|
|
37
37
|
import"./index-kzfs85xp.js";
|
|
38
38
|
import"./index-77fekveh.js";
|
|
39
39
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAgentCodingTools
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-qjeyx5t2.js";
|
|
4
4
|
import"./index-bn2cjajt.js";
|
|
5
5
|
import {
|
|
6
6
|
codingRefusal,
|
|
7
7
|
missingSandboxRestrictions,
|
|
8
8
|
probeAgentProcessSandbox
|
|
9
|
-
} from "./index-
|
|
10
|
-
import"./index-
|
|
9
|
+
} from "./index-qmy6zq75.js";
|
|
10
|
+
import"./index-0a349c33.js";
|
|
11
11
|
import"./index-rxfy4cq7.js";
|
|
12
12
|
import"./index-6k1937bx.js";
|
|
13
13
|
import"./index-8z9we758.js";
|
|
14
14
|
import"./index-fenaekmk.js";
|
|
15
15
|
import"./index-cby4ar3v.js";
|
|
16
|
-
import"./index-
|
|
16
|
+
import"./index-2vtcmrj9.js";
|
|
17
17
|
import"./index-kzfs85xp.js";
|
|
18
18
|
import"./index-77fekveh.js";
|
|
19
19
|
|
package/dist/agent-runtime.js
CHANGED
|
@@ -3,12 +3,6 @@ import {
|
|
|
3
3
|
AgentProviderStreamCutError,
|
|
4
4
|
AgentRuntimeConflictError,
|
|
5
5
|
AgentTokenCountSchema,
|
|
6
|
-
DURABILITY_STEP_EVENT_KIND,
|
|
7
|
-
ParkAbortedError,
|
|
8
|
-
ParkRecordDecodeError,
|
|
9
|
-
StepAbortedError,
|
|
10
|
-
StepResultDecodeError,
|
|
11
|
-
StepResultNotSerializableError,
|
|
12
6
|
agentGoalStateSlot,
|
|
13
7
|
agentTodoStateSlot,
|
|
14
8
|
classifyProviderFailure,
|
|
@@ -18,7 +12,6 @@ import {
|
|
|
18
12
|
createAgentSessionCoordinator,
|
|
19
13
|
createAgentStateSlotStore,
|
|
20
14
|
createAgentToolFenceLifecycle,
|
|
21
|
-
createLocalStepDurability,
|
|
22
15
|
deferredToolCatalog,
|
|
23
16
|
defineStateSlot,
|
|
24
17
|
isToolResultFailure,
|
|
@@ -31,7 +24,7 @@ import {
|
|
|
31
24
|
renderAgentStateSlots,
|
|
32
25
|
repairedSearchCall,
|
|
33
26
|
selectAgentHistory
|
|
34
|
-
} from "./index-
|
|
27
|
+
} from "./index-bx6yq2m4.js";
|
|
35
28
|
import"./index-p13mwz16.js";
|
|
36
29
|
import {
|
|
37
30
|
AgentAdmissionEventSchema,
|
|
@@ -165,19 +158,27 @@ import {
|
|
|
165
158
|
probeAgentProcessSandbox,
|
|
166
159
|
recordAgentSandboxProbe,
|
|
167
160
|
refuseUnknownSpillReference
|
|
168
|
-
} from "./index-
|
|
161
|
+
} from "./index-qmy6zq75.js";
|
|
169
162
|
import {
|
|
170
163
|
buildToolManifest,
|
|
171
164
|
mountAgent
|
|
172
|
-
} from "./index-
|
|
173
|
-
import
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
165
|
+
} from "./index-f4p4b8f6.js";
|
|
166
|
+
import {
|
|
167
|
+
DURABILITY_STEP_EVENT_KIND,
|
|
168
|
+
ParkAbortedError,
|
|
169
|
+
ParkRecordDecodeError,
|
|
170
|
+
StepAbortedError,
|
|
171
|
+
StepResultDecodeError,
|
|
172
|
+
StepResultNotSerializableError,
|
|
173
|
+
createLocalStepDurability
|
|
174
|
+
} from "./index-kw9t5ayn.js";
|
|
175
|
+
import"./index-qrbdq8jk.js";
|
|
176
|
+
import"./index-1qvdwnp2.js";
|
|
177
|
+
import"./index-mqhjmadk.js";
|
|
177
178
|
import"./index-vsbzgd7b.js";
|
|
178
179
|
import"./index-f9mb610r.js";
|
|
179
|
-
import"./index-
|
|
180
|
-
import"./index-
|
|
180
|
+
import"./index-13cjtmrw.js";
|
|
181
|
+
import"./index-0a349c33.js";
|
|
181
182
|
import"./index-rxfy4cq7.js";
|
|
182
183
|
import"./index-6k1937bx.js";
|
|
183
184
|
import {
|
|
@@ -190,7 +191,7 @@ import {
|
|
|
190
191
|
} from "./index-8z9we758.js";
|
|
191
192
|
import"./index-fenaekmk.js";
|
|
192
193
|
import"./index-cby4ar3v.js";
|
|
193
|
-
import"./index-
|
|
194
|
+
import"./index-2vtcmrj9.js";
|
|
194
195
|
import"./index-kzfs85xp.js";
|
|
195
196
|
import {
|
|
196
197
|
executableAgentRuntimeTools
|
package/dist/application.js
CHANGED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
ApplicationShutdownBudgetSchema,
|
|
37
37
|
ApplicationShutdownOptionsSchema,
|
|
38
38
|
createApplication
|
|
39
|
-
} from "./index-
|
|
39
|
+
} from "./index-a11g2kry.js";
|
|
40
40
|
import {
|
|
41
41
|
ApplicationAdmissionSnapshotSchema,
|
|
42
42
|
ApplicationHealthSchema,
|
|
@@ -82,12 +82,12 @@ import {
|
|
|
82
82
|
} from "./index-7gnkny4z.js";
|
|
83
83
|
import {
|
|
84
84
|
measureSize
|
|
85
|
-
} from "./index-
|
|
85
|
+
} from "./index-6kyksz9y.js";
|
|
86
86
|
import {
|
|
87
87
|
argumentsDigest,
|
|
88
88
|
stableValue
|
|
89
89
|
} from "./index-a916km3r.js";
|
|
90
|
-
import"./index-
|
|
90
|
+
import"./index-2vtcmrj9.js";
|
|
91
91
|
import"./index-kzfs85xp.js";
|
|
92
92
|
import"./index-77fekveh.js";
|
|
93
93
|
// src/application/admission.ts
|
package/dist/cli.js
CHANGED
|
@@ -11,15 +11,15 @@ import {
|
|
|
11
11
|
readCapped,
|
|
12
12
|
renderCliView,
|
|
13
13
|
routeCliArgv
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-ya611vx3.js";
|
|
15
15
|
import"./index-sbdmyz75.js";
|
|
16
|
-
import"./index-
|
|
17
|
-
import"./index-
|
|
18
|
-
import"./index-
|
|
16
|
+
import"./index-qrbdq8jk.js";
|
|
17
|
+
import"./index-1qvdwnp2.js";
|
|
18
|
+
import"./index-mqhjmadk.js";
|
|
19
19
|
import"./index-vsbzgd7b.js";
|
|
20
20
|
import"./index-f9mb610r.js";
|
|
21
|
-
import"./index-
|
|
22
|
-
import"./index-
|
|
21
|
+
import"./index-13cjtmrw.js";
|
|
22
|
+
import"./index-0a349c33.js";
|
|
23
23
|
import"./index-rxfy4cq7.js";
|
|
24
24
|
import"./index-6k1937bx.js";
|
|
25
25
|
import"./index-zcgf3gqf.js";
|
|
@@ -31,7 +31,7 @@ import"./index-fenaekmk.js";
|
|
|
31
31
|
import"./index-cby4ar3v.js";
|
|
32
32
|
import {
|
|
33
33
|
AppError
|
|
34
|
-
} from "./index-
|
|
34
|
+
} from "./index-2vtcmrj9.js";
|
|
35
35
|
import {
|
|
36
36
|
safeJsonParse
|
|
37
37
|
} from "./index-kzfs85xp.js";
|
|
@@ -35,10 +35,22 @@ export type ErrorDetailsSchema = z.ZodObject | z.ZodOptional<z.ZodObject>;
|
|
|
35
35
|
export type ErrorDefinition = {
|
|
36
36
|
readonly status: number;
|
|
37
37
|
readonly message?: string;
|
|
38
|
+
readonly retryable?: boolean;
|
|
38
39
|
readonly details?: never;
|
|
39
40
|
} | {
|
|
40
41
|
readonly status: number;
|
|
41
42
|
readonly message?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Whether repeating the call could succeed, when the status class gets it
|
|
45
|
+
* wrong. Omitted, it is derived from `status`.
|
|
46
|
+
*
|
|
47
|
+
* This is where ADR 0077 refused to put `hint`, and the reason does not
|
|
48
|
+
* apply: a hint DECLARED here would concatenate with the surface-wide
|
|
49
|
+
* `ErrorHintFn` and repeat itself on every instance of the code. A
|
|
50
|
+
* boolean has nothing to concatenate with — it is one fact about the
|
|
51
|
+
* code, stated once, in the same place its status is stated.
|
|
52
|
+
*/
|
|
53
|
+
readonly retryable?: boolean;
|
|
42
54
|
readonly details: ErrorDetailsSchema;
|
|
43
55
|
};
|
|
44
56
|
export type ErrorDefinitions = Record<string, ErrorDefinition>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-factory.d.ts","sourceRoot":"","sources":["../../src/contract/errors-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;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CAAC,YAAY,SAAS,gBAAgB,EAC3C,KAAK,CAAC,QAAQ,SAAS,sBAAsB,CAAC,YAAY,CAAC,GAAG,SAAS,GAAG,SAAS,EACnF,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,aAAa,CAAC,YAAY,EAAE,QAAQ,CAAC,CA4HjF"}
|
|
@@ -32,13 +32,35 @@ export declare class AppError<TCode extends string = string, TDetails extends Re
|
|
|
32
32
|
* logs/observability — deliberately NOT part of `toJSON()`'s envelope.
|
|
33
33
|
*/
|
|
34
34
|
readonly traceId?: string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Whether repeating this call could succeed, when the error declares it.
|
|
37
|
+
*
|
|
38
|
+
* Metadata, like `traceId`, and for the same reason: it is not part of
|
|
39
|
+
* `toJSON()`'s HTTP envelope. It exists for the MODEL-facing tool envelope,
|
|
40
|
+
* where the next move — wait and retry, fix the input, or stop — is the
|
|
41
|
+
* whole decision a refusal has to support. Left `undefined`, the class is
|
|
42
|
+
* derived from `status`; declared, it wins, for the domain failure whose
|
|
43
|
+
* status says one thing and whose truth is the other.
|
|
44
|
+
*/
|
|
45
|
+
readonly retryable?: boolean | undefined;
|
|
35
46
|
constructor(code: TCode, message?: string, status?: number, details?: TDetails | undefined, hint?: string | undefined,
|
|
36
47
|
/**
|
|
37
48
|
* Transport trace id (`x-request-id`) preserved across the
|
|
38
49
|
* `ApiError → AppError` conversion in `implementRemote`. Metadata for
|
|
39
50
|
* logs/observability — deliberately NOT part of `toJSON()`'s envelope.
|
|
40
51
|
*/
|
|
41
|
-
traceId?: string | undefined
|
|
52
|
+
traceId?: string | undefined,
|
|
53
|
+
/**
|
|
54
|
+
* Whether repeating this call could succeed, when the error declares it.
|
|
55
|
+
*
|
|
56
|
+
* Metadata, like `traceId`, and for the same reason: it is not part of
|
|
57
|
+
* `toJSON()`'s HTTP envelope. It exists for the MODEL-facing tool envelope,
|
|
58
|
+
* where the next move — wait and retry, fix the input, or stop — is the
|
|
59
|
+
* whole decision a refusal has to support. Left `undefined`, the class is
|
|
60
|
+
* derived from `status`; declared, it wins, for the domain failure whose
|
|
61
|
+
* status says one thing and whose truth is the other.
|
|
62
|
+
*/
|
|
63
|
+
retryable?: boolean | undefined);
|
|
42
64
|
static is(err: unknown): err is AppError;
|
|
43
65
|
toJSON(): ErrorEnvelope;
|
|
44
66
|
}
|
|
@@ -83,6 +105,7 @@ export declare const STITCH_ERROR_STATUS: {
|
|
|
83
105
|
REALTIME_CONTRACT_VIOLATION: number;
|
|
84
106
|
APPLICATION_NOT_ACCEPTING: number;
|
|
85
107
|
GRAMMY_WEBHOOK_NOT_ACCEPTING: number;
|
|
108
|
+
NOT_IMPLEMENTED: number;
|
|
86
109
|
WAIT_TIMEOUT: number;
|
|
87
110
|
WAIT_FAILED: number;
|
|
88
111
|
DOWNLOAD_NOT_FOUND: number;
|
|
@@ -97,6 +120,17 @@ export declare const STITCH_ERROR_STATUS: {
|
|
|
97
120
|
SPILL_REFERENCE_UNKNOWN: number;
|
|
98
121
|
INTERNAL_SERVER_ERROR: number;
|
|
99
122
|
};
|
|
123
|
+
/**
|
|
124
|
+
* Whether a status class means "the same call could work later".
|
|
125
|
+
*
|
|
126
|
+
* Deliberately not "any 5xx". `REALTIME_CONTRACT_VIOLATION`,
|
|
127
|
+
* `STREAM_ITEM_INVALID` and `FRAME_TOO_LARGE` are all 500 and all deterministic
|
|
128
|
+
* — the same call fails the same way every time, and telling a model to retry
|
|
129
|
+
* them buys nothing but billed turns. 408 and 504 are timeouts, 429 is a rate
|
|
130
|
+
* limit, 502 and 503 are an upstream that may return; those are the ones where
|
|
131
|
+
* waiting is a strategy rather than a hope.
|
|
132
|
+
*/
|
|
133
|
+
export declare function isRetryableStatus(status: number): boolean;
|
|
100
134
|
/** A code stitchkit itself emits — derived from `STITCH_ERROR_STATUS` (no dup). */
|
|
101
135
|
export type StitchErrorCode = keyof typeof STITCH_ERROR_STATUS;
|
|
102
136
|
/** Type guard — is `code` one of stitchkit's own error codes? */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/contract/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE;QACL,2CAA2C;QAC3C,IAAI,EAAE,MAAM,CAAC;QACb,8BAA8B;QAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,gCAAgC;QAChC,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,0BAA0B;QAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAcD;;;;GAIG;AACH,qBAAa,QAAQ,CACnB,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAC1F,SAAQ,KAAK;aAEK,IAAI,EAAE,KAAK;aAEX,MAAM,EAAE,MAAM;aACd,OAAO,CAAC,EAAE,QAAQ;aAClB,IAAI,CAAC,EAAE,MAAM;IAC7B;;;;OAIG;aACa,OAAO,CAAC,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/contract/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE;QACL,2CAA2C;QAC3C,IAAI,EAAE,MAAM,CAAC;QACb,8BAA8B;QAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,gCAAgC;QAChC,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,0BAA0B;QAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAcD;;;;GAIG;AACH,qBAAa,QAAQ,CACnB,KAAK,SAAS,MAAM,GAAG,MAAM,EAC7B,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,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K,CAEhE;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDE,CAAC;AAEnC;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIzD;AAED,mFAAmF;AACnF,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,mBAAmB,CAAC;AAE/D,iEAAiE;AACjE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,eAAe,CAEvE;AAED,+FAA+F;AAC/F,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,KAAK,CAOP"}
|
package/dist/contract/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ALL_TRANSPORTS, type BodyHttpSuccessStatus, type ClientRequestOptions, type ContractDef, type ContractMeta, type ContractStreamCompletion, type ContractStreamFraming, defineContract, type EndpointDef, type EndpointFn, type EndpointMcpInputRequired, type EndpointMcpPolicy, type EndpointResponseMeta, type EndpointStreamDescriptor, type EndpointToolAnnotations, type EndpointUiMeta, type FileDescriptor, type HandlerContext, type HeadEndpointDef, type HttpMethod, type HttpSuccessStatus, type McpCallContext, type McpClientInfo, type McpRoundOutcome, type MultipartBufferedFiles, type MultipartDescriptor, type MultipartFile, type MultipartFilePolicy, type PathParams, type ResponseMetadata, type RuntimeContext, type ScopedEndpointFn, type ScopedHttpClient, type ScopedUrlBuilder, type ScopedUrlFn, type StreamFinalLinePolicy, type Transport, type TransportSource, type TypedClient, type TypedHttpClient, type TypedUrlBuilder, } from './define.js';
|
|
2
|
-
export { AppError, appError, badRequest, conflict, type ErrorEnvelope, forbidden, isStitchErrorCode, notFound, rateLimited, STITCH_ERROR_STATUS, type StitchErrorCode, unauthorized, } from './errors.js';
|
|
2
|
+
export { AppError, appError, badRequest, conflict, type ErrorEnvelope, forbidden, isRetryableStatus, isStitchErrorCode, notFound, rateLimited, STITCH_ERROR_STATUS, type StitchErrorCode, unauthorized, } from './errors.js';
|
|
3
3
|
export { type DefinedAppError, type DefinedErrors, defineErrors, type ErrorDefinition, type ErrorDefinitions, type ErrorDetailsOutput, type ErrorDetailsSchema, type ErrorFactories, type ErrorFactory, type ErrorFactoryArguments, type ErrorVocabularyCode, type ErrorVocabularyMapping, type FrozenErrorDefinitions, type VocabularyCodeMap, } from './errors-factory.js';
|
|
4
4
|
export { type ContractFactoryConfig, type ContractFactoryToolExposure, createContractFactory, type ExplicitScopedDefineContract, type ExplicitToolExposureEndpoints, type FactoryScopedEndpoint, type ScopedContractDef, type ScopedDefineContract, } from './factory.js';
|
|
5
5
|
export { type ManagedFilePath, ManagedFilePathSchema, type ManagedFileRef, ManagedFileRefSchema, } from './file-ref.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,U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1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,KAAK,aAAa,EAClB,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,KAAK,eAAe,EACpB,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAClC,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,KAAK,SAAS,EACd,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,mBAAmB,EACxB,yBAAyB,EACzB,mCAAmC,GACpC,MAAM,UAAU,CAAC"}
|
package/dist/contract/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
defineErrors,
|
|
9
9
|
encodeCursor,
|
|
10
10
|
paginatedSchema
|
|
11
|
-
} from "../index-
|
|
11
|
+
} from "../index-0a349c33.js";
|
|
12
12
|
import"../index-rxfy4cq7.js";
|
|
13
13
|
import {
|
|
14
14
|
ManagedFilePathSchema,
|
|
@@ -21,11 +21,12 @@ import {
|
|
|
21
21
|
badRequest,
|
|
22
22
|
conflict,
|
|
23
23
|
forbidden,
|
|
24
|
+
isRetryableStatus,
|
|
24
25
|
isStitchErrorCode,
|
|
25
26
|
notFound,
|
|
26
27
|
rateLimited,
|
|
27
28
|
unauthorized
|
|
28
|
-
} from "../index-
|
|
29
|
+
} from "../index-2vtcmrj9.js";
|
|
29
30
|
import"../index-kzfs85xp.js";
|
|
30
31
|
import"../index-77fekveh.js";
|
|
31
32
|
export {
|
|
@@ -34,6 +35,7 @@ export {
|
|
|
34
35
|
paginatedSchema,
|
|
35
36
|
notFound,
|
|
36
37
|
isStitchErrorCode,
|
|
38
|
+
isRetryableStatus,
|
|
37
39
|
forbidden,
|
|
38
40
|
encodeCursor,
|
|
39
41
|
defineErrors,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
AppError,
|
|
7
7
|
STITCH_ERROR_STATUS,
|
|
8
8
|
isStitchErrorCode
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-2vtcmrj9.js";
|
|
10
10
|
import {
|
|
11
11
|
isUnsafeKey
|
|
12
12
|
} from "./index-kzfs85xp.js";
|
|
@@ -346,10 +346,10 @@ function defineErrors(source, mapping) {
|
|
|
346
346
|
if ("details" in options) {
|
|
347
347
|
throw new Error(`[stitchkit] Error "${name}" does not declare details`);
|
|
348
348
|
}
|
|
349
|
-
return new AppError(name, message, definition.status, undefined, options.hint);
|
|
349
|
+
return new AppError(name, message, definition.status, undefined, options.hint, undefined, definition.retryable);
|
|
350
350
|
}
|
|
351
351
|
const details = definition.details.parse(options.details);
|
|
352
|
-
return new AppError(name, message, definition.status, details, options.hint);
|
|
352
|
+
return new AppError(name, message, definition.status, details, options.hint, undefined, definition.retryable);
|
|
353
353
|
};
|
|
354
354
|
});
|
|
355
355
|
Object.freeze(errors);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isRecord
|
|
3
|
+
} from "./index-77fekveh.js";
|
|
4
|
+
|
|
5
|
+
// src/internal/canonical-json.ts
|
|
6
|
+
function compareCodepoints(left, right) {
|
|
7
|
+
if (left < right)
|
|
8
|
+
return -1;
|
|
9
|
+
if (left > right)
|
|
10
|
+
return 1;
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
13
|
+
function canonicalValue(value) {
|
|
14
|
+
if (Array.isArray(value))
|
|
15
|
+
return value.map(canonicalValue);
|
|
16
|
+
if (!isRecord(value))
|
|
17
|
+
return value;
|
|
18
|
+
const result = {};
|
|
19
|
+
for (const key of Object.keys(value).sort(compareCodepoints)) {
|
|
20
|
+
result[key] = canonicalValue(value[key]);
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
function serializeCanonicalJson(value) {
|
|
25
|
+
return JSON.stringify(canonicalValue(value));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { compareCodepoints, serializeCanonicalJson };
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
inputIsQuery,
|
|
4
4
|
parseSSE,
|
|
5
5
|
readBoundedUtf8Lines
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-b971qjes.js";
|
|
7
7
|
import {
|
|
8
8
|
ApiError,
|
|
9
9
|
RequestCancellationError,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
ContractStreamFrameSchema,
|
|
17
17
|
DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
|
|
18
18
|
parseTrailingWildcard
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-0a349c33.js";
|
|
20
20
|
import {
|
|
21
21
|
isRecord,
|
|
22
22
|
mapObject,
|