stitchkit 0.90.6 → 0.90.8
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 +52 -0
- package/dist/agent-runtime-harness.js +3 -3
- package/dist/agent-runtime.js +6 -6
- package/dist/cli.js +5 -5
- package/dist/{index-tgh3ksfh.js → index-03bvcv7r.js} +2 -2
- package/dist/index-0j3vcp5m.js +28 -0
- package/dist/{index-8pjqv3zh.js → index-1ft2wrv0.js} +1 -1
- package/dist/{index-2hryh65w.js → index-42f33bzd.js} +53 -12
- package/dist/{index-s208wab5.js → index-4yktadec.js} +1 -1
- package/dist/{index-vy2nxwg8.js → index-adj0pc9r.js} +1 -1
- package/dist/{index-1bnkzq95.js → index-dggfq62w.js} +1 -1
- package/dist/{index-fqg5mfk7.js → index-mthq65vn.js} +4 -4
- package/dist/{index-83fafqw8.js → index-p48nc8g9.js} +3 -3
- package/dist/{index-7gqx71yd.js → index-qd8gs6nf.js} +8 -2
- package/dist/{index-zsdgd1tz.js → index-w58rfj2d.js} +1 -1
- package/dist/{index-640tz39q.js → index-xrwgzjw8.js} +2 -2
- package/dist/{index-1txvygak.js → index-zjze12x8.js} +1 -1
- package/dist/index.js +4 -4
- 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 +3 -3
- package/dist/observability/index.js +1 -1
- package/dist/realtime/rejected-frame.d.ts +6 -0
- package/dist/realtime/rejected-frame.d.ts.map +1 -1
- package/dist/remote.js +3 -3
- package/dist/server/index.js +4 -4
- package/dist/testing/surface-manifest.d.ts +2 -1
- package/dist/testing/surface-manifest.d.ts.map +1 -1
- package/dist/testing.js +8 -24
- package/dist/tool-invoker.js +4 -4
- 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/native-mcp.d.ts +3 -0
- package/dist/tools/native-mcp.d.ts.map +1 -1
- package/dist/tools.d.ts +1 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +85 -13
- package/llms-full.txt +55 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,58 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
|
|
|
15
15
|
|
|
16
16
|
## [Unreleased]
|
|
17
17
|
|
|
18
|
+
## [0.90.8] — 2026-09-21
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **Every advertised MCP tool and every tool result now carries a catalog
|
|
23
|
+
stamp** — `_meta["stitchkit/catalog"] = { digest, tools }`, the fingerprint of
|
|
24
|
+
the exact advertised surface. A long-lived consumer stores it when it lists the
|
|
25
|
+
tools and compares it on responses it was already receiving, so it learns its
|
|
26
|
+
own copy of the contract is stale **without making a request to find out** —
|
|
27
|
+
including on the refusal that a stale copy causes, which is when the question
|
|
28
|
+
actually gets asked. `mcpCatalogStamp`, `readMcpCatalogStamp`,
|
|
29
|
+
`mcpCatalogMeta`, `MCP_CATALOG_META_KEY` and `McpCatalogStamp` are exported
|
|
30
|
+
from `stitchkit/tools`. `notifications/tools/list_changed` is the push-shaped
|
|
31
|
+
answer to the same problem and `createMcpHandler` cannot send it — it is
|
|
32
|
+
stateless by construction, so there is no retained session to notify; that
|
|
33
|
+
boundary is stated in `docs/architecture/mcp-semantics.md` rather than papered
|
|
34
|
+
over.
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
|
|
38
|
+
- **A refused union now names the branch and the field instead of only
|
|
39
|
+
`(root)`.** Zod reports a failed `z.union` as one issue — code
|
|
40
|
+
`invalid_union`, path `(root)`, message `Invalid input` — and every per-branch
|
|
41
|
+
reason it computed was discarded on the way to the wire. The refusal therefore
|
|
42
|
+
said that a request was wrong and nothing about what would have been right, so
|
|
43
|
+
whoever hit it blamed the source. `zodIssues` now descends into the branches:
|
|
44
|
+
the union's own issue carries a message naming each branch and where it
|
|
45
|
+
failed, and each branch failure arrives as its own issue with a full path and
|
|
46
|
+
a `branch` number. `formatZodError` and realtime rejection reports carry the
|
|
47
|
+
same detail. Additive — the issue shape gained an optional field and lost
|
|
48
|
+
nothing.
|
|
49
|
+
|
|
50
|
+
## [0.90.7] — 2026-09-21
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- Release workflows now remain safely rerunnable after another package in the
|
|
55
|
+
same train reaches npm, candidate registration stays repeatable after
|
|
56
|
+
publication, and registry polling tolerates normal multi-minute processing.
|
|
57
|
+
- **A release train may no longer publish the framework together with the
|
|
58
|
+
starter that has to pin it.** The starter's lockfile is written by an install,
|
|
59
|
+
so it can only resolve a version npm already serves; a train doing both at
|
|
60
|
+
once states two things that cannot both hold, and the starter it publishes is
|
|
61
|
+
a version behind from its first minute. `create-stitchkit@0.6.1` shipped that
|
|
62
|
+
way. The refusal is narrow — a starter deliberately targeting an older minor
|
|
63
|
+
still rides along with a new one — and it reads the train file rather than the
|
|
64
|
+
registry, so every attempt at the same commit gets the same answer.
|
|
65
|
+
- **The starter lockfile gate now also refuses a pin npm does not serve.** Its
|
|
66
|
+
staleness comparison only ever looked downward, so a lockfile naming a version
|
|
67
|
+
above the newest published one passed every check and left the scaffold to die
|
|
68
|
+
at `bun install` on the consumer's machine.
|
|
69
|
+
|
|
18
70
|
## [0.90.6] — 2026-09-20
|
|
19
71
|
|
|
20
72
|
### Added
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
composeAgentPrompt,
|
|
7
7
|
createAgentRuntime,
|
|
8
8
|
createAgentRuntimeEventSink
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-4yktadec.js";
|
|
10
10
|
import"./index-p13mwz16.js";
|
|
11
11
|
import"./index-y64k3s0h.js";
|
|
12
12
|
import {
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
walkContainedFiles
|
|
20
20
|
} from "./index-bn2cjajt.js";
|
|
21
21
|
import"./index-7rkhw9ec.js";
|
|
22
|
-
import"./index-
|
|
22
|
+
import"./index-1ft2wrv0.js";
|
|
23
23
|
import"./index-vsbzgd7b.js";
|
|
24
24
|
import"./index-f9mb610r.js";
|
|
25
|
-
import"./index-
|
|
25
|
+
import"./index-42f33bzd.js";
|
|
26
26
|
import"./index-nrqg8tks.js";
|
|
27
27
|
import"./index-rxfy4cq7.js";
|
|
28
28
|
import"./index-6k1937bx.js";
|
package/dist/agent-runtime.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
renderAgentStateSlots,
|
|
32
32
|
repairedSearchCall,
|
|
33
33
|
selectAgentHistory
|
|
34
|
-
} from "./index-
|
|
34
|
+
} from "./index-4yktadec.js";
|
|
35
35
|
import"./index-p13mwz16.js";
|
|
36
36
|
import {
|
|
37
37
|
AgentAdmissionEventSchema,
|
|
@@ -169,14 +169,14 @@ import {
|
|
|
169
169
|
import {
|
|
170
170
|
buildToolManifest,
|
|
171
171
|
mountAgent
|
|
172
|
-
} from "./index-
|
|
172
|
+
} from "./index-p48nc8g9.js";
|
|
173
173
|
import"./index-7rkhw9ec.js";
|
|
174
|
-
import"./index-
|
|
175
|
-
import"./index-
|
|
176
|
-
import"./index-
|
|
174
|
+
import"./index-w58rfj2d.js";
|
|
175
|
+
import"./index-dggfq62w.js";
|
|
176
|
+
import"./index-1ft2wrv0.js";
|
|
177
177
|
import"./index-vsbzgd7b.js";
|
|
178
178
|
import"./index-f9mb610r.js";
|
|
179
|
-
import"./index-
|
|
179
|
+
import"./index-42f33bzd.js";
|
|
180
180
|
import"./index-nrqg8tks.js";
|
|
181
181
|
import"./index-rxfy4cq7.js";
|
|
182
182
|
import"./index-6k1937bx.js";
|
package/dist/cli.js
CHANGED
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
readCapped,
|
|
12
12
|
renderCliView,
|
|
13
13
|
routeCliArgv
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-mthq65vn.js";
|
|
15
15
|
import"./index-sbdmyz75.js";
|
|
16
|
-
import"./index-
|
|
17
|
-
import"./index-
|
|
18
|
-
import"./index-
|
|
16
|
+
import"./index-w58rfj2d.js";
|
|
17
|
+
import"./index-dggfq62w.js";
|
|
18
|
+
import"./index-1ft2wrv0.js";
|
|
19
19
|
import"./index-vsbzgd7b.js";
|
|
20
20
|
import"./index-f9mb610r.js";
|
|
21
|
-
import"./index-
|
|
21
|
+
import"./index-42f33bzd.js";
|
|
22
22
|
import"./index-nrqg8tks.js";
|
|
23
23
|
import"./index-rxfy4cq7.js";
|
|
24
24
|
import"./index-6k1937bx.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
collectTools,
|
|
3
3
|
createToolRunner
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-dggfq62w.js";
|
|
5
5
|
import {
|
|
6
6
|
toolErrorFromResult
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-1ft2wrv0.js";
|
|
8
8
|
import {
|
|
9
9
|
assertUniqueToolName
|
|
10
10
|
} from "./index-fenaekmk.js";
|
|
@@ -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 };
|
|
@@ -10,21 +10,62 @@ import { z } from "zod";
|
|
|
10
10
|
function issuePath(path) {
|
|
11
11
|
return path.length > 0 ? path.map(String).join(".") : "(root)";
|
|
12
12
|
}
|
|
13
|
+
var MAX_UNION_DEPTH = 3;
|
|
14
|
+
var MAX_DESCRIBED_BRANCHES = 5;
|
|
15
|
+
function unionBranches(issue) {
|
|
16
|
+
const errors = Reflect.get(issue, "errors");
|
|
17
|
+
if (!Array.isArray(errors) || errors.length === 0)
|
|
18
|
+
return;
|
|
19
|
+
if (!errors.every((branch) => Array.isArray(branch)))
|
|
20
|
+
return;
|
|
21
|
+
return errors;
|
|
22
|
+
}
|
|
23
|
+
function unionSummary(branches, prefix) {
|
|
24
|
+
const described = branches.slice(0, MAX_DESCRIBED_BRANCHES).map((issues, index) => {
|
|
25
|
+
const first = issues[0];
|
|
26
|
+
if (!first)
|
|
27
|
+
return `branch ${index + 1} reported no reason`;
|
|
28
|
+
return `branch ${index + 1} at ${issuePath([...prefix, ...first.path])}: ${first.message}`;
|
|
29
|
+
});
|
|
30
|
+
const rest = branches.length - described.length;
|
|
31
|
+
const suffix = rest > 0 ? `; ...and ${rest} more branches` : "";
|
|
32
|
+
return `No union branch matched — ${described.join("; ")}${suffix}`;
|
|
33
|
+
}
|
|
34
|
+
function collectIssues(issues, prefix, branch, depth, into) {
|
|
35
|
+
for (const issue of issues) {
|
|
36
|
+
const path = [...prefix, ...issue.path];
|
|
37
|
+
const branches = depth < MAX_UNION_DEPTH ? unionBranches(issue) : undefined;
|
|
38
|
+
into.push({
|
|
39
|
+
path: issuePath(path),
|
|
40
|
+
code: issue.code,
|
|
41
|
+
message: branches ? unionSummary(branches, path) : issue.message,
|
|
42
|
+
...branch !== undefined && { branch }
|
|
43
|
+
});
|
|
44
|
+
if (!branches)
|
|
45
|
+
continue;
|
|
46
|
+
branches.forEach((branchIssues, index) => {
|
|
47
|
+
collectIssues(branchIssues, path, index + 1, depth + 1, into);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function zodIssues(error) {
|
|
52
|
+
const issues = [];
|
|
53
|
+
collectIssues(error.issues, [], undefined, 0, issues);
|
|
54
|
+
return issues;
|
|
55
|
+
}
|
|
56
|
+
var MAX_FORMATTED_ISSUES = 5;
|
|
13
57
|
function formatZodError(error) {
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
58
|
+
const all = zodIssues(error);
|
|
59
|
+
const shown = all.slice(0, MAX_FORMATTED_ISSUES);
|
|
60
|
+
const lines = shown.map((issue) => {
|
|
61
|
+
const where = issue.branch === undefined ? issue.path : `${issue.path} (branch ${issue.branch})`;
|
|
62
|
+
return `${where}: ${issue.message}`;
|
|
63
|
+
});
|
|
64
|
+
const suffix = all.length > shown.length ? `
|
|
65
|
+
...and ${all.length - shown.length} more issues` : "";
|
|
18
66
|
return lines.join(`
|
|
19
67
|
`) + suffix;
|
|
20
68
|
}
|
|
21
|
-
function zodIssues(error) {
|
|
22
|
-
return error.issues.map((issue) => ({
|
|
23
|
-
path: issuePath(issue.path),
|
|
24
|
-
code: issue.code,
|
|
25
|
-
message: issue.message
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
69
|
var MAX_DETAIL_ISSUES = 20;
|
|
29
70
|
function errorCode(err) {
|
|
30
71
|
if (AppError.is(err))
|
|
@@ -109,4 +150,4 @@ function validateDeclaredOutput(schema, data, onStripped) {
|
|
|
109
150
|
return validateHandlerOutput(schema, data, onStripped);
|
|
110
151
|
}
|
|
111
152
|
|
|
112
|
-
export {
|
|
153
|
+
export { zodIssues, formatZodError, errorCode, recordedErrorMessage, normalizeError, validateDeclaredOutput };
|
|
@@ -3,19 +3,19 @@ import {
|
|
|
3
3
|
} from "./index-sbdmyz75.js";
|
|
4
4
|
import {
|
|
5
5
|
collectToolSurface
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-w58rfj2d.js";
|
|
7
7
|
import {
|
|
8
8
|
createToolRunner,
|
|
9
9
|
formatToolError
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-dggfq62w.js";
|
|
11
11
|
import {
|
|
12
12
|
toolErrorFromResult,
|
|
13
13
|
toolResultFromError
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-1ft2wrv0.js";
|
|
15
15
|
import {
|
|
16
16
|
formatZodError,
|
|
17
17
|
validateDeclaredOutput
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-42f33bzd.js";
|
|
19
19
|
import {
|
|
20
20
|
coerceJsonArgs
|
|
21
21
|
} from "./index-7zbps32p.js";
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
} from "./index-7rkhw9ec.js";
|
|
5
5
|
import {
|
|
6
6
|
collectToolSurface
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-w58rfj2d.js";
|
|
8
8
|
import {
|
|
9
9
|
createToolRunner,
|
|
10
10
|
formatToolError
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-dggfq62w.js";
|
|
12
12
|
import {
|
|
13
13
|
isToolExecutionControlError,
|
|
14
14
|
toolCauseFromResult,
|
|
15
15
|
toolResultFromError
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-1ft2wrv0.js";
|
|
17
17
|
import {
|
|
18
18
|
isRecord
|
|
19
19
|
} from "./index-77fekveh.js";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./index-2qzskm8h.js";
|
|
5
5
|
import {
|
|
6
6
|
zodIssues
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-42f33bzd.js";
|
|
8
8
|
import {
|
|
9
9
|
AppError
|
|
10
10
|
} from "./index-scs3f1eg.js";
|
|
@@ -43,7 +43,13 @@ function parseIssues(value) {
|
|
|
43
43
|
const code = Reflect.get(entry, "code");
|
|
44
44
|
const message = Reflect.get(entry, "message");
|
|
45
45
|
if (typeof path === "string" && typeof code === "string" && typeof message === "string") {
|
|
46
|
-
|
|
46
|
+
const branch = Reflect.get(entry, "branch");
|
|
47
|
+
issues.push({
|
|
48
|
+
path,
|
|
49
|
+
code,
|
|
50
|
+
message,
|
|
51
|
+
...typeof branch === "number" && Number.isInteger(branch) && branch > 0 && { branch }
|
|
52
|
+
});
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
55
|
return issues.length > 0 ? issues : undefined;
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
createValidatedRealtimeSocket,
|
|
12
12
|
isModuleNotFound
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-qd8gs6nf.js";
|
|
14
14
|
import {
|
|
15
15
|
DEFAULT_PROCESS_SIGNALS,
|
|
16
16
|
RUNTIME_CONTEXT_RESERVED_KEYS,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
normalizeError,
|
|
42
42
|
recordedErrorMessage,
|
|
43
43
|
validateDeclaredOutput
|
|
44
|
-
} from "./index-
|
|
44
|
+
} from "./index-42f33bzd.js";
|
|
45
45
|
import {
|
|
46
46
|
DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
|
|
47
47
|
joinRoutePath,
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
createUrlBuilder,
|
|
16
16
|
createUrlBuilders,
|
|
17
17
|
parseNDJSON
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-adj0pc9r.js";
|
|
19
19
|
import {
|
|
20
20
|
REALTIME_REJECTION_KEY,
|
|
21
21
|
asRealtimeRejection,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
isModuleNotFound,
|
|
24
24
|
parseRealtimeRequestAcknowledgement,
|
|
25
25
|
parseRealtimeRequestArguments
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-qd8gs6nf.js";
|
|
27
27
|
import {
|
|
28
28
|
RealtimeRequestDisconnectedError,
|
|
29
29
|
RealtimeRequestInvalidAcknowledgementError,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
} from "./index-2qzskm8h.js";
|
|
35
35
|
import {
|
|
36
36
|
parseSSE
|
|
37
|
-
} from "./index-
|
|
37
|
+
} from "./index-zjze12x8.js";
|
|
38
38
|
import {
|
|
39
39
|
LiveStateControllerStatusSchema,
|
|
40
40
|
LiveStatePhaseSchema,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
import {
|
|
50
50
|
formatZodError,
|
|
51
51
|
zodIssues
|
|
52
|
-
} from "./index-
|
|
52
|
+
} from "./index-42f33bzd.js";
|
|
53
53
|
import {
|
|
54
54
|
ALL_TRANSPORTS,
|
|
55
55
|
ContractStreamFrameSchema,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codepoint order, not locale order.
|
|
3
|
+
*
|
|
4
|
+
* `Array.prototype.sort` without a comparator is codepoint order already, but
|
|
5
|
+
* `localeCompare` is what a reader reaches for — and it would make a digest
|
|
6
|
+
* depend on the machine's locale, which is the one input a fingerprint must
|
|
7
|
+
* never have.
|
|
8
|
+
*/
|
|
9
|
+
export declare function compareCodepoints(left: string, right: string): number;
|
|
10
|
+
/**
|
|
11
|
+
* Canonical bytes for a JSON value — object keys sorted, array order kept.
|
|
12
|
+
*
|
|
13
|
+
* The single serialisation behind every digest this repository takes of a
|
|
14
|
+
* declared surface: the committed manifest snapshot and the live MCP catalog
|
|
15
|
+
* stamp. Two implementations of "the same bytes" would eventually disagree,
|
|
16
|
+
* and a fingerprint that disagrees with itself reports drift that never
|
|
17
|
+
* happened.
|
|
18
|
+
*/
|
|
19
|
+
export declare function serializeCanonicalJson(value: unknown): string;
|
|
20
|
+
//# sourceMappingURL=canonical-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-json.d.ts","sourceRoot":"","sources":["../../src/internal/canonical-json.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIrE;AAYD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE7D"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type ZodType, z } from 'zod';
|
|
2
2
|
import { AppError } from '../contract/index.js';
|
|
3
|
-
export declare function formatZodError(error: z.ZodError): string;
|
|
4
3
|
/** One field-level validation issue — the structured sibling of `formatZodError`. */
|
|
5
4
|
export interface ZodIssueSummary {
|
|
6
5
|
/** Dotted path to the offending field (`(root)` for a top-level issue). */
|
|
@@ -9,14 +8,24 @@ export interface ZodIssueSummary {
|
|
|
9
8
|
code: string;
|
|
10
9
|
/** Human-readable message for this field. */
|
|
11
10
|
message: string;
|
|
11
|
+
/**
|
|
12
|
+
* 1-based index of the union branch that produced this issue, counted within
|
|
13
|
+
* the nearest enclosing union. Absent when no union was involved.
|
|
14
|
+
*/
|
|
15
|
+
branch?: number;
|
|
12
16
|
}
|
|
13
17
|
/**
|
|
14
18
|
* Project a `ZodError` into structured, wire-safe field issues — path / code /
|
|
15
|
-
* message
|
|
16
|
-
* fields rather than parsing the text
|
|
17
|
-
* that bounds response size slices it
|
|
19
|
+
* message (and a union branch, where one applies) — nothing server-internal.
|
|
20
|
+
* For a machine client that matches on fields rather than parsing the text
|
|
21
|
+
* `message`. Returns every issue; a caller that bounds response size slices it
|
|
22
|
+
* (see `normalizeError`).
|
|
23
|
+
*
|
|
24
|
+
* A failed union contributes its own issue AND one issue per branch failure, so
|
|
25
|
+
* the refusal names the branch and the path instead of only `(root)`.
|
|
18
26
|
*/
|
|
19
27
|
export declare function zodIssues(error: z.ZodError): ZodIssueSummary[];
|
|
28
|
+
export declare function formatZodError(error: z.ZodError): string;
|
|
20
29
|
/**
|
|
21
30
|
* The stable error code for a thrown value — `AppError.code`, `VALIDATION_ERROR`
|
|
22
31
|
* for a `ZodError`, else `undefined`. Side-effect-free (unlike `normalizeError`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/internal/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQvC,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/internal/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQvC,qFAAqF;AACrF,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAyED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,GAAG,eAAe,EAAE,CAI9D;AAKD,wBAAgB,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,GAAG,MAAM,CAWxD;AAKD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAI1D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,MAAM,EAAE,OAAO,GACd,MAAM,GAAG,SAAS,CAYpB;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,CAyBrD;AA4BD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,OAAO,EACb,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,GACrC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAe9D;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,GAAG,SAAS,EAC3B,IAAI,EAAE,OAAO,EACb,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,GACrC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAe9D"}
|
package/dist/node.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
createHandler,
|
|
6
6
|
createSocketIOServer,
|
|
7
7
|
createUnixClientTransport
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-xrwgzjw8.js";
|
|
9
9
|
import"./index-y91ry9h2.js";
|
|
10
10
|
import {
|
|
11
11
|
ShutdownOptionsSchema,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
ShutdownStatusSchema,
|
|
15
15
|
createServerLifecycle
|
|
16
16
|
} from "./index-3z73fh2c.js";
|
|
17
|
-
import"./index-
|
|
17
|
+
import"./index-qd8gs6nf.js";
|
|
18
18
|
import"./index-2qzskm8h.js";
|
|
19
19
|
import {
|
|
20
20
|
createImplement,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from "./index-aj9geeez.js";
|
|
28
28
|
import"./index-vsbzgd7b.js";
|
|
29
29
|
import"./index-f9mb610r.js";
|
|
30
|
-
import"./index-
|
|
30
|
+
import"./index-42f33bzd.js";
|
|
31
31
|
import"./index-nrqg8tks.js";
|
|
32
32
|
import"./index-rxfy4cq7.js";
|
|
33
33
|
import"./index-6k1937bx.js";
|
|
@@ -39,6 +39,12 @@ export interface RealtimeRejectionIssue {
|
|
|
39
39
|
path: string;
|
|
40
40
|
code: string;
|
|
41
41
|
message: string;
|
|
42
|
+
/**
|
|
43
|
+
* The union branch the issue came from, when the refused field was a union.
|
|
44
|
+
* Without it a refused union reports only its own position and the word
|
|
45
|
+
* `invalid_union`, which names no field at all.
|
|
46
|
+
*/
|
|
47
|
+
branch?: number;
|
|
42
48
|
}
|
|
43
49
|
/**
|
|
44
50
|
* At most this many issues travel; a refusal is a signal, not a report.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rejected-frame.d.ts","sourceRoot":"","sources":["../../src/realtime/rejected-frame.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,iCAAiC,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;;;;;;;;GASG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;OAWG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,sBAAsB,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,yBAAyB;IACxC,CAAC,sBAAsB,CAAC,EAAE,uBAAuB,CAAC;CACnD;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,uBAAuB,GAC9B,yBAAyB,CAE3B;AAED,gFAAgF;AAChF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,uBAAuB,GAAG,IAAI,CAgBlF"}
|
|
1
|
+
{"version":3,"file":"rejected-frame.d.ts","sourceRoot":"","sources":["../../src/realtime/rejected-frame.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,iCAAiC,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;;;;;;;;GASG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;OAWG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,sBAAsB,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,yBAAyB;IACxC,CAAC,sBAAsB,CAAC,EAAE,uBAAuB,CAAC;CACnD;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,uBAAuB,GAC9B,yBAAyB,CAE3B;AAED,gFAAgF;AAChF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,uBAAuB,GAAG,IAAI,CAgBlF"}
|
package/dist/remote.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createClient
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
3
|
+
} from "./index-adj0pc9r.js";
|
|
4
|
+
import"./index-zjze12x8.js";
|
|
5
5
|
import {
|
|
6
6
|
ApiError
|
|
7
7
|
} from "./index-3xwxfj4z.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-42f33bzd.js";
|
|
9
9
|
import {
|
|
10
10
|
mergeMeta,
|
|
11
11
|
resolveRouteParamsSchema
|
package/dist/server/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
sseRoute,
|
|
14
14
|
streamingRoute,
|
|
15
15
|
webSocketLane
|
|
16
|
-
} from "../index-
|
|
16
|
+
} from "../index-xrwgzjw8.js";
|
|
17
17
|
import"../index-y91ry9h2.js";
|
|
18
18
|
import {
|
|
19
19
|
withDeadline
|
|
@@ -25,13 +25,13 @@ import {
|
|
|
25
25
|
ShutdownStatusSchema,
|
|
26
26
|
createServerLifecycle
|
|
27
27
|
} from "../index-3z73fh2c.js";
|
|
28
|
-
import"../index-
|
|
28
|
+
import"../index-qd8gs6nf.js";
|
|
29
29
|
import"../index-2qzskm8h.js";
|
|
30
30
|
import {
|
|
31
31
|
inputIsQuery,
|
|
32
32
|
parseSSE,
|
|
33
33
|
streamSSE
|
|
34
|
-
} from "../index-
|
|
34
|
+
} from "../index-zjze12x8.js";
|
|
35
35
|
import {
|
|
36
36
|
composeAuthHooks,
|
|
37
37
|
createAuthHook,
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
formatZodError,
|
|
83
83
|
normalizeError,
|
|
84
84
|
zodIssues
|
|
85
|
-
} from "../index-
|
|
85
|
+
} from "../index-42f33bzd.js";
|
|
86
86
|
import {
|
|
87
87
|
DEFAULT_CONTRACT_STREAM_FRAME_BYTES,
|
|
88
88
|
joinRoutePath,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { serializeCanonicalJson } from '../internal/canonical-json.js';
|
|
2
3
|
import type { RealtimeContract, RealtimeEventRegistry } from '../realtime/contract.js';
|
|
3
4
|
import type { RouteGroup, ServiceDef } from '../server/types.js';
|
|
4
5
|
import type { CliCommandDefinition } from '../tools/cli-command.js';
|
|
@@ -248,7 +249,7 @@ export interface SurfaceManifestConfig {
|
|
|
248
249
|
extensions?: readonly SurfaceManifestExtension[];
|
|
249
250
|
}
|
|
250
251
|
/** Canonical bytes used by snapshots and schema digests. Arrays retain order. */
|
|
251
|
-
export declare
|
|
252
|
+
export declare const serializeSurfaceValue: typeof serializeCanonicalJson;
|
|
252
253
|
/** Build one versioned snapshot of the declared transport-specific surface. */
|
|
253
254
|
export declare function buildSurfaceManifest(config: SurfaceManifestConfig): SurfaceManifest;
|
|
254
255
|
export declare function assertSurfaceManifestSnapshot(manifest: SurfaceManifest, snapshot: SurfaceManifest): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface-manifest.d.ts","sourceRoot":"","sources":["../../src/testing/surface-manifest.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"surface-manifest.d.ts","sourceRoot":"","sources":["../../src/testing/surface-manifest.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,CAAC,EAAE,MAAM,KAAK,CAAC;AAEtC,OAAO,EAAqB,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAGvF,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACL,KAAK,yBAAyB,EAI9B,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EAC1B,MAAM,qCAAqC,CAAC;AAO7C,eAAO,MAAM,0BAA0B;;;;;iBAKrC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASzC,CAAC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AC,EAAE,SAAS,wBAAwB,EAAE,CAAC;CAClD;AAED,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,+BAAyB,CAAC;AAwI5D,+EAA+E;AAC/E,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,qBAAqB,GAAG,eAAe,CAuNnF;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,eAAe,GACxB,IAAI,CAQN"}
|
package/dist/testing.js
CHANGED
|
@@ -28,15 +28,19 @@ import {
|
|
|
28
28
|
import {
|
|
29
29
|
createClient,
|
|
30
30
|
createClients
|
|
31
|
-
} from "./index-
|
|
31
|
+
} from "./index-adj0pc9r.js";
|
|
32
32
|
import {
|
|
33
33
|
RealtimeRequestDisconnectedError,
|
|
34
34
|
RealtimeRequestInvalidAcknowledgementError,
|
|
35
35
|
RealtimeRequestTimeoutError
|
|
36
36
|
} from "./index-2qzskm8h.js";
|
|
37
|
-
import"./index-
|
|
37
|
+
import"./index-zjze12x8.js";
|
|
38
38
|
import"./index-3xwxfj4z.js";
|
|
39
|
-
import
|
|
39
|
+
import {
|
|
40
|
+
compareCodepoints,
|
|
41
|
+
serializeCanonicalJson
|
|
42
|
+
} from "./index-0j3vcp5m.js";
|
|
43
|
+
import"./index-42f33bzd.js";
|
|
40
44
|
import {
|
|
41
45
|
joinRoutePath
|
|
42
46
|
} from "./index-nrqg8tks.js";
|
|
@@ -1544,27 +1548,7 @@ var SurfaceManifestSchema = z2.object({
|
|
|
1544
1548
|
cliOnly: z2.array(SurfaceManifestCliCommandSchema),
|
|
1545
1549
|
extensions: z2.array(SurfaceManifestExtensionSchema)
|
|
1546
1550
|
});
|
|
1547
|
-
|
|
1548
|
-
if (left < right)
|
|
1549
|
-
return -1;
|
|
1550
|
-
if (left > right)
|
|
1551
|
-
return 1;
|
|
1552
|
-
return 0;
|
|
1553
|
-
}
|
|
1554
|
-
function canonicalValue(value) {
|
|
1555
|
-
if (Array.isArray(value))
|
|
1556
|
-
return value.map(canonicalValue);
|
|
1557
|
-
if (!isRecord(value))
|
|
1558
|
-
return value;
|
|
1559
|
-
const result = {};
|
|
1560
|
-
for (const key of Object.keys(value).sort(compareCodepoints)) {
|
|
1561
|
-
result[key] = canonicalValue(value[key]);
|
|
1562
|
-
}
|
|
1563
|
-
return result;
|
|
1564
|
-
}
|
|
1565
|
-
function serializeSurfaceValue(value) {
|
|
1566
|
-
return JSON.stringify(canonicalValue(value));
|
|
1567
|
-
}
|
|
1551
|
+
var serializeSurfaceValue = serializeCanonicalJson;
|
|
1568
1552
|
function digestValue(value) {
|
|
1569
1553
|
return createHash("sha256").update(serializeSurfaceValue(value)).digest("hex").slice(0, 16);
|
|
1570
1554
|
}
|
package/dist/tool-invoker.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createToolInvoker
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
5
|
-
import"./index-
|
|
3
|
+
} from "./index-03bvcv7r.js";
|
|
4
|
+
import"./index-dggfq62w.js";
|
|
5
|
+
import"./index-1ft2wrv0.js";
|
|
6
6
|
import"./index-vsbzgd7b.js";
|
|
7
7
|
import"./index-f9mb610r.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-42f33bzd.js";
|
|
9
9
|
import"./index-nrqg8tks.js";
|
|
10
10
|
import"./index-rxfy4cq7.js";
|
|
11
11
|
import"./index-6k1937bx.js";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { PreparedMcpServerSurface } from './mcp-prepare.js';
|
|
2
|
+
/**
|
|
3
|
+
* The `_meta` key carrying the catalog stamp, on every advertised tool and on
|
|
4
|
+
* every tool result.
|
|
5
|
+
*
|
|
6
|
+
* Namespaced, because `_meta` is shared ground: a host, the official SDK and
|
|
7
|
+
* the application all write into it, and a bare `catalog` would eventually mean
|
|
8
|
+
* two things at once.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MCP_CATALOG_META_KEY = "stitchkit/catalog";
|
|
11
|
+
/**
|
|
12
|
+
* What the server says its advertised catalog currently is.
|
|
13
|
+
*
|
|
14
|
+
* `digest` changes whenever any advertised tool's name, description, input
|
|
15
|
+
* schema, output schema or annotations change — and only then. `tools` is the
|
|
16
|
+
* count, carried because it makes a mismatch legible without a second lookup
|
|
17
|
+
* ("they advertise 41, I hold 39").
|
|
18
|
+
*/
|
|
19
|
+
export interface McpCatalogStamp {
|
|
20
|
+
digest: string;
|
|
21
|
+
tools: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Fingerprint one advertised MCP catalog.
|
|
25
|
+
*
|
|
26
|
+
* The problem this answers is not a broken server — it is a **consumer holding
|
|
27
|
+
* an old idea of the contract and unable to find out**. A long-lived session
|
|
28
|
+
* lists the tools once; the server is redeployed with a renamed field; every
|
|
29
|
+
* later call is refused, and the refusal looks to the consumer like a fault in
|
|
30
|
+
* the source, because a stale catalog is invisible from inside. The fix has to
|
|
31
|
+
* ride on responses the consumer is already receiving, so it can compare what
|
|
32
|
+
* it holds against what is live without asking anything extra.
|
|
33
|
+
*
|
|
34
|
+
* `notifications/tools/list_changed` is the push-shaped answer, and this
|
|
35
|
+
* framework's MCP HTTP handler cannot send it: it is stateless by construction
|
|
36
|
+
* (`createMcpHandler` builds a fresh server per request and keeps no session),
|
|
37
|
+
* so there is no retained stream to notify. The stamp works precisely because
|
|
38
|
+
* it needs no session.
|
|
39
|
+
*/
|
|
40
|
+
export declare function mcpCatalogStamp(surface: PreparedMcpServerSurface): McpCatalogStamp;
|
|
41
|
+
/** The `_meta` fragment a stamped tool or result carries. */
|
|
42
|
+
export declare function mcpCatalogMeta(stamp: McpCatalogStamp): Record<string, unknown>;
|
|
43
|
+
/**
|
|
44
|
+
* Read a catalog stamp out of a peer's `_meta`, or `null` when there is none.
|
|
45
|
+
*
|
|
46
|
+
* Parsed, not trusted: this arrives over the wire from another process, and the
|
|
47
|
+
* fact that it describes a catalog does not exempt it from being validated.
|
|
48
|
+
*/
|
|
49
|
+
export declare function readMcpCatalogStamp(meta: unknown): McpCatalogStamp | null;
|
|
50
|
+
/**
|
|
51
|
+
* Attach the stamp to a tool registration, so `tools/list` carries the catalog
|
|
52
|
+
* the listing came from — the value a consumer stores alongside the tools.
|
|
53
|
+
*/
|
|
54
|
+
export declare function stampToolRegistration<TConfig extends {
|
|
55
|
+
_meta?: Record<string, unknown>;
|
|
56
|
+
}>(config: TConfig, stamp: McpCatalogStamp | undefined): TConfig;
|
|
57
|
+
/**
|
|
58
|
+
* Attach the stamp to a tool result.
|
|
59
|
+
*
|
|
60
|
+
* This is the half that matters. A consumer compares it against the stamp it
|
|
61
|
+
* stored at listing time, on a response it was going to receive anyway, and so
|
|
62
|
+
* learns its catalog is stale WITHOUT asking — including on the refusal that a
|
|
63
|
+
* stale catalog causes, which is exactly when the question gets asked.
|
|
64
|
+
*/
|
|
65
|
+
export declare function stampToolResult<TResult extends {
|
|
66
|
+
_meta?: Record<string, unknown>;
|
|
67
|
+
}>(result: TResult, stamp: McpCatalogStamp | undefined): TResult;
|
|
68
|
+
//# sourceMappingURL=mcp-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-catalog.d.ts","sourceRoot":"","sources":["../../src/tools/mcp-catalog.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAmB,MAAM,eAAe,CAAC;AAE/E;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAwBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,wBAAwB,GAAG,eAAe,CAclF;AAED,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE9E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAQzE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,SAAS;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,EACvF,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,eAAe,GAAG,SAAS,GACjC,OAAO,CAGT;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAS;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,EACjF,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,eAAe,GAAG,SAAS,GACjC,OAAO,CAGT"}
|
package/dist/tools/mcp.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { McpServer, type ServerOptions } from '@modelcontextprotocol/server';
|
|
|
2
2
|
import type { ServiceDef, StitchLogger } from '../server/types.js';
|
|
3
3
|
import { type ErrorHintFn, type ToolCallHooks, type ToolLifecycle } from './execute.js';
|
|
4
4
|
import { type McpResourceDef } from './mcp-app.js';
|
|
5
|
+
import { type McpCatalogStamp } from './mcp-catalog.js';
|
|
5
6
|
import { type McpSchemaValidationConfig, type McpSurfaceRegistry, type PreparedMcpServerSurface, type PreparedMcpSurface, type ValidateMcpSchemasConfig } from './mcp-prepare.js';
|
|
6
7
|
import { type McpRoundRuntime } from './mcp-round.js';
|
|
7
8
|
import { type ToolExtend } from './mount.js';
|
|
@@ -33,6 +34,8 @@ export interface McpMountConfig {
|
|
|
33
34
|
}
|
|
34
35
|
interface PreparedMcpMountConfig extends McpMountConfig {
|
|
35
36
|
multiRoundRuntime?: McpRoundRuntime;
|
|
37
|
+
/** The catalog this surface advertises, stamped onto listings and results. */
|
|
38
|
+
catalog?: McpCatalogStamp;
|
|
36
39
|
}
|
|
37
40
|
/**
|
|
38
41
|
* Validate that every contract tool in `services` can be advertised on the MCP
|
package/dist/tools/mcp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/tools/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAET,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AAItC,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,aAAa,EAEnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,WAAW,CAAC;AACpE,OAAO,EAEL,KAAK,yBAAyB,EAE9B,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EAGvB,KAAK,wBAAwB,EAC9B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,eAAe,EAAuC,MAAM,aAAa,CAAC;AAExF,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAG5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,qCAAqC;IACrC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,yBAAyB,CAAC;IAC7C,8DAA8D;IAC9D,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,+EAA+E;IAC/E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gEAAgE;IAChE,SAAS,C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1,5 +1,6 @@
|
|
|
1
1
|
import { type CallToolResult, type McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
import { executeToolMethod, type ToolCallHooks, type ToolLifecycle } from './execute.js';
|
|
3
|
+
import { type McpCatalogStamp } from './mcp-catalog.js';
|
|
3
4
|
import type { PreparedRuntimeMcpTool } from './mcp-prepare.js';
|
|
4
5
|
import type { McpRoundRuntime } from './mcp-round.js';
|
|
5
6
|
interface NativeMcpRuntimeConfig {
|
|
@@ -9,6 +10,8 @@ interface NativeMcpRuntimeConfig {
|
|
|
9
10
|
coerceJsonArgs?: boolean;
|
|
10
11
|
onOutputStrip?: (toolName: string, paths: string[]) => void;
|
|
11
12
|
multiRoundRuntime?: McpRoundRuntime;
|
|
13
|
+
/** The catalog this surface advertises, stamped onto listings and results. */
|
|
14
|
+
catalog?: McpCatalogStamp;
|
|
12
15
|
formatResult: (result: Awaited<ReturnType<typeof executeToolMethod>>, mode: PreparedRuntimeMcpTool['descriptor']['outputMode'], toolName: string) => CallToolResult;
|
|
13
16
|
}
|
|
14
17
|
/** Mount immutable runtime-tool descriptors onto one fresh MCP server/runtime. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-mcp.d.ts","sourceRoot":"","sources":["../../src/tools/native-mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,SAAS,EACf,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAAE,iBAAiB,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AACtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAKnD,UAAU,sBAAsB;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,a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;IAC5D,iBAAiB,CAAC,EAAE,eAAe,CAAC;IACpC,8EAA8E;IAC9E,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,YAAY,EAAE,CACZ,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,EACrD,IAAI,EAAE,sBAAsB,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,EACxD,QAAQ,EAAE,MAAM,KACb,cAAc,CAAC;CACrB;AAED,kFAAkF;AAClF,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,SAAS,sBAAsB,EAAE,EACxC,MAAM,EAAE,sBAAsB,GAC7B,IAAI,CAwHN"}
|
package/dist/tools.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { listContractToolNames, listToolNames, type ToolNameEntry, } from './too
|
|
|
21
21
|
export { buildToolManifest, describeToolCatalog, type ToolCatalogConfig, type ToolCatalogEntry, type ToolManifestConfig, type ToolManifestEntry, } from './tools/manifest.js';
|
|
22
22
|
export { buildMcpServer, type DirectMcpSurfaceConfig, type FiniteMcpSurfaceConfig, type McpMountConfig, type McpServerBuildConfig, type McpServerSharedConfig, mountMcp, mountMcpResource, validateMcpSchemas, } from './tools/mcp.js';
|
|
23
23
|
export { EXT_APPS_BUNDLE_PLACEHOLDER, inlineMcpAppBundle, type McpAppCsp, type McpAppResourceMeta, type McpResourceDef, RESOURCE_MIME_TYPE, } from './tools/mcp-app.js';
|
|
24
|
+
export { MCP_CATALOG_META_KEY, type McpCatalogStamp, mcpCatalogMeta, readMcpCatalogStamp, } from './tools/mcp-catalog.js';
|
|
24
25
|
export { createMcpHandler, createMcpHttpRoute, type McpHandlerConfig, type McpHttpConfig, type McpHttpHandler, type McpHttpSecurityConfig, type McpLegacyPolicy, } from './tools/mcp-handler.js';
|
|
25
26
|
export type { IncompatibleSchemaPolicy, McpSchemaValidationConfig, McpSurfaceDefinition, McpSurfaceRegistry, ValidateMcpSchemasConfig, } from './tools/mcp-prepare.js';
|
|
26
27
|
export { createStdioMcpServer, type McpStdioHandle, type StdioAuthConfig, type StdioMcpServerConfig, } from './tools/mcp-stdio.js';
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EACL,KAAK,mCAAmC,EACxC,KAAK,sCAAsC,EAC3C,KAAK,qCAAqC,EAC1C,KAAK,oCAAoC,EACzC,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,2CAA2C,EAChD,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,kCAAkC,EACvC,0BAA0B,EAC1B,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACpC,KAAK,mCAAmC,EACxC,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,EAClC,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,GACjC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,8BAA8B,EACnC,KAAK,iCAAi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,EAC3C,KAAK,yCAAyC,EAC9C,KAAK,gCAAgC,EACrC,KAAK,gCAAgC,EACrC,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EACL,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtF,cAAc,kBAAkB,CAAC"}
|
package/dist/tools.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
compareCodepoints,
|
|
3
|
+
serializeCanonicalJson
|
|
4
|
+
} from "./index-0j3vcp5m.js";
|
|
1
5
|
import {
|
|
2
6
|
ManagedFileError
|
|
3
7
|
} from "./index-actkayzn.js";
|
|
@@ -22,7 +26,7 @@ import {
|
|
|
22
26
|
buildToolManifest,
|
|
23
27
|
describeToolCatalog,
|
|
24
28
|
mountAgent
|
|
25
|
-
} from "./index-
|
|
29
|
+
} from "./index-p48nc8g9.js";
|
|
26
30
|
import"./index-7rkhw9ec.js";
|
|
27
31
|
import {
|
|
28
32
|
argumentsDigest
|
|
@@ -38,7 +42,7 @@ import {
|
|
|
38
42
|
} from "./index-4fpa9dy2.js";
|
|
39
43
|
import {
|
|
40
44
|
createToolInvoker
|
|
41
|
-
} from "./index-
|
|
45
|
+
} from "./index-03bvcv7r.js";
|
|
42
46
|
import {
|
|
43
47
|
WaitTimeoutError,
|
|
44
48
|
createCli,
|
|
@@ -47,22 +51,22 @@ import {
|
|
|
47
51
|
fetchPinnedDocument,
|
|
48
52
|
readCapped,
|
|
49
53
|
runWaitOperation
|
|
50
|
-
} from "./index-
|
|
54
|
+
} from "./index-mthq65vn.js";
|
|
51
55
|
import"./index-sbdmyz75.js";
|
|
52
56
|
import {
|
|
53
57
|
collectToolSurface
|
|
54
|
-
} from "./index-
|
|
58
|
+
} from "./index-w58rfj2d.js";
|
|
55
59
|
import {
|
|
56
60
|
collectTools,
|
|
57
61
|
createToolRunner,
|
|
58
62
|
formatToolError
|
|
59
|
-
} from "./index-
|
|
63
|
+
} from "./index-dggfq62w.js";
|
|
60
64
|
import {
|
|
61
65
|
ToolExecutionControlError,
|
|
62
66
|
executeToolMethod,
|
|
63
67
|
isToolExecutionControlError,
|
|
64
68
|
toolResultFromError
|
|
65
|
-
} from "./index-
|
|
69
|
+
} from "./index-1ft2wrv0.js";
|
|
66
70
|
import {
|
|
67
71
|
getRequestContext,
|
|
68
72
|
getTraceId,
|
|
@@ -71,7 +75,7 @@ import {
|
|
|
71
75
|
import"./index-f9mb610r.js";
|
|
72
76
|
import {
|
|
73
77
|
normalizeError
|
|
74
|
-
} from "./index-
|
|
78
|
+
} from "./index-42f33bzd.js";
|
|
75
79
|
import {
|
|
76
80
|
defineContract
|
|
77
81
|
} from "./index-nrqg8tks.js";
|
|
@@ -101,7 +105,9 @@ import {
|
|
|
101
105
|
presentationMetadata,
|
|
102
106
|
validateMcpRoundPolicy
|
|
103
107
|
} from "./index-fenaekmk.js";
|
|
104
|
-
import
|
|
108
|
+
import {
|
|
109
|
+
toJsonSchema
|
|
110
|
+
} from "./index-cby4ar3v.js";
|
|
105
111
|
import {
|
|
106
112
|
AppError,
|
|
107
113
|
STITCH_ERROR_STATUS
|
|
@@ -946,6 +952,63 @@ function inlineMcpAppBundle(html) {
|
|
|
946
952
|
return html.replace(EXT_APPS_BUNDLE_PLACEHOLDER, () => bundle);
|
|
947
953
|
}
|
|
948
954
|
|
|
955
|
+
// src/tools/mcp-catalog.ts
|
|
956
|
+
import { createHash } from "node:crypto";
|
|
957
|
+
var MCP_CATALOG_META_KEY = "stitchkit/catalog";
|
|
958
|
+
var stampCache = new WeakMap;
|
|
959
|
+
function toolFingerprint(descriptor) {
|
|
960
|
+
const { mountable } = descriptor;
|
|
961
|
+
return {
|
|
962
|
+
name: mountable.name,
|
|
963
|
+
description: mountable.method.desc,
|
|
964
|
+
input: descriptor.inputSchema,
|
|
965
|
+
output: descriptor.outputSchema ? toJsonSchema(descriptor.outputSchema, "output", "any") : null,
|
|
966
|
+
annotations: mountable.method.annotations ?? null
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
function mcpCatalogStamp(surface) {
|
|
970
|
+
const cached = stampCache.get(surface);
|
|
971
|
+
if (cached)
|
|
972
|
+
return cached;
|
|
973
|
+
const descriptors = [
|
|
974
|
+
...surface.contractTools,
|
|
975
|
+
...surface.runtimeTools.map((entry) => entry.descriptor)
|
|
976
|
+
].sort((left, right) => compareCodepoints(left.mountable.name, right.mountable.name));
|
|
977
|
+
const bytes = serializeCanonicalJson(descriptors.map(toolFingerprint));
|
|
978
|
+
const stamp = {
|
|
979
|
+
digest: createHash("sha256").update(bytes).digest("hex").slice(0, 16),
|
|
980
|
+
tools: descriptors.length
|
|
981
|
+
};
|
|
982
|
+
stampCache.set(surface, stamp);
|
|
983
|
+
return stamp;
|
|
984
|
+
}
|
|
985
|
+
function mcpCatalogMeta(stamp) {
|
|
986
|
+
return { [MCP_CATALOG_META_KEY]: { ...stamp } };
|
|
987
|
+
}
|
|
988
|
+
function readMcpCatalogStamp(meta) {
|
|
989
|
+
if (!isRecord(meta))
|
|
990
|
+
return null;
|
|
991
|
+
const value = meta[MCP_CATALOG_META_KEY];
|
|
992
|
+
if (!isRecord(value))
|
|
993
|
+
return null;
|
|
994
|
+
const { digest, tools } = value;
|
|
995
|
+
if (typeof digest !== "string" || digest.length === 0)
|
|
996
|
+
return null;
|
|
997
|
+
if (typeof tools !== "number" || !Number.isInteger(tools) || tools < 0)
|
|
998
|
+
return null;
|
|
999
|
+
return { digest, tools };
|
|
1000
|
+
}
|
|
1001
|
+
function stampToolRegistration(config, stamp) {
|
|
1002
|
+
if (!stamp)
|
|
1003
|
+
return config;
|
|
1004
|
+
return { ...config, _meta: { ...config._meta, ...mcpCatalogMeta(stamp) } };
|
|
1005
|
+
}
|
|
1006
|
+
function stampToolResult(result, stamp) {
|
|
1007
|
+
if (!stamp)
|
|
1008
|
+
return result;
|
|
1009
|
+
return { ...result, _meta: { ...result._meta, ...mcpCatalogMeta(stamp) } };
|
|
1010
|
+
}
|
|
1011
|
+
|
|
949
1012
|
// src/tools/mcp-prepare.ts
|
|
950
1013
|
function textBlock(text) {
|
|
951
1014
|
return [{ type: "text", text }];
|
|
@@ -1283,7 +1346,7 @@ function mountPreparedRuntimeMcp(server, tools, config) {
|
|
|
1283
1346
|
"ui/resourceUri": definition.ui.resourceUri
|
|
1284
1347
|
};
|
|
1285
1348
|
}
|
|
1286
|
-
server.registerTool(definition.name, toolConfig, async (rawArgs, mcpContext) => runInMcpRequestContext(mcpContext, definition.name, async () => {
|
|
1349
|
+
server.registerTool(definition.name, stampToolRegistration(toolConfig, config.catalog), async (rawArgs, mcpContext) => stampToolResult(await runInMcpRequestContext(mcpContext, definition.name, async () => {
|
|
1287
1350
|
const args = isRecord(rawArgs) ? rawArgs : {};
|
|
1288
1351
|
const runTool = (tool, toolArgs, roundContext) => executeToolMethod(tool.method, definition.name, toolArgs, { ...config.context, ...roundContext, source: "mcp" }, config.hooks, config.lifecycle, config.coerceJsonArgs ?? true, config.onOutputStrip ? (paths) => config.onOutputStrip?.(definition.name, paths) : undefined);
|
|
1289
1352
|
const round = await resolveMcpRound({
|
|
@@ -1323,7 +1386,7 @@ function mountPreparedRuntimeMcp(server, tools, config) {
|
|
|
1323
1386
|
throw new Error("[stitchkit] Runtime MCP presenter invariant failed");
|
|
1324
1387
|
}
|
|
1325
1388
|
return presentedResult.data;
|
|
1326
|
-
}));
|
|
1389
|
+
}), config.catalog));
|
|
1327
1390
|
}
|
|
1328
1391
|
}
|
|
1329
1392
|
|
|
@@ -1343,7 +1406,10 @@ function mountMcp(mcpServer, services, config = {}) {
|
|
|
1343
1406
|
schemaValidation: config.schemaValidation,
|
|
1344
1407
|
logger: config.logger
|
|
1345
1408
|
});
|
|
1346
|
-
mountPreparedMcp(mcpServer, prepared,
|
|
1409
|
+
mountPreparedMcp(mcpServer, prepared, {
|
|
1410
|
+
...config,
|
|
1411
|
+
catalog: mcpCatalogStamp({ contractTools: prepared, runtimeTools: [] })
|
|
1412
|
+
});
|
|
1347
1413
|
}
|
|
1348
1414
|
function mountPreparedMcp(mcpServer, prepared, config = {}) {
|
|
1349
1415
|
const runTool = createToolRunner({
|
|
@@ -1373,7 +1439,7 @@ function mountPreparedMcp(mcpServer, prepared, config = {}) {
|
|
|
1373
1439
|
"ui/resourceUri": mountable.method.ui.resourceUri
|
|
1374
1440
|
};
|
|
1375
1441
|
}
|
|
1376
|
-
mcpServer.registerTool(mountable.name, toolConfig, async (rawArgs, mcpContext) => runInMcpRequestContext(mcpContext, mountable.name, async () => {
|
|
1442
|
+
mcpServer.registerTool(mountable.name, stampToolRegistration(toolConfig, config.catalog), async (rawArgs, mcpContext) => stampToolResult(await runInMcpRequestContext(mcpContext, mountable.name, async () => {
|
|
1377
1443
|
const args = isRecord(rawArgs) ? rawArgs : {};
|
|
1378
1444
|
try {
|
|
1379
1445
|
const round = await resolveMcpRound({
|
|
@@ -1392,7 +1458,7 @@ function mountPreparedMcp(mcpServer, prepared, config = {}) {
|
|
|
1392
1458
|
} catch (err) {
|
|
1393
1459
|
return formatMcpResult(toolResultFromError(err), "none", mountable.name, config.errorHint);
|
|
1394
1460
|
}
|
|
1395
|
-
}));
|
|
1461
|
+
}), config.catalog));
|
|
1396
1462
|
}
|
|
1397
1463
|
}
|
|
1398
1464
|
function buildMcpServer(config, auth) {
|
|
@@ -1454,7 +1520,9 @@ function buildMcpServerFromPrepared(config, auth, prepared) {
|
|
|
1454
1520
|
};
|
|
1455
1521
|
const server = new McpServer(config.serverInfo, serverOptions);
|
|
1456
1522
|
const context = config.context?.(auth);
|
|
1523
|
+
const catalog = mcpCatalogStamp(prepared);
|
|
1457
1524
|
mountPreparedMcp(server, prepared.contractTools, {
|
|
1525
|
+
catalog,
|
|
1458
1526
|
context,
|
|
1459
1527
|
hooks: config.hooks,
|
|
1460
1528
|
lifecycle: config.lifecycle,
|
|
@@ -1473,6 +1541,7 @@ function buildMcpServerFromPrepared(config, auth, prepared) {
|
|
|
1473
1541
|
}
|
|
1474
1542
|
});
|
|
1475
1543
|
mountPreparedRuntimeMcp(server, prepared.runtimeTools, {
|
|
1544
|
+
catalog,
|
|
1476
1545
|
context,
|
|
1477
1546
|
hooks: config.hooks,
|
|
1478
1547
|
lifecycle: config.lifecycle,
|
|
@@ -2683,6 +2752,7 @@ export {
|
|
|
2683
2752
|
validateMcpSchemas,
|
|
2684
2753
|
summarizeTransports,
|
|
2685
2754
|
resolveMedia,
|
|
2755
|
+
readMcpCatalogStamp,
|
|
2686
2756
|
protectedResourceMetadataUrl,
|
|
2687
2757
|
oauthProtectedResourceRoute,
|
|
2688
2758
|
mountWait,
|
|
@@ -2693,6 +2763,7 @@ export {
|
|
|
2693
2763
|
mountMcp,
|
|
2694
2764
|
mountDownload,
|
|
2695
2765
|
mountAgent,
|
|
2766
|
+
mcpCatalogMeta,
|
|
2696
2767
|
listToolNames,
|
|
2697
2768
|
listContractToolNames,
|
|
2698
2769
|
isToolExecutionControlError,
|
|
@@ -2737,6 +2808,7 @@ export {
|
|
|
2737
2808
|
PORTABLE_JSON_SCHEMA_FORMATS,
|
|
2738
2809
|
McpMediaContentSchema,
|
|
2739
2810
|
McpAnnotationsSchema,
|
|
2811
|
+
MCP_CATALOG_META_KEY,
|
|
2740
2812
|
EXT_APPS_BUNDLE_PLACEHOLDER,
|
|
2741
2813
|
AsyncOperationCancelResultSchema
|
|
2742
2814
|
};
|
package/llms-full.txt
CHANGED
|
@@ -3446,6 +3446,42 @@ finite `surfaces` registry when identities share a provably immutable surface.
|
|
|
3446
3446
|
Stitchkit never advertises list-change or subscription capabilities
|
|
3447
3447
|
without an implementation.
|
|
3448
3448
|
|
|
3449
|
+
### Knowing your catalog is stale — the catalog stamp
|
|
3450
|
+
|
|
3451
|
+
A client lists the tools once and keeps that list. If the server's contract
|
|
3452
|
+
moves afterwards, the client's copy is wrong and *nothing tells it so*: calls
|
|
3453
|
+
are refused, and from inside the client a refusal looks like a broken server.
|
|
3454
|
+
This is the most expensive shape a contract disagreement takes, because the
|
|
3455
|
+
party able to fix it is the one with no evidence.
|
|
3456
|
+
|
|
3457
|
+
Every advertised tool and every tool result therefore carries the fingerprint of
|
|
3458
|
+
the catalog it came from:
|
|
3459
|
+
|
|
3460
|
+
```ts
|
|
3461
|
+
import { readMcpCatalogStamp } from 'stitchkit/tools';
|
|
3462
|
+
|
|
3463
|
+
const listed = await client.listTools();
|
|
3464
|
+
let known = readMcpCatalogStamp(listed.tools[0]?._meta); // { digest, tools }
|
|
3465
|
+
|
|
3466
|
+
const result = await client.callTool({ name: 'record_journal', arguments });
|
|
3467
|
+
const live = readMcpCatalogStamp(result._meta);
|
|
3468
|
+
if (live && known && live.digest !== known.digest) {
|
|
3469
|
+
// The catalog moved under us. Re-list before blaming the result.
|
|
3470
|
+
known = readMcpCatalogStamp((await client.listTools()).tools[0]?._meta);
|
|
3471
|
+
}
|
|
3472
|
+
```
|
|
3473
|
+
|
|
3474
|
+
The comparison costs nothing and runs on a response you were already receiving —
|
|
3475
|
+
including a refusal, which is exactly when a stale catalog is the likeliest
|
|
3476
|
+
explanation. `notifications/tools/list_changed` is the push-shaped answer to the
|
|
3477
|
+
same problem and `createMcpHandler` cannot send it: it is stateless by
|
|
3478
|
+
construction, so there is no retained session to push down.
|
|
3479
|
+
|
|
3480
|
+
The digest covers each advertised tool's name, description, input schema, output
|
|
3481
|
+
schema and annotations, and nothing else — it moves when the contract moves and
|
|
3482
|
+
not when a handler does. Raw SDK registrations stay consumer-owned and are
|
|
3483
|
+
outside it.
|
|
3484
|
+
|
|
3449
3485
|
### Typed MCP call metadata
|
|
3450
3486
|
|
|
3451
3487
|
Contract handlers, runtime-tool handlers/factories, lifecycle and tool hooks all
|
|
@@ -17008,6 +17044,25 @@ A native remote-connector auth surface for MCP — [guide](../guide/mcp-and-agen
|
|
|
17008
17044
|
| `RefreshData` | _type_ | a stored refresh-token record |
|
|
17009
17045
|
| `RegisteredClient` | _type_ | a registered OAuth client |
|
|
17010
17046
|
|
|
17047
|
+
### Catalog stamp
|
|
17048
|
+
|
|
17049
|
+
Every advertised tool and every tool result carries the fingerprint of the catalog it came
|
|
17050
|
+
from, so a long-lived consumer can see that its own copy is stale **without making a
|
|
17051
|
+
request for it**. `createMcpHandler` is stateless by construction and therefore has no
|
|
17052
|
+
retained session to push `notifications/tools/list_changed` down; the stamp needs none.
|
|
17053
|
+
|
|
17054
|
+
Store the stamp beside the tools when you list them, compare it against the one on every
|
|
17055
|
+
result, and re-list when they differ — including on a refusal, which is exactly when a
|
|
17056
|
+
stale catalog is the likeliest explanation and the least visible one. The server side
|
|
17057
|
+
needs no wiring: every mount stamps what it advertises.
|
|
17058
|
+
|
|
17059
|
+
| Export | Kind | Summary |
|
|
17060
|
+
|--------|------|---------|
|
|
17061
|
+
| `readMcpCatalogStamp` | function | read a peer's stamp out of `_meta`, or `null` when there is none |
|
|
17062
|
+
| `mcpCatalogMeta` | function | the `_meta` fragment a stamped tool or result carries |
|
|
17063
|
+
| `MCP_CATALOG_META_KEY` | const | the namespaced `_meta` key (`stitchkit/catalog`) |
|
|
17064
|
+
| `McpCatalogStamp` | _type_ | `{ digest, tools }` — the catalog fingerprint and its tool count |
|
|
17065
|
+
|
|
17011
17066
|
### MCP Apps (widgets)
|
|
17012
17067
|
|
|
17013
17068
|
Interactive MCP resources — [ADR 0019](../decisions/0019-generic-native-tools.md).
|
package/package.json
CHANGED