@decionis/agentsafe 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +135 -20
- package/dist/Cli.js +20 -0
- package/dist/Cli.js.map +1 -1
- package/dist/Index.d.ts +22 -5
- package/dist/Index.d.ts.map +1 -1
- package/dist/Index.js +19 -2
- package/dist/Index.js.map +1 -1
- package/dist/TrustedExecutor.d.ts.map +1 -1
- package/dist/TrustedExecutor.js +1 -0
- package/dist/TrustedExecutor.js.map +1 -1
- package/dist/adapters/AdapterActionHandler.d.ts.map +1 -1
- package/dist/adapters/AdapterActionHandler.js +8 -4
- package/dist/adapters/AdapterActionHandler.js.map +1 -1
- package/dist/adapters/EffectAdapter.d.ts +6 -1
- package/dist/adapters/EffectAdapter.d.ts.map +1 -1
- package/dist/adapters/EffectAdapter.js +7 -1
- package/dist/adapters/EffectAdapter.js.map +1 -1
- package/dist/adapters/banking/CoreBankingHttpAdapter.d.ts.map +1 -1
- package/dist/adapters/banking/CoreBankingHttpAdapter.js +4 -4
- package/dist/adapters/banking/CoreBankingHttpAdapter.js.map +1 -1
- package/dist/adapters/cards/CardAuthorizationMatcher.d.ts +44 -0
- package/dist/adapters/cards/CardAuthorizationMatcher.d.ts.map +1 -0
- package/dist/adapters/cards/CardAuthorizationMatcher.js +39 -0
- package/dist/adapters/cards/CardAuthorizationMatcher.js.map +1 -0
- package/dist/adapters/cards/CardEffect.d.ts +52 -0
- package/dist/adapters/cards/CardEffect.d.ts.map +1 -0
- package/dist/adapters/cards/CardEffect.js +117 -0
- package/dist/adapters/cards/CardEffect.js.map +1 -0
- package/dist/adapters/cards/CardHandlers.d.ts +15 -0
- package/dist/adapters/cards/CardHandlers.d.ts.map +1 -0
- package/dist/adapters/cards/CardHandlers.js +26 -0
- package/dist/adapters/cards/CardHandlers.js.map +1 -0
- package/dist/adapters/cards/CardPurchase.d.ts +61 -0
- package/dist/adapters/cards/CardPurchase.d.ts.map +1 -0
- package/dist/adapters/cards/CardPurchase.js +116 -0
- package/dist/adapters/cards/CardPurchase.js.map +1 -0
- package/dist/adapters/cards/HeldCardGrants.d.ts +70 -0
- package/dist/adapters/cards/HeldCardGrants.d.ts.map +1 -0
- package/dist/adapters/cards/HeldCardGrants.js +79 -0
- package/dist/adapters/cards/HeldCardGrants.js.map +1 -0
- package/dist/adapters/cards/Pan.d.ts +17 -0
- package/dist/adapters/cards/Pan.d.ts.map +1 -0
- package/dist/adapters/cards/Pan.js +52 -0
- package/dist/adapters/cards/Pan.js.map +1 -0
- package/dist/adapters/mcp/McpGuard.d.ts +91 -0
- package/dist/adapters/mcp/McpGuard.d.ts.map +1 -0
- package/dist/adapters/mcp/McpGuard.js +147 -0
- package/dist/adapters/mcp/McpGuard.js.map +1 -0
- package/dist/adapters/mcp/McpIntentBinder.d.ts +54 -0
- package/dist/adapters/mcp/McpIntentBinder.d.ts.map +1 -0
- package/dist/adapters/mcp/McpIntentBinder.js +79 -0
- package/dist/adapters/mcp/McpIntentBinder.js.map +1 -0
- package/dist/adapters/mcp/McpInvocation.d.ts +55 -0
- package/dist/adapters/mcp/McpInvocation.d.ts.map +1 -0
- package/dist/adapters/mcp/McpInvocation.js +88 -0
- package/dist/adapters/mcp/McpInvocation.js.map +1 -0
- package/dist/audit/HashChain.d.ts +8 -2
- package/dist/audit/HashChain.d.ts.map +1 -1
- package/dist/audit/HashChain.js +14 -2
- package/dist/audit/HashChain.js.map +1 -1
- package/dist/boundary/BoundaryIdentity.d.ts +88 -0
- package/dist/boundary/BoundaryIdentity.d.ts.map +1 -0
- package/dist/boundary/BoundaryIdentity.js +126 -0
- package/dist/boundary/BoundaryIdentity.js.map +1 -0
- package/dist/cli/Commands.d.ts +1 -1
- package/dist/cli/Commands.d.ts.map +1 -1
- package/dist/cli/Commands.js +10 -0
- package/dist/cli/Commands.js.map +1 -1
- package/dist/cli/Edge.d.ts +4 -0
- package/dist/cli/Edge.d.ts.map +1 -0
- package/dist/cli/Edge.js +250 -0
- package/dist/cli/Edge.js.map +1 -0
- package/dist/cli/Help.d.ts.map +1 -1
- package/dist/cli/Help.js +9 -0
- package/dist/cli/Help.js.map +1 -1
- package/dist/cli/Host.d.ts +36 -0
- package/dist/cli/Host.d.ts.map +1 -0
- package/dist/cli/Host.js +247 -0
- package/dist/cli/Host.js.map +1 -0
- package/dist/cli/Identity.d.ts +47 -0
- package/dist/cli/Identity.d.ts.map +1 -0
- package/dist/cli/Identity.js +145 -0
- package/dist/cli/Identity.js.map +1 -0
- package/dist/cli/TcpBrokerCli.d.ts +4 -0
- package/dist/cli/TcpBrokerCli.d.ts.map +1 -0
- package/dist/cli/TcpBrokerCli.js +93 -0
- package/dist/cli/TcpBrokerCli.js.map +1 -0
- package/dist/cli/TcpClientCli.d.ts +16 -0
- package/dist/cli/TcpClientCli.d.ts.map +1 -0
- package/dist/cli/TcpClientCli.js +175 -0
- package/dist/cli/TcpClientCli.js.map +1 -0
- package/dist/cli/TestCommand.d.ts +8 -0
- package/dist/cli/TestCommand.d.ts.map +1 -1
- package/dist/cli/TestCommand.js +25 -5
- package/dist/cli/TestCommand.js.map +1 -1
- package/dist/config/ConfigKeys.d.ts +2 -2
- package/dist/config/ConfigKeys.d.ts.map +1 -1
- package/dist/config/ConfigKeys.js +19 -0
- package/dist/config/ConfigKeys.js.map +1 -1
- package/dist/config/ExecutorConfig.d.ts +62 -0
- package/dist/config/ExecutorConfig.d.ts.map +1 -1
- package/dist/config/ExecutorConfig.js +124 -0
- package/dist/config/ExecutorConfig.js.map +1 -1
- package/dist/edge/EdgeLicence.d.ts +25 -0
- package/dist/edge/EdgeLicence.d.ts.map +1 -0
- package/dist/edge/EdgeLicence.js +42 -0
- package/dist/edge/EdgeLicence.js.map +1 -0
- package/dist/edge/EdgeReplay.d.ts +45 -0
- package/dist/edge/EdgeReplay.d.ts.map +1 -0
- package/dist/edge/EdgeReplay.js +69 -0
- package/dist/edge/EdgeReplay.js.map +1 -0
- package/dist/edge/Entitlement.d.ts +57 -0
- package/dist/edge/Entitlement.d.ts.map +1 -0
- package/dist/edge/Entitlement.js +139 -0
- package/dist/edge/Entitlement.js.map +1 -0
- package/dist/edge/EntitlementEvaluation.d.ts +66 -0
- package/dist/edge/EntitlementEvaluation.d.ts.map +1 -0
- package/dist/edge/EntitlementEvaluation.js +74 -0
- package/dist/edge/EntitlementEvaluation.js.map +1 -0
- package/dist/edge/UsageCount.d.ts +40 -0
- package/dist/edge/UsageCount.d.ts.map +1 -0
- package/dist/edge/UsageCount.js +140 -0
- package/dist/edge/UsageCount.js.map +1 -0
- package/dist/edge/UsageKeyRegistration.d.ts +34 -0
- package/dist/edge/UsageKeyRegistration.d.ts.map +1 -0
- package/dist/edge/UsageKeyRegistration.js +74 -0
- package/dist/edge/UsageKeyRegistration.js.map +1 -0
- package/dist/edge/UsageMeter.d.ts +89 -0
- package/dist/edge/UsageMeter.d.ts.map +1 -0
- package/dist/edge/UsageMeter.js +275 -0
- package/dist/edge/UsageMeter.js.map +1 -0
- package/dist/edge/UsagePeriod.d.ts +23 -0
- package/dist/edge/UsagePeriod.d.ts.map +1 -0
- package/dist/edge/UsagePeriod.js +31 -0
- package/dist/edge/UsagePeriod.js.map +1 -0
- package/dist/edge/UsageReport.d.ts +92 -0
- package/dist/edge/UsageReport.d.ts.map +1 -0
- package/dist/edge/UsageReport.js +153 -0
- package/dist/edge/UsageReport.js.map +1 -0
- package/dist/edge/UsageTally.d.ts +63 -0
- package/dist/edge/UsageTally.d.ts.map +1 -0
- package/dist/edge/UsageTally.js +89 -0
- package/dist/edge/UsageTally.js.map +1 -0
- package/dist/egress/EgressError.d.ts +7 -1
- package/dist/egress/EgressError.d.ts.map +1 -1
- package/dist/egress/EgressError.js.map +1 -1
- package/dist/egress/EgressPolicy.d.ts +16 -3
- package/dist/egress/EgressPolicy.d.ts.map +1 -1
- package/dist/egress/EgressPolicy.js +33 -3
- package/dist/egress/EgressPolicy.js.map +1 -1
- package/dist/egress/GuardedFetch.d.ts +38 -1
- package/dist/egress/GuardedFetch.d.ts.map +1 -1
- package/dist/egress/GuardedFetch.js +52 -7
- package/dist/egress/GuardedFetch.js.map +1 -1
- package/dist/egress/TcpClient.d.ts +103 -0
- package/dist/egress/TcpClient.d.ts.map +1 -0
- package/dist/egress/TcpClient.js +490 -0
- package/dist/egress/TcpClient.js.map +1 -0
- package/dist/egress/TcpControlClient.d.ts +49 -0
- package/dist/egress/TcpControlClient.d.ts.map +1 -0
- package/dist/egress/TcpControlClient.js +186 -0
- package/dist/egress/TcpControlClient.js.map +1 -0
- package/dist/gateway/AuthorityAttacks.d.ts +39 -0
- package/dist/gateway/AuthorityAttacks.d.ts.map +1 -0
- package/dist/gateway/AuthorityAttacks.js +158 -0
- package/dist/gateway/AuthorityAttacks.js.map +1 -0
- package/dist/gateway/ForwardHandler.d.ts.map +1 -1
- package/dist/gateway/ForwardHandler.js +7 -4
- package/dist/gateway/ForwardHandler.js.map +1 -1
- package/dist/gateway/Gateway.d.ts +197 -10
- package/dist/gateway/Gateway.d.ts.map +1 -1
- package/dist/gateway/Gateway.js +524 -63
- package/dist/gateway/Gateway.js.map +1 -1
- package/dist/gateway/GatewayConfig.d.ts +78 -0
- package/dist/gateway/GatewayConfig.d.ts.map +1 -1
- package/dist/gateway/GatewayConfig.js +167 -2
- package/dist/gateway/GatewayConfig.js.map +1 -1
- package/dist/gateway/GatewayReport.d.ts +31 -1
- package/dist/gateway/GatewayReport.d.ts.map +1 -1
- package/dist/gateway/GatewayReport.js +12 -0
- package/dist/gateway/GatewayReport.js.map +1 -1
- package/dist/gateway/InterceptedRequest.d.ts +9 -2
- package/dist/gateway/InterceptedRequest.d.ts.map +1 -1
- package/dist/gateway/InterceptedRequest.js +41 -9
- package/dist/gateway/InterceptedRequest.js.map +1 -1
- package/dist/gateway/RateLimit.d.ts +29 -0
- package/dist/gateway/RateLimit.d.ts.map +1 -0
- package/dist/gateway/RateLimit.js +33 -0
- package/dist/gateway/RateLimit.js.map +1 -0
- package/dist/gateway/RefusalSampler.d.ts +28 -0
- package/dist/gateway/RefusalSampler.d.ts.map +1 -0
- package/dist/gateway/RefusalSampler.js +52 -0
- package/dist/gateway/RefusalSampler.js.map +1 -0
- package/dist/gateway/RouteTable.d.ts +3 -0
- package/dist/gateway/RouteTable.d.ts.map +1 -1
- package/dist/gateway/RouteTable.js +44 -7
- package/dist/gateway/RouteTable.js.map +1 -1
- package/dist/gateway/Upstream.d.ts +26 -0
- package/dist/gateway/Upstream.d.ts.map +1 -1
- package/dist/gateway/Upstream.js +41 -2
- package/dist/gateway/Upstream.js.map +1 -1
- package/dist/gateway/UpstreamProof.d.ts +235 -0
- package/dist/gateway/UpstreamProof.d.ts.map +1 -0
- package/dist/gateway/UpstreamProof.js +375 -0
- package/dist/gateway/UpstreamProof.js.map +1 -0
- package/dist/handlers/ForwardRequestHandler.d.ts +5 -1
- package/dist/handlers/ForwardRequestHandler.d.ts.map +1 -1
- package/dist/handlers/ForwardRequestHandler.js +12 -2
- package/dist/handlers/ForwardRequestHandler.js.map +1 -1
- package/dist/hosted/TenantHost.d.ts +180 -0
- package/dist/hosted/TenantHost.d.ts.map +1 -0
- package/dist/hosted/TenantHost.js +432 -0
- package/dist/hosted/TenantHost.js.map +1 -0
- package/dist/hosted/TenantRegistry.d.ts +73 -0
- package/dist/hosted/TenantRegistry.d.ts.map +1 -0
- package/dist/hosted/TenantRegistry.js +123 -0
- package/dist/hosted/TenantRegistry.js.map +1 -0
- package/dist/http/ExecutorHttpServer.d.ts +7 -0
- package/dist/http/ExecutorHttpServer.d.ts.map +1 -1
- package/dist/http/ExecutorHttpServer.js +30 -5
- package/dist/http/ExecutorHttpServer.js.map +1 -1
- package/dist/http/GatewayHttpServer.d.ts +55 -3
- package/dist/http/GatewayHttpServer.d.ts.map +1 -1
- package/dist/http/GatewayHttpServer.js +157 -17
- package/dist/http/GatewayHttpServer.js.map +1 -1
- package/dist/http/RedirectServer.d.ts +26 -0
- package/dist/http/RedirectServer.d.ts.map +1 -0
- package/dist/http/RedirectServer.js +62 -0
- package/dist/http/RedirectServer.js.map +1 -0
- package/dist/http/Routes.d.ts +17 -0
- package/dist/http/Routes.d.ts.map +1 -1
- package/dist/http/Routes.js +21 -0
- package/dist/http/Routes.js.map +1 -1
- package/dist/http/TcpBroker.d.ts +57 -0
- package/dist/http/TcpBroker.d.ts.map +1 -0
- package/dist/http/TcpBroker.js +299 -0
- package/dist/http/TcpBroker.js.map +1 -0
- package/dist/http/TcpHostRelay.d.ts +24 -0
- package/dist/http/TcpHostRelay.d.ts.map +1 -0
- package/dist/http/TcpHostRelay.js +194 -0
- package/dist/http/TcpHostRelay.js.map +1 -0
- package/dist/http/TcpRelayStreams.d.ts +24 -0
- package/dist/http/TcpRelayStreams.d.ts.map +1 -0
- package/dist/http/TcpRelayStreams.js +128 -0
- package/dist/http/TcpRelayStreams.js.map +1 -0
- package/dist/http/TlsListener.d.ts +3 -1
- package/dist/http/TlsListener.d.ts.map +1 -1
- package/dist/http/TlsListener.js +7 -2
- package/dist/http/TlsListener.js.map +1 -1
- package/dist/identity/PrincipalsFile.d.ts +3 -1
- package/dist/identity/PrincipalsFile.d.ts.map +1 -1
- package/dist/identity/PrincipalsFile.js +1 -0
- package/dist/identity/PrincipalsFile.js.map +1 -1
- package/dist/incident/Metrics.d.ts +2 -0
- package/dist/incident/Metrics.d.ts.map +1 -1
- package/dist/incident/Metrics.js +10 -0
- package/dist/incident/Metrics.js.map +1 -1
- package/dist/incident/SecurityEvents.d.ts +89 -0
- package/dist/incident/SecurityEvents.d.ts.map +1 -1
- package/dist/incident/SecurityEvents.js +93 -2
- package/dist/incident/SecurityEvents.js.map +1 -1
- package/dist/journal/ExecutionJournal.d.ts +27 -0
- package/dist/journal/ExecutionJournal.d.ts.map +1 -1
- package/dist/journal/ExecutionJournal.js +28 -0
- package/dist/journal/ExecutionJournal.js.map +1 -1
- package/dist/journal/FileExecutionJournal.d.ts +2 -1
- package/dist/journal/FileExecutionJournal.d.ts.map +1 -1
- package/dist/journal/FileExecutionJournal.js +4 -1
- package/dist/journal/FileExecutionJournal.js.map +1 -1
- package/dist/journal/InMemoryExecutionJournal.d.ts +2 -1
- package/dist/journal/InMemoryExecutionJournal.d.ts.map +1 -1
- package/dist/journal/InMemoryExecutionJournal.js +4 -1
- package/dist/journal/InMemoryExecutionJournal.js.map +1 -1
- package/dist/provenance/DockerProvenanceProvider.d.ts +23 -0
- package/dist/provenance/DockerProvenanceProvider.d.ts.map +1 -0
- package/dist/provenance/DockerProvenanceProvider.js +24 -0
- package/dist/provenance/DockerProvenanceProvider.js.map +1 -0
- package/dist/provenance/KubernetesProvenanceProvider.d.ts +17 -0
- package/dist/provenance/KubernetesProvenanceProvider.d.ts.map +1 -0
- package/dist/provenance/KubernetesProvenanceProvider.js +18 -0
- package/dist/provenance/KubernetesProvenanceProvider.js.map +1 -0
- package/dist/provenance/NoneProvenanceProvider.d.ts +15 -0
- package/dist/provenance/NoneProvenanceProvider.d.ts.map +1 -0
- package/dist/provenance/NoneProvenanceProvider.js +16 -0
- package/dist/provenance/NoneProvenanceProvider.js.map +1 -0
- package/dist/provenance/ProvenanceProvider.d.ts +94 -0
- package/dist/provenance/ProvenanceProvider.d.ts.map +1 -0
- package/dist/provenance/ProvenanceProvider.js +118 -0
- package/dist/provenance/ProvenanceProvider.js.map +1 -0
- package/dist/provenance/StaticProvenanceProvider.d.ts +18 -0
- package/dist/provenance/StaticProvenanceProvider.d.ts.map +1 -0
- package/dist/provenance/StaticProvenanceProvider.js +25 -0
- package/dist/provenance/StaticProvenanceProvider.js.map +1 -0
- package/dist/service/AuthorityClients.d.ts +8 -1
- package/dist/service/AuthorityClients.d.ts.map +1 -1
- package/dist/service/AuthorityClients.js +33 -5
- package/dist/service/AuthorityClients.js.map +1 -1
- package/dist/service/EdgeRuntime.d.ts +73 -0
- package/dist/service/EdgeRuntime.d.ts.map +1 -0
- package/dist/service/EdgeRuntime.js +209 -0
- package/dist/service/EdgeRuntime.js.map +1 -0
- package/dist/service/EscalationResolver.d.ts +82 -2
- package/dist/service/EscalationResolver.d.ts.map +1 -1
- package/dist/service/EscalationResolver.js +39 -3
- package/dist/service/EscalationResolver.js.map +1 -1
- package/dist/service/Requests.d.ts +28 -2
- package/dist/service/Requests.d.ts.map +1 -1
- package/dist/service/TrustedExecutorService.d.ts +71 -1
- package/dist/service/TrustedExecutorService.d.ts.map +1 -1
- package/dist/service/TrustedExecutorService.js +461 -27
- package/dist/service/TrustedExecutorService.js.map +1 -1
- package/dist/tcp/TcpWire.d.ts +18 -0
- package/dist/tcp/TcpWire.d.ts.map +1 -0
- package/dist/tcp/TcpWire.js +114 -0
- package/dist/tcp/TcpWire.js.map +1 -0
- package/dist/verify/VerifyAuditChain.d.ts +5 -0
- package/dist/verify/VerifyAuditChain.d.ts.map +1 -1
- package/dist/verify/VerifyAuditChain.js +20 -4
- package/dist/verify/VerifyAuditChain.js.map +1 -1
- package/package.json +7 -3
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { ActionRegistry, IntentCapture, PreDispatchRefusal, SafeExecutor, } from "@decionis/agent-safe-pipeline";
|
|
2
|
+
import { jcsDigest } from "../JcsDigest.js";
|
|
3
|
+
import { McpBindingError, bindMcpInvocation, bindingFor } from "./McpIntentBinder.js";
|
|
4
|
+
/**
|
|
5
|
+
* The authority boundary for MCP tool execution.
|
|
6
|
+
*
|
|
7
|
+
* MCP has already decided how the agent calls the tool. This decides whether
|
|
8
|
+
* this exact invocation may run, and it is the only thing between a selected
|
|
9
|
+
* tool and its effect:
|
|
10
|
+
*
|
|
11
|
+
* tool selected → arguments constructed → **guard** → intent →
|
|
12
|
+
* enforce-and-bind → authority → atomic claim → the tool runs, once
|
|
13
|
+
*
|
|
14
|
+
* It is not an MCP server, an MCP registry, or a replacement for MCP's own
|
|
15
|
+
* authentication. It holds no opinion about transports and depends on no MCP
|
|
16
|
+
* SDK; a server hands it an invocation and gets back a verdict and, when the
|
|
17
|
+
* verdict is ALLOW and the grant was claimed, a result.
|
|
18
|
+
*
|
|
19
|
+
* The property worth stating plainly: **arguments that change after the
|
|
20
|
+
* authority is issued invalidate it.** They are inside the canonical intent
|
|
21
|
+
* hash, so a changed argument is a different intent whose grant does not
|
|
22
|
+
* match; and independently, the handler recomputes their canonical digest
|
|
23
|
+
* immediately before the point of no return and refuses if it is not the one
|
|
24
|
+
* the intent bound. A tool therefore receives the arguments a policy saw, or
|
|
25
|
+
* receives nothing.
|
|
26
|
+
*/
|
|
27
|
+
export class McpGuard {
|
|
28
|
+
bindings;
|
|
29
|
+
tools;
|
|
30
|
+
held = new Map();
|
|
31
|
+
capture;
|
|
32
|
+
executor;
|
|
33
|
+
options;
|
|
34
|
+
constructor(options) {
|
|
35
|
+
this.options = options;
|
|
36
|
+
this.bindings = new Map(options.tools.map((tool) => [tool.binding.tool, tool.binding]));
|
|
37
|
+
this.tools = new Map(options.tools.map((tool) => [tool.binding.tool, tool]));
|
|
38
|
+
this.capture =
|
|
39
|
+
options.capture ?? new IntentCapture({ ...(options.audit && { audit: options.audit }) });
|
|
40
|
+
let registry = new ActionRegistry();
|
|
41
|
+
for (const tool of options.tools) {
|
|
42
|
+
registry = registry.register(tool.binding.action, {
|
|
43
|
+
parametersSchema: tool.binding.argumentsSchema,
|
|
44
|
+
execute: async ({ intent, parameters, dispatch }) => {
|
|
45
|
+
const held = this.held.get(intent.intent.intentId);
|
|
46
|
+
if (held === undefined)
|
|
47
|
+
throw new Error("MCP_INVOCATION_NOT_HELD");
|
|
48
|
+
// The point of no return is one line below. The tool is handed the
|
|
49
|
+
// parameters off the hash-bound intent, never a copy something else
|
|
50
|
+
// could have edited, and their canonical digest is compared here to
|
|
51
|
+
// the one binding recorded. Arguments that drifted between
|
|
52
|
+
// authorization and dispatch fail before the grant is spent.
|
|
53
|
+
if (jcsDigest(parameters) !== held.digest) {
|
|
54
|
+
throw new PreDispatchRefusal("MCP_ARGUMENTS_MISMATCH");
|
|
55
|
+
}
|
|
56
|
+
return await dispatch.run(async () => await held.tool.invoke(parameters));
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
this.executor = new SafeExecutor(registry.seal(), options.verifier, options.audit, {
|
|
61
|
+
...(options.boundaryId === undefined ? {} : { boundaryId: options.boundaryId }),
|
|
62
|
+
...(options.workloadDigest === undefined ? {} : { workloadDigest: options.workloadDigest }),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/** Every tool this guard governs, for a server publishing its tool list. */
|
|
66
|
+
governs(tool) {
|
|
67
|
+
return this.bindings.has(tool);
|
|
68
|
+
}
|
|
69
|
+
async guard(invocation) {
|
|
70
|
+
let bound;
|
|
71
|
+
let binding;
|
|
72
|
+
try {
|
|
73
|
+
binding = bindingFor(this.bindings, invocation.tool);
|
|
74
|
+
bound = bindMcpInvocation(invocation, binding, {
|
|
75
|
+
idempotencyKey: this.options.createIdempotencyKey?.(invocation) ??
|
|
76
|
+
`mcp-${invocation.tool}-${jcsDigest(invocation.arguments).slice(7, 23)}`,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
// Refused before the authority was asked: no decision, no dossier.
|
|
81
|
+
const code = error instanceof McpBindingError ? error.code : "MCP_INVOCATION_INVALID";
|
|
82
|
+
return { executed: false, intentHash: null, verdict: null, dossierId: null, reason: code };
|
|
83
|
+
}
|
|
84
|
+
const captured = this.capture.capture(bound.proposal, {
|
|
85
|
+
tenantId: this.options.tenantId,
|
|
86
|
+
actor: this.options.actor,
|
|
87
|
+
downstreamTarget: {
|
|
88
|
+
system: binding.system,
|
|
89
|
+
operation: binding.operation,
|
|
90
|
+
...(binding.environment === undefined ? {} : { environment: binding.environment }),
|
|
91
|
+
},
|
|
92
|
+
context: bound.context,
|
|
93
|
+
idempotencyKey: bound.idempotencyKey,
|
|
94
|
+
...(bound.correlationId === undefined ? {} : { correlationId: bound.correlationId }),
|
|
95
|
+
...(this.options.signals === undefined ? {} : { signals: this.options.signals }),
|
|
96
|
+
});
|
|
97
|
+
const tool = this.tools.get(invocation.tool);
|
|
98
|
+
if (tool === undefined)
|
|
99
|
+
throw new Error("MCP_TOOL_NOT_REGISTERED");
|
|
100
|
+
// Held from capture, before the authority is asked, so there is no window
|
|
101
|
+
// in which an intent exists without the arguments its dispatch is held to.
|
|
102
|
+
this.held.set(captured.intent.intentId, { tool, digest: bound.argumentsDigest });
|
|
103
|
+
let execution;
|
|
104
|
+
try {
|
|
105
|
+
const decision = await this.options.authority.evaluate(captured);
|
|
106
|
+
execution = await this.executor.run(captured, decision);
|
|
107
|
+
return this.outcomeOf(captured.intentHash, decision, execution);
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
this.held.delete(captured.intent.intentId);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
outcomeOf(intentHash, decision, execution) {
|
|
114
|
+
if (execution.outcome === "COMPLETED") {
|
|
115
|
+
return {
|
|
116
|
+
executed: true,
|
|
117
|
+
intentHash,
|
|
118
|
+
verdict: "ALLOW",
|
|
119
|
+
dossierId: decision.dossierId,
|
|
120
|
+
result: execution.result,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
if (execution.outcome === "UNKNOWN_AFTER_DISPATCH") {
|
|
124
|
+
// The tool was reached and may have acted. Saying "not executed" here
|
|
125
|
+
// would invite a second attempt at an effect that may already exist.
|
|
126
|
+
return {
|
|
127
|
+
executed: null,
|
|
128
|
+
intentHash,
|
|
129
|
+
verdict: "ALLOW",
|
|
130
|
+
dossierId: decision.dossierId,
|
|
131
|
+
reason: execution.reason,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
executed: false,
|
|
136
|
+
intentHash,
|
|
137
|
+
verdict: decision.verdict,
|
|
138
|
+
dossierId: decision.dossierId,
|
|
139
|
+
// A refusal before dispatch names itself (MCP_ARGUMENTS_MISMATCH),
|
|
140
|
+
// rather than the generic HANDLER_FAILED_BEFORE_DISPATCH.
|
|
141
|
+
reason: execution.outcome === "FAILED_BEFORE_DISPATCH" && execution.code !== undefined
|
|
142
|
+
? execution.code
|
|
143
|
+
: execution.reason,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=McpGuard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"McpGuard.js","sourceRoot":"","sources":["../../../src/adapters/mcp/McpGuard.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,YAAY,GASb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAmEtF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,QAAQ;IACF,QAAQ,CAAsC;IAC9C,KAAK,CAA+B;IACpC,IAAI,GAAG,IAAI,GAAG,EAAgB,CAAC;IAC/B,OAAO,CAAgB;IACvB,QAAQ,CAAe;IACvB,OAAO,CAAkB;IAE1C,YAAmB,OAAwB;QACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACxF,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7E,IAAI,CAAC,OAAO;YACV,OAAO,CAAC,OAAO,IAAI,IAAI,aAAa,CAAC,EAAE,GAAG,CAAC,OAAO,CAA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-pipeline";
|
|
2
|
+
import { type Sha256 } from "../JcsDigest.js";
|
|
3
|
+
import { type McpInvocation, type McpToolBinding } from "./McpInvocation.js";
|
|
4
|
+
export declare class McpBindingError extends Error {
|
|
5
|
+
readonly code: McpBindingCode;
|
|
6
|
+
constructor(code: McpBindingCode);
|
|
7
|
+
}
|
|
8
|
+
export type McpBindingCode = "MCP_INVOCATION_INVALID" | "MCP_TOOL_NOT_BOUND" | "MCP_TOOL_MISMATCH" | "MCP_ARGUMENTS_INVALID" | "MCP_TARGET_UNRESOLVED";
|
|
9
|
+
/** What the runtime knows, as against what the model sent. */
|
|
10
|
+
export interface McpTrustedContext {
|
|
11
|
+
/** The principal the host authenticated, if it authenticated one. */
|
|
12
|
+
readonly principal?: string;
|
|
13
|
+
/** A fallback idempotency key when the invocation carries none. */
|
|
14
|
+
readonly idempotencyKey: string;
|
|
15
|
+
}
|
|
16
|
+
export interface BoundMcpInvocation {
|
|
17
|
+
readonly proposal: AgentProposal;
|
|
18
|
+
/** The trusted context the runtime computes; never anything the model sent as context. */
|
|
19
|
+
readonly context: JsonObject;
|
|
20
|
+
readonly idempotencyKey: string;
|
|
21
|
+
readonly correlationId: string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* The canonical digest of the arguments as bound. The guard recomputes it
|
|
24
|
+
* immediately before dispatch: arguments that changed after the authority
|
|
25
|
+
* was issued are a refusal, not an execution.
|
|
26
|
+
*/
|
|
27
|
+
readonly argumentsDigest: Sha256;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The gate between the MCP transport and the action.
|
|
31
|
+
*
|
|
32
|
+
* A tool name and a bag of arguments arrive from a model. What leaves is an
|
|
33
|
+
* Agent-Safe proposal: an action the operator named, a target derived from
|
|
34
|
+
* the arguments rather than accepted from the caller, and the arguments
|
|
35
|
+
* themselves, validated whole.
|
|
36
|
+
*
|
|
37
|
+
* Every refusal here happens before the authority is asked, so none of them
|
|
38
|
+
* costs a decision or a dossier:
|
|
39
|
+
*
|
|
40
|
+
* - a tool with no binding is refused rather than passed through, so adding
|
|
41
|
+
* a consequential tool to a server cannot quietly add an ungoverned path;
|
|
42
|
+
* - an argument the tool's schema does not name is refused rather than
|
|
43
|
+
* dropped, because a dropped argument is one the authority never saw and
|
|
44
|
+
* the tool might still act on;
|
|
45
|
+
* - a target that cannot be resolved from the arguments is refused rather
|
|
46
|
+
* than guessed.
|
|
47
|
+
*
|
|
48
|
+
* What it does not do is authorize anything. It produces a proposal; the
|
|
49
|
+
* authority decides, and the claim is what makes a dispatch legal.
|
|
50
|
+
*/
|
|
51
|
+
export declare function bindMcpInvocation(input: McpInvocation, binding: McpToolBinding, trusted: McpTrustedContext): BoundMcpInvocation;
|
|
52
|
+
/** The binding for a tool, or a refusal naming the tool as ungoverned. */
|
|
53
|
+
export declare function bindingFor(bindings: ReadonlyMap<string, McpToolBinding>, tool: string): McpToolBinding;
|
|
54
|
+
//# sourceMappingURL=McpIntentBinder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"McpIntentBinder.d.ts","sourceRoot":"","sources":["../../../src/adapters/mcp/McpIntentBinder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAa,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAE5B,qBAAa,eAAgB,SAAQ,KAAK;aACL,IAAI,EAAE,cAAc;gBAApB,IAAI,EAAE,cAAc;CAIxD;AAED,MAAM,MAAM,cAAc,GACtB,wBAAwB,GACxB,oBAAoB,GACpB,mBAAmB,GACnB,uBAAuB,GACvB,uBAAuB,CAAC;AAE5B,8DAA8D;AAC9D,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,0FAA0F;IAC1F,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,iBAAiB,GACzB,kBAAkB,CAkCpB;AAED,0EAA0E;AAC1E,wBAAgB,UAAU,CACxB,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,EAC7C,IAAI,EAAE,MAAM,GACX,cAAc,CAIhB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jcsDigest } from "../JcsDigest.js";
|
|
2
|
+
import { McpInvocationSchema, fillTarget, } from "./McpInvocation.js";
|
|
3
|
+
export class McpBindingError extends Error {
|
|
4
|
+
code;
|
|
5
|
+
constructor(code) {
|
|
6
|
+
super(code);
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.name = "McpBindingError";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The gate between the MCP transport and the action.
|
|
13
|
+
*
|
|
14
|
+
* A tool name and a bag of arguments arrive from a model. What leaves is an
|
|
15
|
+
* Agent-Safe proposal: an action the operator named, a target derived from
|
|
16
|
+
* the arguments rather than accepted from the caller, and the arguments
|
|
17
|
+
* themselves, validated whole.
|
|
18
|
+
*
|
|
19
|
+
* Every refusal here happens before the authority is asked, so none of them
|
|
20
|
+
* costs a decision or a dossier:
|
|
21
|
+
*
|
|
22
|
+
* - a tool with no binding is refused rather than passed through, so adding
|
|
23
|
+
* a consequential tool to a server cannot quietly add an ungoverned path;
|
|
24
|
+
* - an argument the tool's schema does not name is refused rather than
|
|
25
|
+
* dropped, because a dropped argument is one the authority never saw and
|
|
26
|
+
* the tool might still act on;
|
|
27
|
+
* - a target that cannot be resolved from the arguments is refused rather
|
|
28
|
+
* than guessed.
|
|
29
|
+
*
|
|
30
|
+
* What it does not do is authorize anything. It produces a proposal; the
|
|
31
|
+
* authority decides, and the claim is what makes a dispatch legal.
|
|
32
|
+
*/
|
|
33
|
+
export function bindMcpInvocation(input, binding, trusted) {
|
|
34
|
+
const parsed = McpInvocationSchema.safeParse(input);
|
|
35
|
+
if (!parsed.success)
|
|
36
|
+
throw new McpBindingError("MCP_INVOCATION_INVALID");
|
|
37
|
+
const invocation = parsed.data;
|
|
38
|
+
if (invocation.tool !== binding.tool)
|
|
39
|
+
throw new McpBindingError("MCP_TOOL_MISMATCH");
|
|
40
|
+
const args = binding.argumentsSchema.safeParse(invocation.arguments);
|
|
41
|
+
if (!args.success)
|
|
42
|
+
throw new McpBindingError("MCP_ARGUMENTS_INVALID");
|
|
43
|
+
const target = fillTarget(binding.target, args.data);
|
|
44
|
+
if (target === null)
|
|
45
|
+
throw new McpBindingError("MCP_TARGET_UNRESOLVED");
|
|
46
|
+
// The consequential names are an operator's list of what matters, for a
|
|
47
|
+
// reviewer and for evidence. They narrow nothing: every argument is in the
|
|
48
|
+
// proposal and therefore in the hash.
|
|
49
|
+
const consequential = binding.consequential.filter((name) => Object.hasOwn(args.data, name));
|
|
50
|
+
return {
|
|
51
|
+
proposal: { action: binding.action, target, parameters: args.data },
|
|
52
|
+
context: {
|
|
53
|
+
ingress: "mcp",
|
|
54
|
+
mcp_tool: binding.tool,
|
|
55
|
+
mcp_arguments_digest: jcsDigest(args.data),
|
|
56
|
+
mcp_consequential: consequential,
|
|
57
|
+
...(invocation.server === undefined ? {} : { mcp_server: invocation.server }),
|
|
58
|
+
...(invocation.transport === undefined ? {} : { mcp_transport: invocation.transport }),
|
|
59
|
+
// The host's own principal when it has one, else what the caller
|
|
60
|
+
// claimed, marked as claimed either way it is read.
|
|
61
|
+
...(trusted.principal === undefined
|
|
62
|
+
? invocation.principal === undefined
|
|
63
|
+
? {}
|
|
64
|
+
: { claimed_principal: invocation.principal }
|
|
65
|
+
: { claimed_principal: trusted.principal }),
|
|
66
|
+
},
|
|
67
|
+
idempotencyKey: invocation.idempotencyKey ?? trusted.idempotencyKey,
|
|
68
|
+
correlationId: invocation.correlationId,
|
|
69
|
+
argumentsDigest: jcsDigest(args.data),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/** The binding for a tool, or a refusal naming the tool as ungoverned. */
|
|
73
|
+
export function bindingFor(bindings, tool) {
|
|
74
|
+
const binding = bindings.get(tool);
|
|
75
|
+
if (binding === undefined)
|
|
76
|
+
throw new McpBindingError("MCP_TOOL_NOT_BOUND");
|
|
77
|
+
return binding;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=McpIntentBinder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"McpIntentBinder.js","sourceRoot":"","sources":["../../../src/adapters/mcp/McpIntentBinder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAe,MAAM,iBAAiB,CAAC;AACzD,OAAO,EACL,mBAAmB,EACnB,UAAU,GAGX,MAAM,oBAAoB,CAAC;AAE5B,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACL;IAAnC,YAAmC,IAAoB;QACrD,KAAK,CAAC,IAAI,CAAC,CAAC;QADqB,SAAI,GAAJ,IAAI,CAAgB;QAErD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AA+BD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAoB,EACpB,OAAuB,EACvB,OAA0B;IAE1B,MAAM,MAAM,GAAG,mBAAmB,CAA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AAM,EAAE,CAAC;YAC7E,GAAG,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,CAAC,SAAS,EAAE,CAAC;YACtF,iEAAiE;YACjE,oDAAoD;YACpD,GAAG,CAAC,OAAO,CAAC,SAAS,KAAK,SAAS;gBACjC,CAAC,CAAC,UAAU,CAAC,SAAS,KAAK,SAAS;oBAClC,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,EAAE,iBAAiB,EAAE,UAAU,CAAC,SAAS,EAAE;gBAC/C,CAAC,CAAC,EAAE,iBAAiB,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;SAC9C;QACD,cAAc,EAAE,UAAU,CAAC,cAAc,IAAI,OAAO,CAAC,cAAc;QACnE,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,eAAe,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;KACtC,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,UAAU,CACxB,QAA6C,EAC7C,IAAY;IAEZ,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,IAAI,eAAe,CAAC,oBAAoB,CAAC,CAAC;IAC3E,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { JsonObject } from "@decionis/agent-safe-pipeline";
|
|
3
|
+
export declare const McpInvocationSchema: z.ZodObject<{
|
|
4
|
+
tool: z.ZodString;
|
|
5
|
+
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
6
|
+
server: z.ZodOptional<z.ZodString>;
|
|
7
|
+
transport: z.ZodOptional<z.ZodString>;
|
|
8
|
+
principal: z.ZodOptional<z.ZodString>;
|
|
9
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export type McpInvocation = z.infer<typeof McpInvocationSchema>;
|
|
13
|
+
/**
|
|
14
|
+
* What an operator declares about one tool, in trusted startup code beside
|
|
15
|
+
* the registry that will run it.
|
|
16
|
+
*
|
|
17
|
+
* A tool with no binding is not governed by this adapter and not silently
|
|
18
|
+
* allowed by it either: the guard refuses it, so adding a consequential tool
|
|
19
|
+
* to a server cannot quietly add an ungoverned path to a system of record.
|
|
20
|
+
*
|
|
21
|
+
* `target` is a template rather than a callback so that a binding stays a
|
|
22
|
+
* description an operator can read, and later hold in configuration, rather
|
|
23
|
+
* than arbitrary code reached by tool name.
|
|
24
|
+
*/
|
|
25
|
+
export interface McpToolBinding {
|
|
26
|
+
readonly tool: string;
|
|
27
|
+
/** The Agent-Safe action name this tool becomes. */
|
|
28
|
+
readonly action: string;
|
|
29
|
+
/** The system the effect lands in, and the operation there. */
|
|
30
|
+
readonly system: string;
|
|
31
|
+
readonly operation: string;
|
|
32
|
+
readonly environment?: string;
|
|
33
|
+
/** `crm:customer:{customerId}` — every placeholder must be an argument. */
|
|
34
|
+
readonly target: string;
|
|
35
|
+
/**
|
|
36
|
+
* The arguments that decide what the action does. They are named so that
|
|
37
|
+
* evidence and an approval screen can show the few that matter; every
|
|
38
|
+
* argument is inside the intent hash regardless, named or not.
|
|
39
|
+
*/
|
|
40
|
+
readonly consequential: readonly string[];
|
|
41
|
+
/** The arguments this tool accepts. Anything else is refused, not dropped. */
|
|
42
|
+
readonly argumentsSchema: z.ZodType<JsonObject>;
|
|
43
|
+
}
|
|
44
|
+
export declare const MAX_TEMPLATE_PLACEHOLDERS = 16;
|
|
45
|
+
/**
|
|
46
|
+
* Fills a target template from the arguments, by a single linear scan.
|
|
47
|
+
*
|
|
48
|
+
* Deliberately not a regular expression: the template is an operator's, but
|
|
49
|
+
* the values substituted into it are the model's, and a scan has no
|
|
50
|
+
* backtracking to exploit. A placeholder with no argument, an argument that
|
|
51
|
+
* is not a scalar, and an unterminated brace are each a refusal rather than a
|
|
52
|
+
* target with a hole in it.
|
|
53
|
+
*/
|
|
54
|
+
export declare function fillTarget(template: string, args: JsonObject): string | null;
|
|
55
|
+
//# sourceMappingURL=McpInvocation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"McpInvocation.d.ts","sourceRoot":"","sources":["../../../src/adapters/mcp/McpInvocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AA0BhE,eAAO,MAAM,mBAAmB;;;;;;;;kBAerB,CAAC;AAEZ,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,8EAA8E;IAC9E,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;CACjD;AAED,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CA8B5E"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* An MCP tool invocation, at the one moment worth intercepting: the model has
|
|
4
|
+
* chosen a tool and constructed its arguments, and nothing has happened yet.
|
|
5
|
+
*
|
|
6
|
+
* The distinction this file exists to keep is small and load-bearing:
|
|
7
|
+
*
|
|
8
|
+
* MCP decides *how* an agent invokes a tool.
|
|
9
|
+
* AgentSafe and Decionis decide *whether this exact invocation* may run.
|
|
10
|
+
*
|
|
11
|
+
* So nothing here is an MCP server, a registry, or a replacement for MCP's
|
|
12
|
+
* own authentication. The type below is a plain description of a call, with
|
|
13
|
+
* no dependency on any MCP SDK, so a stdio server, a streamable-HTTP server
|
|
14
|
+
* and a test can all hand over the same thing.
|
|
15
|
+
*/
|
|
16
|
+
const toolName = z
|
|
17
|
+
.string()
|
|
18
|
+
.trim()
|
|
19
|
+
.min(1)
|
|
20
|
+
.max(200)
|
|
21
|
+
.regex(/^[a-z0-9][\w.:/-]*$/i);
|
|
22
|
+
const bounded = (max) => z.string().trim().min(1).max(max);
|
|
23
|
+
export const McpInvocationSchema = z
|
|
24
|
+
.object({
|
|
25
|
+
/** The tool the model selected, by the name the server published. */
|
|
26
|
+
tool: toolName,
|
|
27
|
+
/** The arguments the model constructed. Untrusted, and hashed whole. */
|
|
28
|
+
arguments: z.record(z.string(), z.unknown()).default({}),
|
|
29
|
+
/** Which server holds the tool, when the caller runs more than one. */
|
|
30
|
+
server: bounded(200).optional(),
|
|
31
|
+
/** How the call arrived. Carried as context, never as authority. */
|
|
32
|
+
transport: bounded(80).optional(),
|
|
33
|
+
/** Who the caller says it is. Claimed, never verified here. */
|
|
34
|
+
principal: bounded(200).optional(),
|
|
35
|
+
correlationId: bounded(200).optional(),
|
|
36
|
+
idempotencyKey: bounded(180).optional(),
|
|
37
|
+
})
|
|
38
|
+
.strict();
|
|
39
|
+
export const MAX_TEMPLATE_PLACEHOLDERS = 16;
|
|
40
|
+
/**
|
|
41
|
+
* Fills a target template from the arguments, by a single linear scan.
|
|
42
|
+
*
|
|
43
|
+
* Deliberately not a regular expression: the template is an operator's, but
|
|
44
|
+
* the values substituted into it are the model's, and a scan has no
|
|
45
|
+
* backtracking to exploit. A placeholder with no argument, an argument that
|
|
46
|
+
* is not a scalar, and an unterminated brace are each a refusal rather than a
|
|
47
|
+
* target with a hole in it.
|
|
48
|
+
*/
|
|
49
|
+
export function fillTarget(template, args) {
|
|
50
|
+
let out = "";
|
|
51
|
+
let placeholders = 0;
|
|
52
|
+
for (let at = 0; at < template.length; at += 1) {
|
|
53
|
+
const character = template[at];
|
|
54
|
+
if (character !== "{") {
|
|
55
|
+
if (character === "}")
|
|
56
|
+
return null;
|
|
57
|
+
out += character;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const close = template.indexOf("}", at + 1);
|
|
61
|
+
if (close === -1)
|
|
62
|
+
return null;
|
|
63
|
+
placeholders += 1;
|
|
64
|
+
if (placeholders > MAX_TEMPLATE_PLACEHOLDERS)
|
|
65
|
+
return null;
|
|
66
|
+
const name = template.slice(at + 1, close);
|
|
67
|
+
if (name.length === 0 || !Object.hasOwn(args, name))
|
|
68
|
+
return null;
|
|
69
|
+
const value = args[name];
|
|
70
|
+
if (typeof value === "string") {
|
|
71
|
+
if (value.length === 0)
|
|
72
|
+
return null;
|
|
73
|
+
out += value;
|
|
74
|
+
}
|
|
75
|
+
else if (typeof value === "number" && Number.isFinite(value)) {
|
|
76
|
+
out += String(value);
|
|
77
|
+
}
|
|
78
|
+
else if (typeof value === "boolean") {
|
|
79
|
+
out += String(value);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
at = close;
|
|
85
|
+
}
|
|
86
|
+
return out.length === 0 || out.length > 500 ? null : out;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=McpInvocation.js.map
|
|
@@ -0,0 +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QACvB,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;YACtC,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC;QACd,CAAC;QACD,EAAE,GAAG,KAAK,CAAC;IACb,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;AAC3D,CAAC"}
|
|
@@ -10,7 +10,7 @@ export interface ChainedRecord {
|
|
|
10
10
|
readonly seq: number;
|
|
11
11
|
readonly prev_hash: string;
|
|
12
12
|
readonly hash: string;
|
|
13
|
-
/** The line as written: `stream`, `seq`, `prev_hash`, the fields, then `hash`. */
|
|
13
|
+
/** The line as written: `stream`, `tenant` when there is one, `seq`, `prev_hash`, the fields, then `hash`. */
|
|
14
14
|
readonly line: string;
|
|
15
15
|
}
|
|
16
16
|
export type ChainWriter = (line: string) => void;
|
|
@@ -22,12 +22,18 @@ export type ChainWriter = (line: string) => void;
|
|
|
22
22
|
* lines and nothing else; it is continuity and integrity, not origin, which
|
|
23
23
|
* a signature over an export provides. Linking is synchronous, so two lines
|
|
24
24
|
* can never interleave their sequence numbers.
|
|
25
|
+
*
|
|
26
|
+
* A chain run for one tenant of a hosted gateway carries the tenant in its
|
|
27
|
+
* envelope, beside `stream`: covered by every hash, and never overridden by
|
|
28
|
+
* a field, so a line cannot be moved to another tenant without breaking the
|
|
29
|
+
* chain, and one process's output holds each tenant's chains apart.
|
|
25
30
|
*/
|
|
26
31
|
export declare class HashChain {
|
|
27
32
|
readonly stream: string;
|
|
33
|
+
readonly tenant: string | null;
|
|
28
34
|
private current;
|
|
29
35
|
private readonly listeners;
|
|
30
|
-
constructor(stream: string, head?: ChainHead | null);
|
|
36
|
+
constructor(stream: string, head?: ChainHead | null, tenant?: string | null);
|
|
31
37
|
get head(): ChainHead;
|
|
32
38
|
/** Called after every link with the new head; for the journal that persists it. */
|
|
33
39
|
onLink(listener: (head: ChainHead) => void): () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HashChain.d.ts","sourceRoot":"","sources":["../../src/audit/HashChain.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAEtF,+CAA+C;AAC/C,eAAO,MAAM,aAAa,QAA6B,CAAC;AAExD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,
|
|
1
|
+
{"version":3,"file":"HashChain.d.ts","sourceRoot":"","sources":["../../src/audit/HashChain.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAEtF,+CAA+C;AAC/C,eAAO,MAAM,aAAa,QAA6B,CAAC;AAExD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8GAA8G;IAC9G,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,qBAAa,SAAS;aAKF,MAAM,EAAE,MAAM;aAEd,MAAM,EAAE,MAAM,GAAG,IAAI;IANvC,OAAO,CAAC,OAAO,CAAY;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqC;gBAG7C,MAAM,EAAE,MAAM,EAC9B,IAAI,GAAE,SAAS,GAAG,IAAW,EACb,MAAM,GAAE,MAAM,GAAG,IAAW;IAK9C,IAAW,IAAI,IAAI,SAAS,CAE3B;IAED,mFAAmF;IAC5E,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI;IAQ9D,mFAAmF;IAC5E,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,GAAG,aAAa;IAsBnE,gGAAgG;WAClF,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,GAAG,MAAM;CAO1E"}
|
package/dist/audit/HashChain.js
CHANGED
|
@@ -10,13 +10,20 @@ export const CHAIN_GENESIS = `sha256:${"0".repeat(64)}`;
|
|
|
10
10
|
* lines and nothing else; it is continuity and integrity, not origin, which
|
|
11
11
|
* a signature over an export provides. Linking is synchronous, so two lines
|
|
12
12
|
* can never interleave their sequence numbers.
|
|
13
|
+
*
|
|
14
|
+
* A chain run for one tenant of a hosted gateway carries the tenant in its
|
|
15
|
+
* envelope, beside `stream`: covered by every hash, and never overridden by
|
|
16
|
+
* a field, so a line cannot be moved to another tenant without breaking the
|
|
17
|
+
* chain, and one process's output holds each tenant's chains apart.
|
|
13
18
|
*/
|
|
14
19
|
export class HashChain {
|
|
15
20
|
stream;
|
|
21
|
+
tenant;
|
|
16
22
|
current;
|
|
17
23
|
listeners = [];
|
|
18
|
-
constructor(stream, head = null) {
|
|
24
|
+
constructor(stream, head = null, tenant = null) {
|
|
19
25
|
this.stream = stream;
|
|
26
|
+
this.tenant = tenant;
|
|
20
27
|
this.current = head ?? { seq: 0, hash: CHAIN_GENESIS };
|
|
21
28
|
}
|
|
22
29
|
get head() {
|
|
@@ -37,7 +44,12 @@ export class HashChain {
|
|
|
37
44
|
const previous = this.current.hash;
|
|
38
45
|
// The envelope wins over a field of the same name: nothing a line says
|
|
39
46
|
// can move it in the chain.
|
|
40
|
-
const record = {
|
|
47
|
+
const record = {
|
|
48
|
+
stream: this.stream,
|
|
49
|
+
...(this.tenant === null ? {} : { tenant: this.tenant }),
|
|
50
|
+
seq,
|
|
51
|
+
prev_hash: previous,
|
|
52
|
+
};
|
|
41
53
|
for (const [key, value] of Object.entries(fields)) {
|
|
42
54
|
if (!(key in record))
|
|
43
55
|
record[key] = value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HashChain.js","sourceRoot":"","sources":["../../src/audit/HashChain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAkB,MAAM,+BAA+B,CAAC;AAEtF,+CAA+C;AAC/C,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;AAmBxD
|
|
1
|
+
{"version":3,"file":"HashChain.js","sourceRoot":"","sources":["../../src/audit/HashChain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAkB,MAAM,+BAA+B,CAAC;AAEtF,+CAA+C;AAC/C,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;AAmBxD;;;;;;;;;;;;;GA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/**
|
|
4
|
+
* Which enforcement boundary this process is.
|
|
5
|
+
*
|
|
6
|
+
* An estate may run hundreds of gateways across Docker, Kubernetes, a Linux
|
|
7
|
+
* host and the hosted runtime. A Decision Dossier that names the boundary can
|
|
8
|
+
* answer which of them admitted an effect; one that cannot is evidence about
|
|
9
|
+
* an action with no evidence about the door it came through.
|
|
10
|
+
*
|
|
11
|
+
* The identity is of the *configured logical boundary*, not of the process or
|
|
12
|
+
* the container: restarting a container, rescheduling a pod or scaling a
|
|
13
|
+
* deployment to thirty replicas leaves it unchanged, because nothing
|
|
14
|
+
* ephemeral goes into it. That is also why the derivation below reads
|
|
15
|
+
* configuration rather than the machine: a boundary id that moved when a pod
|
|
16
|
+
* did would be an instance id wearing a boundary's name, and an operator
|
|
17
|
+
* grouping policy by boundary would be grouping by nothing.
|
|
18
|
+
*/
|
|
19
|
+
/** The conformance profile this boundary answers for. */
|
|
20
|
+
export declare const BOUNDARY_CONFORMANCE = "agent-safe-intent-v1";
|
|
21
|
+
export declare const BOUNDARY_PROTOCOL = "agent-safe.intent/1";
|
|
22
|
+
/** A derived id wears a prefix so it is never mistaken for one an operator chose. */
|
|
23
|
+
export declare const DERIVED_BOUNDARY_PREFIX = "bd_";
|
|
24
|
+
export declare const BOUNDARY_ENVIRONMENT: {
|
|
25
|
+
readonly boundaryId: "AGENTSAFE_BOUNDARY_ID";
|
|
26
|
+
readonly clusterId: "AGENTSAFE_CLUSTER_ID";
|
|
27
|
+
readonly namespace: "AGENTSAFE_NAMESPACE";
|
|
28
|
+
readonly region: "AGENTSAFE_REGION";
|
|
29
|
+
readonly workloadId: "AGENTSAFE_WORKLOAD_ID";
|
|
30
|
+
readonly containerId: "AGENTSAFE_CONTAINER_ID";
|
|
31
|
+
readonly podId: "AGENTSAFE_POD_ID";
|
|
32
|
+
readonly nodeId: "AGENTSAFE_NODE_ID";
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Where the boundary sits, as the operator's own manifest declared it. These
|
|
36
|
+
* survive a restart and are what a policy means by "production in eu", so
|
|
37
|
+
* they are bound into the intent and reach signed evidence.
|
|
38
|
+
*/
|
|
39
|
+
export interface BoundaryPlacement {
|
|
40
|
+
readonly clusterId: string | null;
|
|
41
|
+
readonly namespace: string | null;
|
|
42
|
+
readonly region: string | null;
|
|
43
|
+
readonly workloadId: string | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Which instance of the boundary this happens to be. Ephemeral by
|
|
47
|
+
* definition, so it is reported locally, for an operator reading one
|
|
48
|
+
* process's own output, and never bound into an intent or signed into
|
|
49
|
+
* evidence: an effect's evidence should say which boundary admitted it, not
|
|
50
|
+
* which container was alive that second.
|
|
51
|
+
*/
|
|
52
|
+
export interface BoundaryInstance {
|
|
53
|
+
readonly containerId: string | null;
|
|
54
|
+
readonly podId: string | null;
|
|
55
|
+
readonly nodeId: string | null;
|
|
56
|
+
}
|
|
57
|
+
export interface EnforcementBoundary {
|
|
58
|
+
readonly boundaryId: string;
|
|
59
|
+
/** Whether an operator named this boundary or the configuration derived it. */
|
|
60
|
+
readonly boundarySource: "configured" | "derived";
|
|
61
|
+
readonly agentsafeVersion: string;
|
|
62
|
+
readonly protocolVersion: typeof BOUNDARY_PROTOCOL;
|
|
63
|
+
readonly conformanceVersion: string;
|
|
64
|
+
readonly deploymentType: InstallSurface | "unknown";
|
|
65
|
+
readonly environment: string | null;
|
|
66
|
+
readonly placement: BoundaryPlacement | null;
|
|
67
|
+
readonly instance: BoundaryInstance | null;
|
|
68
|
+
}
|
|
69
|
+
/** What the resolution reads: the environment and the configuration, never the host. */
|
|
70
|
+
export interface BoundaryFacts {
|
|
71
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
72
|
+
readonly version: string;
|
|
73
|
+
readonly deploymentType: InstallSurface | null;
|
|
74
|
+
/** The operator's own name for this deployment, from `gateway.environment`. */
|
|
75
|
+
readonly environment: string | null;
|
|
76
|
+
/** The origin of the system this boundary stands in front of. */
|
|
77
|
+
readonly upstreamOrigin: string | null;
|
|
78
|
+
/** A boundary id from the configuration file, which the environment overrides. */
|
|
79
|
+
readonly configuredId?: string | null;
|
|
80
|
+
}
|
|
81
|
+
export declare function resolveBoundary(facts: BoundaryFacts): EnforcementBoundary;
|
|
82
|
+
/**
|
|
83
|
+
* The boundary as an intent binds it. The instance is left out deliberately:
|
|
84
|
+
* what reaches signed evidence is the boundary, and the boundary is not the
|
|
85
|
+
* container it happens to be running in.
|
|
86
|
+
*/
|
|
87
|
+
export declare function boundarySignal(boundary: EnforcementBoundary): EnforcementBoundarySignal;
|
|
88
|
+
//# sourceMappingURL=BoundaryIdentity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BoundaryIdentity.d.ts","sourceRoot":"","sources":["../../src/boundary/BoundaryIdentity.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;;;;;;;;;;;;;;GAeG;AAEH,yDAAyD;AACzD,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAE3D,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAEvD,qFAAqF;AACrF,eAAO,MAAM,uBAAuB,QAAQ,CAAC;AAE7C,eAAO,MAAM,oBAAoB;;;;;;;;;CASvB,CAAC;AAUX;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IA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