@decionis/agentsafe 0.2.5 → 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 +19 -0
- package/dist/Cli.js.map +1 -1
- package/dist/Index.d.ts +10 -4
- package/dist/Index.d.ts.map +1 -1
- package/dist/Index.js +8 -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.map +1 -1
- package/dist/adapters/mcp/McpGuard.js +9 -4
- package/dist/adapters/mcp/McpGuard.js.map +1 -1
- 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/cli/Commands.d.ts +1 -1
- package/dist/cli/Commands.d.ts.map +1 -1
- package/dist/cli/Commands.js +5 -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 +8 -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/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/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/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 +190 -10
- package/dist/gateway/Gateway.d.ts.map +1 -1
- package/dist/gateway/Gateway.js +465 -62
- package/dist/gateway/Gateway.js.map +1 -1
- package/dist/gateway/GatewayConfig.d.ts +67 -0
- package/dist/gateway/GatewayConfig.d.ts.map +1 -1
- package/dist/gateway/GatewayConfig.js +149 -2
- package/dist/gateway/GatewayConfig.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/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,73 @@
|
|
|
1
|
+
import { EdgeBundleManager, EdgeModule, LocalGrants, type EdgeDecisionRecord, type LocalFinalizationRecord, type ReplayStore } from "@decionis/agent-safe-pipeline";
|
|
2
|
+
import type { HashChain } from "../audit/HashChain.js";
|
|
3
|
+
import type { LineWriter } from "../audit/LineAuditSink.js";
|
|
4
|
+
import type { ExecutorConfig } from "../config/ExecutorConfig.js";
|
|
5
|
+
import { EdgeLicence } from "../edge/EdgeLicence.js";
|
|
6
|
+
import { type LoadPg } from "../edge/EdgeReplay.js";
|
|
7
|
+
import { UsageMeter } from "../edge/UsageMeter.js";
|
|
8
|
+
import type { FetchLike } from "../handlers/HandlerRegistration.js";
|
|
9
|
+
import type { SecurityEvents } from "../incident/SecurityEvents.js";
|
|
10
|
+
import type { SecretStore } from "../secrets/SecretStore.js";
|
|
11
|
+
export interface EdgeRuntimeOptions {
|
|
12
|
+
readonly config: ExecutorConfig;
|
|
13
|
+
/** Where the replay store's connection string and the usage-report key are read from. */
|
|
14
|
+
readonly secrets: SecretStore;
|
|
15
|
+
/** The organisation's Decionis key, read at the moment of each bundle fetch. */
|
|
16
|
+
readonly apiKey: () => string;
|
|
17
|
+
/** The guarded fetch: a bundle comes from the authority's origin, and nowhere else. */
|
|
18
|
+
readonly fetch: FetchLike;
|
|
19
|
+
readonly events: SecurityEvents;
|
|
20
|
+
/** The executor's evidence chain, and the writer its audit lines go through. */
|
|
21
|
+
readonly chain: HashChain;
|
|
22
|
+
readonly write: LineWriter;
|
|
23
|
+
/** Loads the module; the configured file unless a test hands in its own. */
|
|
24
|
+
readonly loadModule?: (path: string) => EdgeModule;
|
|
25
|
+
/** Loads `pg` for the Postgres replay store; the installed package unless a test hands in its own. */
|
|
26
|
+
readonly loadPg?: LoadPg;
|
|
27
|
+
readonly clock?: () => number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The long-lived half of the edge authority: the module, the bundle it holds,
|
|
31
|
+
* the local grants, the replay store, the usage meter and the licence check.
|
|
32
|
+
* It outlives a rebuild of the authority clients, so a rotated Presence
|
|
33
|
+
* credential neither reloads the module nor forgets which intents have run.
|
|
34
|
+
*/
|
|
35
|
+
export declare class EdgeRuntime {
|
|
36
|
+
private readonly options;
|
|
37
|
+
readonly module: EdgeModule;
|
|
38
|
+
readonly bundles: EdgeBundleManager;
|
|
39
|
+
readonly grants: LocalGrants;
|
|
40
|
+
readonly replay: ReplayStore;
|
|
41
|
+
readonly usage: UsageMeter;
|
|
42
|
+
readonly licence: EdgeLicence;
|
|
43
|
+
readonly onUnavailable: "hosted" | "block";
|
|
44
|
+
readonly clock: () => number;
|
|
45
|
+
private readonly shared;
|
|
46
|
+
private timer;
|
|
47
|
+
private constructor();
|
|
48
|
+
/**
|
|
49
|
+
* The runtime the configuration asks for, or null for a hosted deployment.
|
|
50
|
+
* A module that cannot be read, is not WebAssembly, or is not ABI 3, and a
|
|
51
|
+
* usage-report key that is not an Ed25519 private key, are refusals to
|
|
52
|
+
* start that name the variable and the reason, never a deployment that
|
|
53
|
+
* quietly decides hosted instead.
|
|
54
|
+
*/
|
|
55
|
+
static create(options: EdgeRuntimeOptions): EdgeRuntime | null;
|
|
56
|
+
/**
|
|
57
|
+
* Links one local decision, or a local attempt's outcome, on the evidence
|
|
58
|
+
* chain. A decision is counted as its line is written, with the sequence
|
|
59
|
+
* and hash that line carries, so the count is the chain's own.
|
|
60
|
+
*/
|
|
61
|
+
record(record: EdgeDecisionRecord | LocalFinalizationRecord): void;
|
|
62
|
+
/**
|
|
63
|
+
* The replay store first: a shared store that cannot be reached is a
|
|
64
|
+
* refusal to start, since nothing could be run once. Then the first
|
|
65
|
+
* bundle fetch, the first usage report and licence check, and the hourly
|
|
66
|
+
* schedule for both and for removing lapsed claims.
|
|
67
|
+
*/
|
|
68
|
+
start(): Promise<void>;
|
|
69
|
+
/** One round of housekeeping. Never throws, and touches no decision. */
|
|
70
|
+
tick(): Promise<void>;
|
|
71
|
+
stop(): void;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=EdgeRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EdgeRuntime.d.ts","sourceRoot":"","sources":["../../src/service/EdgeRuntime.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,UAAU,EAGV,WAAW,EAGX,KAAK,kBAAkB,EAEvB,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAiD,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEnG,OAAO,EAGL,UAAU,EAEX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,yFAAyF;IACzF,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,MAAM,MAAM,CAAC;IAC9B,uFAAuF;IACvF,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,UAAU,CAAC;IACnD,sGAAsG;IACtG,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;CAC/B;AAKD;;;;;GAKG;AACH,qBAAa,WAAW;IAapB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAZ1B,SAAgB,MAAM,EAAE,UAAU,CAAC;IACnC,SAAgB,OAAO,EAAE,iBAAiB,CAAC;IAC3C,SAAgB,MAAM,EAAE,WAAW,CAAC;IACpC,SAAgB,MAAM,EAAE,WAAW,CAAC;IACpC,SAAgB,KAAK,EAAE,UAAU,CAAC;IAClC,SAAgB,OAAO,EAAE,WAAW,CAAC;IACrC,SAAgB,aAAa,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClD,SAAgB,KAAK,EAAE,MAAM,MAAM,CAAC;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,KAAK,CAA+C;IAE5D,OAAO;IAgFP;;;;;;OAMG;WACW,MAAM,CAAC,OAAO,EAAE,kBAAkB,GAAG,WAAW,GAAG,IAAI;IAsCrE;;;;OAIG;IACI,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,uBAAuB,GAAG,IAAI;IAwBzE;;;;;OAKG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBnC,wEAAwE;IAC3D,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ3B,IAAI,IAAI,IAAI;CAOpB"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { EdgeBundleManager, EdgeModule, EdgeModuleError, FileBundleSource, LocalGrants, UrlBundleSource, } from "@decionis/agent-safe-pipeline";
|
|
3
|
+
import { EdgeLicence } from "../edge/EdgeLicence.js";
|
|
4
|
+
import { memoryReplay, postgresReplay } from "../edge/EdgeReplay.js";
|
|
5
|
+
import { FileEntitlementSource, UrlEntitlementSource } from "../edge/Entitlement.js";
|
|
6
|
+
import { FileUsageDelivery, UrlUsageDelivery, UsageMeter, } from "../edge/UsageMeter.js";
|
|
7
|
+
import { usageSigningKey } from "../edge/UsageReport.js";
|
|
8
|
+
import { RequestContext } from "../http/RequestContext.js";
|
|
9
|
+
/** How often usage reports are attempted, the entitlement re-read and lapsed claims removed. */
|
|
10
|
+
const TICK_MS = 3_600_000;
|
|
11
|
+
/**
|
|
12
|
+
* The long-lived half of the edge authority: the module, the bundle it holds,
|
|
13
|
+
* the local grants, the replay store, the usage meter and the licence check.
|
|
14
|
+
* It outlives a rebuild of the authority clients, so a rotated Presence
|
|
15
|
+
* credential neither reloads the module nor forgets which intents have run.
|
|
16
|
+
*/
|
|
17
|
+
export class EdgeRuntime {
|
|
18
|
+
options;
|
|
19
|
+
module;
|
|
20
|
+
bundles;
|
|
21
|
+
grants;
|
|
22
|
+
replay;
|
|
23
|
+
usage;
|
|
24
|
+
licence;
|
|
25
|
+
onUnavailable;
|
|
26
|
+
clock;
|
|
27
|
+
shared;
|
|
28
|
+
timer = null;
|
|
29
|
+
constructor(options, module, source, key) {
|
|
30
|
+
this.options = options;
|
|
31
|
+
const { config, events } = options;
|
|
32
|
+
const edge = config.edge;
|
|
33
|
+
if (edge === null)
|
|
34
|
+
throw new Error("EDGE_NOT_CONFIGURED");
|
|
35
|
+
this.module = module;
|
|
36
|
+
this.clock = options.clock ?? Date.now;
|
|
37
|
+
this.onUnavailable = edge.onUnavailable;
|
|
38
|
+
this.grants = new LocalGrants(this.clock);
|
|
39
|
+
this.shared =
|
|
40
|
+
edge.replay.store === "memory"
|
|
41
|
+
? memoryReplay()
|
|
42
|
+
: postgresReplay({
|
|
43
|
+
databaseUrl: () => options.secrets
|
|
44
|
+
.get("EXECUTOR_EDGE_REPLAY_DATABASE_URL")
|
|
45
|
+
.use((value) => value.toString("utf8").trim()),
|
|
46
|
+
namespace: edge.orgId,
|
|
47
|
+
table: edge.replay.table,
|
|
48
|
+
clock: this.clock,
|
|
49
|
+
...(options.loadPg === undefined ? {} : { load: options.loadPg }),
|
|
50
|
+
});
|
|
51
|
+
this.replay = this.shared.store;
|
|
52
|
+
this.bundles = new EdgeBundleManager({
|
|
53
|
+
module,
|
|
54
|
+
source,
|
|
55
|
+
orgId: edge.orgId,
|
|
56
|
+
refreshSeconds: edge.refreshSeconds,
|
|
57
|
+
clock: this.clock,
|
|
58
|
+
onEvent: (event) => events.emit(event),
|
|
59
|
+
});
|
|
60
|
+
const url = edge.bundle.source === "url";
|
|
61
|
+
const delivery = url
|
|
62
|
+
? new UrlUsageDelivery({
|
|
63
|
+
baseUrl: config.authority.baseUrl,
|
|
64
|
+
apiKey: options.apiKey,
|
|
65
|
+
fetch: options.fetch,
|
|
66
|
+
})
|
|
67
|
+
: edge.usage.reportDir === null
|
|
68
|
+
? null
|
|
69
|
+
: new FileUsageDelivery(edge.usage.reportDir);
|
|
70
|
+
this.usage = new UsageMeter({
|
|
71
|
+
orgId: edge.orgId,
|
|
72
|
+
chain: options.chain,
|
|
73
|
+
installationId: edge.usage.installationId,
|
|
74
|
+
stateDir: config.evidence.journalDir === null ? null : join(config.evidence.journalDir, "edge"),
|
|
75
|
+
checkpointLines: config.evidence.checkpointLines,
|
|
76
|
+
events,
|
|
77
|
+
key,
|
|
78
|
+
delivery,
|
|
79
|
+
clock: this.clock,
|
|
80
|
+
});
|
|
81
|
+
this.licence = new EdgeLicence({
|
|
82
|
+
source: url
|
|
83
|
+
? new UrlEntitlementSource({
|
|
84
|
+
baseUrl: config.authority.baseUrl,
|
|
85
|
+
apiKey: options.apiKey,
|
|
86
|
+
fetch: options.fetch,
|
|
87
|
+
})
|
|
88
|
+
: new FileEntitlementSource(edge.entitlement.file, edge.entitlement.jwksFile),
|
|
89
|
+
meter: this.usage,
|
|
90
|
+
orgId: edge.orgId,
|
|
91
|
+
events,
|
|
92
|
+
clock: this.clock,
|
|
93
|
+
});
|
|
94
|
+
if (key !== null) {
|
|
95
|
+
// The kid an operator registers as a `usage_report` provider key.
|
|
96
|
+
events.emit({
|
|
97
|
+
event: "EDGE_USAGE_KEY_LOADED",
|
|
98
|
+
kid: key().kid,
|
|
99
|
+
installation_id: this.usage.installationId,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The runtime the configuration asks for, or null for a hosted deployment.
|
|
105
|
+
* A module that cannot be read, is not WebAssembly, or is not ABI 3, and a
|
|
106
|
+
* usage-report key that is not an Ed25519 private key, are refusals to
|
|
107
|
+
* start that name the variable and the reason, never a deployment that
|
|
108
|
+
* quietly decides hosted instead.
|
|
109
|
+
*/
|
|
110
|
+
static create(options) {
|
|
111
|
+
const edge = options.config.edge;
|
|
112
|
+
if (edge === null)
|
|
113
|
+
return null;
|
|
114
|
+
let module;
|
|
115
|
+
try {
|
|
116
|
+
module = (options.loadModule ?? EdgeModule.fromFile)(edge.wasmPath);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
const code = error instanceof EdgeModuleError ? error.code : "EDGE_MODULE_INVALID";
|
|
120
|
+
throw new Error(`CONFIG_INVALID: EXECUTOR_EDGE_WASM_PATH (${code})`);
|
|
121
|
+
}
|
|
122
|
+
let key = null;
|
|
123
|
+
if (edge.usage.signing) {
|
|
124
|
+
// Read at each use, so a rotated key file is followed; checked once here.
|
|
125
|
+
key = () => usageSigningKey(options.secrets
|
|
126
|
+
.get("EXECUTOR_EDGE_USAGE_SIGNING_KEY")
|
|
127
|
+
.use((value) => value.toString("utf8")), edge.usage.keyId);
|
|
128
|
+
try {
|
|
129
|
+
key();
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
throw new Error("CONFIG_INVALID: EXECUTOR_EDGE_USAGE_SIGNING_KEY (not an Ed25519 key)");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const source = edge.bundle.source === "file"
|
|
136
|
+
? new FileBundleSource(edge.bundle.file)
|
|
137
|
+
: new UrlBundleSource({
|
|
138
|
+
baseUrl: options.config.authority.baseUrl,
|
|
139
|
+
apiKey: options.apiKey,
|
|
140
|
+
allowInsecureLoopback: options.config.authority.allowInsecureLoopback,
|
|
141
|
+
fetch: options.fetch,
|
|
142
|
+
});
|
|
143
|
+
return new EdgeRuntime(options, module, source, key);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Links one local decision, or a local attempt's outcome, on the evidence
|
|
147
|
+
* chain. A decision is counted as its line is written, with the sequence
|
|
148
|
+
* and hash that line carries, so the count is the chain's own.
|
|
149
|
+
*/
|
|
150
|
+
record(record) {
|
|
151
|
+
// The record holds identifiers, codes and digests only; copied as JSON so
|
|
152
|
+
// the chain links exactly what the line will say.
|
|
153
|
+
const fields = JSON.parse(JSON.stringify(record));
|
|
154
|
+
const at = new Date(this.clock()).toISOString();
|
|
155
|
+
const chain = this.options.chain;
|
|
156
|
+
chain.link({ at, ...fields, caller_principal: RequestContext.current()?.principal ?? null }, (line) => {
|
|
157
|
+
this.options.write(line);
|
|
158
|
+
if (record.event !== "EDGE_DECISION")
|
|
159
|
+
return;
|
|
160
|
+
this.usage.observe({
|
|
161
|
+
at,
|
|
162
|
+
mode: record.mode,
|
|
163
|
+
verdict: record.verdict,
|
|
164
|
+
delegated: record.delegated,
|
|
165
|
+
jti: record.jti,
|
|
166
|
+
seq: chain.head.seq,
|
|
167
|
+
hash: chain.head.hash,
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The replay store first: a shared store that cannot be reached is a
|
|
173
|
+
* refusal to start, since nothing could be run once. Then the first
|
|
174
|
+
* bundle fetch, the first usage report and licence check, and the hourly
|
|
175
|
+
* schedule for both and for removing lapsed claims.
|
|
176
|
+
*/
|
|
177
|
+
async start() {
|
|
178
|
+
try {
|
|
179
|
+
await this.shared.ready();
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
const code = error instanceof Error && error.message === "REPLAY_DRIVER_MISSING"
|
|
183
|
+
? "REPLAY_DRIVER_MISSING"
|
|
184
|
+
: "REPLAY_STORE_UNAVAILABLE";
|
|
185
|
+
throw new Error(`CONFIG_INVALID: EXECUTOR_EDGE_REPLAY_DATABASE_URL (${code})`);
|
|
186
|
+
}
|
|
187
|
+
await this.bundles.start();
|
|
188
|
+
await this.tick();
|
|
189
|
+
this.timer = setInterval(() => void this.tick(), TICK_MS);
|
|
190
|
+
this.timer.unref();
|
|
191
|
+
}
|
|
192
|
+
/** One round of housekeeping. Never throws, and touches no decision. */
|
|
193
|
+
async tick() {
|
|
194
|
+
await this.usage.report();
|
|
195
|
+
await this.licence.check();
|
|
196
|
+
await this.shared.cleanup().catch(() => {
|
|
197
|
+
this.options.events.emit({ event: "EDGE_REPLAY_CLEANUP_FAILED" });
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
stop() {
|
|
201
|
+
if (this.timer !== null)
|
|
202
|
+
clearInterval(this.timer);
|
|
203
|
+
this.timer = null;
|
|
204
|
+
this.bundles.stop();
|
|
205
|
+
this.usage.stop();
|
|
206
|
+
void this.shared.close().catch(() => undefined);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=EdgeRuntime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EdgeRuntime.js","sourceRoot":"","sources":["../../src/service/EdgeRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,eAAe,GAMhB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,YAAY,EAA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I,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAClD,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { type AuditRecorder, type CapturedIntent, type DecionisGate, type GateDecision, type PresenceApprovalClient } from "@decionis/agent-safe-pipeline";
|
|
2
|
+
import { type AuditRecorder, type CapturedIntent, type DecionisGate, type DecisionAuthority, type GateDecision, type PresenceApprovalClient } from "@decionis/agent-safe-pipeline";
|
|
3
3
|
import type { EscalationConfig } from "../config/ExecutorConfig.js";
|
|
4
4
|
import type { FetchLike } from "../handlers/HandlerRegistration.js";
|
|
5
5
|
/**
|
|
@@ -45,6 +45,67 @@ export declare const EscalationHandoffSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
45
45
|
}, z.core.$strict>;
|
|
46
46
|
}, z.core.$strict>], "mode">;
|
|
47
47
|
export type EscalationHandoff = z.infer<typeof EscalationHandoffSchema>;
|
|
48
|
+
/**
|
|
49
|
+
* A presence provider's attestation presented for an open escalation: the
|
|
50
|
+
* exact intent, and the compact JWS the provider signed over it (a
|
|
51
|
+
* cardholder's tap, for instance). It is evidence for a fresh evaluation,
|
|
52
|
+
* never authority; this process shapes and bounds it, sends it to the
|
|
53
|
+
* authority, which verifies it, and keeps nothing of it.
|
|
54
|
+
*/
|
|
55
|
+
export declare const AttestationResumeSchema: z.ZodObject<{
|
|
56
|
+
mode: z.ZodLiteral<"ATTESTATION">;
|
|
57
|
+
intent: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
58
|
+
attestation: z.ZodString;
|
|
59
|
+
}, z.core.$strict>;
|
|
60
|
+
/** What `/v1/escalations` accepts: a handoff it was given, or an attestation for the intent. */
|
|
61
|
+
export declare const EscalationResumeSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
62
|
+
mode: z.ZodLiteral<"DIRECT">;
|
|
63
|
+
intent: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
64
|
+
request_id: z.ZodString;
|
|
65
|
+
approval_url: z.ZodNullable<z.ZodString>;
|
|
66
|
+
expires_at: z.ZodNullable<z.ZodString>;
|
|
67
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
68
|
+
mode: z.ZodLiteral<"MANAGED">;
|
|
69
|
+
intent: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
70
|
+
escalation: z.ZodObject<{
|
|
71
|
+
escalationId: z.ZodString;
|
|
72
|
+
intentId: z.ZodString;
|
|
73
|
+
status: z.ZodEnum<{
|
|
74
|
+
FAILED: "FAILED";
|
|
75
|
+
PENDING_PRESENCE: "PENDING_PRESENCE";
|
|
76
|
+
PRESENCE_REQUESTED: "PRESENCE_REQUESTED";
|
|
77
|
+
AWAITING_APPROVER: "AWAITING_APPROVER";
|
|
78
|
+
PRESENCE_VERIFIED: "PRESENCE_VERIFIED";
|
|
79
|
+
REAUTHORIZING: "REAUTHORIZING";
|
|
80
|
+
GRANT_READY: "GRANT_READY";
|
|
81
|
+
EXPIRED: "EXPIRED";
|
|
82
|
+
REJECTED: "REJECTED";
|
|
83
|
+
BLOCKED: "BLOCKED";
|
|
84
|
+
CANCELLED: "CANCELLED";
|
|
85
|
+
}>;
|
|
86
|
+
outcome: z.ZodEnum<{
|
|
87
|
+
ALLOW: "ALLOW";
|
|
88
|
+
BLOCK: "BLOCK";
|
|
89
|
+
ESCALATE_PENDING: "ESCALATE_PENDING";
|
|
90
|
+
ERROR: "ERROR";
|
|
91
|
+
}>;
|
|
92
|
+
expiresAt: z.ZodString;
|
|
93
|
+
reasonCodes: z.ZodReadonly<z.ZodArray<z.ZodString>>;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
}, z.core.$strict>], "mode">, z.ZodObject<{
|
|
96
|
+
mode: z.ZodLiteral<"ATTESTATION">;
|
|
97
|
+
intent: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
98
|
+
attestation: z.ZodString;
|
|
99
|
+
}, z.core.$strict>]>;
|
|
100
|
+
export type EscalationResume = z.infer<typeof EscalationResumeSchema>;
|
|
101
|
+
/**
|
|
102
|
+
* What the caller is handed when an escalation can be resumed with an
|
|
103
|
+
* attestation and nothing else: the exact intent, to present back with it.
|
|
104
|
+
*/
|
|
105
|
+
export interface AttestationHandoff {
|
|
106
|
+
readonly mode: "ATTESTATION";
|
|
107
|
+
readonly intent: Record<string, unknown>;
|
|
108
|
+
}
|
|
48
109
|
type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
49
110
|
/** The handoff without the intent: what a mode knows, and what is echoed while pending. */
|
|
50
111
|
export type EscalationState = DistributiveOmit<EscalationHandoff, "intent">;
|
|
@@ -75,11 +136,23 @@ export interface EscalationDependencies {
|
|
|
75
136
|
export declare class EscalationResolver {
|
|
76
137
|
private readonly config;
|
|
77
138
|
private readonly gate;
|
|
139
|
+
/**
|
|
140
|
+
* What makes the first decision: the gate, unless an edge authority
|
|
141
|
+
* decides in front of it. Resumption is always the gate's: a ceremony's
|
|
142
|
+
* status and the re-evaluation with its receipt are hosted.
|
|
143
|
+
*/
|
|
144
|
+
private readonly first;
|
|
78
145
|
private readonly coordinator;
|
|
79
146
|
private readonly presence;
|
|
80
147
|
constructor(config: EscalationConfig, gate: DecionisGate, audit: AuditRecorder, dependencies?: EscalationDependencies,
|
|
81
148
|
/** The Presence credential for `DIRECT`, read from its handle by the caller for this build. */
|
|
82
|
-
presenceApiKey?: string | null
|
|
149
|
+
presenceApiKey?: string | null,
|
|
150
|
+
/**
|
|
151
|
+
* What makes the first decision: the gate, unless an edge authority
|
|
152
|
+
* decides in front of it. Resumption is always the gate's: a ceremony's
|
|
153
|
+
* status and the re-evaluation with its receipt are hosted.
|
|
154
|
+
*/
|
|
155
|
+
first?: DecisionAuthority);
|
|
83
156
|
get mode(): EscalationConfig["mode"];
|
|
84
157
|
/** The first evaluation: in managed mode it also asks the authority to orchestrate. */
|
|
85
158
|
evaluate(captured: CapturedIntent): Promise<GateDecision>;
|
|
@@ -88,6 +161,13 @@ export declare class EscalationResolver {
|
|
|
88
161
|
* the Presence request, bound to the intent hash the person will see.
|
|
89
162
|
*/
|
|
90
163
|
handoff(captured: CapturedIntent, decision: GateDecision): Promise<EscalationState | null>;
|
|
164
|
+
/**
|
|
165
|
+
* A fresh evaluation of the same intent with a presence attestation as the
|
|
166
|
+
* approval evidence. Whatever the escalation shape, this asks for no
|
|
167
|
+
* orchestration: the authority verifies the attestation against the
|
|
168
|
+
* intent hash and decides, and a refusal is a fail-closed `BLOCK`.
|
|
169
|
+
*/
|
|
170
|
+
attest(captured: CapturedIntent, attestation: string): Promise<GateDecision>;
|
|
91
171
|
/** One bounded lookup, then either a fresh decision or the state to report. */
|
|
92
172
|
resume(captured: CapturedIntent, handoff: EscalationHandoff): Promise<EscalationResolution>;
|
|
93
173
|
private resumeManaged;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EscalationResolver.d.ts","sourceRoot":"","sources":["../../src/service/EscalationResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,EAEjB,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAIpE;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAgClC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAA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AAM,CACjB,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,oBAAoB,CAAC;YAQlB,aAAa;YA8Bb,YAAY;CAkC3B"}
|
|
@@ -42,6 +42,23 @@ export const EscalationHandoffSchema = z.discriminatedUnion("mode", [
|
|
|
42
42
|
}),
|
|
43
43
|
}),
|
|
44
44
|
]);
|
|
45
|
+
/**
|
|
46
|
+
* A presence provider's attestation presented for an open escalation: the
|
|
47
|
+
* exact intent, and the compact JWS the provider signed over it (a
|
|
48
|
+
* cardholder's tap, for instance). It is evidence for a fresh evaluation,
|
|
49
|
+
* never authority; this process shapes and bounds it, sends it to the
|
|
50
|
+
* authority, which verifies it, and keeps nothing of it.
|
|
51
|
+
*/
|
|
52
|
+
export const AttestationResumeSchema = z.strictObject({
|
|
53
|
+
mode: z.literal("ATTESTATION"),
|
|
54
|
+
intent: z.record(z.string(), z.unknown()),
|
|
55
|
+
attestation: z
|
|
56
|
+
.string()
|
|
57
|
+
.max(20_000)
|
|
58
|
+
.regex(/^[\w-]+\.[\w-]+\.[\w-]+$/),
|
|
59
|
+
});
|
|
60
|
+
/** What `/v1/escalations` accepts: a handoff it was given, or an attestation for the intent. */
|
|
61
|
+
export const EscalationResumeSchema = z.union([EscalationHandoffSchema, AttestationResumeSchema]);
|
|
45
62
|
/**
|
|
46
63
|
* Resolves an `ESCALATE` in the shape the adopter configured. Both shapes
|
|
47
64
|
* are stateless on this side: the handoff the caller presents is validated
|
|
@@ -51,13 +68,21 @@ export const EscalationHandoffSchema = z.discriminatedUnion("mode", [
|
|
|
51
68
|
export class EscalationResolver {
|
|
52
69
|
config;
|
|
53
70
|
gate;
|
|
71
|
+
first;
|
|
54
72
|
coordinator;
|
|
55
73
|
presence;
|
|
56
74
|
constructor(config, gate, audit, dependencies = {},
|
|
57
75
|
/** The Presence credential for `DIRECT`, read from its handle by the caller for this build. */
|
|
58
|
-
presenceApiKey = null
|
|
76
|
+
presenceApiKey = null,
|
|
77
|
+
/**
|
|
78
|
+
* What makes the first decision: the gate, unless an edge authority
|
|
79
|
+
* decides in front of it. Resumption is always the gate's: a ceremony's
|
|
80
|
+
* status and the re-evaluation with its receipt are hosted.
|
|
81
|
+
*/
|
|
82
|
+
first = gate) {
|
|
59
83
|
this.config = config;
|
|
60
84
|
this.gate = gate;
|
|
85
|
+
this.first = first;
|
|
61
86
|
if (config.mode !== "DIRECT") {
|
|
62
87
|
this.coordinator = null;
|
|
63
88
|
this.presence = null;
|
|
@@ -81,8 +106,8 @@ export class EscalationResolver {
|
|
|
81
106
|
/** The first evaluation: in managed mode it also asks the authority to orchestrate. */
|
|
82
107
|
async evaluate(captured) {
|
|
83
108
|
if (this.config.mode !== "MANAGED")
|
|
84
|
-
return await this.
|
|
85
|
-
return await this.
|
|
109
|
+
return await this.first.evaluate(captured);
|
|
110
|
+
return await this.first.evaluate(captured, undefined, {
|
|
86
111
|
escalation: {
|
|
87
112
|
mode: "MANAGED",
|
|
88
113
|
approver: {
|
|
@@ -124,6 +149,17 @@ export class EscalationResolver {
|
|
|
124
149
|
expires_at: result.expires_at ?? null,
|
|
125
150
|
};
|
|
126
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* A fresh evaluation of the same intent with a presence attestation as the
|
|
154
|
+
* approval evidence. Whatever the escalation shape, this asks for no
|
|
155
|
+
* orchestration: the authority verifies the attestation against the
|
|
156
|
+
* intent hash and decides, and a refusal is a fail-closed `BLOCK`.
|
|
157
|
+
*/
|
|
158
|
+
async attest(captured, attestation) {
|
|
159
|
+
return await this.gate.evaluate(captured, {
|
|
160
|
+
humanApproval: { provider: "attestation", attestation },
|
|
161
|
+
});
|
|
162
|
+
}
|
|
127
163
|
/** One bounded lookup, then either a fresh decision or the state to report. */
|
|
128
164
|
async resume(captured, handoff) {
|
|
129
165
|
if (handoff.mode !== this.config.mode) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EscalationResolver.js","sourceRoot":"","sources":["../../src/service/Escalation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;QACtF,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,KAAK,gBAAgB,EAAE,CAAC;YACzC,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE,OAAO,CAAC,UAAU;oBAC9B,YAAY,EAAE,OAAO,CAAC,YAAY;oBAClC,UAAU,EAAE,OAAO,CAAC,UAAU;iBAC/B;gBACD,WAAW,EAAE,CAAC,yBAAyB,CAAC;aACzC,CAAC;QACJ,CAAC;QACD,0EAA0E;QAC1E,yEAAyE;QACzE,yEAAyE;QACzE,sCAAsC;QACtC,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,MAAM,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,QAAQ,EAAE,OAAO,CAAC;SAC1E,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type CapturedIntent, type ExecutionRecoveryReference } from "@decionis/agent-safe-pipeline";
|
|
3
3
|
import type { ExecutorMode } from "../config/ExecutorConfig.js";
|
|
4
|
-
import type { EscalationHandoff } from "./EscalationResolver.js";
|
|
4
|
+
import type { AttestationHandoff, EscalationHandoff } from "./EscalationResolver.js";
|
|
5
5
|
/**
|
|
6
6
|
* What the caller sends. `proposal` is the agent's part and nothing else:
|
|
7
7
|
* tenant, actor, downstream target and credentials come from the executor's
|
|
@@ -83,7 +83,7 @@ export interface ActionResponse {
|
|
|
83
83
|
readonly reference: ExecutionRecoveryReference;
|
|
84
84
|
} | null;
|
|
85
85
|
/** Present while an escalation is open: what to present to resume. */
|
|
86
|
-
readonly escalation: EscalationHandoff | null;
|
|
86
|
+
readonly escalation: EscalationHandoff | AttestationHandoff | null;
|
|
87
87
|
}
|
|
88
88
|
export interface ReconciliationResponse {
|
|
89
89
|
readonly intent_id: string;
|
|
@@ -96,4 +96,30 @@ export interface ReconciliationResponse {
|
|
|
96
96
|
readonly result: unknown;
|
|
97
97
|
readonly effect: Readonly<Record<string, unknown>> | null;
|
|
98
98
|
}
|
|
99
|
+
/** What the issuer's authorization hook is answered: approve on a held grant, or no match and why. */
|
|
100
|
+
export type CardAuthorizationAnswer = {
|
|
101
|
+
readonly decision: "APPROVE";
|
|
102
|
+
readonly authorization_id: string;
|
|
103
|
+
readonly intent_id: string;
|
|
104
|
+
readonly intent_hash: string;
|
|
105
|
+
readonly decision_id: string;
|
|
106
|
+
readonly dossier_id: string;
|
|
107
|
+
readonly grant_id: string;
|
|
108
|
+
/** Until when a result is recorded as an outcome; after it, as indeterminate. */
|
|
109
|
+
readonly lease_expires_at: string;
|
|
110
|
+
} | {
|
|
111
|
+
readonly decision: "NO_MATCH";
|
|
112
|
+
readonly code: string;
|
|
113
|
+
};
|
|
114
|
+
/** What a recorded authorization result became: the commit outcome and the effect observed. */
|
|
115
|
+
export interface CardResultResponse {
|
|
116
|
+
readonly authorization_id: string;
|
|
117
|
+
readonly intent_id: string;
|
|
118
|
+
readonly intent_hash: string;
|
|
119
|
+
readonly outcome: "COMMITTED" | "FAILED" | "INDETERMINATE";
|
|
120
|
+
readonly executed: boolean | null;
|
|
121
|
+
readonly finalization: "RECORDED" | "PENDING" | "UNSUPPORTED";
|
|
122
|
+
readonly reason_codes: readonly string[];
|
|
123
|
+
readonly effect: Readonly<Record<string, unknown>> | null;
|
|
124
|
+
}
|
|
99
125
|
//# sourceMappingURL=Requests.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Requests.d.ts","sourceRoot":"","sources":["../../src/service/Requests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAChC,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EA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