@decionis/agentsafe 0.2.3 → 0.2.5

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.
Files changed (74) hide show
  1. package/dist/Cli.js +1 -0
  2. package/dist/Cli.js.map +1 -1
  3. package/dist/Index.d.ts +12 -1
  4. package/dist/Index.d.ts.map +1 -1
  5. package/dist/Index.js +11 -0
  6. package/dist/Index.js.map +1 -1
  7. package/dist/adapters/mcp/McpGuard.d.ts +91 -0
  8. package/dist/adapters/mcp/McpGuard.d.ts.map +1 -0
  9. package/dist/adapters/mcp/McpGuard.js +142 -0
  10. package/dist/adapters/mcp/McpGuard.js.map +1 -0
  11. package/dist/adapters/mcp/McpIntentBinder.d.ts +54 -0
  12. package/dist/adapters/mcp/McpIntentBinder.d.ts.map +1 -0
  13. package/dist/adapters/mcp/McpIntentBinder.js +79 -0
  14. package/dist/adapters/mcp/McpIntentBinder.js.map +1 -0
  15. package/dist/adapters/mcp/McpInvocation.d.ts +55 -0
  16. package/dist/adapters/mcp/McpInvocation.d.ts.map +1 -0
  17. package/dist/adapters/mcp/McpInvocation.js +88 -0
  18. package/dist/adapters/mcp/McpInvocation.js.map +1 -0
  19. package/dist/boundary/BoundaryIdentity.d.ts +88 -0
  20. package/dist/boundary/BoundaryIdentity.d.ts.map +1 -0
  21. package/dist/boundary/BoundaryIdentity.js +126 -0
  22. package/dist/boundary/BoundaryIdentity.js.map +1 -0
  23. package/dist/cli/Commands.d.ts +1 -1
  24. package/dist/cli/Commands.d.ts.map +1 -1
  25. package/dist/cli/Commands.js +5 -0
  26. package/dist/cli/Commands.js.map +1 -1
  27. package/dist/cli/Help.d.ts.map +1 -1
  28. package/dist/cli/Help.js +1 -0
  29. package/dist/cli/Help.js.map +1 -1
  30. package/dist/cli/Identity.d.ts +47 -0
  31. package/dist/cli/Identity.d.ts.map +1 -0
  32. package/dist/cli/Identity.js +145 -0
  33. package/dist/cli/Identity.js.map +1 -0
  34. package/dist/cli/TestCommand.d.ts +8 -0
  35. package/dist/cli/TestCommand.d.ts.map +1 -1
  36. package/dist/cli/TestCommand.js +25 -5
  37. package/dist/cli/TestCommand.js.map +1 -1
  38. package/dist/gateway/AuthorityAttacks.d.ts +39 -0
  39. package/dist/gateway/AuthorityAttacks.d.ts.map +1 -0
  40. package/dist/gateway/AuthorityAttacks.js +158 -0
  41. package/dist/gateway/AuthorityAttacks.js.map +1 -0
  42. package/dist/gateway/Gateway.d.ts +7 -0
  43. package/dist/gateway/Gateway.d.ts.map +1 -1
  44. package/dist/gateway/Gateway.js +61 -3
  45. package/dist/gateway/Gateway.js.map +1 -1
  46. package/dist/gateway/GatewayConfig.d.ts +11 -0
  47. package/dist/gateway/GatewayConfig.d.ts.map +1 -1
  48. package/dist/gateway/GatewayConfig.js +18 -0
  49. package/dist/gateway/GatewayConfig.js.map +1 -1
  50. package/dist/gateway/GatewayReport.d.ts +31 -1
  51. package/dist/gateway/GatewayReport.d.ts.map +1 -1
  52. package/dist/gateway/GatewayReport.js +12 -0
  53. package/dist/gateway/GatewayReport.js.map +1 -1
  54. package/dist/provenance/DockerProvenanceProvider.d.ts +23 -0
  55. package/dist/provenance/DockerProvenanceProvider.d.ts.map +1 -0
  56. package/dist/provenance/DockerProvenanceProvider.js +24 -0
  57. package/dist/provenance/DockerProvenanceProvider.js.map +1 -0
  58. package/dist/provenance/KubernetesProvenanceProvider.d.ts +17 -0
  59. package/dist/provenance/KubernetesProvenanceProvider.d.ts.map +1 -0
  60. package/dist/provenance/KubernetesProvenanceProvider.js +18 -0
  61. package/dist/provenance/KubernetesProvenanceProvider.js.map +1 -0
  62. package/dist/provenance/NoneProvenanceProvider.d.ts +15 -0
  63. package/dist/provenance/NoneProvenanceProvider.d.ts.map +1 -0
  64. package/dist/provenance/NoneProvenanceProvider.js +16 -0
  65. package/dist/provenance/NoneProvenanceProvider.js.map +1 -0
  66. package/dist/provenance/ProvenanceProvider.d.ts +94 -0
  67. package/dist/provenance/ProvenanceProvider.d.ts.map +1 -0
  68. package/dist/provenance/ProvenanceProvider.js +118 -0
  69. package/dist/provenance/ProvenanceProvider.js.map +1 -0
  70. package/dist/provenance/StaticProvenanceProvider.d.ts +18 -0
  71. package/dist/provenance/StaticProvenanceProvider.d.ts.map +1 -0
  72. package/dist/provenance/StaticProvenanceProvider.js +25 -0
  73. package/dist/provenance/StaticProvenanceProvider.js.map +1 -0
  74. package/package.json +2 -2
@@ -0,0 +1,55 @@
1
+ import { z } from "zod";
2
+ import type { JsonObject } from "@decionis/agent-safe-pipeline";
3
+ export declare const McpInvocationSchema: z.ZodObject<{
4
+ tool: z.ZodString;
5
+ arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
6
+ server: z.ZodOptional<z.ZodString>;
7
+ transport: z.ZodOptional<z.ZodString>;
8
+ principal: z.ZodOptional<z.ZodString>;
9
+ correlationId: z.ZodOptional<z.ZodString>;
10
+ idempotencyKey: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$strict>;
12
+ export type McpInvocation = z.infer<typeof McpInvocationSchema>;
13
+ /**
14
+ * What an operator declares about one tool, in trusted startup code beside
15
+ * the registry that will run it.
16
+ *
17
+ * A tool with no binding is not governed by this adapter and not silently
18
+ * allowed by it either: the guard refuses it, so adding a consequential tool
19
+ * to a server cannot quietly add an ungoverned path to a system of record.
20
+ *
21
+ * `target` is a template rather than a callback so that a binding stays a
22
+ * description an operator can read, and later hold in configuration, rather
23
+ * than arbitrary code reached by tool name.
24
+ */
25
+ export interface McpToolBinding {
26
+ readonly tool: string;
27
+ /** The Agent-Safe action name this tool becomes. */
28
+ readonly action: string;
29
+ /** The system the effect lands in, and the operation there. */
30
+ readonly system: string;
31
+ readonly operation: string;
32
+ readonly environment?: string;
33
+ /** `crm:customer:{customerId}` — every placeholder must be an argument. */
34
+ readonly target: string;
35
+ /**
36
+ * The arguments that decide what the action does. They are named so that
37
+ * evidence and an approval screen can show the few that matter; every
38
+ * argument is inside the intent hash regardless, named or not.
39
+ */
40
+ readonly consequential: readonly string[];
41
+ /** The arguments this tool accepts. Anything else is refused, not dropped. */
42
+ readonly argumentsSchema: z.ZodType<JsonObject>;
43
+ }
44
+ export declare const MAX_TEMPLATE_PLACEHOLDERS = 16;
45
+ /**
46
+ * Fills a target template from the arguments, by a single linear scan.
47
+ *
48
+ * Deliberately not a regular expression: the template is an operator's, but
49
+ * the values substituted into it are the model's, and a scan has no
50
+ * backtracking to exploit. A placeholder with no argument, an argument that
51
+ * is not a scalar, and an unterminated brace are each a refusal rather than a
52
+ * target with a hole in it.
53
+ */
54
+ export declare function fillTarget(template: string, args: JsonObject): string | null;
55
+ //# sourceMappingURL=McpInvocation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpInvocation.d.ts","sourceRoot":"","sources":["../../../src/adapters/mcp/McpInvocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AA0BhE,eAAO,MAAM,mBAAmB;;;;;;;;kBAerB,CAAC;AAEZ,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,8EAA8E;IAC9E,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;CACjD;AAED,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CA8B5E"}
@@ -0,0 +1,88 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * An MCP tool invocation, at the one moment worth intercepting: the model has
4
+ * chosen a tool and constructed its arguments, and nothing has happened yet.
5
+ *
6
+ * The distinction this file exists to keep is small and load-bearing:
7
+ *
8
+ * MCP decides *how* an agent invokes a tool.
9
+ * AgentSafe and Decionis decide *whether this exact invocation* may run.
10
+ *
11
+ * So nothing here is an MCP server, a registry, or a replacement for MCP's
12
+ * own authentication. The type below is a plain description of a call, with
13
+ * no dependency on any MCP SDK, so a stdio server, a streamable-HTTP server
14
+ * and a test can all hand over the same thing.
15
+ */
16
+ const toolName = z
17
+ .string()
18
+ .trim()
19
+ .min(1)
20
+ .max(200)
21
+ .regex(/^[a-z0-9][\w.:/-]*$/i);
22
+ const bounded = (max) => z.string().trim().min(1).max(max);
23
+ export const McpInvocationSchema = z
24
+ .object({
25
+ /** The tool the model selected, by the name the server published. */
26
+ tool: toolName,
27
+ /** The arguments the model constructed. Untrusted, and hashed whole. */
28
+ arguments: z.record(z.string(), z.unknown()).default({}),
29
+ /** Which server holds the tool, when the caller runs more than one. */
30
+ server: bounded(200).optional(),
31
+ /** How the call arrived. Carried as context, never as authority. */
32
+ transport: bounded(80).optional(),
33
+ /** Who the caller says it is. Claimed, never verified here. */
34
+ principal: bounded(200).optional(),
35
+ correlationId: bounded(200).optional(),
36
+ idempotencyKey: bounded(180).optional(),
37
+ })
38
+ .strict();
39
+ export const MAX_TEMPLATE_PLACEHOLDERS = 16;
40
+ /**
41
+ * Fills a target template from the arguments, by a single linear scan.
42
+ *
43
+ * Deliberately not a regular expression: the template is an operator's, but
44
+ * the values substituted into it are the model's, and a scan has no
45
+ * backtracking to exploit. A placeholder with no argument, an argument that
46
+ * is not a scalar, and an unterminated brace are each a refusal rather than a
47
+ * target with a hole in it.
48
+ */
49
+ export function fillTarget(template, args) {
50
+ let out = "";
51
+ let placeholders = 0;
52
+ for (let at = 0; at < template.length; at += 1) {
53
+ const character = template[at];
54
+ if (character !== "{") {
55
+ if (character === "}")
56
+ return null;
57
+ out += character;
58
+ continue;
59
+ }
60
+ const close = template.indexOf("}", at + 1);
61
+ if (close === -1)
62
+ return null;
63
+ placeholders += 1;
64
+ if (placeholders > MAX_TEMPLATE_PLACEHOLDERS)
65
+ return null;
66
+ const name = template.slice(at + 1, close);
67
+ if (name.length === 0 || !Object.hasOwn(args, name))
68
+ return null;
69
+ const value = args[name];
70
+ if (typeof value === "string") {
71
+ if (value.length === 0)
72
+ return null;
73
+ out += value;
74
+ }
75
+ else if (typeof value === "number" && Number.isFinite(value)) {
76
+ out += String(value);
77
+ }
78
+ else if (typeof value === "boolean") {
79
+ out += String(value);
80
+ }
81
+ else {
82
+ return null;
83
+ }
84
+ at = close;
85
+ }
86
+ return out.length === 0 || out.length > 500 ? null : out;
87
+ }
88
+ //# sourceMappingURL=McpInvocation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpInvocation.js","sourceRoot":"","sources":["../../../src/adapters/mcp/McpInvocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;;;;GAaG;AAEH,MAAM,QAAQ,GAAG,CAAC;KACf,MAAM,EAAE;KACR,IAAI,EAAE;KACN,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAEjC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAe,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC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
4
+ * Which enforcement boundary this process is.
5
+ *
6
+ * An estate may run hundreds of gateways across Docker, Kubernetes, a Linux
7
+ * host and the hosted runtime. A Decision Dossier that names the boundary can
8
+ * answer which of them admitted an effect; one that cannot is evidence about
9
+ * an action with no evidence about the door it came through.
10
+ *
11
+ * The identity is of the *configured logical boundary*, not of the process or
12
+ * the container: restarting a container, rescheduling a pod or scaling a
13
+ * deployment to thirty replicas leaves it unchanged, because nothing
14
+ * ephemeral goes into it. That is also why the derivation below reads
15
+ * configuration rather than the machine: a boundary id that moved when a pod
16
+ * did would be an instance id wearing a boundary's name, and an operator
17
+ * grouping policy by boundary would be grouping by nothing.
18
+ */
19
+ /** The conformance profile this boundary answers for. */
20
+ export declare const BOUNDARY_CONFORMANCE = "agent-safe-intent-v1";
21
+ export declare const BOUNDARY_PROTOCOL = "agent-safe.intent/1";
22
+ /** A derived id wears a prefix so it is never mistaken for one an operator chose. */
23
+ export declare const DERIVED_BOUNDARY_PREFIX = "bd_";
24
+ export declare const BOUNDARY_ENVIRONMENT: {
25
+ readonly boundaryId: "AGENTSAFE_BOUNDARY_ID";
26
+ readonly clusterId: "AGENTSAFE_CLUSTER_ID";
27
+ readonly namespace: "AGENTSAFE_NAMESPACE";
28
+ readonly region: "AGENTSAFE_REGION";
29
+ readonly workloadId: "AGENTSAFE_WORKLOAD_ID";
30
+ readonly containerId: "AGENTSAFE_CONTAINER_ID";
31
+ readonly podId: "AGENTSAFE_POD_ID";
32
+ readonly nodeId: "AGENTSAFE_NODE_ID";
33
+ };
34
+ /**
35
+ * Where the boundary sits, as the operator's own manifest declared it. These
36
+ * survive a restart and are what a policy means by "production in eu", so
37
+ * they are bound into the intent and reach signed evidence.
38
+ */
39
+ export interface BoundaryPlacement {
40
+ readonly clusterId: string | null;
41
+ readonly namespace: string | null;
42
+ readonly region: string | null;
43
+ readonly workloadId: string | null;
44
+ }
45
+ /**
46
+ * Which instance of the boundary this happens to be. Ephemeral by
47
+ * definition, so it is reported locally, for an operator reading one
48
+ * process's own output, and never bound into an intent or signed into
49
+ * evidence: an effect's evidence should say which boundary admitted it, not
50
+ * which container was alive that second.
51
+ */
52
+ export interface BoundaryInstance {
53
+ readonly containerId: string | null;
54
+ readonly podId: string | null;
55
+ readonly nodeId: string | null;
56
+ }
57
+ export interface EnforcementBoundary {
58
+ readonly boundaryId: string;
59
+ /** Whether an operator named this boundary or the configuration derived it. */
60
+ readonly boundarySource: "configured" | "derived";
61
+ readonly agentsafeVersion: string;
62
+ readonly protocolVersion: typeof BOUNDARY_PROTOCOL;
63
+ readonly conformanceVersion: string;
64
+ readonly deploymentType: InstallSurface | "unknown";
65
+ readonly environment: string | null;
66
+ readonly placement: BoundaryPlacement | null;
67
+ readonly instance: BoundaryInstance | null;
68
+ }
69
+ /** What the resolution reads: the environment and the configuration, never the host. */
70
+ export interface BoundaryFacts {
71
+ readonly env: Readonly<Record<string, string | undefined>>;
72
+ readonly version: string;
73
+ readonly deploymentType: InstallSurface | null;
74
+ /** The operator's own name for this deployment, from `gateway.environment`. */
75
+ readonly environment: string | null;
76
+ /** The origin of the system this boundary stands in front of. */
77
+ readonly upstreamOrigin: string | null;
78
+ /** A boundary id from the configuration file, which the environment overrides. */
79
+ readonly configuredId?: string | null;
80
+ }
81
+ export declare function resolveBoundary(facts: BoundaryFacts): EnforcementBoundary;
82
+ /**
83
+ * The boundary as an intent binds it. The instance is left out deliberately:
84
+ * what reaches signed evidence is the boundary, and the boundary is not the
85
+ * container it happens to be running in.
86
+ */
87
+ export declare function boundarySignal(boundary: EnforcementBoundary): EnforcementBoundarySignal;
88
+ //# sourceMappingURL=BoundaryIdentity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoundaryIdentity.d.ts","sourceRoot":"","sources":["../../src/boundary/BoundaryIdentity.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,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AAC;CAC5C;AAED,wFAAwF;AACxF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAC3D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IAC/C,+EAA+E;IAC/E,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,iEAAiE;IACjE,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,kFAAkF;IAClF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AA2CD,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,mBAAmB,CAuBzE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,mBAAmB,GAAG,yBAAyB,CAoBvF"}
@@ -0,0 +1,126 @@
1
+ import { createHash } from "node:crypto";
2
+ /**
3
+ * Which enforcement boundary this process is.
4
+ *
5
+ * An estate may run hundreds of gateways across Docker, Kubernetes, a Linux
6
+ * host and the hosted runtime. A Decision Dossier that names the boundary can
7
+ * answer which of them admitted an effect; one that cannot is evidence about
8
+ * an action with no evidence about the door it came through.
9
+ *
10
+ * The identity is of the *configured logical boundary*, not of the process or
11
+ * the container: restarting a container, rescheduling a pod or scaling a
12
+ * deployment to thirty replicas leaves it unchanged, because nothing
13
+ * ephemeral goes into it. That is also why the derivation below reads
14
+ * configuration rather than the machine: a boundary id that moved when a pod
15
+ * did would be an instance id wearing a boundary's name, and an operator
16
+ * grouping policy by boundary would be grouping by nothing.
17
+ */
18
+ /** The conformance profile this boundary answers for. */
19
+ export const BOUNDARY_CONFORMANCE = "agent-safe-intent-v1";
20
+ export const BOUNDARY_PROTOCOL = "agent-safe.intent/1";
21
+ /** A derived id wears a prefix so it is never mistaken for one an operator chose. */
22
+ export const DERIVED_BOUNDARY_PREFIX = "bd_";
23
+ export const BOUNDARY_ENVIRONMENT = {
24
+ boundaryId: "AGENTSAFE_BOUNDARY_ID",
25
+ clusterId: "AGENTSAFE_CLUSTER_ID",
26
+ namespace: "AGENTSAFE_NAMESPACE",
27
+ region: "AGENTSAFE_REGION",
28
+ workloadId: "AGENTSAFE_WORKLOAD_ID",
29
+ containerId: "AGENTSAFE_CONTAINER_ID",
30
+ podId: "AGENTSAFE_POD_ID",
31
+ nodeId: "AGENTSAFE_NODE_ID",
32
+ };
33
+ /**
34
+ * The shape a value must have to be one of these. A variable holding anything
35
+ * else is no value rather than a guess, the same way an unrecognised
36
+ * `AGENTSAFE_SURFACE` is no surface.
37
+ */
38
+ const TOKEN = /^[a-z0-9][\w.:/-]*$/i;
39
+ const MAX_TOKEN = 200;
40
+ function token(value) {
41
+ const trimmed = value?.trim();
42
+ // An empty string needs no test of its own: the pattern requires a first
43
+ // character, so `""` fails it like any other malformed value.
44
+ if (trimmed === undefined || trimmed.length > MAX_TOKEN)
45
+ return null;
46
+ return TOKEN.test(trimmed) ? trimmed : null;
47
+ }
48
+ function present(value) {
49
+ return Object.values(value).some((entry) => entry !== null) ? value : null;
50
+ }
51
+ /**
52
+ * The separator between the derivation's parts. It is not decoration: two
53
+ * different configurations must not be able to join into the same string.
54
+ */
55
+ const DERIVATION_SEPARATOR = "\n";
56
+ /**
57
+ * A boundary nobody named, from the settings that define what it is: what it
58
+ * was installed as, which deployment it serves, and what it stands in front
59
+ * of. Two gateways configured alike are the same boundary and share an id;
60
+ * one pointed at a different upstream or a different environment is a
61
+ * different boundary and does not. No hostname, address, user or container id
62
+ * reaches the digest, so the id is stable across restarts and carries nothing
63
+ * about the host into evidence.
64
+ *
65
+ * The derivation is a compatibility contract, pinned by a vector in the
66
+ * tests: changing it would silently re-partition the evidence of every
67
+ * deployment that never named its boundary.
68
+ */
69
+ function derive(facts) {
70
+ const material = [
71
+ facts.deploymentType ?? "unknown",
72
+ facts.environment ?? "",
73
+ facts.upstreamOrigin ?? "",
74
+ ].join(DERIVATION_SEPARATOR);
75
+ const digest = createHash("sha256").update(material).digest("hex");
76
+ return `${DERIVED_BOUNDARY_PREFIX}${digest.slice(0, 16)}`;
77
+ }
78
+ export function resolveBoundary(facts) {
79
+ const named = token(facts.env[BOUNDARY_ENVIRONMENT.boundaryId]) ?? token(facts.configuredId ?? undefined);
80
+ return {
81
+ boundaryId: named ?? derive(facts),
82
+ boundarySource: named === null ? "derived" : "configured",
83
+ agentsafeVersion: facts.version,
84
+ protocolVersion: BOUNDARY_PROTOCOL,
85
+ conformanceVersion: BOUNDARY_CONFORMANCE,
86
+ deploymentType: facts.deploymentType ?? "unknown",
87
+ environment: token(facts.environment ?? undefined),
88
+ placement: present({
89
+ clusterId: token(facts.env[BOUNDARY_ENVIRONMENT.clusterId]),
90
+ namespace: token(facts.env[BOUNDARY_ENVIRONMENT.namespace]),
91
+ region: token(facts.env[BOUNDARY_ENVIRONMENT.region]),
92
+ workloadId: token(facts.env[BOUNDARY_ENVIRONMENT.workloadId]),
93
+ }),
94
+ instance: present({
95
+ containerId: token(facts.env[BOUNDARY_ENVIRONMENT.containerId]),
96
+ podId: token(facts.env[BOUNDARY_ENVIRONMENT.podId]),
97
+ nodeId: token(facts.env[BOUNDARY_ENVIRONMENT.nodeId]),
98
+ }),
99
+ };
100
+ }
101
+ /**
102
+ * The boundary as an intent binds it. The instance is left out deliberately:
103
+ * what reaches signed evidence is the boundary, and the boundary is not the
104
+ * container it happens to be running in.
105
+ */
106
+ export function boundarySignal(boundary) {
107
+ const placement = boundary.placement;
108
+ const stable = placement === null
109
+ ? {}
110
+ : {
111
+ ...(placement.clusterId === null ? {} : { cluster_id: placement.clusterId }),
112
+ ...(placement.namespace === null ? {} : { namespace: placement.namespace }),
113
+ ...(placement.region === null ? {} : { region: placement.region }),
114
+ ...(placement.workloadId === null ? {} : { workload_id: placement.workloadId }),
115
+ };
116
+ return {
117
+ boundary_id: boundary.boundaryId,
118
+ agentsafe_version: boundary.agentsafeVersion,
119
+ protocol_version: BOUNDARY_PROTOCOL,
120
+ deployment_type: boundary.deploymentType,
121
+ ...(boundary.environment === null ? {} : { environment: boundary.environment }),
122
+ conformance_version: boundary.conformanceVersion,
123
+ ...(Object.keys(stable).length === 0 ? {} : { placement: stable }),
124
+ };
125
+ }
126
+ //# sourceMappingURL=BoundaryIdentity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BoundaryIdentity.js","sourceRoot":"","sources":["../../src/boundary/BoundaryIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC;;;;;;;;;;;;;;;GAeG;AAEH,yDAAyD;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAE3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEvD,qFAAqF;AACrF,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,CAAC;AAE7C,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,UAAU,EAAE,uBAAuB;IACnC,SAAS,EAAE,sBAAsB;IACjC,SAAS,EAAE,qBAAqB;IAChC,MAAM,EAAE,kBAAkB;IAC1B,UAAU,EAAE,uBAAuB;IACnC,WAAW,EAAE,wBAAwB;IACrC,KAAK,EAAE,kBAAkB;IACzB,MAAM,EAAE,mBAAmB;CACnB,CAAC;AAEX;;;;GAIG;AACH,MAAM,KAAK,GAAG,sBAAsB,CAAC;AACrC,MAAM,SAAS,GAAG,GAAG,CAAC;AAqDtB,SAAS,KAAK,CAAC,KAAyB;IACtC,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC;IAC9B,yEAAyE;IACzE,8DAA8D;IAC9D,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS;QAAE,OAAO,IAAI,CAAC;IACrE,OAAO,KAAK,CAAC,IAAI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AC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,CAAC;YAC3E,GAAG,CAAC,SAAS,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC;YAClE,GAAG,CAAC,SAAS,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,CAAC,UAAU,EAAE,CAAC;SAChF,CAAC;IACR,OAAO;QACL,WAAW,EAAE,QAAQ,CAAC,UAAU;QAChC,iBAAiB,EAAE,QAAQ,CAAC,gBAAgB;QAC5C,gBAAgB,EAAE,iBAAiB;QACnC,eAAe,EAAE,QAAQ,CAAC,cAAc;QACxC,GAAG,CAAC,QAAQ,CAAC,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC/E,mBAAmB,EAAE,QAAQ,CAAC,kBAAkB;QAChD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;KACnE,CAAC;AACJ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { CliProcess } from "./CliProcess.js";
2
2
  /** The commands this module owns; the executor's own are dispatched by the entry. */
3
- export declare const GATEWAY_COMMANDS: readonly ["init", "proxy", "gateway", "run", "intercept", "status", "doctor", "test", "config", "login", "logout", "version", "help"];
3
+ export declare const GATEWAY_COMMANDS: readonly ["init", "proxy", "gateway", "run", "intercept", "status", "doctor", "test", "identity", "config", "login", "logout", "version", "help"];
4
4
  export type GatewayCommand = (typeof GATEWAY_COMMANDS)[number];
5
5
  export declare function isGatewayCommand(command: string | undefined): command is GatewayCommand;
6
6
  /** Runs one of the gateway commands; every one ends by calling `exit`. */
@@ -1 +1 @@
1
- {"version":3,"file":"Commands.d.ts","sourceRoot":"","sources":["../../src/cli/Commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAWlD,qFAAqF;AACrF,eAAO,MAAM,gBAAgB,uIAcnB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,IAAI,cAAc,CAEvF;AAED,0EAA0E;AAC1E,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,EAAE,UAAU,GACb,OAAO,CAAC,IAAI,CAAC,CAwCf"}
1
+ {"version":3,"file":"Commands.d.ts","sourceRoot":"","sources":["../../src/cli/Commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAYlD,qFAAqF;AACrF,eAAO,MAAM,gBAAgB,mJAenB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,IAAI,cAAc,CAEvF;AAED,0EAA0E;AAC1E,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,EAAE,UAAU,GACb,OAAO,CAAC,IAAI,CAAC,CA2Cf"}
@@ -1,6 +1,7 @@
1
1
  import { packageVersion } from "../Version.js";
2
2
  import { runConfig } from "./ConfigCommand.js";
3
3
  import { runDoctor } from "./Doctor.js";
4
+ import { runIdentity } from "./Identity.js";
4
5
  import { usage } from "./Help.js";
5
6
  import { runInit } from "./Init.js";
6
7
  import { runIntercept } from "./Intercept.js";
@@ -18,6 +19,7 @@ export const GATEWAY_COMMANDS = [
18
19
  "status",
19
20
  "doctor",
20
21
  "test",
22
+ "identity",
21
23
  "config",
22
24
  "login",
23
25
  "logout",
@@ -47,6 +49,9 @@ export async function runGatewayCommand(command, argv, io) {
47
49
  case "doctor":
48
50
  await runDoctor(io, argv);
49
51
  return;
52
+ case "identity":
53
+ runIdentity(io, argv);
54
+ return;
50
55
  case "test":
51
56
  await runTest(io, argv);
52
57
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"Commands.js","sourceRoot":"","sources":["../../src/cli/Commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,qFAAqF;AACrF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,MAAM;IACN,OAAO;IACP,SAAS;IACT,KAAK;IACL,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,SAAS;IACT,MAAM;CACE,CAAC;AAIX,MAAM,UAAU,gBAAgB,CAAC,OAA2B;IAC1D,OA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MAAM,CAsC7C"}
1
+ {"version":3,"file":"Help.d.ts","sourceRoot":"","sources":["../../src/cli/Help.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAuC7C"}
package/dist/cli/Help.js CHANGED
@@ -12,6 +12,7 @@ export function usage(version) {
12
12
  " intercept Run the transparent interceptor: observe every destination, govern the listed ones",
13
13
  " status Ask a running gateway what it is doing",
14
14
  " doctor Check the binary, configuration, upstream, Decionis and credentials",
15
+ " identity Print which enforcement boundary this process is",
15
16
  " test Show what reaches a target without the boundary and what enforcement prevents",
16
17
  " config Print the effective configuration and where each setting came from",
17
18
  " login | logout Store or remove a Decionis key for this user (--provision mints a free workspace)",
@@ -1 +1 @@
1
- {"version":3,"file":"Help.js","sourceRoot":"","sources":["../../src/cli/Help.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,UAAU,KAAK,CAAC,OAAe;IACnC,OAAO;QACL,aAAa,OAAO,2DAA2D;QAC/E,EAAE;QACF,sCAAsC;QACtC,EAAE;QACF,SAAS;QACT,gEAAgE;QAChE,8FAA8F;QAC9F,uFAAuF;QACvF,2GAA2G;QAC3G,+DAA+D;QAC/D,4FAA4F;QAC5F,sGAAsG;QACtG,2FAA2F;QAC3F,0GAA0G;QAC1G,0CAA0C;QAC1C,EAAE;QACF,UAAU;QACV,2DAA2D;QAC3D,0DAA0D;QAC1D,oFAAoF;QACpF,EAAE;QACF,kBAAkB;QAClB,uEAAuE;QACvE,iFAAiF;QACjF,EAAE;QACF,8FAA8F;QAC9F,oGAAoG;QACpG,EAAE;QACF,0DAA0D;QAC1D,uEAAuE;QACvE,uEAAuE;QACvE,mDAAmD;QACnD,EAAE;QACF,oEAAoE;QACpE,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"Help.js","sourceRoot":"","sources":["../../src/cli/Help.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,UAAU,KAAK,CAAC,OAAe;IACnC,OAAO;QACL,aAAa,OAAO,2DAA2D;QAC/E,EAAE;QACF,sCAAsC;QACtC,EAAE;QACF,SAAS;QACT,gEAAgE;QAChE,8FAA8F;QAC9F,uFAAuF;QACvF,2GAA2G;QAC3G,+DAA+D;QAC/D,4FAA4F;QAC5F,yEAAyE;QACzE,sGAAsG;QACtG,2FAA2F;QAC3F,0GAA0G;QAC1G,0CAA0C;QAC1C,EAAE;QACF,UAAU;QACV,2DAA2D;QAC3D,0DAA0D;QAC1D,oFAAoF;QACpF,EAAE;QACF,kBAAkB;QAClB,uEAAuE;QACvE,iFAAiF;QACjF,EAAE;QACF,8FAA8F;QAC9F,oGAAoG;QACpG,EAAE;QACF,0DAA0D;QAC1D,uEAAuE;QACvE,uEAAuE;QACvE,mDAAmD;QACnD,EAAE;QACF,oEAAoE;QACpE,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { type BoundaryInstance, type BoundaryPlacement, type EnforcementBoundary } from "../boundary/BoundaryIdentity.js";
2
+ import type { WorkloadSignal } from "@decionis/agent-safe-pipeline";
3
+ import type { CliProcess } from "./CliProcess.js";
4
+ export declare const IDENTITY_ARGUMENTS: {
5
+ readonly valued: readonly ["upstream", "port", "listen", "mode", "failure-policy", "authority", "config"];
6
+ readonly flags: readonly ["verbose", "json"];
7
+ };
8
+ export declare const IDENTITY_REPORT_VERSION = "agent-safe.boundary-identity/1";
9
+ export interface IdentityReport {
10
+ readonly version: typeof IDENTITY_REPORT_VERSION;
11
+ readonly boundary_id: string;
12
+ readonly boundary_source: "configured" | "derived";
13
+ readonly agentsafe_version: string;
14
+ readonly protocol_version: string;
15
+ readonly conformance_version: string;
16
+ readonly deployment_type: string;
17
+ readonly environment: string | null;
18
+ readonly placement: BoundaryPlacement | null;
19
+ readonly instance: BoundaryInstance | null;
20
+ /**
21
+ * What software this boundary stands in front of, as a runtime reported it,
22
+ * with the trust source beside it. Null when nothing trustworthy described
23
+ * it, which is an answer and not a gap.
24
+ */
25
+ readonly workload: WorkloadSignal | null;
26
+ /**
27
+ * Whether the boundary was resolved from a usable gateway configuration.
28
+ * Without one there is no upstream to stand in front of, so the derived id
29
+ * is the one this process would use if nothing else changed — worth saying
30
+ * out loud rather than printing as if it were settled.
31
+ */
32
+ readonly configured: boolean;
33
+ }
34
+ export declare function identityReport(boundary: EnforcementBoundary, workload: WorkloadSignal | null, configured: boolean): IdentityReport;
35
+ export declare function renderIdentityReport(report: IdentityReport, options: {
36
+ readonly color: boolean;
37
+ }): string;
38
+ /**
39
+ * `agentsafe identity`: which enforcement boundary this process is.
40
+ *
41
+ * An estate running many gateways needs to know which of them admitted an
42
+ * effect, and an operator needs to see that the answer is stable before
43
+ * relying on it. The id printed here is the one bound into every intent this
44
+ * process captures, so it is the one a Decision Dossier will name.
45
+ */
46
+ export declare function runIdentity(io: CliProcess, argv: readonly string[]): IdentityReport | null;
47
+ //# sourceMappingURL=Identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Identity.d.ts","sourceRoot":"","sources":["../../src/cli/Identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACzB,MAAM,iCAAiC,CAAC;AAMzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AAEX,eAAO,MAAM,uBAAuB,mCAAmC,CAAC;AAExE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,OAAO,uBAAuB,CAAC;IACjD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,EAAE,YAAY,GAAG,SAAS,CAA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