@sezzlee/sdk-nestjs 0.0.0-stage → 0.2.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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +360 -2
  3. package/dist/cache.d.ts +18 -0
  4. package/dist/cache.js +55 -0
  5. package/dist/catalog.d.ts +100 -0
  6. package/dist/catalog.js +456 -0
  7. package/dist/decorators.d.ts +172 -0
  8. package/dist/decorators.js +79 -0
  9. package/dist/discovery/body-encoding.d.ts +24 -0
  10. package/dist/discovery/body-encoding.js +211 -0
  11. package/dist/discovery/diagnostics.d.ts +4 -0
  12. package/dist/discovery/diagnostics.js +49 -0
  13. package/dist/discovery/endpoint-discovery.d.ts +52 -0
  14. package/dist/discovery/endpoint-discovery.js +722 -0
  15. package/dist/discovery/type-shape.d.ts +21 -0
  16. package/dist/discovery/type-shape.js +297 -0
  17. package/dist/dispatcher.d.ts +29 -0
  18. package/dist/dispatcher.js +182 -0
  19. package/dist/extension-points.d.ts +34 -0
  20. package/dist/extension-points.js +35 -0
  21. package/dist/families.d.ts +77 -0
  22. package/dist/families.js +157 -0
  23. package/dist/files.d.ts +43 -0
  24. package/dist/files.js +13 -0
  25. package/dist/index.d.ts +48 -0
  26. package/dist/index.js +26 -0
  27. package/dist/invoke-result-mapper.d.ts +16 -0
  28. package/dist/invoke-result-mapper.js +44 -0
  29. package/dist/markers.d.ts +5 -0
  30. package/dist/markers.js +27 -0
  31. package/dist/meta-tools.d.ts +18 -0
  32. package/dist/meta-tools.js +306 -0
  33. package/dist/options-validation.d.ts +17 -0
  34. package/dist/options-validation.js +79 -0
  35. package/dist/options.d.ts +201 -0
  36. package/dist/options.js +151 -0
  37. package/dist/outer-connection.d.ts +18 -0
  38. package/dist/outer-connection.js +23 -0
  39. package/dist/sezzlee.module.d.ts +16 -0
  40. package/dist/sezzlee.module.js +180 -0
  41. package/dist/synthetic-context.d.ts +18 -0
  42. package/dist/synthetic-context.js +131 -0
  43. package/dist/transport/audience.d.ts +2 -0
  44. package/dist/transport/audience.js +21 -0
  45. package/dist/transport/protected-resource-metadata.d.ts +6 -0
  46. package/dist/transport/protected-resource-metadata.js +23 -0
  47. package/dist/transport/streamable-http.d.ts +25 -0
  48. package/dist/transport/streamable-http.js +52 -0
  49. package/dist/visibility/evaluator.d.ts +8 -0
  50. package/dist/visibility/evaluator.js +5 -0
  51. package/dist/visibility/probe.d.ts +25 -0
  52. package/dist/visibility/probe.js +104 -0
  53. package/dist/visibility/provider.d.ts +23 -0
  54. package/dist/visibility/provider.js +118 -0
  55. package/package.json +99 -3
@@ -0,0 +1,157 @@
1
+ import { declaredSchemaProblem, } from "@sezzlee/core";
2
+ export class ToolFamilyOptions {
3
+ registered = new Map();
4
+ loadTimeoutMs = 10_000;
5
+ get sources() {
6
+ return this.registered;
7
+ }
8
+ provide(name, source) {
9
+ this.registered.set(name, source);
10
+ return this;
11
+ }
12
+ }
13
+ async function loadOne(source, timeoutMs) {
14
+ const signal = AbortSignal.timeout(timeoutMs);
15
+ const aborted = new Promise((_, reject) => {
16
+ signal.addEventListener("abort", () => reject(signal.reason), {
17
+ once: true,
18
+ });
19
+ });
20
+ return Promise.race([Promise.resolve(source({ signal })), aborted]);
21
+ }
22
+ /**
23
+ * Loads every registered source once.
24
+ *
25
+ * A failing source keeps the members it last returned: dropping a family because its source was
26
+ * briefly unreachable would take working tools offline on every transient error.
27
+ *
28
+ * @param previous the loads the current catalog was built from, or `undefined` before the first
29
+ */
30
+ export async function loadFamilies(options, previous) {
31
+ const entries = await Promise.all([...options.sources].map(async ([name, source]) => {
32
+ try {
33
+ const members = await loadOne(source, options.loadTimeoutMs);
34
+ return [name, { state: "loaded", members }];
35
+ }
36
+ catch (error) {
37
+ const last = previous?.get(name);
38
+ return [
39
+ name,
40
+ last === undefined || last.state === "failed"
41
+ ? { state: "failed", error }
42
+ : { state: "stale", members: last.members, error },
43
+ ];
44
+ }
45
+ }));
46
+ return new Map(entries);
47
+ }
48
+ export const sdkFamilySeverities = {
49
+ unknown_family_source: "endpointDropped",
50
+ family_source_failed: "endpointDropped",
51
+ family_not_loaded: "endpointDropped",
52
+ family_source_stale: "warning",
53
+ family_member_rejected: "warning",
54
+ };
55
+ const diagnostic = (code, message) => ({ code, message });
56
+ const toolNamePattern = /^[a-z][a-z0-9_]{0,255}$/;
57
+ const reasonOf = (error) => error instanceof Error ? error.message : String(error);
58
+ /**
59
+ * Lowers one operation's family declaration into the variants its members become.
60
+ *
61
+ * A defect in one member is that member's alone: the rest of the family stays published and the
62
+ * member is reported, because the members are host data and one bad row should not take every
63
+ * sibling offline. Only a defect in the declaration itself refuses the operation.
64
+ *
65
+ * @param owner the operation's identity in diagnostics
66
+ * @param declared the handler's own `@McpVariant`s; a member may not reuse their names
67
+ * @param loads the member loads, or `undefined` when the sources have not loaded yet
68
+ */
69
+ export function resolveFamily(family, owner, declared, options, loads) {
70
+ const lowered = { parameter: family.parameter };
71
+ if (family.source === undefined) {
72
+ return {
73
+ kind: "members",
74
+ family: lowered,
75
+ variants: [],
76
+ diagnostics: [],
77
+ };
78
+ }
79
+ if (!options.sources.has(family.source)) {
80
+ return refused("unknown_family_source", `${owner} takes its members from source '${family.source}', which is not registered; register it with options.families.provide.`);
81
+ }
82
+ const load = loads?.get(family.source);
83
+ if (load === undefined) {
84
+ return refused("family_not_loaded", `${owner} was built before source '${family.source}' finished loading; the catalog is rebuilt when it does.`);
85
+ }
86
+ if (load.state === "failed") {
87
+ return refused("family_source_failed", `${owner} has no members: source '${family.source}' failed and has never returned any (${reasonOf(load.error)}).`);
88
+ }
89
+ const diagnostics = [];
90
+ if (load.state === "stale") {
91
+ diagnostics.push(diagnostic("family_source_stale", `${owner} keeps the members source '${family.source}' last returned; the latest load failed (${reasonOf(load.error)}).`));
92
+ }
93
+ const names = new Set(declared.map((variant) => variant.name));
94
+ const keys = new Set();
95
+ const variants = [];
96
+ for (const member of load.members) {
97
+ const problem = memberProblem(member, names, keys);
98
+ if (problem !== undefined) {
99
+ diagnostics.push(diagnostic("family_member_rejected", `${owner} drops member '${String(member.name)}': ${problem}.`));
100
+ continue;
101
+ }
102
+ names.add(member.name);
103
+ keys.add(JSON.stringify(member.key));
104
+ variants.push(lower(member, family.parameter));
105
+ }
106
+ return { kind: "members", family: lowered, variants, diagnostics };
107
+ }
108
+ function memberProblem(member, names, keys) {
109
+ if (typeof member.name !== "string" || !toolNamePattern.test(member.name)) {
110
+ return "its name does not match the tool-name pattern";
111
+ }
112
+ if (typeof member.description !== "string" ||
113
+ member.description.trim() === "") {
114
+ return "it has no description";
115
+ }
116
+ if (names.has(member.name)) {
117
+ return "another member or variant has the same name";
118
+ }
119
+ if (!(typeof member.key === "string" || Number.isFinite(member.key)) ||
120
+ keys.has(JSON.stringify(member.key))) {
121
+ return "its key is not a string or finite number, or repeats another member's";
122
+ }
123
+ const schema = member.body;
124
+ if (typeof schema !== "object" || schema === null || Array.isArray(schema)) {
125
+ return "its body is not a JSON Schema object";
126
+ }
127
+ const invalid = declaredSchemaProblem(member.body);
128
+ return invalid === undefined ? undefined : `its body ${invalid}`;
129
+ }
130
+ function lower(member, parameter) {
131
+ const annotations = {
132
+ ...(member.readOnly === undefined ? {} : { readOnlyHint: member.readOnly }),
133
+ ...(member.destructive === undefined
134
+ ? {}
135
+ : { destructiveHint: member.destructive }),
136
+ ...(member.idempotent === undefined
137
+ ? {}
138
+ : { idempotentHint: member.idempotent }),
139
+ };
140
+ return {
141
+ name: member.name,
142
+ description: member.description,
143
+ arguments: [
144
+ { name: parameter, hidden: { kind: "constant", value: member.key } },
145
+ ],
146
+ requestBody: {
147
+ schema: member.body,
148
+ ...(member.bodyRequired === undefined
149
+ ? {}
150
+ : { required: member.bodyRequired }),
151
+ },
152
+ ...(Object.keys(annotations).length === 0 ? {} : { annotations }),
153
+ };
154
+ }
155
+ function refused(code, message) {
156
+ return { kind: "refused", diagnostic: diagnostic(code, message) };
157
+ }
@@ -0,0 +1,43 @@
1
+ import type { FileRefusalReason } from "@sezzlee/core";
2
+ import type { InvokeTarget, McpCaller } from "./options.js";
3
+ /** What a file resolver is asked to deliver. */
4
+ export interface FileResolveRequest {
5
+ /** The string the agent sent. It is not a capability: authorize it against {@link caller}. */
6
+ readonly ref: string;
7
+ /** The multipart field the file travels in. */
8
+ readonly field: string;
9
+ readonly target: InvokeTarget;
10
+ readonly caller: McpCaller;
11
+ /** The per-file byte limit; answer `too_large` rather than loading more. */
12
+ readonly maxBytes: number;
13
+ /** Aborted when the invoke deadline expires or the caller cancels. */
14
+ readonly signal: AbortSignal;
15
+ }
16
+ export type FileResolution = {
17
+ readonly ok: true;
18
+ readonly bytes: Uint8Array;
19
+ readonly filename?: string;
20
+ readonly mediaType?: string;
21
+ } | {
22
+ readonly ok: false;
23
+ readonly reason: FileRefusalReason;
24
+ };
25
+ /**
26
+ * Turns a `ref` file argument into bytes. sezzlee names no storage: the host binds this port, and
27
+ * binding it is what makes `ref` appear in a file argument's schema.
28
+ */
29
+ export interface FileResolver {
30
+ /** Shown to the agent as the `ref` key's description, so it knows what a ref is and where to get one. */
31
+ readonly refDescription: string;
32
+ resolve(request: FileResolveRequest): Promise<FileResolution>;
33
+ }
34
+ export interface SezzleeFileOptions {
35
+ resolver?: FileResolver;
36
+ }
37
+ /** Raised by the dispatcher when a `ref` was not delivered; the meta-tool layer turns it into an envelope. */
38
+ export declare class SezzleeFileRefused extends Error {
39
+ readonly field: string;
40
+ readonly reason: FileRefusalReason;
41
+ readonly limit: number;
42
+ constructor(field: string, reason: FileRefusalReason, limit: number);
43
+ }
package/dist/files.js ADDED
@@ -0,0 +1,13 @@
1
+ /** Raised by the dispatcher when a `ref` was not delivered; the meta-tool layer turns it into an envelope. */
2
+ export class SezzleeFileRefused extends Error {
3
+ field;
4
+ reason;
5
+ limit;
6
+ constructor(field, reason, limit) {
7
+ super(`sezzlee: file argument '${field}' was refused (${reason}).`);
8
+ this.field = field;
9
+ this.reason = reason;
10
+ this.limit = limit;
11
+ this.name = "SezzleeFileRefused";
12
+ }
13
+ }
@@ -0,0 +1,48 @@
1
+ export { SezzleeModule } from "./sezzlee.module.js";
2
+ export type { SezzleeModuleAsyncOptions } from "./sezzlee.module.js";
3
+ export { SezzleeDispatcher } from "./dispatcher.js";
4
+ export { SezzleeCatalog } from "./catalog.js";
5
+ export type { CatalogEntry, CatalogSnapshot } from "./catalog.js";
6
+ export { curate, hidden, McpIgnore, McpTool, McpToolFamily, McpVariant, } from "./decorators.js";
7
+ export type { ArgumentRule, ArgumentRules, JsonValue, McpFileFieldOptions, McpResponseDeclaration, McpToolEffect, McpToolFamilyOptions, McpToolOptions, McpVariantOptions, } from "./decorators.js";
8
+ export { ToolFamilyOptions } from "./families.js";
9
+ export type { McpFamilyMember, McpFamilySource } from "./families.js";
10
+ export { SezzleeFileRefused } from "./files.js";
11
+ export type { FileResolution, FileResolveRequest, FileResolver, SezzleeFileOptions, } from "./files.js";
12
+ export { ArgumentCurationOptions, callerOf } from "./options.js";
13
+ export type { ArgumentValueProvider, CurationTarget, SezzleeSearchOptions, McpCaller, VerifiedToken, } from "./options.js";
14
+ export type { RankCatalog, RankDocument, RankerFailureMode, RankRequest, ToolRanker, } from "@sezzlee/core";
15
+ export { isSezzleeProbe, isSezzleeRequest } from "./markers.js";
16
+ export { currentOuterConnection, type OuterConnection, } from "./outer-connection.js";
17
+ export { catalogGenerationMetaKey, registerSezzleeTools, } from "./meta-tools.js";
18
+ export type { MetaToolDependencies } from "./meta-tools.js";
19
+ export { createRoutePaths, discoverEndpoints, modulePathOf, normalizeRoute, } from "./discovery/endpoint-discovery.js";
20
+ export type { DiscoveredEndpoint, DiscoveryOptions, RoutePathMetadata, RoutePaths, VisibilityDeclaration, } from "./discovery/endpoint-discovery.js";
21
+ export { NestTypeShapeBinder } from "./discovery/type-shape.js";
22
+ export type { TypeShapeBinderOptions } from "./discovery/type-shape.js";
23
+ export { severityOf } from "./discovery/diagnostics.js";
24
+ export type { CatalogDiagnostic, CatalogSeverity, } from "./discovery/diagnostics.js";
25
+ export { DeclarativeVisibilityEvaluator } from "./visibility/evaluator.js";
26
+ export type { VisibilityEvaluator } from "./visibility/evaluator.js";
27
+ export { SezzleeProbeEvaluator, SezzleeProbeInterceptor, } from "./visibility/probe.js";
28
+ export type { ProbeEvaluator } from "./visibility/probe.js";
29
+ export { CallerVisibilityProvider } from "./visibility/provider.js";
30
+ export type { DispatchDeadline, DispatchResult, ProbeResult, } from "./dispatcher.js";
31
+ export { SezzleeDispatchAborted } from "./synthetic-context.js";
32
+ export type { DispatchAbortReason } from "./synthetic-context.js";
33
+ export { ErrorMappingOptions, IdentityForwardingOptions, SezzleeOptions, SEZZLEE_OPTIONS, } from "./options.js";
34
+ export { SezzleeConfigurationError, collectConfigurationFailures, validateSezzleeOptions, } from "./options-validation.js";
35
+ export type { InvokeTarget, SezzleeInvokeOptions, SezzleeDiagnosticsOptions, SezzleeNamingOptions, SezzleeSelectionOptions, SezzleeVisibilityOptions, SezzleeVisibilityTier, } from "./options.js";
36
+ export type { OuterRequest, SezzleeCacheOptions, SezzleeResourceServerOptions, SyntheticHeaders, SyntheticRequestOptions, } from "./options.js";
37
+ export { extensionTokens, toProviders } from "./extension-points.js";
38
+ export type { ExtensionOverrides, ExtensionPoints, OverrideProvider, } from "./extension-points.js";
39
+ export { CarrierHashCallerScopeResolver, SEZZLEE_CACHE_INVALIDATOR, SezzleeCacheInvalidator, } from "./cache.js";
40
+ export type { CallerScopeResolver } from "./cache.js";
41
+ export { DefaultInvokeResultMapper } from "./invoke-result-mapper.js";
42
+ export type { InvokeResultMapper } from "./invoke-result-mapper.js";
43
+ export { SezzleeStreamableHttp } from "./transport/streamable-http.js";
44
+ export type { SezzleeRequestHandler, SezzleeServerFactory, } from "./transport/streamable-http.js";
45
+ export { withAudienceCheck } from "./transport/audience.js";
46
+ export { protectedResourceMetadataHandler, protectedResourceMetadataPath, protectedResourceMetadataUrl, protectedResourceMetadataWellKnownPrefix, } from "./transport/protected-resource-metadata.js";
47
+ export { compose, createRequestTemplate, isInvokeError, isMappedError, isSdkError, mapInvokeResult, SezzleeArgumentError, SezzleeTemplateError, } from "@sezzlee/core";
48
+ export type { BackendErrorCode, BackendResponse, ComposedRequest, FieldError, InvokeOutcome, InvokeResult, InvokeSuccess, MappedError, ParameterBinding, ParameterKind, ParameterLocation, ParsedBody, Recognizer, RequestTemplate, RequestTemplateInput, SezzleeArgumentErrorCode, } from "@sezzlee/core";
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ export { SezzleeModule } from "./sezzlee.module.js";
2
+ export { SezzleeDispatcher } from "./dispatcher.js";
3
+ export { SezzleeCatalog } from "./catalog.js";
4
+ export { curate, hidden, McpIgnore, McpTool, McpToolFamily, McpVariant, } from "./decorators.js";
5
+ export { ToolFamilyOptions } from "./families.js";
6
+ export { SezzleeFileRefused } from "./files.js";
7
+ export { ArgumentCurationOptions, callerOf } from "./options.js";
8
+ export { isSezzleeProbe, isSezzleeRequest } from "./markers.js";
9
+ export { currentOuterConnection, } from "./outer-connection.js";
10
+ export { catalogGenerationMetaKey, registerSezzleeTools, } from "./meta-tools.js";
11
+ export { createRoutePaths, discoverEndpoints, modulePathOf, normalizeRoute, } from "./discovery/endpoint-discovery.js";
12
+ export { NestTypeShapeBinder } from "./discovery/type-shape.js";
13
+ export { severityOf } from "./discovery/diagnostics.js";
14
+ export { DeclarativeVisibilityEvaluator } from "./visibility/evaluator.js";
15
+ export { SezzleeProbeEvaluator, SezzleeProbeInterceptor, } from "./visibility/probe.js";
16
+ export { CallerVisibilityProvider } from "./visibility/provider.js";
17
+ export { SezzleeDispatchAborted } from "./synthetic-context.js";
18
+ export { ErrorMappingOptions, IdentityForwardingOptions, SezzleeOptions, SEZZLEE_OPTIONS, } from "./options.js";
19
+ export { SezzleeConfigurationError, collectConfigurationFailures, validateSezzleeOptions, } from "./options-validation.js";
20
+ export { extensionTokens, toProviders } from "./extension-points.js";
21
+ export { CarrierHashCallerScopeResolver, SEZZLEE_CACHE_INVALIDATOR, SezzleeCacheInvalidator, } from "./cache.js";
22
+ export { DefaultInvokeResultMapper } from "./invoke-result-mapper.js";
23
+ export { SezzleeStreamableHttp } from "./transport/streamable-http.js";
24
+ export { withAudienceCheck } from "./transport/audience.js";
25
+ export { protectedResourceMetadataHandler, protectedResourceMetadataPath, protectedResourceMetadataUrl, protectedResourceMetadataWellKnownPrefix, } from "./transport/protected-resource-metadata.js";
26
+ export { compose, createRequestTemplate, isInvokeError, isMappedError, isSdkError, mapInvokeResult, SezzleeArgumentError, SezzleeTemplateError, } from "@sezzlee/core";
@@ -0,0 +1,16 @@
1
+ import { type InvokeResult } from "@sezzlee/core";
2
+ import type { DispatchResult } from "./dispatcher.js";
3
+ import { SezzleeOptions } from "./options.js";
4
+ /** The names a reported field may be canonicalised against. */
5
+ export interface FieldVocabulary {
6
+ readonly fieldAliases?: Readonly<Record<string, string>>;
7
+ readonly hiddenFields?: readonly string[];
8
+ }
9
+ export interface InvokeResultMapper {
10
+ map(result: DispatchResult, knownFields: readonly string[], vocabulary?: FieldVocabulary): InvokeResult;
11
+ }
12
+ export declare class DefaultInvokeResultMapper implements InvokeResultMapper {
13
+ private readonly options;
14
+ constructor(options: SezzleeOptions);
15
+ map(result: DispatchResult, knownFields: readonly string[], vocabulary?: FieldVocabulary): InvokeResult;
16
+ }
@@ -0,0 +1,44 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { Inject, Injectable } from "@nestjs/common";
14
+ import { mapInvokeResult } from "@sezzlee/core";
15
+ import { SEZZLEE_OPTIONS, SezzleeOptions } from "./options.js";
16
+ let DefaultInvokeResultMapper = class DefaultInvokeResultMapper {
17
+ options;
18
+ constructor(options) {
19
+ this.options = options;
20
+ }
21
+ map(result, knownFields, vocabulary) {
22
+ return mapInvokeResult({
23
+ status: result.status,
24
+ contentType: result.contentType,
25
+ headers: result.headers,
26
+ body: result.body,
27
+ }, {
28
+ recognizers: this.options.errors.recognizers,
29
+ knownFields,
30
+ ...(vocabulary?.fieldAliases === undefined
31
+ ? {}
32
+ : { fieldAliases: vocabulary.fieldAliases }),
33
+ ...(vocabulary?.hiddenFields === undefined
34
+ ? {}
35
+ : { hiddenFields: vocabulary.hiddenFields }),
36
+ });
37
+ }
38
+ };
39
+ DefaultInvokeResultMapper = __decorate([
40
+ Injectable(),
41
+ __param(0, Inject(SEZZLEE_OPTIONS)),
42
+ __metadata("design:paramtypes", [SezzleeOptions])
43
+ ], DefaultInvokeResultMapper);
44
+ export { DefaultInvokeResultMapper };
@@ -0,0 +1,5 @@
1
+ export declare function markSyntheticRequest(request: object, probe: boolean): void;
2
+ export declare function markShortCircuited(request: object): void;
3
+ export declare function isSezzleeRequest(request: unknown): boolean;
4
+ export declare function isSezzleeProbe(request: unknown): boolean;
5
+ export declare function wasShortCircuited(request: unknown): boolean;
@@ -0,0 +1,27 @@
1
+ const SEZZLEE_REQUEST = Symbol("sezzlee.request");
2
+ const SEZZLEE_PROBE = Symbol("sezzlee.probe");
3
+ const SEZZLEE_SHORT_CIRCUIT = Symbol("sezzlee.probe.short-circuited");
4
+ export function markSyntheticRequest(request, probe) {
5
+ const marked = request;
6
+ marked[SEZZLEE_REQUEST] = true;
7
+ if (probe) {
8
+ marked[SEZZLEE_PROBE] = true;
9
+ }
10
+ }
11
+ export function markShortCircuited(request) {
12
+ request[SEZZLEE_SHORT_CIRCUIT] = true;
13
+ }
14
+ export function isSezzleeRequest(request) {
15
+ return reads(request, SEZZLEE_REQUEST);
16
+ }
17
+ export function isSezzleeProbe(request) {
18
+ return reads(request, SEZZLEE_PROBE);
19
+ }
20
+ export function wasShortCircuited(request) {
21
+ return reads(request, SEZZLEE_SHORT_CIRCUIT);
22
+ }
23
+ function reads(request, key) {
24
+ return (typeof request === "object" &&
25
+ request !== null &&
26
+ request[key] === true);
27
+ }
@@ -0,0 +1,18 @@
1
+ import type { McpServer } from "@modelcontextprotocol/server";
2
+ import { catalogGenerationMetaKey } from "@sezzlee/core";
3
+ import type { SezzleeCatalog } from "./catalog.js";
4
+ import type { CallerScopeResolver } from "./cache.js";
5
+ import type { SezzleeDispatcher } from "./dispatcher.js";
6
+ import type { InvokeResultMapper } from "./invoke-result-mapper.js";
7
+ import type { SezzleeOptions } from "./options.js";
8
+ import type { CallerVisibilityProvider } from "./visibility/provider.js";
9
+ export interface MetaToolDependencies {
10
+ readonly catalog: SezzleeCatalog;
11
+ readonly dispatcher: SezzleeDispatcher;
12
+ readonly mapper: InvokeResultMapper;
13
+ readonly visibility: CallerVisibilityProvider;
14
+ readonly scopes: CallerScopeResolver;
15
+ readonly options: SezzleeOptions;
16
+ }
17
+ export { catalogGenerationMetaKey };
18
+ export declare function registerSezzleeTools(server: McpServer, deps: MetaToolDependencies): void;