@decionis/agent-safe-pipeline 0.3.4 → 0.3.6
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 +5 -4
- package/dist/Index.d.ts +7 -0
- package/dist/Index.d.ts.map +1 -1
- package/dist/Index.js +7 -0
- package/dist/Index.js.map +1 -1
- package/dist/audit/AuditRecorder.d.ts +1 -1
- package/dist/audit/AuditRecorder.d.ts.map +1 -1
- package/dist/audit/AuditRecorder.js.map +1 -1
- package/dist/decision/DecionisGate.d.ts +11 -1
- package/dist/decision/DecionisGate.d.ts.map +1 -1
- package/dist/decision/DecionisGate.js +52 -4
- package/dist/decision/DecionisGate.js.map +1 -1
- package/dist/decision/DecisionAuthority.d.ts +15 -1
- package/dist/decision/DecisionAuthority.d.ts.map +1 -1
- package/dist/decision/DecisionAuthority.js.map +1 -1
- package/dist/decision/edge/BundleWindow.d.ts +43 -0
- package/dist/decision/edge/BundleWindow.d.ts.map +1 -0
- package/dist/decision/edge/BundleWindow.js +41 -0
- package/dist/decision/edge/BundleWindow.js.map +1 -0
- package/dist/decision/edge/EdgeBundleManager.d.ts +87 -0
- package/dist/decision/edge/EdgeBundleManager.d.ts.map +1 -0
- package/dist/decision/edge/EdgeBundleManager.js +175 -0
- package/dist/decision/edge/EdgeBundleManager.js.map +1 -0
- package/dist/decision/edge/EdgeBundleSource.d.ts +59 -0
- package/dist/decision/edge/EdgeBundleSource.d.ts.map +1 -0
- package/dist/decision/edge/EdgeBundleSource.js +99 -0
- package/dist/decision/edge/EdgeBundleSource.js.map +1 -0
- package/dist/decision/edge/EdgeDecisionAuthority.d.ts +104 -0
- package/dist/decision/edge/EdgeDecisionAuthority.d.ts.map +1 -0
- package/dist/decision/edge/EdgeDecisionAuthority.js +197 -0
- package/dist/decision/edge/EdgeDecisionAuthority.js.map +1 -0
- package/dist/decision/edge/EdgeModule.d.ts +63 -0
- package/dist/decision/edge/EdgeModule.d.ts.map +1 -0
- package/dist/decision/edge/EdgeModule.js +147 -0
- package/dist/decision/edge/EdgeModule.js.map +1 -0
- package/dist/execution/ActionRegistry.d.ts +23 -0
- package/dist/execution/ActionRegistry.d.ts.map +1 -1
- package/dist/execution/ActionRegistry.js +32 -2
- package/dist/execution/ActionRegistry.js.map +1 -1
- package/dist/execution/AuthorizationVerifier.d.ts.map +1 -1
- package/dist/execution/AuthorizationVerifier.js +7 -2
- package/dist/execution/AuthorizationVerifier.js.map +1 -1
- package/dist/execution/LocalAuthorizationVerifier.d.ts +70 -0
- package/dist/execution/LocalAuthorizationVerifier.d.ts.map +1 -0
- package/dist/execution/LocalAuthorizationVerifier.js +119 -0
- package/dist/execution/LocalAuthorizationVerifier.js.map +1 -0
- package/dist/execution/PostgresReplayStore.d.ts +57 -0
- package/dist/execution/PostgresReplayStore.d.ts.map +1 -0
- package/dist/execution/PostgresReplayStore.js +81 -0
- package/dist/execution/PostgresReplayStore.js.map +1 -0
- package/dist/execution/ReplayStore.d.ts +14 -0
- package/dist/execution/ReplayStore.d.ts.map +1 -1
- package/dist/execution/ReplayStore.js +8 -0
- package/dist/execution/ReplayStore.js.map +1 -1
- package/dist/execution/SafeExecutor.d.ts +125 -3
- package/dist/execution/SafeExecutor.d.ts.map +1 -1
- package/dist/execution/SafeExecutor.js +242 -68
- package/dist/execution/SafeExecutor.js.map +1 -1
- package/dist/intent/ExecutionIntent.d.ts +32 -0
- package/dist/intent/ExecutionIntent.d.ts.map +1 -1
- package/dist/intent/ExecutionIntent.js +7 -0
- package/dist/intent/ExecutionIntent.js.map +1 -1
- package/dist/intent/ExecutionSignals.d.ts +124 -0
- package/dist/intent/ExecutionSignals.d.ts.map +1 -0
- package/dist/intent/ExecutionSignals.js +124 -0
- package/dist/intent/ExecutionSignals.js.map +1 -0
- package/dist/intent/IntentCapture.d.ts.map +1 -1
- package/dist/intent/IntentCapture.js +9 -2
- package/dist/intent/IntentCapture.js.map +1 -1
- package/dist/testing/LocalAuthority.d.ts +17 -2
- package/dist/testing/LocalAuthority.d.ts.map +1 -1
- package/dist/testing/LocalAuthority.js +38 -1
- package/dist/testing/LocalAuthority.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { JsonObject } from "./JsonValue.js";
|
|
3
|
+
export declare const RESERVED_CONTEXT_BOUNDARY = "enforcement_boundary";
|
|
4
|
+
export declare const RESERVED_CONTEXT_WORKLOAD = "workload";
|
|
5
|
+
/** Every reserved context key, so one refusal covers them all. */
|
|
6
|
+
export declare const RESERVED_CONTEXT_KEYS: readonly ["enforcement_boundary", "workload"];
|
|
7
|
+
/**
|
|
8
|
+
* Where the boundary sits, as the operator configured it. Only stable
|
|
9
|
+
* placement belongs here: it survives a restart, it is what a policy means by
|
|
10
|
+
* "production in eu", and it is safe to sign. A container id, a pod name or a
|
|
11
|
+
* node name is none of those things, so the instance an effect passed through
|
|
12
|
+
* is reported locally and never bound into evidence.
|
|
13
|
+
*/
|
|
14
|
+
export declare const BoundaryPlacementSchema: z.ZodObject<{
|
|
15
|
+
cluster_id: z.ZodOptional<z.ZodString>;
|
|
16
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
17
|
+
region: z.ZodOptional<z.ZodString>;
|
|
18
|
+
workload_id: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
/**
|
|
21
|
+
* Which enforcement boundary admitted this intent. A dossier carrying it can
|
|
22
|
+
* answer which of an estate's gateways stood in front of the effect.
|
|
23
|
+
*/
|
|
24
|
+
export declare const EnforcementBoundarySignalSchema: z.ZodObject<{
|
|
25
|
+
boundary_id: z.ZodString;
|
|
26
|
+
agentsafe_version: z.ZodString;
|
|
27
|
+
protocol_version: z.ZodLiteral<"agent-safe.intent/1">;
|
|
28
|
+
deployment_type: z.ZodString;
|
|
29
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
30
|
+
conformance_version: z.ZodOptional<z.ZodString>;
|
|
31
|
+
placement: z.ZodOptional<z.ZodObject<{
|
|
32
|
+
cluster_id: z.ZodOptional<z.ZodString>;
|
|
33
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
34
|
+
region: z.ZodOptional<z.ZodString>;
|
|
35
|
+
workload_id: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$strict>>;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
/** How far the runtime that reported a workload can be trusted about it. */
|
|
39
|
+
export declare const WORKLOAD_TRUST_LEVELS: readonly ["unverified", "supplied", "observed", "verified"];
|
|
40
|
+
export declare const WorkloadProvenanceSchema: z.ZodObject<{
|
|
41
|
+
source: z.ZodString;
|
|
42
|
+
trust_level: z.ZodEnum<{
|
|
43
|
+
unverified: "unverified";
|
|
44
|
+
supplied: "supplied";
|
|
45
|
+
observed: "observed";
|
|
46
|
+
verified: "verified";
|
|
47
|
+
}>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
/**
|
|
50
|
+
* What software proposed the action, as the runtime reported it. AgentSafe is
|
|
51
|
+
* not the authority for any of it: the fields are carried, never established,
|
|
52
|
+
* and `provenance` says who said so and how far that goes.
|
|
53
|
+
*/
|
|
54
|
+
export declare const WorkloadSignalSchema: z.ZodObject<{
|
|
55
|
+
runtime: z.ZodOptional<z.ZodString>;
|
|
56
|
+
artifact_type: z.ZodOptional<z.ZodString>;
|
|
57
|
+
image: z.ZodOptional<z.ZodString>;
|
|
58
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
59
|
+
publisher: z.ZodOptional<z.ZodString>;
|
|
60
|
+
provenance: z.ZodObject<{
|
|
61
|
+
source: z.ZodString;
|
|
62
|
+
trust_level: z.ZodEnum<{
|
|
63
|
+
unverified: "unverified";
|
|
64
|
+
supplied: "supplied";
|
|
65
|
+
observed: "observed";
|
|
66
|
+
verified: "verified";
|
|
67
|
+
}>;
|
|
68
|
+
}, z.core.$strict>;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
export declare const ExecutionSignalsSchema: z.ZodObject<{
|
|
71
|
+
boundary: z.ZodOptional<z.ZodObject<{
|
|
72
|
+
boundary_id: z.ZodString;
|
|
73
|
+
agentsafe_version: z.ZodString;
|
|
74
|
+
protocol_version: z.ZodLiteral<"agent-safe.intent/1">;
|
|
75
|
+
deployment_type: z.ZodString;
|
|
76
|
+
environment: z.ZodOptional<z.ZodString>;
|
|
77
|
+
conformance_version: z.ZodOptional<z.ZodString>;
|
|
78
|
+
placement: z.ZodOptional<z.ZodObject<{
|
|
79
|
+
cluster_id: z.ZodOptional<z.ZodString>;
|
|
80
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
81
|
+
region: z.ZodOptional<z.ZodString>;
|
|
82
|
+
workload_id: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, z.core.$strict>>;
|
|
84
|
+
}, z.core.$strict>>;
|
|
85
|
+
workload: z.ZodOptional<z.ZodObject<{
|
|
86
|
+
runtime: z.ZodOptional<z.ZodString>;
|
|
87
|
+
artifact_type: z.ZodOptional<z.ZodString>;
|
|
88
|
+
image: z.ZodOptional<z.ZodString>;
|
|
89
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
90
|
+
publisher: z.ZodOptional<z.ZodString>;
|
|
91
|
+
provenance: z.ZodObject<{
|
|
92
|
+
source: z.ZodString;
|
|
93
|
+
trust_level: z.ZodEnum<{
|
|
94
|
+
unverified: "unverified";
|
|
95
|
+
supplied: "supplied";
|
|
96
|
+
observed: "observed";
|
|
97
|
+
verified: "verified";
|
|
98
|
+
}>;
|
|
99
|
+
}, z.core.$strict>;
|
|
100
|
+
}, z.core.$strict>>;
|
|
101
|
+
}, z.core.$strict>;
|
|
102
|
+
export type BoundaryPlacement = z.infer<typeof BoundaryPlacementSchema>;
|
|
103
|
+
export type EnforcementBoundarySignal = z.infer<typeof EnforcementBoundarySignalSchema>;
|
|
104
|
+
export type WorkloadTrustLevel = (typeof WORKLOAD_TRUST_LEVELS)[number];
|
|
105
|
+
export type WorkloadProvenance = z.infer<typeof WorkloadProvenanceSchema>;
|
|
106
|
+
export type WorkloadSignal = z.infer<typeof WorkloadSignalSchema>;
|
|
107
|
+
export type ExecutionSignals = z.infer<typeof ExecutionSignalsSchema>;
|
|
108
|
+
/**
|
|
109
|
+
* The reserved entries a set of signals contributes to a context. Absent
|
|
110
|
+
* signals contribute nothing at all: an intent without provenance carries no
|
|
111
|
+
* `workload` key rather than one claiming there is none, so a policy that
|
|
112
|
+
* requires provenance refuses on the signal's absence instead of matching a
|
|
113
|
+
* placeholder.
|
|
114
|
+
*/
|
|
115
|
+
export declare function signalContext(signals: ExecutionSignals): JsonObject;
|
|
116
|
+
/**
|
|
117
|
+
* The boundary an intent was captured through, read back from its context.
|
|
118
|
+
* Anything that does not parse is no boundary rather than a partial one, so a
|
|
119
|
+
* tampered context cannot satisfy a boundary check by resembling it.
|
|
120
|
+
*/
|
|
121
|
+
export declare function boundaryOf(context: JsonObject): EnforcementBoundarySignal | null;
|
|
122
|
+
/** The workload an intent was captured for, read back from its context. */
|
|
123
|
+
export declare function workloadOf(context: JsonObject): WorkloadSignal | null;
|
|
124
|
+
//# sourceMappingURL=ExecutionSignals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionSignals.d.ts","sourceRoot":"","sources":["../../src/intent/ExecutionSignals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA8BjD,eAAO,MAAM,yBAAyB,yBAAyB,CAAC;AAChE,eAAO,MAAM,yBAAyB,aAAa,CAAC;AAEpD,kEAAkE;AAClE,eAAO,MAAM,qBAAqB,+CAGxB,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;;;;;kBAOzB,CAAC;AAEZ;;;GAGG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;kBAUjC,CAAC;AAEZ,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,6DAA8D,CAAC;AAEjG,eAAO,MAAM,wBAAwB;;;;;;;;kBAK1B,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;kBAYtB,CAAC;AAEZ,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAKxB,CAAC;AAEZ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AACxE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,UAAU,CAMnE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,yBAAyB,GAAG,IAAI,CAGhF;AAED,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,cAAc,GAAG,IAAI,CAGrE"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Signals the trusted runtime binds into an intent so that policy can reason
|
|
4
|
+
* about them and evidence can carry them.
|
|
5
|
+
*
|
|
6
|
+
* They ride inside the hashed `context` under reserved keys rather than as
|
|
7
|
+
* new top-level properties, for the same reason the idempotency key does
|
|
8
|
+
* (`RESERVED_CONTEXT_IDEMPOTENCY_KEY`): the Decionis `ExecutionIntentBinding`
|
|
9
|
+
* contract declares `unevaluatedProperties: false` at the top level and
|
|
10
|
+
* `additionalProperties: true` on `context`. Every property of `context` is
|
|
11
|
+
* inside the canonical hash, so a signal bound here is bound as tightly as
|
|
12
|
+
* the action itself — an authority is issued against these exact bytes, and
|
|
13
|
+
* a signal changed after authorization no longer conforms.
|
|
14
|
+
*
|
|
15
|
+
* This is deliberately an extension of `agent-safe.intent/1` rather than a
|
|
16
|
+
* new protocol version: an intent that carries no signals hashes exactly as
|
|
17
|
+
* it did before, so every published conformance vector still holds.
|
|
18
|
+
*/
|
|
19
|
+
const bounded = (max) => z.string().trim().min(1).max(max);
|
|
20
|
+
/** A value a policy may match on: never free text from a request. */
|
|
21
|
+
const token = z
|
|
22
|
+
.string()
|
|
23
|
+
.trim()
|
|
24
|
+
.min(1)
|
|
25
|
+
.max(200)
|
|
26
|
+
.regex(/^[a-z0-9][\w.:/-]*$/i);
|
|
27
|
+
export const RESERVED_CONTEXT_BOUNDARY = "enforcement_boundary";
|
|
28
|
+
export const RESERVED_CONTEXT_WORKLOAD = "workload";
|
|
29
|
+
/** Every reserved context key, so one refusal covers them all. */
|
|
30
|
+
export const RESERVED_CONTEXT_KEYS = [
|
|
31
|
+
RESERVED_CONTEXT_BOUNDARY,
|
|
32
|
+
RESERVED_CONTEXT_WORKLOAD,
|
|
33
|
+
];
|
|
34
|
+
/**
|
|
35
|
+
* Where the boundary sits, as the operator configured it. Only stable
|
|
36
|
+
* placement belongs here: it survives a restart, it is what a policy means by
|
|
37
|
+
* "production in eu", and it is safe to sign. A container id, a pod name or a
|
|
38
|
+
* node name is none of those things, so the instance an effect passed through
|
|
39
|
+
* is reported locally and never bound into evidence.
|
|
40
|
+
*/
|
|
41
|
+
export const BoundaryPlacementSchema = z
|
|
42
|
+
.object({
|
|
43
|
+
cluster_id: token.optional(),
|
|
44
|
+
namespace: token.optional(),
|
|
45
|
+
region: token.optional(),
|
|
46
|
+
workload_id: token.optional(),
|
|
47
|
+
})
|
|
48
|
+
.strict();
|
|
49
|
+
/**
|
|
50
|
+
* Which enforcement boundary admitted this intent. A dossier carrying it can
|
|
51
|
+
* answer which of an estate's gateways stood in front of the effect.
|
|
52
|
+
*/
|
|
53
|
+
export const EnforcementBoundarySignalSchema = z
|
|
54
|
+
.object({
|
|
55
|
+
boundary_id: token,
|
|
56
|
+
agentsafe_version: bounded(80),
|
|
57
|
+
protocol_version: z.literal("agent-safe.intent/1"),
|
|
58
|
+
deployment_type: token,
|
|
59
|
+
environment: token.optional(),
|
|
60
|
+
conformance_version: bounded(120).optional(),
|
|
61
|
+
placement: BoundaryPlacementSchema.optional(),
|
|
62
|
+
})
|
|
63
|
+
.strict();
|
|
64
|
+
/** How far the runtime that reported a workload can be trusted about it. */
|
|
65
|
+
export const WORKLOAD_TRUST_LEVELS = ["unverified", "supplied", "observed", "verified"];
|
|
66
|
+
export const WorkloadProvenanceSchema = z
|
|
67
|
+
.object({
|
|
68
|
+
source: token,
|
|
69
|
+
trust_level: z.enum(WORKLOAD_TRUST_LEVELS),
|
|
70
|
+
})
|
|
71
|
+
.strict();
|
|
72
|
+
/**
|
|
73
|
+
* What software proposed the action, as the runtime reported it. AgentSafe is
|
|
74
|
+
* not the authority for any of it: the fields are carried, never established,
|
|
75
|
+
* and `provenance` says who said so and how far that goes.
|
|
76
|
+
*/
|
|
77
|
+
export const WorkloadSignalSchema = z
|
|
78
|
+
.object({
|
|
79
|
+
runtime: token.optional(),
|
|
80
|
+
artifact_type: token.optional(),
|
|
81
|
+
image: bounded(500).optional(),
|
|
82
|
+
digest: z
|
|
83
|
+
.string()
|
|
84
|
+
.regex(/^sha256:[0-9a-f]{64}$/)
|
|
85
|
+
.optional(),
|
|
86
|
+
publisher: bounded(200).optional(),
|
|
87
|
+
provenance: WorkloadProvenanceSchema,
|
|
88
|
+
})
|
|
89
|
+
.strict();
|
|
90
|
+
export const ExecutionSignalsSchema = z
|
|
91
|
+
.object({
|
|
92
|
+
boundary: EnforcementBoundarySignalSchema.optional(),
|
|
93
|
+
workload: WorkloadSignalSchema.optional(),
|
|
94
|
+
})
|
|
95
|
+
.strict();
|
|
96
|
+
/**
|
|
97
|
+
* The reserved entries a set of signals contributes to a context. Absent
|
|
98
|
+
* signals contribute nothing at all: an intent without provenance carries no
|
|
99
|
+
* `workload` key rather than one claiming there is none, so a policy that
|
|
100
|
+
* requires provenance refuses on the signal's absence instead of matching a
|
|
101
|
+
* placeholder.
|
|
102
|
+
*/
|
|
103
|
+
export function signalContext(signals) {
|
|
104
|
+
const parsed = ExecutionSignalsSchema.parse(signals);
|
|
105
|
+
return {
|
|
106
|
+
...(parsed.boundary === undefined ? {} : { [RESERVED_CONTEXT_BOUNDARY]: parsed.boundary }),
|
|
107
|
+
...(parsed.workload === undefined ? {} : { [RESERVED_CONTEXT_WORKLOAD]: parsed.workload }),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The boundary an intent was captured through, read back from its context.
|
|
112
|
+
* Anything that does not parse is no boundary rather than a partial one, so a
|
|
113
|
+
* tampered context cannot satisfy a boundary check by resembling it.
|
|
114
|
+
*/
|
|
115
|
+
export function boundaryOf(context) {
|
|
116
|
+
const candidate = EnforcementBoundarySignalSchema.safeParse(context[RESERVED_CONTEXT_BOUNDARY]);
|
|
117
|
+
return candidate.success ? candidate.data : null;
|
|
118
|
+
}
|
|
119
|
+
/** The workload an intent was captured for, read back from its context. */
|
|
120
|
+
export function workloadOf(context) {
|
|
121
|
+
const candidate = WorkloadSignalSchema.safeParse(context[RESERVED_CONTEXT_WORKLOAD]);
|
|
122
|
+
return candidate.success ? candidate.data : null;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=ExecutionSignals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionSignals.js","sourceRoot":"","sources":["../../src/intent/ExecutionSignals.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AAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,yBAAyB,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC1F,GAAG,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,yBAAyB,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;KAC7E,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,OAAmB;IAC5C,MAAM,SAAS,GAAG,+BAA+B,CAAC,SAAS,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC;IAChG,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,UAAU,CAAC,OAAmB;IAC5C,MAAM,SAAS,GAAG,oBAAoB,CAAC,SAAS,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC;IACrF,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntentCapture.d.ts","sourceRoot":"","sources":["../../src/intent/IntentCapture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"IntentCapture.d.ts","sourceRoot":"","sources":["../../src/intent/IntentCapture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC;IACxC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,MAAM,CAAC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;IAC/C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA4B;gBAE/B,OAAO,CAAC,EAAE,oBAAoB;IAQ1C,OAAO,CAAC,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,GAAG,cAAc;IAsChG,6EAA6E;IAChE,eAAe,CAC1B,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,oBAAoB,GACjC,OAAO,CAAC,cAAc,CAAC;CAK3B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { AgentProposalSchema, ExecutionIntentSchema, RESERVED_CONTEXT_IDEMPOTENCY_KEY, TrustedIntentContextSchema, } from "./ExecutionIntent.js";
|
|
3
|
+
import { RESERVED_CONTEXT_KEYS, signalContext } from "./ExecutionSignals.js";
|
|
3
4
|
import { CanonicalIntentHasher } from "./CanonicalIntentHasher.js";
|
|
4
5
|
export class IntentCapture {
|
|
5
6
|
hasher;
|
|
@@ -19,7 +20,11 @@ export class IntentCapture {
|
|
|
19
20
|
this.hasher.assertInputBounded(trustedInput);
|
|
20
21
|
const proposal = AgentProposalSchema.parse(proposalInput);
|
|
21
22
|
const trusted = TrustedIntentContextSchema.parse(trustedInput);
|
|
22
|
-
|
|
23
|
+
// The reserved keys are the runtime's to write. A caller that sets one by
|
|
24
|
+
// hand is describing a boundary or a workload the capture did not observe,
|
|
25
|
+
// so the proposal is refused rather than silently overwritten.
|
|
26
|
+
const reserved = [RESERVED_CONTEXT_IDEMPOTENCY_KEY, ...RESERVED_CONTEXT_KEYS];
|
|
27
|
+
if (reserved.some((key) => Object.hasOwn(trusted.context, key))) {
|
|
23
28
|
throw new Error("INTENT_CONTEXT_KEY_RESERVED");
|
|
24
29
|
}
|
|
25
30
|
const capturedAt = this.clock();
|
|
@@ -35,7 +40,9 @@ export class IntentCapture {
|
|
|
35
40
|
target: proposal.target,
|
|
36
41
|
parameters: proposal.parameters,
|
|
37
42
|
downstreamTarget: trusted.downstreamTarget,
|
|
38
|
-
context: trusted.
|
|
43
|
+
context: trusted.signals === undefined
|
|
44
|
+
? trusted.context
|
|
45
|
+
: { ...trusted.context, ...signalContext(trusted.signals) },
|
|
39
46
|
...(trusted.correlationId === undefined ? {} : { correlationId: trusted.correlationId }),
|
|
40
47
|
...(trusted.expectedEffectDigest === undefined
|
|
41
48
|
? {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntentCapture.js","sourceRoot":"","sources":["../../src/intent/IntentCapture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,gCAAgC,EAChC,0BAA0B,GAI3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAUnE,MAAM,OAAO,aAAa;IACP,MAAM,CAAwB;IAC9B,KAAK,CAAa;IAClB,QAAQ,CAAe;IACvB,UAAU,CAA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C;IACrC,CAAC;IAED,6EAA6E;IACtE,KAAK,CAAC,eAAe,CAC1B,aAA4B,EAC5B,YAAkC;QAElC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;QAC3D,MAAM,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,CAAC;QACrE,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -36,11 +36,14 @@ declare const AuthorityRequestSchema: z.ZodObject<{
|
|
|
36
36
|
SHADOW: "SHADOW";
|
|
37
37
|
}>;
|
|
38
38
|
evidence: z.ZodOptional<z.ZodObject<{
|
|
39
|
-
humanApproval: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
humanApproval: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
40
40
|
provider: z.ZodLiteral<"presence">;
|
|
41
41
|
requestId: z.ZodString;
|
|
42
42
|
receiptDossierId: z.ZodString;
|
|
43
|
-
}, z.core.$strict
|
|
43
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
44
|
+
provider: z.ZodLiteral<"attestation">;
|
|
45
|
+
attestation: z.ZodString;
|
|
46
|
+
}, z.core.$strict>], "provider">>;
|
|
44
47
|
}, z.core.$strict>>;
|
|
45
48
|
escalation: z.ZodOptional<z.ZodObject<{
|
|
46
49
|
mode: z.ZodLiteral<"MANAGED">;
|
|
@@ -185,6 +188,17 @@ export interface LocalAuthorityOptions {
|
|
|
185
188
|
readonly receiptDossierId: string;
|
|
186
189
|
}, intentHash: string) => boolean;
|
|
187
190
|
readonly policy?: LocalAuthorityPolicy;
|
|
191
|
+
/**
|
|
192
|
+
* Stands in for the authority's verification of a presence attestation
|
|
193
|
+
* (signature under the provider's registered key, audience, expiry, intent
|
|
194
|
+
* binding). Absent, every attestation is refused as the hosted route
|
|
195
|
+
* refuses one it cannot verify, with `PRESENCE_ATTESTATION_SIGNATURE_INVALID`.
|
|
196
|
+
*/
|
|
197
|
+
readonly verifyAttestation?: (attestation: string, binding: {
|
|
198
|
+
readonly intentId: string;
|
|
199
|
+
readonly intentHash: string;
|
|
200
|
+
readonly tenantId: string;
|
|
201
|
+
}) => boolean;
|
|
188
202
|
/** Subject routed to for a managed escalation without an approver principal. */
|
|
189
203
|
readonly managedApproverId?: string;
|
|
190
204
|
/**
|
|
@@ -247,6 +261,7 @@ export declare class LocalAuthority {
|
|
|
247
261
|
private readonly apiKey;
|
|
248
262
|
private readonly presence;
|
|
249
263
|
private readonly legacyVerifyReceipt;
|
|
264
|
+
private readonly verifyAttestation;
|
|
250
265
|
private readonly policy;
|
|
251
266
|
private readonly managedApproverId;
|
|
252
267
|
private readonly trustedEffectObserverIds;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalAuthority.d.ts","sourceRoot":"","sources":["../../src/testing/LocalAuthority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAElE,eAAO,MAAM,uBAAuB,aAAa,CAAC;AAClD,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAC7C,eAAO,MAAM,iBAAiB,SAAU,CAAC;AAQzC,0FAA0F;AAC1F,eAAO,MAAM,sBAAsB,wBAAwB,CAAC;AAC5D,uFAAuF;AACvF,eAAO,MAAM,yBAAyB,oDAAoD,CAAC;AAC3F,eAAO,MAAM,sBAAsB,mCAAmC,CAAC;AACvE,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"LocalAuthority.d.ts","sourceRoot":"","sources":["../../src/testing/LocalAuthority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;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;IAgDrB,qGAAqG;IACrG,OAAO,CAAC,WAAW;IAgDnB,iGAAiG;IACjG,OAAO,CAAC,eAAe;IAiDvB,OAAO,CAAC,aAAa;IA8CrB,OAAO,CAAC,QAAQ;IA8BhB,qFAAqF;IACrF,OAAO,CAAC,OAAO;IAqDf,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,KAAK;IA+Fb,OAAO,CAAC,QAAQ;IAkHhB;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAIzB,+EAA+E;IAC/E,OAAO,CAAC,aAAa;YAiBP,OAAO;IAmCrB,OAAO,CAAC,IAAI;IAYZ,OAAO,CAAC,MAAM,CAAC,UAAU;CAU1B"}
|
|
@@ -154,12 +154,32 @@ const ManagedEscalationRequestSchema = z.strictObject({
|
|
|
154
154
|
})
|
|
155
155
|
.optional(),
|
|
156
156
|
});
|
|
157
|
+
/**
|
|
158
|
+
* `enforce-and-bind` evidence: a Presence receipt reference, or a presence
|
|
159
|
+
* provider's signed attestation (`AttestedHumanApprovalEvidence`). The claim
|
|
160
|
+
* route keeps the Presence shape only, as the contract does.
|
|
161
|
+
*/
|
|
162
|
+
const AuthorityEvidenceSchema = z.strictObject({
|
|
163
|
+
humanApproval: z
|
|
164
|
+
.discriminatedUnion("provider", [
|
|
165
|
+
z.strictObject({
|
|
166
|
+
provider: z.literal("presence"),
|
|
167
|
+
requestId: boundedId,
|
|
168
|
+
receiptDossierId: boundedId,
|
|
169
|
+
}),
|
|
170
|
+
z.strictObject({
|
|
171
|
+
provider: z.literal("attestation"),
|
|
172
|
+
attestation: z.string().max(20_000).regex(COMPACT_JWS),
|
|
173
|
+
}),
|
|
174
|
+
])
|
|
175
|
+
.optional(),
|
|
176
|
+
});
|
|
157
177
|
/** `ExecutionAuthorityRequest`: the binding plus hash, mode, evidence, and managed constraints. */
|
|
158
178
|
const AuthorityRequestSchema = z.strictObject({
|
|
159
179
|
...IntentBindingSchema.shape,
|
|
160
180
|
intent_hash: sha256Digest,
|
|
161
181
|
mode: z.enum(["SHADOW", "ENFORCEMENT"]),
|
|
162
|
-
evidence:
|
|
182
|
+
evidence: AuthorityEvidenceSchema.optional(),
|
|
163
183
|
escalation: ManagedEscalationRequestSchema.optional(),
|
|
164
184
|
});
|
|
165
185
|
/** `ExecutionTokenRequest`. */
|
|
@@ -262,6 +282,7 @@ export class LocalAuthority {
|
|
|
262
282
|
apiKey;
|
|
263
283
|
presence;
|
|
264
284
|
legacyVerifyReceipt;
|
|
285
|
+
verifyAttestation;
|
|
265
286
|
policy;
|
|
266
287
|
managedApproverId;
|
|
267
288
|
trustedEffectObserverIds;
|
|
@@ -297,6 +318,7 @@ export class LocalAuthority {
|
|
|
297
318
|
this.verificationLinks = options.verificationLinks === true;
|
|
298
319
|
this.presence = options.presence;
|
|
299
320
|
this.legacyVerifyReceipt = options.verifyReceipt;
|
|
321
|
+
this.verifyAttestation = options.verifyAttestation;
|
|
300
322
|
this.policy = options.policy ?? defaultPolicy;
|
|
301
323
|
this.managedApproverId = options.managedApproverId ?? "synthetic-managed-approver";
|
|
302
324
|
this.trustedEffectObserverIds = options.trustedEffectObserverIds ?? [];
|
|
@@ -702,6 +724,21 @@ export class LocalAuthority {
|
|
|
702
724
|
if (humanApproval === undefined) {
|
|
703
725
|
return { status: "ESCALATE", reasonCode: "HUMAN_APPROVAL_REQUIRED", approval: null };
|
|
704
726
|
}
|
|
727
|
+
if (humanApproval.provider === "attestation") {
|
|
728
|
+
const verified = this.verifyAttestation?.(humanApproval.attestation, {
|
|
729
|
+
intentId: request.intent_id,
|
|
730
|
+
intentHash: request.intent_hash,
|
|
731
|
+
tenantId: request.tenant_id,
|
|
732
|
+
}) ?? false;
|
|
733
|
+
return verified
|
|
734
|
+
? { status: "ALLOW", reasonCode: "PRESENCE_ATTESTATION_VERIFIED", approval: null }
|
|
735
|
+
: {
|
|
736
|
+
status: "BLOCK",
|
|
737
|
+
reasonCode: "PRESENCE_ATTESTATION_SIGNATURE_INVALID",
|
|
738
|
+
approval: null,
|
|
739
|
+
error: "PRESENCE_ATTESTATION_SIGNATURE_INVALID",
|
|
740
|
+
};
|
|
741
|
+
}
|
|
705
742
|
if (!this.verifyEvidence(humanApproval, request)) {
|
|
706
743
|
// Decionis verifies the receipt with Presence and refuses the request.
|
|
707
744
|
return {
|