@kya-os/mcp-i-runtime 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
 
2
- > @kya-os/mcp-i-runtime@1.2.0 build /home/runner/work/xmcp-i/xmcp-i/packages/mcp-i-runtime
2
+ > @kya-os/mcp-i-runtime@1.2.2 build /home/runner/work/xmcp-i/xmcp-i/packages/mcp-i-runtime
3
3
  > tsc
4
4
 
package/dist/index.d.ts CHANGED
@@ -31,6 +31,7 @@ export { OAuthService, defaultSecretResolver } from "./services/oauth-service";
31
31
  export type { OAuthServiceConfig, SecretResolver, } from "./services/oauth-service";
32
32
  export { ToolContextBuilder } from "./services/tool-context-builder";
33
33
  export type { ToolContextBuilderConfig } from "./services/tool-context-builder";
34
+ export { authTypeSatisfies, normalizeAuthType, isUnsatisfiableAuthType, MINTABLE_AUTH_TYPES, } from "./services/auth-type-satisfies";
34
35
  export { OAuthProviderRegistry } from "./services/oauth-provider-registry";
35
36
  export { ProviderResolver, ConsentOnlyModeError, CredentialAuthModeError, } from "./services/provider-resolver";
36
37
  export { ProviderValidator, ProviderValidationError, } from "./services/provider-validator";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,cAAc,EACd,aAAa,EACb,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,aAAa,GACnB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,YAAY,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAG/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,OAAO,E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AAU,CAAC;AAGzB,OAAO,EACL,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAExB,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EAExB,SAAS,EACT,aAAa,EACb,eAAe,EACf,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,YAAY,EACV,cAAc,EACd,oBAAoB,EACpB,WAAW,EACX,aAAa,GACd,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,YAAY,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,wCAAwC,CAAC;AAGhD,OAAO,EACL,MAAM,EACN,0BAA0B,EAC1B,KAAK,MAAM,EACX,KAAK,KAAK,GACX,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,cAAc,EACd,aAAa,EACb,aAAa,EACb,eAAe,EAC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AAuB,EACvB,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,QAAQ,CAAC"}
package/dist/index.js CHANGED
@@ -20,9 +20,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
20
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.InMemoryOAuthConfigCache = exports.BatchDelegationService = exports.OAuthTokenRetrievalService = exports.ProviderValidationError = exports.ProviderValidator = exports.CredentialAuthModeError = exports.ConsentOnlyModeError = exports.ProviderResolver = exports.OAuthProviderRegistry = exports.ToolContextBuilder = exports.defaultSecretResolver = exports.OAuthService = exports.OAuthConfigService = exports.createSessionRegistrationService = exports.SessionRegistrationService = exports.authorizationMatches = exports.AccessControlApiService = exports.ProofVerifier = exports.CryptoService = exports.PolicyService = exports.ToolProtectionService = exports.terminalForToolResult = exports.terminalForToolError = exports.recordRuntimeDelegationAudit = exports.recordRuntimeConsentAudit = exports.createHmacRuntimeAuditContextFactory = exports.beginRuntimeToolAudit = exports.attachRuntimeAuditMetadata = exports.RuntimeToolAuditInvocation = exports.toNeedsAuthorization = exports.normalizeInternalToolName = exports.isInternalToolName = exports.recordWireForm = exports.LEGACY_WELL_KNOWN_IDENTITY_PATH = exports.WELL_KNOWN_IDENTITY_PATH = exports.LEGACY_INTERNAL_TOOL_PREFIX = exports.INTERNAL_TOOL_PREFIX = exports.LEGACY_SESSION_ID_PREFIX = exports.SESSION_ID_PREFIX = exports.CONSENT_UI_RESOURCE_URI = exports.MCPIRuntimeBase = exports.MemoryIdentityProvider = exports.MemoryNonceCacheProvider = exports.MemoryStorageProvider = exports.IdentityProvider = exports.NonceCacheProvider = exports.StorageProvider = exports.FetchProvider = exports.ClockProvider = exports.CryptoProvider = void 0;
24
- exports.MemoryResumeTokenStore = exports.hasSensitiveScopes = exports.verifyOrHints = exports.validateHandshakeFormat = exports.createHandshakeRequest = exports.SessionManager = exports.extractCanonicalData = exports.createProofResponse = exports.ProofGenerator = exports.createDefaultConsoleLogger = exports.logger = exports.IdpTokenResolver = exports.UserDidManager = exports.isPolicyEnabled = exports.hasMergedPolicy = exports.extractPolicy = exports.getPolicy = exports.hasMergedToolProtections = exports.extractToolProtections = exports.getToolProtection = exports.fetchRemoteConfig = exports.bytesToBase64 = exports.base64urlDecodeToString = exports.base64urlDecodeToBytes = exports.base64urlEncodeFromString = exports.base64urlEncodeFromBytes = exports.getSchemaStats = exports.getCriticalSchemas = exports.getSchemaById = exports.getSchemasByCategory = exports.getAllSchemas = exports.SCHEMA_REGISTRY = exports.createSchemaVerifier = exports.SchemaVerifier = exports.isValidBase58 = exports.base58Decode = exports.base58Encode = exports.createDelegationErrorFormatter = exports.DelegationErrorFormatter = exports.OAuthRequiredError = exports.DelegationRequiredError = exports.NoOpToolProtectionCache = exports.InMemoryToolProtectionCache = exports.createProofVerificationError = exports.PROOF_VERIFICATION_ERROR_CODES = exports.ProofVerificationError = exports.migrateLegacyKeys = exports.StorageKeyHelpers = exports.createStorageProviders = exports.NoOpOAuthConfigCache = void 0;
25
- exports.generateResumeToken = void 0;
23
+ exports.ProviderValidator = exports.CredentialAuthModeError = exports.ConsentOnlyModeError = exports.ProviderResolver = exports.OAuthProviderRegistry = exports.MINTABLE_AUTH_TYPES = exports.isUnsatisfiableAuthType = exports.normalizeAuthType = exports.authTypeSatisfies = exports.ToolContextBuilder = exports.defaultSecretResolver = exports.OAuthService = exports.OAuthConfigService = exports.createSessionRegistrationService = exports.SessionRegistrationService = exports.authorizationMatches = exports.AccessControlApiService = exports.ProofVerifier = exports.CryptoService = exports.PolicyService = exports.ToolProtectionService = exports.terminalForToolResult = exports.terminalForToolError = exports.recordRuntimeDelegationAudit = exports.recordRuntimeConsentAudit = exports.createHmacRuntimeAuditContextFactory = exports.beginRuntimeToolAudit = exports.attachRuntimeAuditMetadata = exports.RuntimeToolAuditInvocation = exports.toNeedsAuthorization = exports.normalizeInternalToolName = exports.isInternalToolName = exports.recordWireForm = exports.LEGACY_WELL_KNOWN_IDENTITY_PATH = exports.WELL_KNOWN_IDENTITY_PATH = exports.LEGACY_INTERNAL_TOOL_PREFIX = exports.INTERNAL_TOOL_PREFIX = exports.LEGACY_SESSION_ID_PREFIX = exports.SESSION_ID_PREFIX = exports.CONSENT_UI_RESOURCE_URI = exports.MCPIRuntimeBase = exports.MemoryIdentityProvider = exports.MemoryNonceCacheProvider = exports.MemoryStorageProvider = exports.IdentityProvider = exports.NonceCacheProvider = exports.StorageProvider = exports.FetchProvider = exports.ClockProvider = exports.CryptoProvider = void 0;
24
+ exports.createHandshakeRequest = exports.SessionManager = exports.extractCanonicalData = exports.createProofResponse = exports.ProofGenerator = exports.createDefaultConsoleLogger = exports.logger = exports.IdpTokenResolver = exports.UserDidManager = exports.isPolicyEnabled = exports.hasMergedPolicy = exports.extractPolicy = exports.getPolicy = exports.hasMergedToolProtections = exports.extractToolProtections = exports.getToolProtection = exports.fetchRemoteConfig = exports.bytesToBase64 = exports.base64urlDecodeToString = exports.base64urlDecodeToBytes = exports.base64urlEncodeFromString = exports.base64urlEncodeFromBytes = exports.getSchemaStats = exports.getCriticalSchemas = exports.getSchemaById = exports.getSchemasByCategory = exports.getAllSchemas = exports.SCHEMA_REGISTRY = exports.createSchemaVerifier = exports.SchemaVerifier = exports.isValidBase58 = exports.base58Decode = exports.base58Encode = exports.createDelegationErrorFormatter = exports.DelegationErrorFormatter = exports.OAuthRequiredError = exports.DelegationRequiredError = exports.NoOpToolProtectionCache = exports.InMemoryToolProtectionCache = exports.createProofVerificationError = exports.PROOF_VERIFICATION_ERROR_CODES = exports.ProofVerificationError = exports.migrateLegacyKeys = exports.StorageKeyHelpers = exports.createStorageProviders = exports.NoOpOAuthConfigCache = exports.InMemoryOAuthConfigCache = exports.BatchDelegationService = exports.OAuthTokenRetrievalService = exports.ProviderValidationError = void 0;
25
+ exports.generateResumeToken = exports.MemoryResumeTokenStore = exports.hasSensitiveScopes = exports.verifyOrHints = exports.validateHandshakeFormat = void 0;
26
26
  // Base providers
27
27
  var base_1 = require("./providers/base");
28
28
  Object.defineProperty(exports, "CryptoProvider", { enumerable: true, get: function () { return base_1.CryptoProvider; } });
@@ -98,6 +98,15 @@ Object.defineProperty(exports, "defaultSecretResolver", { enumerable: true, get:
98
98
  // Tool Context Builder (Phase 1)
99
99
  var tool_context_builder_1 = require("./services/tool-context-builder");
100
100
  Object.defineProperty(exports, "ToolContextBuilder", { enumerable: true, get: function () { return tool_context_builder_1.ToolContextBuilder; } });
101
+ // Auth-type satisfaction check (security fix: consent-approve auth-gate, Task B3)
102
+ // Consumed by the delegation-enforcement gates in agent.ts and
103
+ // tool-context-builder.ts to reject a delegation whose authorization type does
104
+ // not satisfy the tool's required type.
105
+ var auth_type_satisfies_1 = require("./services/auth-type-satisfies");
106
+ Object.defineProperty(exports, "authTypeSatisfies", { enumerable: true, get: function () { return auth_type_satisfies_1.authTypeSatisfies; } });
107
+ Object.defineProperty(exports, "normalizeAuthType", { enumerable: true, get: function () { return auth_type_satisfies_1.normalizeAuthType; } });
108
+ Object.defineProperty(exports, "isUnsatisfiableAuthType", { enumerable: true, get: function () { return auth_type_satisfies_1.isUnsatisfiableAuthType; } });
109
+ Object.defineProperty(exports, "MINTABLE_AUTH_TYPES", { enumerable: true, get: function () { return auth_type_satisfies_1.MINTABLE_AUTH_TYPES; } });
101
110
  // OAuth Provider Registry (Phase 2)
102
111
  var oauth_provider_registry_1 = require("./services/oauth-provider-registry");
103
112
  Object.defineProperty(exports, "OAuthProviderRegistry", { enumerable: true, get: function () { return oauth_provider_registry_1.OAuthProviderRegistry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B,mHAAA,yBAAyB,OAAA;AACzB,gHAAA,sBAAsB,OAAA;AACtB,iHAAA,uBAAuB,OAAA;AACvB,uGAAA,aAAa,OAAA;AA6Bf,oCAAoC;AACpC,2CAAyB;AAEzB,gCAAgC;AAChC,wDAagC;AAZ9B,kHAAA,iBAAiB,OAAA;AAGjB,0BAA0B;AAC1B,kHAAA,iBAAiB,OAAA;AACjB,uHAAA,sBAAsB,OAAA;AACtB,yHAAA,wBAAwB,OAAA;AACxB,0BAA0B;AAC1B,0GAAA,SAAS,OAAA;AACT,8GAAA,aAAa,OAAA;AACb,gHAAA,eAAe,OAAA;AACf,gHAAA,eAAe,OAAA;AAGjB,6BAA6B;AAC7B,gEAA6D;AAApD,kHAAA,cAAc,OAAA;AAQvB,4DAA4D;AAC5D,oEAAiE;AAAxD,sHAAA,gBAAgB,OAAA;AAQzB,mCAAmC;AACnC,qCAKmB;AAJjB,iGAAA,MAAM,OAAA;AACN,qHAAA,0BAA0B,OAAA;AAK5B,sEAAsE;AACtE,iCAQiB;AAPf,uGAAA,cAAc,OAAA;AACd,4GAAA,mBAAmB,OAAA;AACnB,6GAAA,oBAAoB,OAAA;AAOtB,wEAAwE;AACxE,qCAMmB;AALjB,yGAAA,cAAc,OAAA;AACd,iHAAA,sBAAsB,OAAA;AACtB,kHAAA,uBAAuB,OAAA;AAKzB,oEAAoE;AACpE,+BAWgB;AAVd,qGAAA,aAAa,OAAA;AACb,0GAAA,kBAAkB,OAAA;AAClB,8GAAA,sBAAsB,OAAA;AACtB,2GAAA,mBAAmB,OAAA"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Auth-Type Satisfaction Check
3
+ *
4
+ * Pure comparison used by the delegation-enforcement gate (security fix:
5
+ * consent-approve auth-gate, 2026-07-29, Task B3) to decide whether a
6
+ * delegation's authorization type satisfies a tool's required authorization
7
+ * type.
8
+ *
9
+ * Background: a gated MCP tool call is authorized by presenting a
10
+ * delegation. A bug let a delegation of ANY auth type satisfy a tool that
11
+ * requires a specific type — e.g. an anonymous consent-only (`none`)
12
+ * delegation wrongly satisfied a `password`-gated tool, because call-time
13
+ * enforcement accepted any present delegation without checking its
14
+ * `authorization.type`. This module implements the comparison that closes
15
+ * that gap. Wiring it into the enforcement sites (`agent.ts`,
16
+ * `tool-context-builder.ts`) is a later task (B3) — this module is
17
+ * intentionally standalone and unused by any gate yet.
18
+ *
19
+ * Decision (locked by product owner, 2026-07-29): STRICT NORMALIZED
20
+ * EQUALITY. A delegation type satisfies a required type iff, after folding
21
+ * deprecated aliases, they are equal. There is no "stronger satisfies
22
+ * weaker" lattice — `oauth`/`oauth2` and `password` are NOT interchangeable,
23
+ * and a `password` delegation does NOT satisfy a `none`-gated tool (or vice
24
+ * versa).
25
+ *
26
+ * @module @kya-os/mcp-i-runtime/services/auth-type-satisfies
27
+ */
28
+ /**
29
+ * Fold deprecated authorization-type aliases to their canonical form and
30
+ * normalize casing/whitespace.
31
+ *
32
+ * Alias rules mirror `normalizeAuthorizationType` in
33
+ * `packages/contracts/src/tool-protection/index.ts` (~774): `oauth` folds to
34
+ * `oauth2`, `credential` folds to `verifiable_credential`. That function
35
+ * operates on a full `AuthorizationRequirement` object and emits a
36
+ * deprecation warning on every call; this is a bare-string equivalent for
37
+ * use at the enforcement gate, where only the stored/required type strings
38
+ * — not the full requirement object — are available, and where a warning
39
+ * log on every tool call would be noise. (Not reusing the alias mapping
40
+ * directly from `@kya-os/contracts` here — it is not exposed as a
41
+ * standalone string-keyed map, only baked into that function's control
42
+ * flow — so the two rules are mirrored inline per the task's fallback
43
+ * guidance.)
44
+ *
45
+ * Canonical types (`AUTHORIZATION_TYPES`, contracts/src/tool-protection/index.ts
46
+ * ~88-106) are stored as lowercase string consts (e.g. "password", "oauth2",
47
+ * "none"), so normalization here only needs to trim and lowercase for
48
+ * defensive consistency — it does not need to handle differently-cased
49
+ * input from any known caller today.
50
+ *
51
+ * @param type - Raw authorization type string, or nullish if unknown/missing.
52
+ * @returns The normalized type string, or `undefined` if `type` is nullish or
53
+ * empty/whitespace-only after trimming.
54
+ */
55
+ export declare function normalizeAuthType(type: string | undefined | null): string | undefined;
56
+ /**
57
+ * Decide whether a delegation's authorization type satisfies a tool's
58
+ * required authorization type.
59
+ *
60
+ * Strict normalized equality (locked decision, see module docs above): both
61
+ * types are normalized (alias-folded, trimmed, lowercased) and then compared
62
+ * for exact equality. There is no cross-type satisfaction — a `password`
63
+ * delegation does NOT satisfy an `oauth2`-gated tool, and (by the same
64
+ * strict rule) does NOT satisfy a `none`-gated tool either.
65
+ *
66
+ * Note on `none`-required tools: per strict equality, only a `none`
67
+ * delegation satisfies a `none` requirement. In practice, a tool requiring
68
+ * `none` (consent-only) is not expected to reach this call today — it is
69
+ * rejected earlier, before the delegation-presence gate, by
70
+ * `ConsentOnlyModeError` (see `provider-resolver.ts`) — so this function is
71
+ * expected to be invoked only for TYPED requirements (`password`, `oauth2`,
72
+ * `apikey`, etc.). Strict equality is still implemented faithfully for
73
+ * `none` in case that assumption ever changes.
74
+ *
75
+ * Fail-safe rules (both nullish cases return `false`, never `true`):
76
+ * - If `delegationType` is nullish (missing on a legacy stored record that
77
+ * predates persisting `authorizationType`, or simply absent), this
78
+ * returns `false` regardless of `requiredType` — an unknown/unrecorded
79
+ * delegation type never satisfies a typed requirement.
80
+ * - If `requiredType` is nullish (or normalizes to empty), there is no
81
+ * requirement to compare against. Callers are not expected to invoke this
82
+ * with a nullish `requiredType` (a tool with no authorization requirement
83
+ * doesn't reach this gate), but this fails safe to `false` rather than
84
+ * treating "no requirement" as automatically satisfied.
85
+ *
86
+ * @param delegationType - The delegation's stored/asserted authorization
87
+ * type (e.g. from `getDelegationFromStorage`), or nullish if unknown.
88
+ * @param requiredType - The tool's required authorization type (e.g.
89
+ * `protection.authorization.type`), or nullish.
90
+ * @returns `true` iff both types are present and equal after normalization.
91
+ */
92
+ export declare function authTypeSatisfies(delegationType: string | undefined | null, requiredType: string | undefined | null): boolean;
93
+ /**
94
+ * The normalized authorization types the mint side can actually produce today.
95
+ *
96
+ * Every delegation is minted with one of these three:
97
+ * - `password` — the credential clickwrap, which rewrites `provider_type` to
98
+ * PASSWORD for EVERY credential provider (`consent.service.ts`);
99
+ * - `oauth2` — the OAuth callback, which persists it as a literal;
100
+ * - `none` — the pure consent-only branch.
101
+ *
102
+ * This is deliberately about what is MINTED, not what is declarable: the
103
+ * `AUTHORIZATION_TYPES` contract also allows `mdl`, `idv`,
104
+ * `verifiable_credential`, `webauthn` and `siwe`.
105
+ */
106
+ export declare const MINTABLE_AUTH_TYPES: ReadonlySet<string>;
107
+ /**
108
+ * Whether a tool's required authorization type is one that no mint can ever
109
+ * produce — meaning the delegation gate can never be satisfied and the tool
110
+ * will re-challenge forever rather than once.
111
+ *
112
+ * Under strict normalized equality (the locked decision), a requirement
113
+ * outside {@link MINTABLE_AUTH_TYPES} is unsatisfiable by construction: no
114
+ * delegation carrying such a type is ever written, so `authTypeSatisfies`
115
+ * cannot return true for it. Before the auth-type gate existed these tools
116
+ * authorized on mere delegation presence, so this is a behaviour change that
117
+ * presents to a user as an inexplicable auth loop.
118
+ *
119
+ * This exists purely so the enforcement gates can SAY so in their logs. It
120
+ * makes no authorization decision and must never be used to relax one —
121
+ * treating "unsatisfiable" as "allow" would reopen exactly the bypass the
122
+ * gate closes.
123
+ *
124
+ * `apikey` is intentionally NOT special-cased here: api-key tools are
125
+ * resolved by a separate vault branch that returns before either delegation
126
+ * gate, so this predicate is never consulted for them.
127
+ *
128
+ * @param requiredType - The tool's required authorization type.
129
+ * @returns `true` if the requirement can never be met by any minted
130
+ * delegation. Nullish/unknown input returns `false` — absence of a
131
+ * requirement is not an unsatisfiable requirement.
132
+ */
133
+ export declare function isUnsatisfiableAuthType(requiredType: string | undefined | null): boolean;
134
+ //# sourceMappingURL=auth-type-satisfies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-type-satisfies.d.ts","sourceRoot":"","sources":["../../src/services/auth-type-satisfies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAC9B,MAAM,GAAG,SAAS,CAmBpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EACzC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GACtC,OAAO,CAgBT;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAIlD,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GACtC,OAAO,CAMT"}
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ /**
3
+ * Auth-Type Satisfaction Check
4
+ *
5
+ * Pure comparison used by the delegation-enforcement gate (security fix:
6
+ * consent-approve auth-gate, 2026-07-29, Task B3) to decide whether a
7
+ * delegation's authorization type satisfies a tool's required authorization
8
+ * type.
9
+ *
10
+ * Background: a gated MCP tool call is authorized by presenting a
11
+ * delegation. A bug let a delegation of ANY auth type satisfy a tool that
12
+ * requires a specific type — e.g. an anonymous consent-only (`none`)
13
+ * delegation wrongly satisfied a `password`-gated tool, because call-time
14
+ * enforcement accepted any present delegation without checking its
15
+ * `authorization.type`. This module implements the comparison that closes
16
+ * that gap. Wiring it into the enforcement sites (`agent.ts`,
17
+ * `tool-context-builder.ts`) is a later task (B3) — this module is
18
+ * intentionally standalone and unused by any gate yet.
19
+ *
20
+ * Decision (locked by product owner, 2026-07-29): STRICT NORMALIZED
21
+ * EQUALITY. A delegation type satisfies a required type iff, after folding
22
+ * deprecated aliases, they are equal. There is no "stronger satisfies
23
+ * weaker" lattice — `oauth`/`oauth2` and `password` are NOT interchangeable,
24
+ * and a `password` delegation does NOT satisfy a `none`-gated tool (or vice
25
+ * versa).
26
+ *
27
+ * @module @kya-os/mcp-i-runtime/services/auth-type-satisfies
28
+ */
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.MINTABLE_AUTH_TYPES = void 0;
31
+ exports.normalizeAuthType = normalizeAuthType;
32
+ exports.authTypeSatisfies = authTypeSatisfies;
33
+ exports.isUnsatisfiableAuthType = isUnsatisfiableAuthType;
34
+ /**
35
+ * Fold deprecated authorization-type aliases to their canonical form and
36
+ * normalize casing/whitespace.
37
+ *
38
+ * Alias rules mirror `normalizeAuthorizationType` in
39
+ * `packages/contracts/src/tool-protection/index.ts` (~774): `oauth` folds to
40
+ * `oauth2`, `credential` folds to `verifiable_credential`. That function
41
+ * operates on a full `AuthorizationRequirement` object and emits a
42
+ * deprecation warning on every call; this is a bare-string equivalent for
43
+ * use at the enforcement gate, where only the stored/required type strings
44
+ * — not the full requirement object — are available, and where a warning
45
+ * log on every tool call would be noise. (Not reusing the alias mapping
46
+ * directly from `@kya-os/contracts` here — it is not exposed as a
47
+ * standalone string-keyed map, only baked into that function's control
48
+ * flow — so the two rules are mirrored inline per the task's fallback
49
+ * guidance.)
50
+ *
51
+ * Canonical types (`AUTHORIZATION_TYPES`, contracts/src/tool-protection/index.ts
52
+ * ~88-106) are stored as lowercase string consts (e.g. "password", "oauth2",
53
+ * "none"), so normalization here only needs to trim and lowercase for
54
+ * defensive consistency — it does not need to handle differently-cased
55
+ * input from any known caller today.
56
+ *
57
+ * @param type - Raw authorization type string, or nullish if unknown/missing.
58
+ * @returns The normalized type string, or `undefined` if `type` is nullish or
59
+ * empty/whitespace-only after trimming.
60
+ */
61
+ function normalizeAuthType(type) {
62
+ if (type === undefined || type === null) {
63
+ return undefined;
64
+ }
65
+ const trimmed = type.trim().toLowerCase();
66
+ if (trimmed === "") {
67
+ return undefined;
68
+ }
69
+ // Deprecated alias -> canonical (mirrors normalizeAuthorizationType).
70
+ if (trimmed === "oauth") {
71
+ return "oauth2";
72
+ }
73
+ if (trimmed === "credential") {
74
+ return "verifiable_credential";
75
+ }
76
+ return trimmed;
77
+ }
78
+ /**
79
+ * Decide whether a delegation's authorization type satisfies a tool's
80
+ * required authorization type.
81
+ *
82
+ * Strict normalized equality (locked decision, see module docs above): both
83
+ * types are normalized (alias-folded, trimmed, lowercased) and then compared
84
+ * for exact equality. There is no cross-type satisfaction — a `password`
85
+ * delegation does NOT satisfy an `oauth2`-gated tool, and (by the same
86
+ * strict rule) does NOT satisfy a `none`-gated tool either.
87
+ *
88
+ * Note on `none`-required tools: per strict equality, only a `none`
89
+ * delegation satisfies a `none` requirement. In practice, a tool requiring
90
+ * `none` (consent-only) is not expected to reach this call today — it is
91
+ * rejected earlier, before the delegation-presence gate, by
92
+ * `ConsentOnlyModeError` (see `provider-resolver.ts`) — so this function is
93
+ * expected to be invoked only for TYPED requirements (`password`, `oauth2`,
94
+ * `apikey`, etc.). Strict equality is still implemented faithfully for
95
+ * `none` in case that assumption ever changes.
96
+ *
97
+ * Fail-safe rules (both nullish cases return `false`, never `true`):
98
+ * - If `delegationType` is nullish (missing on a legacy stored record that
99
+ * predates persisting `authorizationType`, or simply absent), this
100
+ * returns `false` regardless of `requiredType` — an unknown/unrecorded
101
+ * delegation type never satisfies a typed requirement.
102
+ * - If `requiredType` is nullish (or normalizes to empty), there is no
103
+ * requirement to compare against. Callers are not expected to invoke this
104
+ * with a nullish `requiredType` (a tool with no authorization requirement
105
+ * doesn't reach this gate), but this fails safe to `false` rather than
106
+ * treating "no requirement" as automatically satisfied.
107
+ *
108
+ * @param delegationType - The delegation's stored/asserted authorization
109
+ * type (e.g. from `getDelegationFromStorage`), or nullish if unknown.
110
+ * @param requiredType - The tool's required authorization type (e.g.
111
+ * `protection.authorization.type`), or nullish.
112
+ * @returns `true` iff both types are present and equal after normalization.
113
+ */
114
+ function authTypeSatisfies(delegationType, requiredType) {
115
+ const normalizedDelegationType = normalizeAuthType(delegationType);
116
+ if (normalizedDelegationType === undefined) {
117
+ // Fail-safe: an unknown/missing delegation type never satisfies a
118
+ // requirement, typed or not.
119
+ return false;
120
+ }
121
+ const normalizedRequiredType = normalizeAuthType(requiredType);
122
+ if (normalizedRequiredType === undefined) {
123
+ // Fail-safe: no requirement to satisfy is not treated as "anything
124
+ // satisfies it".
125
+ return false;
126
+ }
127
+ return normalizedDelegationType === normalizedRequiredType;
128
+ }
129
+ /**
130
+ * The normalized authorization types the mint side can actually produce today.
131
+ *
132
+ * Every delegation is minted with one of these three:
133
+ * - `password` — the credential clickwrap, which rewrites `provider_type` to
134
+ * PASSWORD for EVERY credential provider (`consent.service.ts`);
135
+ * - `oauth2` — the OAuth callback, which persists it as a literal;
136
+ * - `none` — the pure consent-only branch.
137
+ *
138
+ * This is deliberately about what is MINTED, not what is declarable: the
139
+ * `AUTHORIZATION_TYPES` contract also allows `mdl`, `idv`,
140
+ * `verifiable_credential`, `webauthn` and `siwe`.
141
+ */
142
+ exports.MINTABLE_AUTH_TYPES = new Set([
143
+ "password",
144
+ "oauth2",
145
+ "none",
146
+ ]);
147
+ /**
148
+ * Whether a tool's required authorization type is one that no mint can ever
149
+ * produce — meaning the delegation gate can never be satisfied and the tool
150
+ * will re-challenge forever rather than once.
151
+ *
152
+ * Under strict normalized equality (the locked decision), a requirement
153
+ * outside {@link MINTABLE_AUTH_TYPES} is unsatisfiable by construction: no
154
+ * delegation carrying such a type is ever written, so `authTypeSatisfies`
155
+ * cannot return true for it. Before the auth-type gate existed these tools
156
+ * authorized on mere delegation presence, so this is a behaviour change that
157
+ * presents to a user as an inexplicable auth loop.
158
+ *
159
+ * This exists purely so the enforcement gates can SAY so in their logs. It
160
+ * makes no authorization decision and must never be used to relax one —
161
+ * treating "unsatisfiable" as "allow" would reopen exactly the bypass the
162
+ * gate closes.
163
+ *
164
+ * `apikey` is intentionally NOT special-cased here: api-key tools are
165
+ * resolved by a separate vault branch that returns before either delegation
166
+ * gate, so this predicate is never consulted for them.
167
+ *
168
+ * @param requiredType - The tool's required authorization type.
169
+ * @returns `true` if the requirement can never be met by any minted
170
+ * delegation. Nullish/unknown input returns `false` — absence of a
171
+ * requirement is not an unsatisfiable requirement.
172
+ */
173
+ function isUnsatisfiableAuthType(requiredType) {
174
+ const normalized = normalizeAuthType(requiredType);
175
+ if (normalized === undefined) {
176
+ return false;
177
+ }
178
+ return !exports.MINTABLE_AUTH_TYPES.has(normalized);
179
+ }
180
+ //# sourceMappingURL=auth-type-satisfies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-type-satisfies.js","sourceRoot":"","sources":["../../src/services/auth-type-satisfies.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;AA6BH,8CAqBC;AAsCD,8CAmBC;AA+CD,0DAQC;AAhKD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,iBAAiB,CAC/B,IAA+B;IAE/B,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC1C,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,sEAAsE;IACtE,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACxB,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,OAAO,KAAK,YAAY,EAAE,CAAC;QAC7B,OAAO,uBAAuB,CAAC;IACjC,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,SAAgB,iBAAiB,CAC/B,cAAyC,EACzC,YAAuC;IAEvC,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACnE,IAAI,wBAAwB,KAAK,SAAS,EAAE,CAAC;QAC3C,kEAAkE;QAClE,6BAA6B;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC/D,IAAI,sBAAsB,KAAK,SAAS,EAAE,CAAC;QACzC,mEAAmE;QACnE,iBAAiB;QACjB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,wBAAwB,KAAK,sBAAsB,CAAC;AAC7D,CAAC;AAED;;;;;;;;;;;;GAYG;AACU,QAAA,mBAAmB,GAAwB,IAAI,GAAG,CAAC;IAC9D,UAAU;IACV,QAAQ;IACR,MAAM;CACP,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,uBAAuB,CACrC,YAAuC;IAEvC,MAAM,UAAU,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC;IACnD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CAAC,2BAAmB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC9C,CAAC"}
@@ -44,9 +44,14 @@ export declare class ToolContextBuilder {
44
44
  * @param sessionId - Session ID (optional)
45
45
  * @param delegationToken - Delegation token (optional)
46
46
  * @param toolProtection - Tool protection configuration (optional)
47
+ * @param delegationAuthorizationType - The stored authorization type of the
48
+ * presented delegation (from `getDelegationFromStorage`), or undefined for
49
+ * legacy records that predate persisting it. Used by the delegation-only
50
+ * fallback below to reject a delegation whose type does not satisfy the
51
+ * tool's required type (security fix: consent-approve auth-gate, Task B3).
47
52
  * @returns Tool execution context or undefined if not needed
48
53
  */
49
- buildContext(toolName: string, userDid: string | undefined, sessionId: string | undefined, delegationToken: string | undefined, toolProtection: ToolProtection | null): Promise<ToolExecutionContext | undefined>;
54
+ buildContext(toolName: string, userDid: string | undefined, sessionId: string | undefined, delegationToken: string | undefined, toolProtection: ToolProtection | null, delegationAuthorizationType?: string): Promise<ToolExecutionContext | undefined>;
50
55
  /**
51
56
  * Build authentication headers based on token usage metadata (CRED-003)
52
57
  *
@@ -1 +1 @@
1
- {"version":3,"file":"tool-context-builder.d.ts","sourceRoot":"","sources":["../../src/services/tool-context-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAO/D,MAAM,WAAW,wBAAwB;IACvC,4DAA4D;IAC5D,aAAa,EAAE,gBAAgB,CAAC;IAEhC,gEAAgE;IAChE,aAAa,EAAE,kBAAkB,CAAC;IAElC,gEAAgE;IAChE,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAElB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACpD;AAED;;;;;;GAMG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAEZ;gBAEU,MAAM,EAAE,wBAAwB;IAU5C;;;;;;;;;OASG;IACG,YAAY,CAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,cAAc,EAAE,cAAc,GAAG,IAAI,GACpC,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IAwH5C;;;;;;;;;;;;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AAO,CAAC,gBAAgB;IA2CxB;;;;;;;OAOG;YACW,eAAe;CAsB9B"}
@@ -14,6 +14,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.ToolContextBuilder = void 0;
15
15
  const oauth_required_error_js_1 = require("../types/oauth-required-error.js");
16
16
  const provider_resolver_js_1 = require("./provider-resolver.js");
17
+ const auth_type_satisfies_js_1 = require("./auth-type-satisfies.js");
17
18
  /**
18
19
  * Builder for tool execution context
19
20
  *
@@ -40,9 +41,14 @@ class ToolContextBuilder {
40
41
  * @param sessionId - Session ID (optional)
41
42
  * @param delegationToken - Delegation token (optional)
42
43
  * @param toolProtection - Tool protection configuration (optional)
44
+ * @param delegationAuthorizationType - The stored authorization type of the
45
+ * presented delegation (from `getDelegationFromStorage`), or undefined for
46
+ * legacy records that predate persisting it. Used by the delegation-only
47
+ * fallback below to reject a delegation whose type does not satisfy the
48
+ * tool's required type (security fix: consent-approve auth-gate, Task B3).
43
49
  * @returns Tool execution context or undefined if not needed
44
50
  */
45
- async buildContext(toolName, userDid, sessionId, delegationToken, toolProtection) {
51
+ async buildContext(toolName, userDid, sessionId, delegationToken, toolProtection, delegationAuthorizationType) {
46
52
  // Only build context if tool requires OAuth/credentials
47
53
  if (!toolProtection?.requiredScopes?.length || !userDid) {
48
54
  return undefined;
@@ -80,7 +86,22 @@ class ToolContextBuilder {
80
86
  // IDP token not available - check if delegation token exists
81
87
  // If delegation exists, tool can still execute without IDP token
82
88
  // (the tool handler should check for idpToken if it needs external API access)
83
- if (delegationToken) {
89
+ //
90
+ // SECURITY (consent-approve auth-gate, Task B3): a delegation only
91
+ // authorizes this tool if its OWN authorization type satisfies the tool's
92
+ // required type. Reaching this OAuth context builder means the tool is
93
+ // neither consent-only (`none`) nor password — those throw
94
+ // ConsentOnlyModeError / CredentialAuthModeError inside resolveProvider,
95
+ // BEFORE this point — so the effective requirement is OAuth. Fall back to
96
+ // "oauth2" only when the tool omits an explicit authorization.type (legacy
97
+ // oauthProvider-only config); this keeps such tools working while a
98
+ // mismatched delegation (e.g. an anonymous `none` consent-only delegation,
99
+ // or a legacy record with no persisted type → undefined) is rejected. On
100
+ // mismatch we do NOT return the delegation-only context; we fall through
101
+ // to OAuthRequiredError so the tool re-challenges.
102
+ const requiredAuthType = toolProtection.authorization?.type ?? "oauth2";
103
+ if (delegationToken &&
104
+ (0, auth_type_satisfies_js_1.authTypeSatisfies)(delegationAuthorizationType, requiredAuthType)) {
84
105
  this.config.logger("[ToolContextBuilder] IDP token not found, but delegation exists - returning minimal context", {
85
106
  toolName,
86
107
  userDid: userDid.substring(0, 20) + "...",
@@ -98,7 +119,31 @@ class ToolContextBuilder {
98
119
  delegationToken,
99
120
  };
100
121
  }
101
- // No delegation token either - throw OAuthRequiredError to trigger auth flow
122
+ if (delegationToken) {
123
+ // A delegation WAS presented but its authorization type does not satisfy
124
+ // the tool's required type — log and re-challenge instead of authorizing.
125
+ this.config.logger("[ToolContextBuilder] Delegation present but auth-type does not satisfy tool requirement - re-challenging", {
126
+ toolName,
127
+ userDid: userDid.substring(0, 20) + "...",
128
+ provider,
129
+ requiredAuthType,
130
+ delegationAuthorizationType: delegationAuthorizationType ?? null,
131
+ });
132
+ // Distinguish "re-authenticate and this resolves" from "no mint can
133
+ // ever satisfy this, so the user is in an infinite loop". Without
134
+ // this, an unsatisfiable requirement is indistinguishable from a
135
+ // normal re-challenge in the logs and presents as an inexplicable
136
+ // auth loop. Diagnostic only — the decision above is unchanged.
137
+ if ((0, auth_type_satisfies_js_1.isUnsatisfiableAuthType)(requiredAuthType)) {
138
+ this.config.logger("[ToolContextBuilder] MISCONFIGURATION: tool requires an authorization type no delegation mint can produce - this tool will re-challenge forever", {
139
+ toolName,
140
+ requiredAuthType,
141
+ mintableAuthTypes: [...auth_type_satisfies_js_1.MINTABLE_AUTH_TYPES],
142
+ hint: "Set the tool's authorization.type to one of the mintable types, or add mint support for the required type.",
143
+ });
144
+ }
145
+ }
146
+ // No (satisfying) delegation token - throw OAuthRequiredError to trigger auth flow
102
147
  this.config.logger("[ToolContextBuilder] Token not available, throwing OAuthRequiredError", {
103
148
  toolName,
104
149
  userDid: userDid.substring(0, 20) + "...",
@@ -1 +1 @@
1
- {"version":3,"file":"tool-context-builder.js","sourceRoot":"","sources":["../../src/services/tool-context-builder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAQH,8EAAsE;AACtE,iEAGgC;AAmBhC;;;;;;GAMG;AACH,MAAa,kBAAkB;IACrB,MAAM,CAEZ;IAEF,YAAY,MAAgC;QAC1C,IAAI,CAAC,MAAM,GAAG;YACZ,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;SACpC,CAAC;IACJ,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,YAAY,CAChB,QAAgB,EAChB,OAA2B,EAC3B,SAA6B,EAC7B,eAAmC,EACnC,cAAqC;QAErC,wDAAwD;QACxD,IAAI,CAAC,cAAc,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;YACxD,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,mDAAmD;QACnD,oEAAoE;QACpE,IAAI,QAAgB,CAAC;QACrB,IAAI,CAAC;YACH,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;QACxD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,kEAAkE;YAClE,8EAA8E;YAC9E,IACE,KAAK,YAAY,2CAAoB;gBACrC,KAAK,YAAY,8CAAuB,EACxC,CAAC;gBACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAChB,8DAA8D,EAC9D;oBACE,QAAQ;oBACR,SAAS,EAAE,KAAK,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AAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,iDAAiD,EAAE;gBACpE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC7D,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS;aACjC,CAAC,CAAC;YACH,MAAM,KAAK,CAAC,CAAC,gCAAgC;QAC/C,CAAC;IACH,CAAC;CACF;AA3OD,gDA2OC"}
1
+ {"version":3,"file":"tool-context-builder.js","sourceRoot":"","sources":["../../src/services/tool-context-builder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAQH,8EAAsE;AACtE,iEAGgC;AAChC,qEAIkC;AAmBlC;;;;;;GAMG;AACH,MAAa,kBAAkB;IACrB,MAAM,CAEZ;IAEF,YAAY,MAAgC;QAC1C,IAAI,CAAC,MAAM,GAAG;YACZ,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;YACzC,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;SACpC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,YAAY,CAChB,QAAgB,EAChB,OAA2B,EAC3B,SAA6B,EAC7B,eAAmC,EACnC,cAAqC,EACrC,2BAAoC;QAEpC,wDAAwD;QACxD,IAAI,CAAC,cAAc,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;YACxD,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,mDAAmD;QACnD,oEAAoE;QACpE,IAAI,QAAgB,CAAC;QACrB,IAAI,CAAC;YACH,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,cAAc,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CAAC,MAAM,CAAC,MAAM,CAAC,iDAAiD,EAAE;gBACpE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC7D,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS;aACjC,CAAC,CAAC;YACH,MAAM,KAAK,CAAC,CAAC,gCAAgC;QAC/C,CAAC;IACH,CAAC;CACF;AA1SD,gDA0SC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kya-os/mcp-i-runtime",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Shared product-runtime layer for the MCP-I framework (Node + Cloudflare adapters). Protocol types/values live in @kya-os/mcp (DIF).",
5
5
  "license": "MIT",
6
6
  "author": "Dylan Hobbs",
@@ -59,7 +59,7 @@
59
59
  "prepublishOnly": "npm run build && node ../create-mcpi-app/scripts/validate-no-workspace.js"
60
60
  },
61
61
  "dependencies": {
62
- "@kya-os/contracts": "^1.10.0",
62
+ "@kya-os/contracts": "^1.10.1",
63
63
  "@kya-os/mcp": "1.11.0",
64
64
  "jose": "^5.6.3",
65
65
  "json-canonicalize": "^2.0.0",
package/src/index.ts CHANGED
@@ -138,6 +138,17 @@ export { ToolContextBuilder } from "./services/tool-context-builder";
138
138
 
139
139
  export type { ToolContextBuilderConfig } from "./services/tool-context-builder";
140
140
 
141
+ // Auth-type satisfaction check (security fix: consent-approve auth-gate, Task B3)
142
+ // Consumed by the delegation-enforcement gates in agent.ts and
143
+ // tool-context-builder.ts to reject a delegation whose authorization type does
144
+ // not satisfy the tool's required type.
145
+ export {
146
+ authTypeSatisfies,
147
+ normalizeAuthType,
148
+ isUnsatisfiableAuthType,
149
+ MINTABLE_AUTH_TYPES,
150
+ } from "./services/auth-type-satisfies";
151
+
141
152
  // OAuth Provider Registry (Phase 2)
142
153
  export { OAuthProviderRegistry } from "./services/oauth-provider-registry";
143
154