@decionis/agentsafe 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/dist/Cli.js +16 -7
- package/dist/Cli.js.map +1 -1
- package/dist/Index.d.ts +5 -1
- package/dist/Index.d.ts.map +1 -1
- package/dist/Index.js +5 -1
- package/dist/Index.js.map +1 -1
- package/dist/cli/CliProcess.d.ts +2 -0
- package/dist/cli/CliProcess.d.ts.map +1 -1
- package/dist/cli/CliProcess.js +9 -1
- package/dist/cli/CliProcess.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/Credentials.d.ts.map +1 -1
- package/dist/cli/Credentials.js +8 -1
- package/dist/cli/Credentials.js.map +1 -1
- package/dist/cli/Help.d.ts.map +1 -1
- package/dist/cli/Help.js +4 -1
- package/dist/cli/Help.js.map +1 -1
- package/dist/cli/Intercept.d.ts +66 -0
- package/dist/cli/Intercept.d.ts.map +1 -0
- package/dist/cli/Intercept.js +374 -0
- package/dist/cli/Intercept.js.map +1 -0
- package/dist/cli/Login.d.ts +7 -2
- package/dist/cli/Login.d.ts.map +1 -1
- package/dist/cli/Login.js +106 -3
- package/dist/cli/Login.js.map +1 -1
- package/dist/cli/Status.d.ts.map +1 -1
- package/dist/cli/Status.js +18 -1
- package/dist/cli/Status.js.map +1 -1
- package/dist/cli/TestCommand.d.ts +33 -2
- package/dist/cli/TestCommand.d.ts.map +1 -1
- package/dist/cli/TestCommand.js +130 -4
- package/dist/cli/TestCommand.js.map +1 -1
- package/dist/cli/VerifyIntent.d.ts +28 -0
- package/dist/cli/VerifyIntent.d.ts.map +1 -0
- package/dist/cli/VerifyIntent.js +136 -0
- package/dist/cli/VerifyIntent.js.map +1 -0
- package/dist/egress/TransparentDial.d.ts +18 -0
- package/dist/egress/TransparentDial.d.ts.map +1 -0
- package/dist/egress/TransparentDial.js +33 -0
- package/dist/egress/TransparentDial.js.map +1 -0
- package/dist/gateway/Activation.d.ts +10 -3
- package/dist/gateway/Activation.d.ts.map +1 -1
- package/dist/gateway/Activation.js +17 -2
- package/dist/gateway/Activation.js.map +1 -1
- package/dist/gateway/BoundaryTest.d.ts +54 -0
- package/dist/gateway/BoundaryTest.d.ts.map +1 -1
- package/dist/gateway/BoundaryTest.js +19 -7
- package/dist/gateway/BoundaryTest.js.map +1 -1
- package/dist/gateway/Gateway.d.ts +39 -0
- package/dist/gateway/Gateway.d.ts.map +1 -1
- package/dist/gateway/Gateway.js +62 -4
- package/dist/gateway/Gateway.js.map +1 -1
- package/dist/gateway/GatewayConfig.d.ts +7 -0
- package/dist/gateway/GatewayConfig.d.ts.map +1 -1
- package/dist/gateway/GatewayConfig.js +12 -7
- package/dist/gateway/GatewayConfig.js.map +1 -1
- package/dist/gateway/GatewayReport.d.ts +2 -1
- package/dist/gateway/GatewayReport.d.ts.map +1 -1
- package/dist/gateway/GatewayReport.js +3 -0
- package/dist/gateway/GatewayReport.js.map +1 -1
- package/dist/gateway/HostedBoundaryTest.d.ts +118 -0
- package/dist/gateway/HostedBoundaryTest.d.ts.map +1 -0
- package/dist/gateway/HostedBoundaryTest.js +235 -0
- package/dist/gateway/HostedBoundaryTest.js.map +1 -0
- package/dist/gateway/InstallSurface.d.ts +26 -0
- package/dist/gateway/InstallSurface.d.ts.map +1 -0
- package/dist/gateway/InstallSurface.js +53 -0
- package/dist/gateway/InstallSurface.js.map +1 -0
- package/dist/gateway/ShadowLedger.d.ts +74 -0
- package/dist/gateway/ShadowLedger.d.ts.map +1 -0
- package/dist/gateway/ShadowLedger.js +112 -0
- package/dist/gateway/ShadowLedger.js.map +1 -0
- package/dist/http/GatewayHttpServer.d.ts +7 -0
- package/dist/http/GatewayHttpServer.d.ts.map +1 -1
- package/dist/http/GatewayHttpServer.js +8 -0
- package/dist/http/GatewayHttpServer.js.map +1 -1
- package/dist/http/InterceptGovernor.d.ts +71 -0
- package/dist/http/InterceptGovernor.d.ts.map +1 -0
- package/dist/http/InterceptGovernor.js +128 -0
- package/dist/http/InterceptGovernor.js.map +1 -0
- package/dist/http/InterceptServer.d.ts +124 -0
- package/dist/http/InterceptServer.d.ts.map +1 -0
- package/dist/http/InterceptServer.js +303 -0
- package/dist/http/InterceptServer.js.map +1 -0
- package/dist/intercept/ClientHello.d.ts +37 -0
- package/dist/intercept/ClientHello.d.ts.map +1 -0
- package/dist/intercept/ClientHello.js +216 -0
- package/dist/intercept/ClientHello.js.map +1 -0
- package/dist/intercept/Der.d.ts +59 -0
- package/dist/intercept/Der.d.ts.map +1 -0
- package/dist/intercept/Der.js +140 -0
- package/dist/intercept/Der.js.map +1 -0
- package/dist/intercept/Destination.d.ts +35 -0
- package/dist/intercept/Destination.d.ts.map +1 -0
- package/dist/intercept/Destination.js +66 -0
- package/dist/intercept/Destination.js.map +1 -0
- package/dist/intercept/InterceptLedger.d.ts +103 -0
- package/dist/intercept/InterceptLedger.d.ts.map +1 -0
- package/dist/intercept/InterceptLedger.js +101 -0
- package/dist/intercept/InterceptLedger.js.map +1 -0
- package/dist/intercept/LeafIssuer.d.ts +40 -0
- package/dist/intercept/LeafIssuer.d.ts.map +1 -0
- package/dist/intercept/LeafIssuer.js +124 -0
- package/dist/intercept/LeafIssuer.js.map +1 -0
- package/dist/intercept/RequestHead.d.ts +48 -0
- package/dist/intercept/RequestHead.d.ts.map +1 -0
- package/dist/intercept/RequestHead.js +163 -0
- package/dist/intercept/RequestHead.js.map +1 -0
- package/dist/verify/VerifyIntentVector.d.ts +25 -0
- package/dist/verify/VerifyIntentVector.d.ts.map +1 -0
- package/dist/verify/VerifyIntentVector.js +188 -0
- package/dist/verify/VerifyIntentVector.js.map +1 -0
- package/package.json +2 -2
|
@@ -5,14 +5,21 @@
|
|
|
5
5
|
* no path, no verdict. Nothing here is sent anywhere; the milestones are for
|
|
6
6
|
* the person at the terminal and for an operator's own log pipeline, and
|
|
7
7
|
* the only thing the authority learns is what every hosted call already
|
|
8
|
-
* carries in its `User-Agent
|
|
9
|
-
*
|
|
8
|
+
* carries in its `User-Agent`: the runtime's version and the surface it was
|
|
9
|
+
* installed from. `installation` is the installer's own last line, because
|
|
10
|
+
* a process cannot see itself being installed, and `boundary_tested` is
|
|
11
|
+
* `agentsafe test`'s own last line, because the gateway cannot see the test
|
|
12
|
+
* that ran before it.
|
|
10
13
|
*/
|
|
14
|
+
export declare const ACTIVATION_PATH: readonly ["installation", "boundary_tested", "gateway_started", "shadow_enabled", "first_interception", "first_governed_action", "decionis_connected", "enforcement_enabled", "production_deployment"];
|
|
15
|
+
/** One step of the path, whichever process reports it. */
|
|
16
|
+
export type ActivationStep = (typeof ACTIVATION_PATH)[number];
|
|
17
|
+
/** The steps a gateway process reaches itself. */
|
|
11
18
|
export declare const ACTIVATION_MILESTONES: readonly ["gateway_started", "shadow_enabled", "enforcement_enabled", "decionis_connected", "production_deployment", "first_interception", "first_governed_action"];
|
|
12
19
|
export type ActivationMilestone = (typeof ACTIVATION_MILESTONES)[number];
|
|
13
20
|
export interface ActivationReport {
|
|
14
21
|
readonly event: "ACTIVATION";
|
|
15
|
-
readonly milestone:
|
|
22
|
+
readonly milestone: ActivationStep;
|
|
16
23
|
readonly at: string;
|
|
17
24
|
}
|
|
18
25
|
/** What the funnel needs to know at start: the mode, the authority, the environment. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Activation.d.ts","sourceRoot":"","sources":["../../src/gateway/Activation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Activation.d.ts","sourceRoot":"","sources":["../../src/gateway/Activation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,wMAUlB,CAAC;AAEX,0DAA0D;AAC1D,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,kDAAkD;AAClD,eAAO,MAAM,qBAAqB,qKAQY,CAAC;AAE/C,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,wFAAwF;AACxF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,aAAa,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,UAAU,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAED,qBAAa,gBAAgB;IAIzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAJxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0C;gBAG/C,MAAM,EAAE,CAAC,SAAS,EAAE,mBAAmB,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,EAC5D,KAAK,GAAE,MAAM,MAAyB;IAGzD,gEAAgE;IACzD,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IAOhD,0EAA0E;IACnE,WAAW,IAAI,IAAI;IAI1B,8EAA8E;IACvE,QAAQ,IAAI,IAAI;IAIvB,6DAA6D;IACtD,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;IAQvE,OAAO,CAAC,KAAK;CAMd"}
|
|
@@ -5,9 +5,24 @@
|
|
|
5
5
|
* no path, no verdict. Nothing here is sent anywhere; the milestones are for
|
|
6
6
|
* the person at the terminal and for an operator's own log pipeline, and
|
|
7
7
|
* the only thing the authority learns is what every hosted call already
|
|
8
|
-
* carries in its `User-Agent
|
|
9
|
-
*
|
|
8
|
+
* carries in its `User-Agent`: the runtime's version and the surface it was
|
|
9
|
+
* installed from. `installation` is the installer's own last line, because
|
|
10
|
+
* a process cannot see itself being installed, and `boundary_tested` is
|
|
11
|
+
* `agentsafe test`'s own last line, because the gateway cannot see the test
|
|
12
|
+
* that ran before it.
|
|
10
13
|
*/
|
|
14
|
+
export const ACTIVATION_PATH = [
|
|
15
|
+
"installation",
|
|
16
|
+
"boundary_tested",
|
|
17
|
+
"gateway_started",
|
|
18
|
+
"shadow_enabled",
|
|
19
|
+
"first_interception",
|
|
20
|
+
"first_governed_action",
|
|
21
|
+
"decionis_connected",
|
|
22
|
+
"enforcement_enabled",
|
|
23
|
+
"production_deployment",
|
|
24
|
+
];
|
|
25
|
+
/** The steps a gateway process reaches itself. */
|
|
11
26
|
export const ACTIVATION_MILESTONES = [
|
|
12
27
|
"gateway_started",
|
|
13
28
|
"shadow_enabled",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Activation.js","sourceRoot":"","sources":["../../src/gateway/Activation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Activation.js","sourceRoot":"","sources":["../../src/gateway/Activation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,oBAAoB;IACpB,uBAAuB;IACvB,oBAAoB;IACpB,qBAAqB;IACrB,uBAAuB;CACf,CAAC;AAKX,kDAAkD;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,iBAAiB;IACjB,gBAAgB;IAChB,qBAAqB;IACrB,oBAAoB;IACpB,uBAAuB;IACvB,oBAAoB;IACpB,uBAAuB;CACqB,CAAC;AAiB/C,MAAM,OAAO,gBAAgB;IAIR;IACA;IAJF,OAAO,GAAG,IAAI,GAAG,EAA+B,CAAC;IAElE,YACmB,MAA4D,EAC5D,QAAsB,G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;QAChC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `agentsafe test`: the execution boundary, demonstrated rather than
|
|
3
|
+
* described. A fixed set of consequential requests, most of them the kind
|
|
4
|
+
* a policy exists to stop, is sent three ways at a synthetic target that
|
|
5
|
+
* records what reaches it: directly, as an agent would with nothing in the
|
|
6
|
+
* way; through the gateway in shadow, which forwards everything and says
|
|
7
|
+
* what would have been decided; and through the gateway in enforcement,
|
|
8
|
+
* which forwards only what the authority allowed, once, and holds or
|
|
9
|
+
* refuses the rest. The result is one report: what was exposed without the
|
|
10
|
+
* boundary, what the boundary prevented, and whether the evidence it left
|
|
11
|
+
* verifies.
|
|
12
|
+
*
|
|
13
|
+
* The test is safe by construction, not by care. The target is a loopback
|
|
14
|
+
* service this process starts and stops; the authority is the local demo
|
|
15
|
+
* policy on loopback; nothing named in any configuration, environment or
|
|
16
|
+
* stored login is read, so a real upstream and a real key are never in
|
|
17
|
+
* play. The gateways under test are the same `Gateway` behind the same
|
|
18
|
+
* listener that `agentsafe proxy` runs; nothing here is a mock of the
|
|
19
|
+
* runtime.
|
|
20
|
+
*/
|
|
21
|
+
import { GatewayHttpServer } from "../http/GatewayHttpServer.js";
|
|
22
|
+
import { RecordingTarget } from "../http/RecordingTarget.js";
|
|
1
23
|
import { type DemoAuthorityHandle } from "./DemoAuthority.js";
|
|
24
|
+
import { Gateway, type GatewayDependencies } from "./Gateway.js";
|
|
25
|
+
import { type GatewayConfig } from "./GatewayConfig.js";
|
|
2
26
|
import type { ExecutionDisposition, GatewayState } from "./GatewayReport.js";
|
|
3
27
|
export declare const BOUNDARY_TEST_VERSION = "agent-safe.boundary-test/1";
|
|
4
28
|
/** One request the test sends, the same bytes each way. */
|
|
@@ -87,6 +111,36 @@ export interface BoundaryTestOptions {
|
|
|
87
111
|
/** The demo authority to use, else one is started for the run. */
|
|
88
112
|
readonly demoAuthority?: () => Promise<DemoAuthorityHandle>;
|
|
89
113
|
}
|
|
114
|
+
/** One gateway under test, behind its own listener, writing its lines to an array. */
|
|
115
|
+
export interface Lane {
|
|
116
|
+
readonly gateway: Gateway;
|
|
117
|
+
readonly server: GatewayHttpServer;
|
|
118
|
+
readonly url: string;
|
|
119
|
+
/** Every line the gateway wrote: reports, evidence, security events. */
|
|
120
|
+
readonly lines: string[];
|
|
121
|
+
}
|
|
122
|
+
/** What a shadow lane reported about one governed request, once the observation settled. */
|
|
123
|
+
export interface Observation {
|
|
124
|
+
readonly verdict: "ALLOW" | "ESCALATE" | "BLOCK" | null;
|
|
125
|
+
readonly dossier: boolean;
|
|
126
|
+
readonly decisionId: string | null;
|
|
127
|
+
readonly dossierId: string | null;
|
|
128
|
+
readonly reasonCodes: readonly string[];
|
|
129
|
+
}
|
|
130
|
+
export declare function openLane(config: GatewayConfig, dependencies: GatewayDependencies, lines: string[]): Promise<Lane>;
|
|
131
|
+
export declare function closeLane(lane: Lane): Promise<void>;
|
|
132
|
+
/** Sends one case at one base URL and reads what the target recorded for it. */
|
|
133
|
+
export declare function send(base: string, testCase: BoundaryCase, target: RecordingTarget): Promise<PassOutcome>;
|
|
134
|
+
/** The `SHADOW` reports a lane has written so far, in the order they settled. */
|
|
135
|
+
export declare function shadowReports(lane: Lane): Observation[];
|
|
136
|
+
/**
|
|
137
|
+
* A shadow observation settles after the response, on the report stream,
|
|
138
|
+
* one per governed request and in the order they were sent, since each is
|
|
139
|
+
* awaited before the next is sent. The `ordinal`-th governed request's
|
|
140
|
+
* observation is the `ordinal`-th `SHADOW` report, or none within the
|
|
141
|
+
* bound when the observation itself could not be made.
|
|
142
|
+
*/
|
|
143
|
+
export declare function awaitObservation(lane: Lane, ordinal: number, timeoutMs: number, clock: () => number): Promise<Observation>;
|
|
90
144
|
/** Runs the whole test and returns the report; nothing is printed here. */
|
|
91
145
|
export declare function runBoundaryTest(options: BoundaryTestOptions): Promise<BoundaryTestReport>;
|
|
92
146
|
//# sourceMappingURL=BoundaryTest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoundaryTest.d.ts","sourceRoot":"","sources":["../../src/gateway/BoundaryTest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BoundaryTest.d.ts","sourceRoot":"","sources":["../../src/gateway/BoundaryTest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE7E,eAAO,MAAM,qBAAqB,+BAA+B,CAAC;AAElE,2DAA2D;AAC3D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sFAAsF;IACtF,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,8CAA8C;AAC9C,MAAM,WAAW,WAAW;IA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
|
outage: true,
|
|
120
120
|
},
|
|
121
121
|
];
|
|
122
|
+
const NO_OBSERVATION = {
|
|
123
|
+
verdict: null,
|
|
124
|
+
dossier: false,
|
|
125
|
+
decisionId: null,
|
|
126
|
+
dossierId: null,
|
|
127
|
+
reasonCodes: [],
|
|
128
|
+
};
|
|
122
129
|
const AUTHORITY_DOWN = () => Promise.reject(new Error("AUTHORITY_UNREACHABLE"));
|
|
123
130
|
const CLOSE_GRACE_MS = 100;
|
|
124
131
|
const DEFAULT_OBSERVATION_TIMEOUT_MS = 5_000;
|
|
@@ -133,7 +140,7 @@ function configFor(target, mode, policy, version) {
|
|
|
133
140
|
version,
|
|
134
141
|
});
|
|
135
142
|
}
|
|
136
|
-
async function openLane(config, dependencies, lines) {
|
|
143
|
+
export async function openLane(config, dependencies, lines) {
|
|
137
144
|
const gateway = await Gateway.create(config, {
|
|
138
145
|
...dependencies,
|
|
139
146
|
io: {
|
|
@@ -150,7 +157,7 @@ async function openLane(config, dependencies, lines) {
|
|
|
150
157
|
const address = await server.listen(0, "127.0.0.1");
|
|
151
158
|
return { gateway, server, url: `http://127.0.0.1:${String(address.port)}`, lines };
|
|
152
159
|
}
|
|
153
|
-
async function closeLane(lane) {
|
|
160
|
+
export async function closeLane(lane) {
|
|
154
161
|
await lane.server.close(CLOSE_GRACE_MS);
|
|
155
162
|
await lane.gateway.close();
|
|
156
163
|
}
|
|
@@ -168,7 +175,7 @@ function verdictOf(state) {
|
|
|
168
175
|
return state === "ALLOW" || state === "ESCALATE" || state === "BLOCK" ? state : null;
|
|
169
176
|
}
|
|
170
177
|
/** Sends one case at one base URL and reads what the target recorded for it. */
|
|
171
|
-
async function send(base, testCase, target) {
|
|
178
|
+
export async function send(base, testCase, target) {
|
|
172
179
|
const before = target.received.length;
|
|
173
180
|
let response = null;
|
|
174
181
|
try {
|
|
@@ -201,7 +208,7 @@ async function send(base, testCase, target) {
|
|
|
201
208
|
};
|
|
202
209
|
}
|
|
203
210
|
/** The `SHADOW` reports a lane has written so far, in the order they settled. */
|
|
204
|
-
function shadowReports(lane) {
|
|
211
|
+
export function shadowReports(lane) {
|
|
205
212
|
const observations = [];
|
|
206
213
|
for (const line of lane.lines) {
|
|
207
214
|
let parsed;
|
|
@@ -220,6 +227,11 @@ function shadowReports(lane) {
|
|
|
220
227
|
observations.push({
|
|
221
228
|
verdict: verdict === "ALLOW" || verdict === "ESCALATE" || verdict === "BLOCK" ? verdict : null,
|
|
222
229
|
dossier: typeof report.dossier_id === "string",
|
|
230
|
+
decisionId: typeof report.decision_id === "string" ? report.decision_id : null,
|
|
231
|
+
dossierId: typeof report.dossier_id === "string" ? report.dossier_id : null,
|
|
232
|
+
reasonCodes: Array.isArray(report.reason_codes)
|
|
233
|
+
? report.reason_codes.filter((code) => typeof code === "string")
|
|
234
|
+
: [],
|
|
223
235
|
});
|
|
224
236
|
}
|
|
225
237
|
return observations;
|
|
@@ -231,14 +243,14 @@ function shadowReports(lane) {
|
|
|
231
243
|
* observation is the `ordinal`-th `SHADOW` report, or none within the
|
|
232
244
|
* bound when the observation itself could not be made.
|
|
233
245
|
*/
|
|
234
|
-
async function awaitObservation(lane, ordinal, timeoutMs, clock) {
|
|
246
|
+
export async function awaitObservation(lane, ordinal, timeoutMs, clock) {
|
|
235
247
|
const deadline = clock() + timeoutMs;
|
|
236
248
|
for (;;) {
|
|
237
249
|
const observation = shadowReports(lane)[ordinal - 1];
|
|
238
250
|
if (observation !== undefined)
|
|
239
251
|
return observation;
|
|
240
252
|
if (clock() >= deadline)
|
|
241
|
-
return
|
|
253
|
+
return NO_OBSERVATION;
|
|
242
254
|
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
243
255
|
}
|
|
244
256
|
}
|
|
@@ -282,7 +294,7 @@ export async function runBoundaryTest(options) {
|
|
|
282
294
|
const shadowSent = await send(shadowLane.url, testCase, target);
|
|
283
295
|
const observed = governed
|
|
284
296
|
? await awaitObservation(shadowLane, ordinal, observationTimeoutMs, clock)
|
|
285
|
-
:
|
|
297
|
+
: NO_OBSERVATION;
|
|
286
298
|
const shadowOutcome = {
|
|
287
299
|
...shadowSent,
|
|
288
300
|
state: governed ? "SHADOW" : null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoundaryTest.js","sourceRoot":"","sources":["../../src/gateway/BoundaryTest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAA4B,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,OAAO,EAA4B,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAsB,MAAM,oBAAoB,CAAC;AAG7E,MAAM,CAAC,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AA2ElE,MAAM,SAAS,GAAG,kBAAkB,CAAC;AAErC,MAAM,cAAc,GAAqC;IACvD,uBAAuB,EAAE,OAAO;IAChC,yBAAyB,EAAE,sBAAsB;CAClD,CAAC;AAEF,SAAS,IAAI,CAAC,IAA6B;IACzC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAA4B;IACrD;QACE,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,QAAQ;QACf,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,KAAK;KACd;IACD;QACE,EAAE,EAAE,iBAAiB;QACrB,KAAK,EAAE,yBAAyB;QAChC,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,WAAW;QACjB,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YAAS,CAAC;QACT,KAAK,MAAM,IAAI,IAAI,KAAK;YAAE,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC;AACH,CAAC"}
|
|
@@ -3,8 +3,18 @@ import type { SecretStore } from "../secrets/SecretStore.js";
|
|
|
3
3
|
import { type ActivationMilestone } from "./Activation.js";
|
|
4
4
|
import { type DemoAuthorityHandle } from "./DemoAuthority.js";
|
|
5
5
|
import type { GatewayConfig } from "./GatewayConfig.js";
|
|
6
|
+
import { type InstallSurface } from "./InstallSurface.js";
|
|
6
7
|
import { type InterceptedRequest } from "./InterceptedRequest.js";
|
|
7
8
|
import { type RoutePlan } from "./RouteTable.js";
|
|
9
|
+
import { type ShadowSummary } from "./ShadowLedger.js";
|
|
10
|
+
/**
|
|
11
|
+
* When a shadow gateway prints its report unasked: as the count of settled
|
|
12
|
+
* observations reaches each of these, and whenever a day has passed since
|
|
13
|
+
* the last report at the moment an observation settles. A gateway that
|
|
14
|
+
* observes nothing says nothing; the stop always prints one.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SHADOW_REPORT_MILESTONES: readonly number[];
|
|
17
|
+
export declare const SHADOW_REPORT_INTERVAL_MS: number;
|
|
8
18
|
/** The gateway's own evidence stream: what it did that the pipeline's audit contract has no event for. */
|
|
9
19
|
export declare const GATEWAY_STREAM = "agent-safe.gateway-events/1";
|
|
10
20
|
/** Every path under it belongs to the gateway and is never forwarded. */
|
|
@@ -32,6 +42,18 @@ export interface GatewayDependencies {
|
|
|
32
42
|
readonly demoAuthority?: () => Promise<DemoAuthorityHandle>;
|
|
33
43
|
readonly clock?: () => number;
|
|
34
44
|
readonly version?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The distribution this process was installed from, carried as `surface`
|
|
47
|
+
* in the `User-Agent` of hosted calls; derived from the process when
|
|
48
|
+
* absent, and `null` when it is not one of the named surfaces.
|
|
49
|
+
*/
|
|
50
|
+
readonly surface?: InstallSurface | null;
|
|
51
|
+
/**
|
|
52
|
+
* What a hosted call names as the example, `agentsafe-gateway@<version>`
|
|
53
|
+
* when absent; `agentsafe test --hosted` names itself, so the authority's
|
|
54
|
+
* record tells a test run from a gateway in service.
|
|
55
|
+
*/
|
|
56
|
+
readonly clientExample?: string;
|
|
35
57
|
}
|
|
36
58
|
/** What `/_agentsafe/status` reports: identifiers and counts, never a value. */
|
|
37
59
|
export interface GatewayStatus {
|
|
@@ -50,6 +72,10 @@ export interface GatewayStatus {
|
|
|
50
72
|
};
|
|
51
73
|
/** The adoption milestones this process has reached, with when; never a payload. */
|
|
52
74
|
readonly activation: Readonly<Record<ActivationMilestone, string | null>>;
|
|
75
|
+
/** The distribution this process came from, as sent on hosted calls; null when unknown. */
|
|
76
|
+
readonly surface: InstallSurface | null;
|
|
77
|
+
/** In shadow, what the authority would have decided so far, by verdict and action; null in enforcement. */
|
|
78
|
+
readonly shadow: ShadowSummary | null;
|
|
53
79
|
}
|
|
54
80
|
/**
|
|
55
81
|
* The HTTP-interception ingress over the unchanged lifecycle. A request the
|
|
@@ -73,6 +99,7 @@ export declare class Gateway {
|
|
|
73
99
|
private readonly chain;
|
|
74
100
|
private readonly clock;
|
|
75
101
|
private readonly version;
|
|
102
|
+
private readonly surface;
|
|
76
103
|
private readonly held;
|
|
77
104
|
private readonly holder;
|
|
78
105
|
private readonly capture;
|
|
@@ -82,6 +109,8 @@ export declare class Gateway {
|
|
|
82
109
|
private readonly stopFollowing;
|
|
83
110
|
private readonly counts;
|
|
84
111
|
private readonly activation;
|
|
112
|
+
private readonly ledger;
|
|
113
|
+
private lastShadowReportAt;
|
|
85
114
|
private constructor();
|
|
86
115
|
/**
|
|
87
116
|
* Assembles the gateway: the secrets it needs opened, the demo authority
|
|
@@ -95,12 +124,22 @@ export declare class Gateway {
|
|
|
95
124
|
/** The banner, once the listener is bound. */
|
|
96
125
|
started(gatewayUrl: string): void;
|
|
97
126
|
stopped(signal: string): void;
|
|
127
|
+
/** The shadow report, now: the counts so far and the switch. */
|
|
128
|
+
private shadowReport;
|
|
129
|
+
/**
|
|
130
|
+
* The report on its own cadence, so a gateway that runs for weeks is read
|
|
131
|
+
* without being stopped: at each milestone in the count of observations,
|
|
132
|
+
* and once a day has passed since the last report.
|
|
133
|
+
*/
|
|
134
|
+
private shadowReportOnCadence;
|
|
98
135
|
plan(method: string, path: string): RoutePlan;
|
|
99
136
|
readiness(): {
|
|
100
137
|
readonly ready: boolean;
|
|
101
138
|
readonly body: Record<string, unknown>;
|
|
102
139
|
};
|
|
103
140
|
status(): GatewayStatus;
|
|
141
|
+
/** The switch the shadow report ends with, for whoever renders the status elsewhere. */
|
|
142
|
+
get enforcementSwitch(): string;
|
|
104
143
|
metricsText(): string;
|
|
105
144
|
/** A request that is not consequential: forwarded unchanged, counted, not evaluated. */
|
|
106
145
|
passthrough(request: InterceptedRequest): Promise<GatewayResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Gateway.d.ts","sourceRoot":"","sources":["../../src/gateway/Gateway.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAMpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAoB,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAOlF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"Gateway.d.ts","sourceRoot":"","sources":["../../src/gateway/Gateway.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAMpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAoB,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,OAAO;IAwGrB,iFAAiF;YACnE,WAAW;IAsEzB,mGAAmG;YACrF,OAAO;IA2GrB,OAAO,CAAC,IAAI;IAQZ,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,QAAQ;IAkBhB,sEAAsE;IACtE,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,YAAY;IA8BpB,OAAO,CAAC,KAAK;IAQb,OAAO,CAAC,eAAe;IAUvB,uFAAuF;IACvF,OAAO,CAAC,GAAG;IAwBX,OAAO,CAAC,MAAM;IAKd,oDAAoD;IACpD,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,KAAK;CAGd"}
|
package/dist/gateway/Gateway.js
CHANGED
|
@@ -17,9 +17,21 @@ import { ActivationFunnel } from "./Activation.js";
|
|
|
17
17
|
import { startDemoAuthority } from "./DemoAuthority.js";
|
|
18
18
|
import { httpForwardHandler, registerHttpActions, RequestHolder, } from "./ForwardHandler.js";
|
|
19
19
|
import { gatewayMetrics } from "./GatewayMetrics.js";
|
|
20
|
+
import { processSurface } from "./InstallSurface.js";
|
|
20
21
|
import { renderHuman, renderJson, } from "./GatewayReport.js";
|
|
21
22
|
import { normalizeRequest } from "./InterceptedRequest.js";
|
|
22
23
|
import { RouteTable } from "./RouteTable.js";
|
|
24
|
+
import { enforcementSwitch, ShadowLedger } from "./ShadowLedger.js";
|
|
25
|
+
/**
|
|
26
|
+
* When a shadow gateway prints its report unasked: as the count of settled
|
|
27
|
+
* observations reaches each of these, and whenever a day has passed since
|
|
28
|
+
* the last report at the moment an observation settles. A gateway that
|
|
29
|
+
* observes nothing says nothing; the stop always prints one.
|
|
30
|
+
*/
|
|
31
|
+
export const SHADOW_REPORT_MILESTONES = [
|
|
32
|
+
10, 100, 1_000, 10_000, 100_000, 1_000_000,
|
|
33
|
+
];
|
|
34
|
+
export const SHADOW_REPORT_INTERVAL_MS = 24 * 60 * 60 * 1_000;
|
|
23
35
|
import { Upstream } from "./Upstream.js";
|
|
24
36
|
/** The gateway's own evidence stream: what it did that the pipeline's audit contract has no event for. */
|
|
25
37
|
export const GATEWAY_STREAM = "agent-safe.gateway-events/1";
|
|
@@ -52,6 +64,7 @@ export class Gateway {
|
|
|
52
64
|
chain;
|
|
53
65
|
clock;
|
|
54
66
|
version;
|
|
67
|
+
surface;
|
|
55
68
|
held = new Map();
|
|
56
69
|
holder = new RequestHolder();
|
|
57
70
|
capture;
|
|
@@ -61,7 +74,9 @@ export class Gateway {
|
|
|
61
74
|
stopFollowing;
|
|
62
75
|
counts = {};
|
|
63
76
|
activation;
|
|
64
|
-
|
|
77
|
+
ledger = new ShadowLedger();
|
|
78
|
+
lastShadowReportAt;
|
|
79
|
+
constructor(config, upstream, routes, audit, gate, verifier, metrics, emitLine, io, security, secrets, demo, journal, evidence, chain, clock, version, surface) {
|
|
65
80
|
this.config = config;
|
|
66
81
|
this.upstream = upstream;
|
|
67
82
|
this.routes = routes;
|
|
@@ -74,6 +89,8 @@ export class Gateway {
|
|
|
74
89
|
this.chain = chain;
|
|
75
90
|
this.clock = clock;
|
|
76
91
|
this.version = version;
|
|
92
|
+
this.surface = surface;
|
|
93
|
+
this.lastShadowReportAt = clock();
|
|
77
94
|
this.capture = new IntentCapture({ audit, ttlSeconds: config.intentTtlSeconds });
|
|
78
95
|
this.activation = new ActivationFunnel((milestone, at) => this.report({ event: "ACTIVATION", milestone, at }), clock);
|
|
79
96
|
const registry = registerHttpActions(new ActionRegistry(), routes.actions(), httpForwardHandler(upstream, this.holder));
|
|
@@ -105,6 +122,7 @@ export class Gateway {
|
|
|
105
122
|
const env = dependencies.env ?? process.env;
|
|
106
123
|
const clock = dependencies.clock ?? (() => Date.now());
|
|
107
124
|
const version = dependencies.version ?? "0.0.0";
|
|
125
|
+
const surface = dependencies.surface === undefined ? processSurface(env) : dependencies.surface;
|
|
108
126
|
const io = dependencies.io ?? {
|
|
109
127
|
stdout: (line) => {
|
|
110
128
|
process.stdout.write(`${line}\n`);
|
|
@@ -162,10 +180,15 @@ export class Gateway {
|
|
|
162
180
|
timeoutMs: config.authority.timeoutMs,
|
|
163
181
|
fetch: egress.fetch,
|
|
164
182
|
};
|
|
183
|
+
// What a hosted call says about where it came from: the runtime and its
|
|
184
|
+
// version, and the surface it was installed from; never the machine.
|
|
165
185
|
const gate = new DecionisGate({
|
|
166
186
|
...connection,
|
|
167
187
|
mode: config.authority.mode,
|
|
168
|
-
source: {
|
|
188
|
+
source: {
|
|
189
|
+
example: dependencies.clientExample ?? `agentsafe-gateway@${version}`,
|
|
190
|
+
...(surface === null ? {} : { surface }),
|
|
191
|
+
},
|
|
169
192
|
});
|
|
170
193
|
const verifier = new DecionisGrantVerifier(connection);
|
|
171
194
|
const metrics = gatewayMetrics();
|
|
@@ -194,7 +217,7 @@ export class Gateway {
|
|
|
194
217
|
sink: new HashChainedAuditSink(emitLine, evidence),
|
|
195
218
|
failurePolicy: config.evidence.enabled ? "REQUIRE_BEFORE_EXECUTION" : "BEST_EFFORT",
|
|
196
219
|
});
|
|
197
|
-
const gateway = new Gateway(config, upstream, routes, audit, gate, verifier, metrics, emitLine, io, security, secrets, demo, journal, evidence, chain, clock, version);
|
|
220
|
+
const gateway = new Gateway(config, upstream, routes, audit, gate, verifier, metrics, emitLine, io, security, secrets, demo, journal, evidence, chain, clock, version, surface);
|
|
198
221
|
return gateway;
|
|
199
222
|
}
|
|
200
223
|
get authorityLabel() {
|
|
@@ -236,7 +259,34 @@ export class Gateway {
|
|
|
236
259
|
});
|
|
237
260
|
}
|
|
238
261
|
stopped(signal) {
|
|
239
|
-
|
|
262
|
+
const at = new Date(this.clock()).toISOString();
|
|
263
|
+
// A shadow run ends with its report: what enforcement would have changed,
|
|
264
|
+
// and the one switch that turns it on for this configuration.
|
|
265
|
+
if (this.shadow !== null)
|
|
266
|
+
this.shadowReport(at);
|
|
267
|
+
this.report({ event: "GATEWAY_STOPPED", at, signal });
|
|
268
|
+
}
|
|
269
|
+
/** The shadow report, now: the counts so far and the switch. */
|
|
270
|
+
shadowReport(at) {
|
|
271
|
+
this.report({
|
|
272
|
+
event: "SHADOW_REPORT",
|
|
273
|
+
at,
|
|
274
|
+
shadow: this.ledger.summary(),
|
|
275
|
+
enforce: enforcementSwitch(this.config),
|
|
276
|
+
});
|
|
277
|
+
this.lastShadowReportAt = this.clock();
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* The report on its own cadence, so a gateway that runs for weeks is read
|
|
281
|
+
* without being stopped: at each milestone in the count of observations,
|
|
282
|
+
* and once a day has passed since the last report.
|
|
283
|
+
*/
|
|
284
|
+
shadowReportOnCadence() {
|
|
285
|
+
const now = this.clock();
|
|
286
|
+
if (SHADOW_REPORT_MILESTONES.includes(this.ledger.observed) ||
|
|
287
|
+
now - this.lastShadowReportAt >= SHADOW_REPORT_INTERVAL_MS) {
|
|
288
|
+
this.shadowReport(new Date(now).toISOString());
|
|
289
|
+
}
|
|
240
290
|
}
|
|
241
291
|
plan(method, path) {
|
|
242
292
|
return this.routes.plan(method, path);
|
|
@@ -264,8 +314,14 @@ export class Gateway {
|
|
|
264
314
|
counts: { ...this.counts },
|
|
265
315
|
evidence: this.evidence.head,
|
|
266
316
|
activation: this.activation.snapshot(),
|
|
317
|
+
surface: this.surface,
|
|
318
|
+
shadow: this.shadow === null ? null : this.ledger.summary(),
|
|
267
319
|
};
|
|
268
320
|
}
|
|
321
|
+
/** The switch the shadow report ends with, for whoever renders the status elsewhere. */
|
|
322
|
+
get enforcementSwitch() {
|
|
323
|
+
return enforcementSwitch(this.config);
|
|
324
|
+
}
|
|
269
325
|
metricsText() {
|
|
270
326
|
return this.metrics.registry.render();
|
|
271
327
|
}
|
|
@@ -430,6 +486,7 @@ export class Gateway {
|
|
|
430
486
|
void run.observation.then((observation) => {
|
|
431
487
|
this.metrics.shadowDecisions.inc({ verdict: observation.verdict ?? "NONE" });
|
|
432
488
|
this.count("shadow");
|
|
489
|
+
this.ledger.record(captured.intent.action, observation.verdict, new Date(this.clock()).toISOString(), upstreamStatus);
|
|
433
490
|
this.report({
|
|
434
491
|
...this.interception(request, captured, startedAt),
|
|
435
492
|
state: "SHADOW",
|
|
@@ -444,6 +501,7 @@ export class Gateway {
|
|
|
444
501
|
finalization: null,
|
|
445
502
|
authority_ms: observation.durationMs,
|
|
446
503
|
});
|
|
504
|
+
this.shadowReportOnCadence();
|
|
447
505
|
});
|
|
448
506
|
if (production.status === "FAILED")
|
|
449
507
|
return this.upstreamFailure(production.error);
|